diff --git a/lib/lib-es6-ts.js b/lib/lib-es6-ts.js index 05cb410c..68cdba5d 100644 --- a/lib/lib-es6-ts.js +++ b/lib/lib-es6-ts.js @@ -5,5 +5,5 @@ // This is a generated file from lib.es6.d.ts -define([], function() { return { contents: "/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved. \r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0 \r\n \r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, \r\nMERCHANTABLITY OR NON-INFRINGEMENT. \r\n \r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n\r\n/// \r\n/////////////////////////////\r\n/// ECMAScript APIs\r\n/////////////////////////////\r\n\r\ndeclare const NaN: number;\r\ndeclare const Infinity: number;\r\n\r\n/**\r\n * Evaluates JavaScript code and executes it.\r\n * @param x A String value that contains valid JavaScript code.\r\n */\r\ndeclare function eval(x: string): any;\r\n\r\n/**\r\n * Converts A string to an integer.\r\n * @param s A string to convert into a number.\r\n * @param radix A value between 2 and 36 that specifies the base of the number in numString.\r\n * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\n * All other strings are considered decimal.\r\n */\r\ndeclare function parseInt(s: string, radix?: number): number;\r\n\r\n/**\r\n * Converts a string to a floating-point number.\r\n * @param string A string that contains a floating-point number.\r\n */\r\ndeclare function parseFloat(string: string): number;\r\n\r\n/**\r\n * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number).\r\n * @param number A numeric value.\r\n */\r\ndeclare function isNaN(number: number): boolean;\r\n\r\n/**\r\n * Determines whether a supplied number is finite.\r\n * @param number Any numeric value.\r\n */\r\ndeclare function isFinite(number: number): boolean;\r\n\r\n/**\r\n * Gets the unencoded version of an encoded Uniform Resource Identifier (URI).\r\n * @param encodedURI A value representing an encoded URI.\r\n */\r\ndeclare function decodeURI(encodedURI: string): string;\r\n\r\n/**\r\n * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI).\r\n * @param encodedURIComponent A value representing an encoded URI component.\r\n */\r\ndeclare function decodeURIComponent(encodedURIComponent: string): string;\r\n\r\n/**\r\n * Encodes a text string as a valid Uniform Resource Identifier (URI)\r\n * @param uri A value representing an encoded URI.\r\n */\r\ndeclare function encodeURI(uri: string): string;\r\n\r\n/**\r\n * Encodes a text string as a valid component of a Uniform Resource Identifier (URI).\r\n * @param uriComponent A value representing an encoded URI component.\r\n */\r\ndeclare function encodeURIComponent(uriComponent: string): string;\r\n\r\ninterface PropertyDescriptor {\r\n configurable?: boolean;\r\n enumerable?: boolean;\r\n value?: any;\r\n writable?: boolean;\r\n get? (): any;\r\n set? (v: any): void;\r\n}\r\n\r\ninterface PropertyDescriptorMap {\r\n [s: string]: PropertyDescriptor;\r\n}\r\n\r\ninterface Object {\r\n /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */\r\n constructor: Function;\r\n\r\n /** Returns a string representation of an object. */\r\n toString(): string;\r\n\r\n /** Returns a date converted to a string using the current locale. */\r\n toLocaleString(): string;\r\n\r\n /** Returns the primitive value of the specified object. */\r\n valueOf(): Object;\r\n\r\n /**\r\n * Determines whether an object has a property with the specified name.\r\n * @param v A property name.\r\n */\r\n hasOwnProperty(v: string): boolean;\r\n\r\n /**\r\n * Determines whether an object exists in another object's prototype chain.\r\n * @param v Another object whose prototype chain is to be checked.\r\n */\r\n isPrototypeOf(v: Object): boolean;\r\n\r\n /**\r\n * Determines whether a specified property is enumerable.\r\n * @param v A property name.\r\n */\r\n propertyIsEnumerable(v: string): boolean;\r\n}\r\n\r\ninterface ObjectConstructor {\r\n new (value?: any): Object;\r\n (): any;\r\n (value: any): any;\r\n\r\n /** A reference to the prototype for a class of objects. */\r\n readonly prototype: Object;\r\n\r\n /**\r\n * Returns the prototype of an object.\r\n * @param o The object that references the prototype.\r\n */\r\n getPrototypeOf(o: any): any;\r\n\r\n /**\r\n * Gets the own property descriptor of the specified object.\r\n * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype.\r\n * @param o Object that contains the property.\r\n * @param p Name of the property.\r\n */\r\n getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor;\r\n\r\n /**\r\n * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly\r\n * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions.\r\n * @param o Object that contains the own properties.\r\n */\r\n getOwnPropertyNames(o: any): string[];\r\n\r\n /**\r\n * Creates an object that has null prototype.\r\n * @param o Object to use as a prototype. May be null\r\n */\r\n create(o: null): any;\r\n\r\n /**\r\n * Creates an object that has the specified prototype, and that optionally contains specified properties.\r\n * @param o Object to use as a prototype. May be null\r\n */\r\n create(o: T): T;\r\n\r\n /**\r\n * Creates an object that has the specified prototype, and that optionally contains specified properties.\r\n * @param o Object to use as a prototype. May be null\r\n * @param properties JavaScript object that contains one or more property descriptors.\r\n */\r\n create(o: any, properties: PropertyDescriptorMap): any;\r\n\r\n /**\r\n * Adds a property to an object, or modifies attributes of an existing property.\r\n * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object.\r\n * @param p The property name.\r\n * @param attributes Descriptor for the property. It can be for a data property or an accessor property.\r\n */\r\n defineProperty(o: any, p: string, attributes: PropertyDescriptor): any;\r\n\r\n /**\r\n * Adds one or more properties to an object, and/or modifies attributes of existing properties.\r\n * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object.\r\n * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property.\r\n */\r\n defineProperties(o: any, properties: PropertyDescriptorMap): any;\r\n\r\n /**\r\n * Prevents the modification of attributes of existing properties, and prevents the addition of new properties.\r\n * @param o Object on which to lock the attributes.\r\n */\r\n seal(o: T): T;\r\n\r\n /**\r\n * Prevents the modification of existing property attributes and values, and prevents the addition of new properties.\r\n * @param o Object on which to lock the attributes.\r\n */\r\n freeze(o: T): T;\r\n\r\n /**\r\n * Prevents the addition of new properties to an object.\r\n * @param o Object to make non-extensible.\r\n */\r\n preventExtensions(o: T): T;\r\n\r\n /**\r\n * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object.\r\n * @param o Object to test.\r\n */\r\n isSealed(o: any): boolean;\r\n\r\n /**\r\n * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object.\r\n * @param o Object to test.\r\n */\r\n isFrozen(o: any): boolean;\r\n\r\n /**\r\n * Returns a value that indicates whether new properties can be added to an object.\r\n * @param o Object to test.\r\n */\r\n isExtensible(o: any): boolean;\r\n\r\n /**\r\n * Returns the names of the enumerable properties and methods of an object.\r\n * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.\r\n */\r\n keys(o: any): string[];\r\n}\r\n\r\n/**\r\n * Provides functionality common to all JavaScript objects.\r\n */\r\ndeclare const Object: ObjectConstructor;\r\n\r\n/**\r\n * Creates a new function.\r\n */\r\ninterface Function {\r\n /**\r\n * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function.\r\n * @param thisArg The object to be used as the this object.\r\n * @param argArray A set of arguments to be passed to the function.\r\n */\r\n apply(this: Function, thisArg: any, argArray?: any): any;\r\n\r\n /**\r\n * Calls a method of an object, substituting another object for the current object.\r\n * @param thisArg The object to be used as the current object.\r\n * @param argArray A list of arguments to be passed to the method.\r\n */\r\n call(this: Function, thisArg: any, ...argArray: any[]): any;\r\n\r\n /**\r\n * For a given function, creates a bound function that has the same body as the original function.\r\n * The this object of the bound function is associated with the specified object, and has the specified initial parameters.\r\n * @param thisArg An object to which the this keyword can refer inside the new function.\r\n * @param argArray A list of arguments to be passed to the new function.\r\n */\r\n bind(this: Function, thisArg: any, ...argArray: any[]): any;\r\n\r\n prototype: any;\r\n readonly length: number;\r\n\r\n // Non-standard extensions\r\n arguments: any;\r\n caller: Function;\r\n}\r\n\r\ninterface FunctionConstructor {\r\n /**\r\n * Creates a new function.\r\n * @param args A list of arguments the function accepts.\r\n */\r\n new (...args: string[]): Function;\r\n (...args: string[]): Function;\r\n readonly prototype: Function;\r\n}\r\n\r\ndeclare const Function: FunctionConstructor;\r\n\r\ninterface IArguments {\r\n [index: number]: any;\r\n length: number;\r\n callee: Function;\r\n}\r\n\r\ninterface String {\r\n /** Returns a string representation of a string. */\r\n toString(): string;\r\n\r\n /**\r\n * Returns the character at the specified index.\r\n * @param pos The zero-based index of the desired character.\r\n */\r\n charAt(pos: number): string;\r\n\r\n /**\r\n * Returns the Unicode value of the character at the specified location.\r\n * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned.\r\n */\r\n charCodeAt(index: number): number;\r\n\r\n /**\r\n * Returns a string that contains the concatenation of two or more strings.\r\n * @param strings The strings to append to the end of the string.\r\n */\r\n concat(...strings: string[]): string;\r\n\r\n /**\r\n * Returns the position of the first occurrence of a substring.\r\n * @param searchString The substring to search for in the string\r\n * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string.\r\n */\r\n indexOf(searchString: string, position?: number): number;\r\n\r\n /**\r\n * Returns the last occurrence of a substring in the string.\r\n * @param searchString The substring to search for.\r\n * @param position The index at which to begin searching. If omitted, the search begins at the end of the string.\r\n */\r\n lastIndexOf(searchString: string, position?: number): number;\r\n\r\n /**\r\n * Determines whether two strings are equivalent in the current locale.\r\n * @param that String to compare to target string\r\n */\r\n localeCompare(that: string): number;\r\n\r\n /**\r\n * Matches a string with a regular expression, and returns an array containing the results of that search.\r\n * @param regexp A variable name or string literal containing the regular expression pattern and flags.\r\n */\r\n match(regexp: string): RegExpMatchArray | null;\r\n\r\n /**\r\n * Matches a string with a regular expression, and returns an array containing the results of that search.\r\n * @param regexp A regular expression object that contains the regular expression pattern and applicable flags.\r\n */\r\n match(regexp: RegExp): RegExpMatchArray | null;\r\n\r\n /**\r\n * Replaces text in a string, using a regular expression or search string.\r\n * @param searchValue A string that represents the regular expression.\r\n * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string.\r\n */\r\n replace(searchValue: string, replaceValue: string): string;\r\n\r\n /**\r\n * Replaces text in a string, using a regular expression or search string.\r\n * @param searchValue A string that represents the regular expression.\r\n * @param replacer A function that returns the replacement text.\r\n */\r\n replace(searchValue: string, replacer: (substring: string, ...args: any[]) => string): string;\r\n\r\n /**\r\n * Replaces text in a string, using a regular expression or search string.\r\n * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags.\r\n * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string.\r\n */\r\n replace(searchValue: RegExp, replaceValue: string): string;\r\n\r\n /**\r\n * Replaces text in a string, using a regular expression or search string.\r\n * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags\r\n * @param replacer A function that returns the replacement text.\r\n */\r\n replace(searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string;\r\n\r\n /**\r\n * Finds the first substring match in a regular expression search.\r\n * @param regexp The regular expression pattern and applicable flags.\r\n */\r\n search(regexp: string): number;\r\n\r\n /**\r\n * Finds the first substring match in a regular expression search.\r\n * @param regexp The regular expression pattern and applicable flags.\r\n */\r\n search(regexp: RegExp): number;\r\n\r\n /**\r\n * Returns a section of a string.\r\n * @param start The index to the beginning of the specified portion of stringObj.\r\n * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end.\r\n * If this value is not specified, the substring continues to the end of stringObj.\r\n */\r\n slice(start?: number, end?: number): string;\r\n\r\n /**\r\n * Split a string into substrings using the specified separator and return them as an array.\r\n * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned.\r\n * @param limit A value used to limit the number of elements returned in the array.\r\n */\r\n split(separator: string, limit?: number): string[];\r\n\r\n /**\r\n * Split a string into substrings using the specified separator and return them as an array.\r\n * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned.\r\n * @param limit A value used to limit the number of elements returned in the array.\r\n */\r\n split(separator: RegExp, limit?: number): string[];\r\n\r\n /**\r\n * Returns the substring at the specified location within a String object.\r\n * @param start The zero-based index number indicating the beginning of the substring.\r\n * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end.\r\n * If end is omitted, the characters from start through the end of the original string are returned.\r\n */\r\n substring(start: number, end?: number): string;\r\n\r\n /** Converts all the alphabetic characters in a string to lowercase. */\r\n toLowerCase(): string;\r\n\r\n /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */\r\n toLocaleLowerCase(): string;\r\n\r\n /** Converts all the alphabetic characters in a string to uppercase. */\r\n toUpperCase(): string;\r\n\r\n /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */\r\n toLocaleUpperCase(): string;\r\n\r\n /** Removes the leading and trailing white space and line terminator characters from a string. */\r\n trim(): string;\r\n\r\n /** Returns the length of a String object. */\r\n readonly length: number;\r\n\r\n // IE extensions\r\n /**\r\n * Gets a substring beginning at the specified location and having the specified length.\r\n * @param from The starting position of the desired substring. The index of the first character in the string is zero.\r\n * @param length The number of characters to include in the returned substring.\r\n */\r\n substr(from: number, length?: number): string;\r\n\r\n /** Returns the primitive value of the specified object. */\r\n valueOf(): string;\r\n\r\n readonly [index: number]: string;\r\n}\r\n\r\ninterface StringConstructor {\r\n new (value?: any): String;\r\n (value?: any): string;\r\n readonly prototype: String;\r\n fromCharCode(...codes: number[]): string;\r\n}\r\n\r\n/**\r\n * Allows manipulation and formatting of text strings and determination and location of substrings within strings.\r\n */\r\ndeclare const String: StringConstructor;\r\n\r\ninterface Boolean {\r\n /** Returns the primitive value of the specified object. */\r\n valueOf(): boolean;\r\n}\r\n\r\ninterface BooleanConstructor {\r\n new (value?: any): Boolean;\r\n (value?: any): boolean;\r\n readonly prototype: Boolean;\r\n}\r\n\r\ndeclare const Boolean: BooleanConstructor;\r\n\r\ninterface Number {\r\n /**\r\n * Returns a string representation of an object.\r\n * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers.\r\n */\r\n toString(radix?: number): string;\r\n\r\n /**\r\n * Returns a string representing a number in fixed-point notation.\r\n * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive.\r\n */\r\n toFixed(fractionDigits?: number): string;\r\n\r\n /**\r\n * Returns a string containing a number represented in exponential notation.\r\n * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive.\r\n */\r\n toExponential(fractionDigits?: number): string;\r\n\r\n /**\r\n * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits.\r\n * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive.\r\n */\r\n toPrecision(precision?: number): string;\r\n\r\n /** Returns the primitive value of the specified object. */\r\n valueOf(): number;\r\n}\r\n\r\ninterface NumberConstructor {\r\n new (value?: any): Number;\r\n (value?: any): number;\r\n readonly prototype: Number;\r\n\r\n /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */\r\n readonly MAX_VALUE: number;\r\n\r\n /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */\r\n readonly MIN_VALUE: number;\r\n\r\n /**\r\n * A value that is not a number.\r\n * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function.\r\n */\r\n readonly NaN: number;\r\n\r\n /**\r\n * A value that is less than the largest negative number that can be represented in JavaScript.\r\n * JavaScript displays NEGATIVE_INFINITY values as -infinity.\r\n */\r\n readonly NEGATIVE_INFINITY: number;\r\n\r\n /**\r\n * A value greater than the largest number that can be represented in JavaScript.\r\n * JavaScript displays POSITIVE_INFINITY values as infinity.\r\n */\r\n readonly POSITIVE_INFINITY: number;\r\n}\r\n\r\n/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */\r\ndeclare const Number: NumberConstructor;\r\n\r\ninterface TemplateStringsArray extends ReadonlyArray {\r\n readonly raw: ReadonlyArray\r\n}\r\n\r\ninterface Math {\r\n /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */\r\n readonly E: number;\r\n /** The natural logarithm of 10. */\r\n readonly LN10: number;\r\n /** The natural logarithm of 2. */\r\n readonly LN2: number;\r\n /** The base-2 logarithm of e. */\r\n readonly LOG2E: number;\r\n /** The base-10 logarithm of e. */\r\n readonly LOG10E: number;\r\n /** Pi. This is the ratio of the circumference of a circle to its diameter. */\r\n readonly PI: number;\r\n /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */\r\n readonly SQRT1_2: number;\r\n /** The square root of 2. */\r\n readonly SQRT2: number;\r\n /**\r\n * Returns the absolute value of a number (the value without regard to whether it is positive or negative).\r\n * For example, the absolute value of -5 is the same as the absolute value of 5.\r\n * @param x A numeric expression for which the absolute value is needed.\r\n */\r\n abs(x: number): number;\r\n /**\r\n * Returns the arc cosine (or inverse cosine) of a number.\r\n * @param x A numeric expression.\r\n */\r\n acos(x: number): number;\r\n /**\r\n * Returns the arcsine of a number.\r\n * @param x A numeric expression.\r\n */\r\n asin(x: number): number;\r\n /**\r\n * Returns the arctangent of a number.\r\n * @param x A numeric expression for which the arctangent is needed.\r\n */\r\n atan(x: number): number;\r\n /**\r\n * Returns the angle (in radians) from the X axis to a point.\r\n * @param y A numeric expression representing the cartesian y-coordinate.\r\n * @param x A numeric expression representing the cartesian x-coordinate.\r\n */\r\n atan2(y: number, x: number): number;\r\n /**\r\n * Returns the smallest number greater than or equal to its numeric argument.\r\n * @param x A numeric expression.\r\n */\r\n ceil(x: number): number;\r\n /**\r\n * Returns the cosine of a number.\r\n * @param x A numeric expression that contains an angle measured in radians.\r\n */\r\n cos(x: number): number;\r\n /**\r\n * Returns e (the base of natural logarithms) raised to a power.\r\n * @param x A numeric expression representing the power of e.\r\n */\r\n exp(x: number): number;\r\n /**\r\n * Returns the greatest number less than or equal to its numeric argument.\r\n * @param x A numeric expression.\r\n */\r\n floor(x: number): number;\r\n /**\r\n * Returns the natural logarithm (base e) of a number.\r\n * @param x A numeric expression.\r\n */\r\n log(x: number): number;\r\n /**\r\n * Returns the larger of a set of supplied numeric expressions.\r\n * @param values Numeric expressions to be evaluated.\r\n */\r\n max(...values: number[]): number;\r\n /**\r\n * Returns the smaller of a set of supplied numeric expressions.\r\n * @param values Numeric expressions to be evaluated.\r\n */\r\n min(...values: number[]): number;\r\n /**\r\n * Returns the value of a base expression taken to a specified power.\r\n * @param x The base value of the expression.\r\n * @param y The exponent value of the expression.\r\n */\r\n pow(x: number, y: number): number;\r\n /** Returns a pseudorandom number between 0 and 1. */\r\n random(): number;\r\n /**\r\n * Returns a supplied numeric expression rounded to the nearest number.\r\n * @param x The value to be rounded to the nearest number.\r\n */\r\n round(x: number): number;\r\n /**\r\n * Returns the sine of a number.\r\n * @param x A numeric expression that contains an angle measured in radians.\r\n */\r\n sin(x: number): number;\r\n /**\r\n * Returns the square root of a number.\r\n * @param x A numeric expression.\r\n */\r\n sqrt(x: number): number;\r\n /**\r\n * Returns the tangent of a number.\r\n * @param x A numeric expression that contains an angle measured in radians.\r\n */\r\n tan(x: number): number;\r\n}\r\n/** An intrinsic object that provides basic mathematics functionality and constants. */\r\ndeclare const Math: Math;\r\n\r\n/** Enables basic storage and retrieval of dates and times. */\r\ninterface Date {\r\n /** Returns a string representation of a date. The format of the string depends on the locale. */\r\n toString(): string;\r\n /** Returns a date as a string value. */\r\n toDateString(): string;\r\n /** Returns a time as a string value. */\r\n toTimeString(): string;\r\n /** Returns a value as a string value appropriate to the host environment's current locale. */\r\n toLocaleString(): string;\r\n /** Returns a date as a string value appropriate to the host environment's current locale. */\r\n toLocaleDateString(): string;\r\n /** Returns a time as a string value appropriate to the host environment's current locale. */\r\n toLocaleTimeString(): string;\r\n /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */\r\n valueOf(): number;\r\n /** Gets the time value in milliseconds. */\r\n getTime(): number;\r\n /** Gets the year, using local time. */\r\n getFullYear(): number;\r\n /** Gets the year using Universal Coordinated Time (UTC). */\r\n getUTCFullYear(): number;\r\n /** Gets the month, using local time. */\r\n getMonth(): number;\r\n /** Gets the month of a Date object using Universal Coordinated Time (UTC). */\r\n getUTCMonth(): number;\r\n /** Gets the day-of-the-month, using local time. */\r\n getDate(): number;\r\n /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */\r\n getUTCDate(): number;\r\n /** Gets the day of the week, using local time. */\r\n getDay(): number;\r\n /** Gets the day of the week using Universal Coordinated Time (UTC). */\r\n getUTCDay(): number;\r\n /** Gets the hours in a date, using local time. */\r\n getHours(): number;\r\n /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */\r\n getUTCHours(): number;\r\n /** Gets the minutes of a Date object, using local time. */\r\n getMinutes(): number;\r\n /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */\r\n getUTCMinutes(): number;\r\n /** Gets the seconds of a Date object, using local time. */\r\n getSeconds(): number;\r\n /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */\r\n getUTCSeconds(): number;\r\n /** Gets the milliseconds of a Date, using local time. */\r\n getMilliseconds(): number;\r\n /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */\r\n getUTCMilliseconds(): number;\r\n /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */\r\n getTimezoneOffset(): number;\r\n /**\r\n * Sets the date and time value in the Date object.\r\n * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT.\r\n */\r\n setTime(time: number): number;\r\n /**\r\n * Sets the milliseconds value in the Date object using local time.\r\n * @param ms A numeric value equal to the millisecond value.\r\n */\r\n setMilliseconds(ms: number): number;\r\n /**\r\n * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC).\r\n * @param ms A numeric value equal to the millisecond value.\r\n */\r\n setUTCMilliseconds(ms: number): number;\r\n\r\n /**\r\n * Sets the seconds value in the Date object using local time.\r\n * @param sec A numeric value equal to the seconds value.\r\n * @param ms A numeric value equal to the milliseconds value.\r\n */\r\n setSeconds(sec: number, ms?: number): number;\r\n /**\r\n * Sets the seconds value in the Date object using Universal Coordinated Time (UTC).\r\n * @param sec A numeric value equal to the seconds value.\r\n * @param ms A numeric value equal to the milliseconds value.\r\n */\r\n setUTCSeconds(sec: number, ms?: number): number;\r\n /**\r\n * Sets the minutes value in the Date object using local time.\r\n * @param min A numeric value equal to the minutes value.\r\n * @param sec A numeric value equal to the seconds value.\r\n * @param ms A numeric value equal to the milliseconds value.\r\n */\r\n setMinutes(min: number, sec?: number, ms?: number): number;\r\n /**\r\n * Sets the minutes value in the Date object using Universal Coordinated Time (UTC).\r\n * @param min A numeric value equal to the minutes value.\r\n * @param sec A numeric value equal to the seconds value.\r\n * @param ms A numeric value equal to the milliseconds value.\r\n */\r\n setUTCMinutes(min: number, sec?: number, ms?: number): number;\r\n /**\r\n * Sets the hour value in the Date object using local time.\r\n * @param hours A numeric value equal to the hours value.\r\n * @param min A numeric value equal to the minutes value.\r\n * @param sec A numeric value equal to the seconds value.\r\n * @param ms A numeric value equal to the milliseconds value.\r\n */\r\n setHours(hours: number, min?: number, sec?: number, ms?: number): number;\r\n /**\r\n * Sets the hours value in the Date object using Universal Coordinated Time (UTC).\r\n * @param hours A numeric value equal to the hours value.\r\n * @param min A numeric value equal to the minutes value.\r\n * @param sec A numeric value equal to the seconds value.\r\n * @param ms A numeric value equal to the milliseconds value.\r\n */\r\n setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number;\r\n /**\r\n * Sets the numeric day-of-the-month value of the Date object using local time.\r\n * @param date A numeric value equal to the day of the month.\r\n */\r\n setDate(date: number): number;\r\n /**\r\n * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC).\r\n * @param date A numeric value equal to the day of the month.\r\n */\r\n setUTCDate(date: number): number;\r\n /**\r\n * Sets the month value in the Date object using local time.\r\n * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively.\r\n * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used.\r\n */\r\n setMonth(month: number, date?: number): number;\r\n /**\r\n * Sets the month value in the Date object using Universal Coordinated Time (UTC).\r\n * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively.\r\n * @param date A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used.\r\n */\r\n setUTCMonth(month: number, date?: number): number;\r\n /**\r\n * Sets the year of the Date object using local time.\r\n * @param year A numeric value for the year.\r\n * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified.\r\n * @param date A numeric value equal for the day of the month.\r\n */\r\n setFullYear(year: number, month?: number, date?: number): number;\r\n /**\r\n * Sets the year value in the Date object using Universal Coordinated Time (UTC).\r\n * @param year A numeric value equal to the year.\r\n * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied.\r\n * @param date A numeric value equal to the day of the month.\r\n */\r\n setUTCFullYear(year: number, month?: number, date?: number): number;\r\n /** Returns a date converted to a string using Universal Coordinated Time (UTC). */\r\n toUTCString(): string;\r\n /** Returns a date as a string value in ISO format. */\r\n toISOString(): string;\r\n /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */\r\n toJSON(key?: any): string;\r\n}\r\n\r\ninterface DateConstructor {\r\n new (): Date;\r\n new (value: number): Date;\r\n new (value: string): Date;\r\n new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;\r\n (): string;\r\n readonly prototype: Date;\r\n /**\r\n * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970.\r\n * @param s A date string\r\n */\r\n parse(s: string): number;\r\n /**\r\n * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date.\r\n * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year.\r\n * @param month The month as an number between 0 and 11 (January to December).\r\n * @param date The date as an number between 1 and 31.\r\n * @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour.\r\n * @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes.\r\n * @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds.\r\n * @param ms An number from 0 to 999 that specifies the milliseconds.\r\n */\r\n UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number;\r\n now(): number;\r\n}\r\n\r\ndeclare const Date: DateConstructor;\r\n\r\ninterface RegExpMatchArray extends Array {\r\n index?: number;\r\n input?: string;\r\n}\r\n\r\ninterface RegExpExecArray extends Array {\r\n index: number;\r\n input: string;\r\n}\r\n\r\ninterface RegExp {\r\n /**\r\n * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search.\r\n * @param string The String object or string literal on which to perform the search.\r\n */\r\n exec(string: string): RegExpExecArray | null;\r\n\r\n /**\r\n * Returns a Boolean value that indicates whether or not a pattern exists in a searched string.\r\n * @param string String on which to perform the search.\r\n */\r\n test(string: string): boolean;\r\n\r\n /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */\r\n readonly source: string;\r\n\r\n /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */\r\n readonly global: boolean;\r\n\r\n /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */\r\n readonly ignoreCase: boolean;\r\n\r\n /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */\r\n readonly multiline: boolean;\r\n\r\n lastIndex: number;\r\n\r\n // Non-standard extensions\r\n compile(): this;\r\n}\r\n\r\ninterface RegExpConstructor {\r\n new (pattern: RegExp): RegExp;\r\n new (pattern: string, flags?: string): RegExp;\r\n (pattern: RegExp): RegExp;\r\n (pattern: string, flags?: string): RegExp;\r\n readonly prototype: RegExp;\r\n\r\n // Non-standard extensions\r\n $1: string;\r\n $2: string;\r\n $3: string;\r\n $4: string;\r\n $5: string;\r\n $6: string;\r\n $7: string;\r\n $8: string;\r\n $9: string;\r\n lastMatch: string;\r\n}\r\n\r\ndeclare const RegExp: RegExpConstructor;\r\n\r\ninterface Error {\r\n name: string;\r\n message: string;\r\n stack?: string;\r\n}\r\n\r\ninterface ErrorConstructor {\r\n new (message?: string): Error;\r\n (message?: string): Error;\r\n readonly prototype: Error;\r\n}\r\n\r\ndeclare const Error: ErrorConstructor;\r\n\r\ninterface EvalError extends Error {\r\n}\r\n\r\ninterface EvalErrorConstructor {\r\n new (message?: string): EvalError;\r\n (message?: string): EvalError;\r\n readonly prototype: EvalError;\r\n}\r\n\r\ndeclare const EvalError: EvalErrorConstructor;\r\n\r\ninterface RangeError extends Error {\r\n}\r\n\r\ninterface RangeErrorConstructor {\r\n new (message?: string): RangeError;\r\n (message?: string): RangeError;\r\n readonly prototype: RangeError;\r\n}\r\n\r\ndeclare const RangeError: RangeErrorConstructor;\r\n\r\ninterface ReferenceError extends Error {\r\n}\r\n\r\ninterface ReferenceErrorConstructor {\r\n new (message?: string): ReferenceError;\r\n (message?: string): ReferenceError;\r\n readonly prototype: ReferenceError;\r\n}\r\n\r\ndeclare const ReferenceError: ReferenceErrorConstructor;\r\n\r\ninterface SyntaxError extends Error {\r\n}\r\n\r\ninterface SyntaxErrorConstructor {\r\n new (message?: string): SyntaxError;\r\n (message?: string): SyntaxError;\r\n readonly prototype: SyntaxError;\r\n}\r\n\r\ndeclare const SyntaxError: SyntaxErrorConstructor;\r\n\r\ninterface TypeError extends Error {\r\n}\r\n\r\ninterface TypeErrorConstructor {\r\n new (message?: string): TypeError;\r\n (message?: string): TypeError;\r\n readonly prototype: TypeError;\r\n}\r\n\r\ndeclare const TypeError: TypeErrorConstructor;\r\n\r\ninterface URIError extends Error {\r\n}\r\n\r\ninterface URIErrorConstructor {\r\n new (message?: string): URIError;\r\n (message?: string): URIError;\r\n readonly prototype: URIError;\r\n}\r\n\r\ndeclare const URIError: URIErrorConstructor;\r\n\r\ninterface JSON {\r\n /**\r\n * Converts a JavaScript Object Notation (JSON) string into an object.\r\n * @param text A valid JSON string.\r\n * @param reviver A function that transforms the results. This function is called for each member of the object.\r\n * If a member contains nested objects, the nested objects are transformed before the parent object is.\r\n */\r\n parse(text: string, reviver?: (key: any, value: any) => any): any;\r\n /**\r\n * Converts a JavaScript value to a JavaScript Object Notation (JSON) string.\r\n * @param value A JavaScript value, usually an object or array, to be converted.\r\n * @param replacer A function that transforms the results.\r\n * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.\r\n */\r\n stringify(value: any, replacer?: (key: string, value: any) => any, space?: string | number): string;\r\n /**\r\n * Converts a JavaScript value to a JavaScript Object Notation (JSON) string.\r\n * @param value A JavaScript value, usually an object or array, to be converted.\r\n * @param replacer An array of strings and numbers that acts as a approved list for selecting the object properties that will be stringified.\r\n * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.\r\n */\r\n stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string;\r\n}\r\n\r\n/**\r\n * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.\r\n */\r\ndeclare const JSON: JSON;\r\n\r\n\r\n/////////////////////////////\r\n/// ECMAScript Array API (specially handled by compiler)\r\n/////////////////////////////\r\n\r\ninterface ReadonlyArray {\r\n /**\r\n * Gets the length of the array. This is a number one higher than the highest element defined in an array.\r\n */\r\n readonly length: number;\r\n /**\r\n * Returns a string representation of an array.\r\n */\r\n toString(): string;\r\n toLocaleString(): string;\r\n /**\r\n * Combines two or more arrays.\r\n * @param items Additional items to add to the end of array1.\r\n */\r\n concat>(...items: U[]): T[];\r\n /**\r\n * Combines two or more arrays.\r\n * @param items Additional items to add to the end of array1.\r\n */\r\n concat(...items: T[][]): T[];\r\n /**\r\n * Combines two or more arrays.\r\n * @param items Additional items to add to the end of array1.\r\n */\r\n concat(...items: (T | T[])[]): T[];\r\n /**\r\n * Adds all the elements of an array separated by the specified separator string.\r\n * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.\r\n */\r\n join(separator?: string): string;\r\n /**\r\n * Returns a section of an array.\r\n * @param start The beginning of the specified portion of the array.\r\n * @param end The end of the specified portion of the array.\r\n */\r\n slice(start?: number, end?: number): T[];\r\n /**\r\n * Returns the index of the first occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.\r\n */\r\n indexOf(searchElement: T, fromIndex?: number): number;\r\n\r\n /**\r\n * Returns the index of the last occurrence of a specified value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array.\r\n */\r\n lastIndexOf(searchElement: T, fromIndex?: number): number;\r\n /**\r\n * Determines whether all the members of an array satisfy the specified test.\r\n * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\r\n */\r\n every(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean;\r\n /**\r\n * Determines whether the specified callback function returns true for any element of an array.\r\n * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\r\n */\r\n some(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean;\r\n /**\r\n * Performs the specified action for each element in an array.\r\n * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\r\n */\r\n forEach(callbackfn: (value: T, index: number, array: ReadonlyArray) => void, thisArg?: any): void;\r\n /**\r\n * Calls a defined callback function on each element of an array, and returns an array that contains the results.\r\n * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\r\n */\r\n map(callbackfn: (value: T, index: number, array: ReadonlyArray) => U, thisArg?: any): U[];\r\n /**\r\n * Returns the elements of an array that meet the condition specified in a callback function.\r\n * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\r\n */\r\n filter(callbackfn: (value: T, index: number, array: ReadonlyArray) => any, thisArg?: any): T[];\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T;\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U;\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T;\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U;\r\n\r\n readonly [n: number]: T;\r\n}\r\n\r\ninterface Array {\r\n /**\r\n * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array.\r\n */\r\n length: number;\r\n /**\r\n * Returns a string representation of an array.\r\n */\r\n toString(): string;\r\n toLocaleString(): string;\r\n /**\r\n * Appends new elements to an array, and returns the new length of the array.\r\n * @param items New elements of the Array.\r\n */\r\n push(...items: T[]): number;\r\n /**\r\n * Removes the last element from an array and returns it.\r\n */\r\n pop(): T | undefined;\r\n /**\r\n * Combines two or more arrays.\r\n * @param items Additional items to add to the end of array1.\r\n */\r\n concat(...items: T[][]): T[];\r\n /**\r\n * Combines two or more arrays.\r\n * @param items Additional items to add to the end of array1.\r\n */\r\n concat(...items: (T | T[])[]): T[];\r\n /**\r\n * Adds all the elements of an array separated by the specified separator string.\r\n * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.\r\n */\r\n join(separator?: string): string;\r\n /**\r\n * Reverses the elements in an Array.\r\n */\r\n reverse(): T[];\r\n /**\r\n * Removes the first element from an array and returns it.\r\n */\r\n shift(): T | undefined;\r\n /**\r\n * Returns a section of an array.\r\n * @param start The beginning of the specified portion of the array.\r\n * @param end The end of the specified portion of the array.\r\n */\r\n slice(start?: number, end?: number): T[];\r\n /**\r\n * Sorts an array.\r\n * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order.\r\n */\r\n sort(compareFn?: (a: T, b: T) => number): this;\r\n /**\r\n * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.\r\n * @param start The zero-based location in the array from which to start removing elements.\r\n */\r\n splice(start: number): T[];\r\n /**\r\n * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.\r\n * @param start The zero-based location in the array from which to start removing elements.\r\n * @param deleteCount The number of elements to remove.\r\n * @param items Elements to insert into the array in place of the deleted elements.\r\n */\r\n splice(start: number, deleteCount: number, ...items: T[]): T[];\r\n /**\r\n * Inserts new elements at the start of an array.\r\n * @param items Elements to insert at the start of the Array.\r\n */\r\n unshift(...items: T[]): number;\r\n /**\r\n * Returns the index of the first occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.\r\n */\r\n indexOf(searchElement: T, fromIndex?: number): number;\r\n /**\r\n * Returns the index of the last occurrence of a specified value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array.\r\n */\r\n lastIndexOf(searchElement: T, fromIndex?: number): number;\r\n /**\r\n * Determines whether all the members of an array satisfy the specified test.\r\n * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\r\n */\r\n every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;\r\n /**\r\n * Determines whether the specified callback function returns true for any element of an array.\r\n * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\r\n */\r\n some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;\r\n /**\r\n * Performs the specified action for each element in an array.\r\n * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\r\n */\r\n forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void;\r\n /**\r\n * Calls a defined callback function on each element of an array, and returns an array that contains the results.\r\n * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\r\n */\r\n map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[];\r\n /**\r\n * Returns the elements of an array that meet the condition specified in a callback function.\r\n * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\r\n */\r\n filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[];\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;\r\n\r\n [n: number]: T;\r\n}\r\n\r\ninterface ArrayConstructor {\r\n new (arrayLength?: number): any[];\r\n new (arrayLength: number): T[];\r\n new (...items: T[]): T[];\r\n (arrayLength?: number): any[];\r\n (arrayLength: number): T[];\r\n (...items: T[]): T[];\r\n isArray(arg: any): arg is Array;\r\n readonly prototype: Array;\r\n}\r\n\r\ndeclare const Array: ArrayConstructor;\r\n\r\ninterface TypedPropertyDescriptor {\r\n enumerable?: boolean;\r\n configurable?: boolean;\r\n writable?: boolean;\r\n value?: T;\r\n get?: () => T;\r\n set?: (value: T) => void;\r\n}\r\n\r\ndeclare type ClassDecorator = (target: TFunction) => TFunction | void;\r\ndeclare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;\r\ndeclare type MethodDecorator = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void;\r\ndeclare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;\r\n\r\ndeclare type PromiseConstructorLike = new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike;\r\n\r\ninterface PromiseLike {\r\n /**\r\n * Attaches callbacks for the resolution and/or rejection of the Promise.\r\n * @param onfulfilled The callback to execute when the Promise is resolved.\r\n * @param onrejected The callback to execute when the Promise is rejected.\r\n * @returns A Promise for the completion of which ever callback is executed.\r\n */\r\n then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike;\r\n then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike;\r\n}\r\n\r\ninterface ArrayLike {\r\n readonly length: number;\r\n readonly [n: number]: T;\r\n}\r\n\r\n/**\r\n * Represents a raw buffer of binary data, which is used to store data for the\r\n * different typed arrays. ArrayBuffers cannot be read from or written to directly,\r\n * but can be passed to a typed array or DataView Object to interpret the raw\r\n * buffer as needed.\r\n */\r\ninterface ArrayBuffer {\r\n /**\r\n * Read-only. The length of the ArrayBuffer (in bytes).\r\n */\r\n readonly byteLength: number;\r\n\r\n /**\r\n * Returns a section of an ArrayBuffer.\r\n */\r\n slice(begin:number, end?:number): ArrayBuffer;\r\n}\r\n\r\ninterface ArrayBufferConstructor {\r\n readonly prototype: ArrayBuffer;\r\n new (byteLength: number): ArrayBuffer;\r\n isView(arg: any): arg is ArrayBufferView;\r\n}\r\ndeclare const ArrayBuffer: ArrayBufferConstructor;\r\n\r\ninterface ArrayBufferView {\r\n /**\r\n * The ArrayBuffer instance referenced by the array.\r\n */\r\n buffer: ArrayBuffer;\r\n\r\n /**\r\n * The length in bytes of the array.\r\n */\r\n byteLength: number;\r\n\r\n /**\r\n * The offset in bytes of the array.\r\n */\r\n byteOffset: number;\r\n}\r\n\r\ninterface DataView {\r\n readonly buffer: ArrayBuffer;\r\n readonly byteLength: number;\r\n readonly byteOffset: number;\r\n /**\r\n * Gets the Float32 value at the specified byte offset from the start of the view. There is\r\n * no alignment constraint; multi-byte values may be fetched from any offset.\r\n * @param byteOffset The place in the buffer at which the value should be retrieved.\r\n */\r\n getFloat32(byteOffset: number, littleEndian?: boolean): number;\r\n\r\n /**\r\n * Gets the Float64 value at the specified byte offset from the start of the view. There is\r\n * no alignment constraint; multi-byte values may be fetched from any offset.\r\n * @param byteOffset The place in the buffer at which the value should be retrieved.\r\n */\r\n getFloat64(byteOffset: number, littleEndian?: boolean): number;\r\n\r\n /**\r\n * Gets the Int8 value at the specified byte offset from the start of the view. There is\r\n * no alignment constraint; multi-byte values may be fetched from any offset.\r\n * @param byteOffset The place in the buffer at which the value should be retrieved.\r\n */\r\n getInt8(byteOffset: number): number;\r\n\r\n /**\r\n * Gets the Int16 value at the specified byte offset from the start of the view. There is\r\n * no alignment constraint; multi-byte values may be fetched from any offset.\r\n * @param byteOffset The place in the buffer at which the value should be retrieved.\r\n */\r\n getInt16(byteOffset: number, littleEndian?: boolean): number;\r\n /**\r\n * Gets the Int32 value at the specified byte offset from the start of the view. There is\r\n * no alignment constraint; multi-byte values may be fetched from any offset.\r\n * @param byteOffset The place in the buffer at which the value should be retrieved.\r\n */\r\n getInt32(byteOffset: number, littleEndian?: boolean): number;\r\n\r\n /**\r\n * Gets the Uint8 value at the specified byte offset from the start of the view. There is\r\n * no alignment constraint; multi-byte values may be fetched from any offset.\r\n * @param byteOffset The place in the buffer at which the value should be retrieved.\r\n */\r\n getUint8(byteOffset: number): number;\r\n\r\n /**\r\n * Gets the Uint16 value at the specified byte offset from the start of the view. There is\r\n * no alignment constraint; multi-byte values may be fetched from any offset.\r\n * @param byteOffset The place in the buffer at which the value should be retrieved.\r\n */\r\n getUint16(byteOffset: number, littleEndian?: boolean): number;\r\n\r\n /**\r\n * Gets the Uint32 value at the specified byte offset from the start of the view. There is\r\n * no alignment constraint; multi-byte values may be fetched from any offset.\r\n * @param byteOffset The place in the buffer at which the value should be retrieved.\r\n */\r\n getUint32(byteOffset: number, littleEndian?: boolean): number;\r\n\r\n /**\r\n * Stores an Float32 value at the specified byte offset from the start of the view.\r\n * @param byteOffset The place in the buffer at which the value should be set.\r\n * @param value The value to set.\r\n * @param littleEndian If false or undefined, a big-endian value should be written,\r\n * otherwise a little-endian value should be written.\r\n */\r\n setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void;\r\n\r\n /**\r\n * Stores an Float64 value at the specified byte offset from the start of the view.\r\n * @param byteOffset The place in the buffer at which the value should be set.\r\n * @param value The value to set.\r\n * @param littleEndian If false or undefined, a big-endian value should be written,\r\n * otherwise a little-endian value should be written.\r\n */\r\n setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void;\r\n\r\n /**\r\n * Stores an Int8 value at the specified byte offset from the start of the view.\r\n * @param byteOffset The place in the buffer at which the value should be set.\r\n * @param value The value to set.\r\n */\r\n setInt8(byteOffset: number, value: number): void;\r\n\r\n /**\r\n * Stores an Int16 value at the specified byte offset from the start of the view.\r\n * @param byteOffset The place in the buffer at which the value should be set.\r\n * @param value The value to set.\r\n * @param littleEndian If false or undefined, a big-endian value should be written,\r\n * otherwise a little-endian value should be written.\r\n */\r\n setInt16(byteOffset: number, value: number, littleEndian?: boolean): void;\r\n\r\n /**\r\n * Stores an Int32 value at the specified byte offset from the start of the view.\r\n * @param byteOffset The place in the buffer at which the value should be set.\r\n * @param value The value to set.\r\n * @param littleEndian If false or undefined, a big-endian value should be written,\r\n * otherwise a little-endian value should be written.\r\n */\r\n setInt32(byteOffset: number, value: number, littleEndian?: boolean): void;\r\n\r\n /**\r\n * Stores an Uint8 value at the specified byte offset from the start of the view.\r\n * @param byteOffset The place in the buffer at which the value should be set.\r\n * @param value The value to set.\r\n */\r\n setUint8(byteOffset: number, value: number): void;\r\n\r\n /**\r\n * Stores an Uint16 value at the specified byte offset from the start of the view.\r\n * @param byteOffset The place in the buffer at which the value should be set.\r\n * @param value The value to set.\r\n * @param littleEndian If false or undefined, a big-endian value should be written,\r\n * otherwise a little-endian value should be written.\r\n */\r\n setUint16(byteOffset: number, value: number, littleEndian?: boolean): void;\r\n\r\n /**\r\n * Stores an Uint32 value at the specified byte offset from the start of the view.\r\n * @param byteOffset The place in the buffer at which the value should be set.\r\n * @param value The value to set.\r\n * @param littleEndian If false or undefined, a big-endian value should be written,\r\n * otherwise a little-endian value should be written.\r\n */\r\n setUint32(byteOffset: number, value: number, littleEndian?: boolean): void;\r\n}\r\n\r\ninterface DataViewConstructor {\r\n new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView;\r\n}\r\ndeclare const DataView: DataViewConstructor;\r\n\r\n/**\r\n * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested\r\n * number of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Int8Array {\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * The ArrayBuffer instance referenced by the array.\r\n */\r\n readonly buffer: ArrayBuffer;\r\n\r\n /**\r\n * The length in bytes of the array.\r\n */\r\n readonly byteLength: number;\r\n\r\n /**\r\n * The offset in bytes of the array.\r\n */\r\n readonly byteOffset: number;\r\n\r\n /**\r\n * Returns the this object after copying a section of the array identified by start and end\r\n * to the same array starting at position target\r\n * @param target If target is negative, it is treated as length+target where length is the\r\n * length of the array.\r\n * @param start If start is negative, it is treated as length+start. If end is negative, it\r\n * is treated as length+end.\r\n * @param end If not specified, length of the this object is used as its default value.\r\n */\r\n copyWithin(target: number, start: number, end?: number): this;\r\n\r\n /**\r\n * Determines whether all the members of an array satisfy the specified test.\r\n * @param callbackfn A function that accepts up to three arguments. The every method calls\r\n * the callbackfn function for each element in array1 until the callbackfn returns false,\r\n * or until the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Returns the this object after filling the section identified by start and end with value\r\n * @param value value to fill array section with\r\n * @param start index to start filling the array at. If start is negative, it is treated as\r\n * length+start where length is the length of the array.\r\n * @param end index to stop filling the array at. If end is negative, it is treated as\r\n * length+end.\r\n */\r\n fill(value: number, start?: number, end?: number): this;\r\n\r\n /**\r\n * Returns the elements of an array that meet the condition specified in a callback function.\r\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n filter(callbackfn: (value: number, index: number, array: Int8Array) => any, thisArg?: any): Int8Array;\r\n\r\n /**\r\n * Returns the value of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found, find\r\n * immediately returns that element value. Otherwise, find returns undefined.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\r\n\r\n /**\r\n * Returns the index of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found,\r\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n findIndex(predicate: (value: number) => boolean, thisArg?: any): number;\r\n\r\n /**\r\n * Performs the specified action for each element in an array.\r\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void;\r\n\r\n /**\r\n * Returns the index of the first occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n indexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * Adds all the elements of an array separated by the specified separator string.\r\n * @param separator A string used to separate one element of an array from the next in the\r\n * resulting String. If omitted, the array elements are separated with a comma.\r\n */\r\n join(separator?: string): string;\r\n\r\n /**\r\n * Returns the index of the last occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n lastIndexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * The length of the array.\r\n */\r\n readonly length: number;\r\n\r\n /**\r\n * Calls a defined callback function on each element of an array, and returns an array that\r\n * contains the results.\r\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an\r\n * argument instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U;\r\n\r\n /**\r\n * Reverses the elements in an Array.\r\n */\r\n reverse(): Int8Array;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param index The index of the location to set.\r\n * @param value The value to set.\r\n */\r\n set(index: number, value: number): void;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param array A typed or untyped array of values to set.\r\n * @param offset The index in the current array at which the values are to be written.\r\n */\r\n set(array: ArrayLike, offset?: number): void;\r\n\r\n /**\r\n * Returns a section of an array.\r\n * @param start The beginning of the specified portion of the array.\r\n * @param end The end of the specified portion of the array.\r\n */\r\n slice(start?: number, end?: number): Int8Array;\r\n\r\n /**\r\n * Determines whether the specified callback function returns true for any element of an array.\r\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\r\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\r\n * the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Sorts an array.\r\n * @param compareFn The name of the function used to determine the order of the elements. If\r\n * omitted, the elements are sorted in ascending, ASCII character order.\r\n */\r\n sort(compareFn?: (a: number, b: number) => number): this;\r\n\r\n /**\r\n * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements\r\n * at begin, inclusive, up to end, exclusive.\r\n * @param begin The index of the beginning of the array.\r\n * @param end The index of the end of the array.\r\n */\r\n subarray(begin: number, end?: number): Int8Array;\r\n\r\n /**\r\n * Converts a number to a string by using the current locale.\r\n */\r\n toLocaleString(): string;\r\n\r\n /**\r\n * Returns a string representation of an array.\r\n */\r\n toString(): string;\r\n\r\n [index: number]: number;\r\n}\r\ninterface Int8ArrayConstructor {\r\n readonly prototype: Int8Array;\r\n new (length: number): Int8Array;\r\n new (array: ArrayLike): Int8Array;\r\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array;\r\n\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * Returns a new array from a set of elements.\r\n * @param items A set of elements to include in the new array object.\r\n */\r\n of(...items: number[]): Int8Array;\r\n\r\n /**\r\n * Creates an array from an array-like or iterable object.\r\n * @param arrayLike An array-like or iterable object to convert to an array.\r\n * @param mapfn A mapping function to call on every element of the array.\r\n * @param thisArg Value of 'this' used to invoke the mapfn.\r\n */\r\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array;\r\n\r\n}\r\ndeclare const Int8Array: Int8ArrayConstructor;\r\n\r\n/**\r\n * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the\r\n * requested number of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Uint8Array {\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * The ArrayBuffer instance referenced by the array.\r\n */\r\n readonly buffer: ArrayBuffer;\r\n\r\n /**\r\n * The length in bytes of the array.\r\n */\r\n readonly byteLength: number;\r\n\r\n /**\r\n * The offset in bytes of the array.\r\n */\r\n readonly byteOffset: number;\r\n\r\n /**\r\n * Returns the this object after copying a section of the array identified by start and end\r\n * to the same array starting at position target\r\n * @param target If target is negative, it is treated as length+target where length is the\r\n * length of the array.\r\n * @param start If start is negative, it is treated as length+start. If end is negative, it\r\n * is treated as length+end.\r\n * @param end If not specified, length of the this object is used as its default value.\r\n */\r\n copyWithin(target: number, start: number, end?: number): this;\r\n\r\n /**\r\n * Determines whether all the members of an array satisfy the specified test.\r\n * @param callbackfn A function that accepts up to three arguments. The every method calls\r\n * the callbackfn function for each element in array1 until the callbackfn returns false,\r\n * or until the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Returns the this object after filling the section identified by start and end with value\r\n * @param value value to fill array section with\r\n * @param start index to start filling the array at. If start is negative, it is treated as\r\n * length+start where length is the length of the array.\r\n * @param end index to stop filling the array at. If end is negative, it is treated as\r\n * length+end.\r\n */\r\n fill(value: number, start?: number, end?: number): this;\r\n\r\n /**\r\n * Returns the elements of an array that meet the condition specified in a callback function.\r\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n filter(callbackfn: (value: number, index: number, array: Uint8Array) => any, thisArg?: any): Uint8Array;\r\n\r\n /**\r\n * Returns the value of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found, find\r\n * immediately returns that element value. Otherwise, find returns undefined.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\r\n\r\n /**\r\n * Returns the index of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found,\r\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n findIndex(predicate: (value: number) => boolean, thisArg?: any): number;\r\n\r\n /**\r\n * Performs the specified action for each element in an array.\r\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void;\r\n\r\n /**\r\n * Returns the index of the first occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n indexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * Adds all the elements of an array separated by the specified separator string.\r\n * @param separator A string used to separate one element of an array from the next in the\r\n * resulting String. If omitted, the array elements are separated with a comma.\r\n */\r\n join(separator?: string): string;\r\n\r\n /**\r\n * Returns the index of the last occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n lastIndexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * The length of the array.\r\n */\r\n readonly length: number;\r\n\r\n /**\r\n * Calls a defined callback function on each element of an array, and returns an array that\r\n * contains the results.\r\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an\r\n * argument instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U;\r\n\r\n /**\r\n * Reverses the elements in an Array.\r\n */\r\n reverse(): Uint8Array;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param index The index of the location to set.\r\n * @param value The value to set.\r\n */\r\n set(index: number, value: number): void;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param array A typed or untyped array of values to set.\r\n * @param offset The index in the current array at which the values are to be written.\r\n */\r\n set(array: ArrayLike, offset?: number): void;\r\n\r\n /**\r\n * Returns a section of an array.\r\n * @param start The beginning of the specified portion of the array.\r\n * @param end The end of the specified portion of the array.\r\n */\r\n slice(start?: number, end?: number): Uint8Array;\r\n\r\n /**\r\n * Determines whether the specified callback function returns true for any element of an array.\r\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\r\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\r\n * the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Sorts an array.\r\n * @param compareFn The name of the function used to determine the order of the elements. If\r\n * omitted, the elements are sorted in ascending, ASCII character order.\r\n */\r\n sort(compareFn?: (a: number, b: number) => number): this;\r\n\r\n /**\r\n * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements\r\n * at begin, inclusive, up to end, exclusive.\r\n * @param begin The index of the beginning of the array.\r\n * @param end The index of the end of the array.\r\n */\r\n subarray(begin: number, end?: number): Uint8Array;\r\n\r\n /**\r\n * Converts a number to a string by using the current locale.\r\n */\r\n toLocaleString(): string;\r\n\r\n /**\r\n * Returns a string representation of an array.\r\n */\r\n toString(): string;\r\n\r\n [index: number]: number;\r\n}\r\n\r\ninterface Uint8ArrayConstructor {\r\n readonly prototype: Uint8Array;\r\n new (length: number): Uint8Array;\r\n new (array: ArrayLike): Uint8Array;\r\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array;\r\n\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * Returns a new array from a set of elements.\r\n * @param items A set of elements to include in the new array object.\r\n */\r\n of(...items: number[]): Uint8Array;\r\n\r\n /**\r\n * Creates an array from an array-like or iterable object.\r\n * @param arrayLike An array-like or iterable object to convert to an array.\r\n * @param mapfn A mapping function to call on every element of the array.\r\n * @param thisArg Value of 'this' used to invoke the mapfn.\r\n */\r\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array;\r\n\r\n}\r\ndeclare const Uint8Array: Uint8ArrayConstructor;\r\n\r\n/**\r\n * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0.\r\n * If the requested number of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Uint8ClampedArray {\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * The ArrayBuffer instance referenced by the array.\r\n */\r\n readonly buffer: ArrayBuffer;\r\n\r\n /**\r\n * The length in bytes of the array.\r\n */\r\n readonly byteLength: number;\r\n\r\n /**\r\n * The offset in bytes of the array.\r\n */\r\n readonly byteOffset: number;\r\n\r\n /**\r\n * Returns the this object after copying a section of the array identified by start and end\r\n * to the same array starting at position target\r\n * @param target If target is negative, it is treated as length+target where length is the\r\n * length of the array.\r\n * @param start If start is negative, it is treated as length+start. If end is negative, it\r\n * is treated as length+end.\r\n * @param end If not specified, length of the this object is used as its default value.\r\n */\r\n copyWithin(target: number, start: number, end?: number): this;\r\n\r\n /**\r\n * Determines whether all the members of an array satisfy the specified test.\r\n * @param callbackfn A function that accepts up to three arguments. The every method calls\r\n * the callbackfn function for each element in array1 until the callbackfn returns false,\r\n * or until the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Returns the this object after filling the section identified by start and end with value\r\n * @param value value to fill array section with\r\n * @param start index to start filling the array at. If start is negative, it is treated as\r\n * length+start where length is the length of the array.\r\n * @param end index to stop filling the array at. If end is negative, it is treated as\r\n * length+end.\r\n */\r\n fill(value: number, start?: number, end?: number): this;\r\n\r\n /**\r\n * Returns the elements of an array that meet the condition specified in a callback function.\r\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => any, thisArg?: any): Uint8ClampedArray;\r\n\r\n /**\r\n * Returns the value of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found, find\r\n * immediately returns that element value. Otherwise, find returns undefined.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\r\n\r\n /**\r\n * Returns the index of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found,\r\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n findIndex(predicate: (value: number) => boolean, thisArg?: any): number;\r\n\r\n /**\r\n * Performs the specified action for each element in an array.\r\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void;\r\n\r\n /**\r\n * Returns the index of the first occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n indexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * Adds all the elements of an array separated by the specified separator string.\r\n * @param separator A string used to separate one element of an array from the next in the\r\n * resulting String. If omitted, the array elements are separated with a comma.\r\n */\r\n join(separator?: string): string;\r\n\r\n /**\r\n * Returns the index of the last occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n lastIndexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * The length of the array.\r\n */\r\n readonly length: number;\r\n\r\n /**\r\n * Calls a defined callback function on each element of an array, and returns an array that\r\n * contains the results.\r\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an\r\n * argument instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U;\r\n\r\n /**\r\n * Reverses the elements in an Array.\r\n */\r\n reverse(): Uint8ClampedArray;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param index The index of the location to set.\r\n * @param value The value to set.\r\n */\r\n set(index: number, value: number): void;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param array A typed or untyped array of values to set.\r\n * @param offset The index in the current array at which the values are to be written.\r\n */\r\n set(array: Uint8ClampedArray, offset?: number): void;\r\n\r\n /**\r\n * Returns a section of an array.\r\n * @param start The beginning of the specified portion of the array.\r\n * @param end The end of the specified portion of the array.\r\n */\r\n slice(start?: number, end?: number): Uint8ClampedArray;\r\n\r\n /**\r\n * Determines whether the specified callback function returns true for any element of an array.\r\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\r\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\r\n * the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Sorts an array.\r\n * @param compareFn The name of the function used to determine the order of the elements. If\r\n * omitted, the elements are sorted in ascending, ASCII character order.\r\n */\r\n sort(compareFn?: (a: number, b: number) => number): this;\r\n\r\n /**\r\n * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements\r\n * at begin, inclusive, up to end, exclusive.\r\n * @param begin The index of the beginning of the array.\r\n * @param end The index of the end of the array.\r\n */\r\n subarray(begin: number, end?: number): Uint8ClampedArray;\r\n\r\n /**\r\n * Converts a number to a string by using the current locale.\r\n */\r\n toLocaleString(): string;\r\n\r\n /**\r\n * Returns a string representation of an array.\r\n */\r\n toString(): string;\r\n\r\n [index: number]: number;\r\n}\r\n\r\ninterface Uint8ClampedArrayConstructor {\r\n readonly prototype: Uint8ClampedArray;\r\n new (length: number): Uint8ClampedArray;\r\n new (array: ArrayLike): Uint8ClampedArray;\r\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray;\r\n\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * Returns a new array from a set of elements.\r\n * @param items A set of elements to include in the new array object.\r\n */\r\n of(...items: number[]): Uint8ClampedArray;\r\n\r\n /**\r\n * Creates an array from an array-like or iterable object.\r\n * @param arrayLike An array-like or iterable object to convert to an array.\r\n * @param mapfn A mapping function to call on every element of the array.\r\n * @param thisArg Value of 'this' used to invoke the mapfn.\r\n */\r\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray;\r\n}\r\ndeclare const Uint8ClampedArray: Uint8ClampedArrayConstructor;\r\n\r\n/**\r\n * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the\r\n * requested number of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Int16Array {\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * The ArrayBuffer instance referenced by the array.\r\n */\r\n readonly buffer: ArrayBuffer;\r\n\r\n /**\r\n * The length in bytes of the array.\r\n */\r\n readonly byteLength: number;\r\n\r\n /**\r\n * The offset in bytes of the array.\r\n */\r\n readonly byteOffset: number;\r\n\r\n /**\r\n * Returns the this object after copying a section of the array identified by start and end\r\n * to the same array starting at position target\r\n * @param target If target is negative, it is treated as length+target where length is the\r\n * length of the array.\r\n * @param start If start is negative, it is treated as length+start. If end is negative, it\r\n * is treated as length+end.\r\n * @param end If not specified, length of the this object is used as its default value.\r\n */\r\n copyWithin(target: number, start: number, end?: number): this;\r\n\r\n /**\r\n * Determines whether all the members of an array satisfy the specified test.\r\n * @param callbackfn A function that accepts up to three arguments. The every method calls\r\n * the callbackfn function for each element in array1 until the callbackfn returns false,\r\n * or until the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Returns the this object after filling the section identified by start and end with value\r\n * @param value value to fill array section with\r\n * @param start index to start filling the array at. If start is negative, it is treated as\r\n * length+start where length is the length of the array.\r\n * @param end index to stop filling the array at. If end is negative, it is treated as\r\n * length+end.\r\n */\r\n fill(value: number, start?: number, end?: number): this;\r\n\r\n /**\r\n * Returns the elements of an array that meet the condition specified in a callback function.\r\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n filter(callbackfn: (value: number, index: number, array: Int16Array) => any, thisArg?: any): Int16Array;\r\n\r\n /**\r\n * Returns the value of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found, find\r\n * immediately returns that element value. Otherwise, find returns undefined.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\r\n\r\n /**\r\n * Returns the index of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found,\r\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n findIndex(predicate: (value: number) => boolean, thisArg?: any): number;\r\n\r\n /**\r\n * Performs the specified action for each element in an array.\r\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void;\r\n\r\n /**\r\n * Returns the index of the first occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n indexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * Adds all the elements of an array separated by the specified separator string.\r\n * @param separator A string used to separate one element of an array from the next in the\r\n * resulting String. If omitted, the array elements are separated with a comma.\r\n */\r\n join(separator?: string): string;\r\n\r\n /**\r\n * Returns the index of the last occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n lastIndexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * The length of the array.\r\n */\r\n readonly length: number;\r\n\r\n /**\r\n * Calls a defined callback function on each element of an array, and returns an array that\r\n * contains the results.\r\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an\r\n * argument instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U;\r\n\r\n /**\r\n * Reverses the elements in an Array.\r\n */\r\n reverse(): Int16Array;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param index The index of the location to set.\r\n * @param value The value to set.\r\n */\r\n set(index: number, value: number): void;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param array A typed or untyped array of values to set.\r\n * @param offset The index in the current array at which the values are to be written.\r\n */\r\n set(array: ArrayLike, offset?: number): void;\r\n\r\n /**\r\n * Returns a section of an array.\r\n * @param start The beginning of the specified portion of the array.\r\n * @param end The end of the specified portion of the array.\r\n */\r\n slice(start?: number, end?: number): Int16Array;\r\n\r\n /**\r\n * Determines whether the specified callback function returns true for any element of an array.\r\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\r\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\r\n * the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Sorts an array.\r\n * @param compareFn The name of the function used to determine the order of the elements. If\r\n * omitted, the elements are sorted in ascending, ASCII character order.\r\n */\r\n sort(compareFn?: (a: number, b: number) => number): this;\r\n\r\n /**\r\n * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements\r\n * at begin, inclusive, up to end, exclusive.\r\n * @param begin The index of the beginning of the array.\r\n * @param end The index of the end of the array.\r\n */\r\n subarray(begin: number, end?: number): Int16Array;\r\n\r\n /**\r\n * Converts a number to a string by using the current locale.\r\n */\r\n toLocaleString(): string;\r\n\r\n /**\r\n * Returns a string representation of an array.\r\n */\r\n toString(): string;\r\n\r\n [index: number]: number;\r\n}\r\n\r\ninterface Int16ArrayConstructor {\r\n readonly prototype: Int16Array;\r\n new (length: number): Int16Array;\r\n new (array: ArrayLike): Int16Array;\r\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array;\r\n\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * Returns a new array from a set of elements.\r\n * @param items A set of elements to include in the new array object.\r\n */\r\n of(...items: number[]): Int16Array;\r\n\r\n /**\r\n * Creates an array from an array-like or iterable object.\r\n * @param arrayLike An array-like or iterable object to convert to an array.\r\n * @param mapfn A mapping function to call on every element of the array.\r\n * @param thisArg Value of 'this' used to invoke the mapfn.\r\n */\r\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array;\r\n\r\n}\r\ndeclare const Int16Array: Int16ArrayConstructor;\r\n\r\n/**\r\n * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the\r\n * requested number of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Uint16Array {\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * The ArrayBuffer instance referenced by the array.\r\n */\r\n readonly buffer: ArrayBuffer;\r\n\r\n /**\r\n * The length in bytes of the array.\r\n */\r\n readonly byteLength: number;\r\n\r\n /**\r\n * The offset in bytes of the array.\r\n */\r\n readonly byteOffset: number;\r\n\r\n /**\r\n * Returns the this object after copying a section of the array identified by start and end\r\n * to the same array starting at position target\r\n * @param target If target is negative, it is treated as length+target where length is the\r\n * length of the array.\r\n * @param start If start is negative, it is treated as length+start. If end is negative, it\r\n * is treated as length+end.\r\n * @param end If not specified, length of the this object is used as its default value.\r\n */\r\n copyWithin(target: number, start: number, end?: number): this;\r\n\r\n /**\r\n * Determines whether all the members of an array satisfy the specified test.\r\n * @param callbackfn A function that accepts up to three arguments. The every method calls\r\n * the callbackfn function for each element in array1 until the callbackfn returns false,\r\n * or until the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Returns the this object after filling the section identified by start and end with value\r\n * @param value value to fill array section with\r\n * @param start index to start filling the array at. If start is negative, it is treated as\r\n * length+start where length is the length of the array.\r\n * @param end index to stop filling the array at. If end is negative, it is treated as\r\n * length+end.\r\n */\r\n fill(value: number, start?: number, end?: number): this;\r\n\r\n /**\r\n * Returns the elements of an array that meet the condition specified in a callback function.\r\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n filter(callbackfn: (value: number, index: number, array: Uint16Array) => any, thisArg?: any): Uint16Array;\r\n\r\n /**\r\n * Returns the value of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found, find\r\n * immediately returns that element value. Otherwise, find returns undefined.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\r\n\r\n /**\r\n * Returns the index of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found,\r\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n findIndex(predicate: (value: number) => boolean, thisArg?: any): number;\r\n\r\n /**\r\n * Performs the specified action for each element in an array.\r\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void;\r\n\r\n /**\r\n * Returns the index of the first occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n indexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * Adds all the elements of an array separated by the specified separator string.\r\n * @param separator A string used to separate one element of an array from the next in the\r\n * resulting String. If omitted, the array elements are separated with a comma.\r\n */\r\n join(separator?: string): string;\r\n\r\n /**\r\n * Returns the index of the last occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n lastIndexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * The length of the array.\r\n */\r\n readonly length: number;\r\n\r\n /**\r\n * Calls a defined callback function on each element of an array, and returns an array that\r\n * contains the results.\r\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an\r\n * argument instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U;\r\n\r\n /**\r\n * Reverses the elements in an Array.\r\n */\r\n reverse(): Uint16Array;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param index The index of the location to set.\r\n * @param value The value to set.\r\n */\r\n set(index: number, value: number): void;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param array A typed or untyped array of values to set.\r\n * @param offset The index in the current array at which the values are to be written.\r\n */\r\n set(array: ArrayLike, offset?: number): void;\r\n\r\n /**\r\n * Returns a section of an array.\r\n * @param start The beginning of the specified portion of the array.\r\n * @param end The end of the specified portion of the array.\r\n */\r\n slice(start?: number, end?: number): Uint16Array;\r\n\r\n /**\r\n * Determines whether the specified callback function returns true for any element of an array.\r\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\r\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\r\n * the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Sorts an array.\r\n * @param compareFn The name of the function used to determine the order of the elements. If\r\n * omitted, the elements are sorted in ascending, ASCII character order.\r\n */\r\n sort(compareFn?: (a: number, b: number) => number): this;\r\n\r\n /**\r\n * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements\r\n * at begin, inclusive, up to end, exclusive.\r\n * @param begin The index of the beginning of the array.\r\n * @param end The index of the end of the array.\r\n */\r\n subarray(begin: number, end?: number): Uint16Array;\r\n\r\n /**\r\n * Converts a number to a string by using the current locale.\r\n */\r\n toLocaleString(): string;\r\n\r\n /**\r\n * Returns a string representation of an array.\r\n */\r\n toString(): string;\r\n\r\n [index: number]: number;\r\n}\r\n\r\ninterface Uint16ArrayConstructor {\r\n readonly prototype: Uint16Array;\r\n new (length: number): Uint16Array;\r\n new (array: ArrayLike): Uint16Array;\r\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array;\r\n\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * Returns a new array from a set of elements.\r\n * @param items A set of elements to include in the new array object.\r\n */\r\n of(...items: number[]): Uint16Array;\r\n\r\n /**\r\n * Creates an array from an array-like or iterable object.\r\n * @param arrayLike An array-like or iterable object to convert to an array.\r\n * @param mapfn A mapping function to call on every element of the array.\r\n * @param thisArg Value of 'this' used to invoke the mapfn.\r\n */\r\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array;\r\n\r\n}\r\ndeclare const Uint16Array: Uint16ArrayConstructor;\r\n/**\r\n * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the\r\n * requested number of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Int32Array {\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * The ArrayBuffer instance referenced by the array.\r\n */\r\n readonly buffer: ArrayBuffer;\r\n\r\n /**\r\n * The length in bytes of the array.\r\n */\r\n readonly byteLength: number;\r\n\r\n /**\r\n * The offset in bytes of the array.\r\n */\r\n readonly byteOffset: number;\r\n\r\n /**\r\n * Returns the this object after copying a section of the array identified by start and end\r\n * to the same array starting at position target\r\n * @param target If target is negative, it is treated as length+target where length is the\r\n * length of the array.\r\n * @param start If start is negative, it is treated as length+start. If end is negative, it\r\n * is treated as length+end.\r\n * @param end If not specified, length of the this object is used as its default value.\r\n */\r\n copyWithin(target: number, start: number, end?: number): this;\r\n\r\n /**\r\n * Determines whether all the members of an array satisfy the specified test.\r\n * @param callbackfn A function that accepts up to three arguments. The every method calls\r\n * the callbackfn function for each element in array1 until the callbackfn returns false,\r\n * or until the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Returns the this object after filling the section identified by start and end with value\r\n * @param value value to fill array section with\r\n * @param start index to start filling the array at. If start is negative, it is treated as\r\n * length+start where length is the length of the array.\r\n * @param end index to stop filling the array at. If end is negative, it is treated as\r\n * length+end.\r\n */\r\n fill(value: number, start?: number, end?: number): this;\r\n\r\n /**\r\n * Returns the elements of an array that meet the condition specified in a callback function.\r\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n filter(callbackfn: (value: number, index: number, array: Int32Array) => any, thisArg?: any): Int32Array;\r\n\r\n /**\r\n * Returns the value of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found, find\r\n * immediately returns that element value. Otherwise, find returns undefined.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\r\n\r\n /**\r\n * Returns the index of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found,\r\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n findIndex(predicate: (value: number) => boolean, thisArg?: any): number;\r\n\r\n /**\r\n * Performs the specified action for each element in an array.\r\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void;\r\n\r\n /**\r\n * Returns the index of the first occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n indexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * Adds all the elements of an array separated by the specified separator string.\r\n * @param separator A string used to separate one element of an array from the next in the\r\n * resulting String. If omitted, the array elements are separated with a comma.\r\n */\r\n join(separator?: string): string;\r\n\r\n /**\r\n * Returns the index of the last occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n lastIndexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * The length of the array.\r\n */\r\n readonly length: number;\r\n\r\n /**\r\n * Calls a defined callback function on each element of an array, and returns an array that\r\n * contains the results.\r\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an\r\n * argument instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U;\r\n\r\n /**\r\n * Reverses the elements in an Array.\r\n */\r\n reverse(): Int32Array;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param index The index of the location to set.\r\n * @param value The value to set.\r\n */\r\n set(index: number, value: number): void;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param array A typed or untyped array of values to set.\r\n * @param offset The index in the current array at which the values are to be written.\r\n */\r\n set(array: ArrayLike, offset?: number): void;\r\n\r\n /**\r\n * Returns a section of an array.\r\n * @param start The beginning of the specified portion of the array.\r\n * @param end The end of the specified portion of the array.\r\n */\r\n slice(start?: number, end?: number): Int32Array;\r\n\r\n /**\r\n * Determines whether the specified callback function returns true for any element of an array.\r\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\r\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\r\n * the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Sorts an array.\r\n * @param compareFn The name of the function used to determine the order of the elements. If\r\n * omitted, the elements are sorted in ascending, ASCII character order.\r\n */\r\n sort(compareFn?: (a: number, b: number) => number): this;\r\n\r\n /**\r\n * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements\r\n * at begin, inclusive, up to end, exclusive.\r\n * @param begin The index of the beginning of the array.\r\n * @param end The index of the end of the array.\r\n */\r\n subarray(begin: number, end?: number): Int32Array;\r\n\r\n /**\r\n * Converts a number to a string by using the current locale.\r\n */\r\n toLocaleString(): string;\r\n\r\n /**\r\n * Returns a string representation of an array.\r\n */\r\n toString(): string;\r\n\r\n [index: number]: number;\r\n}\r\n\r\ninterface Int32ArrayConstructor {\r\n readonly prototype: Int32Array;\r\n new (length: number): Int32Array;\r\n new (array: ArrayLike): Int32Array;\r\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array;\r\n\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * Returns a new array from a set of elements.\r\n * @param items A set of elements to include in the new array object.\r\n */\r\n of(...items: number[]): Int32Array;\r\n\r\n /**\r\n * Creates an array from an array-like or iterable object.\r\n * @param arrayLike An array-like or iterable object to convert to an array.\r\n * @param mapfn A mapping function to call on every element of the array.\r\n * @param thisArg Value of 'this' used to invoke the mapfn.\r\n */\r\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array;\r\n}\r\ndeclare const Int32Array: Int32ArrayConstructor;\r\n\r\n/**\r\n * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the\r\n * requested number of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Uint32Array {\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * The ArrayBuffer instance referenced by the array.\r\n */\r\n readonly buffer: ArrayBuffer;\r\n\r\n /**\r\n * The length in bytes of the array.\r\n */\r\n readonly byteLength: number;\r\n\r\n /**\r\n * The offset in bytes of the array.\r\n */\r\n readonly byteOffset: number;\r\n\r\n /**\r\n * Returns the this object after copying a section of the array identified by start and end\r\n * to the same array starting at position target\r\n * @param target If target is negative, it is treated as length+target where length is the\r\n * length of the array.\r\n * @param start If start is negative, it is treated as length+start. If end is negative, it\r\n * is treated as length+end.\r\n * @param end If not specified, length of the this object is used as its default value.\r\n */\r\n copyWithin(target: number, start: number, end?: number): this;\r\n\r\n /**\r\n * Determines whether all the members of an array satisfy the specified test.\r\n * @param callbackfn A function that accepts up to three arguments. The every method calls\r\n * the callbackfn function for each element in array1 until the callbackfn returns false,\r\n * or until the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Returns the this object after filling the section identified by start and end with value\r\n * @param value value to fill array section with\r\n * @param start index to start filling the array at. If start is negative, it is treated as\r\n * length+start where length is the length of the array.\r\n * @param end index to stop filling the array at. If end is negative, it is treated as\r\n * length+end.\r\n */\r\n fill(value: number, start?: number, end?: number): this;\r\n\r\n /**\r\n * Returns the elements of an array that meet the condition specified in a callback function.\r\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n filter(callbackfn: (value: number, index: number, array: Uint32Array) => any, thisArg?: any): Uint32Array;\r\n\r\n /**\r\n * Returns the value of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found, find\r\n * immediately returns that element value. Otherwise, find returns undefined.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\r\n\r\n /**\r\n * Returns the index of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found,\r\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n findIndex(predicate: (value: number) => boolean, thisArg?: any): number;\r\n\r\n /**\r\n * Performs the specified action for each element in an array.\r\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void;\r\n\r\n /**\r\n * Returns the index of the first occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n indexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * Adds all the elements of an array separated by the specified separator string.\r\n * @param separator A string used to separate one element of an array from the next in the\r\n * resulting String. If omitted, the array elements are separated with a comma.\r\n */\r\n join(separator?: string): string;\r\n\r\n /**\r\n * Returns the index of the last occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n lastIndexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * The length of the array.\r\n */\r\n readonly length: number;\r\n\r\n /**\r\n * Calls a defined callback function on each element of an array, and returns an array that\r\n * contains the results.\r\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an\r\n * argument instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U;\r\n\r\n /**\r\n * Reverses the elements in an Array.\r\n */\r\n reverse(): Uint32Array;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param index The index of the location to set.\r\n * @param value The value to set.\r\n */\r\n set(index: number, value: number): void;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param array A typed or untyped array of values to set.\r\n * @param offset The index in the current array at which the values are to be written.\r\n */\r\n set(array: ArrayLike, offset?: number): void;\r\n\r\n /**\r\n * Returns a section of an array.\r\n * @param start The beginning of the specified portion of the array.\r\n * @param end The end of the specified portion of the array.\r\n */\r\n slice(start?: number, end?: number): Uint32Array;\r\n\r\n /**\r\n * Determines whether the specified callback function returns true for any element of an array.\r\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\r\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\r\n * the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Sorts an array.\r\n * @param compareFn The name of the function used to determine the order of the elements. If\r\n * omitted, the elements are sorted in ascending, ASCII character order.\r\n */\r\n sort(compareFn?: (a: number, b: number) => number): this;\r\n\r\n /**\r\n * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements\r\n * at begin, inclusive, up to end, exclusive.\r\n * @param begin The index of the beginning of the array.\r\n * @param end The index of the end of the array.\r\n */\r\n subarray(begin: number, end?: number): Uint32Array;\r\n\r\n /**\r\n * Converts a number to a string by using the current locale.\r\n */\r\n toLocaleString(): string;\r\n\r\n /**\r\n * Returns a string representation of an array.\r\n */\r\n toString(): string;\r\n\r\n [index: number]: number;\r\n}\r\n\r\ninterface Uint32ArrayConstructor {\r\n readonly prototype: Uint32Array;\r\n new (length: number): Uint32Array;\r\n new (array: ArrayLike): Uint32Array;\r\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array;\r\n\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * Returns a new array from a set of elements.\r\n * @param items A set of elements to include in the new array object.\r\n */\r\n of(...items: number[]): Uint32Array;\r\n\r\n /**\r\n * Creates an array from an array-like or iterable object.\r\n * @param arrayLike An array-like or iterable object to convert to an array.\r\n * @param mapfn A mapping function to call on every element of the array.\r\n * @param thisArg Value of 'this' used to invoke the mapfn.\r\n */\r\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array;\r\n}\r\ndeclare const Uint32Array: Uint32ArrayConstructor;\r\n\r\n/**\r\n * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number\r\n * of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Float32Array {\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * The ArrayBuffer instance referenced by the array.\r\n */\r\n readonly buffer: ArrayBuffer;\r\n\r\n /**\r\n * The length in bytes of the array.\r\n */\r\n readonly byteLength: number;\r\n\r\n /**\r\n * The offset in bytes of the array.\r\n */\r\n readonly byteOffset: number;\r\n\r\n /**\r\n * Returns the this object after copying a section of the array identified by start and end\r\n * to the same array starting at position target\r\n * @param target If target is negative, it is treated as length+target where length is the\r\n * length of the array.\r\n * @param start If start is negative, it is treated as length+start. If end is negative, it\r\n * is treated as length+end.\r\n * @param end If not specified, length of the this object is used as its default value.\r\n */\r\n copyWithin(target: number, start: number, end?: number): this;\r\n\r\n /**\r\n * Determines whether all the members of an array satisfy the specified test.\r\n * @param callbackfn A function that accepts up to three arguments. The every method calls\r\n * the callbackfn function for each element in array1 until the callbackfn returns false,\r\n * or until the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Returns the this object after filling the section identified by start and end with value\r\n * @param value value to fill array section with\r\n * @param start index to start filling the array at. If start is negative, it is treated as\r\n * length+start where length is the length of the array.\r\n * @param end index to stop filling the array at. If end is negative, it is treated as\r\n * length+end.\r\n */\r\n fill(value: number, start?: number, end?: number): this;\r\n\r\n /**\r\n * Returns the elements of an array that meet the condition specified in a callback function.\r\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n filter(callbackfn: (value: number, index: number, array: Float32Array) => any, thisArg?: any): Float32Array;\r\n\r\n /**\r\n * Returns the value of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found, find\r\n * immediately returns that element value. Otherwise, find returns undefined.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\r\n\r\n /**\r\n * Returns the index of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found,\r\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n findIndex(predicate: (value: number) => boolean, thisArg?: any): number;\r\n\r\n /**\r\n * Performs the specified action for each element in an array.\r\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void;\r\n\r\n /**\r\n * Returns the index of the first occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n indexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * Adds all the elements of an array separated by the specified separator string.\r\n * @param separator A string used to separate one element of an array from the next in the\r\n * resulting String. If omitted, the array elements are separated with a comma.\r\n */\r\n join(separator?: string): string;\r\n\r\n /**\r\n * Returns the index of the last occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n lastIndexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * The length of the array.\r\n */\r\n readonly length: number;\r\n\r\n /**\r\n * Calls a defined callback function on each element of an array, and returns an array that\r\n * contains the results.\r\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an\r\n * argument instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U;\r\n\r\n /**\r\n * Reverses the elements in an Array.\r\n */\r\n reverse(): Float32Array;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param index The index of the location to set.\r\n * @param value The value to set.\r\n */\r\n set(index: number, value: number): void;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param array A typed or untyped array of values to set.\r\n * @param offset The index in the current array at which the values are to be written.\r\n */\r\n set(array: ArrayLike, offset?: number): void;\r\n\r\n /**\r\n * Returns a section of an array.\r\n * @param start The beginning of the specified portion of the array.\r\n * @param end The end of the specified portion of the array.\r\n */\r\n slice(start?: number, end?: number): Float32Array;\r\n\r\n /**\r\n * Determines whether the specified callback function returns true for any element of an array.\r\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\r\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\r\n * the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Sorts an array.\r\n * @param compareFn The name of the function used to determine the order of the elements. If\r\n * omitted, the elements are sorted in ascending, ASCII character order.\r\n */\r\n sort(compareFn?: (a: number, b: number) => number): this;\r\n\r\n /**\r\n * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements\r\n * at begin, inclusive, up to end, exclusive.\r\n * @param begin The index of the beginning of the array.\r\n * @param end The index of the end of the array.\r\n */\r\n subarray(begin: number, end?: number): Float32Array;\r\n\r\n /**\r\n * Converts a number to a string by using the current locale.\r\n */\r\n toLocaleString(): string;\r\n\r\n /**\r\n * Returns a string representation of an array.\r\n */\r\n toString(): string;\r\n\r\n [index: number]: number;\r\n}\r\n\r\ninterface Float32ArrayConstructor {\r\n readonly prototype: Float32Array;\r\n new (length: number): Float32Array;\r\n new (array: ArrayLike): Float32Array;\r\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array;\r\n\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * Returns a new array from a set of elements.\r\n * @param items A set of elements to include in the new array object.\r\n */\r\n of(...items: number[]): Float32Array;\r\n\r\n /**\r\n * Creates an array from an array-like or iterable object.\r\n * @param arrayLike An array-like or iterable object to convert to an array.\r\n * @param mapfn A mapping function to call on every element of the array.\r\n * @param thisArg Value of 'this' used to invoke the mapfn.\r\n */\r\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array;\r\n\r\n}\r\ndeclare const Float32Array: Float32ArrayConstructor;\r\n\r\n/**\r\n * A typed array of 64-bit float values. The contents are initialized to 0. If the requested\r\n * number of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Float64Array {\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * The ArrayBuffer instance referenced by the array.\r\n */\r\n readonly buffer: ArrayBuffer;\r\n\r\n /**\r\n * The length in bytes of the array.\r\n */\r\n readonly byteLength: number;\r\n\r\n /**\r\n * The offset in bytes of the array.\r\n */\r\n readonly byteOffset: number;\r\n\r\n /**\r\n * Returns the this object after copying a section of the array identified by start and end\r\n * to the same array starting at position target\r\n * @param target If target is negative, it is treated as length+target where length is the\r\n * length of the array.\r\n * @param start If start is negative, it is treated as length+start. If end is negative, it\r\n * is treated as length+end.\r\n * @param end If not specified, length of the this object is used as its default value.\r\n */\r\n copyWithin(target: number, start: number, end?: number): this;\r\n\r\n /**\r\n * Determines whether all the members of an array satisfy the specified test.\r\n * @param callbackfn A function that accepts up to three arguments. The every method calls\r\n * the callbackfn function for each element in array1 until the callbackfn returns false,\r\n * or until the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Returns the this object after filling the section identified by start and end with value\r\n * @param value value to fill array section with\r\n * @param start index to start filling the array at. If start is negative, it is treated as\r\n * length+start where length is the length of the array.\r\n * @param end index to stop filling the array at. If end is negative, it is treated as\r\n * length+end.\r\n */\r\n fill(value: number, start?: number, end?: number): this;\r\n\r\n /**\r\n * Returns the elements of an array that meet the condition specified in a callback function.\r\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n filter(callbackfn: (value: number, index: number, array: Float64Array) => any, thisArg?: any): Float64Array;\r\n\r\n /**\r\n * Returns the value of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found, find\r\n * immediately returns that element value. Otherwise, find returns undefined.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\r\n\r\n /**\r\n * Returns the index of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found,\r\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n findIndex(predicate: (value: number) => boolean, thisArg?: any): number;\r\n\r\n /**\r\n * Performs the specified action for each element in an array.\r\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void;\r\n\r\n /**\r\n * Returns the index of the first occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n indexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * Adds all the elements of an array separated by the specified separator string.\r\n * @param separator A string used to separate one element of an array from the next in the\r\n * resulting String. If omitted, the array elements are separated with a comma.\r\n */\r\n join(separator?: string): string;\r\n\r\n /**\r\n * Returns the index of the last occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n lastIndexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * The length of the array.\r\n */\r\n readonly length: number;\r\n\r\n /**\r\n * Calls a defined callback function on each element of an array, and returns an array that\r\n * contains the results.\r\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an\r\n * argument instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U;\r\n\r\n /**\r\n * Reverses the elements in an Array.\r\n */\r\n reverse(): Float64Array;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param index The index of the location to set.\r\n * @param value The value to set.\r\n */\r\n set(index: number, value: number): void;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param array A typed or untyped array of values to set.\r\n * @param offset The index in the current array at which the values are to be written.\r\n */\r\n set(array: ArrayLike, offset?: number): void;\r\n\r\n /**\r\n * Returns a section of an array.\r\n * @param start The beginning of the specified portion of the array.\r\n * @param end The end of the specified portion of the array.\r\n */\r\n slice(start?: number, end?: number): Float64Array;\r\n\r\n /**\r\n * Determines whether the specified callback function returns true for any element of an array.\r\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\r\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\r\n * the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Sorts an array.\r\n * @param compareFn The name of the function used to determine the order of the elements. If\r\n * omitted, the elements are sorted in ascending, ASCII character order.\r\n */\r\n sort(compareFn?: (a: number, b: number) => number): this;\r\n\r\n /**\r\n * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements\r\n * at begin, inclusive, up to end, exclusive.\r\n * @param begin The index of the beginning of the array.\r\n * @param end The index of the end of the array.\r\n */\r\n subarray(begin: number, end?: number): Float64Array;\r\n\r\n /**\r\n * Converts a number to a string by using the current locale.\r\n */\r\n toLocaleString(): string;\r\n\r\n /**\r\n * Returns a string representation of an array.\r\n */\r\n toString(): string;\r\n\r\n [index: number]: number;\r\n}\r\n\r\ninterface Float64ArrayConstructor {\r\n readonly prototype: Float64Array;\r\n new (length: number): Float64Array;\r\n new (array: ArrayLike): Float64Array;\r\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array;\r\n\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * Returns a new array from a set of elements.\r\n * @param items A set of elements to include in the new array object.\r\n */\r\n of(...items: number[]): Float64Array;\r\n\r\n /**\r\n * Creates an array from an array-like or iterable object.\r\n * @param arrayLike An array-like or iterable object to convert to an array.\r\n * @param mapfn A mapping function to call on every element of the array.\r\n * @param thisArg Value of 'this' used to invoke the mapfn.\r\n */\r\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array;\r\n}\r\ndeclare const Float64Array: Float64ArrayConstructor;\r\n\r\n/////////////////////////////\r\n/// ECMAScript Internationalization API\r\n/////////////////////////////\r\n\r\ndeclare module Intl {\r\n interface CollatorOptions {\r\n usage?: string;\r\n localeMatcher?: string;\r\n numeric?: boolean;\r\n caseFirst?: string;\r\n sensitivity?: string;\r\n ignorePunctuation?: boolean;\r\n }\r\n\r\n interface ResolvedCollatorOptions {\r\n locale: string;\r\n usage: string;\r\n sensitivity: string;\r\n ignorePunctuation: boolean;\r\n collation: string;\r\n caseFirst: string;\r\n numeric: boolean;\r\n }\r\n\r\n interface Collator {\r\n compare(x: string, y: string): number;\r\n resolvedOptions(): ResolvedCollatorOptions;\r\n }\r\n var Collator: {\r\n new (locales?: string[], options?: CollatorOptions): Collator;\r\n new (locale?: string, options?: CollatorOptions): Collator;\r\n (locales?: string[], options?: CollatorOptions): Collator;\r\n (locale?: string, options?: CollatorOptions): Collator;\r\n supportedLocalesOf(locales: string[], options?: CollatorOptions): string[];\r\n supportedLocalesOf(locale: string, options?: CollatorOptions): string[];\r\n }\r\n\r\n interface NumberFormatOptions {\r\n localeMatcher?: string;\r\n style?: string;\r\n currency?: string;\r\n currencyDisplay?: string;\r\n useGrouping?: boolean;\r\n minimumIntegerDigits?: number;\r\n minimumFractionDigits?: number;\r\n maximumFractionDigits?: number;\r\n minimumSignificantDigits?: number;\r\n maximumSignificantDigits?: number;\r\n }\r\n\r\n interface ResolvedNumberFormatOptions {\r\n locale: string;\r\n numberingSystem: string;\r\n style: string;\r\n currency?: string;\r\n currencyDisplay?: string;\r\n minimumIntegerDigits: number;\r\n minimumFractionDigits: number;\r\n maximumFractionDigits: number;\r\n minimumSignificantDigits?: number;\r\n maximumSignificantDigits?: number;\r\n useGrouping: boolean;\r\n }\r\n\r\n interface NumberFormat {\r\n format(value: number): string;\r\n resolvedOptions(): ResolvedNumberFormatOptions;\r\n }\r\n var NumberFormat: {\r\n new (locales?: string[], options?: NumberFormatOptions): NumberFormat;\r\n new (locale?: string, options?: NumberFormatOptions): NumberFormat;\r\n (locales?: string[], options?: NumberFormatOptions): NumberFormat;\r\n (locale?: string, options?: NumberFormatOptions): NumberFormat;\r\n supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[];\r\n supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[];\r\n }\r\n\r\n interface DateTimeFormatOptions {\r\n localeMatcher?: string;\r\n weekday?: string;\r\n era?: string;\r\n year?: string;\r\n month?: string;\r\n day?: string;\r\n hour?: string;\r\n minute?: string;\r\n second?: string;\r\n timeZoneName?: string;\r\n formatMatcher?: string;\r\n hour12?: boolean;\r\n timeZone?: string;\r\n }\r\n\r\n interface ResolvedDateTimeFormatOptions {\r\n locale: string;\r\n calendar: string;\r\n numberingSystem: string;\r\n timeZone: string;\r\n hour12?: boolean;\r\n weekday?: string;\r\n era?: string;\r\n year?: string;\r\n month?: string;\r\n day?: string;\r\n hour?: string;\r\n minute?: string;\r\n second?: string;\r\n timeZoneName?: string;\r\n }\r\n\r\n interface DateTimeFormat {\r\n format(date?: Date | number): string;\r\n resolvedOptions(): ResolvedDateTimeFormatOptions;\r\n }\r\n var DateTimeFormat: {\r\n new (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat;\r\n new (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat;\r\n (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat;\r\n (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat;\r\n supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[];\r\n supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[];\r\n }\r\n}\r\n\r\ninterface String {\r\n /**\r\n * Determines whether two strings are equivalent in the current locale.\r\n * @param that String to compare to target string\r\n * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.\r\n * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details.\r\n */\r\n localeCompare(that: string, locales: string[], options?: Intl.CollatorOptions): number;\r\n\r\n /**\r\n * Determines whether two strings are equivalent in the current locale.\r\n * @param that String to compare to target string\r\n * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.\r\n * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details.\r\n */\r\n localeCompare(that: string, locale: string, options?: Intl.CollatorOptions): number;\r\n}\r\n\r\ninterface Number {\r\n /**\r\n * Converts a number to a string by using the current or specified locale.\r\n * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.\r\n * @param options An object that contains one or more properties that specify comparison options.\r\n */\r\n toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string;\r\n\r\n /**\r\n * Converts a number to a string by using the current or specified locale.\r\n * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.\r\n * @param options An object that contains one or more properties that specify comparison options.\r\n */\r\n toLocaleString(locale?: string, options?: Intl.NumberFormatOptions): string;\r\n}\r\n\r\ninterface Date {\r\n /**\r\n * Converts a date and time to a string by using the current or specified locale.\r\n * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.\r\n * @param options An object that contains one or more properties that specify comparison options.\r\n */\r\n toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;\r\n /**\r\n * Converts a date to a string by using the current or specified locale.\r\n * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.\r\n * @param options An object that contains one or more properties that specify comparison options.\r\n */\r\n toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;\r\n\r\n /**\r\n * Converts a time to a string by using the current or specified locale.\r\n * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.\r\n * @param options An object that contains one or more properties that specify comparison options.\r\n */\r\n toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string;\r\n\r\n /**\r\n * Converts a date and time to a string by using the current or specified locale.\r\n * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.\r\n * @param options An object that contains one or more properties that specify comparison options.\r\n */\r\n toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;\r\n\r\n /**\r\n * Converts a date to a string by using the current or specified locale.\r\n * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.\r\n * @param options An object that contains one or more properties that specify comparison options.\r\n */\r\n toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string;\r\n\r\n /**\r\n * Converts a time to a string by using the current or specified locale.\r\n * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.\r\n * @param options An object that contains one or more properties that specify comparison options.\r\n */\r\n toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string;\r\n}\r\ndeclare type PropertyKey = string | number | symbol;\r\n\r\ninterface Array {\r\n /**\r\n * Returns the value of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found, find\r\n * immediately returns that element value. Otherwise, find returns undefined.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T | undefined;\r\n\r\n /**\r\n * Returns the index of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found, \r\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n findIndex(predicate: (value: T) => boolean, thisArg?: any): number;\r\n\r\n /**\r\n * Returns the this object after filling the section identified by start and end with value\r\n * @param value value to fill array section with\r\n * @param start index to start filling the array at. If start is negative, it is treated as\r\n * length+start where length is the length of the array.\r\n * @param end index to stop filling the array at. If end is negative, it is treated as\r\n * length+end.\r\n */\r\n fill(value: T, start?: number, end?: number): this;\r\n\r\n /**\r\n * Returns the this object after copying a section of the array identified by start and end\r\n * to the same array starting at position target\r\n * @param target If target is negative, it is treated as length+target where length is the\r\n * length of the array.\r\n * @param start If start is negative, it is treated as length+start. If end is negative, it\r\n * is treated as length+end.\r\n * @param end If not specified, length of the this object is used as its default value.\r\n */\r\n copyWithin(target: number, start: number, end?: number): this;\r\n}\r\n\r\ninterface ArrayConstructor {\r\n /**\r\n * Creates an array from an array-like object.\r\n * @param arrayLike An array-like object to convert to an array.\r\n * @param mapfn A mapping function to call on every element of the array.\r\n * @param thisArg Value of 'this' used to invoke the mapfn.\r\n */\r\n from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array;\r\n\r\n\r\n /**\r\n * Creates an array from an array-like object.\r\n * @param arrayLike An array-like object to convert to an array.\r\n */\r\n from(arrayLike: ArrayLike): Array;\r\n\r\n /**\r\n * Returns a new array from a set of elements.\r\n * @param items A set of elements to include in the new array object.\r\n */\r\n of(...items: T[]): Array;\r\n}\r\n\r\ninterface DateConstructor {\r\n new (value: Date): Date;\r\n}\r\n\r\ninterface Function {\r\n /**\r\n * Returns the name of the function. Function names are read-only and can not be changed.\r\n */\r\n readonly name: string;\r\n}\r\n\r\ninterface Math {\r\n /**\r\n * Returns the number of leading zero bits in the 32-bit binary representation of a number.\r\n * @param x A numeric expression.\r\n */\r\n clz32(x: number): number;\r\n\r\n /**\r\n * Returns the result of 32-bit multiplication of two numbers.\r\n * @param x First number\r\n * @param y Second number\r\n */\r\n imul(x: number, y: number): number;\r\n\r\n /**\r\n * Returns the sign of the x, indicating whether x is positive, negative or zero.\r\n * @param x The numeric expression to test\r\n */\r\n sign(x: number): number;\r\n\r\n /**\r\n * Returns the base 10 logarithm of a number.\r\n * @param x A numeric expression.\r\n */\r\n log10(x: number): number;\r\n\r\n /**\r\n * Returns the base 2 logarithm of a number.\r\n * @param x A numeric expression.\r\n */\r\n log2(x: number): number;\r\n\r\n /**\r\n * Returns the natural logarithm of 1 + x.\r\n * @param x A numeric expression.\r\n */\r\n log1p(x: number): number;\r\n\r\n /**\r\n * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of\r\n * the natural logarithms).\r\n * @param x A numeric expression.\r\n */\r\n expm1(x: number): number;\r\n\r\n /**\r\n * Returns the hyperbolic cosine of a number.\r\n * @param x A numeric expression that contains an angle measured in radians.\r\n */\r\n cosh(x: number): number;\r\n\r\n /**\r\n * Returns the hyperbolic sine of a number.\r\n * @param x A numeric expression that contains an angle measured in radians.\r\n */\r\n sinh(x: number): number;\r\n\r\n /**\r\n * Returns the hyperbolic tangent of a number.\r\n * @param x A numeric expression that contains an angle measured in radians.\r\n */\r\n tanh(x: number): number;\r\n\r\n /**\r\n * Returns the inverse hyperbolic cosine of a number.\r\n * @param x A numeric expression that contains an angle measured in radians.\r\n */\r\n acosh(x: number): number;\r\n\r\n /**\r\n * Returns the inverse hyperbolic sine of a number.\r\n * @param x A numeric expression that contains an angle measured in radians.\r\n */\r\n asinh(x: number): number;\r\n\r\n /**\r\n * Returns the inverse hyperbolic tangent of a number.\r\n * @param x A numeric expression that contains an angle measured in radians.\r\n */\r\n atanh(x: number): number;\r\n\r\n /**\r\n * Returns the square root of the sum of squares of its arguments.\r\n * @param values Values to compute the square root for.\r\n * If no arguments are passed, the result is +0.\r\n * If there is only one argument, the result is the absolute value.\r\n * If any argument is +Infinity or -Infinity, the result is +Infinity.\r\n * If any argument is NaN, the result is NaN.\r\n * If all arguments are either +0 or −0, the result is +0.\r\n */\r\n hypot(...values: number[] ): number;\r\n\r\n /**\r\n * Returns the integral part of the a numeric expression, x, removing any fractional digits.\r\n * If x is already an integer, the result is x.\r\n * @param x A numeric expression.\r\n */\r\n trunc(x: number): number;\r\n\r\n /**\r\n * Returns the nearest single precision float representation of a number.\r\n * @param x A numeric expression.\r\n */\r\n fround(x: number): number;\r\n\r\n /**\r\n * Returns an implementation-dependent approximation to the cube root of number.\r\n * @param x A numeric expression.\r\n */\r\n cbrt(x: number): number;\r\n}\r\n\r\ninterface NumberConstructor {\r\n /**\r\n * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1\r\n * that is representable as a Number value, which is approximately:\r\n * 2.2204460492503130808472633361816 x 10‍−‍16.\r\n */\r\n readonly EPSILON: number;\r\n\r\n /**\r\n * Returns true if passed value is finite.\r\n * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a\r\n * number. Only finite values of the type number, result in true.\r\n * @param number A numeric value.\r\n */\r\n isFinite(number: number): boolean;\r\n\r\n /**\r\n * Returns true if the value passed is an integer, false otherwise.\r\n * @param number A numeric value.\r\n */\r\n isInteger(number: number): boolean;\r\n\r\n /**\r\n * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a\r\n * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter\r\n * to a number. Only values of the type number, that are also NaN, result in true.\r\n * @param number A numeric value.\r\n */\r\n isNaN(number: number): boolean;\r\n\r\n /**\r\n * Returns true if the value passed is a safe integer.\r\n * @param number A numeric value.\r\n */\r\n isSafeInteger(number: number): boolean;\r\n\r\n /**\r\n * The value of the largest integer n such that n and n + 1 are both exactly representable as\r\n * a Number value.\r\n * The value of Number.MAX_SAFE_INTEGER is 9007199254740991 2^53 − 1.\r\n */\r\n readonly MAX_SAFE_INTEGER: number;\r\n\r\n /**\r\n * The value of the smallest integer n such that n and n − 1 are both exactly representable as\r\n * a Number value.\r\n * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)).\r\n */\r\n readonly MIN_SAFE_INTEGER: number;\r\n\r\n /**\r\n * Converts a string to a floating-point number.\r\n * @param string A string that contains a floating-point number.\r\n */\r\n parseFloat(string: string): number;\r\n\r\n /**\r\n * Converts A string to an integer.\r\n * @param s A string to convert into a number.\r\n * @param radix A value between 2 and 36 that specifies the base of the number in numString.\r\n * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\n * All other strings are considered decimal.\r\n */\r\n parseInt(string: string, radix?: number): number;\r\n}\r\n\r\ninterface Object {\r\n /**\r\n * Determines whether an object has a property with the specified name.\r\n * @param v A property name.\r\n */\r\n hasOwnProperty(v: PropertyKey): boolean\r\n\r\n /**\r\n * Determines whether a specified property is enumerable.\r\n * @param v A property name.\r\n */\r\n propertyIsEnumerable(v: PropertyKey): boolean;\r\n}\r\n\r\ninterface ObjectConstructor {\r\n /**\r\n * Copy the values of all of the enumerable own properties from one or more source objects to a\r\n * target object. Returns the target object.\r\n * @param target The target object to copy to.\r\n * @param source The source object from which to copy properties.\r\n */\r\n assign(target: T, source: U): T & U;\r\n\r\n /**\r\n * Copy the values of all of the enumerable own properties from one or more source objects to a\r\n * target object. Returns the target object.\r\n * @param target The target object to copy to.\r\n * @param source1 The first source object from which to copy properties.\r\n * @param source2 The second source object from which to copy properties.\r\n */\r\n assign(target: T, source1: U, source2: V): T & U & V;\r\n\r\n /**\r\n * Copy the values of all of the enumerable own properties from one or more source objects to a\r\n * target object. Returns the target object.\r\n * @param target The target object to copy to.\r\n * @param source1 The first source object from which to copy properties.\r\n * @param source2 The second source object from which to copy properties.\r\n * @param source3 The third source object from which to copy properties.\r\n */\r\n assign(target: T, source1: U, source2: V, source3: W): T & U & V & W;\r\n\r\n /**\r\n * Copy the values of all of the enumerable own properties from one or more source objects to a\r\n * target object. Returns the target object.\r\n * @param target The target object to copy to.\r\n * @param sources One or more source objects from which to copy properties\r\n */\r\n assign(target: any, ...sources: any[]): any;\r\n\r\n /**\r\n * Returns an array of all symbol properties found directly on object o.\r\n * @param o Object to retrieve the symbols from.\r\n */\r\n getOwnPropertySymbols(o: any): symbol[];\r\n\r\n /**\r\n * Returns true if the values are the same value, false otherwise.\r\n * @param value1 The first value.\r\n * @param value2 The second value.\r\n */\r\n is(value1: any, value2: any): boolean;\r\n\r\n /**\r\n * Sets the prototype of a specified object o to object proto or null. Returns the object o.\r\n * @param o The object to change its prototype.\r\n * @param proto The value of the new prototype or null.\r\n */\r\n setPrototypeOf(o: any, proto: any): any;\r\n\r\n /**\r\n * Gets the own property descriptor of the specified object.\r\n * An own property descriptor is one that is defined directly on the object and is not\r\n * inherited from the object's prototype.\r\n * @param o Object that contains the property.\r\n * @param p Name of the property.\r\n */\r\n getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor;\r\n\r\n /**\r\n * Adds a property to an object, or modifies attributes of an existing property.\r\n * @param o Object on which to add or modify the property. This can be a native JavaScript\r\n * object (that is, a user-defined object or a built in object) or a DOM object.\r\n * @param p The property name.\r\n * @param attributes Descriptor for the property. It can be for a data property or an accessor\r\n * property.\r\n */\r\n defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any;\r\n}\r\n\r\ninterface ReadonlyArray {\r\n /**\r\n * Returns the value of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found, find\r\n * immediately returns that element value. Otherwise, find returns undefined.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n find(predicate: (value: T, index: number, obj: ReadonlyArray) => boolean, thisArg?: any): T | undefined;\r\n\r\n /**\r\n * Returns the index of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found, \r\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n findIndex(predicate: (value: T) => boolean, thisArg?: any): number;\r\n}\r\n\r\ninterface RegExp {\r\n /**\r\n * Returns a string indicating the flags of the regular expression in question. This field is read-only.\r\n * The characters in this string are sequenced and concatenated in the following order:\r\n *\r\n * - \"g\" for global\r\n * - \"i\" for ignoreCase\r\n * - \"m\" for multiline\r\n * - \"u\" for unicode\r\n * - \"y\" for sticky\r\n *\r\n * If no flags are set, the value is the empty string.\r\n */\r\n readonly flags: string;\r\n\r\n /**\r\n * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular\r\n * expression. Default is false. Read-only.\r\n */\r\n readonly sticky: boolean;\r\n\r\n /**\r\n * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular\r\n * expression. Default is false. Read-only.\r\n */\r\n readonly unicode: boolean;\r\n}\r\n\r\ninterface RegExpConstructor {\r\n new (pattern: RegExp, flags?: string): RegExp;\r\n (pattern: RegExp, flags?: string): RegExp;\r\n}\r\n\r\ninterface String {\r\n /**\r\n * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point\r\n * value of the UTF-16 encoded code point starting at the string element at position pos in\r\n * the String resulting from converting this object to a String.\r\n * If there is no element at that position, the result is undefined.\r\n * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos.\r\n */\r\n codePointAt(pos: number): number | undefined;\r\n\r\n /**\r\n * Returns true if searchString appears as a substring of the result of converting this\r\n * object to a String, at one or more positions that are\r\n * greater than or equal to position; otherwise, returns false.\r\n * @param searchString search string\r\n * @param position If position is undefined, 0 is assumed, so as to search all of the String.\r\n */\r\n includes(searchString: string, position?: number): boolean;\r\n\r\n /**\r\n * Returns true if the sequence of elements of searchString converted to a String is the\r\n * same as the corresponding elements of this object (converted to a String) starting at\r\n * endPosition – length(this). Otherwise returns false.\r\n */\r\n endsWith(searchString: string, endPosition?: number): boolean;\r\n\r\n /**\r\n * Returns the String value result of normalizing the string into the normalization form\r\n * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.\r\n * @param form Applicable values: \"NFC\", \"NFD\", \"NFKC\", or \"NFKD\", If not specified default\r\n * is \"NFC\"\r\n */\r\n normalize(form: \"NFC\" | \"NFD\" | \"NFKC\" | \"NFKD\"): string;\r\n\r\n /**\r\n * Returns the String value result of normalizing the string into the normalization form\r\n * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.\r\n * @param form Applicable values: \"NFC\", \"NFD\", \"NFKC\", or \"NFKD\", If not specified default\r\n * is \"NFC\"\r\n */\r\n normalize(form?: string): string;\r\n\r\n /**\r\n * Returns a String value that is made from count copies appended together. If count is 0,\r\n * T is the empty String is returned.\r\n * @param count number of copies to append\r\n */\r\n repeat(count: number): string;\r\n\r\n /**\r\n * Returns true if the sequence of elements of searchString converted to a String is the\r\n * same as the corresponding elements of this object (converted to a String) starting at\r\n * position. Otherwise returns false.\r\n */\r\n startsWith(searchString: string, position?: number): boolean;\r\n\r\n /**\r\n * Returns an HTML anchor element and sets the name attribute to the text value\r\n * @param name\r\n */\r\n anchor(name: string): string;\r\n\r\n /** Returns a HTML element */\r\n big(): string;\r\n\r\n /** Returns a HTML element */\r\n blink(): string;\r\n\r\n /** Returns a HTML element */\r\n bold(): string;\r\n\r\n /** Returns a HTML element */\r\n fixed(): string\r\n\r\n /** Returns a HTML element and sets the color attribute value */\r\n fontcolor(color: string): string\r\n\r\n /** Returns a HTML element and sets the size attribute value */\r\n fontsize(size: number): string;\r\n\r\n /** Returns a HTML element and sets the size attribute value */\r\n fontsize(size: string): string;\r\n\r\n /** Returns an HTML element */\r\n italics(): string;\r\n\r\n /** Returns an HTML element and sets the href attribute value */\r\n link(url: string): string;\r\n\r\n /** Returns a HTML element */\r\n small(): string;\r\n\r\n /** Returns a HTML element */\r\n strike(): string;\r\n\r\n /** Returns a HTML element */\r\n sub(): string;\r\n\r\n /** Returns a HTML element */\r\n sup(): string;\r\n}\r\n\r\ninterface StringConstructor {\r\n /**\r\n * Return the String value whose elements are, in order, the elements in the List elements.\r\n * If length is 0, the empty string is returned.\r\n */\r\n fromCodePoint(...codePoints: number[]): string;\r\n\r\n /**\r\n * String.raw is intended for use as a tag function of a Tagged Template String. When called\r\n * as such the first argument will be a well formed template call site object and the rest\r\n * parameter will contain the substitution values.\r\n * @param template A well-formed template string call site representation.\r\n * @param substitutions A set of substitution values.\r\n */\r\n raw(template: TemplateStringsArray, ...substitutions: any[]): string;\r\n}\r\ninterface Map {\r\n clear(): void;\r\n delete(key: K): boolean;\r\n forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void;\r\n get(key: K): V | undefined;\r\n has(key: K): boolean;\r\n set(key: K, value?: V): this;\r\n readonly size: number;\r\n}\r\n\r\ninterface MapConstructor {\r\n new (): Map;\r\n new (entries?: [K, V][]): Map;\r\n readonly prototype: Map;\r\n}\r\ndeclare var Map: MapConstructor;\r\n\r\ninterface WeakMap {\r\n delete(key: K): boolean;\r\n get(key: K): V | undefined;\r\n has(key: K): boolean;\r\n set(key: K, value?: V): this;\r\n}\r\n\r\ninterface WeakMapConstructor {\r\n new (): WeakMap;\r\n new (entries?: [K, V][]): WeakMap;\r\n readonly prototype: WeakMap;\r\n}\r\ndeclare var WeakMap: WeakMapConstructor;\r\n\r\ninterface Set {\r\n add(value: T): this;\r\n clear(): void;\r\n delete(value: T): boolean;\r\n forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void;\r\n has(value: T): boolean;\r\n readonly size: number;\r\n}\r\n\r\ninterface SetConstructor {\r\n new (): Set;\r\n new (values?: T[]): Set;\r\n readonly prototype: Set;\r\n}\r\ndeclare var Set: SetConstructor;\r\n\r\ninterface WeakSet {\r\n add(value: T): this;\r\n delete(value: T): boolean;\r\n has(value: T): boolean;\r\n}\r\n\r\ninterface WeakSetConstructor {\r\n new (): WeakSet;\r\n new (values?: T[]): WeakSet;\r\n readonly prototype: WeakSet;\r\n}\r\ndeclare var WeakSet: WeakSetConstructor;\r\ninterface GeneratorFunction extends Function { }\r\n\r\ninterface GeneratorFunctionConstructor {\r\n /**\r\n * Creates a new Generator function.\r\n * @param args A list of arguments the function accepts.\r\n */\r\n new (...args: string[]): GeneratorFunction;\r\n (...args: string[]): GeneratorFunction;\r\n readonly prototype: GeneratorFunction;\r\n}\r\ndeclare var GeneratorFunction: GeneratorFunctionConstructor;\r\n/// \r\n\r\ninterface SymbolConstructor {\r\n /** \r\n * A method that returns the default iterator for an object. Called by the semantics of the \r\n * for-of statement.\r\n */\r\n readonly iterator: symbol;\r\n}\r\n\r\ninterface IteratorResult {\r\n done: boolean;\r\n value: T;\r\n}\r\n\r\ninterface Iterator {\r\n next(value?: any): IteratorResult;\r\n return?(value?: any): IteratorResult;\r\n throw?(e?: any): IteratorResult;\r\n}\r\n\r\ninterface Iterable {\r\n [Symbol.iterator](): Iterator;\r\n}\r\n\r\ninterface IterableIterator extends Iterator {\r\n [Symbol.iterator](): IterableIterator;\r\n}\r\n\r\ninterface Array {\r\n /** Iterator */\r\n [Symbol.iterator](): IterableIterator;\r\n\r\n /** \r\n * Returns an array of key, value pairs for every entry in the array\r\n */\r\n entries(): IterableIterator<[number, T]>;\r\n\r\n /** \r\n * Returns an list of keys in the array\r\n */\r\n keys(): IterableIterator;\r\n\r\n /** \r\n * Returns an list of values in the array\r\n */\r\n values(): IterableIterator;\r\n}\r\n\r\ninterface ArrayConstructor {\r\n /**\r\n * Creates an array from an iterable object.\r\n * @param iterable An iterable object to convert to an array.\r\n * @param mapfn A mapping function to call on every element of the array.\r\n * @param thisArg Value of 'this' used to invoke the mapfn.\r\n */\r\n from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array;\r\n \r\n /**\r\n * Creates an array from an iterable object.\r\n * @param iterable An iterable object to convert to an array.\r\n */\r\n from(iterable: Iterable): Array;\r\n}\r\n\r\ninterface ReadonlyArray {\r\n /** Iterator */\r\n [Symbol.iterator](): IterableIterator;\r\n\r\n /** \r\n * Returns an array of key, value pairs for every entry in the array\r\n */\r\n entries(): IterableIterator<[number, T]>;\r\n\r\n /** \r\n * Returns an list of keys in the array\r\n */\r\n keys(): IterableIterator;\r\n\r\n /** \r\n * Returns an list of values in the array\r\n */\r\n values(): IterableIterator;\r\n}\r\n\r\ninterface IArguments {\r\n /** Iterator */\r\n [Symbol.iterator](): IterableIterator;\r\n}\r\n\r\ninterface Map {\r\n [Symbol.iterator](): IterableIterator<[K,V]>;\r\n entries(): IterableIterator<[K, V]>;\r\n keys(): IterableIterator;\r\n values(): IterableIterator;\r\n}\r\n\r\ninterface MapConstructor {\r\n new (iterable: Iterable<[K, V]>): Map;\r\n}\r\n\r\ninterface WeakMap { }\r\n\r\ninterface WeakMapConstructor {\r\n new (iterable: Iterable<[K, V]>): WeakMap;\r\n}\r\n\r\ninterface Set {\r\n [Symbol.iterator](): IterableIterator;\r\n entries(): IterableIterator<[T, T]>;\r\n keys(): IterableIterator;\r\n values(): IterableIterator;\r\n}\r\n\r\ninterface SetConstructor {\r\n new (iterable: Iterable): Set;\r\n}\r\n\r\ninterface WeakSet { }\r\n\r\ninterface WeakSetConstructor {\r\n new (iterable: Iterable): WeakSet;\r\n}\r\n\r\ninterface Promise { }\r\n\r\ninterface PromiseConstructor {\r\n /**\r\n * Creates a Promise that is resolved with an array of results when all of the provided Promises \r\n * resolve, or rejected when any Promise is rejected.\r\n * @param values An array of Promises.\r\n * @returns A new Promise.\r\n */\r\n all(values: Iterable>): Promise;\r\n \r\n /**\r\n * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved \r\n * or rejected.\r\n * @param values An array of Promises.\r\n * @returns A new Promise.\r\n */\r\n race(values: Iterable>): Promise;\r\n}\r\n\r\ndeclare namespace Reflect {\r\n function enumerate(target: any): IterableIterator;\r\n}\r\n\r\ninterface String {\r\n /** Iterator */\r\n [Symbol.iterator](): IterableIterator;\r\n}\r\n\r\n/**\r\n * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested \r\n * number of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Int8Array {\r\n [Symbol.iterator](): IterableIterator;\r\n /** \r\n * Returns an array of key, value pairs for every entry in the array\r\n */\r\n entries(): IterableIterator<[number, number]>;\r\n /** \r\n * Returns an list of keys in the array\r\n */\r\n keys(): IterableIterator;\r\n /** \r\n * Returns an list of values in the array\r\n */\r\n values(): IterableIterator;\r\n}\r\n\r\ninterface Int8ArrayConstructor {\r\n new (elements: Iterable): Int8Array;\r\n\r\n /**\r\n * Creates an array from an array-like or iterable object.\r\n * @param arrayLike An array-like or iterable object to convert to an array.\r\n * @param mapfn A mapping function to call on every element of the array.\r\n * @param thisArg Value of 'this' used to invoke the mapfn.\r\n */\r\n from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array;\r\n}\r\n\r\n/**\r\n * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the \r\n * requested number of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Uint8Array {\r\n [Symbol.iterator](): IterableIterator;\r\n /** \r\n * Returns an array of key, value pairs for every entry in the array\r\n */\r\n entries(): IterableIterator<[number, number]>;\r\n /** \r\n * Returns an list of keys in the array\r\n */\r\n keys(): IterableIterator;\r\n /** \r\n * Returns an list of values in the array\r\n */\r\n values(): IterableIterator;\r\n}\r\n\r\ninterface Uint8ArrayConstructor {\r\n new (elements: Iterable): Uint8Array;\r\n\r\n /**\r\n * Creates an array from an array-like or iterable object.\r\n * @param arrayLike An array-like or iterable object to convert to an array.\r\n * @param mapfn A mapping function to call on every element of the array.\r\n * @param thisArg Value of 'this' used to invoke the mapfn.\r\n */\r\n from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array;\r\n}\r\n\r\n/**\r\n * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. \r\n * If the requested number of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Uint8ClampedArray {\r\n [Symbol.iterator](): IterableIterator;\r\n /** \r\n * Returns an array of key, value pairs for every entry in the array\r\n */\r\n entries(): IterableIterator<[number, number]>;\r\n\r\n /** \r\n * Returns an list of keys in the array\r\n */\r\n keys(): IterableIterator;\r\n\r\n /** \r\n * Returns an list of values in the array\r\n */\r\n values(): IterableIterator;\r\n}\r\n\r\ninterface Uint8ClampedArrayConstructor {\r\n new (elements: Iterable): Uint8ClampedArray;\r\n\r\n\r\n /**\r\n * Creates an array from an array-like or iterable object.\r\n * @param arrayLike An array-like or iterable object to convert to an array.\r\n * @param mapfn A mapping function to call on every element of the array.\r\n * @param thisArg Value of 'this' used to invoke the mapfn.\r\n */\r\n from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray;\r\n}\r\n\r\n/**\r\n * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the \r\n * requested number of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Int16Array {\r\n [Symbol.iterator](): IterableIterator;\r\n /** \r\n * Returns an array of key, value pairs for every entry in the array\r\n */\r\n entries(): IterableIterator<[number, number]>;\r\n\r\n /** \r\n * Returns an list of keys in the array\r\n */\r\n keys(): IterableIterator;\r\n\r\n /** \r\n * Returns an list of values in the array\r\n */\r\n values(): IterableIterator;\r\n}\r\n\r\ninterface Int16ArrayConstructor {\r\n new (elements: Iterable): Int16Array;\r\n\r\n /**\r\n * Creates an array from an array-like or iterable object.\r\n * @param arrayLike An array-like or iterable object to convert to an array.\r\n * @param mapfn A mapping function to call on every element of the array.\r\n * @param thisArg Value of 'this' used to invoke the mapfn.\r\n */\r\n from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array;\r\n}\r\n\r\n/**\r\n * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the \r\n * requested number of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Uint16Array {\r\n [Symbol.iterator](): IterableIterator;\r\n /** \r\n * Returns an array of key, value pairs for every entry in the array\r\n */\r\n entries(): IterableIterator<[number, number]>;\r\n /** \r\n * Returns an list of keys in the array\r\n */\r\n keys(): IterableIterator;\r\n /** \r\n * Returns an list of values in the array\r\n */\r\n values(): IterableIterator;\r\n}\r\n\r\ninterface Uint16ArrayConstructor {\r\n new (elements: Iterable): Uint16Array;\r\n\r\n /**\r\n * Creates an array from an array-like or iterable object.\r\n * @param arrayLike An array-like or iterable object to convert to an array.\r\n * @param mapfn A mapping function to call on every element of the array.\r\n * @param thisArg Value of 'this' used to invoke the mapfn.\r\n */\r\n from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array;\r\n}\r\n\r\n/**\r\n * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the \r\n * requested number of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Int32Array {\r\n [Symbol.iterator](): IterableIterator;\r\n /** \r\n * Returns an array of key, value pairs for every entry in the array\r\n */\r\n entries(): IterableIterator<[number, number]>;\r\n /** \r\n * Returns an list of keys in the array\r\n */\r\n keys(): IterableIterator;\r\n /** \r\n * Returns an list of values in the array\r\n */\r\n values(): IterableIterator;\r\n}\r\n\r\ninterface Int32ArrayConstructor {\r\n new (elements: Iterable): Int32Array;\r\n\r\n /**\r\n * Creates an array from an array-like or iterable object.\r\n * @param arrayLike An array-like or iterable object to convert to an array.\r\n * @param mapfn A mapping function to call on every element of the array.\r\n * @param thisArg Value of 'this' used to invoke the mapfn.\r\n */\r\n from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array;\r\n}\r\n\r\n/**\r\n * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the \r\n * requested number of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Uint32Array {\r\n [Symbol.iterator](): IterableIterator;\r\n /** \r\n * Returns an array of key, value pairs for every entry in the array\r\n */\r\n entries(): IterableIterator<[number, number]>;\r\n /** \r\n * Returns an list of keys in the array\r\n */\r\n keys(): IterableIterator;\r\n /** \r\n * Returns an list of values in the array\r\n */\r\n values(): IterableIterator;\r\n}\r\n\r\ninterface Uint32ArrayConstructor {\r\n new (elements: Iterable): Uint32Array;\r\n\r\n /**\r\n * Creates an array from an array-like or iterable object.\r\n * @param arrayLike An array-like or iterable object to convert to an array.\r\n * @param mapfn A mapping function to call on every element of the array.\r\n * @param thisArg Value of 'this' used to invoke the mapfn.\r\n */\r\n from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array;\r\n}\r\n\r\n/**\r\n * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number\r\n * of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Float32Array {\r\n [Symbol.iterator](): IterableIterator;\r\n /** \r\n * Returns an array of key, value pairs for every entry in the array\r\n */\r\n entries(): IterableIterator<[number, number]>;\r\n /** \r\n * Returns an list of keys in the array\r\n */\r\n keys(): IterableIterator;\r\n /** \r\n * Returns an list of values in the array\r\n */\r\n values(): IterableIterator;\r\n}\r\n\r\ninterface Float32ArrayConstructor {\r\n new (elements: Iterable): Float32Array;\r\n\r\n /**\r\n * Creates an array from an array-like or iterable object.\r\n * @param arrayLike An array-like or iterable object to convert to an array.\r\n * @param mapfn A mapping function to call on every element of the array.\r\n * @param thisArg Value of 'this' used to invoke the mapfn.\r\n */\r\n from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array;\r\n}\r\n\r\n/**\r\n * A typed array of 64-bit float values. The contents are initialized to 0. If the requested \r\n * number of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Float64Array {\r\n [Symbol.iterator](): IterableIterator;\r\n /** \r\n * Returns an array of key, value pairs for every entry in the array\r\n */\r\n entries(): IterableIterator<[number, number]>;\r\n /** \r\n * Returns an list of keys in the array\r\n */\r\n keys(): IterableIterator;\r\n /** \r\n * Returns an list of values in the array\r\n */\r\n values(): IterableIterator;\r\n}\r\n\r\ninterface Float64ArrayConstructor {\r\n new (elements: Iterable): Float64Array;\r\n\r\n /**\r\n * Creates an array from an array-like or iterable object.\r\n * @param arrayLike An array-like or iterable object to convert to an array.\r\n * @param mapfn A mapping function to call on every element of the array.\r\n * @param thisArg Value of 'this' used to invoke the mapfn.\r\n */\r\n from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array;\r\n}/**\r\n * Represents the completion of an asynchronous operation\r\n */\r\ninterface Promise {\r\n /**\r\n * Attaches callbacks for the resolution and/or rejection of the Promise.\r\n * @param onfulfilled The callback to execute when the Promise is resolved.\r\n * @param onrejected The callback to execute when the Promise is rejected.\r\n * @returns A Promise for the completion of which ever callback is executed.\r\n */\r\n then(onfulfilled: (value: T) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise;\r\n\r\n /**\r\n * Attaches callbacks for the resolution and/or rejection of the Promise.\r\n * @param onfulfilled The callback to execute when the Promise is resolved.\r\n * @param onrejected The callback to execute when the Promise is rejected.\r\n * @returns A Promise for the completion of which ever callback is executed.\r\n */\r\n then(onfulfilled: (value: T) => TResult | PromiseLike, onrejected: (reason: any) => TResult | PromiseLike): Promise;\r\n\r\n /**\r\n * Attaches callbacks for the resolution and/or rejection of the Promise.\r\n * @param onfulfilled The callback to execute when the Promise is resolved.\r\n * @returns A Promise for the completion of which ever callback is executed.\r\n */\r\n then(onfulfilled: (value: T) => TResult | PromiseLike): Promise;\r\n\r\n /**\r\n * Creates a new Promise with the same internal state of this Promise.\r\n * @returns A Promise.\r\n */\r\n then(): Promise;\r\n\r\n /**\r\n * Attaches a callback for only the rejection of the Promise.\r\n * @param onrejected The callback to execute when the Promise is rejected.\r\n * @returns A Promise for the completion of the callback.\r\n */\r\n catch(onrejected: (reason: any) => TResult | PromiseLike): Promise;\r\n\r\n /**\r\n * Attaches a callback for only the rejection of the Promise.\r\n * @param onrejected The callback to execute when the Promise is rejected.\r\n * @returns A Promise for the completion of the callback.\r\n */\r\n catch(onrejected: (reason: any) => T | PromiseLike): Promise;\r\n}\r\n\r\ninterface PromiseConstructor {\r\n /**\r\n * A reference to the prototype.\r\n */\r\n readonly prototype: Promise;\r\n\r\n /**\r\n * Creates a new Promise.\r\n * @param executor A callback used to initialize the promise. This callback is passed two arguments:\r\n * a resolve callback used resolve the promise with a value or the result of another promise,\r\n * and a reject callback used to reject the promise with a provided reason or error.\r\n */\r\n new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise;\r\n\r\n /**\r\n * Creates a Promise that is resolved with an array of results when all of the provided Promises\r\n * resolve, or rejected when any Promise is rejected.\r\n * @param values An array of Promises.\r\n * @returns A new Promise.\r\n */\r\n all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;\r\n\r\n /**\r\n * Creates a Promise that is resolved with an array of results when all of the provided Promises\r\n * resolve, or rejected when any Promise is rejected.\r\n * @param values An array of Promises.\r\n * @returns A new Promise.\r\n */\r\n all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;\r\n\r\n /**\r\n * Creates a Promise that is resolved with an array of results when all of the provided Promises\r\n * resolve, or rejected when any Promise is rejected.\r\n * @param values An array of Promises.\r\n * @returns A new Promise.\r\n */\r\n all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;\r\n\r\n /**\r\n * Creates a Promise that is resolved with an array of results when all of the provided Promises\r\n * resolve, or rejected when any Promise is rejected.\r\n * @param values An array of Promises.\r\n * @returns A new Promise.\r\n */\r\n all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;\r\n\r\n /**\r\n * Creates a Promise that is resolved with an array of results when all of the provided Promises\r\n * resolve, or rejected when any Promise is rejected.\r\n * @param values An array of Promises.\r\n * @returns A new Promise.\r\n */\r\n all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>;\r\n\r\n /**\r\n * Creates a Promise that is resolved with an array of results when all of the provided Promises\r\n * resolve, or rejected when any Promise is rejected.\r\n * @param values An array of Promises.\r\n * @returns A new Promise.\r\n */\r\n all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>;\r\n\r\n /**\r\n * Creates a Promise that is resolved with an array of results when all of the provided Promises\r\n * resolve, or rejected when any Promise is rejected.\r\n * @param values An array of Promises.\r\n * @returns A new Promise.\r\n */\r\n all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike ]): Promise<[T1, T2, T3, T4]>;\r\n\r\n /**\r\n * Creates a Promise that is resolved with an array of results when all of the provided Promises\r\n * resolve, or rejected when any Promise is rejected.\r\n * @param values An array of Promises.\r\n * @returns A new Promise.\r\n */\r\n all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>;\r\n\r\n /**\r\n * Creates a Promise that is resolved with an array of results when all of the provided Promises\r\n * resolve, or rejected when any Promise is rejected.\r\n * @param values An array of Promises.\r\n * @returns A new Promise.\r\n */\r\n all(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>;\r\n\r\n /**\r\n * Creates a Promise that is resolved with an array of results when all of the provided Promises\r\n * resolve, or rejected when any Promise is rejected.\r\n * @param values An array of Promises.\r\n * @returns A new Promise.\r\n */\r\n all(values: (T | PromiseLike)[]): Promise;\r\n\r\n /**\r\n * Creates a new rejected promise for the provided reason.\r\n * @param reason The reason the promise was rejected.\r\n * @returns A new rejected Promise.\r\n */\r\n reject(reason: any): Promise;\r\n\r\n /**\r\n * Creates a new rejected promise for the provided reason.\r\n * @param reason The reason the promise was rejected.\r\n * @returns A new rejected Promise.\r\n */\r\n reject(reason: any): Promise;\r\n\r\n /**\r\n * Creates a new resolved promise for the provided value.\r\n * @param value A promise.\r\n * @returns A promise whose internal state matches the provided promise.\r\n */\r\n resolve(value: T | PromiseLike): Promise;\r\n\r\n /**\r\n * Creates a new resolved promise .\r\n * @returns A resolved promise.\r\n */\r\n resolve(): Promise;\r\n}\r\n\r\ndeclare var Promise: PromiseConstructor;interface ProxyHandler {\r\n getPrototypeOf? (target: T): any;\r\n setPrototypeOf? (target: T, v: any): boolean;\r\n isExtensible? (target: T): boolean;\r\n preventExtensions? (target: T): boolean;\r\n getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor;\r\n has? (target: T, p: PropertyKey): boolean;\r\n get? (target: T, p: PropertyKey, receiver: any): any;\r\n set? (target: T, p: PropertyKey, value: any, receiver: any): boolean;\r\n deleteProperty? (target: T, p: PropertyKey): boolean;\r\n defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean;\r\n enumerate? (target: T): PropertyKey[];\r\n ownKeys? (target: T): PropertyKey[];\r\n apply? (target: T, thisArg: any, argArray?: any): any;\r\n construct? (target: T, thisArg: any, argArray?: any): any;\r\n}\r\n\r\ninterface ProxyConstructor {\r\n revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; };\r\n new (target: T, handler: ProxyHandler): T\r\n}\r\ndeclare var Proxy: ProxyConstructor;declare namespace Reflect {\r\n function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any;\r\n function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any;\r\n function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;\r\n function deleteProperty(target: any, propertyKey: PropertyKey): boolean;\r\n function get(target: any, propertyKey: PropertyKey, receiver?: any): any;\r\n function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor;\r\n function getPrototypeOf(target: any): any;\r\n function has(target: any, propertyKey: string): boolean;\r\n function has(target: any, propertyKey: symbol): boolean;\r\n function isExtensible(target: any): boolean;\r\n function ownKeys(target: any): Array;\r\n function preventExtensions(target: any): boolean;\r\n function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean;\r\n function setPrototypeOf(target: any, proto: any): boolean;\r\n}interface Symbol {\r\n /** Returns a string representation of an object. */\r\n toString(): string;\r\n\r\n /** Returns the primitive value of the specified object. */\r\n valueOf(): Object;\r\n}\r\n\r\ninterface SymbolConstructor {\r\n /** \r\n * A reference to the prototype. \r\n */\r\n readonly prototype: Symbol;\r\n\r\n /**\r\n * Returns a new unique Symbol value.\r\n * @param description Description of the new Symbol object.\r\n */\r\n (description?: string|number): symbol;\r\n\r\n /**\r\n * Returns a Symbol object from the global symbol registry matching the given key if found. \r\n * Otherwise, returns a new symbol with this key.\r\n * @param key key to search for.\r\n */\r\n for(key: string): symbol;\r\n\r\n /**\r\n * Returns a key from the global symbol registry matching the given Symbol if found. \r\n * Otherwise, returns a undefined.\r\n * @param sym Symbol to find the key for.\r\n */\r\n keyFor(sym: symbol): string | undefined;\r\n}\r\n\r\ndeclare var Symbol: SymbolConstructor;/// \r\n\r\ninterface SymbolConstructor {\r\n /** \r\n * A method that determines if a constructor object recognizes an object as one of the \r\n * constructor’s instances. Called by the semantics of the instanceof operator. \r\n */\r\n readonly hasInstance: symbol;\r\n\r\n /** \r\n * A Boolean value that if true indicates that an object should flatten to its array elements\r\n * by Array.prototype.concat.\r\n */\r\n readonly isConcatSpreadable: symbol;\r\n\r\n /**\r\n * A regular expression method that matches the regular expression against a string. Called \r\n * by the String.prototype.match method. \r\n */\r\n readonly match: symbol;\r\n\r\n /** \r\n * A regular expression method that replaces matched substrings of a string. Called by the \r\n * String.prototype.replace method.\r\n */\r\n readonly replace: symbol;\r\n\r\n /**\r\n * A regular expression method that returns the index within a string that matches the \r\n * regular expression. Called by the String.prototype.search method.\r\n */\r\n readonly search: symbol;\r\n\r\n /** \r\n * A function valued property that is the constructor function that is used to create \r\n * derived objects.\r\n */\r\n readonly species: symbol;\r\n\r\n /**\r\n * A regular expression method that splits a string at the indices that match the regular \r\n * expression. Called by the String.prototype.split method.\r\n */\r\n readonly split: symbol;\r\n\r\n /** \r\n * A method that converts an object to a corresponding primitive value.\r\n * Called by the ToPrimitive abstract operation.\r\n */\r\n readonly toPrimitive: symbol;\r\n\r\n /** \r\n * A String value that is used in the creation of the default string description of an object.\r\n * Called by the built-in method Object.prototype.toString.\r\n */\r\n readonly toStringTag: symbol;\r\n\r\n /**\r\n * An Object whose own property names are property names that are excluded from the 'with'\r\n * environment bindings of the associated objects.\r\n */\r\n readonly unscopables: symbol;\r\n}\r\n\r\ninterface Symbol {\r\n readonly [Symbol.toStringTag]: \"Symbol\";\r\n}\r\n\r\ninterface Array {\r\n /**\r\n * Returns an object whose properties have the value 'true'\r\n * when they will be absent when used in a 'with' statement.\r\n */\r\n [Symbol.unscopables](): {\r\n copyWithin: boolean;\r\n entries: boolean;\r\n fill: boolean;\r\n find: boolean;\r\n findIndex: boolean;\r\n keys: boolean;\r\n values: boolean;\r\n };\r\n}\r\n\r\ninterface Date {\r\n /**\r\n * Converts a Date object to a string.\r\n */\r\n [Symbol.toPrimitive](hint: \"default\"): string;\r\n /**\r\n * Converts a Date object to a string.\r\n */\r\n [Symbol.toPrimitive](hint: \"string\"): string;\r\n /**\r\n * Converts a Date object to a number.\r\n */\r\n [Symbol.toPrimitive](hint: \"number\"): number;\r\n /**\r\n * Converts a Date object to a string or number.\r\n *\r\n * @param hint The strings \"number\", \"string\", or \"default\" to specify what primitive to return.\r\n *\r\n * @throws {TypeError} If 'hint' was given something other than \"number\", \"string\", or \"default\".\r\n * @returns A number if 'hint' was \"number\", a string if 'hint' was \"string\" or \"default\".\r\n */\r\n [Symbol.toPrimitive](hint: string): string | number;\r\n}\r\n\r\ninterface Map {\r\n readonly [Symbol.toStringTag]: \"Map\";\r\n}\r\n\r\ninterface WeakMap{\r\n readonly [Symbol.toStringTag]: \"WeakMap\";\r\n}\r\n\r\ninterface Set {\r\n readonly [Symbol.toStringTag]: \"Set\";\r\n}\r\n\r\ninterface WeakSet {\r\n readonly [Symbol.toStringTag]: \"WeakSet\";\r\n}\r\n\r\ninterface JSON {\r\n readonly [Symbol.toStringTag]: \"JSON\";\r\n}\r\n\r\ninterface Function {\r\n /**\r\n * Determines whether the given value inherits from this function if this function was used\r\n * as a constructor function.\r\n *\r\n * A constructor function can control which objects are recognized as its instances by\r\n * 'instanceof' by overriding this method.\r\n */\r\n [Symbol.hasInstance](value: any): boolean;\r\n}\r\n\r\ninterface GeneratorFunction extends Function {\r\n readonly [Symbol.toStringTag]: \"GeneratorFunction\";\r\n}\r\n\r\ninterface Math {\r\n readonly [Symbol.toStringTag]: \"Math\";\r\n}\r\n\r\ninterface Promise {\r\n readonly [Symbol.toStringTag]: \"Promise\";\r\n}\r\n\r\ninterface PromiseConstructor {\r\n readonly [Symbol.species]: Function;\r\n}\r\n\r\ninterface RegExp {\r\n /**\r\n * Matches a string with this regular expression, and returns an array containing the results of\r\n * that search.\r\n * @param string A string to search within.\r\n */\r\n [Symbol.match](string: string): RegExpMatchArray | null;\r\n\r\n /**\r\n * Replaces text in a string, using this regular expression.\r\n * @param string A String object or string literal whose contents matching against\r\n * this regular expression will be replaced\r\n * @param replaceValue A String object or string literal containing the text to replace for every \r\n * successful match of this regular expression.\r\n */\r\n [Symbol.replace](string: string, replaceValue: string): string;\r\n\r\n /**\r\n * Replaces text in a string, using this regular expression.\r\n * @param string A String object or string literal whose contents matching against\r\n * this regular expression will be replaced\r\n * @param replacer A function that returns the replacement text.\r\n */\r\n [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string;\r\n\r\n /**\r\n * Finds the position beginning first substring match in a regular expression search\r\n * using this regular expression.\r\n *\r\n * @param string The string to search within.\r\n */\r\n [Symbol.search](string: string): number;\r\n\r\n /**\r\n * Returns an array of substrings that were delimited by strings in the original input that\r\n * match against this regular expression.\r\n *\r\n * If the regular expression contains capturing parentheses, then each time this\r\n * regular expression matches, the results (including any undefined results) of the\r\n * capturing parentheses are spliced.\r\n *\r\n * @param string string value to split\r\n * @param limit if not undefined, the output array is truncated so that it contains no more\r\n * than 'limit' elements.\r\n */\r\n [Symbol.split](string: string, limit?: number): string[];\r\n}\r\n\r\ninterface RegExpConstructor {\r\n [Symbol.species](): RegExpConstructor;\r\n}\r\n\r\ninterface String {\r\n /**\r\n * Matches a string an object that supports being matched against, and returns an array containing the results of that search.\r\n * @param matcher An object that supports being matched against.\r\n */\r\n match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null;\r\n\r\n /**\r\n * Replaces text in a string, using an object that supports replacement within a string.\r\n * @param searchValue A object can search for and replace matches within a string.\r\n * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string.\r\n */\r\n replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string;\r\n\r\n /**\r\n * Replaces text in a string, using an object that supports replacement within a string.\r\n * @param searchValue A object can search for and replace matches within a string.\r\n * @param replacer A function that returns the replacement text.\r\n */\r\n replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string;\r\n\r\n /**\r\n * Finds the first substring match in a regular expression search.\r\n * @param searcher An object which supports searching within a string.\r\n */\r\n search(searcher: { [Symbol.search](string: string): number; }): number;\r\n\r\n /**\r\n * Split a string into substrings using the specified separator and return them as an array.\r\n * @param splitter An object that can split a string.\r\n * @param limit A value used to limit the number of elements returned in the array.\r\n */\r\n split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[];\r\n}\r\n\r\n/**\r\n * Represents a raw buffer of binary data, which is used to store data for the \r\n * different typed arrays. ArrayBuffers cannot be read from or written to directly, \r\n * but can be passed to a typed array or DataView Object to interpret the raw \r\n * buffer as needed. \r\n */\r\ninterface ArrayBuffer {\r\n readonly [Symbol.toStringTag]: \"ArrayBuffer\";\r\n}\r\n\r\ninterface DataView {\r\n readonly [Symbol.toStringTag]: \"DataView\";\r\n}\r\n\r\n/**\r\n * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested \r\n * number of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Int8Array {\r\n readonly [Symbol.toStringTag]: \"Int8Array\";\r\n}\r\n\r\n/**\r\n * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the \r\n * requested number of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Uint8Array {\r\n readonly [Symbol.toStringTag]: \"UInt8Array\";\r\n}\r\n\r\n/**\r\n * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. \r\n * If the requested number of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Uint8ClampedArray {\r\n readonly [Symbol.toStringTag]: \"Uint8ClampedArray\";\r\n}\r\n\r\n/**\r\n * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the \r\n * requested number of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Int16Array {\r\n readonly [Symbol.toStringTag]: \"Int16Array\";\r\n}\r\n\r\n/**\r\n * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the \r\n * requested number of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Uint16Array {\r\n readonly [Symbol.toStringTag]: \"Uint16Array\";\r\n}\r\n\r\n/**\r\n * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the \r\n * requested number of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Int32Array {\r\n readonly [Symbol.toStringTag]: \"Int32Array\";\r\n}\r\n\r\n/**\r\n * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the \r\n * requested number of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Uint32Array {\r\n readonly [Symbol.toStringTag]: \"Uint32Array\";\r\n}\r\n\r\n/**\r\n * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number\r\n * of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Float32Array {\r\n readonly [Symbol.toStringTag]: \"Float32Array\";\r\n}\r\n\r\n/**\r\n * A typed array of 64-bit float values. The contents are initialized to 0. If the requested \r\n * number of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Float64Array {\r\n readonly [Symbol.toStringTag]: \"Float64Array\";\r\n}\r\n/////////////////////////////\r\n/// IE DOM APIs\r\n/////////////////////////////\r\n\r\ninterface Algorithm {\r\n name: string;\r\n}\r\n\r\ninterface AriaRequestEventInit extends EventInit {\r\n attributeName?: string;\r\n attributeValue?: string;\r\n}\r\n\r\ninterface CommandEventInit extends EventInit {\r\n commandName?: string;\r\n detail?: string;\r\n}\r\n\r\ninterface CompositionEventInit extends UIEventInit {\r\n data?: string;\r\n}\r\n\r\ninterface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation {\r\n arrayOfDomainStrings?: string[];\r\n}\r\n\r\ninterface ConstrainBooleanParameters {\r\n exact?: boolean;\r\n ideal?: boolean;\r\n}\r\n\r\ninterface ConstrainDOMStringParameters {\r\n exact?: string | string[];\r\n ideal?: string | string[];\r\n}\r\n\r\ninterface ConstrainDoubleRange extends DoubleRange {\r\n exact?: number;\r\n ideal?: number;\r\n}\r\n\r\ninterface ConstrainLongRange extends LongRange {\r\n exact?: number;\r\n ideal?: number;\r\n}\r\n\r\ninterface ConstrainVideoFacingModeParameters {\r\n exact?: string | string[];\r\n ideal?: string | string[];\r\n}\r\n\r\ninterface CustomEventInit extends EventInit {\r\n detail?: any;\r\n}\r\n\r\ninterface DeviceAccelerationDict {\r\n x?: number;\r\n y?: number;\r\n z?: number;\r\n}\r\n\r\ninterface DeviceLightEventInit extends EventInit {\r\n value?: number;\r\n}\r\n\r\ninterface DeviceRotationRateDict {\r\n alpha?: number;\r\n beta?: number;\r\n gamma?: number;\r\n}\r\n\r\ninterface DoubleRange {\r\n max?: number;\r\n min?: number;\r\n}\r\n\r\ninterface EventInit {\r\n bubbles?: boolean;\r\n cancelable?: boolean;\r\n}\r\n\r\ninterface EventModifierInit extends UIEventInit {\r\n ctrlKey?: boolean;\r\n shiftKey?: boolean;\r\n altKey?: boolean;\r\n metaKey?: boolean;\r\n modifierAltGraph?: boolean;\r\n modifierCapsLock?: boolean;\r\n modifierFn?: boolean;\r\n modifierFnLock?: boolean;\r\n modifierHyper?: boolean;\r\n modifierNumLock?: boolean;\r\n modifierOS?: boolean;\r\n modifierScrollLock?: boolean;\r\n modifierSuper?: boolean;\r\n modifierSymbol?: boolean;\r\n modifierSymbolLock?: boolean;\r\n}\r\n\r\ninterface ExceptionInformation {\r\n domain?: string;\r\n}\r\n\r\ninterface FocusEventInit extends UIEventInit {\r\n relatedTarget?: EventTarget;\r\n}\r\n\r\ninterface HashChangeEventInit extends EventInit {\r\n newURL?: string;\r\n oldURL?: string;\r\n}\r\n\r\ninterface IDBIndexParameters {\r\n multiEntry?: boolean;\r\n unique?: boolean;\r\n}\r\n\r\ninterface IDBObjectStoreParameters {\r\n autoIncrement?: boolean;\r\n keyPath?: IDBKeyPath;\r\n}\r\n\r\ninterface KeyAlgorithm {\r\n name?: string;\r\n}\r\n\r\ninterface KeyboardEventInit extends EventModifierInit {\r\n code?: string;\r\n key?: string;\r\n location?: number;\r\n repeat?: boolean;\r\n}\r\n\r\ninterface LongRange {\r\n max?: number;\r\n min?: number;\r\n}\r\n\r\ninterface MSAccountInfo {\r\n rpDisplayName?: string;\r\n userDisplayName?: string;\r\n accountName?: string;\r\n userId?: string;\r\n accountImageUri?: string;\r\n}\r\n\r\ninterface MSAudioLocalClientEvent extends MSLocalClientEventBase {\r\n networkSendQualityEventRatio?: number;\r\n networkDelayEventRatio?: number;\r\n cpuInsufficientEventRatio?: number;\r\n deviceHalfDuplexAECEventRatio?: number;\r\n deviceRenderNotFunctioningEventRatio?: number;\r\n deviceCaptureNotFunctioningEventRatio?: number;\r\n deviceGlitchesEventRatio?: number;\r\n deviceLowSNREventRatio?: number;\r\n deviceLowSpeechLevelEventRatio?: number;\r\n deviceClippingEventRatio?: number;\r\n deviceEchoEventRatio?: number;\r\n deviceNearEndToEchoRatioEventRatio?: number;\r\n deviceRenderZeroVolumeEventRatio?: number;\r\n deviceRenderMuteEventRatio?: number;\r\n deviceMultipleEndpointsEventCount?: number;\r\n deviceHowlingEventCount?: number;\r\n}\r\n\r\ninterface MSAudioRecvPayload extends MSPayloadBase {\r\n samplingRate?: number;\r\n signal?: MSAudioRecvSignal;\r\n packetReorderRatio?: number;\r\n packetReorderDepthAvg?: number;\r\n packetReorderDepthMax?: number;\r\n burstLossLength1?: number;\r\n burstLossLength2?: number;\r\n burstLossLength3?: number;\r\n burstLossLength4?: number;\r\n burstLossLength5?: number;\r\n burstLossLength6?: number;\r\n burstLossLength7?: number;\r\n burstLossLength8OrHigher?: number;\r\n fecRecvDistance1?: number;\r\n fecRecvDistance2?: number;\r\n fecRecvDistance3?: number;\r\n ratioConcealedSamplesAvg?: number;\r\n ratioStretchedSamplesAvg?: number;\r\n ratioCompressedSamplesAvg?: number;\r\n}\r\n\r\ninterface MSAudioRecvSignal {\r\n initialSignalLevelRMS?: number;\r\n recvSignalLevelCh1?: number;\r\n recvNoiseLevelCh1?: number;\r\n renderSignalLevel?: number;\r\n renderNoiseLevel?: number;\r\n renderLoopbackSignalLevel?: number;\r\n}\r\n\r\ninterface MSAudioSendPayload extends MSPayloadBase {\r\n samplingRate?: number;\r\n signal?: MSAudioSendSignal;\r\n audioFECUsed?: boolean;\r\n sendMutePercent?: number;\r\n}\r\n\r\ninterface MSAudioSendSignal {\r\n noiseLevel?: number;\r\n sendSignalLevelCh1?: number;\r\n sendNoiseLevelCh1?: number;\r\n}\r\n\r\ninterface MSConnectivity {\r\n iceType?: string;\r\n iceWarningFlags?: MSIceWarningFlags;\r\n relayAddress?: MSRelayAddress;\r\n}\r\n\r\ninterface MSCredentialFilter {\r\n accept?: MSCredentialSpec[];\r\n}\r\n\r\ninterface MSCredentialParameters {\r\n type?: string;\r\n}\r\n\r\ninterface MSCredentialSpec {\r\n type?: string;\r\n id?: string;\r\n}\r\n\r\ninterface MSDelay {\r\n roundTrip?: number;\r\n roundTripMax?: number;\r\n}\r\n\r\ninterface MSDescription extends RTCStats {\r\n connectivity?: MSConnectivity;\r\n transport?: string;\r\n networkconnectivity?: MSNetworkConnectivityInfo;\r\n localAddr?: MSIPAddressInfo;\r\n remoteAddr?: MSIPAddressInfo;\r\n deviceDevName?: string;\r\n reflexiveLocalIPAddr?: MSIPAddressInfo;\r\n}\r\n\r\ninterface MSFIDOCredentialParameters extends MSCredentialParameters {\r\n algorithm?: string | Algorithm;\r\n authenticators?: AAGUID[];\r\n}\r\n\r\ninterface MSIPAddressInfo {\r\n ipAddr?: string;\r\n port?: number;\r\n manufacturerMacAddrMask?: string;\r\n}\r\n\r\ninterface MSIceWarningFlags {\r\n turnTcpTimedOut?: boolean;\r\n turnUdpAllocateFailed?: boolean;\r\n turnUdpSendFailed?: boolean;\r\n turnTcpAllocateFailed?: boolean;\r\n turnTcpSendFailed?: boolean;\r\n udpLocalConnectivityFailed?: boolean;\r\n udpNatConnectivityFailed?: boolean;\r\n udpRelayConnectivityFailed?: boolean;\r\n tcpNatConnectivityFailed?: boolean;\r\n tcpRelayConnectivityFailed?: boolean;\r\n connCheckMessageIntegrityFailed?: boolean;\r\n allocationMessageIntegrityFailed?: boolean;\r\n connCheckOtherError?: boolean;\r\n turnAuthUnknownUsernameError?: boolean;\r\n noRelayServersConfigured?: boolean;\r\n multipleRelayServersAttempted?: boolean;\r\n portRangeExhausted?: boolean;\r\n alternateServerReceived?: boolean;\r\n pseudoTLSFailure?: boolean;\r\n turnTurnTcpConnectivityFailed?: boolean;\r\n useCandidateChecksFailed?: boolean;\r\n fipsAllocationFailure?: boolean;\r\n}\r\n\r\ninterface MSJitter {\r\n interArrival?: number;\r\n interArrivalMax?: number;\r\n interArrivalSD?: number;\r\n}\r\n\r\ninterface MSLocalClientEventBase extends RTCStats {\r\n networkReceiveQualityEventRatio?: number;\r\n networkBandwidthLowEventRatio?: number;\r\n}\r\n\r\ninterface MSNetwork extends RTCStats {\r\n jitter?: MSJitter;\r\n delay?: MSDelay;\r\n packetLoss?: MSPacketLoss;\r\n utilization?: MSUtilization;\r\n}\r\n\r\ninterface MSNetworkConnectivityInfo {\r\n vpn?: boolean;\r\n linkspeed?: number;\r\n networkConnectionDetails?: string;\r\n}\r\n\r\ninterface MSNetworkInterfaceType {\r\n interfaceTypeEthernet?: boolean;\r\n interfaceTypeWireless?: boolean;\r\n interfaceTypePPP?: boolean;\r\n interfaceTypeTunnel?: boolean;\r\n interfaceTypeWWAN?: boolean;\r\n}\r\n\r\ninterface MSOutboundNetwork extends MSNetwork {\r\n appliedBandwidthLimit?: number;\r\n}\r\n\r\ninterface MSPacketLoss {\r\n lossRate?: number;\r\n lossRateMax?: number;\r\n}\r\n\r\ninterface MSPayloadBase extends RTCStats {\r\n payloadDescription?: string;\r\n}\r\n\r\ninterface MSRelayAddress {\r\n relayAddress?: string;\r\n port?: number;\r\n}\r\n\r\ninterface MSSignatureParameters {\r\n userPrompt?: string;\r\n}\r\n\r\ninterface MSTransportDiagnosticsStats extends RTCStats {\r\n baseAddress?: string;\r\n localAddress?: string;\r\n localSite?: string;\r\n networkName?: string;\r\n remoteAddress?: string;\r\n remoteSite?: string;\r\n localMR?: string;\r\n remoteMR?: string;\r\n iceWarningFlags?: MSIceWarningFlags;\r\n portRangeMin?: number;\r\n portRangeMax?: number;\r\n localMRTCPPort?: number;\r\n remoteMRTCPPort?: number;\r\n stunVer?: number;\r\n numConsentReqSent?: number;\r\n numConsentReqReceived?: number;\r\n numConsentRespSent?: number;\r\n numConsentRespReceived?: number;\r\n interfaces?: MSNetworkInterfaceType;\r\n baseInterface?: MSNetworkInterfaceType;\r\n protocol?: string;\r\n localInterface?: MSNetworkInterfaceType;\r\n localAddrType?: string;\r\n remoteAddrType?: string;\r\n iceRole?: string;\r\n rtpRtcpMux?: boolean;\r\n allocationTimeInMs?: number;\r\n msRtcEngineVersion?: string;\r\n}\r\n\r\ninterface MSUtilization {\r\n packets?: number;\r\n bandwidthEstimation?: number;\r\n bandwidthEstimationMin?: number;\r\n bandwidthEstimationMax?: number;\r\n bandwidthEstimationStdDev?: number;\r\n bandwidthEstimationAvg?: number;\r\n}\r\n\r\ninterface MSVideoPayload extends MSPayloadBase {\r\n resoluton?: string;\r\n videoBitRateAvg?: number;\r\n videoBitRateMax?: number;\r\n videoFrameRateAvg?: number;\r\n videoPacketLossRate?: number;\r\n durationSeconds?: number;\r\n}\r\n\r\ninterface MSVideoRecvPayload extends MSVideoPayload {\r\n videoFrameLossRate?: number;\r\n recvCodecType?: string;\r\n recvResolutionWidth?: number;\r\n recvResolutionHeight?: number;\r\n videoResolutions?: MSVideoResolutionDistribution;\r\n recvFrameRateAverage?: number;\r\n recvBitRateMaximum?: number;\r\n recvBitRateAverage?: number;\r\n recvVideoStreamsMax?: number;\r\n recvVideoStreamsMin?: number;\r\n recvVideoStreamsMode?: number;\r\n videoPostFECPLR?: number;\r\n lowBitRateCallPercent?: number;\r\n lowFrameRateCallPercent?: number;\r\n reorderBufferTotalPackets?: number;\r\n recvReorderBufferReorderedPackets?: number;\r\n recvReorderBufferPacketsDroppedDueToBufferExhaustion?: number;\r\n recvReorderBufferMaxSuccessfullyOrderedExtent?: number;\r\n recvReorderBufferMaxSuccessfullyOrderedLateTime?: number;\r\n recvReorderBufferPacketsDroppedDueToTimeout?: number;\r\n recvFpsHarmonicAverage?: number;\r\n recvNumResSwitches?: number;\r\n}\r\n\r\ninterface MSVideoResolutionDistribution {\r\n cifQuality?: number;\r\n vgaQuality?: number;\r\n h720Quality?: number;\r\n h1080Quality?: number;\r\n h1440Quality?: number;\r\n h2160Quality?: number;\r\n}\r\n\r\ninterface MSVideoSendPayload extends MSVideoPayload {\r\n sendFrameRateAverage?: number;\r\n sendBitRateMaximum?: number;\r\n sendBitRateAverage?: number;\r\n sendVideoStreamsMax?: number;\r\n sendResolutionWidth?: number;\r\n sendResolutionHeight?: number;\r\n}\r\n\r\ninterface MediaEncryptedEventInit extends EventInit {\r\n initDataType?: string;\r\n initData?: ArrayBuffer;\r\n}\r\n\r\ninterface MediaKeyMessageEventInit extends EventInit {\r\n messageType?: string;\r\n message?: ArrayBuffer;\r\n}\r\n\r\ninterface MediaKeySystemConfiguration {\r\n initDataTypes?: string[];\r\n audioCapabilities?: MediaKeySystemMediaCapability[];\r\n videoCapabilities?: MediaKeySystemMediaCapability[];\r\n distinctiveIdentifier?: string;\r\n persistentState?: string;\r\n}\r\n\r\ninterface MediaKeySystemMediaCapability {\r\n contentType?: string;\r\n robustness?: string;\r\n}\r\n\r\ninterface MediaStreamConstraints {\r\n video?: boolean | MediaTrackConstraints;\r\n audio?: boolean | MediaTrackConstraints;\r\n}\r\n\r\ninterface MediaStreamErrorEventInit extends EventInit {\r\n error?: MediaStreamError;\r\n}\r\n\r\ninterface MediaStreamTrackEventInit extends EventInit {\r\n track?: MediaStreamTrack;\r\n}\r\n\r\ninterface MediaTrackCapabilities {\r\n width?: number | LongRange;\r\n height?: number | LongRange;\r\n aspectRatio?: number | DoubleRange;\r\n frameRate?: number | DoubleRange;\r\n facingMode?: string;\r\n volume?: number | DoubleRange;\r\n sampleRate?: number | LongRange;\r\n sampleSize?: number | LongRange;\r\n echoCancellation?: boolean[];\r\n deviceId?: string;\r\n groupId?: string;\r\n}\r\n\r\ninterface MediaTrackConstraintSet {\r\n width?: number | ConstrainLongRange;\r\n height?: number | ConstrainLongRange;\r\n aspectRatio?: number | ConstrainDoubleRange;\r\n frameRate?: number | ConstrainDoubleRange;\r\n facingMode?: string | string[] | ConstrainDOMStringParameters;\r\n volume?: number | ConstrainDoubleRange;\r\n sampleRate?: number | ConstrainLongRange;\r\n sampleSize?: number | ConstrainLongRange;\r\n echoCancelation?: boolean | ConstrainBooleanParameters;\r\n deviceId?: string | string[] | ConstrainDOMStringParameters;\r\n groupId?: string | string[] | ConstrainDOMStringParameters;\r\n}\r\n\r\ninterface MediaTrackConstraints extends MediaTrackConstraintSet {\r\n advanced?: MediaTrackConstraintSet[];\r\n}\r\n\r\ninterface MediaTrackSettings {\r\n width?: number;\r\n height?: number;\r\n aspectRatio?: number;\r\n frameRate?: number;\r\n facingMode?: string;\r\n volume?: number;\r\n sampleRate?: number;\r\n sampleSize?: number;\r\n echoCancellation?: boolean;\r\n deviceId?: string;\r\n groupId?: string;\r\n}\r\n\r\ninterface MediaTrackSupportedConstraints {\r\n width?: boolean;\r\n height?: boolean;\r\n aspectRatio?: boolean;\r\n frameRate?: boolean;\r\n facingMode?: boolean;\r\n volume?: boolean;\r\n sampleRate?: boolean;\r\n sampleSize?: boolean;\r\n echoCancellation?: boolean;\r\n deviceId?: boolean;\r\n groupId?: boolean;\r\n}\r\n\r\ninterface MouseEventInit extends EventModifierInit {\r\n screenX?: number;\r\n screenY?: number;\r\n clientX?: number;\r\n clientY?: number;\r\n button?: number;\r\n buttons?: number;\r\n relatedTarget?: EventTarget;\r\n}\r\n\r\ninterface MsZoomToOptions {\r\n contentX?: number;\r\n contentY?: number;\r\n viewportX?: string;\r\n viewportY?: string;\r\n scaleFactor?: number;\r\n animate?: string;\r\n}\r\n\r\ninterface MutationObserverInit {\r\n childList?: boolean;\r\n attributes?: boolean;\r\n characterData?: boolean;\r\n subtree?: boolean;\r\n attributeOldValue?: boolean;\r\n characterDataOldValue?: boolean;\r\n attributeFilter?: string[];\r\n}\r\n\r\ninterface ObjectURLOptions {\r\n oneTimeOnly?: boolean;\r\n}\r\n\r\ninterface PeriodicWaveConstraints {\r\n disableNormalization?: boolean;\r\n}\r\n\r\ninterface PointerEventInit extends MouseEventInit {\r\n pointerId?: number;\r\n width?: number;\r\n height?: number;\r\n pressure?: number;\r\n tiltX?: number;\r\n tiltY?: number;\r\n pointerType?: string;\r\n isPrimary?: boolean;\r\n}\r\n\r\ninterface PositionOptions {\r\n enableHighAccuracy?: boolean;\r\n timeout?: number;\r\n maximumAge?: number;\r\n}\r\n\r\ninterface RTCDTMFToneChangeEventInit extends EventInit {\r\n tone?: string;\r\n}\r\n\r\ninterface RTCDtlsFingerprint {\r\n algorithm?: string;\r\n value?: string;\r\n}\r\n\r\ninterface RTCDtlsParameters {\r\n role?: string;\r\n fingerprints?: RTCDtlsFingerprint[];\r\n}\r\n\r\ninterface RTCIceCandidate {\r\n foundation?: string;\r\n priority?: number;\r\n ip?: string;\r\n protocol?: string;\r\n port?: number;\r\n type?: string;\r\n tcpType?: string;\r\n relatedAddress?: string;\r\n relatedPort?: number;\r\n}\r\n\r\ninterface RTCIceCandidateAttributes extends RTCStats {\r\n ipAddress?: string;\r\n portNumber?: number;\r\n transport?: string;\r\n candidateType?: string;\r\n priority?: number;\r\n addressSourceUrl?: string;\r\n}\r\n\r\ninterface RTCIceCandidateComplete {\r\n}\r\n\r\ninterface RTCIceCandidatePair {\r\n local?: RTCIceCandidate;\r\n remote?: RTCIceCandidate;\r\n}\r\n\r\ninterface RTCIceCandidatePairStats extends RTCStats {\r\n transportId?: string;\r\n localCandidateId?: string;\r\n remoteCandidateId?: string;\r\n state?: string;\r\n priority?: number;\r\n nominated?: boolean;\r\n writable?: boolean;\r\n readable?: boolean;\r\n bytesSent?: number;\r\n bytesReceived?: number;\r\n roundTripTime?: number;\r\n availableOutgoingBitrate?: number;\r\n availableIncomingBitrate?: number;\r\n}\r\n\r\ninterface RTCIceGatherOptions {\r\n gatherPolicy?: string;\r\n iceservers?: RTCIceServer[];\r\n}\r\n\r\ninterface RTCIceParameters {\r\n usernameFragment?: string;\r\n password?: string;\r\n}\r\n\r\ninterface RTCIceServer {\r\n urls?: any;\r\n username?: string;\r\n credential?: string;\r\n}\r\n\r\ninterface RTCInboundRTPStreamStats extends RTCRTPStreamStats {\r\n packetsReceived?: number;\r\n bytesReceived?: number;\r\n packetsLost?: number;\r\n jitter?: number;\r\n fractionLost?: number;\r\n}\r\n\r\ninterface RTCMediaStreamTrackStats extends RTCStats {\r\n trackIdentifier?: string;\r\n remoteSource?: boolean;\r\n ssrcIds?: string[];\r\n frameWidth?: number;\r\n frameHeight?: number;\r\n framesPerSecond?: number;\r\n framesSent?: number;\r\n framesReceived?: number;\r\n framesDecoded?: number;\r\n framesDropped?: number;\r\n framesCorrupted?: number;\r\n audioLevel?: number;\r\n echoReturnLoss?: number;\r\n echoReturnLossEnhancement?: number;\r\n}\r\n\r\ninterface RTCOutboundRTPStreamStats extends RTCRTPStreamStats {\r\n packetsSent?: number;\r\n bytesSent?: number;\r\n targetBitrate?: number;\r\n roundTripTime?: number;\r\n}\r\n\r\ninterface RTCRTPStreamStats extends RTCStats {\r\n ssrc?: string;\r\n associateStatsId?: string;\r\n isRemote?: boolean;\r\n mediaTrackId?: string;\r\n transportId?: string;\r\n codecId?: string;\r\n firCount?: number;\r\n pliCount?: number;\r\n nackCount?: number;\r\n sliCount?: number;\r\n}\r\n\r\ninterface RTCRtcpFeedback {\r\n type?: string;\r\n parameter?: string;\r\n}\r\n\r\ninterface RTCRtcpParameters {\r\n ssrc?: number;\r\n cname?: string;\r\n reducedSize?: boolean;\r\n mux?: boolean;\r\n}\r\n\r\ninterface RTCRtpCapabilities {\r\n codecs?: RTCRtpCodecCapability[];\r\n headerExtensions?: RTCRtpHeaderExtension[];\r\n fecMechanisms?: string[];\r\n}\r\n\r\ninterface RTCRtpCodecCapability {\r\n name?: string;\r\n kind?: string;\r\n clockRate?: number;\r\n preferredPayloadType?: number;\r\n maxptime?: number;\r\n numChannels?: number;\r\n rtcpFeedback?: RTCRtcpFeedback[];\r\n parameters?: any;\r\n options?: any;\r\n maxTemporalLayers?: number;\r\n maxSpatialLayers?: number;\r\n svcMultiStreamSupport?: boolean;\r\n}\r\n\r\ninterface RTCRtpCodecParameters {\r\n name?: string;\r\n payloadType?: any;\r\n clockRate?: number;\r\n maxptime?: number;\r\n numChannels?: number;\r\n rtcpFeedback?: RTCRtcpFeedback[];\r\n parameters?: any;\r\n}\r\n\r\ninterface RTCRtpContributingSource {\r\n timestamp?: number;\r\n csrc?: number;\r\n audioLevel?: number;\r\n}\r\n\r\ninterface RTCRtpEncodingParameters {\r\n ssrc?: number;\r\n codecPayloadType?: number;\r\n fec?: RTCRtpFecParameters;\r\n rtx?: RTCRtpRtxParameters;\r\n priority?: number;\r\n maxBitrate?: number;\r\n minQuality?: number;\r\n framerateBias?: number;\r\n resolutionScale?: number;\r\n framerateScale?: number;\r\n active?: boolean;\r\n encodingId?: string;\r\n dependencyEncodingIds?: string[];\r\n ssrcRange?: RTCSsrcRange;\r\n}\r\n\r\ninterface RTCRtpFecParameters {\r\n ssrc?: number;\r\n mechanism?: string;\r\n}\r\n\r\ninterface RTCRtpHeaderExtension {\r\n kind?: string;\r\n uri?: string;\r\n preferredId?: number;\r\n preferredEncrypt?: boolean;\r\n}\r\n\r\ninterface RTCRtpHeaderExtensionParameters {\r\n uri?: string;\r\n id?: number;\r\n encrypt?: boolean;\r\n}\r\n\r\ninterface RTCRtpParameters {\r\n muxId?: string;\r\n codecs?: RTCRtpCodecParameters[];\r\n headerExtensions?: RTCRtpHeaderExtensionParameters[];\r\n encodings?: RTCRtpEncodingParameters[];\r\n rtcp?: RTCRtcpParameters;\r\n}\r\n\r\ninterface RTCRtpRtxParameters {\r\n ssrc?: number;\r\n}\r\n\r\ninterface RTCRtpUnhandled {\r\n ssrc?: number;\r\n payloadType?: number;\r\n muxId?: string;\r\n}\r\n\r\ninterface RTCSrtpKeyParam {\r\n keyMethod?: string;\r\n keySalt?: string;\r\n lifetime?: string;\r\n mkiValue?: number;\r\n mkiLength?: number;\r\n}\r\n\r\ninterface RTCSrtpSdesParameters {\r\n tag?: number;\r\n cryptoSuite?: string;\r\n keyParams?: RTCSrtpKeyParam[];\r\n sessionParams?: string[];\r\n}\r\n\r\ninterface RTCSsrcRange {\r\n min?: number;\r\n max?: number;\r\n}\r\n\r\ninterface RTCStats {\r\n timestamp?: number;\r\n type?: string;\r\n id?: string;\r\n msType?: string;\r\n}\r\n\r\ninterface RTCStatsReport {\r\n}\r\n\r\ninterface RTCTransportStats extends RTCStats {\r\n bytesSent?: number;\r\n bytesReceived?: number;\r\n rtcpTransportStatsId?: string;\r\n activeConnection?: boolean;\r\n selectedCandidatePairId?: string;\r\n localCertificateId?: string;\r\n remoteCertificateId?: string;\r\n}\r\n\r\ninterface StoreExceptionsInformation extends ExceptionInformation {\r\n siteName?: string;\r\n explanationString?: string;\r\n detailURI?: string;\r\n}\r\n\r\ninterface StoreSiteSpecificExceptionsInformation extends StoreExceptionsInformation {\r\n arrayOfDomainStrings?: string[];\r\n}\r\n\r\ninterface UIEventInit extends EventInit {\r\n view?: Window;\r\n detail?: number;\r\n}\r\n\r\ninterface WebGLContextAttributes {\r\n failIfMajorPerformanceCaveat?: boolean;\r\n alpha?: boolean;\r\n depth?: boolean;\r\n stencil?: boolean;\r\n antialias?: boolean;\r\n premultipliedAlpha?: boolean;\r\n preserveDrawingBuffer?: boolean;\r\n}\r\n\r\ninterface WebGLContextEventInit extends EventInit {\r\n statusMessage?: string;\r\n}\r\n\r\ninterface WheelEventInit extends MouseEventInit {\r\n deltaX?: number;\r\n deltaY?: number;\r\n deltaZ?: number;\r\n deltaMode?: number;\r\n}\r\n\r\ninterface EventListener {\r\n (evt: Event): void;\r\n}\r\n\r\ninterface ANGLE_instanced_arrays {\r\n drawArraysInstancedANGLE(mode: number, first: number, count: number, primcount: number): void;\r\n drawElementsInstancedANGLE(mode: number, count: number, type: number, offset: number, primcount: number): void;\r\n vertexAttribDivisorANGLE(index: number, divisor: number): void;\r\n readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number;\r\n}\r\n\r\ndeclare var ANGLE_instanced_arrays: {\r\n prototype: ANGLE_instanced_arrays;\r\n new(): ANGLE_instanced_arrays;\r\n readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number;\r\n}\r\n\r\ninterface AnalyserNode extends AudioNode {\r\n fftSize: number;\r\n readonly frequencyBinCount: number;\r\n maxDecibels: number;\r\n minDecibels: number;\r\n smoothingTimeConstant: number;\r\n getByteFrequencyData(array: Uint8Array): void;\r\n getByteTimeDomainData(array: Uint8Array): void;\r\n getFloatFrequencyData(array: Float32Array): void;\r\n getFloatTimeDomainData(array: Float32Array): void;\r\n}\r\n\r\ndeclare var AnalyserNode: {\r\n prototype: AnalyserNode;\r\n new(): AnalyserNode;\r\n}\r\n\r\ninterface AnimationEvent extends Event {\r\n readonly animationName: string;\r\n readonly elapsedTime: number;\r\n initAnimationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, animationNameArg: string, elapsedTimeArg: number): void;\r\n}\r\n\r\ndeclare var AnimationEvent: {\r\n prototype: AnimationEvent;\r\n new(): AnimationEvent;\r\n}\r\n\r\ninterface ApplicationCache extends EventTarget {\r\n oncached: (this: this, ev: Event) => any;\r\n onchecking: (this: this, ev: Event) => any;\r\n ondownloading: (this: this, ev: Event) => any;\r\n onerror: (this: this, ev: ErrorEvent) => any;\r\n onnoupdate: (this: this, ev: Event) => any;\r\n onobsolete: (this: this, ev: Event) => any;\r\n onprogress: (this: this, ev: ProgressEvent) => any;\r\n onupdateready: (this: this, ev: Event) => any;\r\n readonly status: number;\r\n abort(): void;\r\n swapCache(): void;\r\n update(): void;\r\n readonly CHECKING: number;\r\n readonly DOWNLOADING: number;\r\n readonly IDLE: number;\r\n readonly OBSOLETE: number;\r\n readonly UNCACHED: number;\r\n readonly UPDATEREADY: number;\r\n addEventListener(type: \"cached\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"checking\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"downloading\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"noupdate\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"obsolete\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"progress\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"updateready\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var ApplicationCache: {\r\n prototype: ApplicationCache;\r\n new(): ApplicationCache;\r\n readonly CHECKING: number;\r\n readonly DOWNLOADING: number;\r\n readonly IDLE: number;\r\n readonly OBSOLETE: number;\r\n readonly UNCACHED: number;\r\n readonly UPDATEREADY: number;\r\n}\r\n\r\ninterface AriaRequestEvent extends Event {\r\n readonly attributeName: string;\r\n attributeValue: string | null;\r\n}\r\n\r\ndeclare var AriaRequestEvent: {\r\n prototype: AriaRequestEvent;\r\n new(type: string, eventInitDict?: AriaRequestEventInit): AriaRequestEvent;\r\n}\r\n\r\ninterface Attr extends Node {\r\n readonly name: string;\r\n readonly ownerElement: Element;\r\n readonly prefix: string | null;\r\n readonly specified: boolean;\r\n value: string;\r\n}\r\n\r\ndeclare var Attr: {\r\n prototype: Attr;\r\n new(): Attr;\r\n}\r\n\r\ninterface AudioBuffer {\r\n readonly duration: number;\r\n readonly length: number;\r\n readonly numberOfChannels: number;\r\n readonly sampleRate: number;\r\n copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void;\r\n copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void;\r\n getChannelData(channel: number): Float32Array;\r\n}\r\n\r\ndeclare var AudioBuffer: {\r\n prototype: AudioBuffer;\r\n new(): AudioBuffer;\r\n}\r\n\r\ninterface AudioBufferSourceNode extends AudioNode {\r\n buffer: AudioBuffer | null;\r\n readonly detune: AudioParam;\r\n loop: boolean;\r\n loopEnd: number;\r\n loopStart: number;\r\n onended: (this: this, ev: MediaStreamErrorEvent) => any;\r\n readonly playbackRate: AudioParam;\r\n start(when?: number, offset?: number, duration?: number): void;\r\n stop(when?: number): void;\r\n addEventListener(type: \"ended\", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var AudioBufferSourceNode: {\r\n prototype: AudioBufferSourceNode;\r\n new(): AudioBufferSourceNode;\r\n}\r\n\r\ninterface AudioContext extends EventTarget {\r\n readonly currentTime: number;\r\n readonly destination: AudioDestinationNode;\r\n readonly listener: AudioListener;\r\n readonly sampleRate: number;\r\n state: string;\r\n createAnalyser(): AnalyserNode;\r\n createBiquadFilter(): BiquadFilterNode;\r\n createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer;\r\n createBufferSource(): AudioBufferSourceNode;\r\n createChannelMerger(numberOfInputs?: number): ChannelMergerNode;\r\n createChannelSplitter(numberOfOutputs?: number): ChannelSplitterNode;\r\n createConvolver(): ConvolverNode;\r\n createDelay(maxDelayTime?: number): DelayNode;\r\n createDynamicsCompressor(): DynamicsCompressorNode;\r\n createGain(): GainNode;\r\n createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode;\r\n createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode;\r\n createOscillator(): OscillatorNode;\r\n createPanner(): PannerNode;\r\n createPeriodicWave(real: Float32Array, imag: Float32Array, constraints?: PeriodicWaveConstraints): PeriodicWave;\r\n createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode;\r\n createStereoPanner(): StereoPannerNode;\r\n createWaveShaper(): WaveShaperNode;\r\n decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): PromiseLike;\r\n}\r\n\r\ndeclare var AudioContext: {\r\n prototype: AudioContext;\r\n new(): AudioContext;\r\n}\r\n\r\ninterface AudioDestinationNode extends AudioNode {\r\n readonly maxChannelCount: number;\r\n}\r\n\r\ndeclare var AudioDestinationNode: {\r\n prototype: AudioDestinationNode;\r\n new(): AudioDestinationNode;\r\n}\r\n\r\ninterface AudioListener {\r\n dopplerFactor: number;\r\n speedOfSound: number;\r\n setOrientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): void;\r\n setPosition(x: number, y: number, z: number): void;\r\n setVelocity(x: number, y: number, z: number): void;\r\n}\r\n\r\ndeclare var AudioListener: {\r\n prototype: AudioListener;\r\n new(): AudioListener;\r\n}\r\n\r\ninterface AudioNode extends EventTarget {\r\n channelCount: number;\r\n channelCountMode: string;\r\n channelInterpretation: string;\r\n readonly context: AudioContext;\r\n readonly numberOfInputs: number;\r\n readonly numberOfOutputs: number;\r\n connect(destination: AudioNode, output?: number, input?: number): void;\r\n disconnect(output?: number): void;\r\n disconnect(destination: AudioNode, output?: number, input?: number): void;\r\n disconnect(destination: AudioParam, output?: number): void;\r\n}\r\n\r\ndeclare var AudioNode: {\r\n prototype: AudioNode;\r\n new(): AudioNode;\r\n}\r\n\r\ninterface AudioParam {\r\n readonly defaultValue: number;\r\n value: number;\r\n cancelScheduledValues(startTime: number): void;\r\n exponentialRampToValueAtTime(value: number, endTime: number): void;\r\n linearRampToValueAtTime(value: number, endTime: number): void;\r\n setTargetAtTime(target: number, startTime: number, timeConstant: number): void;\r\n setValueAtTime(value: number, startTime: number): void;\r\n setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void;\r\n}\r\n\r\ndeclare var AudioParam: {\r\n prototype: AudioParam;\r\n new(): AudioParam;\r\n}\r\n\r\ninterface AudioProcessingEvent extends Event {\r\n readonly inputBuffer: AudioBuffer;\r\n readonly outputBuffer: AudioBuffer;\r\n readonly playbackTime: number;\r\n}\r\n\r\ndeclare var AudioProcessingEvent: {\r\n prototype: AudioProcessingEvent;\r\n new(): AudioProcessingEvent;\r\n}\r\n\r\ninterface AudioTrack {\r\n enabled: boolean;\r\n readonly id: string;\r\n kind: string;\r\n readonly label: string;\r\n language: string;\r\n readonly sourceBuffer: SourceBuffer;\r\n}\r\n\r\ndeclare var AudioTrack: {\r\n prototype: AudioTrack;\r\n new(): AudioTrack;\r\n}\r\n\r\ninterface AudioTrackList extends EventTarget {\r\n readonly length: number;\r\n onaddtrack: (this: this, ev: TrackEvent) => any;\r\n onchange: (this: this, ev: Event) => any;\r\n onremovetrack: (this: this, ev: TrackEvent) => any;\r\n getTrackById(id: string): AudioTrack | null;\r\n item(index: number): AudioTrack;\r\n addEventListener(type: \"addtrack\", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"change\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"removetrack\", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n [index: number]: AudioTrack;\r\n}\r\n\r\ndeclare var AudioTrackList: {\r\n prototype: AudioTrackList;\r\n new(): AudioTrackList;\r\n}\r\n\r\ninterface BarProp {\r\n readonly visible: boolean;\r\n}\r\n\r\ndeclare var BarProp: {\r\n prototype: BarProp;\r\n new(): BarProp;\r\n}\r\n\r\ninterface BeforeUnloadEvent extends Event {\r\n returnValue: any;\r\n}\r\n\r\ndeclare var BeforeUnloadEvent: {\r\n prototype: BeforeUnloadEvent;\r\n new(): BeforeUnloadEvent;\r\n}\r\n\r\ninterface BiquadFilterNode extends AudioNode {\r\n readonly Q: AudioParam;\r\n readonly detune: AudioParam;\r\n readonly frequency: AudioParam;\r\n readonly gain: AudioParam;\r\n type: string;\r\n getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void;\r\n}\r\n\r\ndeclare var BiquadFilterNode: {\r\n prototype: BiquadFilterNode;\r\n new(): BiquadFilterNode;\r\n}\r\n\r\ninterface Blob {\r\n readonly size: number;\r\n readonly type: string;\r\n msClose(): void;\r\n msDetachStream(): any;\r\n slice(start?: number, end?: number, contentType?: string): Blob;\r\n}\r\n\r\ndeclare var Blob: {\r\n prototype: Blob;\r\n new (blobParts?: any[], options?: BlobPropertyBag): Blob;\r\n}\r\n\r\ninterface CDATASection extends Text {\r\n}\r\n\r\ndeclare var CDATASection: {\r\n prototype: CDATASection;\r\n new(): CDATASection;\r\n}\r\n\r\ninterface CSS {\r\n supports(property: string, value?: string): boolean;\r\n}\r\ndeclare var CSS: CSS;\r\n\r\ninterface CSSConditionRule extends CSSGroupingRule {\r\n conditionText: string;\r\n}\r\n\r\ndeclare var CSSConditionRule: {\r\n prototype: CSSConditionRule;\r\n new(): CSSConditionRule;\r\n}\r\n\r\ninterface CSSFontFaceRule extends CSSRule {\r\n readonly style: CSSStyleDeclaration;\r\n}\r\n\r\ndeclare var CSSFontFaceRule: {\r\n prototype: CSSFontFaceRule;\r\n new(): CSSFontFaceRule;\r\n}\r\n\r\ninterface CSSGroupingRule extends CSSRule {\r\n readonly cssRules: CSSRuleList;\r\n deleteRule(index: number): void;\r\n insertRule(rule: string, index: number): number;\r\n}\r\n\r\ndeclare var CSSGroupingRule: {\r\n prototype: CSSGroupingRule;\r\n new(): CSSGroupingRule;\r\n}\r\n\r\ninterface CSSImportRule extends CSSRule {\r\n readonly href: string;\r\n readonly media: MediaList;\r\n readonly styleSheet: CSSStyleSheet;\r\n}\r\n\r\ndeclare var CSSImportRule: {\r\n prototype: CSSImportRule;\r\n new(): CSSImportRule;\r\n}\r\n\r\ninterface CSSKeyframeRule extends CSSRule {\r\n keyText: string;\r\n readonly style: CSSStyleDeclaration;\r\n}\r\n\r\ndeclare var CSSKeyframeRule: {\r\n prototype: CSSKeyframeRule;\r\n new(): CSSKeyframeRule;\r\n}\r\n\r\ninterface CSSKeyframesRule extends CSSRule {\r\n readonly cssRules: CSSRuleList;\r\n name: string;\r\n appendRule(rule: string): void;\r\n deleteRule(rule: string): void;\r\n findRule(rule: string): CSSKeyframeRule;\r\n}\r\n\r\ndeclare var CSSKeyframesRule: {\r\n prototype: CSSKeyframesRule;\r\n new(): CSSKeyframesRule;\r\n}\r\n\r\ninterface CSSMediaRule extends CSSConditionRule {\r\n readonly media: MediaList;\r\n}\r\n\r\ndeclare var CSSMediaRule: {\r\n prototype: CSSMediaRule;\r\n new(): CSSMediaRule;\r\n}\r\n\r\ninterface CSSNamespaceRule extends CSSRule {\r\n readonly namespaceURI: string;\r\n readonly prefix: string;\r\n}\r\n\r\ndeclare var CSSNamespaceRule: {\r\n prototype: CSSNamespaceRule;\r\n new(): CSSNamespaceRule;\r\n}\r\n\r\ninterface CSSPageRule extends CSSRule {\r\n readonly pseudoClass: string;\r\n readonly selector: string;\r\n selectorText: string;\r\n readonly style: CSSStyleDeclaration;\r\n}\r\n\r\ndeclare var CSSPageRule: {\r\n prototype: CSSPageRule;\r\n new(): CSSPageRule;\r\n}\r\n\r\ninterface CSSRule {\r\n cssText: string;\r\n readonly parentRule: CSSRule;\r\n readonly parentStyleSheet: CSSStyleSheet;\r\n readonly type: number;\r\n readonly CHARSET_RULE: number;\r\n readonly FONT_FACE_RULE: number;\r\n readonly IMPORT_RULE: number;\r\n readonly KEYFRAMES_RULE: number;\r\n readonly KEYFRAME_RULE: number;\r\n readonly MEDIA_RULE: number;\r\n readonly NAMESPACE_RULE: number;\r\n readonly PAGE_RULE: number;\r\n readonly STYLE_RULE: number;\r\n readonly SUPPORTS_RULE: number;\r\n readonly UNKNOWN_RULE: number;\r\n readonly VIEWPORT_RULE: number;\r\n}\r\n\r\ndeclare var CSSRule: {\r\n prototype: CSSRule;\r\n new(): CSSRule;\r\n readonly CHARSET_RULE: number;\r\n readonly FONT_FACE_RULE: number;\r\n readonly IMPORT_RULE: number;\r\n readonly KEYFRAMES_RULE: number;\r\n readonly KEYFRAME_RULE: number;\r\n readonly MEDIA_RULE: number;\r\n readonly NAMESPACE_RULE: number;\r\n readonly PAGE_RULE: number;\r\n readonly STYLE_RULE: number;\r\n readonly SUPPORTS_RULE: number;\r\n readonly UNKNOWN_RULE: number;\r\n readonly VIEWPORT_RULE: number;\r\n}\r\n\r\ninterface CSSRuleList {\r\n readonly length: number;\r\n item(index: number): CSSRule;\r\n [index: number]: CSSRule;\r\n}\r\n\r\ndeclare var CSSRuleList: {\r\n prototype: CSSRuleList;\r\n new(): CSSRuleList;\r\n}\r\n\r\ninterface CSSStyleDeclaration {\r\n alignContent: string | null;\r\n alignItems: string | null;\r\n alignSelf: string | null;\r\n alignmentBaseline: string | null;\r\n animation: string | null;\r\n animationDelay: string | null;\r\n animationDirection: string | null;\r\n animationDuration: string | null;\r\n animationFillMode: string | null;\r\n animationIterationCount: string | null;\r\n animationName: string | null;\r\n animationPlayState: string | null;\r\n animationTimingFunction: string | null;\r\n backfaceVisibility: string | null;\r\n background: string | null;\r\n backgroundAttachment: string | null;\r\n backgroundClip: string | null;\r\n backgroundColor: string | null;\r\n backgroundImage: string | null;\r\n backgroundOrigin: string | null;\r\n backgroundPosition: string | null;\r\n backgroundPositionX: string | null;\r\n backgroundPositionY: string | null;\r\n backgroundRepeat: string | null;\r\n backgroundSize: string | null;\r\n baselineShift: string | null;\r\n border: string | null;\r\n borderBottom: string | null;\r\n borderBottomColor: string | null;\r\n borderBottomLeftRadius: string | null;\r\n borderBottomRightRadius: string | null;\r\n borderBottomStyle: string | null;\r\n borderBottomWidth: string | null;\r\n borderCollapse: string | null;\r\n borderColor: string | null;\r\n borderImage: string | null;\r\n borderImageOutset: string | null;\r\n borderImageRepeat: string | null;\r\n borderImageSlice: string | null;\r\n borderImageSource: string | null;\r\n borderImageWidth: string | null;\r\n borderLeft: string | null;\r\n borderLeftColor: string | null;\r\n borderLeftStyle: string | null;\r\n borderLeftWidth: string | null;\r\n borderRadius: string | null;\r\n borderRight: string | null;\r\n borderRightColor: string | null;\r\n borderRightStyle: string | null;\r\n borderRightWidth: string | null;\r\n borderSpacing: string | null;\r\n borderStyle: string | null;\r\n borderTop: string | null;\r\n borderTopColor: string | null;\r\n borderTopLeftRadius: string | null;\r\n borderTopRightRadius: string | null;\r\n borderTopStyle: string | null;\r\n borderTopWidth: string | null;\r\n borderWidth: string | null;\r\n bottom: string | null;\r\n boxShadow: string | null;\r\n boxSizing: string | null;\r\n breakAfter: string | null;\r\n breakBefore: string | null;\r\n breakInside: string | null;\r\n captionSide: string | null;\r\n clear: string | null;\r\n clip: string | null;\r\n clipPath: string | null;\r\n clipRule: string | null;\r\n color: string | null;\r\n colorInterpolationFilters: string | null;\r\n columnCount: any;\r\n columnFill: string | null;\r\n columnGap: any;\r\n columnRule: string | null;\r\n columnRuleColor: any;\r\n columnRuleStyle: string | null;\r\n columnRuleWidth: any;\r\n columnSpan: string | null;\r\n columnWidth: any;\r\n columns: string | null;\r\n content: string | null;\r\n counterIncrement: string | null;\r\n counterReset: string | null;\r\n cssFloat: string | null;\r\n cssText: string;\r\n cursor: string | null;\r\n direction: string | null;\r\n display: string | null;\r\n dominantBaseline: string | null;\r\n emptyCells: string | null;\r\n enableBackground: string | null;\r\n fill: string | null;\r\n fillOpacity: string | null;\r\n fillRule: string | null;\r\n filter: string | null;\r\n flex: string | null;\r\n flexBasis: string | null;\r\n flexDirection: string | null;\r\n flexFlow: string | null;\r\n flexGrow: string | null;\r\n flexShrink: string | null;\r\n flexWrap: string | null;\r\n floodColor: string | null;\r\n floodOpacity: string | null;\r\n font: string | null;\r\n fontFamily: string | null;\r\n fontFeatureSettings: string | null;\r\n fontSize: string | null;\r\n fontSizeAdjust: string | null;\r\n fontStretch: string | null;\r\n fontStyle: string | null;\r\n fontVariant: string | null;\r\n fontWeight: string | null;\r\n glyphOrientationHorizontal: string | null;\r\n glyphOrientationVertical: string | null;\r\n height: string | null;\r\n imeMode: string | null;\r\n justifyContent: string | null;\r\n kerning: string | null;\r\n left: string | null;\r\n readonly length: number;\r\n letterSpacing: string | null;\r\n lightingColor: string | null;\r\n lineHeight: string | null;\r\n listStyle: string | null;\r\n listStyleImage: string | null;\r\n listStylePosition: string | null;\r\n listStyleType: string | null;\r\n margin: string | null;\r\n marginBottom: string | null;\r\n marginLeft: string | null;\r\n marginRight: string | null;\r\n marginTop: string | null;\r\n marker: string | null;\r\n markerEnd: string | null;\r\n markerMid: string | null;\r\n markerStart: string | null;\r\n mask: string | null;\r\n maxHeight: string | null;\r\n maxWidth: string | null;\r\n minHeight: string | null;\r\n minWidth: string | null;\r\n msContentZoomChaining: string | null;\r\n msContentZoomLimit: string | null;\r\n msContentZoomLimitMax: any;\r\n msContentZoomLimitMin: any;\r\n msContentZoomSnap: string | null;\r\n msContentZoomSnapPoints: string | null;\r\n msContentZoomSnapType: string | null;\r\n msContentZooming: string | null;\r\n msFlowFrom: string | null;\r\n msFlowInto: string | null;\r\n msFontFeatureSettings: string | null;\r\n msGridColumn: any;\r\n msGridColumnAlign: string | null;\r\n msGridColumnSpan: any;\r\n msGridColumns: string | null;\r\n msGridRow: any;\r\n msGridRowAlign: string | null;\r\n msGridRowSpan: any;\r\n msGridRows: string | null;\r\n msHighContrastAdjust: string | null;\r\n msHyphenateLimitChars: string | null;\r\n msHyphenateLimitLines: any;\r\n msHyphenateLimitZone: any;\r\n msHyphens: string | null;\r\n msImeAlign: string | null;\r\n msOverflowStyle: string | null;\r\n msScrollChaining: string | null;\r\n msScrollLimit: string | null;\r\n msScrollLimitXMax: any;\r\n msScrollLimitXMin: any;\r\n msScrollLimitYMax: any;\r\n msScrollLimitYMin: any;\r\n msScrollRails: string | null;\r\n msScrollSnapPointsX: string | null;\r\n msScrollSnapPointsY: string | null;\r\n msScrollSnapType: string | null;\r\n msScrollSnapX: string | null;\r\n msScrollSnapY: string | null;\r\n msScrollTranslation: string | null;\r\n msTextCombineHorizontal: string | null;\r\n msTextSizeAdjust: any;\r\n msTouchAction: string | null;\r\n msTouchSelect: string | null;\r\n msUserSelect: string | null;\r\n msWrapFlow: string;\r\n msWrapMargin: any;\r\n msWrapThrough: string;\r\n opacity: string | null;\r\n order: string | null;\r\n orphans: string | null;\r\n outline: string | null;\r\n outlineColor: string | null;\r\n outlineStyle: string | null;\r\n outlineWidth: string | null;\r\n overflow: string | null;\r\n overflowX: string | null;\r\n overflowY: string | null;\r\n padding: string | null;\r\n paddingBottom: string | null;\r\n paddingLeft: string | null;\r\n paddingRight: string | null;\r\n paddingTop: string | null;\r\n pageBreakAfter: string | null;\r\n pageBreakBefore: string | null;\r\n pageBreakInside: string | null;\r\n readonly parentRule: CSSRule;\r\n perspective: string | null;\r\n perspectiveOrigin: string | null;\r\n pointerEvents: string | null;\r\n position: string | null;\r\n quotes: string | null;\r\n right: string | null;\r\n rubyAlign: string | null;\r\n rubyOverhang: string | null;\r\n rubyPosition: string | null;\r\n stopColor: string | null;\r\n stopOpacity: string | null;\r\n stroke: string | null;\r\n strokeDasharray: string | null;\r\n strokeDashoffset: string | null;\r\n strokeLinecap: string | null;\r\n strokeLinejoin: string | null;\r\n strokeMiterlimit: string | null;\r\n strokeOpacity: string | null;\r\n strokeWidth: string | null;\r\n tableLayout: string | null;\r\n textAlign: string | null;\r\n textAlignLast: string | null;\r\n textAnchor: string | null;\r\n textDecoration: string | null;\r\n textIndent: string | null;\r\n textJustify: string | null;\r\n textKashida: string | null;\r\n textKashidaSpace: string | null;\r\n textOverflow: string | null;\r\n textShadow: string | null;\r\n textTransform: string | null;\r\n textUnderlinePosition: string | null;\r\n top: string | null;\r\n touchAction: string | null;\r\n transform: string | null;\r\n transformOrigin: string | null;\r\n transformStyle: string | null;\r\n transition: string | null;\r\n transitionDelay: string | null;\r\n transitionDuration: string | null;\r\n transitionProperty: string | null;\r\n transitionTimingFunction: string | null;\r\n unicodeBidi: string | null;\r\n verticalAlign: string | null;\r\n visibility: string | null;\r\n webkitAlignContent: string | null;\r\n webkitAlignItems: string | null;\r\n webkitAlignSelf: string | null;\r\n webkitAnimation: string | null;\r\n webkitAnimationDelay: string | null;\r\n webkitAnimationDirection: string | null;\r\n webkitAnimationDuration: string | null;\r\n webkitAnimationFillMode: string | null;\r\n webkitAnimationIterationCount: string | null;\r\n webkitAnimationName: string | null;\r\n webkitAnimationPlayState: string | null;\r\n webkitAnimationTimingFunction: string | null;\r\n webkitAppearance: string | null;\r\n webkitBackfaceVisibility: string | null;\r\n webkitBackgroundClip: string | null;\r\n webkitBackgroundOrigin: string | null;\r\n webkitBackgroundSize: string | null;\r\n webkitBorderBottomLeftRadius: string | null;\r\n webkitBorderBottomRightRadius: string | null;\r\n webkitBorderImage: string | null;\r\n webkitBorderRadius: string | null;\r\n webkitBorderTopLeftRadius: string | null;\r\n webkitBorderTopRightRadius: string | null;\r\n webkitBoxAlign: string | null;\r\n webkitBoxDirection: string | null;\r\n webkitBoxFlex: string | null;\r\n webkitBoxOrdinalGroup: string | null;\r\n webkitBoxOrient: string | null;\r\n webkitBoxPack: string | null;\r\n webkitBoxSizing: string | null;\r\n webkitColumnBreakAfter: string | null;\r\n webkitColumnBreakBefore: string | null;\r\n webkitColumnBreakInside: string | null;\r\n webkitColumnCount: any;\r\n webkitColumnGap: any;\r\n webkitColumnRule: string | null;\r\n webkitColumnRuleColor: any;\r\n webkitColumnRuleStyle: string | null;\r\n webkitColumnRuleWidth: any;\r\n webkitColumnSpan: string | null;\r\n webkitColumnWidth: any;\r\n webkitColumns: string | null;\r\n webkitFilter: string | null;\r\n webkitFlex: string | null;\r\n webkitFlexBasis: string | null;\r\n webkitFlexDirection: string | null;\r\n webkitFlexFlow: string | null;\r\n webkitFlexGrow: string | null;\r\n webkitFlexShrink: string | null;\r\n webkitFlexWrap: string | null;\r\n webkitJustifyContent: string | null;\r\n webkitOrder: string | null;\r\n webkitPerspective: string | null;\r\n webkitPerspectiveOrigin: string | null;\r\n webkitTapHighlightColor: string | null;\r\n webkitTextFillColor: string | null;\r\n webkitTextSizeAdjust: any;\r\n webkitTransform: string | null;\r\n webkitTransformOrigin: string | null;\r\n webkitTransformStyle: string | null;\r\n webkitTransition: string | null;\r\n webkitTransitionDelay: string | null;\r\n webkitTransitionDuration: string | null;\r\n webkitTransitionProperty: string | null;\r\n webkitTransitionTimingFunction: string | null;\r\n webkitUserModify: string | null;\r\n webkitUserSelect: string | null;\r\n webkitWritingMode: string | null;\r\n whiteSpace: string | null;\r\n widows: string | null;\r\n width: string | null;\r\n wordBreak: string | null;\r\n wordSpacing: string | null;\r\n wordWrap: string | null;\r\n writingMode: string | null;\r\n zIndex: string | null;\r\n zoom: string | null;\r\n getPropertyPriority(propertyName: string): string;\r\n getPropertyValue(propertyName: string): string;\r\n item(index: number): string;\r\n removeProperty(propertyName: string): string;\r\n setProperty(propertyName: string, value: string | null, priority?: string): void;\r\n [index: number]: string;\r\n}\r\n\r\ndeclare var CSSStyleDeclaration: {\r\n prototype: CSSStyleDeclaration;\r\n new(): CSSStyleDeclaration;\r\n}\r\n\r\ninterface CSSStyleRule extends CSSRule {\r\n readonly readOnly: boolean;\r\n selectorText: string;\r\n readonly style: CSSStyleDeclaration;\r\n}\r\n\r\ndeclare var CSSStyleRule: {\r\n prototype: CSSStyleRule;\r\n new(): CSSStyleRule;\r\n}\r\n\r\ninterface CSSStyleSheet extends StyleSheet {\r\n readonly cssRules: CSSRuleList;\r\n cssText: string;\r\n readonly href: string;\r\n readonly id: string;\r\n readonly imports: StyleSheetList;\r\n readonly isAlternate: boolean;\r\n readonly isPrefAlternate: boolean;\r\n readonly ownerRule: CSSRule;\r\n readonly owningElement: Element;\r\n readonly pages: StyleSheetPageList;\r\n readonly readOnly: boolean;\r\n readonly rules: CSSRuleList;\r\n addImport(bstrURL: string, lIndex?: number): number;\r\n addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number;\r\n addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number;\r\n deleteRule(index?: number): void;\r\n insertRule(rule: string, index?: number): number;\r\n removeImport(lIndex: number): void;\r\n removeRule(lIndex: number): void;\r\n}\r\n\r\ndeclare var CSSStyleSheet: {\r\n prototype: CSSStyleSheet;\r\n new(): CSSStyleSheet;\r\n}\r\n\r\ninterface CSSSupportsRule extends CSSConditionRule {\r\n}\r\n\r\ndeclare var CSSSupportsRule: {\r\n prototype: CSSSupportsRule;\r\n new(): CSSSupportsRule;\r\n}\r\n\r\ninterface CanvasGradient {\r\n addColorStop(offset: number, color: string): void;\r\n}\r\n\r\ndeclare var CanvasGradient: {\r\n prototype: CanvasGradient;\r\n new(): CanvasGradient;\r\n}\r\n\r\ninterface CanvasPattern {\r\n}\r\n\r\ndeclare var CanvasPattern: {\r\n prototype: CanvasPattern;\r\n new(): CanvasPattern;\r\n}\r\n\r\ninterface CanvasRenderingContext2D extends Object, CanvasPathMethods {\r\n readonly canvas: HTMLCanvasElement;\r\n fillStyle: string | CanvasGradient | CanvasPattern;\r\n font: string;\r\n globalAlpha: number;\r\n globalCompositeOperation: string;\r\n lineCap: string;\r\n lineDashOffset: number;\r\n lineJoin: string;\r\n lineWidth: number;\r\n miterLimit: number;\r\n msFillRule: string;\r\n msImageSmoothingEnabled: boolean;\r\n shadowBlur: number;\r\n shadowColor: string;\r\n shadowOffsetX: number;\r\n shadowOffsetY: number;\r\n strokeStyle: string | CanvasGradient | CanvasPattern;\r\n textAlign: string;\r\n textBaseline: string;\r\n mozImageSmoothingEnabled: boolean;\r\n webkitImageSmoothingEnabled: boolean;\r\n oImageSmoothingEnabled: boolean;\r\n beginPath(): void;\r\n clearRect(x: number, y: number, w: number, h: number): void;\r\n clip(fillRule?: string): void;\r\n createImageData(imageDataOrSw: number | ImageData, sh?: number): ImageData;\r\n createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient;\r\n createPattern(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, repetition: string): CanvasPattern;\r\n createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient;\r\n drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, offsetX: number, offsetY: number, width?: number, height?: number, canvasOffsetX?: number, canvasOffsetY?: number, canvasImageWidth?: number, canvasImageHeight?: number): void;\r\n fill(fillRule?: string): void;\r\n fillRect(x: number, y: number, w: number, h: number): void;\r\n fillText(text: string, x: number, y: number, maxWidth?: number): void;\r\n getImageData(sx: number, sy: number, sw: number, sh: number): ImageData;\r\n getLineDash(): number[];\r\n isPointInPath(x: number, y: number, fillRule?: string): boolean;\r\n measureText(text: string): TextMetrics;\r\n putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void;\r\n restore(): void;\r\n rotate(angle: number): void;\r\n save(): void;\r\n scale(x: number, y: number): void;\r\n setLineDash(segments: number[]): void;\r\n setTransform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void;\r\n stroke(): void;\r\n strokeRect(x: number, y: number, w: number, h: number): void;\r\n strokeText(text: string, x: number, y: number, maxWidth?: number): void;\r\n transform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void;\r\n translate(x: number, y: number): void;\r\n}\r\n\r\ndeclare var CanvasRenderingContext2D: {\r\n prototype: CanvasRenderingContext2D;\r\n new(): CanvasRenderingContext2D;\r\n}\r\n\r\ninterface ChannelMergerNode extends AudioNode {\r\n}\r\n\r\ndeclare var ChannelMergerNode: {\r\n prototype: ChannelMergerNode;\r\n new(): ChannelMergerNode;\r\n}\r\n\r\ninterface ChannelSplitterNode extends AudioNode {\r\n}\r\n\r\ndeclare var ChannelSplitterNode: {\r\n prototype: ChannelSplitterNode;\r\n new(): ChannelSplitterNode;\r\n}\r\n\r\ninterface CharacterData extends Node, ChildNode {\r\n data: string;\r\n readonly length: number;\r\n appendData(arg: string): void;\r\n deleteData(offset: number, count: number): void;\r\n insertData(offset: number, arg: string): void;\r\n replaceData(offset: number, count: number, arg: string): void;\r\n substringData(offset: number, count: number): string;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var CharacterData: {\r\n prototype: CharacterData;\r\n new(): CharacterData;\r\n}\r\n\r\ninterface ClientRect {\r\n bottom: number;\r\n readonly height: number;\r\n left: number;\r\n right: number;\r\n top: number;\r\n readonly width: number;\r\n}\r\n\r\ndeclare var ClientRect: {\r\n prototype: ClientRect;\r\n new(): ClientRect;\r\n}\r\n\r\ninterface ClientRectList {\r\n readonly length: number;\r\n item(index: number): ClientRect;\r\n [index: number]: ClientRect;\r\n}\r\n\r\ndeclare var ClientRectList: {\r\n prototype: ClientRectList;\r\n new(): ClientRectList;\r\n}\r\n\r\ninterface ClipboardEvent extends Event {\r\n readonly clipboardData: DataTransfer;\r\n}\r\n\r\ndeclare var ClipboardEvent: {\r\n prototype: ClipboardEvent;\r\n new(type: string, eventInitDict?: ClipboardEventInit): ClipboardEvent;\r\n}\r\n\r\ninterface CloseEvent extends Event {\r\n readonly code: number;\r\n readonly reason: string;\r\n readonly wasClean: boolean;\r\n initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void;\r\n}\r\n\r\ndeclare var CloseEvent: {\r\n prototype: CloseEvent;\r\n new(): CloseEvent;\r\n}\r\n\r\ninterface CommandEvent extends Event {\r\n readonly commandName: string;\r\n readonly detail: string | null;\r\n}\r\n\r\ndeclare var CommandEvent: {\r\n prototype: CommandEvent;\r\n new(type: string, eventInitDict?: CommandEventInit): CommandEvent;\r\n}\r\n\r\ninterface Comment extends CharacterData {\r\n text: string;\r\n}\r\n\r\ndeclare var Comment: {\r\n prototype: Comment;\r\n new(): Comment;\r\n}\r\n\r\ninterface CompositionEvent extends UIEvent {\r\n readonly data: string;\r\n readonly locale: string;\r\n initCompositionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, locale: string): void;\r\n}\r\n\r\ndeclare var CompositionEvent: {\r\n prototype: CompositionEvent;\r\n new(typeArg: string, eventInitDict?: CompositionEventInit): CompositionEvent;\r\n}\r\n\r\ninterface Console {\r\n assert(test?: boolean, message?: string, ...optionalParams: any[]): void;\r\n clear(): void;\r\n count(countTitle?: string): void;\r\n debug(message?: string, ...optionalParams: any[]): void;\r\n dir(value?: any, ...optionalParams: any[]): void;\r\n dirxml(value: any): void;\r\n error(message?: any, ...optionalParams: any[]): void;\r\n exception(message?: string, ...optionalParams: any[]): void;\r\n group(groupTitle?: string): void;\r\n groupCollapsed(groupTitle?: string): void;\r\n groupEnd(): void;\r\n info(message?: any, ...optionalParams: any[]): void;\r\n log(message?: any, ...optionalParams: any[]): void;\r\n msIsIndependentlyComposed(element: Element): boolean;\r\n profile(reportName?: string): void;\r\n profileEnd(): void;\r\n select(element: Element): void;\r\n table(...data: any[]): void;\r\n time(timerName?: string): void;\r\n timeEnd(timerName?: string): void;\r\n trace(message?: any, ...optionalParams: any[]): void;\r\n warn(message?: any, ...optionalParams: any[]): void;\r\n}\r\n\r\ndeclare var Console: {\r\n prototype: Console;\r\n new(): Console;\r\n}\r\n\r\ninterface ConvolverNode extends AudioNode {\r\n buffer: AudioBuffer | null;\r\n normalize: boolean;\r\n}\r\n\r\ndeclare var ConvolverNode: {\r\n prototype: ConvolverNode;\r\n new(): ConvolverNode;\r\n}\r\n\r\ninterface Coordinates {\r\n readonly accuracy: number;\r\n readonly altitude: number | null;\r\n readonly altitudeAccuracy: number | null;\r\n readonly heading: number | null;\r\n readonly latitude: number;\r\n readonly longitude: number;\r\n readonly speed: number | null;\r\n}\r\n\r\ndeclare var Coordinates: {\r\n prototype: Coordinates;\r\n new(): Coordinates;\r\n}\r\n\r\ninterface Crypto extends Object, RandomSource {\r\n readonly subtle: SubtleCrypto;\r\n}\r\n\r\ndeclare var Crypto: {\r\n prototype: Crypto;\r\n new(): Crypto;\r\n}\r\n\r\ninterface CryptoKey {\r\n readonly algorithm: KeyAlgorithm;\r\n readonly extractable: boolean;\r\n readonly type: string;\r\n readonly usages: string[];\r\n}\r\n\r\ndeclare var CryptoKey: {\r\n prototype: CryptoKey;\r\n new(): CryptoKey;\r\n}\r\n\r\ninterface CryptoKeyPair {\r\n privateKey: CryptoKey;\r\n publicKey: CryptoKey;\r\n}\r\n\r\ndeclare var CryptoKeyPair: {\r\n prototype: CryptoKeyPair;\r\n new(): CryptoKeyPair;\r\n}\r\n\r\ninterface CustomEvent extends Event {\r\n readonly detail: any;\r\n initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void;\r\n}\r\n\r\ndeclare var CustomEvent: {\r\n prototype: CustomEvent;\r\n new(typeArg: string, eventInitDict?: CustomEventInit): CustomEvent;\r\n}\r\n\r\ninterface DOMError {\r\n readonly name: string;\r\n toString(): string;\r\n}\r\n\r\ndeclare var DOMError: {\r\n prototype: DOMError;\r\n new(): DOMError;\r\n}\r\n\r\ninterface DOMException {\r\n readonly code: number;\r\n readonly message: string;\r\n readonly name: string;\r\n toString(): string;\r\n readonly ABORT_ERR: number;\r\n readonly DATA_CLONE_ERR: number;\r\n readonly DOMSTRING_SIZE_ERR: number;\r\n readonly HIERARCHY_REQUEST_ERR: number;\r\n readonly INDEX_SIZE_ERR: number;\r\n readonly INUSE_ATTRIBUTE_ERR: number;\r\n readonly INVALID_ACCESS_ERR: number;\r\n readonly INVALID_CHARACTER_ERR: number;\r\n readonly INVALID_MODIFICATION_ERR: number;\r\n readonly INVALID_NODE_TYPE_ERR: number;\r\n readonly INVALID_STATE_ERR: number;\r\n readonly NAMESPACE_ERR: number;\r\n readonly NETWORK_ERR: number;\r\n readonly NOT_FOUND_ERR: number;\r\n readonly NOT_SUPPORTED_ERR: number;\r\n readonly NO_DATA_ALLOWED_ERR: number;\r\n readonly NO_MODIFICATION_ALLOWED_ERR: number;\r\n readonly PARSE_ERR: number;\r\n readonly QUOTA_EXCEEDED_ERR: number;\r\n readonly SECURITY_ERR: number;\r\n readonly SERIALIZE_ERR: number;\r\n readonly SYNTAX_ERR: number;\r\n readonly TIMEOUT_ERR: number;\r\n readonly TYPE_MISMATCH_ERR: number;\r\n readonly URL_MISMATCH_ERR: number;\r\n readonly VALIDATION_ERR: number;\r\n readonly WRONG_DOCUMENT_ERR: number;\r\n}\r\n\r\ndeclare var DOMException: {\r\n prototype: DOMException;\r\n new(): DOMException;\r\n readonly ABORT_ERR: number;\r\n readonly DATA_CLONE_ERR: number;\r\n readonly DOMSTRING_SIZE_ERR: number;\r\n readonly HIERARCHY_REQUEST_ERR: number;\r\n readonly INDEX_SIZE_ERR: number;\r\n readonly INUSE_ATTRIBUTE_ERR: number;\r\n readonly INVALID_ACCESS_ERR: number;\r\n readonly INVALID_CHARACTER_ERR: number;\r\n readonly INVALID_MODIFICATION_ERR: number;\r\n readonly INVALID_NODE_TYPE_ERR: number;\r\n readonly INVALID_STATE_ERR: number;\r\n readonly NAMESPACE_ERR: number;\r\n readonly NETWORK_ERR: number;\r\n readonly NOT_FOUND_ERR: number;\r\n readonly NOT_SUPPORTED_ERR: number;\r\n readonly NO_DATA_ALLOWED_ERR: number;\r\n readonly NO_MODIFICATION_ALLOWED_ERR: number;\r\n readonly PARSE_ERR: number;\r\n readonly QUOTA_EXCEEDED_ERR: number;\r\n readonly SECURITY_ERR: number;\r\n readonly SERIALIZE_ERR: number;\r\n readonly SYNTAX_ERR: number;\r\n readonly TIMEOUT_ERR: number;\r\n readonly TYPE_MISMATCH_ERR: number;\r\n readonly URL_MISMATCH_ERR: number;\r\n readonly VALIDATION_ERR: number;\r\n readonly WRONG_DOCUMENT_ERR: number;\r\n}\r\n\r\ninterface DOMImplementation {\r\n createDocument(namespaceURI: string | null, qualifiedName: string | null, doctype: DocumentType): Document;\r\n createDocumentType(qualifiedName: string, publicId: string | null, systemId: string | null): DocumentType;\r\n createHTMLDocument(title: string): Document;\r\n hasFeature(feature: string | null, version: string | null): boolean;\r\n}\r\n\r\ndeclare var DOMImplementation: {\r\n prototype: DOMImplementation;\r\n new(): DOMImplementation;\r\n}\r\n\r\ninterface DOMParser {\r\n parseFromString(source: string, mimeType: string): Document;\r\n}\r\n\r\ndeclare var DOMParser: {\r\n prototype: DOMParser;\r\n new(): DOMParser;\r\n}\r\n\r\ninterface DOMSettableTokenList extends DOMTokenList {\r\n value: string;\r\n}\r\n\r\ndeclare var DOMSettableTokenList: {\r\n prototype: DOMSettableTokenList;\r\n new(): DOMSettableTokenList;\r\n}\r\n\r\ninterface DOMStringList {\r\n readonly length: number;\r\n contains(str: string): boolean;\r\n item(index: number): string | null;\r\n [index: number]: string;\r\n}\r\n\r\ndeclare var DOMStringList: {\r\n prototype: DOMStringList;\r\n new(): DOMStringList;\r\n}\r\n\r\ninterface DOMStringMap {\r\n [name: string]: string;\r\n}\r\n\r\ndeclare var DOMStringMap: {\r\n prototype: DOMStringMap;\r\n new(): DOMStringMap;\r\n}\r\n\r\ninterface DOMTokenList {\r\n readonly length: number;\r\n add(...token: string[]): void;\r\n contains(token: string): boolean;\r\n item(index: number): string;\r\n remove(...token: string[]): void;\r\n toString(): string;\r\n toggle(token: string, force?: boolean): boolean;\r\n [index: number]: string;\r\n}\r\n\r\ndeclare var DOMTokenList: {\r\n prototype: DOMTokenList;\r\n new(): DOMTokenList;\r\n}\r\n\r\ninterface DataCue extends TextTrackCue {\r\n data: ArrayBuffer;\r\n}\r\n\r\ndeclare var DataCue: {\r\n prototype: DataCue;\r\n new(): DataCue;\r\n}\r\n\r\ninterface DataTransfer {\r\n dropEffect: string;\r\n effectAllowed: string;\r\n readonly files: FileList;\r\n readonly items: DataTransferItemList;\r\n readonly types: DOMStringList;\r\n clearData(format?: string): boolean;\r\n getData(format: string): string;\r\n setData(format: string, data: string): boolean;\r\n}\r\n\r\ndeclare var DataTransfer: {\r\n prototype: DataTransfer;\r\n new(): DataTransfer;\r\n}\r\n\r\ninterface DataTransferItem {\r\n readonly kind: string;\r\n readonly type: string;\r\n getAsFile(): File | null;\r\n getAsString(_callback: FunctionStringCallback | null): void;\r\n}\r\n\r\ndeclare var DataTransferItem: {\r\n prototype: DataTransferItem;\r\n new(): DataTransferItem;\r\n}\r\n\r\ninterface DataTransferItemList {\r\n readonly length: number;\r\n add(data: File): DataTransferItem | null;\r\n clear(): void;\r\n item(index: number): DataTransferItem;\r\n remove(index: number): void;\r\n [index: number]: DataTransferItem;\r\n}\r\n\r\ndeclare var DataTransferItemList: {\r\n prototype: DataTransferItemList;\r\n new(): DataTransferItemList;\r\n}\r\n\r\ninterface DeferredPermissionRequest {\r\n readonly id: number;\r\n readonly type: string;\r\n readonly uri: string;\r\n allow(): void;\r\n deny(): void;\r\n}\r\n\r\ndeclare var DeferredPermissionRequest: {\r\n prototype: DeferredPermissionRequest;\r\n new(): DeferredPermissionRequest;\r\n}\r\n\r\ninterface DelayNode extends AudioNode {\r\n readonly delayTime: AudioParam;\r\n}\r\n\r\ndeclare var DelayNode: {\r\n prototype: DelayNode;\r\n new(): DelayNode;\r\n}\r\n\r\ninterface DeviceAcceleration {\r\n readonly x: number | null;\r\n readonly y: number | null;\r\n readonly z: number | null;\r\n}\r\n\r\ndeclare var DeviceAcceleration: {\r\n prototype: DeviceAcceleration;\r\n new(): DeviceAcceleration;\r\n}\r\n\r\ninterface DeviceLightEvent extends Event {\r\n readonly value: number;\r\n}\r\n\r\ndeclare var DeviceLightEvent: {\r\n prototype: DeviceLightEvent;\r\n new(type: string, eventInitDict?: DeviceLightEventInit): DeviceLightEvent;\r\n}\r\n\r\ninterface DeviceMotionEvent extends Event {\r\n readonly acceleration: DeviceAcceleration | null;\r\n readonly accelerationIncludingGravity: DeviceAcceleration | null;\r\n readonly interval: number | null;\r\n readonly rotationRate: DeviceRotationRate | null;\r\n initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict | null, accelerationIncludingGravity: DeviceAccelerationDict | null, rotationRate: DeviceRotationRateDict | null, interval: number | null): void;\r\n}\r\n\r\ndeclare var DeviceMotionEvent: {\r\n prototype: DeviceMotionEvent;\r\n new(): DeviceMotionEvent;\r\n}\r\n\r\ninterface DeviceOrientationEvent extends Event {\r\n readonly absolute: boolean;\r\n readonly alpha: number | null;\r\n readonly beta: number | null;\r\n readonly gamma: number | null;\r\n initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number | null, beta: number | null, gamma: number | null, absolute: boolean): void;\r\n}\r\n\r\ndeclare var DeviceOrientationEvent: {\r\n prototype: DeviceOrientationEvent;\r\n new(): DeviceOrientationEvent;\r\n}\r\n\r\ninterface DeviceRotationRate {\r\n readonly alpha: number | null;\r\n readonly beta: number | null;\r\n readonly gamma: number | null;\r\n}\r\n\r\ndeclare var DeviceRotationRate: {\r\n prototype: DeviceRotationRate;\r\n new(): DeviceRotationRate;\r\n}\r\n\r\ninterface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode {\r\n /**\r\n * Sets or gets the URL for the current document. \r\n */\r\n readonly URL: string;\r\n /**\r\n * Gets the URL for the document, stripped of any character encoding.\r\n */\r\n readonly URLUnencoded: string;\r\n /**\r\n * Gets the object that has the focus when the parent document has focus.\r\n */\r\n readonly activeElement: Element;\r\n /**\r\n * Sets or gets the color of all active links in the document.\r\n */\r\n alinkColor: string;\r\n /**\r\n * Returns a reference to the collection of elements contained by the object.\r\n */\r\n readonly all: HTMLAllCollection;\r\n /**\r\n * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order.\r\n */\r\n anchors: HTMLCollectionOf;\r\n /**\r\n * Retrieves a collection of all applet objects in the document.\r\n */\r\n applets: HTMLCollectionOf;\r\n /**\r\n * Deprecated. Sets or retrieves a value that indicates the background color behind the object. \r\n */\r\n bgColor: string;\r\n /**\r\n * Specifies the beginning and end of the document body.\r\n */\r\n body: HTMLElement;\r\n readonly characterSet: string;\r\n /**\r\n * Gets or sets the character set used to encode the object.\r\n */\r\n charset: string;\r\n /**\r\n * Gets a value that indicates whether standards-compliant mode is switched on for the object.\r\n */\r\n readonly compatMode: string;\r\n cookie: string;\r\n readonly currentScript: HTMLScriptElement | SVGScriptElement;\r\n /**\r\n * Gets the default character set from the current regional language settings.\r\n */\r\n readonly defaultCharset: string;\r\n readonly defaultView: Window;\r\n /**\r\n * Sets or gets a value that indicates whether the document can be edited.\r\n */\r\n designMode: string;\r\n /**\r\n * Sets or retrieves a value that indicates the reading order of the object. \r\n */\r\n dir: string;\r\n /**\r\n * Gets an object representing the document type declaration associated with the current document. \r\n */\r\n readonly doctype: DocumentType;\r\n /**\r\n * Gets a reference to the root node of the document. \r\n */\r\n documentElement: HTMLElement;\r\n /**\r\n * Sets or gets the security domain of the document. \r\n */\r\n domain: string;\r\n /**\r\n * Retrieves a collection of all embed objects in the document.\r\n */\r\n embeds: HTMLCollectionOf;\r\n /**\r\n * Sets or gets the foreground (text) color of the document.\r\n */\r\n fgColor: string;\r\n /**\r\n * Retrieves a collection, in source order, of all form objects in the document.\r\n */\r\n forms: HTMLCollectionOf;\r\n readonly fullscreenElement: Element | null;\r\n readonly fullscreenEnabled: boolean;\r\n readonly head: HTMLHeadElement;\r\n readonly hidden: boolean;\r\n /**\r\n * Retrieves a collection, in source order, of img objects in the document.\r\n */\r\n images: HTMLCollectionOf;\r\n /**\r\n * Gets the implementation object of the current document. \r\n */\r\n readonly implementation: DOMImplementation;\r\n /**\r\n * Returns the character encoding used to create the webpage that is loaded into the document object.\r\n */\r\n readonly inputEncoding: string | null;\r\n /**\r\n * Gets the date that the page was last modified, if the page supplies one. \r\n */\r\n readonly lastModified: string;\r\n /**\r\n * Sets or gets the color of the document links. \r\n */\r\n linkColor: string;\r\n /**\r\n * Retrieves a collection of all a objects that specify the href property and all area objects in the document.\r\n */\r\n links: HTMLCollectionOf;\r\n /**\r\n * Contains information about the current URL. \r\n */\r\n readonly location: Location;\r\n msCSSOMElementFloatMetrics: boolean;\r\n msCapsLockWarningOff: boolean;\r\n /**\r\n * Fires when the user aborts the download.\r\n * @param ev The event.\r\n */\r\n onabort: (this: this, ev: UIEvent) => any;\r\n /**\r\n * Fires when the object is set as the active element.\r\n * @param ev The event.\r\n */\r\n onactivate: (this: this, ev: UIEvent) => any;\r\n /**\r\n * Fires immediately before the object is set as the active element.\r\n * @param ev The event.\r\n */\r\n onbeforeactivate: (this: this, ev: UIEvent) => any;\r\n /**\r\n * Fires immediately before the activeElement is changed from the current object to another object in the parent document.\r\n * @param ev The event.\r\n */\r\n onbeforedeactivate: (this: this, ev: UIEvent) => any;\r\n /** \r\n * Fires when the object loses the input focus. \r\n * @param ev The focus event.\r\n */\r\n onblur: (this: this, ev: FocusEvent) => any;\r\n /**\r\n * Occurs when playback is possible, but would require further buffering. \r\n * @param ev The event.\r\n */\r\n oncanplay: (this: this, ev: Event) => any;\r\n oncanplaythrough: (this: this, ev: Event) => any;\r\n /**\r\n * Fires when the contents of the object or selection have changed. \r\n * @param ev The event.\r\n */\r\n onchange: (this: this, ev: Event) => any;\r\n /**\r\n * Fires when the user clicks the left mouse button on the object\r\n * @param ev The mouse event.\r\n */\r\n onclick: (this: this, ev: MouseEvent) => any;\r\n /**\r\n * Fires when the user clicks the right mouse button in the client area, opening the context menu. \r\n * @param ev The mouse event.\r\n */\r\n oncontextmenu: (this: this, ev: PointerEvent) => any;\r\n /**\r\n * Fires when the user double-clicks the object.\r\n * @param ev The mouse event.\r\n */\r\n ondblclick: (this: this, ev: MouseEvent) => any;\r\n /**\r\n * Fires when the activeElement is changed from the current object to another object in the parent document.\r\n * @param ev The UI Event\r\n */\r\n ondeactivate: (this: this, ev: UIEvent) => any;\r\n /**\r\n * Fires on the source object continuously during a drag operation.\r\n * @param ev The event.\r\n */\r\n ondrag: (this: this, ev: DragEvent) => any;\r\n /**\r\n * Fires on the source object when the user releases the mouse at the close of a drag operation.\r\n * @param ev The event.\r\n */\r\n ondragend: (this: this, ev: DragEvent) => any;\r\n /** \r\n * Fires on the target element when the user drags the object to a valid drop target.\r\n * @param ev The drag event.\r\n */\r\n ondragenter: (this: this, ev: DragEvent) => any;\r\n /** \r\n * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation.\r\n * @param ev The drag event.\r\n */\r\n ondragleave: (this: this, ev: DragEvent) => any;\r\n /**\r\n * Fires on the target element continuously while the user drags the object over a valid drop target.\r\n * @param ev The event.\r\n */\r\n ondragover: (this: this, ev: DragEvent) => any;\r\n /**\r\n * Fires on the source object when the user starts to drag a text selection or selected object. \r\n * @param ev The event.\r\n */\r\n ondragstart: (this: this, ev: DragEvent) => any;\r\n ondrop: (this: this, ev: DragEvent) => any;\r\n /**\r\n * Occurs when the duration attribute is updated. \r\n * @param ev The event.\r\n */\r\n ondurationchange: (this: this, ev: Event) => any;\r\n /**\r\n * Occurs when the media element is reset to its initial state. \r\n * @param ev The event.\r\n */\r\n onemptied: (this: this, ev: Event) => any;\r\n /**\r\n * Occurs when the end of playback is reached. \r\n * @param ev The event\r\n */\r\n onended: (this: this, ev: MediaStreamErrorEvent) => any;\r\n /**\r\n * Fires when an error occurs during object loading.\r\n * @param ev The event.\r\n */\r\n onerror: (this: this, ev: ErrorEvent) => any;\r\n /**\r\n * Fires when the object receives focus. \r\n * @param ev The event.\r\n */\r\n onfocus: (this: this, ev: FocusEvent) => any;\r\n onfullscreenchange: (this: this, ev: Event) => any;\r\n onfullscreenerror: (this: this, ev: Event) => any;\r\n oninput: (this: this, ev: Event) => any;\r\n oninvalid: (this: this, ev: Event) => any;\r\n /**\r\n * Fires when the user presses a key.\r\n * @param ev The keyboard event\r\n */\r\n onkeydown: (this: this, ev: KeyboardEvent) => any;\r\n /**\r\n * Fires when the user presses an alphanumeric key.\r\n * @param ev The event.\r\n */\r\n onkeypress: (this: this, ev: KeyboardEvent) => any;\r\n /**\r\n * Fires when the user releases a key.\r\n * @param ev The keyboard event\r\n */\r\n onkeyup: (this: this, ev: KeyboardEvent) => any;\r\n /**\r\n * Fires immediately after the browser loads the object. \r\n * @param ev The event.\r\n */\r\n onload: (this: this, ev: Event) => any;\r\n /**\r\n * Occurs when media data is loaded at the current playback position. \r\n * @param ev The event.\r\n */\r\n onloadeddata: (this: this, ev: Event) => any;\r\n /**\r\n * Occurs when the duration and dimensions of the media have been determined.\r\n * @param ev The event.\r\n */\r\n onloadedmetadata: (this: this, ev: Event) => any;\r\n /**\r\n * Occurs when Internet Explorer begins looking for media data. \r\n * @param ev The event.\r\n */\r\n onloadstart: (this: this, ev: Event) => any;\r\n /**\r\n * Fires when the user clicks the object with either mouse button. \r\n * @param ev The mouse event.\r\n */\r\n onmousedown: (this: this, ev: MouseEvent) => any;\r\n /**\r\n * Fires when the user moves the mouse over the object. \r\n * @param ev The mouse event.\r\n */\r\n onmousemove: (this: this, ev: MouseEvent) => any;\r\n /**\r\n * Fires when the user moves the mouse pointer outside the boundaries of the object. \r\n * @param ev The mouse event.\r\n */\r\n onmouseout: (this: this, ev: MouseEvent) => any;\r\n /**\r\n * Fires when the user moves the mouse pointer into the object.\r\n * @param ev The mouse event.\r\n */\r\n onmouseover: (this: this, ev: MouseEvent) => any;\r\n /**\r\n * Fires when the user releases a mouse button while the mouse is over the object. \r\n * @param ev The mouse event.\r\n */\r\n onmouseup: (this: this, ev: MouseEvent) => any;\r\n /**\r\n * Fires when the wheel button is rotated. \r\n * @param ev The mouse event\r\n */\r\n onmousewheel: (this: this, ev: WheelEvent) => any;\r\n onmscontentzoom: (this: this, ev: UIEvent) => any;\r\n onmsgesturechange: (this: this, ev: MSGestureEvent) => any;\r\n onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any;\r\n onmsgestureend: (this: this, ev: MSGestureEvent) => any;\r\n onmsgesturehold: (this: this, ev: MSGestureEvent) => any;\r\n onmsgesturestart: (this: this, ev: MSGestureEvent) => any;\r\n onmsgesturetap: (this: this, ev: MSGestureEvent) => any;\r\n onmsinertiastart: (this: this, ev: MSGestureEvent) => any;\r\n onmsmanipulationstatechanged: (this: this, ev: MSManipulationEvent) => any;\r\n onmspointercancel: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerdown: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerenter: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerleave: (this: this, ev: MSPointerEvent) => any;\r\n onmspointermove: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerout: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerover: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerup: (this: this, ev: MSPointerEvent) => any;\r\n /**\r\n * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. \r\n * @param ev The event.\r\n */\r\n onmssitemodejumplistitemremoved: (this: this, ev: MSSiteModeEvent) => any;\r\n /**\r\n * Occurs when a user clicks a button in a Thumbnail Toolbar of a webpage running in Site Mode.\r\n * @param ev The event.\r\n */\r\n onmsthumbnailclick: (this: this, ev: MSSiteModeEvent) => any;\r\n /**\r\n * Occurs when playback is paused.\r\n * @param ev The event.\r\n */\r\n onpause: (this: this, ev: Event) => any;\r\n /**\r\n * Occurs when the play method is requested. \r\n * @param ev The event.\r\n */\r\n onplay: (this: this, ev: Event) => any;\r\n /**\r\n * Occurs when the audio or video has started playing. \r\n * @param ev The event.\r\n */\r\n onplaying: (this: this, ev: Event) => any;\r\n onpointerlockchange: (this: this, ev: Event) => any;\r\n onpointerlockerror: (this: this, ev: Event) => any;\r\n /**\r\n * Occurs to indicate progress while downloading media data. \r\n * @param ev The event.\r\n */\r\n onprogress: (this: this, ev: ProgressEvent) => any;\r\n /**\r\n * Occurs when the playback rate is increased or decreased. \r\n * @param ev The event.\r\n */\r\n onratechange: (this: this, ev: Event) => any;\r\n /**\r\n * Fires when the state of the object has changed.\r\n * @param ev The event\r\n */\r\n onreadystatechange: (this: this, ev: ProgressEvent) => any;\r\n /**\r\n * Fires when the user resets a form. \r\n * @param ev The event.\r\n */\r\n onreset: (this: this, ev: Event) => any;\r\n /**\r\n * Fires when the user repositions the scroll box in the scroll bar on the object. \r\n * @param ev The event.\r\n */\r\n onscroll: (this: this, ev: UIEvent) => any;\r\n /**\r\n * Occurs when the seek operation ends. \r\n * @param ev The event.\r\n */\r\n onseeked: (this: this, ev: Event) => any;\r\n /**\r\n * Occurs when the current playback position is moved. \r\n * @param ev The event.\r\n */\r\n onseeking: (this: this, ev: Event) => any;\r\n /**\r\n * Fires when the current selection changes.\r\n * @param ev The event.\r\n */\r\n onselect: (this: this, ev: UIEvent) => any;\r\n /**\r\n * Fires when the selection state of a document changes.\r\n * @param ev The event.\r\n */\r\n onselectionchange: (this: this, ev: Event) => any;\r\n onselectstart: (this: this, ev: Event) => any;\r\n /**\r\n * Occurs when the download has stopped. \r\n * @param ev The event.\r\n */\r\n onstalled: (this: this, ev: Event) => any;\r\n /**\r\n * Fires when the user clicks the Stop button or leaves the Web page.\r\n * @param ev The event.\r\n */\r\n onstop: (this: this, ev: Event) => any;\r\n onsubmit: (this: this, ev: Event) => any;\r\n /**\r\n * Occurs if the load operation has been intentionally halted. \r\n * @param ev The event.\r\n */\r\n onsuspend: (this: this, ev: Event) => any;\r\n /**\r\n * Occurs to indicate the current playback position.\r\n * @param ev The event.\r\n */\r\n ontimeupdate: (this: this, ev: Event) => any;\r\n ontouchcancel: (ev: TouchEvent) => any;\r\n ontouchend: (ev: TouchEvent) => any;\r\n ontouchmove: (ev: TouchEvent) => any;\r\n ontouchstart: (ev: TouchEvent) => any;\r\n /**\r\n * Occurs when the volume is changed, or playback is muted or unmuted.\r\n * @param ev The event.\r\n */\r\n onvolumechange: (this: this, ev: Event) => any;\r\n /**\r\n * Occurs when playback stops because the next frame of a video resource is not available. \r\n * @param ev The event.\r\n */\r\n onwaiting: (this: this, ev: Event) => any;\r\n onwebkitfullscreenchange: (this: this, ev: Event) => any;\r\n onwebkitfullscreenerror: (this: this, ev: Event) => any;\r\n plugins: HTMLCollectionOf;\r\n readonly pointerLockElement: Element;\r\n /**\r\n * Retrieves a value that indicates the current state of the object.\r\n */\r\n readonly readyState: string;\r\n /**\r\n * Gets the URL of the location that referred the user to the current page.\r\n */\r\n readonly referrer: string;\r\n /**\r\n * Gets the root svg element in the document hierarchy.\r\n */\r\n readonly rootElement: SVGSVGElement;\r\n /**\r\n * Retrieves a collection of all script objects in the document.\r\n */\r\n scripts: HTMLCollectionOf;\r\n readonly scrollingElement: Element | null;\r\n /**\r\n * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document.\r\n */\r\n readonly styleSheets: StyleSheetList;\r\n /**\r\n * Contains the title of the document.\r\n */\r\n title: string;\r\n readonly visibilityState: string;\r\n /** \r\n * Sets or gets the color of the links that the user has visited.\r\n */\r\n vlinkColor: string;\r\n readonly webkitCurrentFullScreenElement: Element | null;\r\n readonly webkitFullscreenElement: Element | null;\r\n readonly webkitFullscreenEnabled: boolean;\r\n readonly webkitIsFullScreen: boolean;\r\n readonly xmlEncoding: string | null;\r\n xmlStandalone: boolean;\r\n /**\r\n * Gets or sets the version attribute specified in the declaration of an XML document.\r\n */\r\n xmlVersion: string | null;\r\n adoptNode(source: Node): Node;\r\n captureEvents(): void;\r\n caretRangeFromPoint(x: number, y: number): Range;\r\n clear(): void;\r\n /**\r\n * Closes an output stream and forces the sent data to display.\r\n */\r\n close(): void;\r\n /**\r\n * Creates an attribute object with a specified name.\r\n * @param name String that sets the attribute object's name.\r\n */\r\n createAttribute(name: string): Attr;\r\n createAttributeNS(namespaceURI: string | null, qualifiedName: string): Attr;\r\n createCDATASection(data: string): CDATASection;\r\n /**\r\n * Creates a comment object with the specified data.\r\n * @param data Sets the comment object's data.\r\n */\r\n createComment(data: string): Comment;\r\n /**\r\n * Creates a new document.\r\n */\r\n createDocumentFragment(): DocumentFragment;\r\n /**\r\n * Creates an instance of the element for the specified tag.\r\n * @param tagName The name of an element.\r\n */\r\n createElement(tagName: \"a\"): HTMLAnchorElement;\r\n createElement(tagName: \"applet\"): HTMLAppletElement;\r\n createElement(tagName: \"area\"): HTMLAreaElement;\r\n createElement(tagName: \"audio\"): HTMLAudioElement;\r\n createElement(tagName: \"base\"): HTMLBaseElement;\r\n createElement(tagName: \"basefont\"): HTMLBaseFontElement;\r\n createElement(tagName: \"blockquote\"): HTMLQuoteElement;\r\n createElement(tagName: \"body\"): HTMLBodyElement;\r\n createElement(tagName: \"br\"): HTMLBRElement;\r\n createElement(tagName: \"button\"): HTMLButtonElement;\r\n createElement(tagName: \"canvas\"): HTMLCanvasElement;\r\n createElement(tagName: \"caption\"): HTMLTableCaptionElement;\r\n createElement(tagName: \"col\"): HTMLTableColElement;\r\n createElement(tagName: \"colgroup\"): HTMLTableColElement;\r\n createElement(tagName: \"datalist\"): HTMLDataListElement;\r\n createElement(tagName: \"del\"): HTMLModElement;\r\n createElement(tagName: \"dir\"): HTMLDirectoryElement;\r\n createElement(tagName: \"div\"): HTMLDivElement;\r\n createElement(tagName: \"dl\"): HTMLDListElement;\r\n createElement(tagName: \"embed\"): HTMLEmbedElement;\r\n createElement(tagName: \"fieldset\"): HTMLFieldSetElement;\r\n createElement(tagName: \"font\"): HTMLFontElement;\r\n createElement(tagName: \"form\"): HTMLFormElement;\r\n createElement(tagName: \"frame\"): HTMLFrameElement;\r\n createElement(tagName: \"frameset\"): HTMLFrameSetElement;\r\n createElement(tagName: \"h1\"): HTMLHeadingElement;\r\n createElement(tagName: \"h2\"): HTMLHeadingElement;\r\n createElement(tagName: \"h3\"): HTMLHeadingElement;\r\n createElement(tagName: \"h4\"): HTMLHeadingElement;\r\n createElement(tagName: \"h5\"): HTMLHeadingElement;\r\n createElement(tagName: \"h6\"): HTMLHeadingElement;\r\n createElement(tagName: \"head\"): HTMLHeadElement;\r\n createElement(tagName: \"hr\"): HTMLHRElement;\r\n createElement(tagName: \"html\"): HTMLHtmlElement;\r\n createElement(tagName: \"iframe\"): HTMLIFrameElement;\r\n createElement(tagName: \"img\"): HTMLImageElement;\r\n createElement(tagName: \"input\"): HTMLInputElement;\r\n createElement(tagName: \"ins\"): HTMLModElement;\r\n createElement(tagName: \"isindex\"): HTMLUnknownElement;\r\n createElement(tagName: \"label\"): HTMLLabelElement;\r\n createElement(tagName: \"legend\"): HTMLLegendElement;\r\n createElement(tagName: \"li\"): HTMLLIElement;\r\n createElement(tagName: \"link\"): HTMLLinkElement;\r\n createElement(tagName: \"listing\"): HTMLPreElement;\r\n createElement(tagName: \"map\"): HTMLMapElement;\r\n createElement(tagName: \"marquee\"): HTMLMarqueeElement;\r\n createElement(tagName: \"menu\"): HTMLMenuElement;\r\n createElement(tagName: \"meta\"): HTMLMetaElement;\r\n createElement(tagName: \"meter\"): HTMLMeterElement;\r\n createElement(tagName: \"nextid\"): HTMLUnknownElement;\r\n createElement(tagName: \"object\"): HTMLObjectElement;\r\n createElement(tagName: \"ol\"): HTMLOListElement;\r\n createElement(tagName: \"optgroup\"): HTMLOptGroupElement;\r\n createElement(tagName: \"option\"): HTMLOptionElement;\r\n createElement(tagName: \"p\"): HTMLParagraphElement;\r\n createElement(tagName: \"param\"): HTMLParamElement;\r\n createElement(tagName: \"picture\"): HTMLPictureElement;\r\n createElement(tagName: \"pre\"): HTMLPreElement;\r\n createElement(tagName: \"progress\"): HTMLProgressElement;\r\n createElement(tagName: \"q\"): HTMLQuoteElement;\r\n createElement(tagName: \"script\"): HTMLScriptElement;\r\n createElement(tagName: \"select\"): HTMLSelectElement;\r\n createElement(tagName: \"source\"): HTMLSourceElement;\r\n createElement(tagName: \"span\"): HTMLSpanElement;\r\n createElement(tagName: \"style\"): HTMLStyleElement;\r\n createElement(tagName: \"table\"): HTMLTableElement;\r\n createElement(tagName: \"tbody\"): HTMLTableSectionElement;\r\n createElement(tagName: \"td\"): HTMLTableDataCellElement;\r\n createElement(tagName: \"template\"): HTMLTemplateElement;\r\n createElement(tagName: \"textarea\"): HTMLTextAreaElement;\r\n createElement(tagName: \"tfoot\"): HTMLTableSectionElement;\r\n createElement(tagName: \"th\"): HTMLTableHeaderCellElement;\r\n createElement(tagName: \"thead\"): HTMLTableSectionElement;\r\n createElement(tagName: \"title\"): HTMLTitleElement;\r\n createElement(tagName: \"tr\"): HTMLTableRowElement;\r\n createElement(tagName: \"track\"): HTMLTrackElement;\r\n createElement(tagName: \"ul\"): HTMLUListElement;\r\n createElement(tagName: \"video\"): HTMLVideoElement;\r\n createElement(tagName: \"x-ms-webview\"): MSHTMLWebViewElement;\r\n createElement(tagName: \"xmp\"): HTMLPreElement;\r\n createElement(tagName: string): HTMLElement;\r\n createElementNS(namespaceURI: \"http://www.w3.org/1999/xhtml\", qualifiedName: string): HTMLElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"a\"): SVGAElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"circle\"): SVGCircleElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"clipPath\"): SVGClipPathElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"componentTransferFunction\"): SVGComponentTransferFunctionElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"defs\"): SVGDefsElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"desc\"): SVGDescElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"ellipse\"): SVGEllipseElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feBlend\"): SVGFEBlendElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feColorMatrix\"): SVGFEColorMatrixElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feComponentTransfer\"): SVGFEComponentTransferElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feComposite\"): SVGFECompositeElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feConvolveMatrix\"): SVGFEConvolveMatrixElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feDiffuseLighting\"): SVGFEDiffuseLightingElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feDisplacementMap\"): SVGFEDisplacementMapElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feDistantLight\"): SVGFEDistantLightElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feFlood\"): SVGFEFloodElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feFuncA\"): SVGFEFuncAElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feFuncB\"): SVGFEFuncBElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feFuncG\"): SVGFEFuncGElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feFuncR\"): SVGFEFuncRElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feGaussianBlur\"): SVGFEGaussianBlurElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feImage\"): SVGFEImageElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feMerge\"): SVGFEMergeElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feMergeNode\"): SVGFEMergeNodeElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feMorphology\"): SVGFEMorphologyElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feOffset\"): SVGFEOffsetElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"fePointLight\"): SVGFEPointLightElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feSpecularLighting\"): SVGFESpecularLightingElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feSpotLight\"): SVGFESpotLightElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feTile\"): SVGFETileElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feTurbulence\"): SVGFETurbulenceElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"filter\"): SVGFilterElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"foreignObject\"): SVGForeignObjectElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"g\"): SVGGElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"image\"): SVGImageElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"gradient\"): SVGGradientElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"line\"): SVGLineElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"linearGradient\"): SVGLinearGradientElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"marker\"): SVGMarkerElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"mask\"): SVGMaskElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"path\"): SVGPathElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"metadata\"): SVGMetadataElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"pattern\"): SVGPatternElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"polygon\"): SVGPolygonElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"polyline\"): SVGPolylineElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"radialGradient\"): SVGRadialGradientElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"rect\"): SVGRectElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"svg\"): SVGSVGElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"script\"): SVGScriptElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"stop\"): SVGStopElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"style\"): SVGStyleElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"switch\"): SVGSwitchElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"symbol\"): SVGSymbolElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"tspan\"): SVGTSpanElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"textContent\"): SVGTextContentElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"text\"): SVGTextElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"textPath\"): SVGTextPathElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"textPositioning\"): SVGTextPositioningElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"title\"): SVGTitleElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"use\"): SVGUseElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"view\"): SVGViewElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: string): SVGElement\r\n createElementNS(namespaceURI: string | null, qualifiedName: string): Element;\r\n createExpression(expression: string, resolver: XPathNSResolver): XPathExpression;\r\n createNSResolver(nodeResolver: Node): XPathNSResolver;\r\n /**\r\n * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. \r\n * @param root The root element or node to start traversing on.\r\n * @param whatToShow The type of nodes or elements to appear in the node list\r\n * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter.\r\n * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded.\r\n */\r\n createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): NodeIterator;\r\n createProcessingInstruction(target: string, data: string): ProcessingInstruction;\r\n /**\r\n * Returns an empty range object that has both of its boundary points positioned at the beginning of the document. \r\n */\r\n createRange(): Range;\r\n /**\r\n * Creates a text string from the specified value. \r\n * @param data String that specifies the nodeValue property of the text node.\r\n */\r\n createTextNode(data: string): Text;\r\n createTouch(view: Window, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch;\r\n createTouchList(...touches: Touch[]): TouchList;\r\n /**\r\n * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document.\r\n * @param root The root element or node to start traversing on.\r\n * @param whatToShow The type of nodes or elements to appear in the node list. For more information, see whatToShow.\r\n * @param filter A custom NodeFilter function to use.\r\n * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded.\r\n */\r\n createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): TreeWalker;\r\n /**\r\n * Returns the element for the specified x coordinate and the specified y coordinate. \r\n * @param x The x-offset\r\n * @param y The y-offset\r\n */\r\n elementFromPoint(x: number, y: number): Element;\r\n evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult;\r\n /**\r\n * Executes a command on the current document, current selection, or the given range.\r\n * @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script.\r\n * @param showUI Display the user interface, defaults to false.\r\n * @param value Value to assign.\r\n */\r\n execCommand(commandId: string, showUI?: boolean, value?: any): boolean;\r\n /**\r\n * Displays help information for the given command identifier.\r\n * @param commandId Displays help information for the given command identifier.\r\n */\r\n execCommandShowHelp(commandId: string): boolean;\r\n exitFullscreen(): void;\r\n exitPointerLock(): void;\r\n /**\r\n * Causes the element to receive the focus and executes the code specified by the onfocus event.\r\n */\r\n focus(): void;\r\n /**\r\n * Returns a reference to the first object with the specified value of the ID or NAME attribute.\r\n * @param elementId String that specifies the ID value. Case-insensitive.\r\n */\r\n getElementById(elementId: string): HTMLElement | null;\r\n getElementsByClassName(classNames: string): HTMLCollectionOf;\r\n /**\r\n * Gets a collection of objects based on the value of the NAME or ID attribute.\r\n * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute.\r\n */\r\n getElementsByName(elementName: string): NodeListOf;\r\n /**\r\n * Retrieves a collection of objects based on the specified element name.\r\n * @param name Specifies the name of an element.\r\n */\r\n getElementsByTagName(tagname: \"a\"): NodeListOf;\r\n getElementsByTagName(tagname: \"abbr\"): NodeListOf;\r\n getElementsByTagName(tagname: \"acronym\"): NodeListOf;\r\n getElementsByTagName(tagname: \"address\"): NodeListOf;\r\n getElementsByTagName(tagname: \"applet\"): NodeListOf;\r\n getElementsByTagName(tagname: \"area\"): NodeListOf;\r\n getElementsByTagName(tagname: \"article\"): NodeListOf;\r\n getElementsByTagName(tagname: \"aside\"): NodeListOf;\r\n getElementsByTagName(tagname: \"audio\"): NodeListOf;\r\n getElementsByTagName(tagname: \"b\"): NodeListOf;\r\n getElementsByTagName(tagname: \"base\"): NodeListOf;\r\n getElementsByTagName(tagname: \"basefont\"): NodeListOf;\r\n getElementsByTagName(tagname: \"bdo\"): NodeListOf;\r\n getElementsByTagName(tagname: \"big\"): NodeListOf;\r\n getElementsByTagName(tagname: \"blockquote\"): NodeListOf;\r\n getElementsByTagName(tagname: \"body\"): NodeListOf;\r\n getElementsByTagName(tagname: \"br\"): NodeListOf;\r\n getElementsByTagName(tagname: \"button\"): NodeListOf;\r\n getElementsByTagName(tagname: \"canvas\"): NodeListOf;\r\n getElementsByTagName(tagname: \"caption\"): NodeListOf;\r\n getElementsByTagName(tagname: \"center\"): NodeListOf;\r\n getElementsByTagName(tagname: \"circle\"): NodeListOf;\r\n getElementsByTagName(tagname: \"cite\"): NodeListOf;\r\n getElementsByTagName(tagname: \"clippath\"): NodeListOf;\r\n getElementsByTagName(tagname: \"code\"): NodeListOf;\r\n getElementsByTagName(tagname: \"col\"): NodeListOf;\r\n getElementsByTagName(tagname: \"colgroup\"): NodeListOf;\r\n getElementsByTagName(tagname: \"datalist\"): NodeListOf;\r\n getElementsByTagName(tagname: \"dd\"): NodeListOf;\r\n getElementsByTagName(tagname: \"defs\"): NodeListOf;\r\n getElementsByTagName(tagname: \"del\"): NodeListOf;\r\n getElementsByTagName(tagname: \"desc\"): NodeListOf;\r\n getElementsByTagName(tagname: \"dfn\"): NodeListOf;\r\n getElementsByTagName(tagname: \"dir\"): NodeListOf;\r\n getElementsByTagName(tagname: \"div\"): NodeListOf;\r\n getElementsByTagName(tagname: \"dl\"): NodeListOf;\r\n getElementsByTagName(tagname: \"dt\"): NodeListOf;\r\n getElementsByTagName(tagname: \"ellipse\"): NodeListOf;\r\n getElementsByTagName(tagname: \"em\"): NodeListOf;\r\n getElementsByTagName(tagname: \"embed\"): NodeListOf;\r\n getElementsByTagName(tagname: \"feblend\"): NodeListOf;\r\n getElementsByTagName(tagname: \"fecolormatrix\"): NodeListOf;\r\n getElementsByTagName(tagname: \"fecomponenttransfer\"): NodeListOf;\r\n getElementsByTagName(tagname: \"fecomposite\"): NodeListOf;\r\n getElementsByTagName(tagname: \"feconvolvematrix\"): NodeListOf;\r\n getElementsByTagName(tagname: \"fediffuselighting\"): NodeListOf;\r\n getElementsByTagName(tagname: \"fedisplacementmap\"): NodeListOf;\r\n getElementsByTagName(tagname: \"fedistantlight\"): NodeListOf;\r\n getElementsByTagName(tagname: \"feflood\"): NodeListOf;\r\n getElementsByTagName(tagname: \"fefunca\"): NodeListOf;\r\n getElementsByTagName(tagname: \"fefuncb\"): NodeListOf;\r\n getElementsByTagName(tagname: \"fefuncg\"): NodeListOf;\r\n getElementsByTagName(tagname: \"fefuncr\"): NodeListOf;\r\n getElementsByTagName(tagname: \"fegaussianblur\"): NodeListOf;\r\n getElementsByTagName(tagname: \"feimage\"): NodeListOf;\r\n getElementsByTagName(tagname: \"femerge\"): NodeListOf;\r\n getElementsByTagName(tagname: \"femergenode\"): NodeListOf;\r\n getElementsByTagName(tagname: \"femorphology\"): NodeListOf;\r\n getElementsByTagName(tagname: \"feoffset\"): NodeListOf;\r\n getElementsByTagName(tagname: \"fepointlight\"): NodeListOf;\r\n getElementsByTagName(tagname: \"fespecularlighting\"): NodeListOf;\r\n getElementsByTagName(tagname: \"fespotlight\"): NodeListOf;\r\n getElementsByTagName(tagname: \"fetile\"): NodeListOf;\r\n getElementsByTagName(tagname: \"feturbulence\"): NodeListOf;\r\n getElementsByTagName(tagname: \"fieldset\"): NodeListOf;\r\n getElementsByTagName(tagname: \"figcaption\"): NodeListOf;\r\n getElementsByTagName(tagname: \"figure\"): NodeListOf;\r\n getElementsByTagName(tagname: \"filter\"): NodeListOf;\r\n getElementsByTagName(tagname: \"font\"): NodeListOf;\r\n getElementsByTagName(tagname: \"footer\"): NodeListOf;\r\n getElementsByTagName(tagname: \"foreignobject\"): NodeListOf;\r\n getElementsByTagName(tagname: \"form\"): NodeListOf;\r\n getElementsByTagName(tagname: \"frame\"): NodeListOf;\r\n getElementsByTagName(tagname: \"frameset\"): NodeListOf;\r\n getElementsByTagName(tagname: \"g\"): NodeListOf;\r\n getElementsByTagName(tagname: \"h1\"): NodeListOf;\r\n getElementsByTagName(tagname: \"h2\"): NodeListOf;\r\n getElementsByTagName(tagname: \"h3\"): NodeListOf;\r\n getElementsByTagName(tagname: \"h4\"): NodeListOf;\r\n getElementsByTagName(tagname: \"h5\"): NodeListOf;\r\n getElementsByTagName(tagname: \"h6\"): NodeListOf;\r\n getElementsByTagName(tagname: \"head\"): NodeListOf;\r\n getElementsByTagName(tagname: \"header\"): NodeListOf;\r\n getElementsByTagName(tagname: \"hgroup\"): NodeListOf;\r\n getElementsByTagName(tagname: \"hr\"): NodeListOf;\r\n getElementsByTagName(tagname: \"html\"): NodeListOf;\r\n getElementsByTagName(tagname: \"i\"): NodeListOf;\r\n getElementsByTagName(tagname: \"iframe\"): NodeListOf;\r\n getElementsByTagName(tagname: \"image\"): NodeListOf;\r\n getElementsByTagName(tagname: \"img\"): NodeListOf;\r\n getElementsByTagName(tagname: \"input\"): NodeListOf;\r\n getElementsByTagName(tagname: \"ins\"): NodeListOf;\r\n getElementsByTagName(tagname: \"isindex\"): NodeListOf;\r\n getElementsByTagName(tagname: \"kbd\"): NodeListOf;\r\n getElementsByTagName(tagname: \"keygen\"): NodeListOf;\r\n getElementsByTagName(tagname: \"label\"): NodeListOf;\r\n getElementsByTagName(tagname: \"legend\"): NodeListOf;\r\n getElementsByTagName(tagname: \"li\"): NodeListOf;\r\n getElementsByTagName(tagname: \"line\"): NodeListOf;\r\n getElementsByTagName(tagname: \"lineargradient\"): NodeListOf;\r\n getElementsByTagName(tagname: \"link\"): NodeListOf;\r\n getElementsByTagName(tagname: \"listing\"): NodeListOf;\r\n getElementsByTagName(tagname: \"map\"): NodeListOf;\r\n getElementsByTagName(tagname: \"mark\"): NodeListOf;\r\n getElementsByTagName(tagname: \"marker\"): NodeListOf;\r\n getElementsByTagName(tagname: \"marquee\"): NodeListOf;\r\n getElementsByTagName(tagname: \"mask\"): NodeListOf;\r\n getElementsByTagName(tagname: \"menu\"): NodeListOf;\r\n getElementsByTagName(tagname: \"meta\"): NodeListOf;\r\n getElementsByTagName(tagname: \"metadata\"): NodeListOf;\r\n getElementsByTagName(tagname: \"meter\"): NodeListOf;\r\n getElementsByTagName(tagname: \"nav\"): NodeListOf;\r\n getElementsByTagName(tagname: \"nextid\"): NodeListOf;\r\n getElementsByTagName(tagname: \"nobr\"): NodeListOf;\r\n getElementsByTagName(tagname: \"noframes\"): NodeListOf;\r\n getElementsByTagName(tagname: \"noscript\"): NodeListOf;\r\n getElementsByTagName(tagname: \"object\"): NodeListOf;\r\n getElementsByTagName(tagname: \"ol\"): NodeListOf;\r\n getElementsByTagName(tagname: \"optgroup\"): NodeListOf;\r\n getElementsByTagName(tagname: \"option\"): NodeListOf;\r\n getElementsByTagName(tagname: \"p\"): NodeListOf;\r\n getElementsByTagName(tagname: \"param\"): NodeListOf;\r\n getElementsByTagName(tagname: \"path\"): NodeListOf;\r\n getElementsByTagName(tagname: \"pattern\"): NodeListOf;\r\n getElementsByTagName(tagname: \"picture\"): NodeListOf;\r\n getElementsByTagName(tagname: \"plaintext\"): NodeListOf;\r\n getElementsByTagName(tagname: \"polygon\"): NodeListOf;\r\n getElementsByTagName(tagname: \"polyline\"): NodeListOf;\r\n getElementsByTagName(tagname: \"pre\"): NodeListOf;\r\n getElementsByTagName(tagname: \"progress\"): NodeListOf;\r\n getElementsByTagName(tagname: \"q\"): NodeListOf;\r\n getElementsByTagName(tagname: \"radialgradient\"): NodeListOf;\r\n getElementsByTagName(tagname: \"rect\"): NodeListOf;\r\n getElementsByTagName(tagname: \"rt\"): NodeListOf;\r\n getElementsByTagName(tagname: \"ruby\"): NodeListOf;\r\n getElementsByTagName(tagname: \"s\"): NodeListOf;\r\n getElementsByTagName(tagname: \"samp\"): NodeListOf;\r\n getElementsByTagName(tagname: \"script\"): NodeListOf;\r\n getElementsByTagName(tagname: \"section\"): NodeListOf;\r\n getElementsByTagName(tagname: \"select\"): NodeListOf;\r\n getElementsByTagName(tagname: \"small\"): NodeListOf;\r\n getElementsByTagName(tagname: \"source\"): NodeListOf;\r\n getElementsByTagName(tagname: \"span\"): NodeListOf;\r\n getElementsByTagName(tagname: \"stop\"): NodeListOf;\r\n getElementsByTagName(tagname: \"strike\"): NodeListOf;\r\n getElementsByTagName(tagname: \"strong\"): NodeListOf;\r\n getElementsByTagName(tagname: \"style\"): NodeListOf;\r\n getElementsByTagName(tagname: \"sub\"): NodeListOf;\r\n getElementsByTagName(tagname: \"sup\"): NodeListOf;\r\n getElementsByTagName(tagname: \"svg\"): NodeListOf;\r\n getElementsByTagName(tagname: \"switch\"): NodeListOf;\r\n getElementsByTagName(tagname: \"symbol\"): NodeListOf;\r\n getElementsByTagName(tagname: \"table\"): NodeListOf;\r\n getElementsByTagName(tagname: \"tbody\"): NodeListOf;\r\n getElementsByTagName(tagname: \"td\"): NodeListOf;\r\n getElementsByTagName(tagname: \"template\"): NodeListOf;\r\n getElementsByTagName(tagname: \"text\"): NodeListOf;\r\n getElementsByTagName(tagname: \"textpath\"): NodeListOf;\r\n getElementsByTagName(tagname: \"textarea\"): NodeListOf;\r\n getElementsByTagName(tagname: \"tfoot\"): NodeListOf;\r\n getElementsByTagName(tagname: \"th\"): NodeListOf;\r\n getElementsByTagName(tagname: \"thead\"): NodeListOf;\r\n getElementsByTagName(tagname: \"title\"): NodeListOf;\r\n getElementsByTagName(tagname: \"tr\"): NodeListOf;\r\n getElementsByTagName(tagname: \"track\"): NodeListOf;\r\n getElementsByTagName(tagname: \"tspan\"): NodeListOf;\r\n getElementsByTagName(tagname: \"tt\"): NodeListOf;\r\n getElementsByTagName(tagname: \"u\"): NodeListOf;\r\n getElementsByTagName(tagname: \"ul\"): NodeListOf;\r\n getElementsByTagName(tagname: \"use\"): NodeListOf;\r\n getElementsByTagName(tagname: \"var\"): NodeListOf;\r\n getElementsByTagName(tagname: \"video\"): NodeListOf;\r\n getElementsByTagName(tagname: \"view\"): NodeListOf;\r\n getElementsByTagName(tagname: \"wbr\"): NodeListOf;\r\n getElementsByTagName(tagname: \"x-ms-webview\"): NodeListOf;\r\n getElementsByTagName(tagname: \"xmp\"): NodeListOf;\r\n getElementsByTagName(tagname: string): NodeListOf;\r\n getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/1999/xhtml\", localName: string): HTMLCollectionOf;\r\n getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/2000/svg\", localName: string): HTMLCollectionOf;\r\n getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf;\r\n /**\r\n * Returns an object representing the current selection of the document that is loaded into the object displaying a webpage.\r\n */\r\n getSelection(): Selection;\r\n /**\r\n * Gets a value indicating whether the object currently has focus.\r\n */\r\n hasFocus(): boolean;\r\n importNode(importedNode: Node, deep: boolean): Node;\r\n msElementsFromPoint(x: number, y: number): NodeListOf;\r\n msElementsFromRect(left: number, top: number, width: number, height: number): NodeListOf;\r\n /**\r\n * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method.\r\n * @param url Specifies a MIME type for the document.\r\n * @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element.\r\n * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, \"fullscreen=yes, toolbar=yes\"). The following values are supported.\r\n * @param replace Specifies whether the existing entry for the document is replaced in the history list.\r\n */\r\n open(url?: string, name?: string, features?: string, replace?: boolean): Document;\r\n /** \r\n * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document.\r\n * @param commandId Specifies a command identifier.\r\n */\r\n queryCommandEnabled(commandId: string): boolean;\r\n /**\r\n * Returns a Boolean value that indicates whether the specified command is in the indeterminate state.\r\n * @param commandId String that specifies a command identifier.\r\n */\r\n queryCommandIndeterm(commandId: string): boolean;\r\n /**\r\n * Returns a Boolean value that indicates the current state of the command.\r\n * @param commandId String that specifies a command identifier.\r\n */\r\n queryCommandState(commandId: string): boolean;\r\n /**\r\n * Returns a Boolean value that indicates whether the current command is supported on the current range.\r\n * @param commandId Specifies a command identifier.\r\n */\r\n queryCommandSupported(commandId: string): boolean;\r\n /**\r\n * Retrieves the string associated with a command.\r\n * @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers. \r\n */\r\n queryCommandText(commandId: string): string;\r\n /**\r\n * Returns the current value of the document, range, or current selection for the given command.\r\n * @param commandId String that specifies a command identifier.\r\n */\r\n queryCommandValue(commandId: string): string;\r\n releaseEvents(): void;\r\n /**\r\n * Allows updating the print settings for the page.\r\n */\r\n updateSettings(): void;\r\n webkitCancelFullScreen(): void;\r\n webkitExitFullscreen(): void;\r\n /**\r\n * Writes one or more HTML expressions to a document in the specified window. \r\n * @param content Specifies the text and HTML tags to write.\r\n */\r\n write(...content: string[]): void;\r\n /**\r\n * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. \r\n * @param content The text and HTML tags to write.\r\n */\r\n writeln(...content: string[]): void;\r\n addEventListener(type: \"MSContentZoom\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureChange\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureDoubleTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureEnd\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureHold\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSInertiaStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSManipulationStateChanged\", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerCancel\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerDown\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerEnter\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerLeave\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerMove\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOut\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOver\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerUp\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"abort\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"activate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforedeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"blur\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplay\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplaythrough\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"change\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"click\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"contextmenu\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dblclick\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"deactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drag\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragend\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragenter\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragleave\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragover\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragstart\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drop\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"durationchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"emptied\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ended\", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"focus\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"fullscreenchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"fullscreenerror\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"input\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"invalid\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keydown\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keypress\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keyup\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadeddata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadedmetadata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousedown\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousemove\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseout\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseover\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseup\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousewheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mssitemodejumplistitemremoved\", listener: (this: this, ev: MSSiteModeEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"msthumbnailclick\", listener: (this: this, ev: MSSiteModeEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pause\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"play\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"playing\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointercancel\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerdown\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerenter\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerleave\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerlockchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerlockerror\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointermove\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerout\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerover\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerup\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"progress\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ratechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"readystatechange\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"reset\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"scroll\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeked\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeking\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"select\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"selectionchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"selectstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"stalled\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"stop\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"submit\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"suspend\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"timeupdate\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchcancel\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchend\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchmove\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchstart\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"volumechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"waiting\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenerror\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"wheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var Document: {\r\n prototype: Document;\r\n new(): Document;\r\n}\r\n\r\ninterface DocumentFragment extends Node, NodeSelector, ParentNode {\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var DocumentFragment: {\r\n prototype: DocumentFragment;\r\n new(): DocumentFragment;\r\n}\r\n\r\ninterface DocumentType extends Node, ChildNode {\r\n readonly entities: NamedNodeMap;\r\n readonly internalSubset: string | null;\r\n readonly name: string;\r\n readonly notations: NamedNodeMap;\r\n readonly publicId: string | null;\r\n readonly systemId: string | null;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var DocumentType: {\r\n prototype: DocumentType;\r\n new(): DocumentType;\r\n}\r\n\r\ninterface DragEvent extends MouseEvent {\r\n readonly dataTransfer: DataTransfer;\r\n initDragEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, dataTransferArg: DataTransfer): void;\r\n msConvertURL(file: File, targetType: string, targetURL?: string): void;\r\n}\r\n\r\ndeclare var DragEvent: {\r\n prototype: DragEvent;\r\n new(): DragEvent;\r\n}\r\n\r\ninterface DynamicsCompressorNode extends AudioNode {\r\n readonly attack: AudioParam;\r\n readonly knee: AudioParam;\r\n readonly ratio: AudioParam;\r\n readonly reduction: AudioParam;\r\n readonly release: AudioParam;\r\n readonly threshold: AudioParam;\r\n}\r\n\r\ndeclare var DynamicsCompressorNode: {\r\n prototype: DynamicsCompressorNode;\r\n new(): DynamicsCompressorNode;\r\n}\r\n\r\ninterface EXT_frag_depth {\r\n}\r\n\r\ndeclare var EXT_frag_depth: {\r\n prototype: EXT_frag_depth;\r\n new(): EXT_frag_depth;\r\n}\r\n\r\ninterface EXT_texture_filter_anisotropic {\r\n readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number;\r\n readonly TEXTURE_MAX_ANISOTROPY_EXT: number;\r\n}\r\n\r\ndeclare var EXT_texture_filter_anisotropic: {\r\n prototype: EXT_texture_filter_anisotropic;\r\n new(): EXT_texture_filter_anisotropic;\r\n readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number;\r\n readonly TEXTURE_MAX_ANISOTROPY_EXT: number;\r\n}\r\n\r\ninterface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode, ParentNode {\r\n readonly classList: DOMTokenList;\r\n className: string;\r\n readonly clientHeight: number;\r\n readonly clientLeft: number;\r\n readonly clientTop: number;\r\n readonly clientWidth: number;\r\n id: string;\r\n msContentZoomFactor: number;\r\n readonly msRegionOverflow: string;\r\n onariarequest: (this: this, ev: AriaRequestEvent) => any;\r\n oncommand: (this: this, ev: CommandEvent) => any;\r\n ongotpointercapture: (this: this, ev: PointerEvent) => any;\r\n onlostpointercapture: (this: this, ev: PointerEvent) => any;\r\n onmsgesturechange: (this: this, ev: MSGestureEvent) => any;\r\n onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any;\r\n onmsgestureend: (this: this, ev: MSGestureEvent) => any;\r\n onmsgesturehold: (this: this, ev: MSGestureEvent) => any;\r\n onmsgesturestart: (this: this, ev: MSGestureEvent) => any;\r\n onmsgesturetap: (this: this, ev: MSGestureEvent) => any;\r\n onmsgotpointercapture: (this: this, ev: MSPointerEvent) => any;\r\n onmsinertiastart: (this: this, ev: MSGestureEvent) => any;\r\n onmslostpointercapture: (this: this, ev: MSPointerEvent) => any;\r\n onmspointercancel: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerdown: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerenter: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerleave: (this: this, ev: MSPointerEvent) => any;\r\n onmspointermove: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerout: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerover: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerup: (this: this, ev: MSPointerEvent) => any;\r\n ontouchcancel: (ev: TouchEvent) => any;\r\n ontouchend: (ev: TouchEvent) => any;\r\n ontouchmove: (ev: TouchEvent) => any;\r\n ontouchstart: (ev: TouchEvent) => any;\r\n onwebkitfullscreenchange: (this: this, ev: Event) => any;\r\n onwebkitfullscreenerror: (this: this, ev: Event) => any;\r\n readonly prefix: string | null;\r\n readonly scrollHeight: number;\r\n scrollLeft: number;\r\n scrollTop: number;\r\n readonly scrollWidth: number;\r\n readonly tagName: string;\r\n innerHTML: string;\r\n getAttribute(name: string): string | null;\r\n getAttributeNS(namespaceURI: string, localName: string): string;\r\n getAttributeNode(name: string): Attr;\r\n getAttributeNodeNS(namespaceURI: string, localName: string): Attr;\r\n getBoundingClientRect(): ClientRect;\r\n getClientRects(): ClientRectList;\r\n getElementsByTagName(name: \"a\"): NodeListOf;\r\n getElementsByTagName(name: \"abbr\"): NodeListOf;\r\n getElementsByTagName(name: \"acronym\"): NodeListOf;\r\n getElementsByTagName(name: \"address\"): NodeListOf;\r\n getElementsByTagName(name: \"applet\"): NodeListOf;\r\n getElementsByTagName(name: \"area\"): NodeListOf;\r\n getElementsByTagName(name: \"article\"): NodeListOf;\r\n getElementsByTagName(name: \"aside\"): NodeListOf;\r\n getElementsByTagName(name: \"audio\"): NodeListOf;\r\n getElementsByTagName(name: \"b\"): NodeListOf;\r\n getElementsByTagName(name: \"base\"): NodeListOf;\r\n getElementsByTagName(name: \"basefont\"): NodeListOf;\r\n getElementsByTagName(name: \"bdo\"): NodeListOf;\r\n getElementsByTagName(name: \"big\"): NodeListOf;\r\n getElementsByTagName(name: \"blockquote\"): NodeListOf;\r\n getElementsByTagName(name: \"body\"): NodeListOf;\r\n getElementsByTagName(name: \"br\"): NodeListOf;\r\n getElementsByTagName(name: \"button\"): NodeListOf;\r\n getElementsByTagName(name: \"canvas\"): NodeListOf;\r\n getElementsByTagName(name: \"caption\"): NodeListOf;\r\n getElementsByTagName(name: \"center\"): NodeListOf;\r\n getElementsByTagName(name: \"circle\"): NodeListOf;\r\n getElementsByTagName(name: \"cite\"): NodeListOf;\r\n getElementsByTagName(name: \"clippath\"): NodeListOf;\r\n getElementsByTagName(name: \"code\"): NodeListOf;\r\n getElementsByTagName(name: \"col\"): NodeListOf;\r\n getElementsByTagName(name: \"colgroup\"): NodeListOf;\r\n getElementsByTagName(name: \"datalist\"): NodeListOf;\r\n getElementsByTagName(name: \"dd\"): NodeListOf;\r\n getElementsByTagName(name: \"defs\"): NodeListOf;\r\n getElementsByTagName(name: \"del\"): NodeListOf;\r\n getElementsByTagName(name: \"desc\"): NodeListOf;\r\n getElementsByTagName(name: \"dfn\"): NodeListOf;\r\n getElementsByTagName(name: \"dir\"): NodeListOf;\r\n getElementsByTagName(name: \"div\"): NodeListOf;\r\n getElementsByTagName(name: \"dl\"): NodeListOf;\r\n getElementsByTagName(name: \"dt\"): NodeListOf;\r\n getElementsByTagName(name: \"ellipse\"): NodeListOf;\r\n getElementsByTagName(name: \"em\"): NodeListOf;\r\n getElementsByTagName(name: \"embed\"): NodeListOf;\r\n getElementsByTagName(name: \"feblend\"): NodeListOf;\r\n getElementsByTagName(name: \"fecolormatrix\"): NodeListOf;\r\n getElementsByTagName(name: \"fecomponenttransfer\"): NodeListOf;\r\n getElementsByTagName(name: \"fecomposite\"): NodeListOf;\r\n getElementsByTagName(name: \"feconvolvematrix\"): NodeListOf;\r\n getElementsByTagName(name: \"fediffuselighting\"): NodeListOf;\r\n getElementsByTagName(name: \"fedisplacementmap\"): NodeListOf;\r\n getElementsByTagName(name: \"fedistantlight\"): NodeListOf;\r\n getElementsByTagName(name: \"feflood\"): NodeListOf;\r\n getElementsByTagName(name: \"fefunca\"): NodeListOf;\r\n getElementsByTagName(name: \"fefuncb\"): NodeListOf;\r\n getElementsByTagName(name: \"fefuncg\"): NodeListOf;\r\n getElementsByTagName(name: \"fefuncr\"): NodeListOf;\r\n getElementsByTagName(name: \"fegaussianblur\"): NodeListOf;\r\n getElementsByTagName(name: \"feimage\"): NodeListOf;\r\n getElementsByTagName(name: \"femerge\"): NodeListOf;\r\n getElementsByTagName(name: \"femergenode\"): NodeListOf;\r\n getElementsByTagName(name: \"femorphology\"): NodeListOf;\r\n getElementsByTagName(name: \"feoffset\"): NodeListOf;\r\n getElementsByTagName(name: \"fepointlight\"): NodeListOf;\r\n getElementsByTagName(name: \"fespecularlighting\"): NodeListOf;\r\n getElementsByTagName(name: \"fespotlight\"): NodeListOf;\r\n getElementsByTagName(name: \"fetile\"): NodeListOf;\r\n getElementsByTagName(name: \"feturbulence\"): NodeListOf;\r\n getElementsByTagName(name: \"fieldset\"): NodeListOf;\r\n getElementsByTagName(name: \"figcaption\"): NodeListOf;\r\n getElementsByTagName(name: \"figure\"): NodeListOf;\r\n getElementsByTagName(name: \"filter\"): NodeListOf;\r\n getElementsByTagName(name: \"font\"): NodeListOf;\r\n getElementsByTagName(name: \"footer\"): NodeListOf;\r\n getElementsByTagName(name: \"foreignobject\"): NodeListOf;\r\n getElementsByTagName(name: \"form\"): NodeListOf;\r\n getElementsByTagName(name: \"frame\"): NodeListOf;\r\n getElementsByTagName(name: \"frameset\"): NodeListOf;\r\n getElementsByTagName(name: \"g\"): NodeListOf;\r\n getElementsByTagName(name: \"h1\"): NodeListOf;\r\n getElementsByTagName(name: \"h2\"): NodeListOf;\r\n getElementsByTagName(name: \"h3\"): NodeListOf;\r\n getElementsByTagName(name: \"h4\"): NodeListOf;\r\n getElementsByTagName(name: \"h5\"): NodeListOf;\r\n getElementsByTagName(name: \"h6\"): NodeListOf;\r\n getElementsByTagName(name: \"head\"): NodeListOf;\r\n getElementsByTagName(name: \"header\"): NodeListOf;\r\n getElementsByTagName(name: \"hgroup\"): NodeListOf;\r\n getElementsByTagName(name: \"hr\"): NodeListOf;\r\n getElementsByTagName(name: \"html\"): NodeListOf;\r\n getElementsByTagName(name: \"i\"): NodeListOf;\r\n getElementsByTagName(name: \"iframe\"): NodeListOf;\r\n getElementsByTagName(name: \"image\"): NodeListOf;\r\n getElementsByTagName(name: \"img\"): NodeListOf;\r\n getElementsByTagName(name: \"input\"): NodeListOf;\r\n getElementsByTagName(name: \"ins\"): NodeListOf;\r\n getElementsByTagName(name: \"isindex\"): NodeListOf;\r\n getElementsByTagName(name: \"kbd\"): NodeListOf;\r\n getElementsByTagName(name: \"keygen\"): NodeListOf;\r\n getElementsByTagName(name: \"label\"): NodeListOf;\r\n getElementsByTagName(name: \"legend\"): NodeListOf;\r\n getElementsByTagName(name: \"li\"): NodeListOf;\r\n getElementsByTagName(name: \"line\"): NodeListOf;\r\n getElementsByTagName(name: \"lineargradient\"): NodeListOf;\r\n getElementsByTagName(name: \"link\"): NodeListOf;\r\n getElementsByTagName(name: \"listing\"): NodeListOf;\r\n getElementsByTagName(name: \"map\"): NodeListOf;\r\n getElementsByTagName(name: \"mark\"): NodeListOf;\r\n getElementsByTagName(name: \"marker\"): NodeListOf;\r\n getElementsByTagName(name: \"marquee\"): NodeListOf;\r\n getElementsByTagName(name: \"mask\"): NodeListOf;\r\n getElementsByTagName(name: \"menu\"): NodeListOf;\r\n getElementsByTagName(name: \"meta\"): NodeListOf;\r\n getElementsByTagName(name: \"metadata\"): NodeListOf;\r\n getElementsByTagName(name: \"meter\"): NodeListOf;\r\n getElementsByTagName(name: \"nav\"): NodeListOf;\r\n getElementsByTagName(name: \"nextid\"): NodeListOf;\r\n getElementsByTagName(name: \"nobr\"): NodeListOf;\r\n getElementsByTagName(name: \"noframes\"): NodeListOf;\r\n getElementsByTagName(name: \"noscript\"): NodeListOf;\r\n getElementsByTagName(name: \"object\"): NodeListOf;\r\n getElementsByTagName(name: \"ol\"): NodeListOf;\r\n getElementsByTagName(name: \"optgroup\"): NodeListOf;\r\n getElementsByTagName(name: \"option\"): NodeListOf;\r\n getElementsByTagName(name: \"p\"): NodeListOf;\r\n getElementsByTagName(name: \"param\"): NodeListOf;\r\n getElementsByTagName(name: \"path\"): NodeListOf;\r\n getElementsByTagName(name: \"pattern\"): NodeListOf;\r\n getElementsByTagName(name: \"picture\"): NodeListOf;\r\n getElementsByTagName(name: \"plaintext\"): NodeListOf;\r\n getElementsByTagName(name: \"polygon\"): NodeListOf;\r\n getElementsByTagName(name: \"polyline\"): NodeListOf;\r\n getElementsByTagName(name: \"pre\"): NodeListOf;\r\n getElementsByTagName(name: \"progress\"): NodeListOf;\r\n getElementsByTagName(name: \"q\"): NodeListOf;\r\n getElementsByTagName(name: \"radialgradient\"): NodeListOf;\r\n getElementsByTagName(name: \"rect\"): NodeListOf;\r\n getElementsByTagName(name: \"rt\"): NodeListOf;\r\n getElementsByTagName(name: \"ruby\"): NodeListOf;\r\n getElementsByTagName(name: \"s\"): NodeListOf;\r\n getElementsByTagName(name: \"samp\"): NodeListOf;\r\n getElementsByTagName(name: \"script\"): NodeListOf;\r\n getElementsByTagName(name: \"section\"): NodeListOf;\r\n getElementsByTagName(name: \"select\"): NodeListOf;\r\n getElementsByTagName(name: \"small\"): NodeListOf;\r\n getElementsByTagName(name: \"source\"): NodeListOf;\r\n getElementsByTagName(name: \"span\"): NodeListOf;\r\n getElementsByTagName(name: \"stop\"): NodeListOf;\r\n getElementsByTagName(name: \"strike\"): NodeListOf;\r\n getElementsByTagName(name: \"strong\"): NodeListOf;\r\n getElementsByTagName(name: \"style\"): NodeListOf;\r\n getElementsByTagName(name: \"sub\"): NodeListOf;\r\n getElementsByTagName(name: \"sup\"): NodeListOf;\r\n getElementsByTagName(name: \"svg\"): NodeListOf;\r\n getElementsByTagName(name: \"switch\"): NodeListOf;\r\n getElementsByTagName(name: \"symbol\"): NodeListOf;\r\n getElementsByTagName(name: \"table\"): NodeListOf;\r\n getElementsByTagName(name: \"tbody\"): NodeListOf;\r\n getElementsByTagName(name: \"td\"): NodeListOf;\r\n getElementsByTagName(name: \"template\"): NodeListOf;\r\n getElementsByTagName(name: \"text\"): NodeListOf;\r\n getElementsByTagName(name: \"textpath\"): NodeListOf;\r\n getElementsByTagName(name: \"textarea\"): NodeListOf;\r\n getElementsByTagName(name: \"tfoot\"): NodeListOf;\r\n getElementsByTagName(name: \"th\"): NodeListOf;\r\n getElementsByTagName(name: \"thead\"): NodeListOf;\r\n getElementsByTagName(name: \"title\"): NodeListOf;\r\n getElementsByTagName(name: \"tr\"): NodeListOf;\r\n getElementsByTagName(name: \"track\"): NodeListOf;\r\n getElementsByTagName(name: \"tspan\"): NodeListOf;\r\n getElementsByTagName(name: \"tt\"): NodeListOf;\r\n getElementsByTagName(name: \"u\"): NodeListOf;\r\n getElementsByTagName(name: \"ul\"): NodeListOf;\r\n getElementsByTagName(name: \"use\"): NodeListOf;\r\n getElementsByTagName(name: \"var\"): NodeListOf;\r\n getElementsByTagName(name: \"video\"): NodeListOf;\r\n getElementsByTagName(name: \"view\"): NodeListOf;\r\n getElementsByTagName(name: \"wbr\"): NodeListOf;\r\n getElementsByTagName(name: \"x-ms-webview\"): NodeListOf;\r\n getElementsByTagName(name: \"xmp\"): NodeListOf;\r\n getElementsByTagName(name: string): NodeListOf;\r\n getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/1999/xhtml\", localName: string): HTMLCollectionOf;\r\n getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/2000/svg\", localName: string): HTMLCollectionOf;\r\n getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf;\r\n hasAttribute(name: string): boolean;\r\n hasAttributeNS(namespaceURI: string, localName: string): boolean;\r\n msGetRegionContent(): MSRangeCollection;\r\n msGetUntransformedBounds(): ClientRect;\r\n msMatchesSelector(selectors: string): boolean;\r\n msReleasePointerCapture(pointerId: number): void;\r\n msSetPointerCapture(pointerId: number): void;\r\n msZoomTo(args: MsZoomToOptions): void;\r\n releasePointerCapture(pointerId: number): void;\r\n removeAttribute(name?: string): void;\r\n removeAttributeNS(namespaceURI: string, localName: string): void;\r\n removeAttributeNode(oldAttr: Attr): Attr;\r\n requestFullscreen(): void;\r\n requestPointerLock(): void;\r\n setAttribute(name: string, value: string): void;\r\n setAttributeNS(namespaceURI: string, qualifiedName: string, value: string): void;\r\n setAttributeNode(newAttr: Attr): Attr;\r\n setAttributeNodeNS(newAttr: Attr): Attr;\r\n setPointerCapture(pointerId: number): void;\r\n webkitMatchesSelector(selectors: string): boolean;\r\n webkitRequestFullScreen(): void;\r\n webkitRequestFullscreen(): void;\r\n getElementsByClassName(classNames: string): NodeListOf;\r\n matches(selector: string): boolean;\r\n closest(selector: string): Element | null;\r\n scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;\r\n scroll(options?: ScrollToOptions): void;\r\n scroll(x: number, y: number): void;\r\n scrollTo(options?: ScrollToOptions): void;\r\n scrollTo(x: number, y: number): void;\r\n scrollBy(options?: ScrollToOptions): void;\r\n scrollBy(x: number, y: number): void;\r\n insertAdjacentElement(position: string, insertedElement: Element): Element | null;\r\n insertAdjacentHTML(where: string, html: string): void;\r\n insertAdjacentText(where: string, text: string): void;\r\n addEventListener(type: \"MSGestureChange\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureDoubleTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureEnd\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureHold\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGotPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSInertiaStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSLostPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerCancel\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerDown\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerEnter\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerLeave\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerMove\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOut\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOver\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerUp\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ariarequest\", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"command\", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"gotpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"lostpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointercancel\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerdown\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerenter\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerleave\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointermove\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerout\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerover\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerup\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchcancel\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchend\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchmove\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchstart\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenerror\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"wheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var Element: {\r\n prototype: Element;\r\n new(): Element;\r\n}\r\n\r\ninterface ErrorEvent extends Event {\r\n readonly colno: number;\r\n readonly error: any;\r\n readonly filename: string;\r\n readonly lineno: number;\r\n readonly message: string;\r\n initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void;\r\n}\r\n\r\ndeclare var ErrorEvent: {\r\n prototype: ErrorEvent;\r\n new(): ErrorEvent;\r\n}\r\n\r\ninterface Event {\r\n readonly bubbles: boolean;\r\n cancelBubble: boolean;\r\n readonly cancelable: boolean;\r\n readonly currentTarget: EventTarget;\r\n readonly defaultPrevented: boolean;\r\n readonly eventPhase: number;\r\n readonly isTrusted: boolean;\r\n returnValue: boolean;\r\n readonly srcElement: Element | null;\r\n readonly target: EventTarget;\r\n readonly timeStamp: number;\r\n readonly type: string;\r\n initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void;\r\n preventDefault(): void;\r\n stopImmediatePropagation(): void;\r\n stopPropagation(): void;\r\n readonly AT_TARGET: number;\r\n readonly BUBBLING_PHASE: number;\r\n readonly CAPTURING_PHASE: number;\r\n}\r\n\r\ndeclare var Event: {\r\n prototype: Event;\r\n new(type: string, eventInitDict?: EventInit): Event;\r\n readonly AT_TARGET: number;\r\n readonly BUBBLING_PHASE: number;\r\n readonly CAPTURING_PHASE: number;\r\n}\r\n\r\ninterface EventTarget {\r\n addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n dispatchEvent(evt: Event): boolean;\r\n removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var EventTarget: {\r\n prototype: EventTarget;\r\n new(): EventTarget;\r\n}\r\n\r\ninterface External {\r\n}\r\n\r\ndeclare var External: {\r\n prototype: External;\r\n new(): External;\r\n}\r\n\r\ninterface File extends Blob {\r\n readonly lastModifiedDate: any;\r\n readonly name: string;\r\n readonly webkitRelativePath: string;\r\n}\r\n\r\ndeclare var File: {\r\n prototype: File;\r\n new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File;\r\n}\r\n\r\ninterface FileList {\r\n readonly length: number;\r\n item(index: number): File;\r\n [index: number]: File;\r\n}\r\n\r\ndeclare var FileList: {\r\n prototype: FileList;\r\n new(): FileList;\r\n}\r\n\r\ninterface FileReader extends EventTarget, MSBaseReader {\r\n readonly error: DOMError;\r\n readAsArrayBuffer(blob: Blob): void;\r\n readAsBinaryString(blob: Blob): void;\r\n readAsDataURL(blob: Blob): void;\r\n readAsText(blob: Blob, encoding?: string): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var FileReader: {\r\n prototype: FileReader;\r\n new(): FileReader;\r\n}\r\n\r\ninterface FocusEvent extends UIEvent {\r\n readonly relatedTarget: EventTarget;\r\n initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void;\r\n}\r\n\r\ndeclare var FocusEvent: {\r\n prototype: FocusEvent;\r\n new(typeArg: string, eventInitDict?: FocusEventInit): FocusEvent;\r\n}\r\n\r\ninterface FormData {\r\n append(name: any, value: any, blobName?: string): void;\r\n}\r\n\r\ndeclare var FormData: {\r\n prototype: FormData;\r\n new (form?: HTMLFormElement): FormData;\r\n}\r\n\r\ninterface GainNode extends AudioNode {\r\n readonly gain: AudioParam;\r\n}\r\n\r\ndeclare var GainNode: {\r\n prototype: GainNode;\r\n new(): GainNode;\r\n}\r\n\r\ninterface Gamepad {\r\n readonly axes: number[];\r\n readonly buttons: GamepadButton[];\r\n readonly connected: boolean;\r\n readonly id: string;\r\n readonly index: number;\r\n readonly mapping: string;\r\n readonly timestamp: number;\r\n}\r\n\r\ndeclare var Gamepad: {\r\n prototype: Gamepad;\r\n new(): Gamepad;\r\n}\r\n\r\ninterface GamepadButton {\r\n readonly pressed: boolean;\r\n readonly value: number;\r\n}\r\n\r\ndeclare var GamepadButton: {\r\n prototype: GamepadButton;\r\n new(): GamepadButton;\r\n}\r\n\r\ninterface GamepadEvent extends Event {\r\n readonly gamepad: Gamepad;\r\n}\r\n\r\ndeclare var GamepadEvent: {\r\n prototype: GamepadEvent;\r\n new(): GamepadEvent;\r\n}\r\n\r\ninterface Geolocation {\r\n clearWatch(watchId: number): void;\r\n getCurrentPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): void;\r\n watchPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): number;\r\n}\r\n\r\ndeclare var Geolocation: {\r\n prototype: Geolocation;\r\n new(): Geolocation;\r\n}\r\n\r\ninterface HTMLAllCollection extends HTMLCollection {\r\n namedItem(name: string): Element;\r\n}\r\n\r\ndeclare var HTMLAllCollection: {\r\n prototype: HTMLAllCollection;\r\n new(): HTMLAllCollection;\r\n}\r\n\r\ninterface HTMLAnchorElement extends HTMLElement {\r\n Methods: string;\r\n /**\r\n * Sets or retrieves the character set used to encode the object.\r\n */\r\n charset: string;\r\n /**\r\n * Sets or retrieves the coordinates of the object.\r\n */\r\n coords: string;\r\n download: string;\r\n /**\r\n * Contains the anchor portion of the URL including the hash sign (#).\r\n */\r\n hash: string;\r\n /**\r\n * Contains the hostname and port values of the URL.\r\n */\r\n host: string;\r\n /**\r\n * Contains the hostname of a URL.\r\n */\r\n hostname: string;\r\n /**\r\n * Sets or retrieves a destination URL or an anchor point.\r\n */\r\n href: string;\r\n /**\r\n * Sets or retrieves the language code of the object.\r\n */\r\n hreflang: string;\r\n readonly mimeType: string;\r\n /**\r\n * Sets or retrieves the shape of the object.\r\n */\r\n name: string;\r\n readonly nameProp: string;\r\n /**\r\n * Contains the pathname of the URL.\r\n */\r\n pathname: string;\r\n /**\r\n * Sets or retrieves the port number associated with a URL.\r\n */\r\n port: string;\r\n /**\r\n * Contains the protocol of the URL.\r\n */\r\n protocol: string;\r\n readonly protocolLong: string;\r\n /**\r\n * Sets or retrieves the relationship between the object and the destination of the link.\r\n */\r\n rel: string;\r\n /**\r\n * Sets or retrieves the relationship between the object and the destination of the link.\r\n */\r\n rev: string;\r\n /**\r\n * Sets or retrieves the substring of the href property that follows the question mark.\r\n */\r\n search: string;\r\n /**\r\n * Sets or retrieves the shape of the object.\r\n */\r\n shape: string;\r\n /**\r\n * Sets or retrieves the window or frame at which to target content.\r\n */\r\n target: string;\r\n /**\r\n * Retrieves or sets the text of the object as a string. \r\n */\r\n text: string;\r\n type: string;\r\n urn: string;\r\n /** \r\n * Returns a string representation of an object.\r\n */\r\n toString(): string;\r\n}\r\n\r\ndeclare var HTMLAnchorElement: {\r\n prototype: HTMLAnchorElement;\r\n new(): HTMLAnchorElement;\r\n}\r\n\r\ninterface HTMLAppletElement extends HTMLElement {\r\n /**\r\n * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element.\r\n */\r\n readonly BaseHref: string;\r\n align: string;\r\n /**\r\n * Sets or retrieves a text alternative to the graphic.\r\n */\r\n alt: string;\r\n /**\r\n * Gets or sets the optional alternative HTML script to execute if the object fails to load.\r\n */\r\n altHtml: string;\r\n /**\r\n * Sets or retrieves a character string that can be used to implement your own archive functionality for the object.\r\n */\r\n archive: string;\r\n border: string;\r\n code: string;\r\n /**\r\n * Sets or retrieves the URL of the component.\r\n */\r\n codeBase: string;\r\n /**\r\n * Sets or retrieves the Internet media type for the code associated with the object.\r\n */\r\n codeType: string;\r\n /**\r\n * Address of a pointer to the document this page or frame contains. If there is no document, then null will be returned.\r\n */\r\n readonly contentDocument: Document;\r\n /**\r\n * Sets or retrieves the URL that references the data of the object.\r\n */\r\n data: string;\r\n /**\r\n * Sets or retrieves a character string that can be used to implement your own declare functionality for the object.\r\n */\r\n declare: boolean;\r\n readonly form: HTMLFormElement;\r\n /**\r\n * Sets or retrieves the height of the object.\r\n */\r\n height: string;\r\n hspace: number;\r\n /**\r\n * Sets or retrieves the shape of the object.\r\n */\r\n name: string;\r\n object: string | null;\r\n /**\r\n * Sets or retrieves a message to be displayed while an object is loading.\r\n */\r\n standby: string;\r\n /**\r\n * Returns the content type of the object.\r\n */\r\n type: string;\r\n /**\r\n * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map.\r\n */\r\n useMap: string;\r\n vspace: number;\r\n width: number;\r\n}\r\n\r\ndeclare var HTMLAppletElement: {\r\n prototype: HTMLAppletElement;\r\n new(): HTMLAppletElement;\r\n}\r\n\r\ninterface HTMLAreaElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves a text alternative to the graphic.\r\n */\r\n alt: string;\r\n /**\r\n * Sets or retrieves the coordinates of the object.\r\n */\r\n coords: string;\r\n download: string;\r\n /**\r\n * Sets or retrieves the subsection of the href property that follows the number sign (#).\r\n */\r\n hash: string;\r\n /**\r\n * Sets or retrieves the hostname and port number of the location or URL.\r\n */\r\n host: string;\r\n /**\r\n * Sets or retrieves the host name part of the location or URL. \r\n */\r\n hostname: string;\r\n /**\r\n * Sets or retrieves a destination URL or an anchor point.\r\n */\r\n href: string;\r\n /**\r\n * Sets or gets whether clicks in this region cause action.\r\n */\r\n noHref: boolean;\r\n /**\r\n * Sets or retrieves the file name or path specified by the object.\r\n */\r\n pathname: string;\r\n /**\r\n * Sets or retrieves the port number associated with a URL.\r\n */\r\n port: string;\r\n /**\r\n * Sets or retrieves the protocol portion of a URL.\r\n */\r\n protocol: string;\r\n rel: string;\r\n /**\r\n * Sets or retrieves the substring of the href property that follows the question mark.\r\n */\r\n search: string;\r\n /**\r\n * Sets or retrieves the shape of the object.\r\n */\r\n shape: string;\r\n /**\r\n * Sets or retrieves the window or frame at which to target content.\r\n */\r\n target: string;\r\n /** \r\n * Returns a string representation of an object.\r\n */\r\n toString(): string;\r\n}\r\n\r\ndeclare var HTMLAreaElement: {\r\n prototype: HTMLAreaElement;\r\n new(): HTMLAreaElement;\r\n}\r\n\r\ninterface HTMLAreasCollection extends HTMLCollection {\r\n /**\r\n * Adds an element to the areas, controlRange, or options collection.\r\n */\r\n add(element: HTMLElement, before?: HTMLElement | number): void;\r\n /**\r\n * Removes an element from the collection.\r\n */\r\n remove(index?: number): void;\r\n}\r\n\r\ndeclare var HTMLAreasCollection: {\r\n prototype: HTMLAreasCollection;\r\n new(): HTMLAreasCollection;\r\n}\r\n\r\ninterface HTMLAudioElement extends HTMLMediaElement {\r\n}\r\n\r\ndeclare var HTMLAudioElement: {\r\n prototype: HTMLAudioElement;\r\n new(): HTMLAudioElement;\r\n}\r\n\r\ninterface HTMLBRElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document.\r\n */\r\n clear: string;\r\n}\r\n\r\ndeclare var HTMLBRElement: {\r\n prototype: HTMLBRElement;\r\n new(): HTMLBRElement;\r\n}\r\n\r\ninterface HTMLBaseElement extends HTMLElement {\r\n /**\r\n * Gets or sets the baseline URL on which relative links are based.\r\n */\r\n href: string;\r\n /**\r\n * Sets or retrieves the window or frame at which to target content.\r\n */\r\n target: string;\r\n}\r\n\r\ndeclare var HTMLBaseElement: {\r\n prototype: HTMLBaseElement;\r\n new(): HTMLBaseElement;\r\n}\r\n\r\ninterface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedColorProperty {\r\n /**\r\n * Sets or retrieves the current typeface family.\r\n */\r\n face: string;\r\n /**\r\n * Sets or retrieves the font size of the object.\r\n */\r\n size: number;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLBaseFontElement: {\r\n prototype: HTMLBaseFontElement;\r\n new(): HTMLBaseFontElement;\r\n}\r\n\r\ninterface HTMLBodyElement extends HTMLElement {\r\n aLink: any;\r\n background: string;\r\n bgColor: any;\r\n bgProperties: string;\r\n link: any;\r\n noWrap: boolean;\r\n onafterprint: (this: this, ev: Event) => any;\r\n onbeforeprint: (this: this, ev: Event) => any;\r\n onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any;\r\n onblur: (this: this, ev: FocusEvent) => any;\r\n onerror: (this: this, ev: ErrorEvent) => any;\r\n onfocus: (this: this, ev: FocusEvent) => any;\r\n onhashchange: (this: this, ev: HashChangeEvent) => any;\r\n onload: (this: this, ev: Event) => any;\r\n onmessage: (this: this, ev: MessageEvent) => any;\r\n onoffline: (this: this, ev: Event) => any;\r\n ononline: (this: this, ev: Event) => any;\r\n onorientationchange: (this: this, ev: Event) => any;\r\n onpagehide: (this: this, ev: PageTransitionEvent) => any;\r\n onpageshow: (this: this, ev: PageTransitionEvent) => any;\r\n onpopstate: (this: this, ev: PopStateEvent) => any;\r\n onresize: (this: this, ev: UIEvent) => any;\r\n onstorage: (this: this, ev: StorageEvent) => any;\r\n onunload: (this: this, ev: Event) => any;\r\n text: any;\r\n vLink: any;\r\n addEventListener(type: \"MSContentZoom\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureChange\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureDoubleTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureEnd\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureHold\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGotPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSInertiaStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSLostPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSManipulationStateChanged\", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerCancel\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerDown\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerEnter\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerLeave\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerMove\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOut\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOver\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerUp\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"abort\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"activate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"afterprint\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ariarequest\", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforecopy\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforecut\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforedeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforepaste\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforeprint\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforeunload\", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"blur\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"blur\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplay\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplaythrough\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"change\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"click\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"command\", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"contextmenu\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"copy\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"cuechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"cut\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dblclick\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"deactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drag\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragend\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragenter\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragleave\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragover\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragstart\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drop\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"durationchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"emptied\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ended\", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"focus\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"focus\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"gotpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"hashchange\", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"input\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"invalid\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keydown\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keypress\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keyup\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadeddata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadedmetadata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"lostpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"message\", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousedown\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseenter\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseleave\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousemove\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseout\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseover\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseup\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousewheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"offline\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"online\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"orientationchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pagehide\", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pageshow\", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"paste\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pause\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"play\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"playing\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointercancel\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerdown\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerenter\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerleave\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointermove\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerout\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerover\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerup\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"popstate\", listener: (this: this, ev: PopStateEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"progress\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ratechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"reset\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"resize\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"scroll\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeked\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeking\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"select\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"selectstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"stalled\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"storage\", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"submit\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"suspend\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"timeupdate\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchcancel\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchend\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchmove\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchstart\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"unload\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"volumechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"waiting\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenerror\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"wheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLBodyElement: {\r\n prototype: HTMLBodyElement;\r\n new(): HTMLBodyElement;\r\n}\r\n\r\ninterface HTMLButtonElement extends HTMLElement {\r\n /**\r\n * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing.\r\n */\r\n autofocus: boolean;\r\n disabled: boolean;\r\n /**\r\n * Retrieves a reference to the form that the object is embedded in.\r\n */\r\n readonly form: HTMLFormElement;\r\n /**\r\n * Overrides the action attribute (where the data on a form is sent) on the parent form element.\r\n */\r\n formAction: string;\r\n /**\r\n * Used to override the encoding (formEnctype attribute) specified on the form element.\r\n */\r\n formEnctype: string;\r\n /**\r\n * Overrides the submit method attribute previously specified on a form element.\r\n */\r\n formMethod: string;\r\n /**\r\n * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a \"save draft\"-type submit option.\r\n */\r\n formNoValidate: string;\r\n /**\r\n * Overrides the target attribute on a form element.\r\n */\r\n formTarget: string;\r\n /** \r\n * Sets or retrieves the name of the object.\r\n */\r\n name: string;\r\n status: any;\r\n /**\r\n * Gets the classification and default behavior of the button.\r\n */\r\n type: string;\r\n /**\r\n * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\r\n */\r\n readonly validationMessage: string;\r\n /**\r\n * Returns a ValidityState object that represents the validity states of an element.\r\n */\r\n readonly validity: ValidityState;\r\n /** \r\n * Sets or retrieves the default or selected value of the control.\r\n */\r\n value: string;\r\n /**\r\n * Returns whether an element will successfully validate based on forms validation rules and constraints.\r\n */\r\n readonly willValidate: boolean;\r\n /**\r\n * Returns whether a form will validate when it is submitted, without having to submit it.\r\n */\r\n checkValidity(): boolean;\r\n /**\r\n * Sets a custom error message that is displayed when a form is submitted.\r\n * @param error Sets a custom error message that is displayed when a form is submitted.\r\n */\r\n setCustomValidity(error: string): void;\r\n}\r\n\r\ndeclare var HTMLButtonElement: {\r\n prototype: HTMLButtonElement;\r\n new(): HTMLButtonElement;\r\n}\r\n\r\ninterface HTMLCanvasElement extends HTMLElement {\r\n /**\r\n * Gets or sets the height of a canvas element on a document.\r\n */\r\n height: number;\r\n /**\r\n * Gets or sets the width of a canvas element on a document.\r\n */\r\n width: number;\r\n /**\r\n * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas.\r\n * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext(\"2d\"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext(\"experimental-webgl\");\r\n */\r\n getContext(contextId: \"2d\", contextAttributes?: Canvas2DContextAttributes): CanvasRenderingContext2D | null;\r\n getContext(contextId: \"webgl\" | \"experimental-webgl\", contextAttributes?: WebGLContextAttributes): WebGLRenderingContext | null;\r\n getContext(contextId: string, contextAttributes?: {}): CanvasRenderingContext2D | WebGLRenderingContext | null;\r\n /**\r\n * Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing.\r\n */\r\n msToBlob(): Blob;\r\n /**\r\n * Returns the content of the current canvas as an image that you can use as a source for another canvas or an HTML element.\r\n * @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image.\r\n */\r\n toDataURL(type?: string, ...args: any[]): string;\r\n toBlob(callback: (result: Blob | null) => void, type?: string, ...arguments: any[]): void;\r\n}\r\n\r\ndeclare var HTMLCanvasElement: {\r\n prototype: HTMLCanvasElement;\r\n new(): HTMLCanvasElement;\r\n}\r\n\r\ninterface HTMLCollection {\r\n /**\r\n * Sets or retrieves the number of objects in a collection.\r\n */\r\n readonly length: number;\r\n /**\r\n * Retrieves an object from various collections.\r\n */\r\n item(index: number): Element;\r\n /**\r\n * Retrieves a select object or an object from an options collection.\r\n */\r\n namedItem(name: string): Element;\r\n [index: number]: Element;\r\n}\r\n\r\ndeclare var HTMLCollection: {\r\n prototype: HTMLCollection;\r\n new(): HTMLCollection;\r\n}\r\n\r\ninterface HTMLDListElement extends HTMLElement {\r\n compact: boolean;\r\n}\r\n\r\ndeclare var HTMLDListElement: {\r\n prototype: HTMLDListElement;\r\n new(): HTMLDListElement;\r\n}\r\n\r\ninterface HTMLDataListElement extends HTMLElement {\r\n options: HTMLCollectionOf;\r\n}\r\n\r\ndeclare var HTMLDataListElement: {\r\n prototype: HTMLDataListElement;\r\n new(): HTMLDataListElement;\r\n}\r\n\r\ninterface HTMLDirectoryElement extends HTMLElement {\r\n compact: boolean;\r\n}\r\n\r\ndeclare var HTMLDirectoryElement: {\r\n prototype: HTMLDirectoryElement;\r\n new(): HTMLDirectoryElement;\r\n}\r\n\r\ninterface HTMLDivElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves how the object is aligned with adjacent text. \r\n */\r\n align: string;\r\n /**\r\n * Sets or retrieves whether the browser automatically performs wordwrap.\r\n */\r\n noWrap: boolean;\r\n}\r\n\r\ndeclare var HTMLDivElement: {\r\n prototype: HTMLDivElement;\r\n new(): HTMLDivElement;\r\n}\r\n\r\ninterface HTMLDocument extends Document {\r\n}\r\n\r\ndeclare var HTMLDocument: {\r\n prototype: HTMLDocument;\r\n new(): HTMLDocument;\r\n}\r\n\r\ninterface HTMLElement extends Element {\r\n accessKey: string;\r\n readonly children: HTMLCollection;\r\n contentEditable: string;\r\n readonly dataset: DOMStringMap;\r\n dir: string;\r\n draggable: boolean;\r\n hidden: boolean;\r\n hideFocus: boolean;\r\n innerHTML: string;\r\n innerText: string;\r\n readonly isContentEditable: boolean;\r\n lang: string;\r\n readonly offsetHeight: number;\r\n readonly offsetLeft: number;\r\n readonly offsetParent: Element;\r\n readonly offsetTop: number;\r\n readonly offsetWidth: number;\r\n onabort: (this: this, ev: UIEvent) => any;\r\n onactivate: (this: this, ev: UIEvent) => any;\r\n onbeforeactivate: (this: this, ev: UIEvent) => any;\r\n onbeforecopy: (this: this, ev: ClipboardEvent) => any;\r\n onbeforecut: (this: this, ev: ClipboardEvent) => any;\r\n onbeforedeactivate: (this: this, ev: UIEvent) => any;\r\n onbeforepaste: (this: this, ev: ClipboardEvent) => any;\r\n onblur: (this: this, ev: FocusEvent) => any;\r\n oncanplay: (this: this, ev: Event) => any;\r\n oncanplaythrough: (this: this, ev: Event) => any;\r\n onchange: (this: this, ev: Event) => any;\r\n onclick: (this: this, ev: MouseEvent) => any;\r\n oncontextmenu: (this: this, ev: PointerEvent) => any;\r\n oncopy: (this: this, ev: ClipboardEvent) => any;\r\n oncuechange: (this: this, ev: Event) => any;\r\n oncut: (this: this, ev: ClipboardEvent) => any;\r\n ondblclick: (this: this, ev: MouseEvent) => any;\r\n ondeactivate: (this: this, ev: UIEvent) => any;\r\n ondrag: (this: this, ev: DragEvent) => any;\r\n ondragend: (this: this, ev: DragEvent) => any;\r\n ondragenter: (this: this, ev: DragEvent) => any;\r\n ondragleave: (this: this, ev: DragEvent) => any;\r\n ondragover: (this: this, ev: DragEvent) => any;\r\n ondragstart: (this: this, ev: DragEvent) => any;\r\n ondrop: (this: this, ev: DragEvent) => any;\r\n ondurationchange: (this: this, ev: Event) => any;\r\n onemptied: (this: this, ev: Event) => any;\r\n onended: (this: this, ev: MediaStreamErrorEvent) => any;\r\n onerror: (this: this, ev: ErrorEvent) => any;\r\n onfocus: (this: this, ev: FocusEvent) => any;\r\n oninput: (this: this, ev: Event) => any;\r\n oninvalid: (this: this, ev: Event) => any;\r\n onkeydown: (this: this, ev: KeyboardEvent) => any;\r\n onkeypress: (this: this, ev: KeyboardEvent) => any;\r\n onkeyup: (this: this, ev: KeyboardEvent) => any;\r\n onload: (this: this, ev: Event) => any;\r\n onloadeddata: (this: this, ev: Event) => any;\r\n onloadedmetadata: (this: this, ev: Event) => any;\r\n onloadstart: (this: this, ev: Event) => any;\r\n onmousedown: (this: this, ev: MouseEvent) => any;\r\n onmouseenter: (this: this, ev: MouseEvent) => any;\r\n onmouseleave: (this: this, ev: MouseEvent) => any;\r\n onmousemove: (this: this, ev: MouseEvent) => any;\r\n onmouseout: (this: this, ev: MouseEvent) => any;\r\n onmouseover: (this: this, ev: MouseEvent) => any;\r\n onmouseup: (this: this, ev: MouseEvent) => any;\r\n onmousewheel: (this: this, ev: WheelEvent) => any;\r\n onmscontentzoom: (this: this, ev: UIEvent) => any;\r\n onmsmanipulationstatechanged: (this: this, ev: MSManipulationEvent) => any;\r\n onpaste: (this: this, ev: ClipboardEvent) => any;\r\n onpause: (this: this, ev: Event) => any;\r\n onplay: (this: this, ev: Event) => any;\r\n onplaying: (this: this, ev: Event) => any;\r\n onprogress: (this: this, ev: ProgressEvent) => any;\r\n onratechange: (this: this, ev: Event) => any;\r\n onreset: (this: this, ev: Event) => any;\r\n onscroll: (this: this, ev: UIEvent) => any;\r\n onseeked: (this: this, ev: Event) => any;\r\n onseeking: (this: this, ev: Event) => any;\r\n onselect: (this: this, ev: UIEvent) => any;\r\n onselectstart: (this: this, ev: Event) => any;\r\n onstalled: (this: this, ev: Event) => any;\r\n onsubmit: (this: this, ev: Event) => any;\r\n onsuspend: (this: this, ev: Event) => any;\r\n ontimeupdate: (this: this, ev: Event) => any;\r\n onvolumechange: (this: this, ev: Event) => any;\r\n onwaiting: (this: this, ev: Event) => any;\r\n outerHTML: string;\r\n outerText: string;\r\n spellcheck: boolean;\r\n readonly style: CSSStyleDeclaration;\r\n tabIndex: number;\r\n title: string;\r\n blur(): void;\r\n click(): void;\r\n dragDrop(): boolean;\r\n focus(): void;\r\n msGetInputContext(): MSInputMethodContext;\r\n setActive(): void;\r\n addEventListener(type: \"MSContentZoom\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureChange\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureDoubleTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureEnd\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureHold\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGotPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSInertiaStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSLostPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSManipulationStateChanged\", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerCancel\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerDown\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerEnter\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerLeave\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerMove\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOut\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOver\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerUp\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"abort\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"activate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ariarequest\", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforecopy\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforecut\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforedeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforepaste\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"blur\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplay\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplaythrough\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"change\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"click\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"command\", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"contextmenu\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"copy\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"cuechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"cut\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dblclick\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"deactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drag\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragend\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragenter\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragleave\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragover\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragstart\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drop\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"durationchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"emptied\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ended\", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"focus\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"gotpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"input\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"invalid\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keydown\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keypress\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keyup\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadeddata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadedmetadata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"lostpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousedown\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseenter\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseleave\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousemove\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseout\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseover\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseup\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousewheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"paste\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pause\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"play\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"playing\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointercancel\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerdown\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerenter\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerleave\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointermove\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerout\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerover\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerup\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"progress\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ratechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"reset\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"scroll\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeked\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeking\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"select\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"selectstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"stalled\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"submit\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"suspend\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"timeupdate\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchcancel\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchend\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchmove\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchstart\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"volumechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"waiting\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenerror\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"wheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLElement: {\r\n prototype: HTMLElement;\r\n new(): HTMLElement;\r\n}\r\n\r\ninterface HTMLEmbedElement extends HTMLElement, GetSVGDocument {\r\n /**\r\n * Sets or retrieves the height of the object.\r\n */\r\n height: string;\r\n hidden: any;\r\n /**\r\n * Gets or sets whether the DLNA PlayTo device is available.\r\n */\r\n msPlayToDisabled: boolean;\r\n /**\r\n * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server.\r\n */\r\n msPlayToPreferredSourceUri: string;\r\n /**\r\n * Gets or sets the primary DLNA PlayTo device.\r\n */\r\n msPlayToPrimary: boolean;\r\n /**\r\n * Gets the source associated with the media element for use by the PlayToManager.\r\n */\r\n readonly msPlayToSource: any;\r\n /**\r\n * Sets or retrieves the name of the object.\r\n */\r\n name: string;\r\n /**\r\n * Retrieves the palette used for the embedded document.\r\n */\r\n readonly palette: string;\r\n /**\r\n * Retrieves the URL of the plug-in used to view an embedded document.\r\n */\r\n readonly pluginspage: string;\r\n readonly readyState: string;\r\n /**\r\n * Sets or retrieves a URL to be loaded by the object.\r\n */\r\n src: string;\r\n /**\r\n * Sets or retrieves the height and width units of the embed object.\r\n */\r\n units: string;\r\n /**\r\n * Sets or retrieves the width of the object.\r\n */\r\n width: string;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLEmbedElement: {\r\n prototype: HTMLEmbedElement;\r\n new(): HTMLEmbedElement;\r\n}\r\n\r\ninterface HTMLFieldSetElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves how the object is aligned with adjacent text.\r\n */\r\n align: string;\r\n disabled: boolean;\r\n /**\r\n * Retrieves a reference to the form that the object is embedded in.\r\n */\r\n readonly form: HTMLFormElement;\r\n /**\r\n * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\r\n */\r\n readonly validationMessage: string;\r\n /**\r\n * Returns a ValidityState object that represents the validity states of an element.\r\n */\r\n readonly validity: ValidityState;\r\n /**\r\n * Returns whether an element will successfully validate based on forms validation rules and constraints.\r\n */\r\n readonly willValidate: boolean;\r\n /**\r\n * Returns whether a form will validate when it is submitted, without having to submit it.\r\n */\r\n checkValidity(): boolean;\r\n /**\r\n * Sets a custom error message that is displayed when a form is submitted.\r\n * @param error Sets a custom error message that is displayed when a form is submitted.\r\n */\r\n setCustomValidity(error: string): void;\r\n}\r\n\r\ndeclare var HTMLFieldSetElement: {\r\n prototype: HTMLFieldSetElement;\r\n new(): HTMLFieldSetElement;\r\n}\r\n\r\ninterface HTMLFontElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty {\r\n /**\r\n * Sets or retrieves the current typeface family.\r\n */\r\n face: string;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLFontElement: {\r\n prototype: HTMLFontElement;\r\n new(): HTMLFontElement;\r\n}\r\n\r\ninterface HTMLFormElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves a list of character encodings for input data that must be accepted by the server processing the form.\r\n */\r\n acceptCharset: string;\r\n /**\r\n * Sets or retrieves the URL to which the form content is sent for processing.\r\n */\r\n action: string;\r\n /**\r\n * Specifies whether autocomplete is applied to an editable text field.\r\n */\r\n autocomplete: string;\r\n /**\r\n * Retrieves a collection, in source order, of all controls in a given form.\r\n */\r\n readonly elements: HTMLCollection;\r\n /**\r\n * Sets or retrieves the MIME encoding for the form.\r\n */\r\n encoding: string;\r\n /**\r\n * Sets or retrieves the encoding type for the form.\r\n */\r\n enctype: string;\r\n /**\r\n * Sets or retrieves the number of objects in a collection.\r\n */\r\n readonly length: number;\r\n /**\r\n * Sets or retrieves how to send the form data to the server.\r\n */\r\n method: string;\r\n /**\r\n * Sets or retrieves the name of the object.\r\n */\r\n name: string;\r\n /**\r\n * Designates a form that is not validated when submitted.\r\n */\r\n noValidate: boolean;\r\n /**\r\n * Sets or retrieves the window or frame at which to target content.\r\n */\r\n target: string;\r\n /**\r\n * Returns whether a form will validate when it is submitted, without having to submit it.\r\n */\r\n checkValidity(): boolean;\r\n /**\r\n * Retrieves a form object or an object from an elements collection.\r\n * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is a Number, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made.\r\n * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned.\r\n */\r\n item(name?: any, index?: any): any;\r\n /**\r\n * Retrieves a form object or an object from an elements collection.\r\n */\r\n namedItem(name: string): any;\r\n /**\r\n * Fires when the user resets a form.\r\n */\r\n reset(): void;\r\n /**\r\n * Fires when a FORM is about to be submitted.\r\n */\r\n submit(): void;\r\n [name: string]: any;\r\n}\r\n\r\ndeclare var HTMLFormElement: {\r\n prototype: HTMLFormElement;\r\n new(): HTMLFormElement;\r\n}\r\n\r\ninterface HTMLFrameElement extends HTMLElement, GetSVGDocument {\r\n /**\r\n * Specifies the properties of a border drawn around an object.\r\n */\r\n border: string;\r\n /**\r\n * Sets or retrieves the border color of the object.\r\n */\r\n borderColor: any;\r\n /**\r\n * Retrieves the document object of the page or frame.\r\n */\r\n readonly contentDocument: Document;\r\n /**\r\n * Retrieves the object of the specified.\r\n */\r\n readonly contentWindow: Window;\r\n /**\r\n * Sets or retrieves whether to display a border for the frame.\r\n */\r\n frameBorder: string;\r\n /**\r\n * Sets or retrieves the amount of additional space between the frames.\r\n */\r\n frameSpacing: any;\r\n /**\r\n * Sets or retrieves the height of the object.\r\n */\r\n height: string | number;\r\n /**\r\n * Sets or retrieves a URI to a long description of the object.\r\n */\r\n longDesc: string;\r\n /**\r\n * Sets or retrieves the top and bottom margin heights before displaying the text in a frame.\r\n */\r\n marginHeight: string;\r\n /**\r\n * Sets or retrieves the left and right margin widths before displaying the text in a frame.\r\n */\r\n marginWidth: string;\r\n /**\r\n * Sets or retrieves the frame name.\r\n */\r\n name: string;\r\n /**\r\n * Sets or retrieves whether the user can resize the frame.\r\n */\r\n noResize: boolean;\r\n /**\r\n * Raised when the object has been completely received from the server.\r\n */\r\n onload: (this: this, ev: Event) => any;\r\n /**\r\n * Sets or retrieves whether the frame can be scrolled.\r\n */\r\n scrolling: string;\r\n /**\r\n * Sets or retrieves a URL to be loaded by the object.\r\n */\r\n src: string;\r\n /**\r\n * Sets or retrieves the width of the object.\r\n */\r\n width: string | number;\r\n addEventListener(type: \"MSContentZoom\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureChange\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureDoubleTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureEnd\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureHold\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGotPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSInertiaStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSLostPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSManipulationStateChanged\", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerCancel\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerDown\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerEnter\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerLeave\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerMove\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOut\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOver\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerUp\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"abort\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"activate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ariarequest\", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforecopy\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforecut\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforedeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforepaste\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"blur\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplay\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplaythrough\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"change\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"click\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"command\", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"contextmenu\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"copy\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"cuechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"cut\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dblclick\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"deactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drag\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragend\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragenter\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragleave\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragover\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragstart\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drop\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"durationchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"emptied\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ended\", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"focus\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"gotpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"input\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"invalid\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keydown\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keypress\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keyup\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadeddata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadedmetadata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"lostpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousedown\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseenter\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseleave\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousemove\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseout\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseover\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseup\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousewheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"paste\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pause\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"play\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"playing\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointercancel\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerdown\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerenter\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerleave\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointermove\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerout\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerover\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerup\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"progress\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ratechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"reset\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"scroll\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeked\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeking\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"select\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"selectstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"stalled\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"submit\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"suspend\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"timeupdate\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchcancel\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchend\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchmove\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchstart\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"volumechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"waiting\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenerror\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"wheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLFrameElement: {\r\n prototype: HTMLFrameElement;\r\n new(): HTMLFrameElement;\r\n}\r\n\r\ninterface HTMLFrameSetElement extends HTMLElement {\r\n border: string;\r\n /**\r\n * Sets or retrieves the border color of the object.\r\n */\r\n borderColor: any;\r\n /**\r\n * Sets or retrieves the frame widths of the object.\r\n */\r\n cols: string;\r\n /**\r\n * Sets or retrieves whether to display a border for the frame.\r\n */\r\n frameBorder: string;\r\n /**\r\n * Sets or retrieves the amount of additional space between the frames.\r\n */\r\n frameSpacing: any;\r\n name: string;\r\n onafterprint: (this: this, ev: Event) => any;\r\n onbeforeprint: (this: this, ev: Event) => any;\r\n onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any;\r\n /**\r\n * Fires when the object loses the input focus.\r\n */\r\n onblur: (this: this, ev: FocusEvent) => any;\r\n onerror: (this: this, ev: ErrorEvent) => any;\r\n /**\r\n * Fires when the object receives focus.\r\n */\r\n onfocus: (this: this, ev: FocusEvent) => any;\r\n onhashchange: (this: this, ev: HashChangeEvent) => any;\r\n onload: (this: this, ev: Event) => any;\r\n onmessage: (this: this, ev: MessageEvent) => any;\r\n onoffline: (this: this, ev: Event) => any;\r\n ononline: (this: this, ev: Event) => any;\r\n onorientationchange: (this: this, ev: Event) => any;\r\n onpagehide: (this: this, ev: PageTransitionEvent) => any;\r\n onpageshow: (this: this, ev: PageTransitionEvent) => any;\r\n onresize: (this: this, ev: UIEvent) => any;\r\n onstorage: (this: this, ev: StorageEvent) => any;\r\n onunload: (this: this, ev: Event) => any;\r\n /**\r\n * Sets or retrieves the frame heights of the object.\r\n */\r\n rows: string;\r\n addEventListener(type: \"MSContentZoom\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureChange\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureDoubleTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureEnd\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureHold\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGotPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSInertiaStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSLostPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSManipulationStateChanged\", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerCancel\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerDown\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerEnter\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerLeave\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerMove\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOut\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOver\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerUp\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"abort\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"activate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ariarequest\", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforecopy\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforecut\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforedeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforepaste\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforeprint\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforeunload\", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"blur\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"blur\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplay\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplaythrough\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"change\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"click\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"command\", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"contextmenu\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"copy\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"cuechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"cut\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dblclick\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"deactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drag\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragend\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragenter\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragleave\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragover\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragstart\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drop\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"durationchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"emptied\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ended\", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"focus\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"focus\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"gotpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"hashchange\", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"input\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"invalid\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keydown\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keypress\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keyup\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadeddata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadedmetadata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"lostpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"message\", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousedown\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseenter\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseleave\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousemove\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseout\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseover\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseup\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousewheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"offline\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"online\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"orientationchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pagehide\", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pageshow\", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"paste\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pause\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"play\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"playing\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointercancel\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerdown\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerenter\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerleave\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointermove\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerout\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerover\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerup\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"progress\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ratechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"reset\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"resize\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"scroll\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeked\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeking\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"select\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"selectstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"stalled\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"storage\", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"submit\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"suspend\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"timeupdate\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchcancel\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchend\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchmove\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchstart\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"unload\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"volumechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"waiting\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenerror\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"wheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLFrameSetElement: {\r\n prototype: HTMLFrameSetElement;\r\n new(): HTMLFrameSetElement;\r\n}\r\n\r\ninterface HTMLHRElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty {\r\n /**\r\n * Sets or retrieves how the object is aligned with adjacent text.\r\n */\r\n align: string;\r\n /**\r\n * Sets or retrieves whether the horizontal rule is drawn with 3-D shading.\r\n */\r\n noShade: boolean;\r\n /**\r\n * Sets or retrieves the width of the object.\r\n */\r\n width: number;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLHRElement: {\r\n prototype: HTMLHRElement;\r\n new(): HTMLHRElement;\r\n}\r\n\r\ninterface HTMLHeadElement extends HTMLElement {\r\n profile: string;\r\n}\r\n\r\ndeclare var HTMLHeadElement: {\r\n prototype: HTMLHeadElement;\r\n new(): HTMLHeadElement;\r\n}\r\n\r\ninterface HTMLHeadingElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves a value that indicates the table alignment.\r\n */\r\n align: string;\r\n}\r\n\r\ndeclare var HTMLHeadingElement: {\r\n prototype: HTMLHeadingElement;\r\n new(): HTMLHeadingElement;\r\n}\r\n\r\ninterface HTMLHtmlElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves the DTD version that governs the current document.\r\n */\r\n version: string;\r\n}\r\n\r\ndeclare var HTMLHtmlElement: {\r\n prototype: HTMLHtmlElement;\r\n new(): HTMLHtmlElement;\r\n}\r\n\r\ninterface HTMLIFrameElement extends HTMLElement, GetSVGDocument {\r\n /**\r\n * Sets or retrieves how the object is aligned with adjacent text.\r\n */\r\n align: string;\r\n allowFullscreen: boolean;\r\n /**\r\n * Specifies the properties of a border drawn around an object.\r\n */\r\n border: string;\r\n /**\r\n * Retrieves the document object of the page or frame.\r\n */\r\n readonly contentDocument: Document;\r\n /**\r\n * Retrieves the object of the specified.\r\n */\r\n readonly contentWindow: Window;\r\n /**\r\n * Sets or retrieves whether to display a border for the frame.\r\n */\r\n frameBorder: string;\r\n /**\r\n * Sets or retrieves the amount of additional space between the frames.\r\n */\r\n frameSpacing: any;\r\n /**\r\n * Sets or retrieves the height of the object.\r\n */\r\n height: string;\r\n /**\r\n * Sets or retrieves the horizontal margin for the object.\r\n */\r\n hspace: number;\r\n /**\r\n * Sets or retrieves a URI to a long description of the object.\r\n */\r\n longDesc: string;\r\n /**\r\n * Sets or retrieves the top and bottom margin heights before displaying the text in a frame.\r\n */\r\n marginHeight: string;\r\n /**\r\n * Sets or retrieves the left and right margin widths before displaying the text in a frame.\r\n */\r\n marginWidth: string;\r\n /**\r\n * Sets or retrieves the frame name.\r\n */\r\n name: string;\r\n /**\r\n * Sets or retrieves whether the user can resize the frame.\r\n */\r\n noResize: boolean;\r\n /**\r\n * Raised when the object has been completely received from the server.\r\n */\r\n onload: (this: this, ev: Event) => any;\r\n readonly sandbox: DOMSettableTokenList;\r\n /**\r\n * Sets or retrieves whether the frame can be scrolled.\r\n */\r\n scrolling: string;\r\n /**\r\n * Sets or retrieves a URL to be loaded by the object.\r\n */\r\n src: string;\r\n /**\r\n * Sets or retrieves the vertical margin for the object.\r\n */\r\n vspace: number;\r\n /**\r\n * Sets or retrieves the width of the object.\r\n */\r\n width: string;\r\n addEventListener(type: \"MSContentZoom\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureChange\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureDoubleTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureEnd\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureHold\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGotPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSInertiaStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSLostPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSManipulationStateChanged\", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerCancel\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerDown\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerEnter\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerLeave\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerMove\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOut\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOver\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerUp\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"abort\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"activate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ariarequest\", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforecopy\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforecut\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforedeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforepaste\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"blur\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplay\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplaythrough\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"change\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"click\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"command\", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"contextmenu\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"copy\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"cuechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"cut\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dblclick\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"deactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drag\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragend\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragenter\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragleave\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragover\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragstart\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drop\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"durationchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"emptied\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ended\", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"focus\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"gotpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"input\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"invalid\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keydown\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keypress\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keyup\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadeddata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadedmetadata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"lostpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousedown\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseenter\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseleave\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousemove\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseout\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseover\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseup\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousewheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"paste\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pause\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"play\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"playing\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointercancel\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerdown\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerenter\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerleave\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointermove\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerout\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerover\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerup\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"progress\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ratechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"reset\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"scroll\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeked\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeking\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"select\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"selectstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"stalled\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"submit\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"suspend\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"timeupdate\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchcancel\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchend\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchmove\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchstart\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"volumechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"waiting\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenerror\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"wheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLIFrameElement: {\r\n prototype: HTMLIFrameElement;\r\n new(): HTMLIFrameElement;\r\n}\r\n\r\ninterface HTMLImageElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves how the object is aligned with adjacent text.\r\n */\r\n align: string;\r\n /**\r\n * Sets or retrieves a text alternative to the graphic.\r\n */\r\n alt: string;\r\n /**\r\n * Specifies the properties of a border drawn around an object.\r\n */\r\n border: string;\r\n /**\r\n * Retrieves whether the object is fully loaded.\r\n */\r\n readonly complete: boolean;\r\n crossOrigin: string;\r\n readonly currentSrc: string;\r\n /**\r\n * Sets or retrieves the height of the object.\r\n */\r\n height: number;\r\n /**\r\n * Sets or retrieves the width of the border to draw around the object.\r\n */\r\n hspace: number;\r\n /**\r\n * Sets or retrieves whether the image is a server-side image map.\r\n */\r\n isMap: boolean;\r\n /**\r\n * Sets or retrieves a Uniform Resource Identifier (URI) to a long description of the object.\r\n */\r\n longDesc: string;\r\n lowsrc: string;\r\n /**\r\n * Gets or sets whether the DLNA PlayTo device is available.\r\n */\r\n msPlayToDisabled: boolean;\r\n msPlayToPreferredSourceUri: string;\r\n /**\r\n * Gets or sets the primary DLNA PlayTo device.\r\n */\r\n msPlayToPrimary: boolean;\r\n /**\r\n * Gets the source associated with the media element for use by the PlayToManager.\r\n */\r\n readonly msPlayToSource: any;\r\n /**\r\n * Sets or retrieves the name of the object.\r\n */\r\n name: string;\r\n /**\r\n * The original height of the image resource before sizing.\r\n */\r\n readonly naturalHeight: number;\r\n /**\r\n * The original width of the image resource before sizing.\r\n */\r\n readonly naturalWidth: number;\r\n sizes: string;\r\n /**\r\n * The address or URL of the a media resource that is to be considered.\r\n */\r\n src: string;\r\n srcset: string;\r\n /**\r\n * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map.\r\n */\r\n useMap: string;\r\n /**\r\n * Sets or retrieves the vertical margin for the object.\r\n */\r\n vspace: number;\r\n /**\r\n * Sets or retrieves the width of the object.\r\n */\r\n width: number;\r\n readonly x: number;\r\n readonly y: number;\r\n msGetAsCastingSource(): any;\r\n}\r\n\r\ndeclare var HTMLImageElement: {\r\n prototype: HTMLImageElement;\r\n new(): HTMLImageElement;\r\n create(): HTMLImageElement;\r\n}\r\n\r\ninterface HTMLInputElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves a comma-separated list of content types.\r\n */\r\n accept: string;\r\n /**\r\n * Sets or retrieves how the object is aligned with adjacent text.\r\n */\r\n align: string;\r\n /**\r\n * Sets or retrieves a text alternative to the graphic.\r\n */\r\n alt: string;\r\n /**\r\n * Specifies whether autocomplete is applied to an editable text field.\r\n */\r\n autocomplete: string;\r\n /**\r\n * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing.\r\n */\r\n autofocus: boolean;\r\n /**\r\n * Sets or retrieves the width of the border to draw around the object.\r\n */\r\n border: string;\r\n /**\r\n * Sets or retrieves the state of the check box or radio button.\r\n */\r\n checked: boolean;\r\n /**\r\n * Retrieves whether the object is fully loaded.\r\n */\r\n readonly complete: boolean;\r\n /**\r\n * Sets or retrieves the state of the check box or radio button.\r\n */\r\n defaultChecked: boolean;\r\n /**\r\n * Sets or retrieves the initial contents of the object.\r\n */\r\n defaultValue: string;\r\n disabled: boolean;\r\n /**\r\n * Returns a FileList object on a file type input object.\r\n */\r\n readonly files: FileList | null;\r\n /**\r\n * Retrieves a reference to the form that the object is embedded in. \r\n */\r\n readonly form: HTMLFormElement;\r\n /**\r\n * Overrides the action attribute (where the data on a form is sent) on the parent form element.\r\n */\r\n formAction: string;\r\n /**\r\n * Used to override the encoding (formEnctype attribute) specified on the form element.\r\n */\r\n formEnctype: string;\r\n /**\r\n * Overrides the submit method attribute previously specified on a form element.\r\n */\r\n formMethod: string;\r\n /**\r\n * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a \"save draft\"-type submit option.\r\n */\r\n formNoValidate: string;\r\n /**\r\n * Overrides the target attribute on a form element.\r\n */\r\n formTarget: string;\r\n /**\r\n * Sets or retrieves the height of the object.\r\n */\r\n height: string;\r\n /**\r\n * Sets or retrieves the width of the border to draw around the object.\r\n */\r\n hspace: number;\r\n indeterminate: boolean;\r\n /**\r\n * Specifies the ID of a pre-defined datalist of options for an input element.\r\n */\r\n readonly list: HTMLElement;\r\n /**\r\n * Defines the maximum acceptable value for an input element with type=\"number\".When used with the min and step attributes, lets you control the range and increment (such as only even numbers) that the user can enter into an input field.\r\n */\r\n max: string;\r\n /**\r\n * Sets or retrieves the maximum number of characters that the user can enter in a text control.\r\n */\r\n maxLength: number;\r\n /**\r\n * Defines the minimum acceptable value for an input element with type=\"number\". When used with the max and step attributes, lets you control the range and increment (such as even numbers only) that the user can enter into an input field.\r\n */\r\n min: string;\r\n /**\r\n * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list.\r\n */\r\n multiple: boolean;\r\n /**\r\n * Sets or retrieves the name of the object.\r\n */\r\n name: string;\r\n /**\r\n * Gets or sets a string containing a regular expression that the user's input must match.\r\n */\r\n pattern: string;\r\n /**\r\n * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field.\r\n */\r\n placeholder: string;\r\n readOnly: boolean;\r\n /**\r\n * When present, marks an element that can't be submitted without a value.\r\n */\r\n required: boolean;\r\n selectionDirection: string;\r\n /**\r\n * Gets or sets the end position or offset of a text selection.\r\n */\r\n selectionEnd: number;\r\n /**\r\n * Gets or sets the starting position or offset of a text selection.\r\n */\r\n selectionStart: number;\r\n size: number;\r\n /**\r\n * The address or URL of the a media resource that is to be considered.\r\n */\r\n src: string;\r\n status: boolean;\r\n /**\r\n * Defines an increment or jump between values that you want to allow the user to enter. When used with the max and min attributes, lets you control the range and increment (for example, allow only even numbers) that the user can enter into an input field.\r\n */\r\n step: string;\r\n /**\r\n * Returns the content type of the object.\r\n */\r\n type: string;\r\n /**\r\n * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map.\r\n */\r\n useMap: string;\r\n /**\r\n * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\r\n */\r\n readonly validationMessage: string;\r\n /**\r\n * Returns a ValidityState object that represents the validity states of an element.\r\n */\r\n readonly validity: ValidityState;\r\n /**\r\n * Returns the value of the data at the cursor's current position.\r\n */\r\n value: string;\r\n valueAsDate: Date;\r\n /**\r\n * Returns the input field value as a number.\r\n */\r\n valueAsNumber: number;\r\n /**\r\n * Sets or retrieves the vertical margin for the object.\r\n */\r\n vspace: number;\r\n webkitdirectory: boolean;\r\n /**\r\n * Sets or retrieves the width of the object.\r\n */\r\n width: string;\r\n /**\r\n * Returns whether an element will successfully validate based on forms validation rules and constraints.\r\n */\r\n readonly willValidate: boolean;\r\n minLength: number;\r\n /**\r\n * Returns whether a form will validate when it is submitted, without having to submit it.\r\n */\r\n checkValidity(): boolean;\r\n /**\r\n * Makes the selection equal to the current object.\r\n */\r\n select(): void;\r\n /**\r\n * Sets a custom error message that is displayed when a form is submitted.\r\n * @param error Sets a custom error message that is displayed when a form is submitted.\r\n */\r\n setCustomValidity(error: string): void;\r\n /**\r\n * Sets the start and end positions of a selection in a text field.\r\n * @param start The offset into the text field for the start of the selection.\r\n * @param end The offset into the text field for the end of the selection.\r\n */\r\n setSelectionRange(start?: number, end?: number, direction?: string): void;\r\n /**\r\n * Decrements a range input control's value by the value given by the Step attribute. If the optional parameter is used, it will decrement the input control's step value multiplied by the parameter's value.\r\n * @param n Value to decrement the value by.\r\n */\r\n stepDown(n?: number): void;\r\n /**\r\n * Increments a range input control's value by the value given by the Step attribute. If the optional parameter is used, will increment the input control's value by that value.\r\n * @param n Value to increment the value by.\r\n */\r\n stepUp(n?: number): void;\r\n}\r\n\r\ndeclare var HTMLInputElement: {\r\n prototype: HTMLInputElement;\r\n new(): HTMLInputElement;\r\n}\r\n\r\ninterface HTMLLIElement extends HTMLElement {\r\n type: string;\r\n /**\r\n * Sets or retrieves the value of a list item.\r\n */\r\n value: number;\r\n}\r\n\r\ndeclare var HTMLLIElement: {\r\n prototype: HTMLLIElement;\r\n new(): HTMLLIElement;\r\n}\r\n\r\ninterface HTMLLabelElement extends HTMLElement {\r\n /**\r\n * Retrieves a reference to the form that the object is embedded in.\r\n */\r\n readonly form: HTMLFormElement;\r\n /**\r\n * Sets or retrieves the object to which the given label object is assigned.\r\n */\r\n htmlFor: string;\r\n}\r\n\r\ndeclare var HTMLLabelElement: {\r\n prototype: HTMLLabelElement;\r\n new(): HTMLLabelElement;\r\n}\r\n\r\ninterface HTMLLegendElement extends HTMLElement {\r\n /**\r\n * Retrieves a reference to the form that the object is embedded in.\r\n */\r\n align: string;\r\n /**\r\n * Retrieves a reference to the form that the object is embedded in.\r\n */\r\n readonly form: HTMLFormElement;\r\n}\r\n\r\ndeclare var HTMLLegendElement: {\r\n prototype: HTMLLegendElement;\r\n new(): HTMLLegendElement;\r\n}\r\n\r\ninterface HTMLLinkElement extends HTMLElement, LinkStyle {\r\n /**\r\n * Sets or retrieves the character set used to encode the object.\r\n */\r\n charset: string;\r\n disabled: boolean;\r\n /**\r\n * Sets or retrieves a destination URL or an anchor point.\r\n */\r\n href: string;\r\n /**\r\n * Sets or retrieves the language code of the object.\r\n */\r\n hreflang: string;\r\n /**\r\n * Sets or retrieves the media type.\r\n */\r\n media: string;\r\n /**\r\n * Sets or retrieves the relationship between the object and the destination of the link.\r\n */\r\n rel: string;\r\n /**\r\n * Sets or retrieves the relationship between the object and the destination of the link.\r\n */\r\n rev: string;\r\n /**\r\n * Sets or retrieves the window or frame at which to target content.\r\n */\r\n target: string;\r\n /**\r\n * Sets or retrieves the MIME type of the object.\r\n */\r\n type: string;\r\n import?: Document;\r\n integrity: string;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLLinkElement: {\r\n prototype: HTMLLinkElement;\r\n new(): HTMLLinkElement;\r\n}\r\n\r\ninterface HTMLMapElement extends HTMLElement {\r\n /**\r\n * Retrieves a collection of the area objects defined for the given map object.\r\n */\r\n readonly areas: HTMLAreasCollection;\r\n /**\r\n * Sets or retrieves the name of the object.\r\n */\r\n name: string;\r\n}\r\n\r\ndeclare var HTMLMapElement: {\r\n prototype: HTMLMapElement;\r\n new(): HTMLMapElement;\r\n}\r\n\r\ninterface HTMLMarqueeElement extends HTMLElement {\r\n behavior: string;\r\n bgColor: any;\r\n direction: string;\r\n height: string;\r\n hspace: number;\r\n loop: number;\r\n onbounce: (this: this, ev: Event) => any;\r\n onfinish: (this: this, ev: Event) => any;\r\n onstart: (this: this, ev: Event) => any;\r\n scrollAmount: number;\r\n scrollDelay: number;\r\n trueSpeed: boolean;\r\n vspace: number;\r\n width: string;\r\n start(): void;\r\n stop(): void;\r\n addEventListener(type: \"MSContentZoom\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureChange\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureDoubleTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureEnd\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureHold\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGotPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSInertiaStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSLostPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSManipulationStateChanged\", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerCancel\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerDown\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerEnter\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerLeave\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerMove\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOut\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOver\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerUp\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"abort\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"activate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ariarequest\", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforecopy\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforecut\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforedeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforepaste\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"blur\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"bounce\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplay\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplaythrough\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"change\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"click\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"command\", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"contextmenu\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"copy\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"cuechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"cut\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dblclick\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"deactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drag\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragend\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragenter\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragleave\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragover\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragstart\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drop\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"durationchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"emptied\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ended\", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"finish\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"focus\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"gotpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"input\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"invalid\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keydown\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keypress\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keyup\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadeddata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadedmetadata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"lostpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousedown\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseenter\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseleave\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousemove\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseout\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseover\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseup\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousewheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"paste\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pause\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"play\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"playing\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointercancel\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerdown\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerenter\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerleave\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointermove\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerout\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerover\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerup\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"progress\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ratechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"reset\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"scroll\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeked\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeking\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"select\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"selectstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"stalled\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"start\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"submit\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"suspend\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"timeupdate\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchcancel\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchend\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchmove\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchstart\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"volumechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"waiting\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenerror\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"wheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLMarqueeElement: {\r\n prototype: HTMLMarqueeElement;\r\n new(): HTMLMarqueeElement;\r\n}\r\n\r\ninterface HTMLMediaElement extends HTMLElement {\r\n /**\r\n * Returns an AudioTrackList object with the audio tracks for a given video element.\r\n */\r\n readonly audioTracks: AudioTrackList;\r\n /**\r\n * Gets or sets a value that indicates whether to start playing the media automatically.\r\n */\r\n autoplay: boolean;\r\n /**\r\n * Gets a collection of buffered time ranges.\r\n */\r\n readonly buffered: TimeRanges;\r\n /**\r\n * Gets or sets a flag that indicates whether the client provides a set of controls for the media (in case the developer does not include controls for the player).\r\n */\r\n controls: boolean;\r\n crossOrigin: string;\r\n /**\r\n * Gets the address or URL of the current media resource that is selected by IHTMLMediaElement.\r\n */\r\n readonly currentSrc: string;\r\n /**\r\n * Gets or sets the current playback position, in seconds.\r\n */\r\n currentTime: number;\r\n defaultMuted: boolean;\r\n /**\r\n * Gets or sets the default playback rate when the user is not using fast forward or reverse for a video or audio resource.\r\n */\r\n defaultPlaybackRate: number;\r\n /**\r\n * Returns the duration in seconds of the current media resource. A NaN value is returned if duration is not available, or Infinity if the media resource is streaming.\r\n */\r\n readonly duration: number;\r\n /**\r\n * Gets information about whether the playback has ended or not.\r\n */\r\n readonly ended: boolean;\r\n /**\r\n * Returns an object representing the current error state of the audio or video element.\r\n */\r\n readonly error: MediaError;\r\n /**\r\n * Gets or sets a flag to specify whether playback should restart after it completes.\r\n */\r\n loop: boolean;\r\n readonly mediaKeys: MediaKeys | null;\r\n /**\r\n * Specifies the purpose of the audio or video media, such as background audio or alerts.\r\n */\r\n msAudioCategory: string;\r\n /**\r\n * Specifies the output device id that the audio will be sent to.\r\n */\r\n msAudioDeviceType: string;\r\n readonly msGraphicsTrustStatus: MSGraphicsTrust;\r\n /**\r\n * Gets the MSMediaKeys object, which is used for decrypting media data, that is associated with this media element.\r\n */\r\n readonly msKeys: MSMediaKeys;\r\n /**\r\n * Gets or sets whether the DLNA PlayTo device is available.\r\n */\r\n msPlayToDisabled: boolean;\r\n /**\r\n * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server.\r\n */\r\n msPlayToPreferredSourceUri: string;\r\n /**\r\n * Gets or sets the primary DLNA PlayTo device.\r\n */\r\n msPlayToPrimary: boolean;\r\n /**\r\n * Gets the source associated with the media element for use by the PlayToManager.\r\n */\r\n readonly msPlayToSource: any;\r\n /**\r\n * Specifies whether or not to enable low-latency playback on the media element.\r\n */\r\n msRealTime: boolean;\r\n /**\r\n * Gets or sets a flag that indicates whether the audio (either audio or the audio track on video media) is muted.\r\n */\r\n muted: boolean;\r\n /**\r\n * Gets the current network activity for the element.\r\n */\r\n readonly networkState: number;\r\n onencrypted: (this: this, ev: MediaEncryptedEvent) => any;\r\n onmsneedkey: (this: this, ev: MSMediaKeyNeededEvent) => any;\r\n /**\r\n * Gets a flag that specifies whether playback is paused.\r\n */\r\n readonly paused: boolean;\r\n /**\r\n * Gets or sets the current rate of speed for the media resource to play. This speed is expressed as a multiple of the normal speed of the media resource.\r\n */\r\n playbackRate: number;\r\n /**\r\n * Gets TimeRanges for the current media resource that has been played.\r\n */\r\n readonly played: TimeRanges;\r\n /**\r\n * Gets or sets the current playback position, in seconds.\r\n */\r\n preload: string;\r\n readyState: number;\r\n /**\r\n * Returns a TimeRanges object that represents the ranges of the current media resource that can be seeked.\r\n */\r\n readonly seekable: TimeRanges;\r\n /**\r\n * Gets a flag that indicates whether the the client is currently moving to a new playback position in the media resource.\r\n */\r\n readonly seeking: boolean;\r\n /**\r\n * The address or URL of the a media resource that is to be considered.\r\n */\r\n src: string;\r\n srcObject: MediaStream | null;\r\n readonly textTracks: TextTrackList;\r\n readonly videoTracks: VideoTrackList;\r\n /**\r\n * Gets or sets the volume level for audio portions of the media element.\r\n */\r\n volume: number;\r\n addTextTrack(kind: string, label?: string, language?: string): TextTrack;\r\n /**\r\n * Returns a string that specifies whether the client can play a given media resource type.\r\n */\r\n canPlayType(type: string): string;\r\n /**\r\n * Resets the audio or video object and loads a new media resource.\r\n */\r\n load(): void;\r\n /**\r\n * Clears all effects from the media pipeline.\r\n */\r\n msClearEffects(): void;\r\n msGetAsCastingSource(): any;\r\n /**\r\n * Inserts the specified audio effect into media pipeline.\r\n */\r\n msInsertAudioEffect(activatableClassId: string, effectRequired: boolean, config?: any): void;\r\n msSetMediaKeys(mediaKeys: MSMediaKeys): void;\r\n /**\r\n * Specifies the media protection manager for a given media pipeline.\r\n */\r\n msSetMediaProtectionManager(mediaProtectionManager?: any): void;\r\n /**\r\n * Pauses the current playback and sets paused to TRUE. This can be used to test whether the media is playing or paused. You can also use the pause or play events to tell whether the media is playing or not.\r\n */\r\n pause(): void;\r\n /**\r\n * Loads and starts playback of a media resource.\r\n */\r\n play(): void;\r\n setMediaKeys(mediaKeys: MediaKeys | null): PromiseLike;\r\n readonly HAVE_CURRENT_DATA: number;\r\n readonly HAVE_ENOUGH_DATA: number;\r\n readonly HAVE_FUTURE_DATA: number;\r\n readonly HAVE_METADATA: number;\r\n readonly HAVE_NOTHING: number;\r\n readonly NETWORK_EMPTY: number;\r\n readonly NETWORK_IDLE: number;\r\n readonly NETWORK_LOADING: number;\r\n readonly NETWORK_NO_SOURCE: number;\r\n addEventListener(type: \"MSContentZoom\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureChange\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureDoubleTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureEnd\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureHold\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGotPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSInertiaStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSLostPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSManipulationStateChanged\", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerCancel\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerDown\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerEnter\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerLeave\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerMove\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOut\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOver\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerUp\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"abort\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"activate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ariarequest\", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforecopy\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforecut\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforedeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforepaste\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"blur\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplay\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplaythrough\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"change\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"click\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"command\", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"contextmenu\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"copy\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"cuechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"cut\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dblclick\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"deactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drag\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragend\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragenter\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragleave\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragover\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragstart\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drop\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"durationchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"emptied\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"encrypted\", listener: (this: this, ev: MediaEncryptedEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ended\", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"focus\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"gotpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"input\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"invalid\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keydown\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keypress\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keyup\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadeddata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadedmetadata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"lostpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousedown\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseenter\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseleave\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousemove\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseout\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseover\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseup\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousewheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"msneedkey\", listener: (this: this, ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"paste\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pause\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"play\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"playing\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointercancel\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerdown\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerenter\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerleave\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointermove\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerout\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerover\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerup\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"progress\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ratechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"reset\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"scroll\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeked\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeking\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"select\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"selectstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"stalled\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"submit\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"suspend\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"timeupdate\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchcancel\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchend\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchmove\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchstart\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"volumechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"waiting\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenerror\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"wheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLMediaElement: {\r\n prototype: HTMLMediaElement;\r\n new(): HTMLMediaElement;\r\n readonly HAVE_CURRENT_DATA: number;\r\n readonly HAVE_ENOUGH_DATA: number;\r\n readonly HAVE_FUTURE_DATA: number;\r\n readonly HAVE_METADATA: number;\r\n readonly HAVE_NOTHING: number;\r\n readonly NETWORK_EMPTY: number;\r\n readonly NETWORK_IDLE: number;\r\n readonly NETWORK_LOADING: number;\r\n readonly NETWORK_NO_SOURCE: number;\r\n}\r\n\r\ninterface HTMLMenuElement extends HTMLElement {\r\n compact: boolean;\r\n type: string;\r\n}\r\n\r\ndeclare var HTMLMenuElement: {\r\n prototype: HTMLMenuElement;\r\n new(): HTMLMenuElement;\r\n}\r\n\r\ninterface HTMLMetaElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves the character set used to encode the object.\r\n */\r\n charset: string;\r\n /**\r\n * Gets or sets meta-information to associate with httpEquiv or name.\r\n */\r\n content: string;\r\n /**\r\n * Gets or sets information used to bind the value of a content attribute of a meta element to an HTTP response header.\r\n */\r\n httpEquiv: string;\r\n /**\r\n * Sets or retrieves the value specified in the content attribute of the meta object.\r\n */\r\n name: string;\r\n /**\r\n * Sets or retrieves a scheme to be used in interpreting the value of a property specified for the object.\r\n */\r\n scheme: string;\r\n /**\r\n * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. \r\n */\r\n url: string;\r\n}\r\n\r\ndeclare var HTMLMetaElement: {\r\n prototype: HTMLMetaElement;\r\n new(): HTMLMetaElement;\r\n}\r\n\r\ninterface HTMLMeterElement extends HTMLElement {\r\n high: number;\r\n low: number;\r\n max: number;\r\n min: number;\r\n optimum: number;\r\n value: number;\r\n}\r\n\r\ndeclare var HTMLMeterElement: {\r\n prototype: HTMLMeterElement;\r\n new(): HTMLMeterElement;\r\n}\r\n\r\ninterface HTMLModElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves reference information about the object.\r\n */\r\n cite: string;\r\n /**\r\n * Sets or retrieves the date and time of a modification to the object.\r\n */\r\n dateTime: string;\r\n}\r\n\r\ndeclare var HTMLModElement: {\r\n prototype: HTMLModElement;\r\n new(): HTMLModElement;\r\n}\r\n\r\ninterface HTMLOListElement extends HTMLElement {\r\n compact: boolean;\r\n /**\r\n * The starting number.\r\n */\r\n start: number;\r\n type: string;\r\n}\r\n\r\ndeclare var HTMLOListElement: {\r\n prototype: HTMLOListElement;\r\n new(): HTMLOListElement;\r\n}\r\n\r\ninterface HTMLObjectElement extends HTMLElement, GetSVGDocument {\r\n /**\r\n * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element.\r\n */\r\n readonly BaseHref: string;\r\n align: string;\r\n /**\r\n * Sets or retrieves a text alternative to the graphic.\r\n */\r\n alt: string;\r\n /**\r\n * Gets or sets the optional alternative HTML script to execute if the object fails to load.\r\n */\r\n altHtml: string;\r\n /**\r\n * Sets or retrieves a character string that can be used to implement your own archive functionality for the object.\r\n */\r\n archive: string;\r\n border: string;\r\n /**\r\n * Sets or retrieves the URL of the file containing the compiled Java class.\r\n */\r\n code: string;\r\n /**\r\n * Sets or retrieves the URL of the component.\r\n */\r\n codeBase: string;\r\n /**\r\n * Sets or retrieves the Internet media type for the code associated with the object.\r\n */\r\n codeType: string;\r\n /**\r\n * Retrieves the document object of the page or frame.\r\n */\r\n readonly contentDocument: Document;\r\n /**\r\n * Sets or retrieves the URL that references the data of the object.\r\n */\r\n data: string;\r\n declare: boolean;\r\n /**\r\n * Retrieves a reference to the form that the object is embedded in.\r\n */\r\n readonly form: HTMLFormElement;\r\n /**\r\n * Sets or retrieves the height of the object.\r\n */\r\n height: string;\r\n hspace: number;\r\n /**\r\n * Gets or sets whether the DLNA PlayTo device is available.\r\n */\r\n msPlayToDisabled: boolean;\r\n /**\r\n * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server.\r\n */\r\n msPlayToPreferredSourceUri: string;\r\n /**\r\n * Gets or sets the primary DLNA PlayTo device.\r\n */\r\n msPlayToPrimary: boolean;\r\n /**\r\n * Gets the source associated with the media element for use by the PlayToManager.\r\n */\r\n readonly msPlayToSource: any;\r\n /**\r\n * Sets or retrieves the name of the object.\r\n */\r\n name: string;\r\n /**\r\n * Retrieves the contained object.\r\n */\r\n readonly object: any;\r\n readonly readyState: number;\r\n /**\r\n * Sets or retrieves a message to be displayed while an object is loading.\r\n */\r\n standby: string;\r\n /**\r\n * Sets or retrieves the MIME type of the object.\r\n */\r\n type: string;\r\n /**\r\n * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map.\r\n */\r\n useMap: string;\r\n /**\r\n * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\r\n */\r\n readonly validationMessage: string;\r\n /**\r\n * Returns a ValidityState object that represents the validity states of an element.\r\n */\r\n readonly validity: ValidityState;\r\n vspace: number;\r\n /**\r\n * Sets or retrieves the width of the object.\r\n */\r\n width: string;\r\n /**\r\n * Returns whether an element will successfully validate based on forms validation rules and constraints.\r\n */\r\n readonly willValidate: boolean;\r\n /**\r\n * Returns whether a form will validate when it is submitted, without having to submit it.\r\n */\r\n checkValidity(): boolean;\r\n /**\r\n * Sets a custom error message that is displayed when a form is submitted.\r\n * @param error Sets a custom error message that is displayed when a form is submitted.\r\n */\r\n setCustomValidity(error: string): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLObjectElement: {\r\n prototype: HTMLObjectElement;\r\n new(): HTMLObjectElement;\r\n}\r\n\r\ninterface HTMLOptGroupElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves the status of an option.\r\n */\r\n defaultSelected: boolean;\r\n disabled: boolean;\r\n /**\r\n * Retrieves a reference to the form that the object is embedded in.\r\n */\r\n readonly form: HTMLFormElement;\r\n /**\r\n * Sets or retrieves the ordinal position of an option in a list box.\r\n */\r\n readonly index: number;\r\n /**\r\n * Sets or retrieves a value that you can use to implement your own label functionality for the object.\r\n */\r\n label: string;\r\n /**\r\n * Sets or retrieves whether the option in the list box is the default item.\r\n */\r\n selected: boolean;\r\n /**\r\n * Sets or retrieves the text string specified by the option tag.\r\n */\r\n readonly text: string;\r\n /**\r\n * Sets or retrieves the value which is returned to the server when the form control is submitted.\r\n */\r\n value: string;\r\n}\r\n\r\ndeclare var HTMLOptGroupElement: {\r\n prototype: HTMLOptGroupElement;\r\n new(): HTMLOptGroupElement;\r\n}\r\n\r\ninterface HTMLOptionElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves the status of an option.\r\n */\r\n defaultSelected: boolean;\r\n disabled: boolean;\r\n /**\r\n * Retrieves a reference to the form that the object is embedded in.\r\n */\r\n readonly form: HTMLFormElement;\r\n /**\r\n * Sets or retrieves the ordinal position of an option in a list box.\r\n */\r\n readonly index: number;\r\n /**\r\n * Sets or retrieves a value that you can use to implement your own label functionality for the object.\r\n */\r\n label: string;\r\n /**\r\n * Sets or retrieves whether the option in the list box is the default item.\r\n */\r\n selected: boolean;\r\n /**\r\n * Sets or retrieves the text string specified by the option tag.\r\n */\r\n text: string;\r\n /**\r\n * Sets or retrieves the value which is returned to the server when the form control is submitted.\r\n */\r\n value: string;\r\n}\r\n\r\ndeclare var HTMLOptionElement: {\r\n prototype: HTMLOptionElement;\r\n new(): HTMLOptionElement;\r\n create(): HTMLOptionElement;\r\n}\r\n\r\ninterface HTMLOptionsCollection extends HTMLCollectionOf {\r\n length: number;\r\n selectedIndex: number;\r\n add(element: HTMLOptionElement | HTMLOptGroupElement, before?: HTMLElement | number): void;\r\n remove(index: number): void;\r\n}\r\n\r\ndeclare var HTMLOptionsCollection: {\r\n prototype: HTMLOptionsCollection;\r\n new(): HTMLOptionsCollection;\r\n}\r\n\r\ninterface HTMLParagraphElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves how the object is aligned with adjacent text. \r\n */\r\n align: string;\r\n clear: string;\r\n}\r\n\r\ndeclare var HTMLParagraphElement: {\r\n prototype: HTMLParagraphElement;\r\n new(): HTMLParagraphElement;\r\n}\r\n\r\ninterface HTMLParamElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves the name of an input parameter for an element.\r\n */\r\n name: string;\r\n /**\r\n * Sets or retrieves the content type of the resource designated by the value attribute.\r\n */\r\n type: string;\r\n /**\r\n * Sets or retrieves the value of an input parameter for an element.\r\n */\r\n value: string;\r\n /**\r\n * Sets or retrieves the data type of the value attribute.\r\n */\r\n valueType: string;\r\n}\r\n\r\ndeclare var HTMLParamElement: {\r\n prototype: HTMLParamElement;\r\n new(): HTMLParamElement;\r\n}\r\n\r\ninterface HTMLPictureElement extends HTMLElement {\r\n}\r\n\r\ndeclare var HTMLPictureElement: {\r\n prototype: HTMLPictureElement;\r\n new(): HTMLPictureElement;\r\n}\r\n\r\ninterface HTMLPreElement extends HTMLElement {\r\n /**\r\n * Sets or gets a value that you can use to implement your own width functionality for the object.\r\n */\r\n width: number;\r\n}\r\n\r\ndeclare var HTMLPreElement: {\r\n prototype: HTMLPreElement;\r\n new(): HTMLPreElement;\r\n}\r\n\r\ninterface HTMLProgressElement extends HTMLElement {\r\n /**\r\n * Retrieves a reference to the form that the object is embedded in.\r\n */\r\n readonly form: HTMLFormElement;\r\n /**\r\n * Defines the maximum, or \"done\" value for a progress element.\r\n */\r\n max: number;\r\n /**\r\n * Returns the quotient of value/max when the value attribute is set (determinate progress bar), or -1 when the value attribute is missing (indeterminate progress bar).\r\n */\r\n readonly position: number;\r\n /**\r\n * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value.\r\n */\r\n value: number;\r\n}\r\n\r\ndeclare var HTMLProgressElement: {\r\n prototype: HTMLProgressElement;\r\n new(): HTMLProgressElement;\r\n}\r\n\r\ninterface HTMLQuoteElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves reference information about the object.\r\n */\r\n cite: string;\r\n}\r\n\r\ndeclare var HTMLQuoteElement: {\r\n prototype: HTMLQuoteElement;\r\n new(): HTMLQuoteElement;\r\n}\r\n\r\ninterface HTMLScriptElement extends HTMLElement {\r\n async: boolean;\r\n /**\r\n * Sets or retrieves the character set used to encode the object.\r\n */\r\n charset: string;\r\n /**\r\n * Sets or retrieves the status of the script.\r\n */\r\n defer: boolean;\r\n /**\r\n * Sets or retrieves the event for which the script is written. \r\n */\r\n event: string;\r\n /** \r\n * Sets or retrieves the object that is bound to the event script.\r\n */\r\n htmlFor: string;\r\n /**\r\n * Retrieves the URL to an external file that contains the source code or data.\r\n */\r\n src: string;\r\n /**\r\n * Retrieves or sets the text of the object as a string. \r\n */\r\n text: string;\r\n /**\r\n * Sets or retrieves the MIME type for the associated scripting engine.\r\n */\r\n type: string;\r\n integrity: string;\r\n}\r\n\r\ndeclare var HTMLScriptElement: {\r\n prototype: HTMLScriptElement;\r\n new(): HTMLScriptElement;\r\n}\r\n\r\ninterface HTMLSelectElement extends HTMLElement {\r\n /**\r\n * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing.\r\n */\r\n autofocus: boolean;\r\n disabled: boolean;\r\n /**\r\n * Retrieves a reference to the form that the object is embedded in. \r\n */\r\n readonly form: HTMLFormElement;\r\n /**\r\n * Sets or retrieves the number of objects in a collection.\r\n */\r\n length: number;\r\n /**\r\n * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list.\r\n */\r\n multiple: boolean;\r\n /**\r\n * Sets or retrieves the name of the object.\r\n */\r\n name: string;\r\n readonly options: HTMLOptionsCollection;\r\n /**\r\n * When present, marks an element that can't be submitted without a value.\r\n */\r\n required: boolean;\r\n /**\r\n * Sets or retrieves the index of the selected option in a select object.\r\n */\r\n selectedIndex: number;\r\n selectedOptions: HTMLCollectionOf;\r\n /**\r\n * Sets or retrieves the number of rows in the list box. \r\n */\r\n size: number;\r\n /**\r\n * Retrieves the type of select control based on the value of the MULTIPLE attribute.\r\n */\r\n readonly type: string;\r\n /**\r\n * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\r\n */\r\n readonly validationMessage: string;\r\n /**\r\n * Returns a ValidityState object that represents the validity states of an element.\r\n */\r\n readonly validity: ValidityState;\r\n /**\r\n * Sets or retrieves the value which is returned to the server when the form control is submitted.\r\n */\r\n value: string;\r\n /**\r\n * Returns whether an element will successfully validate based on forms validation rules and constraints.\r\n */\r\n readonly willValidate: boolean;\r\n /**\r\n * Adds an element to the areas, controlRange, or options collection.\r\n * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection.\r\n * @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection. \r\n */\r\n add(element: HTMLElement, before?: HTMLElement | number): void;\r\n /**\r\n * Returns whether a form will validate when it is submitted, without having to submit it.\r\n */\r\n checkValidity(): boolean;\r\n /**\r\n * Retrieves a select object or an object from an options collection.\r\n * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is an integer, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made.\r\n * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned.\r\n */\r\n item(name?: any, index?: any): any;\r\n /**\r\n * Retrieves a select object or an object from an options collection.\r\n * @param namedItem A String that specifies the name or id property of the object to retrieve. A collection is returned if more than one match is made.\r\n */\r\n namedItem(name: string): any;\r\n /**\r\n * Removes an element from the collection.\r\n * @param index Number that specifies the zero-based index of the element to remove from the collection.\r\n */\r\n remove(index?: number): void;\r\n /**\r\n * Sets a custom error message that is displayed when a form is submitted.\r\n * @param error Sets a custom error message that is displayed when a form is submitted.\r\n */\r\n setCustomValidity(error: string): void;\r\n [name: string]: any;\r\n}\r\n\r\ndeclare var HTMLSelectElement: {\r\n prototype: HTMLSelectElement;\r\n new(): HTMLSelectElement;\r\n}\r\n\r\ninterface HTMLSourceElement extends HTMLElement {\r\n /**\r\n * Gets or sets the intended media type of the media source.\r\n */\r\n media: string;\r\n msKeySystem: string;\r\n sizes: string;\r\n /**\r\n * The address or URL of the a media resource that is to be considered.\r\n */\r\n src: string;\r\n srcset: string;\r\n /**\r\n * Gets or sets the MIME type of a media resource.\r\n */\r\n type: string;\r\n}\r\n\r\ndeclare var HTMLSourceElement: {\r\n prototype: HTMLSourceElement;\r\n new(): HTMLSourceElement;\r\n}\r\n\r\ninterface HTMLSpanElement extends HTMLElement {\r\n}\r\n\r\ndeclare var HTMLSpanElement: {\r\n prototype: HTMLSpanElement;\r\n new(): HTMLSpanElement;\r\n}\r\n\r\ninterface HTMLStyleElement extends HTMLElement, LinkStyle {\r\n disabled: boolean;\r\n /**\r\n * Sets or retrieves the media type.\r\n */\r\n media: string;\r\n /**\r\n * Retrieves the CSS language in which the style sheet is written.\r\n */\r\n type: string;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLStyleElement: {\r\n prototype: HTMLStyleElement;\r\n new(): HTMLStyleElement;\r\n}\r\n\r\ninterface HTMLTableCaptionElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves the alignment of the caption or legend.\r\n */\r\n align: string;\r\n /**\r\n * Sets or retrieves whether the caption appears at the top or bottom of the table.\r\n */\r\n vAlign: string;\r\n}\r\n\r\ndeclare var HTMLTableCaptionElement: {\r\n prototype: HTMLTableCaptionElement;\r\n new(): HTMLTableCaptionElement;\r\n}\r\n\r\ninterface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment {\r\n /**\r\n * Sets or retrieves abbreviated text for the object.\r\n */\r\n abbr: string;\r\n /**\r\n * Sets or retrieves how the object is aligned with adjacent text.\r\n */\r\n align: string;\r\n /**\r\n * Sets or retrieves a comma-delimited list of conceptual categories associated with the object.\r\n */\r\n axis: string;\r\n bgColor: any;\r\n /**\r\n * Retrieves the position of the object in the cells collection of a row.\r\n */\r\n readonly cellIndex: number;\r\n /**\r\n * Sets or retrieves the number columns in the table that the object should span.\r\n */\r\n colSpan: number;\r\n /**\r\n * Sets or retrieves a list of header cells that provide information for the object.\r\n */\r\n headers: string;\r\n /**\r\n * Sets or retrieves the height of the object.\r\n */\r\n height: any;\r\n /**\r\n * Sets or retrieves whether the browser automatically performs wordwrap.\r\n */\r\n noWrap: boolean;\r\n /**\r\n * Sets or retrieves how many rows in a table the cell should span.\r\n */\r\n rowSpan: number;\r\n /**\r\n * Sets or retrieves the group of cells in a table to which the object's information applies.\r\n */\r\n scope: string;\r\n /**\r\n * Sets or retrieves the width of the object.\r\n */\r\n width: string;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLTableCellElement: {\r\n prototype: HTMLTableCellElement;\r\n new(): HTMLTableCellElement;\r\n}\r\n\r\ninterface HTMLTableColElement extends HTMLElement, HTMLTableAlignment {\r\n /**\r\n * Sets or retrieves the alignment of the object relative to the display or table.\r\n */\r\n align: string;\r\n /**\r\n * Sets or retrieves the number of columns in the group.\r\n */\r\n span: number;\r\n /**\r\n * Sets or retrieves the width of the object.\r\n */\r\n width: any;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLTableColElement: {\r\n prototype: HTMLTableColElement;\r\n new(): HTMLTableColElement;\r\n}\r\n\r\ninterface HTMLTableDataCellElement extends HTMLTableCellElement {\r\n}\r\n\r\ndeclare var HTMLTableDataCellElement: {\r\n prototype: HTMLTableDataCellElement;\r\n new(): HTMLTableDataCellElement;\r\n}\r\n\r\ninterface HTMLTableElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves a value that indicates the table alignment.\r\n */\r\n align: string;\r\n bgColor: any;\r\n /**\r\n * Sets or retrieves the width of the border to draw around the object.\r\n */\r\n border: string;\r\n /**\r\n * Sets or retrieves the border color of the object. \r\n */\r\n borderColor: any;\r\n /**\r\n * Retrieves the caption object of a table.\r\n */\r\n caption: HTMLTableCaptionElement;\r\n /**\r\n * Sets or retrieves the amount of space between the border of the cell and the content of the cell.\r\n */\r\n cellPadding: string;\r\n /**\r\n * Sets or retrieves the amount of space between cells in a table.\r\n */\r\n cellSpacing: string;\r\n /**\r\n * Sets or retrieves the number of columns in the table.\r\n */\r\n cols: number;\r\n /**\r\n * Sets or retrieves the way the border frame around the table is displayed.\r\n */\r\n frame: string;\r\n /**\r\n * Sets or retrieves the height of the object.\r\n */\r\n height: any;\r\n /**\r\n * Sets or retrieves the number of horizontal rows contained in the object.\r\n */\r\n rows: HTMLCollectionOf;\r\n /**\r\n * Sets or retrieves which dividing lines (inner borders) are displayed.\r\n */\r\n rules: string;\r\n /**\r\n * Sets or retrieves a description and/or structure of the object.\r\n */\r\n summary: string;\r\n /**\r\n * Retrieves a collection of all tBody objects in the table. Objects in this collection are in source order.\r\n */\r\n tBodies: HTMLCollectionOf;\r\n /**\r\n * Retrieves the tFoot object of the table.\r\n */\r\n tFoot: HTMLTableSectionElement;\r\n /**\r\n * Retrieves the tHead object of the table.\r\n */\r\n tHead: HTMLTableSectionElement;\r\n /**\r\n * Sets or retrieves the width of the object.\r\n */\r\n width: string;\r\n /**\r\n * Creates an empty caption element in the table.\r\n */\r\n createCaption(): HTMLTableCaptionElement;\r\n /**\r\n * Creates an empty tBody element in the table.\r\n */\r\n createTBody(): HTMLTableSectionElement;\r\n /**\r\n * Creates an empty tFoot element in the table.\r\n */\r\n createTFoot(): HTMLTableSectionElement;\r\n /**\r\n * Returns the tHead element object if successful, or null otherwise.\r\n */\r\n createTHead(): HTMLTableSectionElement;\r\n /**\r\n * Deletes the caption element and its contents from the table.\r\n */\r\n deleteCaption(): void;\r\n /**\r\n * Removes the specified row (tr) from the element and from the rows collection.\r\n * @param index Number that specifies the zero-based position in the rows collection of the row to remove.\r\n */\r\n deleteRow(index?: number): void;\r\n /**\r\n * Deletes the tFoot element and its contents from the table.\r\n */\r\n deleteTFoot(): void;\r\n /**\r\n * Deletes the tHead element and its contents from the table.\r\n */\r\n deleteTHead(): void;\r\n /**\r\n * Creates a new row (tr) in the table, and adds the row to the rows collection.\r\n * @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.\r\n */\r\n insertRow(index?: number): HTMLTableRowElement;\r\n}\r\n\r\ndeclare var HTMLTableElement: {\r\n prototype: HTMLTableElement;\r\n new(): HTMLTableElement;\r\n}\r\n\r\ninterface HTMLTableHeaderCellElement extends HTMLTableCellElement {\r\n /**\r\n * Sets or retrieves the group of cells in a table to which the object's information applies.\r\n */\r\n scope: string;\r\n}\r\n\r\ndeclare var HTMLTableHeaderCellElement: {\r\n prototype: HTMLTableHeaderCellElement;\r\n new(): HTMLTableHeaderCellElement;\r\n}\r\n\r\ninterface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment {\r\n /**\r\n * Sets or retrieves how the object is aligned with adjacent text.\r\n */\r\n align: string;\r\n bgColor: any;\r\n /**\r\n * Retrieves a collection of all cells in the table row.\r\n */\r\n cells: HTMLCollectionOf;\r\n /**\r\n * Sets or retrieves the height of the object.\r\n */\r\n height: any;\r\n /**\r\n * Retrieves the position of the object in the rows collection for the table.\r\n */\r\n readonly rowIndex: number;\r\n /**\r\n * Retrieves the position of the object in the collection.\r\n */\r\n readonly sectionRowIndex: number;\r\n /**\r\n * Removes the specified cell from the table row, as well as from the cells collection.\r\n * @param index Number that specifies the zero-based position of the cell to remove from the table row. If no value is provided, the last cell in the cells collection is deleted.\r\n */\r\n deleteCell(index?: number): void;\r\n /**\r\n * Creates a new cell in the table row, and adds the cell to the cells collection.\r\n * @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.\r\n */\r\n insertCell(index?: number): HTMLTableDataCellElement;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLTableRowElement: {\r\n prototype: HTMLTableRowElement;\r\n new(): HTMLTableRowElement;\r\n}\r\n\r\ninterface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment {\r\n /**\r\n * Sets or retrieves a value that indicates the table alignment.\r\n */\r\n align: string;\r\n /**\r\n * Sets or retrieves the number of horizontal rows contained in the object.\r\n */\r\n rows: HTMLCollectionOf;\r\n /**\r\n * Removes the specified row (tr) from the element and from the rows collection.\r\n * @param index Number that specifies the zero-based position in the rows collection of the row to remove.\r\n */\r\n deleteRow(index?: number): void;\r\n /**\r\n * Creates a new row (tr) in the table, and adds the row to the rows collection.\r\n * @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.\r\n */\r\n insertRow(index?: number): HTMLTableRowElement;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLTableSectionElement: {\r\n prototype: HTMLTableSectionElement;\r\n new(): HTMLTableSectionElement;\r\n}\r\n\r\ninterface HTMLTemplateElement extends HTMLElement {\r\n readonly content: DocumentFragment;\r\n}\r\n\r\ndeclare var HTMLTemplateElement: {\r\n prototype: HTMLTemplateElement;\r\n new(): HTMLTemplateElement;\r\n}\r\n\r\ninterface HTMLTextAreaElement extends HTMLElement {\r\n /**\r\n * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing.\r\n */\r\n autofocus: boolean;\r\n /**\r\n * Sets or retrieves the width of the object.\r\n */\r\n cols: number;\r\n /**\r\n * Sets or retrieves the initial contents of the object.\r\n */\r\n defaultValue: string;\r\n disabled: boolean;\r\n /**\r\n * Retrieves a reference to the form that the object is embedded in.\r\n */\r\n readonly form: HTMLFormElement;\r\n /**\r\n * Sets or retrieves the maximum number of characters that the user can enter in a text control.\r\n */\r\n maxLength: number;\r\n /**\r\n * Sets or retrieves the name of the object.\r\n */\r\n name: string;\r\n /**\r\n * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field.\r\n */\r\n placeholder: string;\r\n /**\r\n * Sets or retrieves the value indicated whether the content of the object is read-only.\r\n */\r\n readOnly: boolean;\r\n /**\r\n * When present, marks an element that can't be submitted without a value.\r\n */\r\n required: boolean;\r\n /**\r\n * Sets or retrieves the number of horizontal rows contained in the object.\r\n */\r\n rows: number;\r\n /**\r\n * Gets or sets the end position or offset of a text selection.\r\n */\r\n selectionEnd: number;\r\n /**\r\n * Gets or sets the starting position or offset of a text selection.\r\n */\r\n selectionStart: number;\r\n /**\r\n * Sets or retrieves the value indicating whether the control is selected.\r\n */\r\n status: any;\r\n /**\r\n * Retrieves the type of control.\r\n */\r\n readonly type: string;\r\n /**\r\n * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\r\n */\r\n readonly validationMessage: string;\r\n /**\r\n * Returns a ValidityState object that represents the validity states of an element.\r\n */\r\n readonly validity: ValidityState;\r\n /**\r\n * Retrieves or sets the text in the entry field of the textArea element.\r\n */\r\n value: string;\r\n /**\r\n * Returns whether an element will successfully validate based on forms validation rules and constraints.\r\n */\r\n readonly willValidate: boolean;\r\n /**\r\n * Sets or retrieves how to handle wordwrapping in the object.\r\n */\r\n wrap: string;\r\n minLength: number;\r\n /**\r\n * Returns whether a form will validate when it is submitted, without having to submit it.\r\n */\r\n checkValidity(): boolean;\r\n /**\r\n * Highlights the input area of a form element.\r\n */\r\n select(): void;\r\n /**\r\n * Sets a custom error message that is displayed when a form is submitted.\r\n * @param error Sets a custom error message that is displayed when a form is submitted.\r\n */\r\n setCustomValidity(error: string): void;\r\n /**\r\n * Sets the start and end positions of a selection in a text field.\r\n * @param start The offset into the text field for the start of the selection.\r\n * @param end The offset into the text field for the end of the selection.\r\n */\r\n setSelectionRange(start: number, end: number): void;\r\n}\r\n\r\ndeclare var HTMLTextAreaElement: {\r\n prototype: HTMLTextAreaElement;\r\n new(): HTMLTextAreaElement;\r\n}\r\n\r\ninterface HTMLTitleElement extends HTMLElement {\r\n /**\r\n * Retrieves or sets the text of the object as a string. \r\n */\r\n text: string;\r\n}\r\n\r\ndeclare var HTMLTitleElement: {\r\n prototype: HTMLTitleElement;\r\n new(): HTMLTitleElement;\r\n}\r\n\r\ninterface HTMLTrackElement extends HTMLElement {\r\n default: boolean;\r\n kind: string;\r\n label: string;\r\n readonly readyState: number;\r\n src: string;\r\n srclang: string;\r\n readonly track: TextTrack;\r\n readonly ERROR: number;\r\n readonly LOADED: number;\r\n readonly LOADING: number;\r\n readonly NONE: number;\r\n}\r\n\r\ndeclare var HTMLTrackElement: {\r\n prototype: HTMLTrackElement;\r\n new(): HTMLTrackElement;\r\n readonly ERROR: number;\r\n readonly LOADED: number;\r\n readonly LOADING: number;\r\n readonly NONE: number;\r\n}\r\n\r\ninterface HTMLUListElement extends HTMLElement {\r\n compact: boolean;\r\n type: string;\r\n}\r\n\r\ndeclare var HTMLUListElement: {\r\n prototype: HTMLUListElement;\r\n new(): HTMLUListElement;\r\n}\r\n\r\ninterface HTMLUnknownElement extends HTMLElement {\r\n}\r\n\r\ndeclare var HTMLUnknownElement: {\r\n prototype: HTMLUnknownElement;\r\n new(): HTMLUnknownElement;\r\n}\r\n\r\ninterface HTMLVideoElement extends HTMLMediaElement {\r\n /**\r\n * Gets or sets the height of the video element.\r\n */\r\n height: number;\r\n msHorizontalMirror: boolean;\r\n readonly msIsLayoutOptimalForPlayback: boolean;\r\n readonly msIsStereo3D: boolean;\r\n msStereo3DPackingMode: string;\r\n msStereo3DRenderMode: string;\r\n msZoom: boolean;\r\n onMSVideoFormatChanged: (this: this, ev: Event) => any;\r\n onMSVideoFrameStepCompleted: (this: this, ev: Event) => any;\r\n onMSVideoOptimalLayoutChanged: (this: this, ev: Event) => any;\r\n /**\r\n * 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.\r\n */\r\n poster: string;\r\n /**\r\n * Gets the intrinsic height of a video in CSS pixels, or zero if the dimensions are not known.\r\n */\r\n readonly videoHeight: number;\r\n /**\r\n * Gets the intrinsic width of a video in CSS pixels, or zero if the dimensions are not known.\r\n */\r\n readonly videoWidth: number;\r\n readonly webkitDisplayingFullscreen: boolean;\r\n readonly webkitSupportsFullscreen: boolean;\r\n /**\r\n * Gets or sets the width of the video element.\r\n */\r\n width: number;\r\n getVideoPlaybackQuality(): VideoPlaybackQuality;\r\n msFrameStep(forward: boolean): void;\r\n msInsertVideoEffect(activatableClassId: string, effectRequired: boolean, config?: any): void;\r\n msSetVideoRectangle(left: number, top: number, right: number, bottom: number): void;\r\n webkitEnterFullScreen(): void;\r\n webkitEnterFullscreen(): void;\r\n webkitExitFullScreen(): void;\r\n webkitExitFullscreen(): void;\r\n addEventListener(type: \"MSContentZoom\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureChange\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureDoubleTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureEnd\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureHold\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGotPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSInertiaStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSLostPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSManipulationStateChanged\", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerCancel\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerDown\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerEnter\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerLeave\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerMove\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOut\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOver\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerUp\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSVideoFormatChanged\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSVideoFrameStepCompleted\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSVideoOptimalLayoutChanged\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"abort\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"activate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ariarequest\", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforecopy\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforecut\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforedeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforepaste\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"blur\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplay\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplaythrough\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"change\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"click\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"command\", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"contextmenu\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"copy\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"cuechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"cut\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dblclick\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"deactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drag\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragend\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragenter\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragleave\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragover\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragstart\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drop\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"durationchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"emptied\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"encrypted\", listener: (this: this, ev: MediaEncryptedEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ended\", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"focus\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"gotpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"input\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"invalid\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keydown\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keypress\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keyup\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadeddata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadedmetadata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"lostpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousedown\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseenter\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseleave\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousemove\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseout\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseover\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseup\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousewheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"msneedkey\", listener: (this: this, ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"paste\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pause\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"play\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"playing\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointercancel\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerdown\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerenter\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerleave\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointermove\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerout\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerover\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerup\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"progress\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ratechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"reset\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"scroll\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeked\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeking\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"select\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"selectstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"stalled\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"submit\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"suspend\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"timeupdate\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchcancel\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchend\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchmove\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchstart\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"volumechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"waiting\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenerror\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"wheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLVideoElement: {\r\n prototype: HTMLVideoElement;\r\n new(): HTMLVideoElement;\r\n}\r\n\r\ninterface HashChangeEvent extends Event {\r\n readonly newURL: string | null;\r\n readonly oldURL: string | null;\r\n}\r\n\r\ndeclare var HashChangeEvent: {\r\n prototype: HashChangeEvent;\r\n new(type: string, eventInitDict?: HashChangeEventInit): HashChangeEvent;\r\n}\r\n\r\ninterface History {\r\n readonly length: number;\r\n readonly state: any;\r\n back(distance?: any): void;\r\n forward(distance?: any): void;\r\n go(delta?: any): void;\r\n pushState(statedata: any, title?: string, url?: string): void;\r\n replaceState(statedata: any, title?: string, url?: string): void;\r\n}\r\n\r\ndeclare var History: {\r\n prototype: History;\r\n new(): History;\r\n}\r\n\r\ninterface IDBCursor {\r\n readonly direction: string;\r\n key: IDBKeyRange | IDBValidKey;\r\n readonly primaryKey: any;\r\n source: IDBObjectStore | IDBIndex;\r\n advance(count: number): void;\r\n continue(key?: IDBKeyRange | IDBValidKey): void;\r\n delete(): IDBRequest;\r\n update(value: any): IDBRequest;\r\n readonly NEXT: string;\r\n readonly NEXT_NO_DUPLICATE: string;\r\n readonly PREV: string;\r\n readonly PREV_NO_DUPLICATE: string;\r\n}\r\n\r\ndeclare var IDBCursor: {\r\n prototype: IDBCursor;\r\n new(): IDBCursor;\r\n readonly NEXT: string;\r\n readonly NEXT_NO_DUPLICATE: string;\r\n readonly PREV: string;\r\n readonly PREV_NO_DUPLICATE: string;\r\n}\r\n\r\ninterface IDBCursorWithValue extends IDBCursor {\r\n readonly value: any;\r\n}\r\n\r\ndeclare var IDBCursorWithValue: {\r\n prototype: IDBCursorWithValue;\r\n new(): IDBCursorWithValue;\r\n}\r\n\r\ninterface IDBDatabase extends EventTarget {\r\n readonly name: string;\r\n readonly objectStoreNames: DOMStringList;\r\n onabort: (this: this, ev: Event) => any;\r\n onerror: (this: this, ev: ErrorEvent) => any;\r\n version: number;\r\n onversionchange: (ev: IDBVersionChangeEvent) => any;\r\n close(): void;\r\n createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore;\r\n deleteObjectStore(name: string): void;\r\n transaction(storeNames: string | string[], mode?: string): IDBTransaction;\r\n addEventListener(type: \"versionchange\", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"abort\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var IDBDatabase: {\r\n prototype: IDBDatabase;\r\n new(): IDBDatabase;\r\n}\r\n\r\ninterface IDBFactory {\r\n cmp(first: any, second: any): number;\r\n deleteDatabase(name: string): IDBOpenDBRequest;\r\n open(name: string, version?: number): IDBOpenDBRequest;\r\n}\r\n\r\ndeclare var IDBFactory: {\r\n prototype: IDBFactory;\r\n new(): IDBFactory;\r\n}\r\n\r\ninterface IDBIndex {\r\n keyPath: string | string[];\r\n readonly name: string;\r\n readonly objectStore: IDBObjectStore;\r\n readonly unique: boolean;\r\n multiEntry: boolean;\r\n count(key?: IDBKeyRange | IDBValidKey): IDBRequest;\r\n get(key: IDBKeyRange | IDBValidKey): IDBRequest;\r\n getKey(key: IDBKeyRange | IDBValidKey): IDBRequest;\r\n openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest;\r\n openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest;\r\n}\r\n\r\ndeclare var IDBIndex: {\r\n prototype: IDBIndex;\r\n new(): IDBIndex;\r\n}\r\n\r\ninterface IDBKeyRange {\r\n readonly lower: any;\r\n readonly lowerOpen: boolean;\r\n readonly upper: any;\r\n readonly upperOpen: boolean;\r\n}\r\n\r\ndeclare var IDBKeyRange: {\r\n prototype: IDBKeyRange;\r\n new(): IDBKeyRange;\r\n bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange;\r\n lowerBound(lower: any, open?: boolean): IDBKeyRange;\r\n only(value: any): IDBKeyRange;\r\n upperBound(upper: any, open?: boolean): IDBKeyRange;\r\n}\r\n\r\ninterface IDBObjectStore {\r\n readonly indexNames: DOMStringList;\r\n keyPath: string | string[];\r\n readonly name: string;\r\n readonly transaction: IDBTransaction;\r\n autoIncrement: boolean;\r\n add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest;\r\n clear(): IDBRequest;\r\n count(key?: IDBKeyRange | IDBValidKey): IDBRequest;\r\n createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex;\r\n delete(key: IDBKeyRange | IDBValidKey): IDBRequest;\r\n deleteIndex(indexName: string): void;\r\n get(key: any): IDBRequest;\r\n index(name: string): IDBIndex;\r\n openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest;\r\n put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest;\r\n}\r\n\r\ndeclare var IDBObjectStore: {\r\n prototype: IDBObjectStore;\r\n new(): IDBObjectStore;\r\n}\r\n\r\ninterface IDBOpenDBRequest extends IDBRequest {\r\n onblocked: (this: this, ev: Event) => any;\r\n onupgradeneeded: (this: this, ev: IDBVersionChangeEvent) => any;\r\n addEventListener(type: \"blocked\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"success\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"upgradeneeded\", listener: (this: this, ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var IDBOpenDBRequest: {\r\n prototype: IDBOpenDBRequest;\r\n new(): IDBOpenDBRequest;\r\n}\r\n\r\ninterface IDBRequest extends EventTarget {\r\n readonly error: DOMError;\r\n onerror: (this: this, ev: ErrorEvent) => any;\r\n onsuccess: (this: this, ev: Event) => any;\r\n readonly readyState: string;\r\n readonly result: any;\r\n source: IDBObjectStore | IDBIndex | IDBCursor;\r\n readonly transaction: IDBTransaction;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"success\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var IDBRequest: {\r\n prototype: IDBRequest;\r\n new(): IDBRequest;\r\n}\r\n\r\ninterface IDBTransaction extends EventTarget {\r\n readonly db: IDBDatabase;\r\n readonly error: DOMError;\r\n readonly mode: string;\r\n onabort: (this: this, ev: Event) => any;\r\n oncomplete: (this: this, ev: Event) => any;\r\n onerror: (this: this, ev: ErrorEvent) => any;\r\n abort(): void;\r\n objectStore(name: string): IDBObjectStore;\r\n readonly READ_ONLY: string;\r\n readonly READ_WRITE: string;\r\n readonly VERSION_CHANGE: string;\r\n addEventListener(type: \"abort\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"complete\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var IDBTransaction: {\r\n prototype: IDBTransaction;\r\n new(): IDBTransaction;\r\n readonly READ_ONLY: string;\r\n readonly READ_WRITE: string;\r\n readonly VERSION_CHANGE: string;\r\n}\r\n\r\ninterface IDBVersionChangeEvent extends Event {\r\n readonly newVersion: number | null;\r\n readonly oldVersion: number;\r\n}\r\n\r\ndeclare var IDBVersionChangeEvent: {\r\n prototype: IDBVersionChangeEvent;\r\n new(): IDBVersionChangeEvent;\r\n}\r\n\r\ninterface ImageData {\r\n data: Uint8ClampedArray;\r\n readonly height: number;\r\n readonly width: number;\r\n}\r\n\r\ndeclare var ImageData: {\r\n prototype: ImageData;\r\n new(width: number, height: number): ImageData;\r\n new(array: Uint8ClampedArray, width: number, height: number): ImageData;\r\n}\r\n\r\ninterface KeyboardEvent extends UIEvent {\r\n readonly altKey: boolean;\r\n readonly char: string | null;\r\n readonly charCode: number;\r\n readonly ctrlKey: boolean;\r\n readonly key: string;\r\n readonly keyCode: number;\r\n readonly locale: string;\r\n readonly location: number;\r\n readonly metaKey: boolean;\r\n readonly repeat: boolean;\r\n readonly shiftKey: boolean;\r\n readonly which: number;\r\n readonly code: string;\r\n getModifierState(keyArg: string): boolean;\r\n initKeyboardEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, keyArg: string, locationArg: number, modifiersListArg: string, repeat: boolean, locale: string): void;\r\n readonly DOM_KEY_LOCATION_JOYSTICK: number;\r\n readonly DOM_KEY_LOCATION_LEFT: number;\r\n readonly DOM_KEY_LOCATION_MOBILE: number;\r\n readonly DOM_KEY_LOCATION_NUMPAD: number;\r\n readonly DOM_KEY_LOCATION_RIGHT: number;\r\n readonly DOM_KEY_LOCATION_STANDARD: number;\r\n}\r\n\r\ndeclare var KeyboardEvent: {\r\n prototype: KeyboardEvent;\r\n new(typeArg: string, eventInitDict?: KeyboardEventInit): KeyboardEvent;\r\n readonly DOM_KEY_LOCATION_JOYSTICK: number;\r\n readonly DOM_KEY_LOCATION_LEFT: number;\r\n readonly DOM_KEY_LOCATION_MOBILE: number;\r\n readonly DOM_KEY_LOCATION_NUMPAD: number;\r\n readonly DOM_KEY_LOCATION_RIGHT: number;\r\n readonly DOM_KEY_LOCATION_STANDARD: number;\r\n}\r\n\r\ninterface ListeningStateChangedEvent extends Event {\r\n readonly label: string;\r\n readonly state: string;\r\n}\r\n\r\ndeclare var ListeningStateChangedEvent: {\r\n prototype: ListeningStateChangedEvent;\r\n new(): ListeningStateChangedEvent;\r\n}\r\n\r\ninterface Location {\r\n hash: string;\r\n host: string;\r\n hostname: string;\r\n href: string;\r\n readonly origin: string;\r\n pathname: string;\r\n port: string;\r\n protocol: string;\r\n search: string;\r\n assign(url: string): void;\r\n reload(forcedReload?: boolean): void;\r\n replace(url: string): void;\r\n toString(): string;\r\n}\r\n\r\ndeclare var Location: {\r\n prototype: Location;\r\n new(): Location;\r\n}\r\n\r\ninterface LongRunningScriptDetectedEvent extends Event {\r\n readonly executionTime: number;\r\n stopPageScriptExecution: boolean;\r\n}\r\n\r\ndeclare var LongRunningScriptDetectedEvent: {\r\n prototype: LongRunningScriptDetectedEvent;\r\n new(): LongRunningScriptDetectedEvent;\r\n}\r\n\r\ninterface MSApp {\r\n clearTemporaryWebDataAsync(): MSAppAsyncOperation;\r\n createBlobFromRandomAccessStream(type: string, seeker: any): Blob;\r\n createDataPackage(object: any): any;\r\n createDataPackageFromSelection(): any;\r\n createFileFromStorageFile(storageFile: any): File;\r\n createStreamFromInputStream(type: string, inputStream: any): MSStream;\r\n execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void;\r\n execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any;\r\n getCurrentPriority(): string;\r\n getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike;\r\n getViewId(view: any): any;\r\n isTaskScheduledAtPriorityOrHigher(priority: string): boolean;\r\n pageHandlesAllApplicationActivations(enabled: boolean): void;\r\n suppressSubdownloadCredentialPrompts(suppress: boolean): void;\r\n terminateApp(exceptionObject: any): void;\r\n readonly CURRENT: string;\r\n readonly HIGH: string;\r\n readonly IDLE: string;\r\n readonly NORMAL: string;\r\n}\r\ndeclare var MSApp: MSApp;\r\n\r\ninterface MSAppAsyncOperation extends EventTarget {\r\n readonly error: DOMError;\r\n oncomplete: (this: this, ev: Event) => any;\r\n onerror: (this: this, ev: ErrorEvent) => any;\r\n readonly readyState: number;\r\n readonly result: any;\r\n start(): void;\r\n readonly COMPLETED: number;\r\n readonly ERROR: number;\r\n readonly STARTED: number;\r\n addEventListener(type: \"complete\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var MSAppAsyncOperation: {\r\n prototype: MSAppAsyncOperation;\r\n new(): MSAppAsyncOperation;\r\n readonly COMPLETED: number;\r\n readonly ERROR: number;\r\n readonly STARTED: number;\r\n}\r\n\r\ninterface MSAssertion {\r\n readonly id: string;\r\n readonly type: string;\r\n}\r\n\r\ndeclare var MSAssertion: {\r\n prototype: MSAssertion;\r\n new(): MSAssertion;\r\n}\r\n\r\ninterface MSBlobBuilder {\r\n append(data: any, endings?: string): void;\r\n getBlob(contentType?: string): Blob;\r\n}\r\n\r\ndeclare var MSBlobBuilder: {\r\n prototype: MSBlobBuilder;\r\n new(): MSBlobBuilder;\r\n}\r\n\r\ninterface MSCredentials {\r\n getAssertion(challenge: string, filter?: MSCredentialFilter, params?: MSSignatureParameters): PromiseLike;\r\n makeCredential(accountInfo: MSAccountInfo, params: MSCredentialParameters[], challenge?: string): PromiseLike;\r\n}\r\n\r\ndeclare var MSCredentials: {\r\n prototype: MSCredentials;\r\n new(): MSCredentials;\r\n}\r\n\r\ninterface MSFIDOCredentialAssertion extends MSAssertion {\r\n readonly algorithm: string | Algorithm;\r\n readonly attestation: any;\r\n readonly publicKey: string;\r\n readonly transportHints: string[];\r\n}\r\n\r\ndeclare var MSFIDOCredentialAssertion: {\r\n prototype: MSFIDOCredentialAssertion;\r\n new(): MSFIDOCredentialAssertion;\r\n}\r\n\r\ninterface MSFIDOSignature {\r\n readonly authnrData: string;\r\n readonly clientData: string;\r\n readonly signature: string;\r\n}\r\n\r\ndeclare var MSFIDOSignature: {\r\n prototype: MSFIDOSignature;\r\n new(): MSFIDOSignature;\r\n}\r\n\r\ninterface MSFIDOSignatureAssertion extends MSAssertion {\r\n readonly signature: MSFIDOSignature;\r\n}\r\n\r\ndeclare var MSFIDOSignatureAssertion: {\r\n prototype: MSFIDOSignatureAssertion;\r\n new(): MSFIDOSignatureAssertion;\r\n}\r\n\r\ninterface MSGesture {\r\n target: Element;\r\n addPointer(pointerId: number): void;\r\n stop(): void;\r\n}\r\n\r\ndeclare var MSGesture: {\r\n prototype: MSGesture;\r\n new(): MSGesture;\r\n}\r\n\r\ninterface MSGestureEvent extends UIEvent {\r\n readonly clientX: number;\r\n readonly clientY: number;\r\n readonly expansion: number;\r\n readonly gestureObject: any;\r\n readonly hwTimestamp: number;\r\n readonly offsetX: number;\r\n readonly offsetY: number;\r\n readonly rotation: number;\r\n readonly scale: number;\r\n readonly screenX: number;\r\n readonly screenY: number;\r\n readonly translationX: number;\r\n readonly translationY: number;\r\n readonly velocityAngular: number;\r\n readonly velocityExpansion: number;\r\n readonly velocityX: number;\r\n readonly velocityY: number;\r\n initGestureEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, offsetXArg: number, offsetYArg: number, translationXArg: number, translationYArg: number, scaleArg: number, expansionArg: number, rotationArg: number, velocityXArg: number, velocityYArg: number, velocityExpansionArg: number, velocityAngularArg: number, hwTimestampArg: number): void;\r\n readonly MSGESTURE_FLAG_BEGIN: number;\r\n readonly MSGESTURE_FLAG_CANCEL: number;\r\n readonly MSGESTURE_FLAG_END: number;\r\n readonly MSGESTURE_FLAG_INERTIA: number;\r\n readonly MSGESTURE_FLAG_NONE: number;\r\n}\r\n\r\ndeclare var MSGestureEvent: {\r\n prototype: MSGestureEvent;\r\n new(): MSGestureEvent;\r\n readonly MSGESTURE_FLAG_BEGIN: number;\r\n readonly MSGESTURE_FLAG_CANCEL: number;\r\n readonly MSGESTURE_FLAG_END: number;\r\n readonly MSGESTURE_FLAG_INERTIA: number;\r\n readonly MSGESTURE_FLAG_NONE: number;\r\n}\r\n\r\ninterface MSGraphicsTrust {\r\n readonly constrictionActive: boolean;\r\n readonly status: string;\r\n}\r\n\r\ndeclare var MSGraphicsTrust: {\r\n prototype: MSGraphicsTrust;\r\n new(): MSGraphicsTrust;\r\n}\r\n\r\ninterface MSHTMLWebViewElement extends HTMLElement {\r\n readonly canGoBack: boolean;\r\n readonly canGoForward: boolean;\r\n readonly containsFullScreenElement: boolean;\r\n readonly documentTitle: string;\r\n height: number;\r\n readonly settings: MSWebViewSettings;\r\n src: string;\r\n width: number;\r\n addWebAllowedObject(name: string, applicationObject: any): void;\r\n buildLocalStreamUri(contentIdentifier: string, relativePath: string): string;\r\n capturePreviewToBlobAsync(): MSWebViewAsyncOperation;\r\n captureSelectedContentToDataPackageAsync(): MSWebViewAsyncOperation;\r\n getDeferredPermissionRequestById(id: number): DeferredPermissionRequest;\r\n getDeferredPermissionRequests(): DeferredPermissionRequest[];\r\n goBack(): void;\r\n goForward(): void;\r\n invokeScriptAsync(scriptName: string, ...args: any[]): MSWebViewAsyncOperation;\r\n navigate(uri: string): void;\r\n navigateToLocalStreamUri(source: string, streamResolver: any): void;\r\n navigateToString(contents: string): void;\r\n navigateWithHttpRequestMessage(requestMessage: any): void;\r\n refresh(): void;\r\n stop(): void;\r\n}\r\n\r\ndeclare var MSHTMLWebViewElement: {\r\n prototype: MSHTMLWebViewElement;\r\n new(): MSHTMLWebViewElement;\r\n}\r\n\r\ninterface MSInputMethodContext extends EventTarget {\r\n readonly compositionEndOffset: number;\r\n readonly compositionStartOffset: number;\r\n oncandidatewindowhide: (this: this, ev: Event) => any;\r\n oncandidatewindowshow: (this: this, ev: Event) => any;\r\n oncandidatewindowupdate: (this: this, ev: Event) => any;\r\n readonly target: HTMLElement;\r\n getCandidateWindowClientRect(): ClientRect;\r\n getCompositionAlternatives(): string[];\r\n hasComposition(): boolean;\r\n isCandidateWindowVisible(): boolean;\r\n addEventListener(type: \"MSCandidateWindowHide\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSCandidateWindowShow\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSCandidateWindowUpdate\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var MSInputMethodContext: {\r\n prototype: MSInputMethodContext;\r\n new(): MSInputMethodContext;\r\n}\r\n\r\ninterface MSManipulationEvent extends UIEvent {\r\n readonly currentState: number;\r\n readonly inertiaDestinationX: number;\r\n readonly inertiaDestinationY: number;\r\n readonly lastState: number;\r\n initMSManipulationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, lastState: number, currentState: number): void;\r\n readonly MS_MANIPULATION_STATE_ACTIVE: number;\r\n readonly MS_MANIPULATION_STATE_CANCELLED: number;\r\n readonly MS_MANIPULATION_STATE_COMMITTED: number;\r\n readonly MS_MANIPULATION_STATE_DRAGGING: number;\r\n readonly MS_MANIPULATION_STATE_INERTIA: number;\r\n readonly MS_MANIPULATION_STATE_PRESELECT: number;\r\n readonly MS_MANIPULATION_STATE_SELECTING: number;\r\n readonly MS_MANIPULATION_STATE_STOPPED: number;\r\n}\r\n\r\ndeclare var MSManipulationEvent: {\r\n prototype: MSManipulationEvent;\r\n new(): MSManipulationEvent;\r\n readonly MS_MANIPULATION_STATE_ACTIVE: number;\r\n readonly MS_MANIPULATION_STATE_CANCELLED: number;\r\n readonly MS_MANIPULATION_STATE_COMMITTED: number;\r\n readonly MS_MANIPULATION_STATE_DRAGGING: number;\r\n readonly MS_MANIPULATION_STATE_INERTIA: number;\r\n readonly MS_MANIPULATION_STATE_PRESELECT: number;\r\n readonly MS_MANIPULATION_STATE_SELECTING: number;\r\n readonly MS_MANIPULATION_STATE_STOPPED: number;\r\n}\r\n\r\ninterface MSMediaKeyError {\r\n readonly code: number;\r\n readonly systemCode: number;\r\n readonly MS_MEDIA_KEYERR_CLIENT: number;\r\n readonly MS_MEDIA_KEYERR_DOMAIN: number;\r\n readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number;\r\n readonly MS_MEDIA_KEYERR_OUTPUT: number;\r\n readonly MS_MEDIA_KEYERR_SERVICE: number;\r\n readonly MS_MEDIA_KEYERR_UNKNOWN: number;\r\n}\r\n\r\ndeclare var MSMediaKeyError: {\r\n prototype: MSMediaKeyError;\r\n new(): MSMediaKeyError;\r\n readonly MS_MEDIA_KEYERR_CLIENT: number;\r\n readonly MS_MEDIA_KEYERR_DOMAIN: number;\r\n readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number;\r\n readonly MS_MEDIA_KEYERR_OUTPUT: number;\r\n readonly MS_MEDIA_KEYERR_SERVICE: number;\r\n readonly MS_MEDIA_KEYERR_UNKNOWN: number;\r\n}\r\n\r\ninterface MSMediaKeyMessageEvent extends Event {\r\n readonly destinationURL: string | null;\r\n readonly message: Uint8Array;\r\n}\r\n\r\ndeclare var MSMediaKeyMessageEvent: {\r\n prototype: MSMediaKeyMessageEvent;\r\n new(): MSMediaKeyMessageEvent;\r\n}\r\n\r\ninterface MSMediaKeyNeededEvent extends Event {\r\n readonly initData: Uint8Array | null;\r\n}\r\n\r\ndeclare var MSMediaKeyNeededEvent: {\r\n prototype: MSMediaKeyNeededEvent;\r\n new(): MSMediaKeyNeededEvent;\r\n}\r\n\r\ninterface MSMediaKeySession extends EventTarget {\r\n readonly error: MSMediaKeyError | null;\r\n readonly keySystem: string;\r\n readonly sessionId: string;\r\n close(): void;\r\n update(key: Uint8Array): void;\r\n}\r\n\r\ndeclare var MSMediaKeySession: {\r\n prototype: MSMediaKeySession;\r\n new(): MSMediaKeySession;\r\n}\r\n\r\ninterface MSMediaKeys {\r\n readonly keySystem: string;\r\n createSession(type: string, initData: Uint8Array, cdmData?: Uint8Array): MSMediaKeySession;\r\n}\r\n\r\ndeclare var MSMediaKeys: {\r\n prototype: MSMediaKeys;\r\n new(keySystem: string): MSMediaKeys;\r\n isTypeSupported(keySystem: string, type?: string): boolean;\r\n isTypeSupportedWithFeatures(keySystem: string, type?: string): string;\r\n}\r\n\r\ninterface MSPointerEvent extends MouseEvent {\r\n readonly currentPoint: any;\r\n readonly height: number;\r\n readonly hwTimestamp: number;\r\n readonly intermediatePoints: any;\r\n readonly isPrimary: boolean;\r\n readonly pointerId: number;\r\n readonly pointerType: any;\r\n readonly pressure: number;\r\n readonly rotation: number;\r\n readonly tiltX: number;\r\n readonly tiltY: number;\r\n readonly width: number;\r\n getCurrentPoint(element: Element): void;\r\n getIntermediatePoints(element: Element): void;\r\n initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void;\r\n}\r\n\r\ndeclare var MSPointerEvent: {\r\n prototype: MSPointerEvent;\r\n new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent;\r\n}\r\n\r\ninterface MSRangeCollection {\r\n readonly length: number;\r\n item(index: number): Range;\r\n [index: number]: Range;\r\n}\r\n\r\ndeclare var MSRangeCollection: {\r\n prototype: MSRangeCollection;\r\n new(): MSRangeCollection;\r\n}\r\n\r\ninterface MSSiteModeEvent extends Event {\r\n readonly actionURL: string;\r\n readonly buttonID: number;\r\n}\r\n\r\ndeclare var MSSiteModeEvent: {\r\n prototype: MSSiteModeEvent;\r\n new(): MSSiteModeEvent;\r\n}\r\n\r\ninterface MSStream {\r\n readonly type: string;\r\n msClose(): void;\r\n msDetachStream(): any;\r\n}\r\n\r\ndeclare var MSStream: {\r\n prototype: MSStream;\r\n new(): MSStream;\r\n}\r\n\r\ninterface MSStreamReader extends EventTarget, MSBaseReader {\r\n readonly error: DOMError;\r\n readAsArrayBuffer(stream: MSStream, size?: number): void;\r\n readAsBinaryString(stream: MSStream, size?: number): void;\r\n readAsBlob(stream: MSStream, size?: number): void;\r\n readAsDataURL(stream: MSStream, size?: number): void;\r\n readAsText(stream: MSStream, encoding?: string, size?: number): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var MSStreamReader: {\r\n prototype: MSStreamReader;\r\n new(): MSStreamReader;\r\n}\r\n\r\ninterface MSWebViewAsyncOperation extends EventTarget {\r\n readonly error: DOMError;\r\n oncomplete: (this: this, ev: Event) => any;\r\n onerror: (this: this, ev: ErrorEvent) => any;\r\n readonly readyState: number;\r\n readonly result: any;\r\n readonly target: MSHTMLWebViewElement;\r\n readonly type: number;\r\n start(): void;\r\n readonly COMPLETED: number;\r\n readonly ERROR: number;\r\n readonly STARTED: number;\r\n readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number;\r\n readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number;\r\n readonly TYPE_INVOKE_SCRIPT: number;\r\n addEventListener(type: \"complete\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var MSWebViewAsyncOperation: {\r\n prototype: MSWebViewAsyncOperation;\r\n new(): MSWebViewAsyncOperation;\r\n readonly COMPLETED: number;\r\n readonly ERROR: number;\r\n readonly STARTED: number;\r\n readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number;\r\n readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number;\r\n readonly TYPE_INVOKE_SCRIPT: number;\r\n}\r\n\r\ninterface MSWebViewSettings {\r\n isIndexedDBEnabled: boolean;\r\n isJavaScriptEnabled: boolean;\r\n}\r\n\r\ndeclare var MSWebViewSettings: {\r\n prototype: MSWebViewSettings;\r\n new(): MSWebViewSettings;\r\n}\r\n\r\ninterface MediaDeviceInfo {\r\n readonly deviceId: string;\r\n readonly groupId: string;\r\n readonly kind: string;\r\n readonly label: string;\r\n}\r\n\r\ndeclare var MediaDeviceInfo: {\r\n prototype: MediaDeviceInfo;\r\n new(): MediaDeviceInfo;\r\n}\r\n\r\ninterface MediaDevices extends EventTarget {\r\n ondevicechange: (this: this, ev: Event) => any;\r\n enumerateDevices(): any;\r\n getSupportedConstraints(): MediaTrackSupportedConstraints;\r\n getUserMedia(constraints: MediaStreamConstraints): PromiseLike;\r\n addEventListener(type: \"devicechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var MediaDevices: {\r\n prototype: MediaDevices;\r\n new(): MediaDevices;\r\n}\r\n\r\ninterface MediaElementAudioSourceNode extends AudioNode {\r\n}\r\n\r\ndeclare var MediaElementAudioSourceNode: {\r\n prototype: MediaElementAudioSourceNode;\r\n new(): MediaElementAudioSourceNode;\r\n}\r\n\r\ninterface MediaEncryptedEvent extends Event {\r\n readonly initData: ArrayBuffer | null;\r\n readonly initDataType: string;\r\n}\r\n\r\ndeclare var MediaEncryptedEvent: {\r\n prototype: MediaEncryptedEvent;\r\n new(type: string, eventInitDict?: MediaEncryptedEventInit): MediaEncryptedEvent;\r\n}\r\n\r\ninterface MediaError {\r\n readonly code: number;\r\n readonly msExtendedCode: number;\r\n readonly MEDIA_ERR_ABORTED: number;\r\n readonly MEDIA_ERR_DECODE: number;\r\n readonly MEDIA_ERR_NETWORK: number;\r\n readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number;\r\n readonly MS_MEDIA_ERR_ENCRYPTED: number;\r\n}\r\n\r\ndeclare var MediaError: {\r\n prototype: MediaError;\r\n new(): MediaError;\r\n readonly MEDIA_ERR_ABORTED: number;\r\n readonly MEDIA_ERR_DECODE: number;\r\n readonly MEDIA_ERR_NETWORK: number;\r\n readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number;\r\n readonly MS_MEDIA_ERR_ENCRYPTED: number;\r\n}\r\n\r\ninterface MediaKeyMessageEvent extends Event {\r\n readonly message: ArrayBuffer;\r\n readonly messageType: string;\r\n}\r\n\r\ndeclare var MediaKeyMessageEvent: {\r\n prototype: MediaKeyMessageEvent;\r\n new(type: string, eventInitDict?: MediaKeyMessageEventInit): MediaKeyMessageEvent;\r\n}\r\n\r\ninterface MediaKeySession extends EventTarget {\r\n readonly closed: PromiseLike;\r\n readonly expiration: number;\r\n readonly keyStatuses: MediaKeyStatusMap;\r\n readonly sessionId: string;\r\n close(): PromiseLike;\r\n generateRequest(initDataType: string, initData: any): PromiseLike;\r\n load(sessionId: string): PromiseLike;\r\n remove(): PromiseLike;\r\n update(response: any): PromiseLike;\r\n}\r\n\r\ndeclare var MediaKeySession: {\r\n prototype: MediaKeySession;\r\n new(): MediaKeySession;\r\n}\r\n\r\ninterface MediaKeyStatusMap {\r\n readonly size: number;\r\n forEach(callback: ForEachCallback): void;\r\n get(keyId: any): string;\r\n has(keyId: any): boolean;\r\n}\r\n\r\ndeclare var MediaKeyStatusMap: {\r\n prototype: MediaKeyStatusMap;\r\n new(): MediaKeyStatusMap;\r\n}\r\n\r\ninterface MediaKeySystemAccess {\r\n readonly keySystem: string;\r\n createMediaKeys(): PromiseLike;\r\n getConfiguration(): MediaKeySystemConfiguration;\r\n}\r\n\r\ndeclare var MediaKeySystemAccess: {\r\n prototype: MediaKeySystemAccess;\r\n new(): MediaKeySystemAccess;\r\n}\r\n\r\ninterface MediaKeys {\r\n createSession(sessionType?: string): MediaKeySession;\r\n setServerCertificate(serverCertificate: any): PromiseLike;\r\n}\r\n\r\ndeclare var MediaKeys: {\r\n prototype: MediaKeys;\r\n new(): MediaKeys;\r\n}\r\n\r\ninterface MediaList {\r\n readonly length: number;\r\n mediaText: string;\r\n appendMedium(newMedium: string): void;\r\n deleteMedium(oldMedium: string): void;\r\n item(index: number): string;\r\n toString(): string;\r\n [index: number]: string;\r\n}\r\n\r\ndeclare var MediaList: {\r\n prototype: MediaList;\r\n new(): MediaList;\r\n}\r\n\r\ninterface MediaQueryList {\r\n readonly matches: boolean;\r\n readonly media: string;\r\n addListener(listener: MediaQueryListListener): void;\r\n removeListener(listener: MediaQueryListListener): void;\r\n}\r\n\r\ndeclare var MediaQueryList: {\r\n prototype: MediaQueryList;\r\n new(): MediaQueryList;\r\n}\r\n\r\ninterface MediaSource extends EventTarget {\r\n readonly activeSourceBuffers: SourceBufferList;\r\n duration: number;\r\n readonly readyState: string;\r\n readonly sourceBuffers: SourceBufferList;\r\n addSourceBuffer(type: string): SourceBuffer;\r\n endOfStream(error?: number): void;\r\n removeSourceBuffer(sourceBuffer: SourceBuffer): void;\r\n}\r\n\r\ndeclare var MediaSource: {\r\n prototype: MediaSource;\r\n new(): MediaSource;\r\n isTypeSupported(type: string): boolean;\r\n}\r\n\r\ninterface MediaStream extends EventTarget {\r\n readonly active: boolean;\r\n readonly id: string;\r\n onactive: (this: this, ev: Event) => any;\r\n onaddtrack: (this: this, ev: TrackEvent) => any;\r\n oninactive: (this: this, ev: Event) => any;\r\n onremovetrack: (this: this, ev: TrackEvent) => any;\r\n addTrack(track: MediaStreamTrack): void;\r\n clone(): MediaStream;\r\n getAudioTracks(): MediaStreamTrack[];\r\n getTrackById(trackId: string): MediaStreamTrack | null;\r\n getTracks(): MediaStreamTrack[];\r\n getVideoTracks(): MediaStreamTrack[];\r\n removeTrack(track: MediaStreamTrack): void;\r\n stop(): void;\r\n addEventListener(type: \"active\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"addtrack\", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"inactive\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"removetrack\", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var MediaStream: {\r\n prototype: MediaStream;\r\n new(streamOrTracks?: MediaStream | MediaStreamTrack[]): MediaStream;\r\n}\r\n\r\ninterface MediaStreamAudioSourceNode extends AudioNode {\r\n}\r\n\r\ndeclare var MediaStreamAudioSourceNode: {\r\n prototype: MediaStreamAudioSourceNode;\r\n new(): MediaStreamAudioSourceNode;\r\n}\r\n\r\ninterface MediaStreamError {\r\n readonly constraintName: string | null;\r\n readonly message: string | null;\r\n readonly name: string;\r\n}\r\n\r\ndeclare var MediaStreamError: {\r\n prototype: MediaStreamError;\r\n new(): MediaStreamError;\r\n}\r\n\r\ninterface MediaStreamErrorEvent extends Event {\r\n readonly error: MediaStreamError | null;\r\n}\r\n\r\ndeclare var MediaStreamErrorEvent: {\r\n prototype: MediaStreamErrorEvent;\r\n new(type: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent;\r\n}\r\n\r\ninterface MediaStreamTrack extends EventTarget {\r\n enabled: boolean;\r\n readonly id: string;\r\n readonly kind: string;\r\n readonly label: string;\r\n readonly muted: boolean;\r\n onended: (this: this, ev: MediaStreamErrorEvent) => any;\r\n onmute: (this: this, ev: Event) => any;\r\n onoverconstrained: (this: this, ev: MediaStreamErrorEvent) => any;\r\n onunmute: (this: this, ev: Event) => any;\r\n readonly readonly: boolean;\r\n readonly readyState: string;\r\n readonly remote: boolean;\r\n applyConstraints(constraints: MediaTrackConstraints): PromiseLike;\r\n clone(): MediaStreamTrack;\r\n getCapabilities(): MediaTrackCapabilities;\r\n getConstraints(): MediaTrackConstraints;\r\n getSettings(): MediaTrackSettings;\r\n stop(): void;\r\n addEventListener(type: \"ended\", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mute\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"overconstrained\", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"unmute\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var MediaStreamTrack: {\r\n prototype: MediaStreamTrack;\r\n new(): MediaStreamTrack;\r\n}\r\n\r\ninterface MediaStreamTrackEvent extends Event {\r\n readonly track: MediaStreamTrack;\r\n}\r\n\r\ndeclare var MediaStreamTrackEvent: {\r\n prototype: MediaStreamTrackEvent;\r\n new(type: string, eventInitDict?: MediaStreamTrackEventInit): MediaStreamTrackEvent;\r\n}\r\n\r\ninterface MessageChannel {\r\n readonly port1: MessagePort;\r\n readonly port2: MessagePort;\r\n}\r\n\r\ndeclare var MessageChannel: {\r\n prototype: MessageChannel;\r\n new(): MessageChannel;\r\n}\r\n\r\ninterface MessageEvent extends Event {\r\n readonly data: any;\r\n readonly origin: string;\r\n readonly ports: any;\r\n readonly source: Window;\r\n initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: Window): void;\r\n}\r\n\r\ndeclare var MessageEvent: {\r\n prototype: MessageEvent;\r\n new(type: string, eventInitDict?: MessageEventInit): MessageEvent;\r\n}\r\n\r\ninterface MessagePort extends EventTarget {\r\n onmessage: (this: this, ev: MessageEvent) => any;\r\n close(): void;\r\n postMessage(message?: any, ports?: any): void;\r\n start(): void;\r\n addEventListener(type: \"message\", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var MessagePort: {\r\n prototype: MessagePort;\r\n new(): MessagePort;\r\n}\r\n\r\ninterface MimeType {\r\n readonly description: string;\r\n readonly enabledPlugin: Plugin;\r\n readonly suffixes: string;\r\n readonly type: string;\r\n}\r\n\r\ndeclare var MimeType: {\r\n prototype: MimeType;\r\n new(): MimeType;\r\n}\r\n\r\ninterface MimeTypeArray {\r\n readonly length: number;\r\n item(index: number): Plugin;\r\n namedItem(type: string): Plugin;\r\n [index: number]: Plugin;\r\n}\r\n\r\ndeclare var MimeTypeArray: {\r\n prototype: MimeTypeArray;\r\n new(): MimeTypeArray;\r\n}\r\n\r\ninterface MouseEvent extends UIEvent {\r\n readonly altKey: boolean;\r\n readonly button: number;\r\n readonly buttons: number;\r\n readonly clientX: number;\r\n readonly clientY: number;\r\n readonly ctrlKey: boolean;\r\n readonly fromElement: Element;\r\n readonly layerX: number;\r\n readonly layerY: number;\r\n readonly metaKey: boolean;\r\n readonly movementX: number;\r\n readonly movementY: number;\r\n readonly offsetX: number;\r\n readonly offsetY: number;\r\n readonly pageX: number;\r\n readonly pageY: number;\r\n readonly relatedTarget: EventTarget;\r\n readonly screenX: number;\r\n readonly screenY: number;\r\n readonly shiftKey: boolean;\r\n readonly toElement: Element;\r\n readonly which: number;\r\n readonly x: number;\r\n readonly y: number;\r\n getModifierState(keyArg: string): boolean;\r\n initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget): void;\r\n}\r\n\r\ndeclare var MouseEvent: {\r\n prototype: MouseEvent;\r\n new(typeArg: string, eventInitDict?: MouseEventInit): MouseEvent;\r\n}\r\n\r\ninterface MutationEvent extends Event {\r\n readonly attrChange: number;\r\n readonly attrName: string;\r\n readonly newValue: string;\r\n readonly prevValue: string;\r\n readonly relatedNode: Node;\r\n initMutationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, relatedNodeArg: Node, prevValueArg: string, newValueArg: string, attrNameArg: string, attrChangeArg: number): void;\r\n readonly ADDITION: number;\r\n readonly MODIFICATION: number;\r\n readonly REMOVAL: number;\r\n}\r\n\r\ndeclare var MutationEvent: {\r\n prototype: MutationEvent;\r\n new(): MutationEvent;\r\n readonly ADDITION: number;\r\n readonly MODIFICATION: number;\r\n readonly REMOVAL: number;\r\n}\r\n\r\ninterface MutationObserver {\r\n disconnect(): void;\r\n observe(target: Node, options: MutationObserverInit): void;\r\n takeRecords(): MutationRecord[];\r\n}\r\n\r\ndeclare var MutationObserver: {\r\n prototype: MutationObserver;\r\n new(callback: MutationCallback): MutationObserver;\r\n}\r\n\r\ninterface MutationRecord {\r\n readonly addedNodes: NodeList;\r\n readonly attributeName: string | null;\r\n readonly attributeNamespace: string | null;\r\n readonly nextSibling: Node | null;\r\n readonly oldValue: string | null;\r\n readonly previousSibling: Node | null;\r\n readonly removedNodes: NodeList;\r\n readonly target: Node;\r\n readonly type: string;\r\n}\r\n\r\ndeclare var MutationRecord: {\r\n prototype: MutationRecord;\r\n new(): MutationRecord;\r\n}\r\n\r\ninterface NamedNodeMap {\r\n readonly length: number;\r\n getNamedItem(name: string): Attr;\r\n getNamedItemNS(namespaceURI: string | null, localName: string | null): Attr;\r\n item(index: number): Attr;\r\n removeNamedItem(name: string): Attr;\r\n removeNamedItemNS(namespaceURI: string | null, localName: string | null): Attr;\r\n setNamedItem(arg: Attr): Attr;\r\n setNamedItemNS(arg: Attr): Attr;\r\n [index: number]: Attr;\r\n}\r\n\r\ndeclare var NamedNodeMap: {\r\n prototype: NamedNodeMap;\r\n new(): NamedNodeMap;\r\n}\r\n\r\ninterface NavigationCompletedEvent extends NavigationEvent {\r\n readonly isSuccess: boolean;\r\n readonly webErrorStatus: number;\r\n}\r\n\r\ndeclare var NavigationCompletedEvent: {\r\n prototype: NavigationCompletedEvent;\r\n new(): NavigationCompletedEvent;\r\n}\r\n\r\ninterface NavigationEvent extends Event {\r\n readonly uri: string;\r\n}\r\n\r\ndeclare var NavigationEvent: {\r\n prototype: NavigationEvent;\r\n new(): NavigationEvent;\r\n}\r\n\r\ninterface NavigationEventWithReferrer extends NavigationEvent {\r\n readonly referer: string;\r\n}\r\n\r\ndeclare var NavigationEventWithReferrer: {\r\n prototype: NavigationEventWithReferrer;\r\n new(): NavigationEventWithReferrer;\r\n}\r\n\r\ninterface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver, NavigatorUserMedia {\r\n readonly appCodeName: string;\r\n readonly cookieEnabled: boolean;\r\n readonly language: string;\r\n readonly maxTouchPoints: number;\r\n readonly mimeTypes: MimeTypeArray;\r\n readonly msManipulationViewsEnabled: boolean;\r\n readonly msMaxTouchPoints: number;\r\n readonly msPointerEnabled: boolean;\r\n readonly plugins: PluginArray;\r\n readonly pointerEnabled: boolean;\r\n readonly webdriver: boolean;\r\n getGamepads(): Gamepad[];\r\n javaEnabled(): boolean;\r\n msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void;\r\n requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): PromiseLike;\r\n vibrate(pattern: number | number[]): boolean;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var Navigator: {\r\n prototype: Navigator;\r\n new(): Navigator;\r\n}\r\n\r\ninterface Node extends EventTarget {\r\n readonly attributes: NamedNodeMap;\r\n readonly baseURI: string | null;\r\n readonly childNodes: NodeList;\r\n readonly firstChild: Node;\r\n readonly lastChild: Node;\r\n readonly localName: string | null;\r\n readonly namespaceURI: string | null;\r\n readonly nextSibling: Node;\r\n readonly nodeName: string;\r\n readonly nodeType: number;\r\n nodeValue: string | null;\r\n readonly ownerDocument: Document;\r\n readonly parentElement: HTMLElement;\r\n readonly parentNode: Node;\r\n readonly previousSibling: Node;\r\n textContent: string | null;\r\n appendChild(newChild: Node): Node;\r\n cloneNode(deep?: boolean): Node;\r\n compareDocumentPosition(other: Node): number;\r\n contains(child: Node): boolean;\r\n hasAttributes(): boolean;\r\n hasChildNodes(): boolean;\r\n insertBefore(newChild: Node, refChild: Node | null): Node;\r\n isDefaultNamespace(namespaceURI: string | null): boolean;\r\n isEqualNode(arg: Node): boolean;\r\n isSameNode(other: Node): boolean;\r\n lookupNamespaceURI(prefix: string | null): string | null;\r\n lookupPrefix(namespaceURI: string | null): string | null;\r\n normalize(): void;\r\n removeChild(oldChild: Node): Node;\r\n replaceChild(newChild: Node, oldChild: Node): Node;\r\n readonly ATTRIBUTE_NODE: number;\r\n readonly CDATA_SECTION_NODE: number;\r\n readonly COMMENT_NODE: number;\r\n readonly DOCUMENT_FRAGMENT_NODE: number;\r\n readonly DOCUMENT_NODE: number;\r\n readonly DOCUMENT_POSITION_CONTAINED_BY: number;\r\n readonly DOCUMENT_POSITION_CONTAINS: number;\r\n readonly DOCUMENT_POSITION_DISCONNECTED: number;\r\n readonly DOCUMENT_POSITION_FOLLOWING: number;\r\n readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number;\r\n readonly DOCUMENT_POSITION_PRECEDING: number;\r\n readonly DOCUMENT_TYPE_NODE: number;\r\n readonly ELEMENT_NODE: number;\r\n readonly ENTITY_NODE: number;\r\n readonly ENTITY_REFERENCE_NODE: number;\r\n readonly NOTATION_NODE: number;\r\n readonly PROCESSING_INSTRUCTION_NODE: number;\r\n readonly TEXT_NODE: number;\r\n}\r\n\r\ndeclare var Node: {\r\n prototype: Node;\r\n new(): Node;\r\n readonly ATTRIBUTE_NODE: number;\r\n readonly CDATA_SECTION_NODE: number;\r\n readonly COMMENT_NODE: number;\r\n readonly DOCUMENT_FRAGMENT_NODE: number;\r\n readonly DOCUMENT_NODE: number;\r\n readonly DOCUMENT_POSITION_CONTAINED_BY: number;\r\n readonly DOCUMENT_POSITION_CONTAINS: number;\r\n readonly DOCUMENT_POSITION_DISCONNECTED: number;\r\n readonly DOCUMENT_POSITION_FOLLOWING: number;\r\n readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number;\r\n readonly DOCUMENT_POSITION_PRECEDING: number;\r\n readonly DOCUMENT_TYPE_NODE: number;\r\n readonly ELEMENT_NODE: number;\r\n readonly ENTITY_NODE: number;\r\n readonly ENTITY_REFERENCE_NODE: number;\r\n readonly NOTATION_NODE: number;\r\n readonly PROCESSING_INSTRUCTION_NODE: number;\r\n readonly TEXT_NODE: number;\r\n}\r\n\r\ninterface NodeFilter {\r\n acceptNode(n: Node): number;\r\n}\r\n\r\ndeclare var NodeFilter: {\r\n readonly FILTER_ACCEPT: number;\r\n readonly FILTER_REJECT: number;\r\n readonly FILTER_SKIP: number;\r\n readonly SHOW_ALL: number;\r\n readonly SHOW_ATTRIBUTE: number;\r\n readonly SHOW_CDATA_SECTION: number;\r\n readonly SHOW_COMMENT: number;\r\n readonly SHOW_DOCUMENT: number;\r\n readonly SHOW_DOCUMENT_FRAGMENT: number;\r\n readonly SHOW_DOCUMENT_TYPE: number;\r\n readonly SHOW_ELEMENT: number;\r\n readonly SHOW_ENTITY: number;\r\n readonly SHOW_ENTITY_REFERENCE: number;\r\n readonly SHOW_NOTATION: number;\r\n readonly SHOW_PROCESSING_INSTRUCTION: number;\r\n readonly SHOW_TEXT: number;\r\n}\r\n\r\ninterface NodeIterator {\r\n readonly expandEntityReferences: boolean;\r\n readonly filter: NodeFilter;\r\n readonly root: Node;\r\n readonly whatToShow: number;\r\n detach(): void;\r\n nextNode(): Node;\r\n previousNode(): Node;\r\n}\r\n\r\ndeclare var NodeIterator: {\r\n prototype: NodeIterator;\r\n new(): NodeIterator;\r\n}\r\n\r\ninterface NodeList {\r\n readonly length: number;\r\n item(index: number): Node;\r\n [index: number]: Node;\r\n}\r\n\r\ndeclare var NodeList: {\r\n prototype: NodeList;\r\n new(): NodeList;\r\n}\r\n\r\ninterface OES_element_index_uint {\r\n}\r\n\r\ndeclare var OES_element_index_uint: {\r\n prototype: OES_element_index_uint;\r\n new(): OES_element_index_uint;\r\n}\r\n\r\ninterface OES_standard_derivatives {\r\n readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number;\r\n}\r\n\r\ndeclare var OES_standard_derivatives: {\r\n prototype: OES_standard_derivatives;\r\n new(): OES_standard_derivatives;\r\n readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number;\r\n}\r\n\r\ninterface OES_texture_float {\r\n}\r\n\r\ndeclare var OES_texture_float: {\r\n prototype: OES_texture_float;\r\n new(): OES_texture_float;\r\n}\r\n\r\ninterface OES_texture_float_linear {\r\n}\r\n\r\ndeclare var OES_texture_float_linear: {\r\n prototype: OES_texture_float_linear;\r\n new(): OES_texture_float_linear;\r\n}\r\n\r\ninterface OfflineAudioCompletionEvent extends Event {\r\n readonly renderedBuffer: AudioBuffer;\r\n}\r\n\r\ndeclare var OfflineAudioCompletionEvent: {\r\n prototype: OfflineAudioCompletionEvent;\r\n new(): OfflineAudioCompletionEvent;\r\n}\r\n\r\ninterface OfflineAudioContext extends AudioContext {\r\n oncomplete: (this: this, ev: Event) => any;\r\n startRendering(): PromiseLike;\r\n addEventListener(type: \"complete\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var OfflineAudioContext: {\r\n prototype: OfflineAudioContext;\r\n new(numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext;\r\n}\r\n\r\ninterface OscillatorNode extends AudioNode {\r\n readonly detune: AudioParam;\r\n readonly frequency: AudioParam;\r\n onended: (this: this, ev: MediaStreamErrorEvent) => any;\r\n type: string;\r\n setPeriodicWave(periodicWave: PeriodicWave): void;\r\n start(when?: number): void;\r\n stop(when?: number): void;\r\n addEventListener(type: \"ended\", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var OscillatorNode: {\r\n prototype: OscillatorNode;\r\n new(): OscillatorNode;\r\n}\r\n\r\ninterface OverflowEvent extends UIEvent {\r\n readonly horizontalOverflow: boolean;\r\n readonly orient: number;\r\n readonly verticalOverflow: boolean;\r\n readonly BOTH: number;\r\n readonly HORIZONTAL: number;\r\n readonly VERTICAL: number;\r\n}\r\n\r\ndeclare var OverflowEvent: {\r\n prototype: OverflowEvent;\r\n new(): OverflowEvent;\r\n readonly BOTH: number;\r\n readonly HORIZONTAL: number;\r\n readonly VERTICAL: number;\r\n}\r\n\r\ninterface PageTransitionEvent extends Event {\r\n readonly persisted: boolean;\r\n}\r\n\r\ndeclare var PageTransitionEvent: {\r\n prototype: PageTransitionEvent;\r\n new(): PageTransitionEvent;\r\n}\r\n\r\ninterface PannerNode extends AudioNode {\r\n coneInnerAngle: number;\r\n coneOuterAngle: number;\r\n coneOuterGain: number;\r\n distanceModel: string;\r\n maxDistance: number;\r\n panningModel: string;\r\n refDistance: number;\r\n rolloffFactor: number;\r\n setOrientation(x: number, y: number, z: number): void;\r\n setPosition(x: number, y: number, z: number): void;\r\n setVelocity(x: number, y: number, z: number): void;\r\n}\r\n\r\ndeclare var PannerNode: {\r\n prototype: PannerNode;\r\n new(): PannerNode;\r\n}\r\n\r\ninterface PerfWidgetExternal {\r\n readonly activeNetworkRequestCount: number;\r\n readonly averageFrameTime: number;\r\n readonly averagePaintTime: number;\r\n readonly extraInformationEnabled: boolean;\r\n readonly independentRenderingEnabled: boolean;\r\n readonly irDisablingContentString: string;\r\n readonly irStatusAvailable: boolean;\r\n readonly maxCpuSpeed: number;\r\n readonly paintRequestsPerSecond: number;\r\n readonly performanceCounter: number;\r\n readonly performanceCounterFrequency: number;\r\n addEventListener(eventType: string, callback: Function): void;\r\n getMemoryUsage(): number;\r\n getProcessCpuUsage(): number;\r\n getRecentCpuUsage(last: number | null): any;\r\n getRecentFrames(last: number | null): any;\r\n getRecentMemoryUsage(last: number | null): any;\r\n getRecentPaintRequests(last: number | null): any;\r\n removeEventListener(eventType: string, callback: Function): void;\r\n repositionWindow(x: number, y: number): void;\r\n resizeWindow(width: number, height: number): void;\r\n}\r\n\r\ndeclare var PerfWidgetExternal: {\r\n prototype: PerfWidgetExternal;\r\n new(): PerfWidgetExternal;\r\n}\r\n\r\ninterface Performance {\r\n readonly navigation: PerformanceNavigation;\r\n readonly timing: PerformanceTiming;\r\n clearMarks(markName?: string): void;\r\n clearMeasures(measureName?: string): void;\r\n clearResourceTimings(): void;\r\n getEntries(): any;\r\n getEntriesByName(name: string, entryType?: string): any;\r\n getEntriesByType(entryType: string): any;\r\n getMarks(markName?: string): any;\r\n getMeasures(measureName?: string): any;\r\n mark(markName: string): void;\r\n measure(measureName: string, startMarkName?: string, endMarkName?: string): void;\r\n now(): number;\r\n setResourceTimingBufferSize(maxSize: number): void;\r\n toJSON(): any;\r\n}\r\n\r\ndeclare var Performance: {\r\n prototype: Performance;\r\n new(): Performance;\r\n}\r\n\r\ninterface PerformanceEntry {\r\n readonly duration: number;\r\n readonly entryType: string;\r\n readonly name: string;\r\n readonly startTime: number;\r\n}\r\n\r\ndeclare var PerformanceEntry: {\r\n prototype: PerformanceEntry;\r\n new(): PerformanceEntry;\r\n}\r\n\r\ninterface PerformanceMark extends PerformanceEntry {\r\n}\r\n\r\ndeclare var PerformanceMark: {\r\n prototype: PerformanceMark;\r\n new(): PerformanceMark;\r\n}\r\n\r\ninterface PerformanceMeasure extends PerformanceEntry {\r\n}\r\n\r\ndeclare var PerformanceMeasure: {\r\n prototype: PerformanceMeasure;\r\n new(): PerformanceMeasure;\r\n}\r\n\r\ninterface PerformanceNavigation {\r\n readonly redirectCount: number;\r\n readonly type: number;\r\n toJSON(): any;\r\n readonly TYPE_BACK_FORWARD: number;\r\n readonly TYPE_NAVIGATE: number;\r\n readonly TYPE_RELOAD: number;\r\n readonly TYPE_RESERVED: number;\r\n}\r\n\r\ndeclare var PerformanceNavigation: {\r\n prototype: PerformanceNavigation;\r\n new(): PerformanceNavigation;\r\n readonly TYPE_BACK_FORWARD: number;\r\n readonly TYPE_NAVIGATE: number;\r\n readonly TYPE_RELOAD: number;\r\n readonly TYPE_RESERVED: number;\r\n}\r\n\r\ninterface PerformanceNavigationTiming extends PerformanceEntry {\r\n readonly connectEnd: number;\r\n readonly connectStart: number;\r\n readonly domComplete: number;\r\n readonly domContentLoadedEventEnd: number;\r\n readonly domContentLoadedEventStart: number;\r\n readonly domInteractive: number;\r\n readonly domLoading: number;\r\n readonly domainLookupEnd: number;\r\n readonly domainLookupStart: number;\r\n readonly fetchStart: number;\r\n readonly loadEventEnd: number;\r\n readonly loadEventStart: number;\r\n readonly navigationStart: number;\r\n readonly redirectCount: number;\r\n readonly redirectEnd: number;\r\n readonly redirectStart: number;\r\n readonly requestStart: number;\r\n readonly responseEnd: number;\r\n readonly responseStart: number;\r\n readonly type: string;\r\n readonly unloadEventEnd: number;\r\n readonly unloadEventStart: number;\r\n}\r\n\r\ndeclare var PerformanceNavigationTiming: {\r\n prototype: PerformanceNavigationTiming;\r\n new(): PerformanceNavigationTiming;\r\n}\r\n\r\ninterface PerformanceResourceTiming extends PerformanceEntry {\r\n readonly connectEnd: number;\r\n readonly connectStart: number;\r\n readonly domainLookupEnd: number;\r\n readonly domainLookupStart: number;\r\n readonly fetchStart: number;\r\n readonly initiatorType: string;\r\n readonly redirectEnd: number;\r\n readonly redirectStart: number;\r\n readonly requestStart: number;\r\n readonly responseEnd: number;\r\n readonly responseStart: number;\r\n}\r\n\r\ndeclare var PerformanceResourceTiming: {\r\n prototype: PerformanceResourceTiming;\r\n new(): PerformanceResourceTiming;\r\n}\r\n\r\ninterface PerformanceTiming {\r\n readonly connectEnd: number;\r\n readonly connectStart: number;\r\n readonly domComplete: number;\r\n readonly domContentLoadedEventEnd: number;\r\n readonly domContentLoadedEventStart: number;\r\n readonly domInteractive: number;\r\n readonly domLoading: number;\r\n readonly domainLookupEnd: number;\r\n readonly domainLookupStart: number;\r\n readonly fetchStart: number;\r\n readonly loadEventEnd: number;\r\n readonly loadEventStart: number;\r\n readonly msFirstPaint: number;\r\n readonly navigationStart: number;\r\n readonly redirectEnd: number;\r\n readonly redirectStart: number;\r\n readonly requestStart: number;\r\n readonly responseEnd: number;\r\n readonly responseStart: number;\r\n readonly unloadEventEnd: number;\r\n readonly unloadEventStart: number;\r\n readonly secureConnectionStart: number;\r\n toJSON(): any;\r\n}\r\n\r\ndeclare var PerformanceTiming: {\r\n prototype: PerformanceTiming;\r\n new(): PerformanceTiming;\r\n}\r\n\r\ninterface PeriodicWave {\r\n}\r\n\r\ndeclare var PeriodicWave: {\r\n prototype: PeriodicWave;\r\n new(): PeriodicWave;\r\n}\r\n\r\ninterface PermissionRequest extends DeferredPermissionRequest {\r\n readonly state: string;\r\n defer(): void;\r\n}\r\n\r\ndeclare var PermissionRequest: {\r\n prototype: PermissionRequest;\r\n new(): PermissionRequest;\r\n}\r\n\r\ninterface PermissionRequestedEvent extends Event {\r\n readonly permissionRequest: PermissionRequest;\r\n}\r\n\r\ndeclare var PermissionRequestedEvent: {\r\n prototype: PermissionRequestedEvent;\r\n new(): PermissionRequestedEvent;\r\n}\r\n\r\ninterface Plugin {\r\n readonly description: string;\r\n readonly filename: string;\r\n readonly length: number;\r\n readonly name: string;\r\n readonly version: string;\r\n item(index: number): MimeType;\r\n namedItem(type: string): MimeType;\r\n [index: number]: MimeType;\r\n}\r\n\r\ndeclare var Plugin: {\r\n prototype: Plugin;\r\n new(): Plugin;\r\n}\r\n\r\ninterface PluginArray {\r\n readonly length: number;\r\n item(index: number): Plugin;\r\n namedItem(name: string): Plugin;\r\n refresh(reload?: boolean): void;\r\n [index: number]: Plugin;\r\n}\r\n\r\ndeclare var PluginArray: {\r\n prototype: PluginArray;\r\n new(): PluginArray;\r\n}\r\n\r\ninterface PointerEvent extends MouseEvent {\r\n readonly currentPoint: any;\r\n readonly height: number;\r\n readonly hwTimestamp: number;\r\n readonly intermediatePoints: any;\r\n readonly isPrimary: boolean;\r\n readonly pointerId: number;\r\n readonly pointerType: any;\r\n readonly pressure: number;\r\n readonly rotation: number;\r\n readonly tiltX: number;\r\n readonly tiltY: number;\r\n readonly width: number;\r\n getCurrentPoint(element: Element): void;\r\n getIntermediatePoints(element: Element): void;\r\n initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void;\r\n}\r\n\r\ndeclare var PointerEvent: {\r\n prototype: PointerEvent;\r\n new(typeArg: string, eventInitDict?: PointerEventInit): PointerEvent;\r\n}\r\n\r\ninterface PopStateEvent extends Event {\r\n readonly state: any;\r\n initPopStateEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, stateArg: any): void;\r\n}\r\n\r\ndeclare var PopStateEvent: {\r\n prototype: PopStateEvent;\r\n new(): PopStateEvent;\r\n}\r\n\r\ninterface Position {\r\n readonly coords: Coordinates;\r\n readonly timestamp: number;\r\n}\r\n\r\ndeclare var Position: {\r\n prototype: Position;\r\n new(): Position;\r\n}\r\n\r\ninterface PositionError {\r\n readonly code: number;\r\n readonly message: string;\r\n toString(): string;\r\n readonly PERMISSION_DENIED: number;\r\n readonly POSITION_UNAVAILABLE: number;\r\n readonly TIMEOUT: number;\r\n}\r\n\r\ndeclare var PositionError: {\r\n prototype: PositionError;\r\n new(): PositionError;\r\n readonly PERMISSION_DENIED: number;\r\n readonly POSITION_UNAVAILABLE: number;\r\n readonly TIMEOUT: number;\r\n}\r\n\r\ninterface ProcessingInstruction extends CharacterData {\r\n readonly target: string;\r\n}\r\n\r\ndeclare var ProcessingInstruction: {\r\n prototype: ProcessingInstruction;\r\n new(): ProcessingInstruction;\r\n}\r\n\r\ninterface ProgressEvent extends Event {\r\n readonly lengthComputable: boolean;\r\n readonly loaded: number;\r\n readonly total: number;\r\n initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void;\r\n}\r\n\r\ndeclare var ProgressEvent: {\r\n prototype: ProgressEvent;\r\n new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent;\r\n}\r\n\r\ninterface RTCDTMFToneChangeEvent extends Event {\r\n readonly tone: string;\r\n}\r\n\r\ndeclare var RTCDTMFToneChangeEvent: {\r\n prototype: RTCDTMFToneChangeEvent;\r\n new(type: string, eventInitDict: RTCDTMFToneChangeEventInit): RTCDTMFToneChangeEvent;\r\n}\r\n\r\ninterface RTCDtlsTransport extends RTCStatsProvider {\r\n ondtlsstatechange: ((this: this, ev: RTCDtlsTransportStateChangedEvent) => any) | null;\r\n onerror: ((this: this, ev: ErrorEvent) => any) | null;\r\n readonly state: string;\r\n readonly transport: RTCIceTransport;\r\n getLocalParameters(): RTCDtlsParameters;\r\n getRemoteCertificates(): ArrayBuffer[];\r\n getRemoteParameters(): RTCDtlsParameters | null;\r\n start(remoteParameters: RTCDtlsParameters): void;\r\n stop(): void;\r\n addEventListener(type: \"dtlsstatechange\", listener: (this: this, ev: RTCDtlsTransportStateChangedEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var RTCDtlsTransport: {\r\n prototype: RTCDtlsTransport;\r\n new(transport: RTCIceTransport): RTCDtlsTransport;\r\n}\r\n\r\ninterface RTCDtlsTransportStateChangedEvent extends Event {\r\n readonly state: string;\r\n}\r\n\r\ndeclare var RTCDtlsTransportStateChangedEvent: {\r\n prototype: RTCDtlsTransportStateChangedEvent;\r\n new(): RTCDtlsTransportStateChangedEvent;\r\n}\r\n\r\ninterface RTCDtmfSender extends EventTarget {\r\n readonly canInsertDTMF: boolean;\r\n readonly duration: number;\r\n readonly interToneGap: number;\r\n ontonechange: (this: this, ev: RTCDTMFToneChangeEvent) => any;\r\n readonly sender: RTCRtpSender;\r\n readonly toneBuffer: string;\r\n insertDTMF(tones: string, duration?: number, interToneGap?: number): void;\r\n addEventListener(type: \"tonechange\", listener: (this: this, ev: RTCDTMFToneChangeEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var RTCDtmfSender: {\r\n prototype: RTCDtmfSender;\r\n new(sender: RTCRtpSender): RTCDtmfSender;\r\n}\r\n\r\ninterface RTCIceCandidatePairChangedEvent extends Event {\r\n readonly pair: RTCIceCandidatePair;\r\n}\r\n\r\ndeclare var RTCIceCandidatePairChangedEvent: {\r\n prototype: RTCIceCandidatePairChangedEvent;\r\n new(): RTCIceCandidatePairChangedEvent;\r\n}\r\n\r\ninterface RTCIceGatherer extends RTCStatsProvider {\r\n readonly component: string;\r\n onerror: ((this: this, ev: ErrorEvent) => any) | null;\r\n onlocalcandidate: ((this: this, ev: RTCIceGathererEvent) => any) | null;\r\n createAssociatedGatherer(): RTCIceGatherer;\r\n getLocalCandidates(): RTCIceCandidate[];\r\n getLocalParameters(): RTCIceParameters;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"localcandidate\", listener: (this: this, ev: RTCIceGathererEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var RTCIceGatherer: {\r\n prototype: RTCIceGatherer;\r\n new(options: RTCIceGatherOptions): RTCIceGatherer;\r\n}\r\n\r\ninterface RTCIceGathererEvent extends Event {\r\n readonly candidate: RTCIceCandidate | RTCIceCandidateComplete;\r\n}\r\n\r\ndeclare var RTCIceGathererEvent: {\r\n prototype: RTCIceGathererEvent;\r\n new(): RTCIceGathererEvent;\r\n}\r\n\r\ninterface RTCIceTransport extends RTCStatsProvider {\r\n readonly component: string;\r\n readonly iceGatherer: RTCIceGatherer | null;\r\n oncandidatepairchange: ((this: this, ev: RTCIceCandidatePairChangedEvent) => any) | null;\r\n onicestatechange: ((this: this, ev: RTCIceTransportStateChangedEvent) => any) | null;\r\n readonly role: string;\r\n readonly state: string;\r\n addRemoteCandidate(remoteCandidate: RTCIceCandidate | RTCIceCandidateComplete): void;\r\n createAssociatedTransport(): RTCIceTransport;\r\n getNominatedCandidatePair(): RTCIceCandidatePair | null;\r\n getRemoteCandidates(): RTCIceCandidate[];\r\n getRemoteParameters(): RTCIceParameters | null;\r\n setRemoteCandidates(remoteCandidates: RTCIceCandidate[]): void;\r\n start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: string): void;\r\n stop(): void;\r\n addEventListener(type: \"candidatepairchange\", listener: (this: this, ev: RTCIceCandidatePairChangedEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"icestatechange\", listener: (this: this, ev: RTCIceTransportStateChangedEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var RTCIceTransport: {\r\n prototype: RTCIceTransport;\r\n new(): RTCIceTransport;\r\n}\r\n\r\ninterface RTCIceTransportStateChangedEvent extends Event {\r\n readonly state: string;\r\n}\r\n\r\ndeclare var RTCIceTransportStateChangedEvent: {\r\n prototype: RTCIceTransportStateChangedEvent;\r\n new(): RTCIceTransportStateChangedEvent;\r\n}\r\n\r\ninterface RTCRtpReceiver extends RTCStatsProvider {\r\n onerror: ((this: this, ev: ErrorEvent) => any) | null;\r\n readonly rtcpTransport: RTCDtlsTransport;\r\n readonly track: MediaStreamTrack | null;\r\n readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport;\r\n getContributingSources(): RTCRtpContributingSource[];\r\n receive(parameters: RTCRtpParameters): void;\r\n requestSendCSRC(csrc: number): void;\r\n setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void;\r\n stop(): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var RTCRtpReceiver: {\r\n prototype: RTCRtpReceiver;\r\n new(transport: RTCDtlsTransport | RTCSrtpSdesTransport, kind: string, rtcpTransport?: RTCDtlsTransport): RTCRtpReceiver;\r\n getCapabilities(kind?: string): RTCRtpCapabilities;\r\n}\r\n\r\ninterface RTCRtpSender extends RTCStatsProvider {\r\n onerror: ((this: this, ev: ErrorEvent) => any) | null;\r\n onssrcconflict: ((this: this, ev: RTCSsrcConflictEvent) => any) | null;\r\n readonly rtcpTransport: RTCDtlsTransport;\r\n readonly track: MediaStreamTrack;\r\n readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport;\r\n send(parameters: RTCRtpParameters): void;\r\n setTrack(track: MediaStreamTrack): void;\r\n setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void;\r\n stop(): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ssrcconflict\", listener: (this: this, ev: RTCSsrcConflictEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var RTCRtpSender: {\r\n prototype: RTCRtpSender;\r\n new(track: MediaStreamTrack, transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): RTCRtpSender;\r\n getCapabilities(kind?: string): RTCRtpCapabilities;\r\n}\r\n\r\ninterface RTCSrtpSdesTransport extends EventTarget {\r\n onerror: ((this: this, ev: ErrorEvent) => any) | null;\r\n readonly transport: RTCIceTransport;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var RTCSrtpSdesTransport: {\r\n prototype: RTCSrtpSdesTransport;\r\n new(transport: RTCIceTransport, encryptParameters: RTCSrtpSdesParameters, decryptParameters: RTCSrtpSdesParameters): RTCSrtpSdesTransport;\r\n getLocalParameters(): RTCSrtpSdesParameters[];\r\n}\r\n\r\ninterface RTCSsrcConflictEvent extends Event {\r\n readonly ssrc: number;\r\n}\r\n\r\ndeclare var RTCSsrcConflictEvent: {\r\n prototype: RTCSsrcConflictEvent;\r\n new(): RTCSsrcConflictEvent;\r\n}\r\n\r\ninterface RTCStatsProvider extends EventTarget {\r\n getStats(): PromiseLike;\r\n msGetStats(): PromiseLike;\r\n}\r\n\r\ndeclare var RTCStatsProvider: {\r\n prototype: RTCStatsProvider;\r\n new(): RTCStatsProvider;\r\n}\r\n\r\ninterface Range {\r\n readonly collapsed: boolean;\r\n readonly commonAncestorContainer: Node;\r\n readonly endContainer: Node;\r\n readonly endOffset: number;\r\n readonly startContainer: Node;\r\n readonly startOffset: number;\r\n cloneContents(): DocumentFragment;\r\n cloneRange(): Range;\r\n collapse(toStart: boolean): void;\r\n compareBoundaryPoints(how: number, sourceRange: Range): number;\r\n createContextualFragment(fragment: string): DocumentFragment;\r\n deleteContents(): void;\r\n detach(): void;\r\n expand(Unit: string): boolean;\r\n extractContents(): DocumentFragment;\r\n getBoundingClientRect(): ClientRect;\r\n getClientRects(): ClientRectList;\r\n insertNode(newNode: Node): void;\r\n selectNode(refNode: Node): void;\r\n selectNodeContents(refNode: Node): void;\r\n setEnd(refNode: Node, offset: number): void;\r\n setEndAfter(refNode: Node): void;\r\n setEndBefore(refNode: Node): void;\r\n setStart(refNode: Node, offset: number): void;\r\n setStartAfter(refNode: Node): void;\r\n setStartBefore(refNode: Node): void;\r\n surroundContents(newParent: Node): void;\r\n toString(): string;\r\n readonly END_TO_END: number;\r\n readonly END_TO_START: number;\r\n readonly START_TO_END: number;\r\n readonly START_TO_START: number;\r\n}\r\n\r\ndeclare var Range: {\r\n prototype: Range;\r\n new(): Range;\r\n readonly END_TO_END: number;\r\n readonly END_TO_START: number;\r\n readonly START_TO_END: number;\r\n readonly START_TO_START: number;\r\n}\r\n\r\ninterface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference {\r\n readonly target: SVGAnimatedString;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGAElement: {\r\n prototype: SVGAElement;\r\n new(): SVGAElement;\r\n}\r\n\r\ninterface SVGAngle {\r\n readonly unitType: number;\r\n value: number;\r\n valueAsString: string;\r\n valueInSpecifiedUnits: number;\r\n convertToSpecifiedUnits(unitType: number): void;\r\n newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void;\r\n readonly SVG_ANGLETYPE_DEG: number;\r\n readonly SVG_ANGLETYPE_GRAD: number;\r\n readonly SVG_ANGLETYPE_RAD: number;\r\n readonly SVG_ANGLETYPE_UNKNOWN: number;\r\n readonly SVG_ANGLETYPE_UNSPECIFIED: number;\r\n}\r\n\r\ndeclare var SVGAngle: {\r\n prototype: SVGAngle;\r\n new(): SVGAngle;\r\n readonly SVG_ANGLETYPE_DEG: number;\r\n readonly SVG_ANGLETYPE_GRAD: number;\r\n readonly SVG_ANGLETYPE_RAD: number;\r\n readonly SVG_ANGLETYPE_UNKNOWN: number;\r\n readonly SVG_ANGLETYPE_UNSPECIFIED: number;\r\n}\r\n\r\ninterface SVGAnimatedAngle {\r\n readonly animVal: SVGAngle;\r\n readonly baseVal: SVGAngle;\r\n}\r\n\r\ndeclare var SVGAnimatedAngle: {\r\n prototype: SVGAnimatedAngle;\r\n new(): SVGAnimatedAngle;\r\n}\r\n\r\ninterface SVGAnimatedBoolean {\r\n readonly animVal: boolean;\r\n baseVal: boolean;\r\n}\r\n\r\ndeclare var SVGAnimatedBoolean: {\r\n prototype: SVGAnimatedBoolean;\r\n new(): SVGAnimatedBoolean;\r\n}\r\n\r\ninterface SVGAnimatedEnumeration {\r\n readonly animVal: number;\r\n baseVal: number;\r\n}\r\n\r\ndeclare var SVGAnimatedEnumeration: {\r\n prototype: SVGAnimatedEnumeration;\r\n new(): SVGAnimatedEnumeration;\r\n}\r\n\r\ninterface SVGAnimatedInteger {\r\n readonly animVal: number;\r\n baseVal: number;\r\n}\r\n\r\ndeclare var SVGAnimatedInteger: {\r\n prototype: SVGAnimatedInteger;\r\n new(): SVGAnimatedInteger;\r\n}\r\n\r\ninterface SVGAnimatedLength {\r\n readonly animVal: SVGLength;\r\n readonly baseVal: SVGLength;\r\n}\r\n\r\ndeclare var SVGAnimatedLength: {\r\n prototype: SVGAnimatedLength;\r\n new(): SVGAnimatedLength;\r\n}\r\n\r\ninterface SVGAnimatedLengthList {\r\n readonly animVal: SVGLengthList;\r\n readonly baseVal: SVGLengthList;\r\n}\r\n\r\ndeclare var SVGAnimatedLengthList: {\r\n prototype: SVGAnimatedLengthList;\r\n new(): SVGAnimatedLengthList;\r\n}\r\n\r\ninterface SVGAnimatedNumber {\r\n readonly animVal: number;\r\n baseVal: number;\r\n}\r\n\r\ndeclare var SVGAnimatedNumber: {\r\n prototype: SVGAnimatedNumber;\r\n new(): SVGAnimatedNumber;\r\n}\r\n\r\ninterface SVGAnimatedNumberList {\r\n readonly animVal: SVGNumberList;\r\n readonly baseVal: SVGNumberList;\r\n}\r\n\r\ndeclare var SVGAnimatedNumberList: {\r\n prototype: SVGAnimatedNumberList;\r\n new(): SVGAnimatedNumberList;\r\n}\r\n\r\ninterface SVGAnimatedPreserveAspectRatio {\r\n readonly animVal: SVGPreserveAspectRatio;\r\n readonly baseVal: SVGPreserveAspectRatio;\r\n}\r\n\r\ndeclare var SVGAnimatedPreserveAspectRatio: {\r\n prototype: SVGAnimatedPreserveAspectRatio;\r\n new(): SVGAnimatedPreserveAspectRatio;\r\n}\r\n\r\ninterface SVGAnimatedRect {\r\n readonly animVal: SVGRect;\r\n readonly baseVal: SVGRect;\r\n}\r\n\r\ndeclare var SVGAnimatedRect: {\r\n prototype: SVGAnimatedRect;\r\n new(): SVGAnimatedRect;\r\n}\r\n\r\ninterface SVGAnimatedString {\r\n readonly animVal: string;\r\n baseVal: string;\r\n}\r\n\r\ndeclare var SVGAnimatedString: {\r\n prototype: SVGAnimatedString;\r\n new(): SVGAnimatedString;\r\n}\r\n\r\ninterface SVGAnimatedTransformList {\r\n readonly animVal: SVGTransformList;\r\n readonly baseVal: SVGTransformList;\r\n}\r\n\r\ndeclare var SVGAnimatedTransformList: {\r\n prototype: SVGAnimatedTransformList;\r\n new(): SVGAnimatedTransformList;\r\n}\r\n\r\ninterface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\r\n readonly cx: SVGAnimatedLength;\r\n readonly cy: SVGAnimatedLength;\r\n readonly r: SVGAnimatedLength;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGCircleElement: {\r\n prototype: SVGCircleElement;\r\n new(): SVGCircleElement;\r\n}\r\n\r\ninterface SVGClipPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes {\r\n readonly clipPathUnits: SVGAnimatedEnumeration;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGClipPathElement: {\r\n prototype: SVGClipPathElement;\r\n new(): SVGClipPathElement;\r\n}\r\n\r\ninterface SVGComponentTransferFunctionElement extends SVGElement {\r\n readonly amplitude: SVGAnimatedNumber;\r\n readonly exponent: SVGAnimatedNumber;\r\n readonly intercept: SVGAnimatedNumber;\r\n readonly offset: SVGAnimatedNumber;\r\n readonly slope: SVGAnimatedNumber;\r\n readonly tableValues: SVGAnimatedNumberList;\r\n readonly type: SVGAnimatedEnumeration;\r\n readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number;\r\n readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number;\r\n readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number;\r\n readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number;\r\n readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number;\r\n readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number;\r\n}\r\n\r\ndeclare var SVGComponentTransferFunctionElement: {\r\n prototype: SVGComponentTransferFunctionElement;\r\n new(): SVGComponentTransferFunctionElement;\r\n readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number;\r\n readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number;\r\n readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number;\r\n readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number;\r\n readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number;\r\n readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number;\r\n}\r\n\r\ninterface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGDefsElement: {\r\n prototype: SVGDefsElement;\r\n new(): SVGDefsElement;\r\n}\r\n\r\ninterface SVGDescElement extends SVGElement, SVGStylable, SVGLangSpace {\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGDescElement: {\r\n prototype: SVGDescElement;\r\n new(): SVGDescElement;\r\n}\r\n\r\ninterface SVGElement extends Element {\r\n onclick: (this: this, ev: MouseEvent) => any;\r\n ondblclick: (this: this, ev: MouseEvent) => any;\r\n onfocusin: (this: this, ev: FocusEvent) => any;\r\n onfocusout: (this: this, ev: FocusEvent) => any;\r\n onload: (this: this, ev: Event) => any;\r\n onmousedown: (this: this, ev: MouseEvent) => any;\r\n onmousemove: (this: this, ev: MouseEvent) => any;\r\n onmouseout: (this: this, ev: MouseEvent) => any;\r\n onmouseover: (this: this, ev: MouseEvent) => any;\r\n onmouseup: (this: this, ev: MouseEvent) => any;\r\n readonly ownerSVGElement: SVGSVGElement;\r\n readonly viewportElement: SVGElement;\r\n xmlbase: string;\r\n className: any;\r\n addEventListener(type: \"MSGestureChange\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureDoubleTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureEnd\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureHold\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGotPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSInertiaStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSLostPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerCancel\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerDown\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerEnter\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerLeave\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerMove\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOut\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOver\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerUp\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ariarequest\", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"click\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"command\", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dblclick\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"focusin\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"focusout\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"gotpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"lostpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousedown\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousemove\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseout\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseover\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseup\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointercancel\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerdown\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerenter\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerleave\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointermove\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerout\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerover\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerup\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchcancel\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchend\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchmove\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchstart\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenerror\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"wheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGElement: {\r\n prototype: SVGElement;\r\n new(): SVGElement;\r\n}\r\n\r\ninterface SVGElementInstance extends EventTarget {\r\n readonly childNodes: SVGElementInstanceList;\r\n readonly correspondingElement: SVGElement;\r\n readonly correspondingUseElement: SVGUseElement;\r\n readonly firstChild: SVGElementInstance;\r\n readonly lastChild: SVGElementInstance;\r\n readonly nextSibling: SVGElementInstance;\r\n readonly parentNode: SVGElementInstance;\r\n readonly previousSibling: SVGElementInstance;\r\n}\r\n\r\ndeclare var SVGElementInstance: {\r\n prototype: SVGElementInstance;\r\n new(): SVGElementInstance;\r\n}\r\n\r\ninterface SVGElementInstanceList {\r\n readonly length: number;\r\n item(index: number): SVGElementInstance;\r\n}\r\n\r\ndeclare var SVGElementInstanceList: {\r\n prototype: SVGElementInstanceList;\r\n new(): SVGElementInstanceList;\r\n}\r\n\r\ninterface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\r\n readonly cx: SVGAnimatedLength;\r\n readonly cy: SVGAnimatedLength;\r\n readonly rx: SVGAnimatedLength;\r\n readonly ry: SVGAnimatedLength;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGEllipseElement: {\r\n prototype: SVGEllipseElement;\r\n new(): SVGEllipseElement;\r\n}\r\n\r\ninterface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\r\n readonly in1: SVGAnimatedString;\r\n readonly in2: SVGAnimatedString;\r\n readonly mode: SVGAnimatedEnumeration;\r\n readonly SVG_FEBLEND_MODE_COLOR: number;\r\n readonly SVG_FEBLEND_MODE_COLOR_BURN: number;\r\n readonly SVG_FEBLEND_MODE_COLOR_DODGE: number;\r\n readonly SVG_FEBLEND_MODE_DARKEN: number;\r\n readonly SVG_FEBLEND_MODE_DIFFERENCE: number;\r\n readonly SVG_FEBLEND_MODE_EXCLUSION: number;\r\n readonly SVG_FEBLEND_MODE_HARD_LIGHT: number;\r\n readonly SVG_FEBLEND_MODE_HUE: number;\r\n readonly SVG_FEBLEND_MODE_LIGHTEN: number;\r\n readonly SVG_FEBLEND_MODE_LUMINOSITY: number;\r\n readonly SVG_FEBLEND_MODE_MULTIPLY: number;\r\n readonly SVG_FEBLEND_MODE_NORMAL: number;\r\n readonly SVG_FEBLEND_MODE_OVERLAY: number;\r\n readonly SVG_FEBLEND_MODE_SATURATION: number;\r\n readonly SVG_FEBLEND_MODE_SCREEN: number;\r\n readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number;\r\n readonly SVG_FEBLEND_MODE_UNKNOWN: number;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFEBlendElement: {\r\n prototype: SVGFEBlendElement;\r\n new(): SVGFEBlendElement;\r\n readonly SVG_FEBLEND_MODE_COLOR: number;\r\n readonly SVG_FEBLEND_MODE_COLOR_BURN: number;\r\n readonly SVG_FEBLEND_MODE_COLOR_DODGE: number;\r\n readonly SVG_FEBLEND_MODE_DARKEN: number;\r\n readonly SVG_FEBLEND_MODE_DIFFERENCE: number;\r\n readonly SVG_FEBLEND_MODE_EXCLUSION: number;\r\n readonly SVG_FEBLEND_MODE_HARD_LIGHT: number;\r\n readonly SVG_FEBLEND_MODE_HUE: number;\r\n readonly SVG_FEBLEND_MODE_LIGHTEN: number;\r\n readonly SVG_FEBLEND_MODE_LUMINOSITY: number;\r\n readonly SVG_FEBLEND_MODE_MULTIPLY: number;\r\n readonly SVG_FEBLEND_MODE_NORMAL: number;\r\n readonly SVG_FEBLEND_MODE_OVERLAY: number;\r\n readonly SVG_FEBLEND_MODE_SATURATION: number;\r\n readonly SVG_FEBLEND_MODE_SCREEN: number;\r\n readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number;\r\n readonly SVG_FEBLEND_MODE_UNKNOWN: number;\r\n}\r\n\r\ninterface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\r\n readonly in1: SVGAnimatedString;\r\n readonly type: SVGAnimatedEnumeration;\r\n readonly values: SVGAnimatedNumberList;\r\n readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number;\r\n readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number;\r\n readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number;\r\n readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number;\r\n readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFEColorMatrixElement: {\r\n prototype: SVGFEColorMatrixElement;\r\n new(): SVGFEColorMatrixElement;\r\n readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number;\r\n readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number;\r\n readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number;\r\n readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number;\r\n readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number;\r\n}\r\n\r\ninterface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\r\n readonly in1: SVGAnimatedString;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFEComponentTransferElement: {\r\n prototype: SVGFEComponentTransferElement;\r\n new(): SVGFEComponentTransferElement;\r\n}\r\n\r\ninterface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\r\n readonly in1: SVGAnimatedString;\r\n readonly in2: SVGAnimatedString;\r\n readonly k1: SVGAnimatedNumber;\r\n readonly k2: SVGAnimatedNumber;\r\n readonly k3: SVGAnimatedNumber;\r\n readonly k4: SVGAnimatedNumber;\r\n readonly operator: SVGAnimatedEnumeration;\r\n readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number;\r\n readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number;\r\n readonly SVG_FECOMPOSITE_OPERATOR_IN: number;\r\n readonly SVG_FECOMPOSITE_OPERATOR_OUT: number;\r\n readonly SVG_FECOMPOSITE_OPERATOR_OVER: number;\r\n readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number;\r\n readonly SVG_FECOMPOSITE_OPERATOR_XOR: number;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFECompositeElement: {\r\n prototype: SVGFECompositeElement;\r\n new(): SVGFECompositeElement;\r\n readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number;\r\n readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number;\r\n readonly SVG_FECOMPOSITE_OPERATOR_IN: number;\r\n readonly SVG_FECOMPOSITE_OPERATOR_OUT: number;\r\n readonly SVG_FECOMPOSITE_OPERATOR_OVER: number;\r\n readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number;\r\n readonly SVG_FECOMPOSITE_OPERATOR_XOR: number;\r\n}\r\n\r\ninterface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\r\n readonly bias: SVGAnimatedNumber;\r\n readonly divisor: SVGAnimatedNumber;\r\n readonly edgeMode: SVGAnimatedEnumeration;\r\n readonly in1: SVGAnimatedString;\r\n readonly kernelMatrix: SVGAnimatedNumberList;\r\n readonly kernelUnitLengthX: SVGAnimatedNumber;\r\n readonly kernelUnitLengthY: SVGAnimatedNumber;\r\n readonly orderX: SVGAnimatedInteger;\r\n readonly orderY: SVGAnimatedInteger;\r\n readonly preserveAlpha: SVGAnimatedBoolean;\r\n readonly targetX: SVGAnimatedInteger;\r\n readonly targetY: SVGAnimatedInteger;\r\n readonly SVG_EDGEMODE_DUPLICATE: number;\r\n readonly SVG_EDGEMODE_NONE: number;\r\n readonly SVG_EDGEMODE_UNKNOWN: number;\r\n readonly SVG_EDGEMODE_WRAP: number;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFEConvolveMatrixElement: {\r\n prototype: SVGFEConvolveMatrixElement;\r\n new(): SVGFEConvolveMatrixElement;\r\n readonly SVG_EDGEMODE_DUPLICATE: number;\r\n readonly SVG_EDGEMODE_NONE: number;\r\n readonly SVG_EDGEMODE_UNKNOWN: number;\r\n readonly SVG_EDGEMODE_WRAP: number;\r\n}\r\n\r\ninterface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\r\n readonly diffuseConstant: SVGAnimatedNumber;\r\n readonly in1: SVGAnimatedString;\r\n readonly kernelUnitLengthX: SVGAnimatedNumber;\r\n readonly kernelUnitLengthY: SVGAnimatedNumber;\r\n readonly surfaceScale: SVGAnimatedNumber;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFEDiffuseLightingElement: {\r\n prototype: SVGFEDiffuseLightingElement;\r\n new(): SVGFEDiffuseLightingElement;\r\n}\r\n\r\ninterface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\r\n readonly in1: SVGAnimatedString;\r\n readonly in2: SVGAnimatedString;\r\n readonly scale: SVGAnimatedNumber;\r\n readonly xChannelSelector: SVGAnimatedEnumeration;\r\n readonly yChannelSelector: SVGAnimatedEnumeration;\r\n readonly SVG_CHANNEL_A: number;\r\n readonly SVG_CHANNEL_B: number;\r\n readonly SVG_CHANNEL_G: number;\r\n readonly SVG_CHANNEL_R: number;\r\n readonly SVG_CHANNEL_UNKNOWN: number;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFEDisplacementMapElement: {\r\n prototype: SVGFEDisplacementMapElement;\r\n new(): SVGFEDisplacementMapElement;\r\n readonly SVG_CHANNEL_A: number;\r\n readonly SVG_CHANNEL_B: number;\r\n readonly SVG_CHANNEL_G: number;\r\n readonly SVG_CHANNEL_R: number;\r\n readonly SVG_CHANNEL_UNKNOWN: number;\r\n}\r\n\r\ninterface SVGFEDistantLightElement extends SVGElement {\r\n readonly azimuth: SVGAnimatedNumber;\r\n readonly elevation: SVGAnimatedNumber;\r\n}\r\n\r\ndeclare var SVGFEDistantLightElement: {\r\n prototype: SVGFEDistantLightElement;\r\n new(): SVGFEDistantLightElement;\r\n}\r\n\r\ninterface SVGFEFloodElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFEFloodElement: {\r\n prototype: SVGFEFloodElement;\r\n new(): SVGFEFloodElement;\r\n}\r\n\r\ninterface SVGFEFuncAElement extends SVGComponentTransferFunctionElement {\r\n}\r\n\r\ndeclare var SVGFEFuncAElement: {\r\n prototype: SVGFEFuncAElement;\r\n new(): SVGFEFuncAElement;\r\n}\r\n\r\ninterface SVGFEFuncBElement extends SVGComponentTransferFunctionElement {\r\n}\r\n\r\ndeclare var SVGFEFuncBElement: {\r\n prototype: SVGFEFuncBElement;\r\n new(): SVGFEFuncBElement;\r\n}\r\n\r\ninterface SVGFEFuncGElement extends SVGComponentTransferFunctionElement {\r\n}\r\n\r\ndeclare var SVGFEFuncGElement: {\r\n prototype: SVGFEFuncGElement;\r\n new(): SVGFEFuncGElement;\r\n}\r\n\r\ninterface SVGFEFuncRElement extends SVGComponentTransferFunctionElement {\r\n}\r\n\r\ndeclare var SVGFEFuncRElement: {\r\n prototype: SVGFEFuncRElement;\r\n new(): SVGFEFuncRElement;\r\n}\r\n\r\ninterface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\r\n readonly in1: SVGAnimatedString;\r\n readonly stdDeviationX: SVGAnimatedNumber;\r\n readonly stdDeviationY: SVGAnimatedNumber;\r\n setStdDeviation(stdDeviationX: number, stdDeviationY: number): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFEGaussianBlurElement: {\r\n prototype: SVGFEGaussianBlurElement;\r\n new(): SVGFEGaussianBlurElement;\r\n}\r\n\r\ninterface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired {\r\n readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFEImageElement: {\r\n prototype: SVGFEImageElement;\r\n new(): SVGFEImageElement;\r\n}\r\n\r\ninterface SVGFEMergeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFEMergeElement: {\r\n prototype: SVGFEMergeElement;\r\n new(): SVGFEMergeElement;\r\n}\r\n\r\ninterface SVGFEMergeNodeElement extends SVGElement {\r\n readonly in1: SVGAnimatedString;\r\n}\r\n\r\ndeclare var SVGFEMergeNodeElement: {\r\n prototype: SVGFEMergeNodeElement;\r\n new(): SVGFEMergeNodeElement;\r\n}\r\n\r\ninterface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\r\n readonly in1: SVGAnimatedString;\r\n readonly operator: SVGAnimatedEnumeration;\r\n readonly radiusX: SVGAnimatedNumber;\r\n readonly radiusY: SVGAnimatedNumber;\r\n readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number;\r\n readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number;\r\n readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFEMorphologyElement: {\r\n prototype: SVGFEMorphologyElement;\r\n new(): SVGFEMorphologyElement;\r\n readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number;\r\n readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number;\r\n readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number;\r\n}\r\n\r\ninterface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\r\n readonly dx: SVGAnimatedNumber;\r\n readonly dy: SVGAnimatedNumber;\r\n readonly in1: SVGAnimatedString;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFEOffsetElement: {\r\n prototype: SVGFEOffsetElement;\r\n new(): SVGFEOffsetElement;\r\n}\r\n\r\ninterface SVGFEPointLightElement extends SVGElement {\r\n readonly x: SVGAnimatedNumber;\r\n readonly y: SVGAnimatedNumber;\r\n readonly z: SVGAnimatedNumber;\r\n}\r\n\r\ndeclare var SVGFEPointLightElement: {\r\n prototype: SVGFEPointLightElement;\r\n new(): SVGFEPointLightElement;\r\n}\r\n\r\ninterface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\r\n readonly in1: SVGAnimatedString;\r\n readonly kernelUnitLengthX: SVGAnimatedNumber;\r\n readonly kernelUnitLengthY: SVGAnimatedNumber;\r\n readonly specularConstant: SVGAnimatedNumber;\r\n readonly specularExponent: SVGAnimatedNumber;\r\n readonly surfaceScale: SVGAnimatedNumber;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFESpecularLightingElement: {\r\n prototype: SVGFESpecularLightingElement;\r\n new(): SVGFESpecularLightingElement;\r\n}\r\n\r\ninterface SVGFESpotLightElement extends SVGElement {\r\n readonly limitingConeAngle: SVGAnimatedNumber;\r\n readonly pointsAtX: SVGAnimatedNumber;\r\n readonly pointsAtY: SVGAnimatedNumber;\r\n readonly pointsAtZ: SVGAnimatedNumber;\r\n readonly specularExponent: SVGAnimatedNumber;\r\n readonly x: SVGAnimatedNumber;\r\n readonly y: SVGAnimatedNumber;\r\n readonly z: SVGAnimatedNumber;\r\n}\r\n\r\ndeclare var SVGFESpotLightElement: {\r\n prototype: SVGFESpotLightElement;\r\n new(): SVGFESpotLightElement;\r\n}\r\n\r\ninterface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\r\n readonly in1: SVGAnimatedString;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFETileElement: {\r\n prototype: SVGFETileElement;\r\n new(): SVGFETileElement;\r\n}\r\n\r\ninterface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\r\n readonly baseFrequencyX: SVGAnimatedNumber;\r\n readonly baseFrequencyY: SVGAnimatedNumber;\r\n readonly numOctaves: SVGAnimatedInteger;\r\n readonly seed: SVGAnimatedNumber;\r\n readonly stitchTiles: SVGAnimatedEnumeration;\r\n readonly type: SVGAnimatedEnumeration;\r\n readonly SVG_STITCHTYPE_NOSTITCH: number;\r\n readonly SVG_STITCHTYPE_STITCH: number;\r\n readonly SVG_STITCHTYPE_UNKNOWN: number;\r\n readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number;\r\n readonly SVG_TURBULENCE_TYPE_TURBULENCE: number;\r\n readonly SVG_TURBULENCE_TYPE_UNKNOWN: number;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFETurbulenceElement: {\r\n prototype: SVGFETurbulenceElement;\r\n new(): SVGFETurbulenceElement;\r\n readonly SVG_STITCHTYPE_NOSTITCH: number;\r\n readonly SVG_STITCHTYPE_STITCH: number;\r\n readonly SVG_STITCHTYPE_UNKNOWN: number;\r\n readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number;\r\n readonly SVG_TURBULENCE_TYPE_TURBULENCE: number;\r\n readonly SVG_TURBULENCE_TYPE_UNKNOWN: number;\r\n}\r\n\r\ninterface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired {\r\n readonly filterResX: SVGAnimatedInteger;\r\n readonly filterResY: SVGAnimatedInteger;\r\n readonly filterUnits: SVGAnimatedEnumeration;\r\n readonly height: SVGAnimatedLength;\r\n readonly primitiveUnits: SVGAnimatedEnumeration;\r\n readonly width: SVGAnimatedLength;\r\n readonly x: SVGAnimatedLength;\r\n readonly y: SVGAnimatedLength;\r\n setFilterRes(filterResX: number, filterResY: number): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFilterElement: {\r\n prototype: SVGFilterElement;\r\n new(): SVGFilterElement;\r\n}\r\n\r\ninterface SVGForeignObjectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\r\n readonly height: SVGAnimatedLength;\r\n readonly width: SVGAnimatedLength;\r\n readonly x: SVGAnimatedLength;\r\n readonly y: SVGAnimatedLength;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGForeignObjectElement: {\r\n prototype: SVGForeignObjectElement;\r\n new(): SVGForeignObjectElement;\r\n}\r\n\r\ninterface SVGGElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGGElement: {\r\n prototype: SVGGElement;\r\n new(): SVGGElement;\r\n}\r\n\r\ninterface SVGGradientElement extends SVGElement, SVGStylable, SVGExternalResourcesRequired, SVGURIReference, SVGUnitTypes {\r\n readonly gradientTransform: SVGAnimatedTransformList;\r\n readonly gradientUnits: SVGAnimatedEnumeration;\r\n readonly spreadMethod: SVGAnimatedEnumeration;\r\n readonly SVG_SPREADMETHOD_PAD: number;\r\n readonly SVG_SPREADMETHOD_REFLECT: number;\r\n readonly SVG_SPREADMETHOD_REPEAT: number;\r\n readonly SVG_SPREADMETHOD_UNKNOWN: number;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGGradientElement: {\r\n prototype: SVGGradientElement;\r\n new(): SVGGradientElement;\r\n readonly SVG_SPREADMETHOD_PAD: number;\r\n readonly SVG_SPREADMETHOD_REFLECT: number;\r\n readonly SVG_SPREADMETHOD_REPEAT: number;\r\n readonly SVG_SPREADMETHOD_UNKNOWN: number;\r\n}\r\n\r\ninterface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference {\r\n readonly height: SVGAnimatedLength;\r\n readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio;\r\n readonly width: SVGAnimatedLength;\r\n readonly x: SVGAnimatedLength;\r\n readonly y: SVGAnimatedLength;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGImageElement: {\r\n prototype: SVGImageElement;\r\n new(): SVGImageElement;\r\n}\r\n\r\ninterface SVGLength {\r\n readonly unitType: number;\r\n value: number;\r\n valueAsString: string;\r\n valueInSpecifiedUnits: number;\r\n convertToSpecifiedUnits(unitType: number): void;\r\n newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void;\r\n readonly SVG_LENGTHTYPE_CM: number;\r\n readonly SVG_LENGTHTYPE_EMS: number;\r\n readonly SVG_LENGTHTYPE_EXS: number;\r\n readonly SVG_LENGTHTYPE_IN: number;\r\n readonly SVG_LENGTHTYPE_MM: number;\r\n readonly SVG_LENGTHTYPE_NUMBER: number;\r\n readonly SVG_LENGTHTYPE_PC: number;\r\n readonly SVG_LENGTHTYPE_PERCENTAGE: number;\r\n readonly SVG_LENGTHTYPE_PT: number;\r\n readonly SVG_LENGTHTYPE_PX: number;\r\n readonly SVG_LENGTHTYPE_UNKNOWN: number;\r\n}\r\n\r\ndeclare var SVGLength: {\r\n prototype: SVGLength;\r\n new(): SVGLength;\r\n readonly SVG_LENGTHTYPE_CM: number;\r\n readonly SVG_LENGTHTYPE_EMS: number;\r\n readonly SVG_LENGTHTYPE_EXS: number;\r\n readonly SVG_LENGTHTYPE_IN: number;\r\n readonly SVG_LENGTHTYPE_MM: number;\r\n readonly SVG_LENGTHTYPE_NUMBER: number;\r\n readonly SVG_LENGTHTYPE_PC: number;\r\n readonly SVG_LENGTHTYPE_PERCENTAGE: number;\r\n readonly SVG_LENGTHTYPE_PT: number;\r\n readonly SVG_LENGTHTYPE_PX: number;\r\n readonly SVG_LENGTHTYPE_UNKNOWN: number;\r\n}\r\n\r\ninterface SVGLengthList {\r\n readonly numberOfItems: number;\r\n appendItem(newItem: SVGLength): SVGLength;\r\n clear(): void;\r\n getItem(index: number): SVGLength;\r\n initialize(newItem: SVGLength): SVGLength;\r\n insertItemBefore(newItem: SVGLength, index: number): SVGLength;\r\n removeItem(index: number): SVGLength;\r\n replaceItem(newItem: SVGLength, index: number): SVGLength;\r\n}\r\n\r\ndeclare var SVGLengthList: {\r\n prototype: SVGLengthList;\r\n new(): SVGLengthList;\r\n}\r\n\r\ninterface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\r\n readonly x1: SVGAnimatedLength;\r\n readonly x2: SVGAnimatedLength;\r\n readonly y1: SVGAnimatedLength;\r\n readonly y2: SVGAnimatedLength;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGLineElement: {\r\n prototype: SVGLineElement;\r\n new(): SVGLineElement;\r\n}\r\n\r\ninterface SVGLinearGradientElement extends SVGGradientElement {\r\n readonly x1: SVGAnimatedLength;\r\n readonly x2: SVGAnimatedLength;\r\n readonly y1: SVGAnimatedLength;\r\n readonly y2: SVGAnimatedLength;\r\n}\r\n\r\ndeclare var SVGLinearGradientElement: {\r\n prototype: SVGLinearGradientElement;\r\n new(): SVGLinearGradientElement;\r\n}\r\n\r\ninterface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox {\r\n readonly markerHeight: SVGAnimatedLength;\r\n readonly markerUnits: SVGAnimatedEnumeration;\r\n readonly markerWidth: SVGAnimatedLength;\r\n readonly orientAngle: SVGAnimatedAngle;\r\n readonly orientType: SVGAnimatedEnumeration;\r\n readonly refX: SVGAnimatedLength;\r\n readonly refY: SVGAnimatedLength;\r\n setOrientToAngle(angle: SVGAngle): void;\r\n setOrientToAuto(): void;\r\n readonly SVG_MARKERUNITS_STROKEWIDTH: number;\r\n readonly SVG_MARKERUNITS_UNKNOWN: number;\r\n readonly SVG_MARKERUNITS_USERSPACEONUSE: number;\r\n readonly SVG_MARKER_ORIENT_ANGLE: number;\r\n readonly SVG_MARKER_ORIENT_AUTO: number;\r\n readonly SVG_MARKER_ORIENT_UNKNOWN: number;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGMarkerElement: {\r\n prototype: SVGMarkerElement;\r\n new(): SVGMarkerElement;\r\n readonly SVG_MARKERUNITS_STROKEWIDTH: number;\r\n readonly SVG_MARKERUNITS_UNKNOWN: number;\r\n readonly SVG_MARKERUNITS_USERSPACEONUSE: number;\r\n readonly SVG_MARKER_ORIENT_ANGLE: number;\r\n readonly SVG_MARKER_ORIENT_AUTO: number;\r\n readonly SVG_MARKER_ORIENT_UNKNOWN: number;\r\n}\r\n\r\ninterface SVGMaskElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes {\r\n readonly height: SVGAnimatedLength;\r\n readonly maskContentUnits: SVGAnimatedEnumeration;\r\n readonly maskUnits: SVGAnimatedEnumeration;\r\n readonly width: SVGAnimatedLength;\r\n readonly x: SVGAnimatedLength;\r\n readonly y: SVGAnimatedLength;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGMaskElement: {\r\n prototype: SVGMaskElement;\r\n new(): SVGMaskElement;\r\n}\r\n\r\ninterface SVGMatrix {\r\n a: number;\r\n b: number;\r\n c: number;\r\n d: number;\r\n e: number;\r\n f: number;\r\n flipX(): SVGMatrix;\r\n flipY(): SVGMatrix;\r\n inverse(): SVGMatrix;\r\n multiply(secondMatrix: SVGMatrix): SVGMatrix;\r\n rotate(angle: number): SVGMatrix;\r\n rotateFromVector(x: number, y: number): SVGMatrix;\r\n scale(scaleFactor: number): SVGMatrix;\r\n scaleNonUniform(scaleFactorX: number, scaleFactorY: number): SVGMatrix;\r\n skewX(angle: number): SVGMatrix;\r\n skewY(angle: number): SVGMatrix;\r\n translate(x: number, y: number): SVGMatrix;\r\n}\r\n\r\ndeclare var SVGMatrix: {\r\n prototype: SVGMatrix;\r\n new(): SVGMatrix;\r\n}\r\n\r\ninterface SVGMetadataElement extends SVGElement {\r\n}\r\n\r\ndeclare var SVGMetadataElement: {\r\n prototype: SVGMetadataElement;\r\n new(): SVGMetadataElement;\r\n}\r\n\r\ninterface SVGNumber {\r\n value: number;\r\n}\r\n\r\ndeclare var SVGNumber: {\r\n prototype: SVGNumber;\r\n new(): SVGNumber;\r\n}\r\n\r\ninterface SVGNumberList {\r\n readonly numberOfItems: number;\r\n appendItem(newItem: SVGNumber): SVGNumber;\r\n clear(): void;\r\n getItem(index: number): SVGNumber;\r\n initialize(newItem: SVGNumber): SVGNumber;\r\n insertItemBefore(newItem: SVGNumber, index: number): SVGNumber;\r\n removeItem(index: number): SVGNumber;\r\n replaceItem(newItem: SVGNumber, index: number): SVGNumber;\r\n}\r\n\r\ndeclare var SVGNumberList: {\r\n prototype: SVGNumberList;\r\n new(): SVGNumberList;\r\n}\r\n\r\ninterface SVGPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPathData {\r\n createSVGPathSegArcAbs(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcAbs;\r\n createSVGPathSegArcRel(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcRel;\r\n createSVGPathSegClosePath(): SVGPathSegClosePath;\r\n createSVGPathSegCurvetoCubicAbs(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicAbs;\r\n createSVGPathSegCurvetoCubicRel(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicRel;\r\n createSVGPathSegCurvetoCubicSmoothAbs(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothAbs;\r\n createSVGPathSegCurvetoCubicSmoothRel(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothRel;\r\n createSVGPathSegCurvetoQuadraticAbs(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticAbs;\r\n createSVGPathSegCurvetoQuadraticRel(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticRel;\r\n createSVGPathSegCurvetoQuadraticSmoothAbs(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothAbs;\r\n createSVGPathSegCurvetoQuadraticSmoothRel(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothRel;\r\n createSVGPathSegLinetoAbs(x: number, y: number): SVGPathSegLinetoAbs;\r\n createSVGPathSegLinetoHorizontalAbs(x: number): SVGPathSegLinetoHorizontalAbs;\r\n createSVGPathSegLinetoHorizontalRel(x: number): SVGPathSegLinetoHorizontalRel;\r\n createSVGPathSegLinetoRel(x: number, y: number): SVGPathSegLinetoRel;\r\n createSVGPathSegLinetoVerticalAbs(y: number): SVGPathSegLinetoVerticalAbs;\r\n createSVGPathSegLinetoVerticalRel(y: number): SVGPathSegLinetoVerticalRel;\r\n createSVGPathSegMovetoAbs(x: number, y: number): SVGPathSegMovetoAbs;\r\n createSVGPathSegMovetoRel(x: number, y: number): SVGPathSegMovetoRel;\r\n getPathSegAtLength(distance: number): number;\r\n getPointAtLength(distance: number): SVGPoint;\r\n getTotalLength(): number;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGPathElement: {\r\n prototype: SVGPathElement;\r\n new(): SVGPathElement;\r\n}\r\n\r\ninterface SVGPathSeg {\r\n readonly pathSegType: number;\r\n readonly pathSegTypeAsLetter: string;\r\n readonly PATHSEG_ARC_ABS: number;\r\n readonly PATHSEG_ARC_REL: number;\r\n readonly PATHSEG_CLOSEPATH: number;\r\n readonly PATHSEG_CURVETO_CUBIC_ABS: number;\r\n readonly PATHSEG_CURVETO_CUBIC_REL: number;\r\n readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number;\r\n readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number;\r\n readonly PATHSEG_CURVETO_QUADRATIC_ABS: number;\r\n readonly PATHSEG_CURVETO_QUADRATIC_REL: number;\r\n readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number;\r\n readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number;\r\n readonly PATHSEG_LINETO_ABS: number;\r\n readonly PATHSEG_LINETO_HORIZONTAL_ABS: number;\r\n readonly PATHSEG_LINETO_HORIZONTAL_REL: number;\r\n readonly PATHSEG_LINETO_REL: number;\r\n readonly PATHSEG_LINETO_VERTICAL_ABS: number;\r\n readonly PATHSEG_LINETO_VERTICAL_REL: number;\r\n readonly PATHSEG_MOVETO_ABS: number;\r\n readonly PATHSEG_MOVETO_REL: number;\r\n readonly PATHSEG_UNKNOWN: number;\r\n}\r\n\r\ndeclare var SVGPathSeg: {\r\n prototype: SVGPathSeg;\r\n new(): SVGPathSeg;\r\n readonly PATHSEG_ARC_ABS: number;\r\n readonly PATHSEG_ARC_REL: number;\r\n readonly PATHSEG_CLOSEPATH: number;\r\n readonly PATHSEG_CURVETO_CUBIC_ABS: number;\r\n readonly PATHSEG_CURVETO_CUBIC_REL: number;\r\n readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number;\r\n readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number;\r\n readonly PATHSEG_CURVETO_QUADRATIC_ABS: number;\r\n readonly PATHSEG_CURVETO_QUADRATIC_REL: number;\r\n readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number;\r\n readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number;\r\n readonly PATHSEG_LINETO_ABS: number;\r\n readonly PATHSEG_LINETO_HORIZONTAL_ABS: number;\r\n readonly PATHSEG_LINETO_HORIZONTAL_REL: number;\r\n readonly PATHSEG_LINETO_REL: number;\r\n readonly PATHSEG_LINETO_VERTICAL_ABS: number;\r\n readonly PATHSEG_LINETO_VERTICAL_REL: number;\r\n readonly PATHSEG_MOVETO_ABS: number;\r\n readonly PATHSEG_MOVETO_REL: number;\r\n readonly PATHSEG_UNKNOWN: number;\r\n}\r\n\r\ninterface SVGPathSegArcAbs extends SVGPathSeg {\r\n angle: number;\r\n largeArcFlag: boolean;\r\n r1: number;\r\n r2: number;\r\n sweepFlag: boolean;\r\n x: number;\r\n y: number;\r\n}\r\n\r\ndeclare var SVGPathSegArcAbs: {\r\n prototype: SVGPathSegArcAbs;\r\n new(): SVGPathSegArcAbs;\r\n}\r\n\r\ninterface SVGPathSegArcRel extends SVGPathSeg {\r\n angle: number;\r\n largeArcFlag: boolean;\r\n r1: number;\r\n r2: number;\r\n sweepFlag: boolean;\r\n x: number;\r\n y: number;\r\n}\r\n\r\ndeclare var SVGPathSegArcRel: {\r\n prototype: SVGPathSegArcRel;\r\n new(): SVGPathSegArcRel;\r\n}\r\n\r\ninterface SVGPathSegClosePath extends SVGPathSeg {\r\n}\r\n\r\ndeclare var SVGPathSegClosePath: {\r\n prototype: SVGPathSegClosePath;\r\n new(): SVGPathSegClosePath;\r\n}\r\n\r\ninterface SVGPathSegCurvetoCubicAbs extends SVGPathSeg {\r\n x: number;\r\n x1: number;\r\n x2: number;\r\n y: number;\r\n y1: number;\r\n y2: number;\r\n}\r\n\r\ndeclare var SVGPathSegCurvetoCubicAbs: {\r\n prototype: SVGPathSegCurvetoCubicAbs;\r\n new(): SVGPathSegCurvetoCubicAbs;\r\n}\r\n\r\ninterface SVGPathSegCurvetoCubicRel extends SVGPathSeg {\r\n x: number;\r\n x1: number;\r\n x2: number;\r\n y: number;\r\n y1: number;\r\n y2: number;\r\n}\r\n\r\ndeclare var SVGPathSegCurvetoCubicRel: {\r\n prototype: SVGPathSegCurvetoCubicRel;\r\n new(): SVGPathSegCurvetoCubicRel;\r\n}\r\n\r\ninterface SVGPathSegCurvetoCubicSmoothAbs extends SVGPathSeg {\r\n x: number;\r\n x2: number;\r\n y: number;\r\n y2: number;\r\n}\r\n\r\ndeclare var SVGPathSegCurvetoCubicSmoothAbs: {\r\n prototype: SVGPathSegCurvetoCubicSmoothAbs;\r\n new(): SVGPathSegCurvetoCubicSmoothAbs;\r\n}\r\n\r\ninterface SVGPathSegCurvetoCubicSmoothRel extends SVGPathSeg {\r\n x: number;\r\n x2: number;\r\n y: number;\r\n y2: number;\r\n}\r\n\r\ndeclare var SVGPathSegCurvetoCubicSmoothRel: {\r\n prototype: SVGPathSegCurvetoCubicSmoothRel;\r\n new(): SVGPathSegCurvetoCubicSmoothRel;\r\n}\r\n\r\ninterface SVGPathSegCurvetoQuadraticAbs extends SVGPathSeg {\r\n x: number;\r\n x1: number;\r\n y: number;\r\n y1: number;\r\n}\r\n\r\ndeclare var SVGPathSegCurvetoQuadraticAbs: {\r\n prototype: SVGPathSegCurvetoQuadraticAbs;\r\n new(): SVGPathSegCurvetoQuadraticAbs;\r\n}\r\n\r\ninterface SVGPathSegCurvetoQuadraticRel extends SVGPathSeg {\r\n x: number;\r\n x1: number;\r\n y: number;\r\n y1: number;\r\n}\r\n\r\ndeclare var SVGPathSegCurvetoQuadraticRel: {\r\n prototype: SVGPathSegCurvetoQuadraticRel;\r\n new(): SVGPathSegCurvetoQuadraticRel;\r\n}\r\n\r\ninterface SVGPathSegCurvetoQuadraticSmoothAbs extends SVGPathSeg {\r\n x: number;\r\n y: number;\r\n}\r\n\r\ndeclare var SVGPathSegCurvetoQuadraticSmoothAbs: {\r\n prototype: SVGPathSegCurvetoQuadraticSmoothAbs;\r\n new(): SVGPathSegCurvetoQuadraticSmoothAbs;\r\n}\r\n\r\ninterface SVGPathSegCurvetoQuadraticSmoothRel extends SVGPathSeg {\r\n x: number;\r\n y: number;\r\n}\r\n\r\ndeclare var SVGPathSegCurvetoQuadraticSmoothRel: {\r\n prototype: SVGPathSegCurvetoQuadraticSmoothRel;\r\n new(): SVGPathSegCurvetoQuadraticSmoothRel;\r\n}\r\n\r\ninterface SVGPathSegLinetoAbs extends SVGPathSeg {\r\n x: number;\r\n y: number;\r\n}\r\n\r\ndeclare var SVGPathSegLinetoAbs: {\r\n prototype: SVGPathSegLinetoAbs;\r\n new(): SVGPathSegLinetoAbs;\r\n}\r\n\r\ninterface SVGPathSegLinetoHorizontalAbs extends SVGPathSeg {\r\n x: number;\r\n}\r\n\r\ndeclare var SVGPathSegLinetoHorizontalAbs: {\r\n prototype: SVGPathSegLinetoHorizontalAbs;\r\n new(): SVGPathSegLinetoHorizontalAbs;\r\n}\r\n\r\ninterface SVGPathSegLinetoHorizontalRel extends SVGPathSeg {\r\n x: number;\r\n}\r\n\r\ndeclare var SVGPathSegLinetoHorizontalRel: {\r\n prototype: SVGPathSegLinetoHorizontalRel;\r\n new(): SVGPathSegLinetoHorizontalRel;\r\n}\r\n\r\ninterface SVGPathSegLinetoRel extends SVGPathSeg {\r\n x: number;\r\n y: number;\r\n}\r\n\r\ndeclare var SVGPathSegLinetoRel: {\r\n prototype: SVGPathSegLinetoRel;\r\n new(): SVGPathSegLinetoRel;\r\n}\r\n\r\ninterface SVGPathSegLinetoVerticalAbs extends SVGPathSeg {\r\n y: number;\r\n}\r\n\r\ndeclare var SVGPathSegLinetoVerticalAbs: {\r\n prototype: SVGPathSegLinetoVerticalAbs;\r\n new(): SVGPathSegLinetoVerticalAbs;\r\n}\r\n\r\ninterface SVGPathSegLinetoVerticalRel extends SVGPathSeg {\r\n y: number;\r\n}\r\n\r\ndeclare var SVGPathSegLinetoVerticalRel: {\r\n prototype: SVGPathSegLinetoVerticalRel;\r\n new(): SVGPathSegLinetoVerticalRel;\r\n}\r\n\r\ninterface SVGPathSegList {\r\n readonly numberOfItems: number;\r\n appendItem(newItem: SVGPathSeg): SVGPathSeg;\r\n clear(): void;\r\n getItem(index: number): SVGPathSeg;\r\n initialize(newItem: SVGPathSeg): SVGPathSeg;\r\n insertItemBefore(newItem: SVGPathSeg, index: number): SVGPathSeg;\r\n removeItem(index: number): SVGPathSeg;\r\n replaceItem(newItem: SVGPathSeg, index: number): SVGPathSeg;\r\n}\r\n\r\ndeclare var SVGPathSegList: {\r\n prototype: SVGPathSegList;\r\n new(): SVGPathSegList;\r\n}\r\n\r\ninterface SVGPathSegMovetoAbs extends SVGPathSeg {\r\n x: number;\r\n y: number;\r\n}\r\n\r\ndeclare var SVGPathSegMovetoAbs: {\r\n prototype: SVGPathSegMovetoAbs;\r\n new(): SVGPathSegMovetoAbs;\r\n}\r\n\r\ninterface SVGPathSegMovetoRel extends SVGPathSeg {\r\n x: number;\r\n y: number;\r\n}\r\n\r\ndeclare var SVGPathSegMovetoRel: {\r\n prototype: SVGPathSegMovetoRel;\r\n new(): SVGPathSegMovetoRel;\r\n}\r\n\r\ninterface SVGPatternElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGURIReference, SVGUnitTypes {\r\n readonly height: SVGAnimatedLength;\r\n readonly patternContentUnits: SVGAnimatedEnumeration;\r\n readonly patternTransform: SVGAnimatedTransformList;\r\n readonly patternUnits: SVGAnimatedEnumeration;\r\n readonly width: SVGAnimatedLength;\r\n readonly x: SVGAnimatedLength;\r\n readonly y: SVGAnimatedLength;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGPatternElement: {\r\n prototype: SVGPatternElement;\r\n new(): SVGPatternElement;\r\n}\r\n\r\ninterface SVGPoint {\r\n x: number;\r\n y: number;\r\n matrixTransform(matrix: SVGMatrix): SVGPoint;\r\n}\r\n\r\ndeclare var SVGPoint: {\r\n prototype: SVGPoint;\r\n new(): SVGPoint;\r\n}\r\n\r\ninterface SVGPointList {\r\n readonly numberOfItems: number;\r\n appendItem(newItem: SVGPoint): SVGPoint;\r\n clear(): void;\r\n getItem(index: number): SVGPoint;\r\n initialize(newItem: SVGPoint): SVGPoint;\r\n insertItemBefore(newItem: SVGPoint, index: number): SVGPoint;\r\n removeItem(index: number): SVGPoint;\r\n replaceItem(newItem: SVGPoint, index: number): SVGPoint;\r\n}\r\n\r\ndeclare var SVGPointList: {\r\n prototype: SVGPointList;\r\n new(): SVGPointList;\r\n}\r\n\r\ninterface SVGPolygonElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints {\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGPolygonElement: {\r\n prototype: SVGPolygonElement;\r\n new(): SVGPolygonElement;\r\n}\r\n\r\ninterface SVGPolylineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints {\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGPolylineElement: {\r\n prototype: SVGPolylineElement;\r\n new(): SVGPolylineElement;\r\n}\r\n\r\ninterface SVGPreserveAspectRatio {\r\n align: number;\r\n meetOrSlice: number;\r\n readonly SVG_MEETORSLICE_MEET: number;\r\n readonly SVG_MEETORSLICE_SLICE: number;\r\n readonly SVG_MEETORSLICE_UNKNOWN: number;\r\n readonly SVG_PRESERVEASPECTRATIO_NONE: number;\r\n readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number;\r\n}\r\n\r\ndeclare var SVGPreserveAspectRatio: {\r\n prototype: SVGPreserveAspectRatio;\r\n new(): SVGPreserveAspectRatio;\r\n readonly SVG_MEETORSLICE_MEET: number;\r\n readonly SVG_MEETORSLICE_SLICE: number;\r\n readonly SVG_MEETORSLICE_UNKNOWN: number;\r\n readonly SVG_PRESERVEASPECTRATIO_NONE: number;\r\n readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number;\r\n}\r\n\r\ninterface SVGRadialGradientElement extends SVGGradientElement {\r\n readonly cx: SVGAnimatedLength;\r\n readonly cy: SVGAnimatedLength;\r\n readonly fx: SVGAnimatedLength;\r\n readonly fy: SVGAnimatedLength;\r\n readonly r: SVGAnimatedLength;\r\n}\r\n\r\ndeclare var SVGRadialGradientElement: {\r\n prototype: SVGRadialGradientElement;\r\n new(): SVGRadialGradientElement;\r\n}\r\n\r\ninterface SVGRect {\r\n height: number;\r\n width: number;\r\n x: number;\r\n y: number;\r\n}\r\n\r\ndeclare var SVGRect: {\r\n prototype: SVGRect;\r\n new(): SVGRect;\r\n}\r\n\r\ninterface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\r\n readonly height: SVGAnimatedLength;\r\n readonly rx: SVGAnimatedLength;\r\n readonly ry: SVGAnimatedLength;\r\n readonly width: SVGAnimatedLength;\r\n readonly x: SVGAnimatedLength;\r\n readonly y: SVGAnimatedLength;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGRectElement: {\r\n prototype: SVGRectElement;\r\n new(): SVGRectElement;\r\n}\r\n\r\ninterface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTests, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan {\r\n contentScriptType: string;\r\n contentStyleType: string;\r\n currentScale: number;\r\n readonly currentTranslate: SVGPoint;\r\n readonly height: SVGAnimatedLength;\r\n onabort: (this: this, ev: Event) => any;\r\n onerror: (this: this, ev: Event) => any;\r\n onresize: (this: this, ev: UIEvent) => any;\r\n onscroll: (this: this, ev: UIEvent) => any;\r\n onunload: (this: this, ev: Event) => any;\r\n onzoom: (this: this, ev: SVGZoomEvent) => any;\r\n readonly pixelUnitToMillimeterX: number;\r\n readonly pixelUnitToMillimeterY: number;\r\n readonly screenPixelToMillimeterX: number;\r\n readonly screenPixelToMillimeterY: number;\r\n readonly viewport: SVGRect;\r\n readonly width: SVGAnimatedLength;\r\n readonly x: SVGAnimatedLength;\r\n readonly y: SVGAnimatedLength;\r\n checkEnclosure(element: SVGElement, rect: SVGRect): boolean;\r\n checkIntersection(element: SVGElement, rect: SVGRect): boolean;\r\n createSVGAngle(): SVGAngle;\r\n createSVGLength(): SVGLength;\r\n createSVGMatrix(): SVGMatrix;\r\n createSVGNumber(): SVGNumber;\r\n createSVGPoint(): SVGPoint;\r\n createSVGRect(): SVGRect;\r\n createSVGTransform(): SVGTransform;\r\n createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform;\r\n deselectAll(): void;\r\n forceRedraw(): void;\r\n getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration;\r\n getCurrentTime(): number;\r\n getElementById(elementId: string): Element;\r\n getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeListOf;\r\n getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeListOf;\r\n pauseAnimations(): void;\r\n setCurrentTime(seconds: number): void;\r\n suspendRedraw(maxWaitMilliseconds: number): number;\r\n unpauseAnimations(): void;\r\n unsuspendRedraw(suspendHandleID: number): void;\r\n unsuspendRedrawAll(): void;\r\n addEventListener(type: \"MSGestureChange\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureDoubleTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureEnd\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureHold\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGotPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSInertiaStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSLostPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerCancel\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerDown\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerEnter\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerLeave\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerMove\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOut\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOver\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerUp\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"SVGAbort\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"SVGError\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"SVGUnload\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"SVGZoom\", listener: (this: this, ev: SVGZoomEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ariarequest\", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"click\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"command\", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dblclick\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"focusin\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"focusout\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"gotpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"lostpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousedown\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousemove\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseout\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseover\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseup\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointercancel\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerdown\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerenter\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerleave\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointermove\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerout\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerover\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerup\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"resize\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"scroll\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchcancel\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchend\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchmove\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchstart\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenerror\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"wheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGSVGElement: {\r\n prototype: SVGSVGElement;\r\n new(): SVGSVGElement;\r\n}\r\n\r\ninterface SVGScriptElement extends SVGElement, SVGExternalResourcesRequired, SVGURIReference {\r\n type: string;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGScriptElement: {\r\n prototype: SVGScriptElement;\r\n new(): SVGScriptElement;\r\n}\r\n\r\ninterface SVGStopElement extends SVGElement, SVGStylable {\r\n readonly offset: SVGAnimatedNumber;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGStopElement: {\r\n prototype: SVGStopElement;\r\n new(): SVGStopElement;\r\n}\r\n\r\ninterface SVGStringList {\r\n readonly numberOfItems: number;\r\n appendItem(newItem: string): string;\r\n clear(): void;\r\n getItem(index: number): string;\r\n initialize(newItem: string): string;\r\n insertItemBefore(newItem: string, index: number): string;\r\n removeItem(index: number): string;\r\n replaceItem(newItem: string, index: number): string;\r\n}\r\n\r\ndeclare var SVGStringList: {\r\n prototype: SVGStringList;\r\n new(): SVGStringList;\r\n}\r\n\r\ninterface SVGStyleElement extends SVGElement, SVGLangSpace {\r\n disabled: boolean;\r\n media: string;\r\n title: string;\r\n type: string;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGStyleElement: {\r\n prototype: SVGStyleElement;\r\n new(): SVGStyleElement;\r\n}\r\n\r\ninterface SVGSwitchElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGSwitchElement: {\r\n prototype: SVGSwitchElement;\r\n new(): SVGSwitchElement;\r\n}\r\n\r\ninterface SVGSymbolElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox {\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGSymbolElement: {\r\n prototype: SVGSymbolElement;\r\n new(): SVGSymbolElement;\r\n}\r\n\r\ninterface SVGTSpanElement extends SVGTextPositioningElement {\r\n}\r\n\r\ndeclare var SVGTSpanElement: {\r\n prototype: SVGTSpanElement;\r\n new(): SVGTSpanElement;\r\n}\r\n\r\ninterface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\r\n readonly lengthAdjust: SVGAnimatedEnumeration;\r\n readonly textLength: SVGAnimatedLength;\r\n getCharNumAtPosition(point: SVGPoint): number;\r\n getComputedTextLength(): number;\r\n getEndPositionOfChar(charnum: number): SVGPoint;\r\n getExtentOfChar(charnum: number): SVGRect;\r\n getNumberOfChars(): number;\r\n getRotationOfChar(charnum: number): number;\r\n getStartPositionOfChar(charnum: number): SVGPoint;\r\n getSubStringLength(charnum: number, nchars: number): number;\r\n selectSubString(charnum: number, nchars: number): void;\r\n readonly LENGTHADJUST_SPACING: number;\r\n readonly LENGTHADJUST_SPACINGANDGLYPHS: number;\r\n readonly LENGTHADJUST_UNKNOWN: number;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGTextContentElement: {\r\n prototype: SVGTextContentElement;\r\n new(): SVGTextContentElement;\r\n readonly LENGTHADJUST_SPACING: number;\r\n readonly LENGTHADJUST_SPACINGANDGLYPHS: number;\r\n readonly LENGTHADJUST_UNKNOWN: number;\r\n}\r\n\r\ninterface SVGTextElement extends SVGTextPositioningElement, SVGTransformable {\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGTextElement: {\r\n prototype: SVGTextElement;\r\n new(): SVGTextElement;\r\n}\r\n\r\ninterface SVGTextPathElement extends SVGTextContentElement, SVGURIReference {\r\n readonly method: SVGAnimatedEnumeration;\r\n readonly spacing: SVGAnimatedEnumeration;\r\n readonly startOffset: SVGAnimatedLength;\r\n readonly TEXTPATH_METHODTYPE_ALIGN: number;\r\n readonly TEXTPATH_METHODTYPE_STRETCH: number;\r\n readonly TEXTPATH_METHODTYPE_UNKNOWN: number;\r\n readonly TEXTPATH_SPACINGTYPE_AUTO: number;\r\n readonly TEXTPATH_SPACINGTYPE_EXACT: number;\r\n readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGTextPathElement: {\r\n prototype: SVGTextPathElement;\r\n new(): SVGTextPathElement;\r\n readonly TEXTPATH_METHODTYPE_ALIGN: number;\r\n readonly TEXTPATH_METHODTYPE_STRETCH: number;\r\n readonly TEXTPATH_METHODTYPE_UNKNOWN: number;\r\n readonly TEXTPATH_SPACINGTYPE_AUTO: number;\r\n readonly TEXTPATH_SPACINGTYPE_EXACT: number;\r\n readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number;\r\n}\r\n\r\ninterface SVGTextPositioningElement extends SVGTextContentElement {\r\n readonly dx: SVGAnimatedLengthList;\r\n readonly dy: SVGAnimatedLengthList;\r\n readonly rotate: SVGAnimatedNumberList;\r\n readonly x: SVGAnimatedLengthList;\r\n readonly y: SVGAnimatedLengthList;\r\n}\r\n\r\ndeclare var SVGTextPositioningElement: {\r\n prototype: SVGTextPositioningElement;\r\n new(): SVGTextPositioningElement;\r\n}\r\n\r\ninterface SVGTitleElement extends SVGElement, SVGStylable, SVGLangSpace {\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGTitleElement: {\r\n prototype: SVGTitleElement;\r\n new(): SVGTitleElement;\r\n}\r\n\r\ninterface SVGTransform {\r\n readonly angle: number;\r\n readonly matrix: SVGMatrix;\r\n readonly type: number;\r\n setMatrix(matrix: SVGMatrix): void;\r\n setRotate(angle: number, cx: number, cy: number): void;\r\n setScale(sx: number, sy: number): void;\r\n setSkewX(angle: number): void;\r\n setSkewY(angle: number): void;\r\n setTranslate(tx: number, ty: number): void;\r\n readonly SVG_TRANSFORM_MATRIX: number;\r\n readonly SVG_TRANSFORM_ROTATE: number;\r\n readonly SVG_TRANSFORM_SCALE: number;\r\n readonly SVG_TRANSFORM_SKEWX: number;\r\n readonly SVG_TRANSFORM_SKEWY: number;\r\n readonly SVG_TRANSFORM_TRANSLATE: number;\r\n readonly SVG_TRANSFORM_UNKNOWN: number;\r\n}\r\n\r\ndeclare var SVGTransform: {\r\n prototype: SVGTransform;\r\n new(): SVGTransform;\r\n readonly SVG_TRANSFORM_MATRIX: number;\r\n readonly SVG_TRANSFORM_ROTATE: number;\r\n readonly SVG_TRANSFORM_SCALE: number;\r\n readonly SVG_TRANSFORM_SKEWX: number;\r\n readonly SVG_TRANSFORM_SKEWY: number;\r\n readonly SVG_TRANSFORM_TRANSLATE: number;\r\n readonly SVG_TRANSFORM_UNKNOWN: number;\r\n}\r\n\r\ninterface SVGTransformList {\r\n readonly numberOfItems: number;\r\n appendItem(newItem: SVGTransform): SVGTransform;\r\n clear(): void;\r\n consolidate(): SVGTransform;\r\n createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform;\r\n getItem(index: number): SVGTransform;\r\n initialize(newItem: SVGTransform): SVGTransform;\r\n insertItemBefore(newItem: SVGTransform, index: number): SVGTransform;\r\n removeItem(index: number): SVGTransform;\r\n replaceItem(newItem: SVGTransform, index: number): SVGTransform;\r\n}\r\n\r\ndeclare var SVGTransformList: {\r\n prototype: SVGTransformList;\r\n new(): SVGTransformList;\r\n}\r\n\r\ninterface SVGUnitTypes {\r\n readonly SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number;\r\n readonly SVG_UNIT_TYPE_UNKNOWN: number;\r\n readonly SVG_UNIT_TYPE_USERSPACEONUSE: number;\r\n}\r\ndeclare var SVGUnitTypes: SVGUnitTypes;\r\n\r\ninterface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference {\r\n readonly animatedInstanceRoot: SVGElementInstance;\r\n readonly height: SVGAnimatedLength;\r\n readonly instanceRoot: SVGElementInstance;\r\n readonly width: SVGAnimatedLength;\r\n readonly x: SVGAnimatedLength;\r\n readonly y: SVGAnimatedLength;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGUseElement: {\r\n prototype: SVGUseElement;\r\n new(): SVGUseElement;\r\n}\r\n\r\ninterface SVGViewElement extends SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan {\r\n readonly viewTarget: SVGStringList;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGViewElement: {\r\n prototype: SVGViewElement;\r\n new(): SVGViewElement;\r\n}\r\n\r\ninterface SVGZoomAndPan {\r\n readonly zoomAndPan: number;\r\n}\r\n\r\ndeclare var SVGZoomAndPan: {\r\n readonly SVG_ZOOMANDPAN_DISABLE: number;\r\n readonly SVG_ZOOMANDPAN_MAGNIFY: number;\r\n readonly SVG_ZOOMANDPAN_UNKNOWN: number;\r\n}\r\n\r\ninterface SVGZoomEvent extends UIEvent {\r\n readonly newScale: number;\r\n readonly newTranslate: SVGPoint;\r\n readonly previousScale: number;\r\n readonly previousTranslate: SVGPoint;\r\n readonly zoomRectScreen: SVGRect;\r\n}\r\n\r\ndeclare var SVGZoomEvent: {\r\n prototype: SVGZoomEvent;\r\n new(): SVGZoomEvent;\r\n}\r\n\r\ninterface Screen extends EventTarget {\r\n readonly availHeight: number;\r\n readonly availWidth: number;\r\n bufferDepth: number;\r\n readonly colorDepth: number;\r\n readonly deviceXDPI: number;\r\n readonly deviceYDPI: number;\r\n readonly fontSmoothingEnabled: boolean;\r\n readonly height: number;\r\n readonly logicalXDPI: number;\r\n readonly logicalYDPI: number;\r\n readonly msOrientation: string;\r\n onmsorientationchange: (this: this, ev: Event) => any;\r\n readonly pixelDepth: number;\r\n readonly systemXDPI: number;\r\n readonly systemYDPI: number;\r\n readonly width: number;\r\n msLockOrientation(orientations: string | string[]): boolean;\r\n msUnlockOrientation(): void;\r\n addEventListener(type: \"MSOrientationChange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var Screen: {\r\n prototype: Screen;\r\n new(): Screen;\r\n}\r\n\r\ninterface ScriptNotifyEvent extends Event {\r\n readonly callingUri: string;\r\n readonly value: string;\r\n}\r\n\r\ndeclare var ScriptNotifyEvent: {\r\n prototype: ScriptNotifyEvent;\r\n new(): ScriptNotifyEvent;\r\n}\r\n\r\ninterface ScriptProcessorNode extends AudioNode {\r\n readonly bufferSize: number;\r\n onaudioprocess: (this: this, ev: AudioProcessingEvent) => any;\r\n addEventListener(type: \"audioprocess\", listener: (this: this, ev: AudioProcessingEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var ScriptProcessorNode: {\r\n prototype: ScriptProcessorNode;\r\n new(): ScriptProcessorNode;\r\n}\r\n\r\ninterface Selection {\r\n readonly anchorNode: Node;\r\n readonly anchorOffset: number;\r\n readonly focusNode: Node;\r\n readonly focusOffset: number;\r\n readonly isCollapsed: boolean;\r\n readonly rangeCount: number;\r\n readonly type: string;\r\n addRange(range: Range): void;\r\n collapse(parentNode: Node, offset: number): void;\r\n collapseToEnd(): void;\r\n collapseToStart(): void;\r\n containsNode(node: Node, partlyContained: boolean): boolean;\r\n deleteFromDocument(): void;\r\n empty(): void;\r\n extend(newNode: Node, offset: number): void;\r\n getRangeAt(index: number): Range;\r\n removeAllRanges(): void;\r\n removeRange(range: Range): void;\r\n selectAllChildren(parentNode: Node): void;\r\n setBaseAndExtent(baseNode: Node, baseOffset: number, extentNode: Node, extentOffset: number): void;\r\n toString(): string;\r\n}\r\n\r\ndeclare var Selection: {\r\n prototype: Selection;\r\n new(): Selection;\r\n}\r\n\r\ninterface SourceBuffer extends EventTarget {\r\n appendWindowEnd: number;\r\n appendWindowStart: number;\r\n readonly audioTracks: AudioTrackList;\r\n readonly buffered: TimeRanges;\r\n mode: string;\r\n timestampOffset: number;\r\n readonly updating: boolean;\r\n readonly videoTracks: VideoTrackList;\r\n abort(): void;\r\n appendBuffer(data: ArrayBuffer | ArrayBufferView): void;\r\n appendStream(stream: MSStream, maxSize?: number): void;\r\n remove(start: number, end: number): void;\r\n}\r\n\r\ndeclare var SourceBuffer: {\r\n prototype: SourceBuffer;\r\n new(): SourceBuffer;\r\n}\r\n\r\ninterface SourceBufferList extends EventTarget {\r\n readonly length: number;\r\n item(index: number): SourceBuffer;\r\n [index: number]: SourceBuffer;\r\n}\r\n\r\ndeclare var SourceBufferList: {\r\n prototype: SourceBufferList;\r\n new(): SourceBufferList;\r\n}\r\n\r\ninterface StereoPannerNode extends AudioNode {\r\n readonly pan: AudioParam;\r\n}\r\n\r\ndeclare var StereoPannerNode: {\r\n prototype: StereoPannerNode;\r\n new(): StereoPannerNode;\r\n}\r\n\r\ninterface Storage {\r\n readonly length: number;\r\n clear(): void;\r\n getItem(key: string): string | null;\r\n key(index: number): string | null;\r\n removeItem(key: string): void;\r\n setItem(key: string, data: string): void;\r\n [key: string]: any;\r\n [index: number]: string;\r\n}\r\n\r\ndeclare var Storage: {\r\n prototype: Storage;\r\n new(): Storage;\r\n}\r\n\r\ninterface StorageEvent extends Event {\r\n readonly url: string;\r\n key?: string;\r\n oldValue?: string;\r\n newValue?: string;\r\n storageArea?: Storage;\r\n}\r\n\r\ndeclare var StorageEvent: {\r\n prototype: StorageEvent;\r\n new (type: string, eventInitDict?: StorageEventInit): StorageEvent;\r\n}\r\n\r\ninterface StyleMedia {\r\n readonly type: string;\r\n matchMedium(mediaquery: string): boolean;\r\n}\r\n\r\ndeclare var StyleMedia: {\r\n prototype: StyleMedia;\r\n new(): StyleMedia;\r\n}\r\n\r\ninterface StyleSheet {\r\n disabled: boolean;\r\n readonly href: string;\r\n readonly media: MediaList;\r\n readonly ownerNode: Node;\r\n readonly parentStyleSheet: StyleSheet;\r\n readonly title: string;\r\n readonly type: string;\r\n}\r\n\r\ndeclare var StyleSheet: {\r\n prototype: StyleSheet;\r\n new(): StyleSheet;\r\n}\r\n\r\ninterface StyleSheetList {\r\n readonly length: number;\r\n item(index?: number): StyleSheet;\r\n [index: number]: StyleSheet;\r\n}\r\n\r\ndeclare var StyleSheetList: {\r\n prototype: StyleSheetList;\r\n new(): StyleSheetList;\r\n}\r\n\r\ninterface StyleSheetPageList {\r\n readonly length: number;\r\n item(index: number): CSSPageRule;\r\n [index: number]: CSSPageRule;\r\n}\r\n\r\ndeclare var StyleSheetPageList: {\r\n prototype: StyleSheetPageList;\r\n new(): StyleSheetPageList;\r\n}\r\n\r\ninterface SubtleCrypto {\r\n decrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike;\r\n deriveBits(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, length: number): PromiseLike;\r\n deriveKey(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: string | AesDerivedKeyParams | HmacImportParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike;\r\n digest(algorithm: AlgorithmIdentifier, data: BufferSource): PromiseLike;\r\n encrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike;\r\n exportKey(format: \"jwk\", key: CryptoKey): PromiseLike;\r\n exportKey(format: \"raw\" | \"pkcs8\" | \"spki\", key: CryptoKey): PromiseLike;\r\n exportKey(format: string, key: CryptoKey): PromiseLike;\r\n generateKey(algorithm: string, extractable: boolean, keyUsages: string[]): PromiseLike;\r\n generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams | DhKeyGenParams, extractable: boolean, keyUsages: string[]): PromiseLike;\r\n generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike;\r\n importKey(format: \"jwk\", keyData: JsonWebKey, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike;\r\n importKey(format: \"raw\" | \"pkcs8\" | \"spki\", keyData: BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike;\r\n importKey(format: string, keyData: JsonWebKey | BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike;\r\n sign(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, data: BufferSource): PromiseLike;\r\n unwrapKey(format: string, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier, unwrappedKeyAlgorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: string[]): PromiseLike;\r\n verify(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, signature: BufferSource, data: BufferSource): PromiseLike;\r\n wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier): PromiseLike;\r\n}\r\n\r\ndeclare var SubtleCrypto: {\r\n prototype: SubtleCrypto;\r\n new(): SubtleCrypto;\r\n}\r\n\r\ninterface Text extends CharacterData {\r\n readonly wholeText: string;\r\n splitText(offset: number): Text;\r\n}\r\n\r\ndeclare var Text: {\r\n prototype: Text;\r\n new(): Text;\r\n}\r\n\r\ninterface TextEvent extends UIEvent {\r\n readonly data: string;\r\n readonly inputMethod: number;\r\n readonly locale: string;\r\n initTextEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, inputMethod: number, locale: string): void;\r\n readonly DOM_INPUT_METHOD_DROP: number;\r\n readonly DOM_INPUT_METHOD_HANDWRITING: number;\r\n readonly DOM_INPUT_METHOD_IME: number;\r\n readonly DOM_INPUT_METHOD_KEYBOARD: number;\r\n readonly DOM_INPUT_METHOD_MULTIMODAL: number;\r\n readonly DOM_INPUT_METHOD_OPTION: number;\r\n readonly DOM_INPUT_METHOD_PASTE: number;\r\n readonly DOM_INPUT_METHOD_SCRIPT: number;\r\n readonly DOM_INPUT_METHOD_UNKNOWN: number;\r\n readonly DOM_INPUT_METHOD_VOICE: number;\r\n}\r\n\r\ndeclare var TextEvent: {\r\n prototype: TextEvent;\r\n new(): TextEvent;\r\n readonly DOM_INPUT_METHOD_DROP: number;\r\n readonly DOM_INPUT_METHOD_HANDWRITING: number;\r\n readonly DOM_INPUT_METHOD_IME: number;\r\n readonly DOM_INPUT_METHOD_KEYBOARD: number;\r\n readonly DOM_INPUT_METHOD_MULTIMODAL: number;\r\n readonly DOM_INPUT_METHOD_OPTION: number;\r\n readonly DOM_INPUT_METHOD_PASTE: number;\r\n readonly DOM_INPUT_METHOD_SCRIPT: number;\r\n readonly DOM_INPUT_METHOD_UNKNOWN: number;\r\n readonly DOM_INPUT_METHOD_VOICE: number;\r\n}\r\n\r\ninterface TextMetrics {\r\n readonly width: number;\r\n}\r\n\r\ndeclare var TextMetrics: {\r\n prototype: TextMetrics;\r\n new(): TextMetrics;\r\n}\r\n\r\ninterface TextTrack extends EventTarget {\r\n readonly activeCues: TextTrackCueList;\r\n readonly cues: TextTrackCueList;\r\n readonly inBandMetadataTrackDispatchType: string;\r\n readonly kind: string;\r\n readonly label: string;\r\n readonly language: string;\r\n mode: any;\r\n oncuechange: (this: this, ev: Event) => any;\r\n onerror: (this: this, ev: ErrorEvent) => any;\r\n onload: (this: this, ev: Event) => any;\r\n readonly readyState: number;\r\n addCue(cue: TextTrackCue): void;\r\n removeCue(cue: TextTrackCue): void;\r\n readonly DISABLED: number;\r\n readonly ERROR: number;\r\n readonly HIDDEN: number;\r\n readonly LOADED: number;\r\n readonly LOADING: number;\r\n readonly NONE: number;\r\n readonly SHOWING: number;\r\n addEventListener(type: \"cuechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var TextTrack: {\r\n prototype: TextTrack;\r\n new(): TextTrack;\r\n readonly DISABLED: number;\r\n readonly ERROR: number;\r\n readonly HIDDEN: number;\r\n readonly LOADED: number;\r\n readonly LOADING: number;\r\n readonly NONE: number;\r\n readonly SHOWING: number;\r\n}\r\n\r\ninterface TextTrackCue extends EventTarget {\r\n endTime: number;\r\n id: string;\r\n onenter: (this: this, ev: Event) => any;\r\n onexit: (this: this, ev: Event) => any;\r\n pauseOnExit: boolean;\r\n startTime: number;\r\n text: string;\r\n readonly track: TextTrack;\r\n getCueAsHTML(): DocumentFragment;\r\n addEventListener(type: \"enter\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"exit\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var TextTrackCue: {\r\n prototype: TextTrackCue;\r\n new(startTime: number, endTime: number, text: string): TextTrackCue;\r\n}\r\n\r\ninterface TextTrackCueList {\r\n readonly length: number;\r\n getCueById(id: string): TextTrackCue;\r\n item(index: number): TextTrackCue;\r\n [index: number]: TextTrackCue;\r\n}\r\n\r\ndeclare var TextTrackCueList: {\r\n prototype: TextTrackCueList;\r\n new(): TextTrackCueList;\r\n}\r\n\r\ninterface TextTrackList extends EventTarget {\r\n readonly length: number;\r\n onaddtrack: ((this: this, ev: TrackEvent) => any) | null;\r\n item(index: number): TextTrack;\r\n addEventListener(type: \"addtrack\", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n [index: number]: TextTrack;\r\n}\r\n\r\ndeclare var TextTrackList: {\r\n prototype: TextTrackList;\r\n new(): TextTrackList;\r\n}\r\n\r\ninterface TimeRanges {\r\n readonly length: number;\r\n end(index: number): number;\r\n start(index: number): number;\r\n}\r\n\r\ndeclare var TimeRanges: {\r\n prototype: TimeRanges;\r\n new(): TimeRanges;\r\n}\r\n\r\ninterface Touch {\r\n readonly clientX: number;\r\n readonly clientY: number;\r\n readonly identifier: number;\r\n readonly pageX: number;\r\n readonly pageY: number;\r\n readonly screenX: number;\r\n readonly screenY: number;\r\n readonly target: EventTarget;\r\n}\r\n\r\ndeclare var Touch: {\r\n prototype: Touch;\r\n new(): Touch;\r\n}\r\n\r\ninterface TouchEvent extends UIEvent {\r\n readonly altKey: boolean;\r\n readonly changedTouches: TouchList;\r\n readonly ctrlKey: boolean;\r\n readonly metaKey: boolean;\r\n readonly shiftKey: boolean;\r\n readonly targetTouches: TouchList;\r\n readonly touches: TouchList;\r\n}\r\n\r\ndeclare var TouchEvent: {\r\n prototype: TouchEvent;\r\n new(): TouchEvent;\r\n}\r\n\r\ninterface TouchList {\r\n readonly length: number;\r\n item(index: number): Touch | null;\r\n [index: number]: Touch;\r\n}\r\n\r\ndeclare var TouchList: {\r\n prototype: TouchList;\r\n new(): TouchList;\r\n}\r\n\r\ninterface TrackEvent extends Event {\r\n readonly track: any;\r\n}\r\n\r\ndeclare var TrackEvent: {\r\n prototype: TrackEvent;\r\n new(): TrackEvent;\r\n}\r\n\r\ninterface TransitionEvent extends Event {\r\n readonly elapsedTime: number;\r\n readonly propertyName: string;\r\n initTransitionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, propertyNameArg: string, elapsedTimeArg: number): void;\r\n}\r\n\r\ndeclare var TransitionEvent: {\r\n prototype: TransitionEvent;\r\n new(): TransitionEvent;\r\n}\r\n\r\ninterface TreeWalker {\r\n currentNode: Node;\r\n readonly expandEntityReferences: boolean;\r\n readonly filter: NodeFilter;\r\n readonly root: Node;\r\n readonly whatToShow: number;\r\n firstChild(): Node;\r\n lastChild(): Node;\r\n nextNode(): Node;\r\n nextSibling(): Node;\r\n parentNode(): Node;\r\n previousNode(): Node;\r\n previousSibling(): Node;\r\n}\r\n\r\ndeclare var TreeWalker: {\r\n prototype: TreeWalker;\r\n new(): TreeWalker;\r\n}\r\n\r\ninterface UIEvent extends Event {\r\n readonly detail: number;\r\n readonly view: Window;\r\n initUIEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number): void;\r\n}\r\n\r\ndeclare var UIEvent: {\r\n prototype: UIEvent;\r\n new(type: string, eventInitDict?: UIEventInit): UIEvent;\r\n}\r\n\r\ninterface URL {\r\n hash: string;\r\n host: string;\r\n hostname: string;\r\n href: string;\r\n readonly origin: string;\r\n password: string;\r\n pathname: string;\r\n port: string;\r\n protocol: string;\r\n search: string;\r\n username: string;\r\n toString(): string;\r\n}\r\n\r\ndeclare var URL: {\r\n prototype: URL;\r\n new(url: string, base?: string): URL;\r\n createObjectURL(object: any, options?: ObjectURLOptions): string;\r\n revokeObjectURL(url: string): void;\r\n}\r\n\r\ninterface UnviewableContentIdentifiedEvent extends NavigationEventWithReferrer {\r\n readonly mediaType: string;\r\n}\r\n\r\ndeclare var UnviewableContentIdentifiedEvent: {\r\n prototype: UnviewableContentIdentifiedEvent;\r\n new(): UnviewableContentIdentifiedEvent;\r\n}\r\n\r\ninterface ValidityState {\r\n readonly badInput: boolean;\r\n readonly customError: boolean;\r\n readonly patternMismatch: boolean;\r\n readonly rangeOverflow: boolean;\r\n readonly rangeUnderflow: boolean;\r\n readonly stepMismatch: boolean;\r\n readonly tooLong: boolean;\r\n readonly typeMismatch: boolean;\r\n readonly valid: boolean;\r\n readonly valueMissing: boolean;\r\n}\r\n\r\ndeclare var ValidityState: {\r\n prototype: ValidityState;\r\n new(): ValidityState;\r\n}\r\n\r\ninterface VideoPlaybackQuality {\r\n readonly corruptedVideoFrames: number;\r\n readonly creationTime: number;\r\n readonly droppedVideoFrames: number;\r\n readonly totalFrameDelay: number;\r\n readonly totalVideoFrames: number;\r\n}\r\n\r\ndeclare var VideoPlaybackQuality: {\r\n prototype: VideoPlaybackQuality;\r\n new(): VideoPlaybackQuality;\r\n}\r\n\r\ninterface VideoTrack {\r\n readonly id: string;\r\n kind: string;\r\n readonly label: string;\r\n language: string;\r\n selected: boolean;\r\n readonly sourceBuffer: SourceBuffer;\r\n}\r\n\r\ndeclare var VideoTrack: {\r\n prototype: VideoTrack;\r\n new(): VideoTrack;\r\n}\r\n\r\ninterface VideoTrackList extends EventTarget {\r\n readonly length: number;\r\n onaddtrack: (this: this, ev: TrackEvent) => any;\r\n onchange: (this: this, ev: Event) => any;\r\n onremovetrack: (this: this, ev: TrackEvent) => any;\r\n readonly selectedIndex: number;\r\n getTrackById(id: string): VideoTrack | null;\r\n item(index: number): VideoTrack;\r\n addEventListener(type: \"addtrack\", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"change\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"removetrack\", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n [index: number]: VideoTrack;\r\n}\r\n\r\ndeclare var VideoTrackList: {\r\n prototype: VideoTrackList;\r\n new(): VideoTrackList;\r\n}\r\n\r\ninterface WEBGL_compressed_texture_s3tc {\r\n readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number;\r\n readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number;\r\n readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number;\r\n readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number;\r\n}\r\n\r\ndeclare var WEBGL_compressed_texture_s3tc: {\r\n prototype: WEBGL_compressed_texture_s3tc;\r\n new(): WEBGL_compressed_texture_s3tc;\r\n readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number;\r\n readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number;\r\n readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number;\r\n readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number;\r\n}\r\n\r\ninterface WEBGL_debug_renderer_info {\r\n readonly UNMASKED_RENDERER_WEBGL: number;\r\n readonly UNMASKED_VENDOR_WEBGL: number;\r\n}\r\n\r\ndeclare var WEBGL_debug_renderer_info: {\r\n prototype: WEBGL_debug_renderer_info;\r\n new(): WEBGL_debug_renderer_info;\r\n readonly UNMASKED_RENDERER_WEBGL: number;\r\n readonly UNMASKED_VENDOR_WEBGL: number;\r\n}\r\n\r\ninterface WEBGL_depth_texture {\r\n readonly UNSIGNED_INT_24_8_WEBGL: number;\r\n}\r\n\r\ndeclare var WEBGL_depth_texture: {\r\n prototype: WEBGL_depth_texture;\r\n new(): WEBGL_depth_texture;\r\n readonly UNSIGNED_INT_24_8_WEBGL: number;\r\n}\r\n\r\ninterface WaveShaperNode extends AudioNode {\r\n curve: Float32Array | null;\r\n oversample: string;\r\n}\r\n\r\ndeclare var WaveShaperNode: {\r\n prototype: WaveShaperNode;\r\n new(): WaveShaperNode;\r\n}\r\n\r\ninterface WebGLActiveInfo {\r\n readonly name: string;\r\n readonly size: number;\r\n readonly type: number;\r\n}\r\n\r\ndeclare var WebGLActiveInfo: {\r\n prototype: WebGLActiveInfo;\r\n new(): WebGLActiveInfo;\r\n}\r\n\r\ninterface WebGLBuffer extends WebGLObject {\r\n}\r\n\r\ndeclare var WebGLBuffer: {\r\n prototype: WebGLBuffer;\r\n new(): WebGLBuffer;\r\n}\r\n\r\ninterface WebGLContextEvent extends Event {\r\n readonly statusMessage: string;\r\n}\r\n\r\ndeclare var WebGLContextEvent: {\r\n prototype: WebGLContextEvent;\r\n new(type: string, eventInitDict?: WebGLContextEventInit): WebGLContextEvent;\r\n}\r\n\r\ninterface WebGLFramebuffer extends WebGLObject {\r\n}\r\n\r\ndeclare var WebGLFramebuffer: {\r\n prototype: WebGLFramebuffer;\r\n new(): WebGLFramebuffer;\r\n}\r\n\r\ninterface WebGLObject {\r\n}\r\n\r\ndeclare var WebGLObject: {\r\n prototype: WebGLObject;\r\n new(): WebGLObject;\r\n}\r\n\r\ninterface WebGLProgram extends WebGLObject {\r\n}\r\n\r\ndeclare var WebGLProgram: {\r\n prototype: WebGLProgram;\r\n new(): WebGLProgram;\r\n}\r\n\r\ninterface WebGLRenderbuffer extends WebGLObject {\r\n}\r\n\r\ndeclare var WebGLRenderbuffer: {\r\n prototype: WebGLRenderbuffer;\r\n new(): WebGLRenderbuffer;\r\n}\r\n\r\ninterface WebGLRenderingContext {\r\n readonly canvas: HTMLCanvasElement;\r\n readonly drawingBufferHeight: number;\r\n readonly drawingBufferWidth: number;\r\n activeTexture(texture: number): void;\r\n attachShader(program: WebGLProgram | null, shader: WebGLShader | null): void;\r\n bindAttribLocation(program: WebGLProgram | null, index: number, name: string): void;\r\n bindBuffer(target: number, buffer: WebGLBuffer | null): void;\r\n bindFramebuffer(target: number, framebuffer: WebGLFramebuffer | null): void;\r\n bindRenderbuffer(target: number, renderbuffer: WebGLRenderbuffer | null): void;\r\n bindTexture(target: number, texture: WebGLTexture | null): void;\r\n blendColor(red: number, green: number, blue: number, alpha: number): void;\r\n blendEquation(mode: number): void;\r\n blendEquationSeparate(modeRGB: number, modeAlpha: number): void;\r\n blendFunc(sfactor: number, dfactor: number): void;\r\n blendFuncSeparate(srcRGB: number, dstRGB: number, srcAlpha: number, dstAlpha: number): void;\r\n bufferData(target: number, size: number | ArrayBufferView | ArrayBuffer, usage: number): void;\r\n bufferSubData(target: number, offset: number, data: ArrayBufferView | ArrayBuffer): void;\r\n checkFramebufferStatus(target: number): number;\r\n clear(mask: number): void;\r\n clearColor(red: number, green: number, blue: number, alpha: number): void;\r\n clearDepth(depth: number): void;\r\n clearStencil(s: number): void;\r\n colorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void;\r\n compileShader(shader: WebGLShader | null): void;\r\n compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: ArrayBufferView): void;\r\n compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: ArrayBufferView): void;\r\n copyTexImage2D(target: number, level: number, internalformat: number, x: number, y: number, width: number, height: number, border: number): void;\r\n copyTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, x: number, y: number, width: number, height: number): void;\r\n createBuffer(): WebGLBuffer | null;\r\n createFramebuffer(): WebGLFramebuffer | null;\r\n createProgram(): WebGLProgram | null;\r\n createRenderbuffer(): WebGLRenderbuffer | null;\r\n createShader(type: number): WebGLShader | null;\r\n createTexture(): WebGLTexture | null;\r\n cullFace(mode: number): void;\r\n deleteBuffer(buffer: WebGLBuffer | null): void;\r\n deleteFramebuffer(framebuffer: WebGLFramebuffer | null): void;\r\n deleteProgram(program: WebGLProgram | null): void;\r\n deleteRenderbuffer(renderbuffer: WebGLRenderbuffer | null): void;\r\n deleteShader(shader: WebGLShader | null): void;\r\n deleteTexture(texture: WebGLTexture | null): void;\r\n depthFunc(func: number): void;\r\n depthMask(flag: boolean): void;\r\n depthRange(zNear: number, zFar: number): void;\r\n detachShader(program: WebGLProgram | null, shader: WebGLShader | null): void;\r\n disable(cap: number): void;\r\n disableVertexAttribArray(index: number): void;\r\n drawArrays(mode: number, first: number, count: number): void;\r\n drawElements(mode: number, count: number, type: number, offset: number): void;\r\n enable(cap: number): void;\r\n enableVertexAttribArray(index: number): void;\r\n finish(): void;\r\n flush(): void;\r\n framebufferRenderbuffer(target: number, attachment: number, renderbuffertarget: number, renderbuffer: WebGLRenderbuffer | null): void;\r\n framebufferTexture2D(target: number, attachment: number, textarget: number, texture: WebGLTexture | null, level: number): void;\r\n frontFace(mode: number): void;\r\n generateMipmap(target: number): void;\r\n getActiveAttrib(program: WebGLProgram | null, index: number): WebGLActiveInfo | null;\r\n getActiveUniform(program: WebGLProgram | null, index: number): WebGLActiveInfo | null;\r\n getAttachedShaders(program: WebGLProgram | null): WebGLShader[] | null;\r\n getAttribLocation(program: WebGLProgram | null, name: string): number;\r\n getBufferParameter(target: number, pname: number): any;\r\n getContextAttributes(): WebGLContextAttributes;\r\n getError(): number;\r\n getExtension(name: string): any;\r\n getFramebufferAttachmentParameter(target: number, attachment: number, pname: number): any;\r\n getParameter(pname: number): any;\r\n getProgramInfoLog(program: WebGLProgram | null): string | null;\r\n getProgramParameter(program: WebGLProgram | null, pname: number): any;\r\n getRenderbufferParameter(target: number, pname: number): any;\r\n getShaderInfoLog(shader: WebGLShader | null): string | null;\r\n getShaderParameter(shader: WebGLShader | null, pname: number): any;\r\n getShaderPrecisionFormat(shadertype: number, precisiontype: number): WebGLShaderPrecisionFormat | null;\r\n getShaderSource(shader: WebGLShader | null): string | null;\r\n getSupportedExtensions(): string[] | null;\r\n getTexParameter(target: number, pname: number): any;\r\n getUniform(program: WebGLProgram | null, location: WebGLUniformLocation | null): any;\r\n getUniformLocation(program: WebGLProgram | null, name: string): WebGLUniformLocation | null;\r\n getVertexAttrib(index: number, pname: number): any;\r\n getVertexAttribOffset(index: number, pname: number): number;\r\n hint(target: number, mode: number): void;\r\n isBuffer(buffer: WebGLBuffer | null): boolean;\r\n isContextLost(): boolean;\r\n isEnabled(cap: number): boolean;\r\n isFramebuffer(framebuffer: WebGLFramebuffer | null): boolean;\r\n isProgram(program: WebGLProgram | null): boolean;\r\n isRenderbuffer(renderbuffer: WebGLRenderbuffer | null): boolean;\r\n isShader(shader: WebGLShader | null): boolean;\r\n isTexture(texture: WebGLTexture | null): boolean;\r\n lineWidth(width: number): void;\r\n linkProgram(program: WebGLProgram | null): void;\r\n pixelStorei(pname: number, param: number): void;\r\n polygonOffset(factor: number, units: number): void;\r\n readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void;\r\n renderbufferStorage(target: number, internalformat: number, width: number, height: number): void;\r\n sampleCoverage(value: number, invert: boolean): void;\r\n scissor(x: number, y: number, width: number, height: number): void;\r\n shaderSource(shader: WebGLShader | null, source: string): void;\r\n stencilFunc(func: number, ref: number, mask: number): void;\r\n stencilFuncSeparate(face: number, func: number, ref: number, mask: number): void;\r\n stencilMask(mask: number): void;\r\n stencilMaskSeparate(face: number, mask: number): void;\r\n stencilOp(fail: number, zfail: number, zpass: number): void;\r\n stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void;\r\n texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels?: ArrayBufferView): void;\r\n texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void;\r\n texParameterf(target: number, pname: number, param: number): void;\r\n texParameteri(target: number, pname: number, param: number): void;\r\n texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels?: ArrayBufferView): void;\r\n texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void;\r\n uniform1f(location: WebGLUniformLocation | null, x: number): void;\r\n uniform1fv(location: WebGLUniformLocation, v: Float32Array | number[]): void;\r\n uniform1i(location: WebGLUniformLocation | null, x: number): void;\r\n uniform1iv(location: WebGLUniformLocation, v: Int32Array | number[]): void;\r\n uniform2f(location: WebGLUniformLocation | null, x: number, y: number): void;\r\n uniform2fv(location: WebGLUniformLocation, v: Float32Array | number[]): void;\r\n uniform2i(location: WebGLUniformLocation | null, x: number, y: number): void;\r\n uniform2iv(location: WebGLUniformLocation, v: Int32Array | number[]): void;\r\n uniform3f(location: WebGLUniformLocation | null, x: number, y: number, z: number): void;\r\n uniform3fv(location: WebGLUniformLocation, v: Float32Array | number[]): void;\r\n uniform3i(location: WebGLUniformLocation | null, x: number, y: number, z: number): void;\r\n uniform3iv(location: WebGLUniformLocation, v: Int32Array | number[]): void;\r\n uniform4f(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void;\r\n uniform4fv(location: WebGLUniformLocation, v: Float32Array | number[]): void;\r\n uniform4i(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void;\r\n uniform4iv(location: WebGLUniformLocation, v: Int32Array | number[]): void;\r\n uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void;\r\n uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void;\r\n uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void;\r\n useProgram(program: WebGLProgram | null): void;\r\n validateProgram(program: WebGLProgram | null): void;\r\n vertexAttrib1f(indx: number, x: number): void;\r\n vertexAttrib1fv(indx: number, values: Float32Array | number[]): void;\r\n vertexAttrib2f(indx: number, x: number, y: number): void;\r\n vertexAttrib2fv(indx: number, values: Float32Array | number[]): void;\r\n vertexAttrib3f(indx: number, x: number, y: number, z: number): void;\r\n vertexAttrib3fv(indx: number, values: Float32Array | number[]): void;\r\n vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void;\r\n vertexAttrib4fv(indx: number, values: Float32Array | number[]): void;\r\n vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void;\r\n viewport(x: number, y: number, width: number, height: number): void;\r\n readonly ACTIVE_ATTRIBUTES: number;\r\n readonly ACTIVE_TEXTURE: number;\r\n readonly ACTIVE_UNIFORMS: number;\r\n readonly ALIASED_LINE_WIDTH_RANGE: number;\r\n readonly ALIASED_POINT_SIZE_RANGE: number;\r\n readonly ALPHA: number;\r\n readonly ALPHA_BITS: number;\r\n readonly ALWAYS: number;\r\n readonly ARRAY_BUFFER: number;\r\n readonly ARRAY_BUFFER_BINDING: number;\r\n readonly ATTACHED_SHADERS: number;\r\n readonly BACK: number;\r\n readonly BLEND: number;\r\n readonly BLEND_COLOR: number;\r\n readonly BLEND_DST_ALPHA: number;\r\n readonly BLEND_DST_RGB: number;\r\n readonly BLEND_EQUATION: number;\r\n readonly BLEND_EQUATION_ALPHA: number;\r\n readonly BLEND_EQUATION_RGB: number;\r\n readonly BLEND_SRC_ALPHA: number;\r\n readonly BLEND_SRC_RGB: number;\r\n readonly BLUE_BITS: number;\r\n readonly BOOL: number;\r\n readonly BOOL_VEC2: number;\r\n readonly BOOL_VEC3: number;\r\n readonly BOOL_VEC4: number;\r\n readonly BROWSER_DEFAULT_WEBGL: number;\r\n readonly BUFFER_SIZE: number;\r\n readonly BUFFER_USAGE: number;\r\n readonly BYTE: number;\r\n readonly CCW: number;\r\n readonly CLAMP_TO_EDGE: number;\r\n readonly COLOR_ATTACHMENT0: number;\r\n readonly COLOR_BUFFER_BIT: number;\r\n readonly COLOR_CLEAR_VALUE: number;\r\n readonly COLOR_WRITEMASK: number;\r\n readonly COMPILE_STATUS: number;\r\n readonly COMPRESSED_TEXTURE_FORMATS: number;\r\n readonly CONSTANT_ALPHA: number;\r\n readonly CONSTANT_COLOR: number;\r\n readonly CONTEXT_LOST_WEBGL: number;\r\n readonly CULL_FACE: number;\r\n readonly CULL_FACE_MODE: number;\r\n readonly CURRENT_PROGRAM: number;\r\n readonly CURRENT_VERTEX_ATTRIB: number;\r\n readonly CW: number;\r\n readonly DECR: number;\r\n readonly DECR_WRAP: number;\r\n readonly DELETE_STATUS: number;\r\n readonly DEPTH_ATTACHMENT: number;\r\n readonly DEPTH_BITS: number;\r\n readonly DEPTH_BUFFER_BIT: number;\r\n readonly DEPTH_CLEAR_VALUE: number;\r\n readonly DEPTH_COMPONENT: number;\r\n readonly DEPTH_COMPONENT16: number;\r\n readonly DEPTH_FUNC: number;\r\n readonly DEPTH_RANGE: number;\r\n readonly DEPTH_STENCIL: number;\r\n readonly DEPTH_STENCIL_ATTACHMENT: number;\r\n readonly DEPTH_TEST: number;\r\n readonly DEPTH_WRITEMASK: number;\r\n readonly DITHER: number;\r\n readonly DONT_CARE: number;\r\n readonly DST_ALPHA: number;\r\n readonly DST_COLOR: number;\r\n readonly DYNAMIC_DRAW: number;\r\n readonly ELEMENT_ARRAY_BUFFER: number;\r\n readonly ELEMENT_ARRAY_BUFFER_BINDING: number;\r\n readonly EQUAL: number;\r\n readonly FASTEST: number;\r\n readonly FLOAT: number;\r\n readonly FLOAT_MAT2: number;\r\n readonly FLOAT_MAT3: number;\r\n readonly FLOAT_MAT4: number;\r\n readonly FLOAT_VEC2: number;\r\n readonly FLOAT_VEC3: number;\r\n readonly FLOAT_VEC4: number;\r\n readonly FRAGMENT_SHADER: number;\r\n readonly FRAMEBUFFER: number;\r\n readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number;\r\n readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number;\r\n readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number;\r\n readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number;\r\n readonly FRAMEBUFFER_BINDING: number;\r\n readonly FRAMEBUFFER_COMPLETE: number;\r\n readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number;\r\n readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number;\r\n readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number;\r\n readonly FRAMEBUFFER_UNSUPPORTED: number;\r\n readonly FRONT: number;\r\n readonly FRONT_AND_BACK: number;\r\n readonly FRONT_FACE: number;\r\n readonly FUNC_ADD: number;\r\n readonly FUNC_REVERSE_SUBTRACT: number;\r\n readonly FUNC_SUBTRACT: number;\r\n readonly GENERATE_MIPMAP_HINT: number;\r\n readonly GEQUAL: number;\r\n readonly GREATER: number;\r\n readonly GREEN_BITS: number;\r\n readonly HIGH_FLOAT: number;\r\n readonly HIGH_INT: number;\r\n readonly IMPLEMENTATION_COLOR_READ_FORMAT: number;\r\n readonly IMPLEMENTATION_COLOR_READ_TYPE: number;\r\n readonly INCR: number;\r\n readonly INCR_WRAP: number;\r\n readonly INT: number;\r\n readonly INT_VEC2: number;\r\n readonly INT_VEC3: number;\r\n readonly INT_VEC4: number;\r\n readonly INVALID_ENUM: number;\r\n readonly INVALID_FRAMEBUFFER_OPERATION: number;\r\n readonly INVALID_OPERATION: number;\r\n readonly INVALID_VALUE: number;\r\n readonly INVERT: number;\r\n readonly KEEP: number;\r\n readonly LEQUAL: number;\r\n readonly LESS: number;\r\n readonly LINEAR: number;\r\n readonly LINEAR_MIPMAP_LINEAR: number;\r\n readonly LINEAR_MIPMAP_NEAREST: number;\r\n readonly LINES: number;\r\n readonly LINE_LOOP: number;\r\n readonly LINE_STRIP: number;\r\n readonly LINE_WIDTH: number;\r\n readonly LINK_STATUS: number;\r\n readonly LOW_FLOAT: number;\r\n readonly LOW_INT: number;\r\n readonly LUMINANCE: number;\r\n readonly LUMINANCE_ALPHA: number;\r\n readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number;\r\n readonly MAX_CUBE_MAP_TEXTURE_SIZE: number;\r\n readonly MAX_FRAGMENT_UNIFORM_VECTORS: number;\r\n readonly MAX_RENDERBUFFER_SIZE: number;\r\n readonly MAX_TEXTURE_IMAGE_UNITS: number;\r\n readonly MAX_TEXTURE_SIZE: number;\r\n readonly MAX_VARYING_VECTORS: number;\r\n readonly MAX_VERTEX_ATTRIBS: number;\r\n readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number;\r\n readonly MAX_VERTEX_UNIFORM_VECTORS: number;\r\n readonly MAX_VIEWPORT_DIMS: number;\r\n readonly MEDIUM_FLOAT: number;\r\n readonly MEDIUM_INT: number;\r\n readonly MIRRORED_REPEAT: number;\r\n readonly NEAREST: number;\r\n readonly NEAREST_MIPMAP_LINEAR: number;\r\n readonly NEAREST_MIPMAP_NEAREST: number;\r\n readonly NEVER: number;\r\n readonly NICEST: number;\r\n readonly NONE: number;\r\n readonly NOTEQUAL: number;\r\n readonly NO_ERROR: number;\r\n readonly ONE: number;\r\n readonly ONE_MINUS_CONSTANT_ALPHA: number;\r\n readonly ONE_MINUS_CONSTANT_COLOR: number;\r\n readonly ONE_MINUS_DST_ALPHA: number;\r\n readonly ONE_MINUS_DST_COLOR: number;\r\n readonly ONE_MINUS_SRC_ALPHA: number;\r\n readonly ONE_MINUS_SRC_COLOR: number;\r\n readonly OUT_OF_MEMORY: number;\r\n readonly PACK_ALIGNMENT: number;\r\n readonly POINTS: number;\r\n readonly POLYGON_OFFSET_FACTOR: number;\r\n readonly POLYGON_OFFSET_FILL: number;\r\n readonly POLYGON_OFFSET_UNITS: number;\r\n readonly RED_BITS: number;\r\n readonly RENDERBUFFER: number;\r\n readonly RENDERBUFFER_ALPHA_SIZE: number;\r\n readonly RENDERBUFFER_BINDING: number;\r\n readonly RENDERBUFFER_BLUE_SIZE: number;\r\n readonly RENDERBUFFER_DEPTH_SIZE: number;\r\n readonly RENDERBUFFER_GREEN_SIZE: number;\r\n readonly RENDERBUFFER_HEIGHT: number;\r\n readonly RENDERBUFFER_INTERNAL_FORMAT: number;\r\n readonly RENDERBUFFER_RED_SIZE: number;\r\n readonly RENDERBUFFER_STENCIL_SIZE: number;\r\n readonly RENDERBUFFER_WIDTH: number;\r\n readonly RENDERER: number;\r\n readonly REPEAT: number;\r\n readonly REPLACE: number;\r\n readonly RGB: number;\r\n readonly RGB565: number;\r\n readonly RGB5_A1: number;\r\n readonly RGBA: number;\r\n readonly RGBA4: number;\r\n readonly SAMPLER_2D: number;\r\n readonly SAMPLER_CUBE: number;\r\n readonly SAMPLES: number;\r\n readonly SAMPLE_ALPHA_TO_COVERAGE: number;\r\n readonly SAMPLE_BUFFERS: number;\r\n readonly SAMPLE_COVERAGE: number;\r\n readonly SAMPLE_COVERAGE_INVERT: number;\r\n readonly SAMPLE_COVERAGE_VALUE: number;\r\n readonly SCISSOR_BOX: number;\r\n readonly SCISSOR_TEST: number;\r\n readonly SHADER_TYPE: number;\r\n readonly SHADING_LANGUAGE_VERSION: number;\r\n readonly SHORT: number;\r\n readonly SRC_ALPHA: number;\r\n readonly SRC_ALPHA_SATURATE: number;\r\n readonly SRC_COLOR: number;\r\n readonly STATIC_DRAW: number;\r\n readonly STENCIL_ATTACHMENT: number;\r\n readonly STENCIL_BACK_FAIL: number;\r\n readonly STENCIL_BACK_FUNC: number;\r\n readonly STENCIL_BACK_PASS_DEPTH_FAIL: number;\r\n readonly STENCIL_BACK_PASS_DEPTH_PASS: number;\r\n readonly STENCIL_BACK_REF: number;\r\n readonly STENCIL_BACK_VALUE_MASK: number;\r\n readonly STENCIL_BACK_WRITEMASK: number;\r\n readonly STENCIL_BITS: number;\r\n readonly STENCIL_BUFFER_BIT: number;\r\n readonly STENCIL_CLEAR_VALUE: number;\r\n readonly STENCIL_FAIL: number;\r\n readonly STENCIL_FUNC: number;\r\n readonly STENCIL_INDEX: number;\r\n readonly STENCIL_INDEX8: number;\r\n readonly STENCIL_PASS_DEPTH_FAIL: number;\r\n readonly STENCIL_PASS_DEPTH_PASS: number;\r\n readonly STENCIL_REF: number;\r\n readonly STENCIL_TEST: number;\r\n readonly STENCIL_VALUE_MASK: number;\r\n readonly STENCIL_WRITEMASK: number;\r\n readonly STREAM_DRAW: number;\r\n readonly SUBPIXEL_BITS: number;\r\n readonly TEXTURE: number;\r\n readonly TEXTURE0: number;\r\n readonly TEXTURE1: number;\r\n readonly TEXTURE10: number;\r\n readonly TEXTURE11: number;\r\n readonly TEXTURE12: number;\r\n readonly TEXTURE13: number;\r\n readonly TEXTURE14: number;\r\n readonly TEXTURE15: number;\r\n readonly TEXTURE16: number;\r\n readonly TEXTURE17: number;\r\n readonly TEXTURE18: number;\r\n readonly TEXTURE19: number;\r\n readonly TEXTURE2: number;\r\n readonly TEXTURE20: number;\r\n readonly TEXTURE21: number;\r\n readonly TEXTURE22: number;\r\n readonly TEXTURE23: number;\r\n readonly TEXTURE24: number;\r\n readonly TEXTURE25: number;\r\n readonly TEXTURE26: number;\r\n readonly TEXTURE27: number;\r\n readonly TEXTURE28: number;\r\n readonly TEXTURE29: number;\r\n readonly TEXTURE3: number;\r\n readonly TEXTURE30: number;\r\n readonly TEXTURE31: number;\r\n readonly TEXTURE4: number;\r\n readonly TEXTURE5: number;\r\n readonly TEXTURE6: number;\r\n readonly TEXTURE7: number;\r\n readonly TEXTURE8: number;\r\n readonly TEXTURE9: number;\r\n readonly TEXTURE_2D: number;\r\n readonly TEXTURE_BINDING_2D: number;\r\n readonly TEXTURE_BINDING_CUBE_MAP: number;\r\n readonly TEXTURE_CUBE_MAP: number;\r\n readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number;\r\n readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number;\r\n readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number;\r\n readonly TEXTURE_CUBE_MAP_POSITIVE_X: number;\r\n readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number;\r\n readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number;\r\n readonly TEXTURE_MAG_FILTER: number;\r\n readonly TEXTURE_MIN_FILTER: number;\r\n readonly TEXTURE_WRAP_S: number;\r\n readonly TEXTURE_WRAP_T: number;\r\n readonly TRIANGLES: number;\r\n readonly TRIANGLE_FAN: number;\r\n readonly TRIANGLE_STRIP: number;\r\n readonly UNPACK_ALIGNMENT: number;\r\n readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number;\r\n readonly UNPACK_FLIP_Y_WEBGL: number;\r\n readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number;\r\n readonly UNSIGNED_BYTE: number;\r\n readonly UNSIGNED_INT: number;\r\n readonly UNSIGNED_SHORT: number;\r\n readonly UNSIGNED_SHORT_4_4_4_4: number;\r\n readonly UNSIGNED_SHORT_5_5_5_1: number;\r\n readonly UNSIGNED_SHORT_5_6_5: number;\r\n readonly VALIDATE_STATUS: number;\r\n readonly VENDOR: number;\r\n readonly VERSION: number;\r\n readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number;\r\n readonly VERTEX_ATTRIB_ARRAY_ENABLED: number;\r\n readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number;\r\n readonly VERTEX_ATTRIB_ARRAY_POINTER: number;\r\n readonly VERTEX_ATTRIB_ARRAY_SIZE: number;\r\n readonly VERTEX_ATTRIB_ARRAY_STRIDE: number;\r\n readonly VERTEX_ATTRIB_ARRAY_TYPE: number;\r\n readonly VERTEX_SHADER: number;\r\n readonly VIEWPORT: number;\r\n readonly ZERO: number;\r\n}\r\n\r\ndeclare var WebGLRenderingContext: {\r\n prototype: WebGLRenderingContext;\r\n new(): WebGLRenderingContext;\r\n readonly ACTIVE_ATTRIBUTES: number;\r\n readonly ACTIVE_TEXTURE: number;\r\n readonly ACTIVE_UNIFORMS: number;\r\n readonly ALIASED_LINE_WIDTH_RANGE: number;\r\n readonly ALIASED_POINT_SIZE_RANGE: number;\r\n readonly ALPHA: number;\r\n readonly ALPHA_BITS: number;\r\n readonly ALWAYS: number;\r\n readonly ARRAY_BUFFER: number;\r\n readonly ARRAY_BUFFER_BINDING: number;\r\n readonly ATTACHED_SHADERS: number;\r\n readonly BACK: number;\r\n readonly BLEND: number;\r\n readonly BLEND_COLOR: number;\r\n readonly BLEND_DST_ALPHA: number;\r\n readonly BLEND_DST_RGB: number;\r\n readonly BLEND_EQUATION: number;\r\n readonly BLEND_EQUATION_ALPHA: number;\r\n readonly BLEND_EQUATION_RGB: number;\r\n readonly BLEND_SRC_ALPHA: number;\r\n readonly BLEND_SRC_RGB: number;\r\n readonly BLUE_BITS: number;\r\n readonly BOOL: number;\r\n readonly BOOL_VEC2: number;\r\n readonly BOOL_VEC3: number;\r\n readonly BOOL_VEC4: number;\r\n readonly BROWSER_DEFAULT_WEBGL: number;\r\n readonly BUFFER_SIZE: number;\r\n readonly BUFFER_USAGE: number;\r\n readonly BYTE: number;\r\n readonly CCW: number;\r\n readonly CLAMP_TO_EDGE: number;\r\n readonly COLOR_ATTACHMENT0: number;\r\n readonly COLOR_BUFFER_BIT: number;\r\n readonly COLOR_CLEAR_VALUE: number;\r\n readonly COLOR_WRITEMASK: number;\r\n readonly COMPILE_STATUS: number;\r\n readonly COMPRESSED_TEXTURE_FORMATS: number;\r\n readonly CONSTANT_ALPHA: number;\r\n readonly CONSTANT_COLOR: number;\r\n readonly CONTEXT_LOST_WEBGL: number;\r\n readonly CULL_FACE: number;\r\n readonly CULL_FACE_MODE: number;\r\n readonly CURRENT_PROGRAM: number;\r\n readonly CURRENT_VERTEX_ATTRIB: number;\r\n readonly CW: number;\r\n readonly DECR: number;\r\n readonly DECR_WRAP: number;\r\n readonly DELETE_STATUS: number;\r\n readonly DEPTH_ATTACHMENT: number;\r\n readonly DEPTH_BITS: number;\r\n readonly DEPTH_BUFFER_BIT: number;\r\n readonly DEPTH_CLEAR_VALUE: number;\r\n readonly DEPTH_COMPONENT: number;\r\n readonly DEPTH_COMPONENT16: number;\r\n readonly DEPTH_FUNC: number;\r\n readonly DEPTH_RANGE: number;\r\n readonly DEPTH_STENCIL: number;\r\n readonly DEPTH_STENCIL_ATTACHMENT: number;\r\n readonly DEPTH_TEST: number;\r\n readonly DEPTH_WRITEMASK: number;\r\n readonly DITHER: number;\r\n readonly DONT_CARE: number;\r\n readonly DST_ALPHA: number;\r\n readonly DST_COLOR: number;\r\n readonly DYNAMIC_DRAW: number;\r\n readonly ELEMENT_ARRAY_BUFFER: number;\r\n readonly ELEMENT_ARRAY_BUFFER_BINDING: number;\r\n readonly EQUAL: number;\r\n readonly FASTEST: number;\r\n readonly FLOAT: number;\r\n readonly FLOAT_MAT2: number;\r\n readonly FLOAT_MAT3: number;\r\n readonly FLOAT_MAT4: number;\r\n readonly FLOAT_VEC2: number;\r\n readonly FLOAT_VEC3: number;\r\n readonly FLOAT_VEC4: number;\r\n readonly FRAGMENT_SHADER: number;\r\n readonly FRAMEBUFFER: number;\r\n readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number;\r\n readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number;\r\n readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number;\r\n readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number;\r\n readonly FRAMEBUFFER_BINDING: number;\r\n readonly FRAMEBUFFER_COMPLETE: number;\r\n readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number;\r\n readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number;\r\n readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number;\r\n readonly FRAMEBUFFER_UNSUPPORTED: number;\r\n readonly FRONT: number;\r\n readonly FRONT_AND_BACK: number;\r\n readonly FRONT_FACE: number;\r\n readonly FUNC_ADD: number;\r\n readonly FUNC_REVERSE_SUBTRACT: number;\r\n readonly FUNC_SUBTRACT: number;\r\n readonly GENERATE_MIPMAP_HINT: number;\r\n readonly GEQUAL: number;\r\n readonly GREATER: number;\r\n readonly GREEN_BITS: number;\r\n readonly HIGH_FLOAT: number;\r\n readonly HIGH_INT: number;\r\n readonly IMPLEMENTATION_COLOR_READ_FORMAT: number;\r\n readonly IMPLEMENTATION_COLOR_READ_TYPE: number;\r\n readonly INCR: number;\r\n readonly INCR_WRAP: number;\r\n readonly INT: number;\r\n readonly INT_VEC2: number;\r\n readonly INT_VEC3: number;\r\n readonly INT_VEC4: number;\r\n readonly INVALID_ENUM: number;\r\n readonly INVALID_FRAMEBUFFER_OPERATION: number;\r\n readonly INVALID_OPERATION: number;\r\n readonly INVALID_VALUE: number;\r\n readonly INVERT: number;\r\n readonly KEEP: number;\r\n readonly LEQUAL: number;\r\n readonly LESS: number;\r\n readonly LINEAR: number;\r\n readonly LINEAR_MIPMAP_LINEAR: number;\r\n readonly LINEAR_MIPMAP_NEAREST: number;\r\n readonly LINES: number;\r\n readonly LINE_LOOP: number;\r\n readonly LINE_STRIP: number;\r\n readonly LINE_WIDTH: number;\r\n readonly LINK_STATUS: number;\r\n readonly LOW_FLOAT: number;\r\n readonly LOW_INT: number;\r\n readonly LUMINANCE: number;\r\n readonly LUMINANCE_ALPHA: number;\r\n readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number;\r\n readonly MAX_CUBE_MAP_TEXTURE_SIZE: number;\r\n readonly MAX_FRAGMENT_UNIFORM_VECTORS: number;\r\n readonly MAX_RENDERBUFFER_SIZE: number;\r\n readonly MAX_TEXTURE_IMAGE_UNITS: number;\r\n readonly MAX_TEXTURE_SIZE: number;\r\n readonly MAX_VARYING_VECTORS: number;\r\n readonly MAX_VERTEX_ATTRIBS: number;\r\n readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number;\r\n readonly MAX_VERTEX_UNIFORM_VECTORS: number;\r\n readonly MAX_VIEWPORT_DIMS: number;\r\n readonly MEDIUM_FLOAT: number;\r\n readonly MEDIUM_INT: number;\r\n readonly MIRRORED_REPEAT: number;\r\n readonly NEAREST: number;\r\n readonly NEAREST_MIPMAP_LINEAR: number;\r\n readonly NEAREST_MIPMAP_NEAREST: number;\r\n readonly NEVER: number;\r\n readonly NICEST: number;\r\n readonly NONE: number;\r\n readonly NOTEQUAL: number;\r\n readonly NO_ERROR: number;\r\n readonly ONE: number;\r\n readonly ONE_MINUS_CONSTANT_ALPHA: number;\r\n readonly ONE_MINUS_CONSTANT_COLOR: number;\r\n readonly ONE_MINUS_DST_ALPHA: number;\r\n readonly ONE_MINUS_DST_COLOR: number;\r\n readonly ONE_MINUS_SRC_ALPHA: number;\r\n readonly ONE_MINUS_SRC_COLOR: number;\r\n readonly OUT_OF_MEMORY: number;\r\n readonly PACK_ALIGNMENT: number;\r\n readonly POINTS: number;\r\n readonly POLYGON_OFFSET_FACTOR: number;\r\n readonly POLYGON_OFFSET_FILL: number;\r\n readonly POLYGON_OFFSET_UNITS: number;\r\n readonly RED_BITS: number;\r\n readonly RENDERBUFFER: number;\r\n readonly RENDERBUFFER_ALPHA_SIZE: number;\r\n readonly RENDERBUFFER_BINDING: number;\r\n readonly RENDERBUFFER_BLUE_SIZE: number;\r\n readonly RENDERBUFFER_DEPTH_SIZE: number;\r\n readonly RENDERBUFFER_GREEN_SIZE: number;\r\n readonly RENDERBUFFER_HEIGHT: number;\r\n readonly RENDERBUFFER_INTERNAL_FORMAT: number;\r\n readonly RENDERBUFFER_RED_SIZE: number;\r\n readonly RENDERBUFFER_STENCIL_SIZE: number;\r\n readonly RENDERBUFFER_WIDTH: number;\r\n readonly RENDERER: number;\r\n readonly REPEAT: number;\r\n readonly REPLACE: number;\r\n readonly RGB: number;\r\n readonly RGB565: number;\r\n readonly RGB5_A1: number;\r\n readonly RGBA: number;\r\n readonly RGBA4: number;\r\n readonly SAMPLER_2D: number;\r\n readonly SAMPLER_CUBE: number;\r\n readonly SAMPLES: number;\r\n readonly SAMPLE_ALPHA_TO_COVERAGE: number;\r\n readonly SAMPLE_BUFFERS: number;\r\n readonly SAMPLE_COVERAGE: number;\r\n readonly SAMPLE_COVERAGE_INVERT: number;\r\n readonly SAMPLE_COVERAGE_VALUE: number;\r\n readonly SCISSOR_BOX: number;\r\n readonly SCISSOR_TEST: number;\r\n readonly SHADER_TYPE: number;\r\n readonly SHADING_LANGUAGE_VERSION: number;\r\n readonly SHORT: number;\r\n readonly SRC_ALPHA: number;\r\n readonly SRC_ALPHA_SATURATE: number;\r\n readonly SRC_COLOR: number;\r\n readonly STATIC_DRAW: number;\r\n readonly STENCIL_ATTACHMENT: number;\r\n readonly STENCIL_BACK_FAIL: number;\r\n readonly STENCIL_BACK_FUNC: number;\r\n readonly STENCIL_BACK_PASS_DEPTH_FAIL: number;\r\n readonly STENCIL_BACK_PASS_DEPTH_PASS: number;\r\n readonly STENCIL_BACK_REF: number;\r\n readonly STENCIL_BACK_VALUE_MASK: number;\r\n readonly STENCIL_BACK_WRITEMASK: number;\r\n readonly STENCIL_BITS: number;\r\n readonly STENCIL_BUFFER_BIT: number;\r\n readonly STENCIL_CLEAR_VALUE: number;\r\n readonly STENCIL_FAIL: number;\r\n readonly STENCIL_FUNC: number;\r\n readonly STENCIL_INDEX: number;\r\n readonly STENCIL_INDEX8: number;\r\n readonly STENCIL_PASS_DEPTH_FAIL: number;\r\n readonly STENCIL_PASS_DEPTH_PASS: number;\r\n readonly STENCIL_REF: number;\r\n readonly STENCIL_TEST: number;\r\n readonly STENCIL_VALUE_MASK: number;\r\n readonly STENCIL_WRITEMASK: number;\r\n readonly STREAM_DRAW: number;\r\n readonly SUBPIXEL_BITS: number;\r\n readonly TEXTURE: number;\r\n readonly TEXTURE0: number;\r\n readonly TEXTURE1: number;\r\n readonly TEXTURE10: number;\r\n readonly TEXTURE11: number;\r\n readonly TEXTURE12: number;\r\n readonly TEXTURE13: number;\r\n readonly TEXTURE14: number;\r\n readonly TEXTURE15: number;\r\n readonly TEXTURE16: number;\r\n readonly TEXTURE17: number;\r\n readonly TEXTURE18: number;\r\n readonly TEXTURE19: number;\r\n readonly TEXTURE2: number;\r\n readonly TEXTURE20: number;\r\n readonly TEXTURE21: number;\r\n readonly TEXTURE22: number;\r\n readonly TEXTURE23: number;\r\n readonly TEXTURE24: number;\r\n readonly TEXTURE25: number;\r\n readonly TEXTURE26: number;\r\n readonly TEXTURE27: number;\r\n readonly TEXTURE28: number;\r\n readonly TEXTURE29: number;\r\n readonly TEXTURE3: number;\r\n readonly TEXTURE30: number;\r\n readonly TEXTURE31: number;\r\n readonly TEXTURE4: number;\r\n readonly TEXTURE5: number;\r\n readonly TEXTURE6: number;\r\n readonly TEXTURE7: number;\r\n readonly TEXTURE8: number;\r\n readonly TEXTURE9: number;\r\n readonly TEXTURE_2D: number;\r\n readonly TEXTURE_BINDING_2D: number;\r\n readonly TEXTURE_BINDING_CUBE_MAP: number;\r\n readonly TEXTURE_CUBE_MAP: number;\r\n readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number;\r\n readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number;\r\n readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number;\r\n readonly TEXTURE_CUBE_MAP_POSITIVE_X: number;\r\n readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number;\r\n readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number;\r\n readonly TEXTURE_MAG_FILTER: number;\r\n readonly TEXTURE_MIN_FILTER: number;\r\n readonly TEXTURE_WRAP_S: number;\r\n readonly TEXTURE_WRAP_T: number;\r\n readonly TRIANGLES: number;\r\n readonly TRIANGLE_FAN: number;\r\n readonly TRIANGLE_STRIP: number;\r\n readonly UNPACK_ALIGNMENT: number;\r\n readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number;\r\n readonly UNPACK_FLIP_Y_WEBGL: number;\r\n readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number;\r\n readonly UNSIGNED_BYTE: number;\r\n readonly UNSIGNED_INT: number;\r\n readonly UNSIGNED_SHORT: number;\r\n readonly UNSIGNED_SHORT_4_4_4_4: number;\r\n readonly UNSIGNED_SHORT_5_5_5_1: number;\r\n readonly UNSIGNED_SHORT_5_6_5: number;\r\n readonly VALIDATE_STATUS: number;\r\n readonly VENDOR: number;\r\n readonly VERSION: number;\r\n readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number;\r\n readonly VERTEX_ATTRIB_ARRAY_ENABLED: number;\r\n readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number;\r\n readonly VERTEX_ATTRIB_ARRAY_POINTER: number;\r\n readonly VERTEX_ATTRIB_ARRAY_SIZE: number;\r\n readonly VERTEX_ATTRIB_ARRAY_STRIDE: number;\r\n readonly VERTEX_ATTRIB_ARRAY_TYPE: number;\r\n readonly VERTEX_SHADER: number;\r\n readonly VIEWPORT: number;\r\n readonly ZERO: number;\r\n}\r\n\r\ninterface WebGLShader extends WebGLObject {\r\n}\r\n\r\ndeclare var WebGLShader: {\r\n prototype: WebGLShader;\r\n new(): WebGLShader;\r\n}\r\n\r\ninterface WebGLShaderPrecisionFormat {\r\n readonly precision: number;\r\n readonly rangeMax: number;\r\n readonly rangeMin: number;\r\n}\r\n\r\ndeclare var WebGLShaderPrecisionFormat: {\r\n prototype: WebGLShaderPrecisionFormat;\r\n new(): WebGLShaderPrecisionFormat;\r\n}\r\n\r\ninterface WebGLTexture extends WebGLObject {\r\n}\r\n\r\ndeclare var WebGLTexture: {\r\n prototype: WebGLTexture;\r\n new(): WebGLTexture;\r\n}\r\n\r\ninterface WebGLUniformLocation {\r\n}\r\n\r\ndeclare var WebGLUniformLocation: {\r\n prototype: WebGLUniformLocation;\r\n new(): WebGLUniformLocation;\r\n}\r\n\r\ninterface WebKitCSSMatrix {\r\n a: number;\r\n b: number;\r\n c: number;\r\n d: number;\r\n e: number;\r\n f: number;\r\n m11: number;\r\n m12: number;\r\n m13: number;\r\n m14: number;\r\n m21: number;\r\n m22: number;\r\n m23: number;\r\n m24: number;\r\n m31: number;\r\n m32: number;\r\n m33: number;\r\n m34: number;\r\n m41: number;\r\n m42: number;\r\n m43: number;\r\n m44: number;\r\n inverse(): WebKitCSSMatrix;\r\n multiply(secondMatrix: WebKitCSSMatrix): WebKitCSSMatrix;\r\n rotate(angleX: number, angleY?: number, angleZ?: number): WebKitCSSMatrix;\r\n rotateAxisAngle(x: number, y: number, z: number, angle: number): WebKitCSSMatrix;\r\n scale(scaleX: number, scaleY?: number, scaleZ?: number): WebKitCSSMatrix;\r\n setMatrixValue(value: string): void;\r\n skewX(angle: number): WebKitCSSMatrix;\r\n skewY(angle: number): WebKitCSSMatrix;\r\n toString(): string;\r\n translate(x: number, y: number, z?: number): WebKitCSSMatrix;\r\n}\r\n\r\ndeclare var WebKitCSSMatrix: {\r\n prototype: WebKitCSSMatrix;\r\n new(text?: string): WebKitCSSMatrix;\r\n}\r\n\r\ninterface WebKitPoint {\r\n x: number;\r\n y: number;\r\n}\r\n\r\ndeclare var WebKitPoint: {\r\n prototype: WebKitPoint;\r\n new(x?: number, y?: number): WebKitPoint;\r\n}\r\n\r\ninterface WebSocket extends EventTarget {\r\n binaryType: string;\r\n readonly bufferedAmount: number;\r\n readonly extensions: string;\r\n onclose: (this: this, ev: CloseEvent) => any;\r\n onerror: (this: this, ev: ErrorEvent) => any;\r\n onmessage: (this: this, ev: MessageEvent) => any;\r\n onopen: (this: this, ev: Event) => any;\r\n readonly protocol: string;\r\n readonly readyState: number;\r\n readonly url: string;\r\n close(code?: number, reason?: string): void;\r\n send(data: any): void;\r\n readonly CLOSED: number;\r\n readonly CLOSING: number;\r\n readonly CONNECTING: number;\r\n readonly OPEN: number;\r\n addEventListener(type: \"close\", listener: (this: this, ev: CloseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"message\", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"open\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var WebSocket: {\r\n prototype: WebSocket;\r\n new(url: string, protocols?: string | string[]): WebSocket;\r\n readonly CLOSED: number;\r\n readonly CLOSING: number;\r\n readonly CONNECTING: number;\r\n readonly OPEN: number;\r\n}\r\n\r\ninterface WheelEvent extends MouseEvent {\r\n readonly deltaMode: number;\r\n readonly deltaX: number;\r\n readonly deltaY: number;\r\n readonly deltaZ: number;\r\n readonly wheelDelta: number;\r\n readonly wheelDeltaX: number;\r\n readonly wheelDeltaY: number;\r\n getCurrentPoint(element: Element): void;\r\n initWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, deltaXArg: number, deltaYArg: number, deltaZArg: number, deltaMode: number): void;\r\n readonly DOM_DELTA_LINE: number;\r\n readonly DOM_DELTA_PAGE: number;\r\n readonly DOM_DELTA_PIXEL: number;\r\n}\r\n\r\ndeclare var WheelEvent: {\r\n prototype: WheelEvent;\r\n new(typeArg: string, eventInitDict?: WheelEventInit): WheelEvent;\r\n readonly DOM_DELTA_LINE: number;\r\n readonly DOM_DELTA_PAGE: number;\r\n readonly DOM_DELTA_PIXEL: number;\r\n}\r\n\r\ninterface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64 {\r\n readonly applicationCache: ApplicationCache;\r\n readonly clientInformation: Navigator;\r\n readonly closed: boolean;\r\n readonly crypto: Crypto;\r\n defaultStatus: string;\r\n readonly devicePixelRatio: number;\r\n readonly doNotTrack: string;\r\n readonly document: Document;\r\n event: Event;\r\n readonly external: External;\r\n readonly frameElement: Element;\r\n readonly frames: Window;\r\n readonly history: History;\r\n readonly innerHeight: number;\r\n readonly innerWidth: number;\r\n readonly length: number;\r\n readonly location: Location;\r\n readonly locationbar: BarProp;\r\n readonly menubar: BarProp;\r\n readonly msCredentials: MSCredentials;\r\n name: string;\r\n readonly navigator: Navigator;\r\n offscreenBuffering: string | boolean;\r\n onabort: (this: this, ev: UIEvent) => any;\r\n onafterprint: (this: this, ev: Event) => any;\r\n onbeforeprint: (this: this, ev: Event) => any;\r\n onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any;\r\n onblur: (this: this, ev: FocusEvent) => any;\r\n oncanplay: (this: this, ev: Event) => any;\r\n oncanplaythrough: (this: this, ev: Event) => any;\r\n onchange: (this: this, ev: Event) => any;\r\n onclick: (this: this, ev: MouseEvent) => any;\r\n oncompassneedscalibration: (this: this, ev: Event) => any;\r\n oncontextmenu: (this: this, ev: PointerEvent) => any;\r\n ondblclick: (this: this, ev: MouseEvent) => any;\r\n ondevicelight: (this: this, ev: DeviceLightEvent) => any;\r\n ondevicemotion: (this: this, ev: DeviceMotionEvent) => any;\r\n ondeviceorientation: (this: this, ev: DeviceOrientationEvent) => any;\r\n ondrag: (this: this, ev: DragEvent) => any;\r\n ondragend: (this: this, ev: DragEvent) => any;\r\n ondragenter: (this: this, ev: DragEvent) => any;\r\n ondragleave: (this: this, ev: DragEvent) => any;\r\n ondragover: (this: this, ev: DragEvent) => any;\r\n ondragstart: (this: this, ev: DragEvent) => any;\r\n ondrop: (this: this, ev: DragEvent) => any;\r\n ondurationchange: (this: this, ev: Event) => any;\r\n onemptied: (this: this, ev: Event) => any;\r\n onended: (this: this, ev: MediaStreamErrorEvent) => any;\r\n onerror: ErrorEventHandler;\r\n onfocus: (this: this, ev: FocusEvent) => any;\r\n onhashchange: (this: this, ev: HashChangeEvent) => any;\r\n oninput: (this: this, ev: Event) => any;\r\n oninvalid: (this: this, ev: Event) => any;\r\n onkeydown: (this: this, ev: KeyboardEvent) => any;\r\n onkeypress: (this: this, ev: KeyboardEvent) => any;\r\n onkeyup: (this: this, ev: KeyboardEvent) => any;\r\n onload: (this: this, ev: Event) => any;\r\n onloadeddata: (this: this, ev: Event) => any;\r\n onloadedmetadata: (this: this, ev: Event) => any;\r\n onloadstart: (this: this, ev: Event) => any;\r\n onmessage: (this: this, ev: MessageEvent) => any;\r\n onmousedown: (this: this, ev: MouseEvent) => any;\r\n onmouseenter: (this: this, ev: MouseEvent) => any;\r\n onmouseleave: (this: this, ev: MouseEvent) => any;\r\n onmousemove: (this: this, ev: MouseEvent) => any;\r\n onmouseout: (this: this, ev: MouseEvent) => any;\r\n onmouseover: (this: this, ev: MouseEvent) => any;\r\n onmouseup: (this: this, ev: MouseEvent) => any;\r\n onmousewheel: (this: this, ev: WheelEvent) => any;\r\n onmsgesturechange: (this: this, ev: MSGestureEvent) => any;\r\n onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any;\r\n onmsgestureend: (this: this, ev: MSGestureEvent) => any;\r\n onmsgesturehold: (this: this, ev: MSGestureEvent) => any;\r\n onmsgesturestart: (this: this, ev: MSGestureEvent) => any;\r\n onmsgesturetap: (this: this, ev: MSGestureEvent) => any;\r\n onmsinertiastart: (this: this, ev: MSGestureEvent) => any;\r\n onmspointercancel: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerdown: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerenter: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerleave: (this: this, ev: MSPointerEvent) => any;\r\n onmspointermove: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerout: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerover: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerup: (this: this, ev: MSPointerEvent) => any;\r\n onoffline: (this: this, ev: Event) => any;\r\n ononline: (this: this, ev: Event) => any;\r\n onorientationchange: (this: this, ev: Event) => any;\r\n onpagehide: (this: this, ev: PageTransitionEvent) => any;\r\n onpageshow: (this: this, ev: PageTransitionEvent) => any;\r\n onpause: (this: this, ev: Event) => any;\r\n onplay: (this: this, ev: Event) => any;\r\n onplaying: (this: this, ev: Event) => any;\r\n onpopstate: (this: this, ev: PopStateEvent) => any;\r\n onprogress: (this: this, ev: ProgressEvent) => any;\r\n onratechange: (this: this, ev: Event) => any;\r\n onreadystatechange: (this: this, ev: ProgressEvent) => any;\r\n onreset: (this: this, ev: Event) => any;\r\n onresize: (this: this, ev: UIEvent) => any;\r\n onscroll: (this: this, ev: UIEvent) => any;\r\n onseeked: (this: this, ev: Event) => any;\r\n onseeking: (this: this, ev: Event) => any;\r\n onselect: (this: this, ev: UIEvent) => any;\r\n onstalled: (this: this, ev: Event) => any;\r\n onstorage: (this: this, ev: StorageEvent) => any;\r\n onsubmit: (this: this, ev: Event) => any;\r\n onsuspend: (this: this, ev: Event) => any;\r\n ontimeupdate: (this: this, ev: Event) => any;\r\n ontouchcancel: (ev: TouchEvent) => any;\r\n ontouchend: (ev: TouchEvent) => any;\r\n ontouchmove: (ev: TouchEvent) => any;\r\n ontouchstart: (ev: TouchEvent) => any;\r\n onunload: (this: this, ev: Event) => any;\r\n onvolumechange: (this: this, ev: Event) => any;\r\n onwaiting: (this: this, ev: Event) => any;\r\n opener: any;\r\n orientation: string | number;\r\n readonly outerHeight: number;\r\n readonly outerWidth: number;\r\n readonly pageXOffset: number;\r\n readonly pageYOffset: number;\r\n readonly parent: Window;\r\n readonly performance: Performance;\r\n readonly personalbar: BarProp;\r\n readonly screen: Screen;\r\n readonly screenLeft: number;\r\n readonly screenTop: number;\r\n readonly screenX: number;\r\n readonly screenY: number;\r\n readonly scrollX: number;\r\n readonly scrollY: number;\r\n readonly scrollbars: BarProp;\r\n readonly self: Window;\r\n status: string;\r\n readonly statusbar: BarProp;\r\n readonly styleMedia: StyleMedia;\r\n readonly toolbar: BarProp;\r\n readonly top: Window;\r\n readonly window: Window;\r\n URL: typeof URL;\r\n Blob: typeof Blob;\r\n alert(message?: any): void;\r\n blur(): void;\r\n cancelAnimationFrame(handle: number): void;\r\n captureEvents(): void;\r\n close(): void;\r\n confirm(message?: string): boolean;\r\n focus(): void;\r\n getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration;\r\n getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList;\r\n getSelection(): Selection;\r\n matchMedia(mediaQuery: string): MediaQueryList;\r\n moveBy(x?: number, y?: number): void;\r\n moveTo(x?: number, y?: number): void;\r\n msWriteProfilerMark(profilerMarkName: string): void;\r\n open(url?: string, target?: string, features?: string, replace?: boolean): Window;\r\n postMessage(message: any, targetOrigin: string, transfer?: any[]): void;\r\n print(): void;\r\n prompt(message?: string, _default?: string): string | null;\r\n releaseEvents(): void;\r\n requestAnimationFrame(callback: FrameRequestCallback): number;\r\n resizeBy(x?: number, y?: number): void;\r\n resizeTo(x?: number, y?: number): void;\r\n scroll(x?: number, y?: number): void;\r\n scrollBy(x?: number, y?: number): void;\r\n scrollTo(x?: number, y?: number): void;\r\n webkitCancelAnimationFrame(handle: number): void;\r\n webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint;\r\n webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint;\r\n webkitRequestAnimationFrame(callback: FrameRequestCallback): number;\r\n scroll(options?: ScrollToOptions): void;\r\n scrollTo(options?: ScrollToOptions): void;\r\n scrollBy(options?: ScrollToOptions): void;\r\n addEventListener(type: \"MSGestureChange\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureDoubleTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureEnd\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureHold\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSInertiaStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerCancel\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerDown\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerEnter\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerLeave\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerMove\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOut\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOver\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerUp\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"abort\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"afterprint\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforeprint\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforeunload\", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"blur\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplay\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplaythrough\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"change\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"click\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"compassneedscalibration\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"contextmenu\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dblclick\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"devicelight\", listener: (this: this, ev: DeviceLightEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"devicemotion\", listener: (this: this, ev: DeviceMotionEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"deviceorientation\", listener: (this: this, ev: DeviceOrientationEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drag\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragend\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragenter\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragleave\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragover\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragstart\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drop\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"durationchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"emptied\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ended\", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"focus\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"hashchange\", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"input\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"invalid\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keydown\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keypress\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keyup\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadeddata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadedmetadata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"message\", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousedown\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseenter\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseleave\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousemove\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseout\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseover\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseup\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousewheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"offline\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"online\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"orientationchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pagehide\", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pageshow\", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pause\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"play\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"playing\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointercancel\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerdown\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerenter\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerleave\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointermove\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerout\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerover\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerup\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"popstate\", listener: (this: this, ev: PopStateEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"progress\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ratechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"readystatechange\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"reset\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"resize\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"scroll\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeked\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeking\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"select\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"stalled\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"storage\", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"submit\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"suspend\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"timeupdate\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"unload\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"volumechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"waiting\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"wheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n [index: number]: Window;\r\n}\r\n\r\ndeclare var Window: {\r\n prototype: Window;\r\n new(): Window;\r\n}\r\n\r\ninterface Worker extends EventTarget, AbstractWorker {\r\n onmessage: (this: this, ev: MessageEvent) => any;\r\n postMessage(message: any, ports?: any): void;\r\n terminate(): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"message\", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var Worker: {\r\n prototype: Worker;\r\n new(stringUrl: string): Worker;\r\n}\r\n\r\ninterface XMLDocument extends Document {\r\n}\r\n\r\ndeclare var XMLDocument: {\r\n prototype: XMLDocument;\r\n new(): XMLDocument;\r\n}\r\n\r\ninterface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {\r\n onreadystatechange: (this: this, ev: ProgressEvent) => any;\r\n readonly readyState: number;\r\n readonly response: any;\r\n readonly responseText: string;\r\n responseType: string;\r\n readonly responseXML: any;\r\n readonly status: number;\r\n readonly statusText: string;\r\n timeout: number;\r\n readonly upload: XMLHttpRequestUpload;\r\n withCredentials: boolean;\r\n msCaching?: string;\r\n abort(): void;\r\n getAllResponseHeaders(): string;\r\n getResponseHeader(header: string): string | null;\r\n msCachingEnabled(): boolean;\r\n open(method: string, url: string, async?: boolean, user?: string, password?: string): void;\r\n overrideMimeType(mime: string): void;\r\n send(data?: Document): void;\r\n send(data?: string): void;\r\n send(data?: any): void;\r\n setRequestHeader(header: string, value: string): void;\r\n readonly DONE: number;\r\n readonly HEADERS_RECEIVED: number;\r\n readonly LOADING: number;\r\n readonly OPENED: number;\r\n readonly UNSENT: number;\r\n addEventListener(type: \"abort\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadend\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"progress\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"readystatechange\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"timeout\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var XMLHttpRequest: {\r\n prototype: XMLHttpRequest;\r\n new(): XMLHttpRequest;\r\n readonly DONE: number;\r\n readonly HEADERS_RECEIVED: number;\r\n readonly LOADING: number;\r\n readonly OPENED: number;\r\n readonly UNSENT: number;\r\n create(): XMLHttpRequest;\r\n}\r\n\r\ninterface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget {\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var XMLHttpRequestUpload: {\r\n prototype: XMLHttpRequestUpload;\r\n new(): XMLHttpRequestUpload;\r\n}\r\n\r\ninterface XMLSerializer {\r\n serializeToString(target: Node): string;\r\n}\r\n\r\ndeclare var XMLSerializer: {\r\n prototype: XMLSerializer;\r\n new(): XMLSerializer;\r\n}\r\n\r\ninterface XPathEvaluator {\r\n createExpression(expression: string, resolver: XPathNSResolver): XPathExpression;\r\n createNSResolver(nodeResolver?: Node): XPathNSResolver;\r\n evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult;\r\n}\r\n\r\ndeclare var XPathEvaluator: {\r\n prototype: XPathEvaluator;\r\n new(): XPathEvaluator;\r\n}\r\n\r\ninterface XPathExpression {\r\n evaluate(contextNode: Node, type: number, result: XPathResult): XPathExpression;\r\n}\r\n\r\ndeclare var XPathExpression: {\r\n prototype: XPathExpression;\r\n new(): XPathExpression;\r\n}\r\n\r\ninterface XPathNSResolver {\r\n lookupNamespaceURI(prefix: string): string;\r\n}\r\n\r\ndeclare var XPathNSResolver: {\r\n prototype: XPathNSResolver;\r\n new(): XPathNSResolver;\r\n}\r\n\r\ninterface XPathResult {\r\n readonly booleanValue: boolean;\r\n readonly invalidIteratorState: boolean;\r\n readonly numberValue: number;\r\n readonly resultType: number;\r\n readonly singleNodeValue: Node;\r\n readonly snapshotLength: number;\r\n readonly stringValue: string;\r\n iterateNext(): Node;\r\n snapshotItem(index: number): Node;\r\n readonly ANY_TYPE: number;\r\n readonly ANY_UNORDERED_NODE_TYPE: number;\r\n readonly BOOLEAN_TYPE: number;\r\n readonly FIRST_ORDERED_NODE_TYPE: number;\r\n readonly NUMBER_TYPE: number;\r\n readonly ORDERED_NODE_ITERATOR_TYPE: number;\r\n readonly ORDERED_NODE_SNAPSHOT_TYPE: number;\r\n readonly STRING_TYPE: number;\r\n readonly UNORDERED_NODE_ITERATOR_TYPE: number;\r\n readonly UNORDERED_NODE_SNAPSHOT_TYPE: number;\r\n}\r\n\r\ndeclare var XPathResult: {\r\n prototype: XPathResult;\r\n new(): XPathResult;\r\n readonly ANY_TYPE: number;\r\n readonly ANY_UNORDERED_NODE_TYPE: number;\r\n readonly BOOLEAN_TYPE: number;\r\n readonly FIRST_ORDERED_NODE_TYPE: number;\r\n readonly NUMBER_TYPE: number;\r\n readonly ORDERED_NODE_ITERATOR_TYPE: number;\r\n readonly ORDERED_NODE_SNAPSHOT_TYPE: number;\r\n readonly STRING_TYPE: number;\r\n readonly UNORDERED_NODE_ITERATOR_TYPE: number;\r\n readonly UNORDERED_NODE_SNAPSHOT_TYPE: number;\r\n}\r\n\r\ninterface XSLTProcessor {\r\n clearParameters(): void;\r\n getParameter(namespaceURI: string, localName: string): any;\r\n importStylesheet(style: Node): void;\r\n removeParameter(namespaceURI: string, localName: string): void;\r\n reset(): void;\r\n setParameter(namespaceURI: string, localName: string, value: any): void;\r\n transformToDocument(source: Node): Document;\r\n transformToFragment(source: Node, document: Document): DocumentFragment;\r\n}\r\n\r\ndeclare var XSLTProcessor: {\r\n prototype: XSLTProcessor;\r\n new(): XSLTProcessor;\r\n}\r\n\r\ninterface AbstractWorker {\r\n onerror: (this: this, ev: ErrorEvent) => any;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ninterface CanvasPathMethods {\r\n arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;\r\n arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void;\r\n bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void;\r\n closePath(): void;\r\n ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;\r\n lineTo(x: number, y: number): void;\r\n moveTo(x: number, y: number): void;\r\n quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;\r\n rect(x: number, y: number, w: number, h: number): void;\r\n}\r\n\r\ninterface ChildNode {\r\n remove(): void;\r\n}\r\n\r\ninterface DOML2DeprecatedColorProperty {\r\n color: string;\r\n}\r\n\r\ninterface DOML2DeprecatedSizeProperty {\r\n size: number;\r\n}\r\n\r\ninterface DocumentEvent {\r\n createEvent(eventInterface:\"AnimationEvent\"): AnimationEvent;\r\n createEvent(eventInterface:\"AriaRequestEvent\"): AriaRequestEvent;\r\n createEvent(eventInterface:\"AudioProcessingEvent\"): AudioProcessingEvent;\r\n createEvent(eventInterface:\"BeforeUnloadEvent\"): BeforeUnloadEvent;\r\n createEvent(eventInterface:\"ClipboardEvent\"): ClipboardEvent;\r\n createEvent(eventInterface:\"CloseEvent\"): CloseEvent;\r\n createEvent(eventInterface:\"CommandEvent\"): CommandEvent;\r\n createEvent(eventInterface:\"CompositionEvent\"): CompositionEvent;\r\n createEvent(eventInterface:\"CustomEvent\"): CustomEvent;\r\n createEvent(eventInterface:\"DeviceLightEvent\"): DeviceLightEvent;\r\n createEvent(eventInterface:\"DeviceMotionEvent\"): DeviceMotionEvent;\r\n createEvent(eventInterface:\"DeviceOrientationEvent\"): DeviceOrientationEvent;\r\n createEvent(eventInterface:\"DragEvent\"): DragEvent;\r\n createEvent(eventInterface:\"ErrorEvent\"): ErrorEvent;\r\n createEvent(eventInterface:\"Event\"): Event;\r\n createEvent(eventInterface:\"Events\"): Event;\r\n createEvent(eventInterface:\"FocusEvent\"): FocusEvent;\r\n createEvent(eventInterface:\"GamepadEvent\"): GamepadEvent;\r\n createEvent(eventInterface:\"HashChangeEvent\"): HashChangeEvent;\r\n createEvent(eventInterface:\"IDBVersionChangeEvent\"): IDBVersionChangeEvent;\r\n createEvent(eventInterface:\"KeyboardEvent\"): KeyboardEvent;\r\n createEvent(eventInterface:\"ListeningStateChangedEvent\"): ListeningStateChangedEvent;\r\n createEvent(eventInterface:\"LongRunningScriptDetectedEvent\"): LongRunningScriptDetectedEvent;\r\n createEvent(eventInterface:\"MSGestureEvent\"): MSGestureEvent;\r\n createEvent(eventInterface:\"MSManipulationEvent\"): MSManipulationEvent;\r\n createEvent(eventInterface:\"MSMediaKeyMessageEvent\"): MSMediaKeyMessageEvent;\r\n createEvent(eventInterface:\"MSMediaKeyNeededEvent\"): MSMediaKeyNeededEvent;\r\n createEvent(eventInterface:\"MSPointerEvent\"): MSPointerEvent;\r\n createEvent(eventInterface:\"MSSiteModeEvent\"): MSSiteModeEvent;\r\n createEvent(eventInterface:\"MediaEncryptedEvent\"): MediaEncryptedEvent;\r\n createEvent(eventInterface:\"MediaKeyMessageEvent\"): MediaKeyMessageEvent;\r\n createEvent(eventInterface:\"MediaStreamErrorEvent\"): MediaStreamErrorEvent;\r\n createEvent(eventInterface:\"MediaStreamTrackEvent\"): MediaStreamTrackEvent;\r\n createEvent(eventInterface:\"MessageEvent\"): MessageEvent;\r\n createEvent(eventInterface:\"MouseEvent\"): MouseEvent;\r\n createEvent(eventInterface:\"MouseEvents\"): MouseEvent;\r\n createEvent(eventInterface:\"MutationEvent\"): MutationEvent;\r\n createEvent(eventInterface:\"MutationEvents\"): MutationEvent;\r\n createEvent(eventInterface:\"NavigationCompletedEvent\"): NavigationCompletedEvent;\r\n createEvent(eventInterface:\"NavigationEvent\"): NavigationEvent;\r\n createEvent(eventInterface:\"NavigationEventWithReferrer\"): NavigationEventWithReferrer;\r\n createEvent(eventInterface:\"OfflineAudioCompletionEvent\"): OfflineAudioCompletionEvent;\r\n createEvent(eventInterface:\"OverflowEvent\"): OverflowEvent;\r\n createEvent(eventInterface:\"PageTransitionEvent\"): PageTransitionEvent;\r\n createEvent(eventInterface:\"PermissionRequestedEvent\"): PermissionRequestedEvent;\r\n createEvent(eventInterface:\"PointerEvent\"): PointerEvent;\r\n createEvent(eventInterface:\"PopStateEvent\"): PopStateEvent;\r\n createEvent(eventInterface:\"ProgressEvent\"): ProgressEvent;\r\n createEvent(eventInterface:\"RTCDTMFToneChangeEvent\"): RTCDTMFToneChangeEvent;\r\n createEvent(eventInterface:\"RTCDtlsTransportStateChangedEvent\"): RTCDtlsTransportStateChangedEvent;\r\n createEvent(eventInterface:\"RTCIceCandidatePairChangedEvent\"): RTCIceCandidatePairChangedEvent;\r\n createEvent(eventInterface:\"RTCIceGathererEvent\"): RTCIceGathererEvent;\r\n createEvent(eventInterface:\"RTCIceTransportStateChangedEvent\"): RTCIceTransportStateChangedEvent;\r\n createEvent(eventInterface:\"RTCSsrcConflictEvent\"): RTCSsrcConflictEvent;\r\n createEvent(eventInterface:\"SVGZoomEvent\"): SVGZoomEvent;\r\n createEvent(eventInterface:\"SVGZoomEvents\"): SVGZoomEvent;\r\n createEvent(eventInterface:\"ScriptNotifyEvent\"): ScriptNotifyEvent;\r\n createEvent(eventInterface:\"StorageEvent\"): StorageEvent;\r\n createEvent(eventInterface:\"TextEvent\"): TextEvent;\r\n createEvent(eventInterface:\"TouchEvent\"): TouchEvent;\r\n createEvent(eventInterface:\"TrackEvent\"): TrackEvent;\r\n createEvent(eventInterface:\"TransitionEvent\"): TransitionEvent;\r\n createEvent(eventInterface:\"UIEvent\"): UIEvent;\r\n createEvent(eventInterface:\"UIEvents\"): UIEvent;\r\n createEvent(eventInterface:\"UnviewableContentIdentifiedEvent\"): UnviewableContentIdentifiedEvent;\r\n createEvent(eventInterface:\"WebGLContextEvent\"): WebGLContextEvent;\r\n createEvent(eventInterface:\"WheelEvent\"): WheelEvent;\r\n createEvent(eventInterface: string): Event;\r\n}\r\n\r\ninterface ElementTraversal {\r\n readonly childElementCount: number;\r\n readonly firstElementChild: Element;\r\n readonly lastElementChild: Element;\r\n readonly nextElementSibling: Element;\r\n readonly previousElementSibling: Element;\r\n}\r\n\r\ninterface GetSVGDocument {\r\n getSVGDocument(): Document;\r\n}\r\n\r\ninterface GlobalEventHandlers {\r\n onpointercancel: (this: this, ev: PointerEvent) => any;\r\n onpointerdown: (this: this, ev: PointerEvent) => any;\r\n onpointerenter: (this: this, ev: PointerEvent) => any;\r\n onpointerleave: (this: this, ev: PointerEvent) => any;\r\n onpointermove: (this: this, ev: PointerEvent) => any;\r\n onpointerout: (this: this, ev: PointerEvent) => any;\r\n onpointerover: (this: this, ev: PointerEvent) => any;\r\n onpointerup: (this: this, ev: PointerEvent) => any;\r\n onwheel: (this: this, ev: WheelEvent) => any;\r\n addEventListener(type: \"pointercancel\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerdown\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerenter\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerleave\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointermove\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerout\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerover\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerup\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"wheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ninterface HTMLTableAlignment {\r\n /**\r\n * Sets or retrieves a value that you can use to implement your own ch functionality for the object.\r\n */\r\n ch: string;\r\n /**\r\n * Sets or retrieves a value that you can use to implement your own chOff functionality for the object.\r\n */\r\n chOff: string;\r\n /**\r\n * Sets or retrieves how text and other content are vertically aligned within the object that contains them.\r\n */\r\n vAlign: string;\r\n}\r\n\r\ninterface IDBEnvironment {\r\n readonly indexedDB: IDBFactory;\r\n}\r\n\r\ninterface LinkStyle {\r\n readonly sheet: StyleSheet;\r\n}\r\n\r\ninterface MSBaseReader {\r\n onabort: (this: this, ev: Event) => any;\r\n onerror: (this: this, ev: ErrorEvent) => any;\r\n onload: (this: this, ev: Event) => any;\r\n onloadend: (this: this, ev: ProgressEvent) => any;\r\n onloadstart: (this: this, ev: Event) => any;\r\n onprogress: (this: this, ev: ProgressEvent) => any;\r\n readonly readyState: number;\r\n readonly result: any;\r\n abort(): void;\r\n readonly DONE: number;\r\n readonly EMPTY: number;\r\n readonly LOADING: number;\r\n addEventListener(type: \"abort\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadend\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"progress\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ninterface MSFileSaver {\r\n msSaveBlob(blob: any, defaultName?: string): boolean;\r\n msSaveOrOpenBlob(blob: any, defaultName?: string): boolean;\r\n}\r\n\r\ninterface MSNavigatorDoNotTrack {\r\n confirmSiteSpecificTrackingException(args: ConfirmSiteSpecificExceptionsInformation): boolean;\r\n confirmWebWideTrackingException(args: ExceptionInformation): boolean;\r\n removeSiteSpecificTrackingException(args: ExceptionInformation): void;\r\n removeWebWideTrackingException(args: ExceptionInformation): void;\r\n storeSiteSpecificTrackingException(args: StoreSiteSpecificExceptionsInformation): void;\r\n storeWebWideTrackingException(args: StoreExceptionsInformation): void;\r\n}\r\n\r\ninterface NavigatorContentUtils {\r\n}\r\n\r\ninterface NavigatorGeolocation {\r\n readonly geolocation: Geolocation;\r\n}\r\n\r\ninterface NavigatorID {\r\n readonly appName: string;\r\n readonly appVersion: string;\r\n readonly platform: string;\r\n readonly product: string;\r\n readonly productSub: string;\r\n readonly userAgent: string;\r\n readonly vendor: string;\r\n readonly vendorSub: string;\r\n}\r\n\r\ninterface NavigatorOnLine {\r\n readonly onLine: boolean;\r\n}\r\n\r\ninterface NavigatorStorageUtils {\r\n}\r\n\r\ninterface NavigatorUserMedia {\r\n readonly mediaDevices: MediaDevices;\r\n getUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void;\r\n}\r\n\r\ninterface NodeSelector {\r\n querySelector(selectors: \"a\"): HTMLAnchorElement;\r\n querySelector(selectors: \"abbr\"): HTMLElement;\r\n querySelector(selectors: \"acronym\"): HTMLElement;\r\n querySelector(selectors: \"address\"): HTMLElement;\r\n querySelector(selectors: \"applet\"): HTMLAppletElement;\r\n querySelector(selectors: \"area\"): HTMLAreaElement;\r\n querySelector(selectors: \"article\"): HTMLElement;\r\n querySelector(selectors: \"aside\"): HTMLElement;\r\n querySelector(selectors: \"audio\"): HTMLAudioElement;\r\n querySelector(selectors: \"b\"): HTMLElement;\r\n querySelector(selectors: \"base\"): HTMLBaseElement;\r\n querySelector(selectors: \"basefont\"): HTMLBaseFontElement;\r\n querySelector(selectors: \"bdo\"): HTMLElement;\r\n querySelector(selectors: \"big\"): HTMLElement;\r\n querySelector(selectors: \"blockquote\"): HTMLQuoteElement;\r\n querySelector(selectors: \"body\"): HTMLBodyElement;\r\n querySelector(selectors: \"br\"): HTMLBRElement;\r\n querySelector(selectors: \"button\"): HTMLButtonElement;\r\n querySelector(selectors: \"canvas\"): HTMLCanvasElement;\r\n querySelector(selectors: \"caption\"): HTMLTableCaptionElement;\r\n querySelector(selectors: \"center\"): HTMLElement;\r\n querySelector(selectors: \"circle\"): SVGCircleElement;\r\n querySelector(selectors: \"cite\"): HTMLElement;\r\n querySelector(selectors: \"clippath\"): SVGClipPathElement;\r\n querySelector(selectors: \"code\"): HTMLElement;\r\n querySelector(selectors: \"col\"): HTMLTableColElement;\r\n querySelector(selectors: \"colgroup\"): HTMLTableColElement;\r\n querySelector(selectors: \"datalist\"): HTMLDataListElement;\r\n querySelector(selectors: \"dd\"): HTMLElement;\r\n querySelector(selectors: \"defs\"): SVGDefsElement;\r\n querySelector(selectors: \"del\"): HTMLModElement;\r\n querySelector(selectors: \"desc\"): SVGDescElement;\r\n querySelector(selectors: \"dfn\"): HTMLElement;\r\n querySelector(selectors: \"dir\"): HTMLDirectoryElement;\r\n querySelector(selectors: \"div\"): HTMLDivElement;\r\n querySelector(selectors: \"dl\"): HTMLDListElement;\r\n querySelector(selectors: \"dt\"): HTMLElement;\r\n querySelector(selectors: \"ellipse\"): SVGEllipseElement;\r\n querySelector(selectors: \"em\"): HTMLElement;\r\n querySelector(selectors: \"embed\"): HTMLEmbedElement;\r\n querySelector(selectors: \"feblend\"): SVGFEBlendElement;\r\n querySelector(selectors: \"fecolormatrix\"): SVGFEColorMatrixElement;\r\n querySelector(selectors: \"fecomponenttransfer\"): SVGFEComponentTransferElement;\r\n querySelector(selectors: \"fecomposite\"): SVGFECompositeElement;\r\n querySelector(selectors: \"feconvolvematrix\"): SVGFEConvolveMatrixElement;\r\n querySelector(selectors: \"fediffuselighting\"): SVGFEDiffuseLightingElement;\r\n querySelector(selectors: \"fedisplacementmap\"): SVGFEDisplacementMapElement;\r\n querySelector(selectors: \"fedistantlight\"): SVGFEDistantLightElement;\r\n querySelector(selectors: \"feflood\"): SVGFEFloodElement;\r\n querySelector(selectors: \"fefunca\"): SVGFEFuncAElement;\r\n querySelector(selectors: \"fefuncb\"): SVGFEFuncBElement;\r\n querySelector(selectors: \"fefuncg\"): SVGFEFuncGElement;\r\n querySelector(selectors: \"fefuncr\"): SVGFEFuncRElement;\r\n querySelector(selectors: \"fegaussianblur\"): SVGFEGaussianBlurElement;\r\n querySelector(selectors: \"feimage\"): SVGFEImageElement;\r\n querySelector(selectors: \"femerge\"): SVGFEMergeElement;\r\n querySelector(selectors: \"femergenode\"): SVGFEMergeNodeElement;\r\n querySelector(selectors: \"femorphology\"): SVGFEMorphologyElement;\r\n querySelector(selectors: \"feoffset\"): SVGFEOffsetElement;\r\n querySelector(selectors: \"fepointlight\"): SVGFEPointLightElement;\r\n querySelector(selectors: \"fespecularlighting\"): SVGFESpecularLightingElement;\r\n querySelector(selectors: \"fespotlight\"): SVGFESpotLightElement;\r\n querySelector(selectors: \"fetile\"): SVGFETileElement;\r\n querySelector(selectors: \"feturbulence\"): SVGFETurbulenceElement;\r\n querySelector(selectors: \"fieldset\"): HTMLFieldSetElement;\r\n querySelector(selectors: \"figcaption\"): HTMLElement;\r\n querySelector(selectors: \"figure\"): HTMLElement;\r\n querySelector(selectors: \"filter\"): SVGFilterElement;\r\n querySelector(selectors: \"font\"): HTMLFontElement;\r\n querySelector(selectors: \"footer\"): HTMLElement;\r\n querySelector(selectors: \"foreignobject\"): SVGForeignObjectElement;\r\n querySelector(selectors: \"form\"): HTMLFormElement;\r\n querySelector(selectors: \"frame\"): HTMLFrameElement;\r\n querySelector(selectors: \"frameset\"): HTMLFrameSetElement;\r\n querySelector(selectors: \"g\"): SVGGElement;\r\n querySelector(selectors: \"h1\"): HTMLHeadingElement;\r\n querySelector(selectors: \"h2\"): HTMLHeadingElement;\r\n querySelector(selectors: \"h3\"): HTMLHeadingElement;\r\n querySelector(selectors: \"h4\"): HTMLHeadingElement;\r\n querySelector(selectors: \"h5\"): HTMLHeadingElement;\r\n querySelector(selectors: \"h6\"): HTMLHeadingElement;\r\n querySelector(selectors: \"head\"): HTMLHeadElement;\r\n querySelector(selectors: \"header\"): HTMLElement;\r\n querySelector(selectors: \"hgroup\"): HTMLElement;\r\n querySelector(selectors: \"hr\"): HTMLHRElement;\r\n querySelector(selectors: \"html\"): HTMLHtmlElement;\r\n querySelector(selectors: \"i\"): HTMLElement;\r\n querySelector(selectors: \"iframe\"): HTMLIFrameElement;\r\n querySelector(selectors: \"image\"): SVGImageElement;\r\n querySelector(selectors: \"img\"): HTMLImageElement;\r\n querySelector(selectors: \"input\"): HTMLInputElement;\r\n querySelector(selectors: \"ins\"): HTMLModElement;\r\n querySelector(selectors: \"isindex\"): HTMLUnknownElement;\r\n querySelector(selectors: \"kbd\"): HTMLElement;\r\n querySelector(selectors: \"keygen\"): HTMLElement;\r\n querySelector(selectors: \"label\"): HTMLLabelElement;\r\n querySelector(selectors: \"legend\"): HTMLLegendElement;\r\n querySelector(selectors: \"li\"): HTMLLIElement;\r\n querySelector(selectors: \"line\"): SVGLineElement;\r\n querySelector(selectors: \"lineargradient\"): SVGLinearGradientElement;\r\n querySelector(selectors: \"link\"): HTMLLinkElement;\r\n querySelector(selectors: \"listing\"): HTMLPreElement;\r\n querySelector(selectors: \"map\"): HTMLMapElement;\r\n querySelector(selectors: \"mark\"): HTMLElement;\r\n querySelector(selectors: \"marker\"): SVGMarkerElement;\r\n querySelector(selectors: \"marquee\"): HTMLMarqueeElement;\r\n querySelector(selectors: \"mask\"): SVGMaskElement;\r\n querySelector(selectors: \"menu\"): HTMLMenuElement;\r\n querySelector(selectors: \"meta\"): HTMLMetaElement;\r\n querySelector(selectors: \"metadata\"): SVGMetadataElement;\r\n querySelector(selectors: \"meter\"): HTMLMeterElement;\r\n querySelector(selectors: \"nav\"): HTMLElement;\r\n querySelector(selectors: \"nextid\"): HTMLUnknownElement;\r\n querySelector(selectors: \"nobr\"): HTMLElement;\r\n querySelector(selectors: \"noframes\"): HTMLElement;\r\n querySelector(selectors: \"noscript\"): HTMLElement;\r\n querySelector(selectors: \"object\"): HTMLObjectElement;\r\n querySelector(selectors: \"ol\"): HTMLOListElement;\r\n querySelector(selectors: \"optgroup\"): HTMLOptGroupElement;\r\n querySelector(selectors: \"option\"): HTMLOptionElement;\r\n querySelector(selectors: \"p\"): HTMLParagraphElement;\r\n querySelector(selectors: \"param\"): HTMLParamElement;\r\n querySelector(selectors: \"path\"): SVGPathElement;\r\n querySelector(selectors: \"pattern\"): SVGPatternElement;\r\n querySelector(selectors: \"picture\"): HTMLPictureElement;\r\n querySelector(selectors: \"plaintext\"): HTMLElement;\r\n querySelector(selectors: \"polygon\"): SVGPolygonElement;\r\n querySelector(selectors: \"polyline\"): SVGPolylineElement;\r\n querySelector(selectors: \"pre\"): HTMLPreElement;\r\n querySelector(selectors: \"progress\"): HTMLProgressElement;\r\n querySelector(selectors: \"q\"): HTMLQuoteElement;\r\n querySelector(selectors: \"radialgradient\"): SVGRadialGradientElement;\r\n querySelector(selectors: \"rect\"): SVGRectElement;\r\n querySelector(selectors: \"rt\"): HTMLElement;\r\n querySelector(selectors: \"ruby\"): HTMLElement;\r\n querySelector(selectors: \"s\"): HTMLElement;\r\n querySelector(selectors: \"samp\"): HTMLElement;\r\n querySelector(selectors: \"script\"): HTMLScriptElement;\r\n querySelector(selectors: \"section\"): HTMLElement;\r\n querySelector(selectors: \"select\"): HTMLSelectElement;\r\n querySelector(selectors: \"small\"): HTMLElement;\r\n querySelector(selectors: \"source\"): HTMLSourceElement;\r\n querySelector(selectors: \"span\"): HTMLSpanElement;\r\n querySelector(selectors: \"stop\"): SVGStopElement;\r\n querySelector(selectors: \"strike\"): HTMLElement;\r\n querySelector(selectors: \"strong\"): HTMLElement;\r\n querySelector(selectors: \"style\"): HTMLStyleElement;\r\n querySelector(selectors: \"sub\"): HTMLElement;\r\n querySelector(selectors: \"sup\"): HTMLElement;\r\n querySelector(selectors: \"svg\"): SVGSVGElement;\r\n querySelector(selectors: \"switch\"): SVGSwitchElement;\r\n querySelector(selectors: \"symbol\"): SVGSymbolElement;\r\n querySelector(selectors: \"table\"): HTMLTableElement;\r\n querySelector(selectors: \"tbody\"): HTMLTableSectionElement;\r\n querySelector(selectors: \"td\"): HTMLTableDataCellElement;\r\n querySelector(selectors: \"template\"): HTMLTemplateElement;\r\n querySelector(selectors: \"text\"): SVGTextElement;\r\n querySelector(selectors: \"textpath\"): SVGTextPathElement;\r\n querySelector(selectors: \"textarea\"): HTMLTextAreaElement;\r\n querySelector(selectors: \"tfoot\"): HTMLTableSectionElement;\r\n querySelector(selectors: \"th\"): HTMLTableHeaderCellElement;\r\n querySelector(selectors: \"thead\"): HTMLTableSectionElement;\r\n querySelector(selectors: \"title\"): HTMLTitleElement;\r\n querySelector(selectors: \"tr\"): HTMLTableRowElement;\r\n querySelector(selectors: \"track\"): HTMLTrackElement;\r\n querySelector(selectors: \"tspan\"): SVGTSpanElement;\r\n querySelector(selectors: \"tt\"): HTMLElement;\r\n querySelector(selectors: \"u\"): HTMLElement;\r\n querySelector(selectors: \"ul\"): HTMLUListElement;\r\n querySelector(selectors: \"use\"): SVGUseElement;\r\n querySelector(selectors: \"var\"): HTMLElement;\r\n querySelector(selectors: \"video\"): HTMLVideoElement;\r\n querySelector(selectors: \"view\"): SVGViewElement;\r\n querySelector(selectors: \"wbr\"): HTMLElement;\r\n querySelector(selectors: \"x-ms-webview\"): MSHTMLWebViewElement;\r\n querySelector(selectors: \"xmp\"): HTMLPreElement;\r\n querySelector(selectors: string): Element;\r\n querySelectorAll(selectors: \"a\"): NodeListOf;\r\n querySelectorAll(selectors: \"abbr\"): NodeListOf;\r\n querySelectorAll(selectors: \"acronym\"): NodeListOf;\r\n querySelectorAll(selectors: \"address\"): NodeListOf;\r\n querySelectorAll(selectors: \"applet\"): NodeListOf;\r\n querySelectorAll(selectors: \"area\"): NodeListOf;\r\n querySelectorAll(selectors: \"article\"): NodeListOf;\r\n querySelectorAll(selectors: \"aside\"): NodeListOf;\r\n querySelectorAll(selectors: \"audio\"): NodeListOf;\r\n querySelectorAll(selectors: \"b\"): NodeListOf;\r\n querySelectorAll(selectors: \"base\"): NodeListOf;\r\n querySelectorAll(selectors: \"basefont\"): NodeListOf;\r\n querySelectorAll(selectors: \"bdo\"): NodeListOf;\r\n querySelectorAll(selectors: \"big\"): NodeListOf;\r\n querySelectorAll(selectors: \"blockquote\"): NodeListOf;\r\n querySelectorAll(selectors: \"body\"): NodeListOf;\r\n querySelectorAll(selectors: \"br\"): NodeListOf;\r\n querySelectorAll(selectors: \"button\"): NodeListOf;\r\n querySelectorAll(selectors: \"canvas\"): NodeListOf;\r\n querySelectorAll(selectors: \"caption\"): NodeListOf;\r\n querySelectorAll(selectors: \"center\"): NodeListOf;\r\n querySelectorAll(selectors: \"circle\"): NodeListOf;\r\n querySelectorAll(selectors: \"cite\"): NodeListOf;\r\n querySelectorAll(selectors: \"clippath\"): NodeListOf;\r\n querySelectorAll(selectors: \"code\"): NodeListOf;\r\n querySelectorAll(selectors: \"col\"): NodeListOf;\r\n querySelectorAll(selectors: \"colgroup\"): NodeListOf;\r\n querySelectorAll(selectors: \"datalist\"): NodeListOf;\r\n querySelectorAll(selectors: \"dd\"): NodeListOf;\r\n querySelectorAll(selectors: \"defs\"): NodeListOf;\r\n querySelectorAll(selectors: \"del\"): NodeListOf;\r\n querySelectorAll(selectors: \"desc\"): NodeListOf;\r\n querySelectorAll(selectors: \"dfn\"): NodeListOf;\r\n querySelectorAll(selectors: \"dir\"): NodeListOf;\r\n querySelectorAll(selectors: \"div\"): NodeListOf;\r\n querySelectorAll(selectors: \"dl\"): NodeListOf;\r\n querySelectorAll(selectors: \"dt\"): NodeListOf;\r\n querySelectorAll(selectors: \"ellipse\"): NodeListOf;\r\n querySelectorAll(selectors: \"em\"): NodeListOf;\r\n querySelectorAll(selectors: \"embed\"): NodeListOf;\r\n querySelectorAll(selectors: \"feblend\"): NodeListOf;\r\n querySelectorAll(selectors: \"fecolormatrix\"): NodeListOf;\r\n querySelectorAll(selectors: \"fecomponenttransfer\"): NodeListOf;\r\n querySelectorAll(selectors: \"fecomposite\"): NodeListOf;\r\n querySelectorAll(selectors: \"feconvolvematrix\"): NodeListOf;\r\n querySelectorAll(selectors: \"fediffuselighting\"): NodeListOf;\r\n querySelectorAll(selectors: \"fedisplacementmap\"): NodeListOf;\r\n querySelectorAll(selectors: \"fedistantlight\"): NodeListOf;\r\n querySelectorAll(selectors: \"feflood\"): NodeListOf;\r\n querySelectorAll(selectors: \"fefunca\"): NodeListOf;\r\n querySelectorAll(selectors: \"fefuncb\"): NodeListOf;\r\n querySelectorAll(selectors: \"fefuncg\"): NodeListOf;\r\n querySelectorAll(selectors: \"fefuncr\"): NodeListOf;\r\n querySelectorAll(selectors: \"fegaussianblur\"): NodeListOf;\r\n querySelectorAll(selectors: \"feimage\"): NodeListOf;\r\n querySelectorAll(selectors: \"femerge\"): NodeListOf;\r\n querySelectorAll(selectors: \"femergenode\"): NodeListOf;\r\n querySelectorAll(selectors: \"femorphology\"): NodeListOf;\r\n querySelectorAll(selectors: \"feoffset\"): NodeListOf;\r\n querySelectorAll(selectors: \"fepointlight\"): NodeListOf;\r\n querySelectorAll(selectors: \"fespecularlighting\"): NodeListOf;\r\n querySelectorAll(selectors: \"fespotlight\"): NodeListOf;\r\n querySelectorAll(selectors: \"fetile\"): NodeListOf;\r\n querySelectorAll(selectors: \"feturbulence\"): NodeListOf;\r\n querySelectorAll(selectors: \"fieldset\"): NodeListOf;\r\n querySelectorAll(selectors: \"figcaption\"): NodeListOf;\r\n querySelectorAll(selectors: \"figure\"): NodeListOf;\r\n querySelectorAll(selectors: \"filter\"): NodeListOf;\r\n querySelectorAll(selectors: \"font\"): NodeListOf;\r\n querySelectorAll(selectors: \"footer\"): NodeListOf;\r\n querySelectorAll(selectors: \"foreignobject\"): NodeListOf;\r\n querySelectorAll(selectors: \"form\"): NodeListOf;\r\n querySelectorAll(selectors: \"frame\"): NodeListOf;\r\n querySelectorAll(selectors: \"frameset\"): NodeListOf;\r\n querySelectorAll(selectors: \"g\"): NodeListOf;\r\n querySelectorAll(selectors: \"h1\"): NodeListOf;\r\n querySelectorAll(selectors: \"h2\"): NodeListOf;\r\n querySelectorAll(selectors: \"h3\"): NodeListOf;\r\n querySelectorAll(selectors: \"h4\"): NodeListOf;\r\n querySelectorAll(selectors: \"h5\"): NodeListOf;\r\n querySelectorAll(selectors: \"h6\"): NodeListOf;\r\n querySelectorAll(selectors: \"head\"): NodeListOf;\r\n querySelectorAll(selectors: \"header\"): NodeListOf;\r\n querySelectorAll(selectors: \"hgroup\"): NodeListOf;\r\n querySelectorAll(selectors: \"hr\"): NodeListOf;\r\n querySelectorAll(selectors: \"html\"): NodeListOf;\r\n querySelectorAll(selectors: \"i\"): NodeListOf;\r\n querySelectorAll(selectors: \"iframe\"): NodeListOf;\r\n querySelectorAll(selectors: \"image\"): NodeListOf;\r\n querySelectorAll(selectors: \"img\"): NodeListOf;\r\n querySelectorAll(selectors: \"input\"): NodeListOf;\r\n querySelectorAll(selectors: \"ins\"): NodeListOf;\r\n querySelectorAll(selectors: \"isindex\"): NodeListOf;\r\n querySelectorAll(selectors: \"kbd\"): NodeListOf;\r\n querySelectorAll(selectors: \"keygen\"): NodeListOf;\r\n querySelectorAll(selectors: \"label\"): NodeListOf;\r\n querySelectorAll(selectors: \"legend\"): NodeListOf;\r\n querySelectorAll(selectors: \"li\"): NodeListOf;\r\n querySelectorAll(selectors: \"line\"): NodeListOf;\r\n querySelectorAll(selectors: \"lineargradient\"): NodeListOf;\r\n querySelectorAll(selectors: \"link\"): NodeListOf;\r\n querySelectorAll(selectors: \"listing\"): NodeListOf;\r\n querySelectorAll(selectors: \"map\"): NodeListOf;\r\n querySelectorAll(selectors: \"mark\"): NodeListOf;\r\n querySelectorAll(selectors: \"marker\"): NodeListOf;\r\n querySelectorAll(selectors: \"marquee\"): NodeListOf;\r\n querySelectorAll(selectors: \"mask\"): NodeListOf;\r\n querySelectorAll(selectors: \"menu\"): NodeListOf;\r\n querySelectorAll(selectors: \"meta\"): NodeListOf;\r\n querySelectorAll(selectors: \"metadata\"): NodeListOf;\r\n querySelectorAll(selectors: \"meter\"): NodeListOf;\r\n querySelectorAll(selectors: \"nav\"): NodeListOf;\r\n querySelectorAll(selectors: \"nextid\"): NodeListOf;\r\n querySelectorAll(selectors: \"nobr\"): NodeListOf;\r\n querySelectorAll(selectors: \"noframes\"): NodeListOf;\r\n querySelectorAll(selectors: \"noscript\"): NodeListOf;\r\n querySelectorAll(selectors: \"object\"): NodeListOf;\r\n querySelectorAll(selectors: \"ol\"): NodeListOf;\r\n querySelectorAll(selectors: \"optgroup\"): NodeListOf;\r\n querySelectorAll(selectors: \"option\"): NodeListOf;\r\n querySelectorAll(selectors: \"p\"): NodeListOf;\r\n querySelectorAll(selectors: \"param\"): NodeListOf;\r\n querySelectorAll(selectors: \"path\"): NodeListOf;\r\n querySelectorAll(selectors: \"pattern\"): NodeListOf;\r\n querySelectorAll(selectors: \"picture\"): NodeListOf;\r\n querySelectorAll(selectors: \"plaintext\"): NodeListOf;\r\n querySelectorAll(selectors: \"polygon\"): NodeListOf;\r\n querySelectorAll(selectors: \"polyline\"): NodeListOf;\r\n querySelectorAll(selectors: \"pre\"): NodeListOf;\r\n querySelectorAll(selectors: \"progress\"): NodeListOf;\r\n querySelectorAll(selectors: \"q\"): NodeListOf;\r\n querySelectorAll(selectors: \"radialgradient\"): NodeListOf;\r\n querySelectorAll(selectors: \"rect\"): NodeListOf;\r\n querySelectorAll(selectors: \"rt\"): NodeListOf;\r\n querySelectorAll(selectors: \"ruby\"): NodeListOf;\r\n querySelectorAll(selectors: \"s\"): NodeListOf;\r\n querySelectorAll(selectors: \"samp\"): NodeListOf;\r\n querySelectorAll(selectors: \"script\"): NodeListOf;\r\n querySelectorAll(selectors: \"section\"): NodeListOf;\r\n querySelectorAll(selectors: \"select\"): NodeListOf;\r\n querySelectorAll(selectors: \"small\"): NodeListOf;\r\n querySelectorAll(selectors: \"source\"): NodeListOf;\r\n querySelectorAll(selectors: \"span\"): NodeListOf;\r\n querySelectorAll(selectors: \"stop\"): NodeListOf;\r\n querySelectorAll(selectors: \"strike\"): NodeListOf;\r\n querySelectorAll(selectors: \"strong\"): NodeListOf;\r\n querySelectorAll(selectors: \"style\"): NodeListOf;\r\n querySelectorAll(selectors: \"sub\"): NodeListOf;\r\n querySelectorAll(selectors: \"sup\"): NodeListOf;\r\n querySelectorAll(selectors: \"svg\"): NodeListOf;\r\n querySelectorAll(selectors: \"switch\"): NodeListOf;\r\n querySelectorAll(selectors: \"symbol\"): NodeListOf;\r\n querySelectorAll(selectors: \"table\"): NodeListOf;\r\n querySelectorAll(selectors: \"tbody\"): NodeListOf;\r\n querySelectorAll(selectors: \"td\"): NodeListOf;\r\n querySelectorAll(selectors: \"template\"): NodeListOf;\r\n querySelectorAll(selectors: \"text\"): NodeListOf;\r\n querySelectorAll(selectors: \"textpath\"): NodeListOf;\r\n querySelectorAll(selectors: \"textarea\"): NodeListOf;\r\n querySelectorAll(selectors: \"tfoot\"): NodeListOf;\r\n querySelectorAll(selectors: \"th\"): NodeListOf;\r\n querySelectorAll(selectors: \"thead\"): NodeListOf;\r\n querySelectorAll(selectors: \"title\"): NodeListOf;\r\n querySelectorAll(selectors: \"tr\"): NodeListOf;\r\n querySelectorAll(selectors: \"track\"): NodeListOf;\r\n querySelectorAll(selectors: \"tspan\"): NodeListOf;\r\n querySelectorAll(selectors: \"tt\"): NodeListOf;\r\n querySelectorAll(selectors: \"u\"): NodeListOf;\r\n querySelectorAll(selectors: \"ul\"): NodeListOf;\r\n querySelectorAll(selectors: \"use\"): NodeListOf;\r\n querySelectorAll(selectors: \"var\"): NodeListOf;\r\n querySelectorAll(selectors: \"video\"): NodeListOf;\r\n querySelectorAll(selectors: \"view\"): NodeListOf;\r\n querySelectorAll(selectors: \"wbr\"): NodeListOf;\r\n querySelectorAll(selectors: \"x-ms-webview\"): NodeListOf;\r\n querySelectorAll(selectors: \"xmp\"): NodeListOf;\r\n querySelectorAll(selectors: string): NodeListOf;\r\n}\r\n\r\ninterface RandomSource {\r\n getRandomValues(array: ArrayBufferView): ArrayBufferView;\r\n}\r\n\r\ninterface SVGAnimatedPathData {\r\n readonly pathSegList: SVGPathSegList;\r\n}\r\n\r\ninterface SVGAnimatedPoints {\r\n readonly animatedPoints: SVGPointList;\r\n readonly points: SVGPointList;\r\n}\r\n\r\ninterface SVGExternalResourcesRequired {\r\n readonly externalResourcesRequired: SVGAnimatedBoolean;\r\n}\r\n\r\ninterface SVGFilterPrimitiveStandardAttributes extends SVGStylable {\r\n readonly height: SVGAnimatedLength;\r\n readonly result: SVGAnimatedString;\r\n readonly width: SVGAnimatedLength;\r\n readonly x: SVGAnimatedLength;\r\n readonly y: SVGAnimatedLength;\r\n}\r\n\r\ninterface SVGFitToViewBox {\r\n readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio;\r\n readonly viewBox: SVGAnimatedRect;\r\n}\r\n\r\ninterface SVGLangSpace {\r\n xmllang: string;\r\n xmlspace: string;\r\n}\r\n\r\ninterface SVGLocatable {\r\n readonly farthestViewportElement: SVGElement;\r\n readonly nearestViewportElement: SVGElement;\r\n getBBox(): SVGRect;\r\n getCTM(): SVGMatrix;\r\n getScreenCTM(): SVGMatrix;\r\n getTransformToElement(element: SVGElement): SVGMatrix;\r\n}\r\n\r\ninterface SVGStylable {\r\n className: any;\r\n readonly style: CSSStyleDeclaration;\r\n}\r\n\r\ninterface SVGTests {\r\n readonly requiredExtensions: SVGStringList;\r\n readonly requiredFeatures: SVGStringList;\r\n readonly systemLanguage: SVGStringList;\r\n hasExtension(extension: string): boolean;\r\n}\r\n\r\ninterface SVGTransformable extends SVGLocatable {\r\n readonly transform: SVGAnimatedTransformList;\r\n}\r\n\r\ninterface SVGURIReference {\r\n readonly href: SVGAnimatedString;\r\n}\r\n\r\ninterface WindowBase64 {\r\n atob(encodedString: string): string;\r\n btoa(rawString: string): string;\r\n}\r\n\r\ninterface WindowConsole {\r\n readonly console: Console;\r\n}\r\n\r\ninterface WindowLocalStorage {\r\n readonly localStorage: Storage;\r\n}\r\n\r\ninterface WindowSessionStorage {\r\n readonly sessionStorage: Storage;\r\n}\r\n\r\ninterface WindowTimers extends Object, WindowTimersExtension {\r\n clearInterval(handle: number): void;\r\n clearTimeout(handle: number): void;\r\n setInterval(handler: (...args: any[]) => void, timeout: number): number;\r\n setInterval(handler: any, timeout?: any, ...args: any[]): number;\r\n setTimeout(handler: (...args: any[]) => void, timeout: number): number;\r\n setTimeout(handler: any, timeout?: any, ...args: any[]): number;\r\n}\r\n\r\ninterface WindowTimersExtension {\r\n clearImmediate(handle: number): void;\r\n setImmediate(handler: (...args: any[]) => void): number;\r\n setImmediate(handler: any, ...args: any[]): number;\r\n}\r\n\r\ninterface XMLHttpRequestEventTarget {\r\n onabort: (this: this, ev: Event) => any;\r\n onerror: (this: this, ev: ErrorEvent) => any;\r\n onload: (this: this, ev: Event) => any;\r\n onloadend: (this: this, ev: ProgressEvent) => any;\r\n onloadstart: (this: this, ev: Event) => any;\r\n onprogress: (this: this, ev: ProgressEvent) => any;\r\n ontimeout: (this: this, ev: ProgressEvent) => any;\r\n addEventListener(type: \"abort\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadend\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"progress\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"timeout\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ninterface StorageEventInit extends EventInit {\r\n key?: string;\r\n oldValue?: string;\r\n newValue?: string;\r\n url: string;\r\n storageArea?: Storage;\r\n}\r\n\r\ninterface Canvas2DContextAttributes {\r\n alpha?: boolean;\r\n willReadFrequently?: boolean;\r\n storage?: boolean;\r\n [attribute: string]: boolean | string | undefined;\r\n}\r\n\r\ninterface NodeListOf extends NodeList {\r\n length: number;\r\n item(index: number): TNode;\r\n [index: number]: TNode;\r\n}\r\n\r\ninterface HTMLCollectionOf extends HTMLCollection {\r\n item(index: number): T;\r\n namedItem(name: string): T;\r\n [index: number]: T;\r\n}\r\n\r\ninterface BlobPropertyBag {\r\n type?: string;\r\n endings?: string;\r\n}\r\n\r\ninterface FilePropertyBag {\r\n type?: string;\r\n lastModified?: number;\r\n}\r\n\r\ninterface EventListenerObject {\r\n handleEvent(evt: Event): void;\r\n}\r\n\r\ninterface MessageEventInit extends EventInit {\r\n data?: any;\r\n origin?: string;\r\n lastEventId?: string;\r\n channel?: string;\r\n source?: any;\r\n ports?: MessagePort[];\r\n}\r\n\r\ninterface ProgressEventInit extends EventInit {\r\n lengthComputable?: boolean;\r\n loaded?: number;\r\n total?: number;\r\n}\r\n\r\ninterface ScrollOptions {\r\n behavior?: ScrollBehavior;\r\n}\r\n\r\ninterface ScrollToOptions extends ScrollOptions {\r\n left?: number;\r\n top?: number;\r\n}\r\n\r\ninterface ScrollIntoViewOptions extends ScrollOptions {\r\n block?: ScrollLogicalPosition;\r\n inline?: ScrollLogicalPosition;\r\n}\r\n\r\ninterface ClipboardEventInit extends EventInit {\r\n data?: string;\r\n dataType?: string;\r\n}\r\n\r\ninterface IDBArrayKey extends Array {\r\n}\r\n\r\ninterface RsaKeyGenParams extends Algorithm {\r\n modulusLength: number;\r\n publicExponent: Uint8Array;\r\n}\r\n\r\ninterface RsaHashedKeyGenParams extends RsaKeyGenParams {\r\n hash: AlgorithmIdentifier;\r\n}\r\n\r\ninterface RsaKeyAlgorithm extends KeyAlgorithm {\r\n modulusLength: number;\r\n publicExponent: Uint8Array;\r\n}\r\n\r\ninterface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm {\r\n hash: AlgorithmIdentifier;\r\n}\r\n\r\ninterface RsaHashedImportParams {\r\n hash: AlgorithmIdentifier;\r\n}\r\n\r\ninterface RsaPssParams {\r\n saltLength: number;\r\n}\r\n\r\ninterface RsaOaepParams extends Algorithm {\r\n label?: BufferSource;\r\n}\r\n\r\ninterface EcdsaParams extends Algorithm {\r\n hash: AlgorithmIdentifier;\r\n}\r\n\r\ninterface EcKeyGenParams extends Algorithm {\r\n namedCurve: string;\r\n}\r\n\r\ninterface EcKeyAlgorithm extends KeyAlgorithm {\r\n typedCurve: string;\r\n}\r\n\r\ninterface EcKeyImportParams {\r\n namedCurve: string;\r\n}\r\n\r\ninterface EcdhKeyDeriveParams extends Algorithm {\r\n public: CryptoKey;\r\n}\r\n\r\ninterface AesCtrParams extends Algorithm {\r\n counter: BufferSource;\r\n length: number;\r\n}\r\n\r\ninterface AesKeyAlgorithm extends KeyAlgorithm {\r\n length: number;\r\n}\r\n\r\ninterface AesKeyGenParams extends Algorithm {\r\n length: number;\r\n}\r\n\r\ninterface AesDerivedKeyParams extends Algorithm {\r\n length: number;\r\n}\r\n\r\ninterface AesCbcParams extends Algorithm {\r\n iv: BufferSource;\r\n}\r\n\r\ninterface AesCmacParams extends Algorithm {\r\n length: number;\r\n}\r\n\r\ninterface AesGcmParams extends Algorithm {\r\n iv: BufferSource;\r\n additionalData?: BufferSource;\r\n tagLength?: number;\r\n}\r\n\r\ninterface AesCfbParams extends Algorithm {\r\n iv: BufferSource;\r\n}\r\n\r\ninterface HmacImportParams extends Algorithm {\r\n hash?: AlgorithmIdentifier;\r\n length?: number;\r\n}\r\n\r\ninterface HmacKeyAlgorithm extends KeyAlgorithm {\r\n hash: AlgorithmIdentifier;\r\n length: number;\r\n}\r\n\r\ninterface HmacKeyGenParams extends Algorithm {\r\n hash: AlgorithmIdentifier;\r\n length?: number;\r\n}\r\n\r\ninterface DhKeyGenParams extends Algorithm {\r\n prime: Uint8Array;\r\n generator: Uint8Array;\r\n}\r\n\r\ninterface DhKeyAlgorithm extends KeyAlgorithm {\r\n prime: Uint8Array;\r\n generator: Uint8Array;\r\n}\r\n\r\ninterface DhKeyDeriveParams extends Algorithm {\r\n public: CryptoKey;\r\n}\r\n\r\ninterface DhImportKeyParams extends Algorithm {\r\n prime: Uint8Array;\r\n generator: Uint8Array;\r\n}\r\n\r\ninterface ConcatParams extends Algorithm {\r\n hash?: AlgorithmIdentifier;\r\n algorithmId: Uint8Array;\r\n partyUInfo: Uint8Array;\r\n partyVInfo: Uint8Array;\r\n publicInfo?: Uint8Array;\r\n privateInfo?: Uint8Array;\r\n}\r\n\r\ninterface HkdfCtrParams extends Algorithm {\r\n hash: AlgorithmIdentifier;\r\n label: BufferSource;\r\n context: BufferSource;\r\n}\r\n\r\ninterface Pbkdf2Params extends Algorithm {\r\n salt: BufferSource;\r\n iterations: number;\r\n hash: AlgorithmIdentifier;\r\n}\r\n\r\ninterface RsaOtherPrimesInfo {\r\n r: string;\r\n d: string;\r\n t: string;\r\n}\r\n\r\ninterface JsonWebKey {\r\n kty: string;\r\n use?: string;\r\n key_ops?: string[];\r\n alg?: string;\r\n kid?: string;\r\n x5u?: string;\r\n x5c?: string;\r\n x5t?: string;\r\n ext?: boolean;\r\n crv?: string;\r\n x?: string;\r\n y?: string;\r\n d?: string;\r\n n?: string;\r\n e?: string;\r\n p?: string;\r\n q?: string;\r\n dp?: string;\r\n dq?: string;\r\n qi?: string;\r\n oth?: RsaOtherPrimesInfo[];\r\n k?: string;\r\n}\r\n\r\ninterface ParentNode {\r\n readonly children: HTMLCollection;\r\n readonly firstElementChild: Element;\r\n readonly lastElementChild: Element;\r\n readonly childElementCount: number;\r\n}\r\n\r\ndeclare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;\r\n\r\ninterface ErrorEventHandler {\r\n (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void;\r\n}\r\ninterface PositionCallback {\r\n (position: Position): void;\r\n}\r\ninterface PositionErrorCallback {\r\n (error: PositionError): void;\r\n}\r\ninterface MediaQueryListListener {\r\n (mql: MediaQueryList): void;\r\n}\r\ninterface MSLaunchUriCallback {\r\n (): void;\r\n}\r\ninterface FrameRequestCallback {\r\n (time: number): void;\r\n}\r\ninterface MSUnsafeFunctionCallback {\r\n (): any;\r\n}\r\ninterface MSExecAtPriorityFunctionCallback {\r\n (...args: any[]): any;\r\n}\r\ninterface MutationCallback {\r\n (mutations: MutationRecord[], observer: MutationObserver): void;\r\n}\r\ninterface DecodeSuccessCallback {\r\n (decodedData: AudioBuffer): void;\r\n}\r\ninterface DecodeErrorCallback {\r\n (error: DOMException): void;\r\n}\r\ninterface FunctionStringCallback {\r\n (data: string): void;\r\n}\r\ninterface NavigatorUserMediaSuccessCallback {\r\n (stream: MediaStream): void;\r\n}\r\ninterface NavigatorUserMediaErrorCallback {\r\n (error: MediaStreamError): void;\r\n}\r\ninterface ForEachCallback {\r\n (keyId: any, status: string): void;\r\n}\r\ndeclare var Audio: {new(src?: string): HTMLAudioElement; };\r\ndeclare var Image: {new(width?: number, height?: number): HTMLImageElement; };\r\ndeclare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; };\r\ndeclare var applicationCache: ApplicationCache;\r\ndeclare var clientInformation: Navigator;\r\ndeclare var closed: boolean;\r\ndeclare var crypto: Crypto;\r\ndeclare var defaultStatus: string;\r\ndeclare var devicePixelRatio: number;\r\ndeclare var doNotTrack: string;\r\ndeclare var document: Document;\r\ndeclare var event: Event;\r\ndeclare var external: External;\r\ndeclare var frameElement: Element;\r\ndeclare var frames: Window;\r\ndeclare var history: History;\r\ndeclare var innerHeight: number;\r\ndeclare var innerWidth: number;\r\ndeclare var length: number;\r\ndeclare var location: Location;\r\ndeclare var locationbar: BarProp;\r\ndeclare var menubar: BarProp;\r\ndeclare var msCredentials: MSCredentials;\r\ndeclare const name: never;\r\ndeclare var navigator: Navigator;\r\ndeclare var offscreenBuffering: string | boolean;\r\ndeclare var onabort: (this: Window, ev: UIEvent) => any;\r\ndeclare var onafterprint: (this: Window, ev: Event) => any;\r\ndeclare var onbeforeprint: (this: Window, ev: Event) => any;\r\ndeclare var onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any;\r\ndeclare var onblur: (this: Window, ev: FocusEvent) => any;\r\ndeclare var oncanplay: (this: Window, ev: Event) => any;\r\ndeclare var oncanplaythrough: (this: Window, ev: Event) => any;\r\ndeclare var onchange: (this: Window, ev: Event) => any;\r\ndeclare var onclick: (this: Window, ev: MouseEvent) => any;\r\ndeclare var oncompassneedscalibration: (this: Window, ev: Event) => any;\r\ndeclare var oncontextmenu: (this: Window, ev: PointerEvent) => any;\r\ndeclare var ondblclick: (this: Window, ev: MouseEvent) => any;\r\ndeclare var ondevicelight: (this: Window, ev: DeviceLightEvent) => any;\r\ndeclare var ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any;\r\ndeclare var ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any;\r\ndeclare var ondrag: (this: Window, ev: DragEvent) => any;\r\ndeclare var ondragend: (this: Window, ev: DragEvent) => any;\r\ndeclare var ondragenter: (this: Window, ev: DragEvent) => any;\r\ndeclare var ondragleave: (this: Window, ev: DragEvent) => any;\r\ndeclare var ondragover: (this: Window, ev: DragEvent) => any;\r\ndeclare var ondragstart: (this: Window, ev: DragEvent) => any;\r\ndeclare var ondrop: (this: Window, ev: DragEvent) => any;\r\ndeclare var ondurationchange: (this: Window, ev: Event) => any;\r\ndeclare var onemptied: (this: Window, ev: Event) => any;\r\ndeclare var onended: (this: Window, ev: MediaStreamErrorEvent) => any;\r\ndeclare var onerror: ErrorEventHandler;\r\ndeclare var onfocus: (this: Window, ev: FocusEvent) => any;\r\ndeclare var onhashchange: (this: Window, ev: HashChangeEvent) => any;\r\ndeclare var oninput: (this: Window, ev: Event) => any;\r\ndeclare var oninvalid: (this: Window, ev: Event) => any;\r\ndeclare var onkeydown: (this: Window, ev: KeyboardEvent) => any;\r\ndeclare var onkeypress: (this: Window, ev: KeyboardEvent) => any;\r\ndeclare var onkeyup: (this: Window, ev: KeyboardEvent) => any;\r\ndeclare var onload: (this: Window, ev: Event) => any;\r\ndeclare var onloadeddata: (this: Window, ev: Event) => any;\r\ndeclare var onloadedmetadata: (this: Window, ev: Event) => any;\r\ndeclare var onloadstart: (this: Window, ev: Event) => any;\r\ndeclare var onmessage: (this: Window, ev: MessageEvent) => any;\r\ndeclare var onmousedown: (this: Window, ev: MouseEvent) => any;\r\ndeclare var onmouseenter: (this: Window, ev: MouseEvent) => any;\r\ndeclare var onmouseleave: (this: Window, ev: MouseEvent) => any;\r\ndeclare var onmousemove: (this: Window, ev: MouseEvent) => any;\r\ndeclare var onmouseout: (this: Window, ev: MouseEvent) => any;\r\ndeclare var onmouseover: (this: Window, ev: MouseEvent) => any;\r\ndeclare var onmouseup: (this: Window, ev: MouseEvent) => any;\r\ndeclare var onmousewheel: (this: Window, ev: WheelEvent) => any;\r\ndeclare var onmsgesturechange: (this: Window, ev: MSGestureEvent) => any;\r\ndeclare var onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any;\r\ndeclare var onmsgestureend: (this: Window, ev: MSGestureEvent) => any;\r\ndeclare var onmsgesturehold: (this: Window, ev: MSGestureEvent) => any;\r\ndeclare var onmsgesturestart: (this: Window, ev: MSGestureEvent) => any;\r\ndeclare var onmsgesturetap: (this: Window, ev: MSGestureEvent) => any;\r\ndeclare var onmsinertiastart: (this: Window, ev: MSGestureEvent) => any;\r\ndeclare var onmspointercancel: (this: Window, ev: MSPointerEvent) => any;\r\ndeclare var onmspointerdown: (this: Window, ev: MSPointerEvent) => any;\r\ndeclare var onmspointerenter: (this: Window, ev: MSPointerEvent) => any;\r\ndeclare var onmspointerleave: (this: Window, ev: MSPointerEvent) => any;\r\ndeclare var onmspointermove: (this: Window, ev: MSPointerEvent) => any;\r\ndeclare var onmspointerout: (this: Window, ev: MSPointerEvent) => any;\r\ndeclare var onmspointerover: (this: Window, ev: MSPointerEvent) => any;\r\ndeclare var onmspointerup: (this: Window, ev: MSPointerEvent) => any;\r\ndeclare var onoffline: (this: Window, ev: Event) => any;\r\ndeclare var ononline: (this: Window, ev: Event) => any;\r\ndeclare var onorientationchange: (this: Window, ev: Event) => any;\r\ndeclare var onpagehide: (this: Window, ev: PageTransitionEvent) => any;\r\ndeclare var onpageshow: (this: Window, ev: PageTransitionEvent) => any;\r\ndeclare var onpause: (this: Window, ev: Event) => any;\r\ndeclare var onplay: (this: Window, ev: Event) => any;\r\ndeclare var onplaying: (this: Window, ev: Event) => any;\r\ndeclare var onpopstate: (this: Window, ev: PopStateEvent) => any;\r\ndeclare var onprogress: (this: Window, ev: ProgressEvent) => any;\r\ndeclare var onratechange: (this: Window, ev: Event) => any;\r\ndeclare var onreadystatechange: (this: Window, ev: ProgressEvent) => any;\r\ndeclare var onreset: (this: Window, ev: Event) => any;\r\ndeclare var onresize: (this: Window, ev: UIEvent) => any;\r\ndeclare var onscroll: (this: Window, ev: UIEvent) => any;\r\ndeclare var onseeked: (this: Window, ev: Event) => any;\r\ndeclare var onseeking: (this: Window, ev: Event) => any;\r\ndeclare var onselect: (this: Window, ev: UIEvent) => any;\r\ndeclare var onstalled: (this: Window, ev: Event) => any;\r\ndeclare var onstorage: (this: Window, ev: StorageEvent) => any;\r\ndeclare var onsubmit: (this: Window, ev: Event) => any;\r\ndeclare var onsuspend: (this: Window, ev: Event) => any;\r\ndeclare var ontimeupdate: (this: Window, ev: Event) => any;\r\ndeclare var ontouchcancel: (ev: TouchEvent) => any;\r\ndeclare var ontouchend: (ev: TouchEvent) => any;\r\ndeclare var ontouchmove: (ev: TouchEvent) => any;\r\ndeclare var ontouchstart: (ev: TouchEvent) => any;\r\ndeclare var onunload: (this: Window, ev: Event) => any;\r\ndeclare var onvolumechange: (this: Window, ev: Event) => any;\r\ndeclare var onwaiting: (this: Window, ev: Event) => any;\r\ndeclare var opener: any;\r\ndeclare var orientation: string | number;\r\ndeclare var outerHeight: number;\r\ndeclare var outerWidth: number;\r\ndeclare var pageXOffset: number;\r\ndeclare var pageYOffset: number;\r\ndeclare var parent: Window;\r\ndeclare var performance: Performance;\r\ndeclare var personalbar: BarProp;\r\ndeclare var screen: Screen;\r\ndeclare var screenLeft: number;\r\ndeclare var screenTop: number;\r\ndeclare var screenX: number;\r\ndeclare var screenY: number;\r\ndeclare var scrollX: number;\r\ndeclare var scrollY: number;\r\ndeclare var scrollbars: BarProp;\r\ndeclare var self: Window;\r\ndeclare var status: string;\r\ndeclare var statusbar: BarProp;\r\ndeclare var styleMedia: StyleMedia;\r\ndeclare var toolbar: BarProp;\r\ndeclare var top: Window;\r\ndeclare var window: Window;\r\ndeclare function alert(message?: any): void;\r\ndeclare function blur(): void;\r\ndeclare function cancelAnimationFrame(handle: number): void;\r\ndeclare function captureEvents(): void;\r\ndeclare function close(): void;\r\ndeclare function confirm(message?: string): boolean;\r\ndeclare function focus(): void;\r\ndeclare function getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration;\r\ndeclare function getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList;\r\ndeclare function getSelection(): Selection;\r\ndeclare function matchMedia(mediaQuery: string): MediaQueryList;\r\ndeclare function moveBy(x?: number, y?: number): void;\r\ndeclare function moveTo(x?: number, y?: number): void;\r\ndeclare function msWriteProfilerMark(profilerMarkName: string): void;\r\ndeclare function open(url?: string, target?: string, features?: string, replace?: boolean): Window;\r\ndeclare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void;\r\ndeclare function print(): void;\r\ndeclare function prompt(message?: string, _default?: string): string | null;\r\ndeclare function releaseEvents(): void;\r\ndeclare function requestAnimationFrame(callback: FrameRequestCallback): number;\r\ndeclare function resizeBy(x?: number, y?: number): void;\r\ndeclare function resizeTo(x?: number, y?: number): void;\r\ndeclare function scroll(x?: number, y?: number): void;\r\ndeclare function scrollBy(x?: number, y?: number): void;\r\ndeclare function scrollTo(x?: number, y?: number): void;\r\ndeclare function webkitCancelAnimationFrame(handle: number): void;\r\ndeclare function webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint;\r\ndeclare function webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint;\r\ndeclare function webkitRequestAnimationFrame(callback: FrameRequestCallback): number;\r\ndeclare function scroll(options?: ScrollToOptions): void;\r\ndeclare function scrollTo(options?: ScrollToOptions): void;\r\ndeclare function scrollBy(options?: ScrollToOptions): void;\r\ndeclare function toString(): string;\r\ndeclare function addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\ndeclare function dispatchEvent(evt: Event): boolean;\r\ndeclare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\ndeclare function clearInterval(handle: number): void;\r\ndeclare function clearTimeout(handle: number): void;\r\ndeclare function setInterval(handler: (...args: any[]) => void, timeout: number): number;\r\ndeclare function setInterval(handler: any, timeout?: any, ...args: any[]): number;\r\ndeclare function setTimeout(handler: (...args: any[]) => void, timeout: number): number;\r\ndeclare function setTimeout(handler: any, timeout?: any, ...args: any[]): number;\r\ndeclare function clearImmediate(handle: number): void;\r\ndeclare function setImmediate(handler: (...args: any[]) => void): number;\r\ndeclare function setImmediate(handler: any, ...args: any[]): number;\r\ndeclare var sessionStorage: Storage;\r\ndeclare var localStorage: Storage;\r\ndeclare var console: Console;\r\ndeclare var onpointercancel: (this: Window, ev: PointerEvent) => any;\r\ndeclare var onpointerdown: (this: Window, ev: PointerEvent) => any;\r\ndeclare var onpointerenter: (this: Window, ev: PointerEvent) => any;\r\ndeclare var onpointerleave: (this: Window, ev: PointerEvent) => any;\r\ndeclare var onpointermove: (this: Window, ev: PointerEvent) => any;\r\ndeclare var onpointerout: (this: Window, ev: PointerEvent) => any;\r\ndeclare var onpointerover: (this: Window, ev: PointerEvent) => any;\r\ndeclare var onpointerup: (this: Window, ev: PointerEvent) => any;\r\ndeclare var onwheel: (this: Window, ev: WheelEvent) => any;\r\ndeclare var indexedDB: IDBFactory;\r\ndeclare function atob(encodedString: string): string;\r\ndeclare function btoa(rawString: string): string;\r\ndeclare function addEventListener(type: \"MSGestureChange\", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"MSGestureDoubleTap\", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"MSGestureEnd\", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"MSGestureHold\", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"MSGestureStart\", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"MSGestureTap\", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"MSInertiaStart\", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"MSPointerCancel\", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"MSPointerDown\", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"MSPointerEnter\", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"MSPointerLeave\", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"MSPointerMove\", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"MSPointerOut\", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"MSPointerOver\", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"MSPointerUp\", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"abort\", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"afterprint\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"beforeprint\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"beforeunload\", listener: (this: Window, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"blur\", listener: (this: Window, ev: FocusEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"canplay\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"canplaythrough\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"change\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"click\", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"compassneedscalibration\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"contextmenu\", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"dblclick\", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"devicelight\", listener: (this: Window, ev: DeviceLightEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"devicemotion\", listener: (this: Window, ev: DeviceMotionEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"deviceorientation\", listener: (this: Window, ev: DeviceOrientationEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"drag\", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"dragend\", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"dragenter\", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"dragleave\", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"dragover\", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"dragstart\", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"drop\", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"durationchange\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"emptied\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"ended\", listener: (this: Window, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"focus\", listener: (this: Window, ev: FocusEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"hashchange\", listener: (this: Window, ev: HashChangeEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"input\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"invalid\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"keydown\", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"keypress\", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"keyup\", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"load\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"loadeddata\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"loadedmetadata\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"loadstart\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"message\", listener: (this: Window, ev: MessageEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"mousedown\", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"mouseenter\", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"mouseleave\", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"mousemove\", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"mouseout\", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"mouseover\", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"mouseup\", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"mousewheel\", listener: (this: Window, ev: WheelEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"offline\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"online\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"orientationchange\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"pagehide\", listener: (this: Window, ev: PageTransitionEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"pageshow\", listener: (this: Window, ev: PageTransitionEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"pause\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"play\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"playing\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"pointercancel\", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"pointerdown\", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"pointerenter\", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"pointerleave\", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"pointermove\", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"pointerout\", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"pointerover\", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"pointerup\", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"popstate\", listener: (this: Window, ev: PopStateEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"progress\", listener: (this: Window, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"ratechange\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"readystatechange\", listener: (this: Window, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"reset\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"resize\", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"scroll\", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"seeked\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"seeking\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"select\", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"stalled\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"storage\", listener: (this: Window, ev: StorageEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"submit\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"suspend\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"timeupdate\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"unload\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"volumechange\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"waiting\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"wheel\", listener: (this: Window, ev: WheelEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\ntype AAGUID = string;\r\ntype AlgorithmIdentifier = string | Algorithm;\r\ntype ConstrainBoolean = boolean | ConstrainBooleanParameters;\r\ntype ConstrainDOMString = string | string[] | ConstrainDOMStringParameters;\r\ntype ConstrainDouble = number | ConstrainDoubleRange;\r\ntype ConstrainLong = number | ConstrainLongRange;\r\ntype CryptoOperationData = ArrayBufferView;\r\ntype GLbitfield = number;\r\ntype GLboolean = boolean;\r\ntype GLbyte = number;\r\ntype GLclampf = number;\r\ntype GLenum = number;\r\ntype GLfloat = number;\r\ntype GLint = number;\r\ntype GLintptr = number;\r\ntype GLshort = number;\r\ntype GLsizei = number;\r\ntype GLsizeiptr = number;\r\ntype GLubyte = number;\r\ntype GLuint = number;\r\ntype GLushort = number;\r\ntype IDBKeyPath = string;\r\ntype KeyFormat = string;\r\ntype KeyType = string;\r\ntype KeyUsage = string;\r\ntype MSInboundPayload = MSVideoRecvPayload | MSAudioRecvPayload;\r\ntype MSLocalClientEvent = MSLocalClientEventBase | MSAudioLocalClientEvent;\r\ntype MSOutboundPayload = MSVideoSendPayload | MSAudioSendPayload;\r\ntype RTCIceGatherCandidate = RTCIceCandidate | RTCIceCandidateComplete;\r\ntype RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport;\r\ntype payloadtype = number;\r\ntype ScrollBehavior = \"auto\" | \"instant\" | \"smooth\";\r\ntype ScrollLogicalPosition = \"start\" | \"center\" | \"end\" | \"nearest\";\r\ntype IDBValidKey = number | string | Date | IDBArrayKey;\r\ntype BufferSource = ArrayBuffer | ArrayBufferView;\r\ntype MouseWheelEvent = WheelEvent;\r\n/////////////////////////////\r\n/// WorkerGlobalScope APIs \r\n/////////////////////////////\r\n// These are only available in a Web Worker \r\ndeclare function importScripts(...urls: string[]): void;\r\n\r\n\r\n/////////////////////////////\r\n/// Windows Script Host APIS\r\n/////////////////////////////\r\n\r\n\r\ninterface ActiveXObject {\r\n new (s: string): any;\r\n}\r\ndeclare var ActiveXObject: ActiveXObject;\r\n\r\ninterface ITextWriter {\r\n Write(s: string): void;\r\n WriteLine(s: string): void;\r\n Close(): void;\r\n}\r\n\r\ninterface TextStreamBase {\r\n /**\r\n * The column number of the current character position in an input stream.\r\n */\r\n Column: number;\r\n\r\n /**\r\n * The current line number in an input stream.\r\n */\r\n Line: number;\r\n\r\n /**\r\n * Closes a text stream.\r\n * It is not necessary to close standard streams; they close automatically when the process ends. If \r\n * you close a standard stream, be aware that any other pointers to that standard stream become invalid.\r\n */\r\n Close(): void;\r\n}\r\n\r\ninterface TextStreamWriter extends TextStreamBase {\r\n /**\r\n * Sends a string to an output stream.\r\n */\r\n Write(s: string): void;\r\n\r\n /**\r\n * Sends a specified number of blank lines (newline characters) to an output stream.\r\n */\r\n WriteBlankLines(intLines: number): void;\r\n\r\n /**\r\n * Sends a string followed by a newline character to an output stream.\r\n */\r\n WriteLine(s: string): void;\r\n}\r\n\r\ninterface TextStreamReader extends TextStreamBase {\r\n /**\r\n * Returns a specified number of characters from an input stream, starting at the current pointer position.\r\n * Does not return until the ENTER key is pressed.\r\n * Can only be used on a stream in reading mode; causes an error in writing or appending mode.\r\n */\r\n Read(characters: number): string;\r\n\r\n /**\r\n * Returns all characters from an input stream.\r\n * Can only be used on a stream in reading mode; causes an error in writing or appending mode.\r\n */\r\n ReadAll(): string;\r\n\r\n /**\r\n * Returns an entire line from an input stream.\r\n * Although this method extracts the newline character, it does not add it to the returned string.\r\n * Can only be used on a stream in reading mode; causes an error in writing or appending mode.\r\n */\r\n ReadLine(): string;\r\n\r\n /**\r\n * Skips a specified number of characters when reading from an input text stream.\r\n * Can only be used on a stream in reading mode; causes an error in writing or appending mode.\r\n * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.)\r\n */\r\n Skip(characters: number): void;\r\n\r\n /**\r\n * Skips the next line when reading from an input text stream.\r\n * Can only be used on a stream in reading mode, not writing or appending mode.\r\n */\r\n SkipLine(): void;\r\n\r\n /**\r\n * Indicates whether the stream pointer position is at the end of a line.\r\n */\r\n AtEndOfLine: boolean;\r\n\r\n /**\r\n * Indicates whether the stream pointer position is at the end of a stream.\r\n */\r\n AtEndOfStream: boolean;\r\n}\r\n\r\ndeclare var WScript: {\r\n /**\r\n * Outputs text to either a message box (under WScript.exe) or the command console window followed by\r\n * a newline (under CScript.exe).\r\n */\r\n Echo(s: any): void;\r\n\r\n /**\r\n * Exposes the write-only error output stream for the current script.\r\n * Can be accessed only while using CScript.exe.\r\n */\r\n StdErr: TextStreamWriter;\r\n\r\n /**\r\n * Exposes the write-only output stream for the current script.\r\n * Can be accessed only while using CScript.exe.\r\n */\r\n StdOut: TextStreamWriter;\r\n Arguments: { length: number; Item(n: number): string; };\r\n\r\n /**\r\n * The full path of the currently running script.\r\n */\r\n ScriptFullName: string;\r\n\r\n /**\r\n * Forces the script to stop immediately, with an optional exit code.\r\n */\r\n Quit(exitCode?: number): number;\r\n\r\n /**\r\n * The Windows Script Host build version number.\r\n */\r\n BuildVersion: number;\r\n\r\n /**\r\n * Fully qualified path of the host executable.\r\n */\r\n FullName: string;\r\n\r\n /**\r\n * Gets/sets the script mode - interactive(true) or batch(false).\r\n */\r\n Interactive: boolean;\r\n\r\n /**\r\n * The name of the host executable (WScript.exe or CScript.exe).\r\n */\r\n Name: string;\r\n\r\n /**\r\n * Path of the directory containing the host executable.\r\n */\r\n Path: string;\r\n\r\n /**\r\n * The filename of the currently running script.\r\n */\r\n ScriptName: string;\r\n\r\n /**\r\n * Exposes the read-only input stream for the current script.\r\n * Can be accessed only while using CScript.exe.\r\n */\r\n StdIn: TextStreamReader;\r\n\r\n /**\r\n * Windows Script Host version\r\n */\r\n Version: string;\r\n\r\n /**\r\n * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event.\r\n */\r\n ConnectObject(objEventSource: any, strPrefix: string): void;\r\n\r\n /**\r\n * Creates a COM object.\r\n * @param strProgiID\r\n * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.\r\n */\r\n CreateObject(strProgID: string, strPrefix?: string): any;\r\n\r\n /**\r\n * Disconnects a COM object from its event sources.\r\n */\r\n DisconnectObject(obj: any): void;\r\n\r\n /**\r\n * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file.\r\n * @param strPathname Fully qualified path to the file containing the object persisted to disk.\r\n * For objects in memory, pass a zero-length string.\r\n * @param strProgID\r\n * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.\r\n */\r\n GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any;\r\n\r\n /**\r\n * Suspends script execution for a specified length of time, then continues execution.\r\n * @param intTime Interval (in milliseconds) to suspend script execution.\r\n */\r\n Sleep(intTime: number): void;\r\n};\r\n\r\n/**\r\n * Allows enumerating over a COM collection, which may not have indexed item access.\r\n */\r\ninterface Enumerator {\r\n /**\r\n * Returns true if the current item is the last one in the collection, or the collection is empty,\r\n * or the current item is undefined.\r\n */\r\n atEnd(): boolean;\r\n\r\n /**\r\n * Returns the current item in the collection\r\n */\r\n item(): T;\r\n\r\n /**\r\n * Resets the current item in the collection to the first item. If there are no items in the collection,\r\n * the current item is set to undefined.\r\n */\r\n moveFirst(): void;\r\n\r\n /**\r\n * Moves the current item to the next item in the collection. If the enumerator is at the end of\r\n * the collection or the collection is empty, the current item is set to undefined.\r\n */\r\n moveNext(): void;\r\n}\r\n\r\ninterface EnumeratorConstructor {\r\n new (collection: any): Enumerator;\r\n new (collection: any): Enumerator;\r\n}\r\n\r\ndeclare var Enumerator: EnumeratorConstructor;\r\n\r\n/**\r\n * Enables reading from a COM safe array, which might have an alternate lower bound, or multiple dimensions.\r\n */\r\ninterface VBArray {\r\n /**\r\n * Returns the number of dimensions (1-based).\r\n */\r\n dimensions(): number;\r\n\r\n /**\r\n * Takes an index for each dimension in the array, and returns the item at the corresponding location.\r\n */\r\n getItem(dimension1Index: number, ...dimensionNIndexes: number[]): T;\r\n\r\n /**\r\n * Returns the smallest available index for a given dimension.\r\n * @param dimension 1-based dimension (defaults to 1)\r\n */\r\n lbound(dimension?: number): number;\r\n\r\n /**\r\n * Returns the largest available index for a given dimension.\r\n * @param dimension 1-based dimension (defaults to 1)\r\n */\r\n ubound(dimension?: number): number;\r\n\r\n /**\r\n * Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions,\r\n * each successive dimension is appended to the end of the array.\r\n * Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6]\r\n */\r\n toArray(): T[];\r\n}\r\n\r\ninterface VBArrayConstructor {\r\n new (safeArray: any): VBArray;\r\n new (safeArray: any): VBArray;\r\n}\r\n\r\ndeclare var VBArray: VBArrayConstructor;\r\n\r\n/**\r\n * Automation date (VT_DATE)\r\n */\r\ninterface VarDate { }\r\n\r\ninterface DateConstructor {\r\n new (vd: VarDate): Date;\r\n}\r\n\r\ninterface Date {\r\n getVarDate: () => VarDate;\r\n}\r\n/// \r\n\r\ninterface DOMTokenList {\r\n [Symbol.iterator](): IterableIterator;\r\n}\r\n\r\ninterface NodeList {\r\n [Symbol.iterator](): IterableIterator\r\n}\r\n\r\ninterface NodeListOf {\r\n [Symbol.iterator](): IterableIterator\r\n}\r\n"}; }); +define([], function() { return { contents: "/*! *****************************************************************************\nCopyright (c) Microsoft Corporation. All rights reserved. \nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\nthis file except in compliance with the License. You may obtain a copy of the\nLicense at http://www.apache.org/licenses/LICENSE-2.0 \n \nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, \nMERCHANTABLITY OR NON-INFRINGEMENT. \n \nSee the Apache Version 2.0 License for specific language governing permissions\nand limitations under the License.\n***************************************************************************** */\n\n\n\n/// \n\n\n/////////////////////////////\n/// ECMAScript APIs\n/////////////////////////////\n\ndeclare const NaN: number;\ndeclare const Infinity: number;\n\n/**\n * Evaluates JavaScript code and executes it.\n * @param x A String value that contains valid JavaScript code.\n */\ndeclare function eval(x: string): any;\n\n/**\n * Converts A string to an integer.\n * @param s A string to convert into a number.\n * @param radix A value between 2 and 36 that specifies the base of the number in numString.\n * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\n * All other strings are considered decimal.\n */\ndeclare function parseInt(s: string, radix?: number): number;\n\n/**\n * Converts a string to a floating-point number.\n * @param string A string that contains a floating-point number.\n */\ndeclare function parseFloat(string: string): number;\n\n/**\n * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number).\n * @param number A numeric value.\n */\ndeclare function isNaN(number: number): boolean;\n\n/**\n * Determines whether a supplied number is finite.\n * @param number Any numeric value.\n */\ndeclare function isFinite(number: number): boolean;\n\n/**\n * Gets the unencoded version of an encoded Uniform Resource Identifier (URI).\n * @param encodedURI A value representing an encoded URI.\n */\ndeclare function decodeURI(encodedURI: string): string;\n\n/**\n * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI).\n * @param encodedURIComponent A value representing an encoded URI component.\n */\ndeclare function decodeURIComponent(encodedURIComponent: string): string;\n\n/**\n * Encodes a text string as a valid Uniform Resource Identifier (URI)\n * @param uri A value representing an encoded URI.\n */\ndeclare function encodeURI(uri: string): string;\n\n/**\n * Encodes a text string as a valid component of a Uniform Resource Identifier (URI).\n * @param uriComponent A value representing an encoded URI component.\n */\ndeclare function encodeURIComponent(uriComponent: string): string;\n\ninterface PropertyDescriptor {\n configurable?: boolean;\n enumerable?: boolean;\n value?: any;\n writable?: boolean;\n get? (): any;\n set? (v: any): void;\n}\n\ninterface PropertyDescriptorMap {\n [s: string]: PropertyDescriptor;\n}\n\ninterface Object {\n /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */\n constructor: Function;\n\n /** Returns a string representation of an object. */\n toString(): string;\n\n /** Returns a date converted to a string using the current locale. */\n toLocaleString(): string;\n\n /** Returns the primitive value of the specified object. */\n valueOf(): Object;\n\n /**\n * Determines whether an object has a property with the specified name.\n * @param v A property name.\n */\n hasOwnProperty(v: string): boolean;\n\n /**\n * Determines whether an object exists in another object's prototype chain.\n * @param v Another object whose prototype chain is to be checked.\n */\n isPrototypeOf(v: Object): boolean;\n\n /**\n * Determines whether a specified property is enumerable.\n * @param v A property name.\n */\n propertyIsEnumerable(v: string): boolean;\n}\n\ninterface ObjectConstructor {\n new (value?: any): Object;\n (): any;\n (value: any): any;\n\n /** A reference to the prototype for a class of objects. */\n readonly prototype: Object;\n\n /**\n * Returns the prototype of an object.\n * @param o The object that references the prototype.\n */\n getPrototypeOf(o: any): any;\n\n /**\n * Gets the own property descriptor of the specified object.\n * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype.\n * @param o Object that contains the property.\n * @param p Name of the property.\n */\n getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor;\n\n /**\n * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly\n * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions.\n * @param o Object that contains the own properties.\n */\n getOwnPropertyNames(o: any): string[];\n\n /**\n * Creates an object that has null prototype.\n * @param o Object to use as a prototype. May be null\n */\n create(o: null): any;\n\n /**\n * Creates an object that has the specified prototype, and that optionally contains specified properties.\n * @param o Object to use as a prototype. May be null\n */\n create(o: T): T;\n\n /**\n * Creates an object that has the specified prototype, and that optionally contains specified properties.\n * @param o Object to use as a prototype. May be null\n * @param properties JavaScript object that contains one or more property descriptors.\n */\n create(o: any, properties: PropertyDescriptorMap): any;\n\n /**\n * Adds a property to an object, or modifies attributes of an existing property.\n * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object.\n * @param p The property name.\n * @param attributes Descriptor for the property. It can be for a data property or an accessor property.\n */\n defineProperty(o: any, p: string, attributes: PropertyDescriptor): any;\n\n /**\n * Adds one or more properties to an object, and/or modifies attributes of existing properties.\n * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object.\n * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property.\n */\n defineProperties(o: any, properties: PropertyDescriptorMap): any;\n\n /**\n * Prevents the modification of attributes of existing properties, and prevents the addition of new properties.\n * @param o Object on which to lock the attributes.\n */\n seal(o: T): T;\n\n /**\n * Prevents the modification of existing property attributes and values, and prevents the addition of new properties.\n * @param o Object on which to lock the attributes.\n */\n freeze(a: T[]): ReadonlyArray;\n\n /**\n * Prevents the modification of existing property attributes and values, and prevents the addition of new properties.\n * @param o Object on which to lock the attributes.\n */\n freeze(f: T): T;\n\n /**\n * Prevents the modification of existing property attributes and values, and prevents the addition of new properties.\n * @param o Object on which to lock the attributes.\n */\n freeze(o: T): Readonly;\n\n /**\n * Prevents the addition of new properties to an object.\n * @param o Object to make non-extensible.\n */\n preventExtensions(o: T): T;\n\n /**\n * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object.\n * @param o Object to test.\n */\n isSealed(o: any): boolean;\n\n /**\n * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object.\n * @param o Object to test.\n */\n isFrozen(o: any): boolean;\n\n /**\n * Returns a value that indicates whether new properties can be added to an object.\n * @param o Object to test.\n */\n isExtensible(o: any): boolean;\n\n /**\n * Returns the names of the enumerable properties and methods of an object.\n * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.\n */\n keys(o: any): string[];\n}\n\n/**\n * Provides functionality common to all JavaScript objects.\n */\ndeclare const Object: ObjectConstructor;\n\n/**\n * Creates a new function.\n */\ninterface Function {\n /**\n * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function.\n * @param thisArg The object to be used as the this object.\n * @param argArray A set of arguments to be passed to the function.\n */\n apply(this: Function, thisArg: any, argArray?: any): any;\n\n /**\n * Calls a method of an object, substituting another object for the current object.\n * @param thisArg The object to be used as the current object.\n * @param argArray A list of arguments to be passed to the method.\n */\n call(this: Function, thisArg: any, ...argArray: any[]): any;\n\n /**\n * For a given function, creates a bound function that has the same body as the original function.\n * The this object of the bound function is associated with the specified object, and has the specified initial parameters.\n * @param thisArg An object to which the this keyword can refer inside the new function.\n * @param argArray A list of arguments to be passed to the new function.\n */\n bind(this: Function, thisArg: any, ...argArray: any[]): any;\n\n /** Returns a string representation of a function. */\n toString(): string;\n\n prototype: any;\n readonly length: number;\n\n // Non-standard extensions\n arguments: any;\n caller: Function;\n}\n\ninterface FunctionConstructor {\n /**\n * Creates a new function.\n * @param args A list of arguments the function accepts.\n */\n new (...args: string[]): Function;\n (...args: string[]): Function;\n readonly prototype: Function;\n}\n\ndeclare const Function: FunctionConstructor;\n\ninterface IArguments {\n [index: number]: any;\n length: number;\n callee: Function;\n}\n\ninterface String {\n /** Returns a string representation of a string. */\n toString(): string;\n\n /**\n * Returns the character at the specified index.\n * @param pos The zero-based index of the desired character.\n */\n charAt(pos: number): string;\n\n /**\n * Returns the Unicode value of the character at the specified location.\n * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned.\n */\n charCodeAt(index: number): number;\n\n /**\n * Returns a string that contains the concatenation of two or more strings.\n * @param strings The strings to append to the end of the string.\n */\n concat(...strings: string[]): string;\n\n /**\n * Returns the position of the first occurrence of a substring.\n * @param searchString The substring to search for in the string\n * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string.\n */\n indexOf(searchString: string, position?: number): number;\n\n /**\n * Returns the last occurrence of a substring in the string.\n * @param searchString The substring to search for.\n * @param position The index at which to begin searching. If omitted, the search begins at the end of the string.\n */\n lastIndexOf(searchString: string, position?: number): number;\n\n /**\n * Determines whether two strings are equivalent in the current locale.\n * @param that String to compare to target string\n */\n localeCompare(that: string): number;\n\n /**\n * Matches a string with a regular expression, and returns an array containing the results of that search.\n * @param regexp A variable name or string literal containing the regular expression pattern and flags.\n */\n match(regexp: string): RegExpMatchArray | null;\n\n /**\n * Matches a string with a regular expression, and returns an array containing the results of that search.\n * @param regexp A regular expression object that contains the regular expression pattern and applicable flags.\n */\n match(regexp: RegExp): RegExpMatchArray | null;\n\n /**\n * Replaces text in a string, using a regular expression or search string.\n * @param searchValue A string that represents the regular expression.\n * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string.\n */\n replace(searchValue: string, replaceValue: string): string;\n\n /**\n * Replaces text in a string, using a regular expression or search string.\n * @param searchValue A string that represents the regular expression.\n * @param replacer A function that returns the replacement text.\n */\n replace(searchValue: string, replacer: (substring: string, ...args: any[]) => string): string;\n\n /**\n * Replaces text in a string, using a regular expression or search string.\n * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags.\n * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string.\n */\n replace(searchValue: RegExp, replaceValue: string): string;\n\n /**\n * Replaces text in a string, using a regular expression or search string.\n * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags\n * @param replacer A function that returns the replacement text.\n */\n replace(searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string;\n\n /**\n * Finds the first substring match in a regular expression search.\n * @param regexp The regular expression pattern and applicable flags.\n */\n search(regexp: string): number;\n\n /**\n * Finds the first substring match in a regular expression search.\n * @param regexp The regular expression pattern and applicable flags.\n */\n search(regexp: RegExp): number;\n\n /**\n * Returns a section of a string.\n * @param start The index to the beginning of the specified portion of stringObj.\n * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end.\n * If this value is not specified, the substring continues to the end of stringObj.\n */\n slice(start?: number, end?: number): string;\n\n /**\n * Split a string into substrings using the specified separator and return them as an array.\n * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned.\n * @param limit A value used to limit the number of elements returned in the array.\n */\n split(separator: string, limit?: number): string[];\n\n /**\n * Split a string into substrings using the specified separator and return them as an array.\n * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned.\n * @param limit A value used to limit the number of elements returned in the array.\n */\n split(separator: RegExp, limit?: number): string[];\n\n /**\n * Returns the substring at the specified location within a String object.\n * @param start The zero-based index number indicating the beginning of the substring.\n * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end.\n * If end is omitted, the characters from start through the end of the original string are returned.\n */\n substring(start: number, end?: number): string;\n\n /** Converts all the alphabetic characters in a string to lowercase. */\n toLowerCase(): string;\n\n /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */\n toLocaleLowerCase(): string;\n\n /** Converts all the alphabetic characters in a string to uppercase. */\n toUpperCase(): string;\n\n /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */\n toLocaleUpperCase(): string;\n\n /** Removes the leading and trailing white space and line terminator characters from a string. */\n trim(): string;\n\n /** Returns the length of a String object. */\n readonly length: number;\n\n // IE extensions\n /**\n * Gets a substring beginning at the specified location and having the specified length.\n * @param from The starting position of the desired substring. The index of the first character in the string is zero.\n * @param length The number of characters to include in the returned substring.\n */\n substr(from: number, length?: number): string;\n\n /** Returns the primitive value of the specified object. */\n valueOf(): string;\n\n readonly [index: number]: string;\n}\n\ninterface StringConstructor {\n new (value?: any): String;\n (value?: any): string;\n readonly prototype: String;\n fromCharCode(...codes: number[]): string;\n}\n\n/**\n * Allows manipulation and formatting of text strings and determination and location of substrings within strings.\n */\ndeclare const String: StringConstructor;\n\ninterface Boolean {\n /** Returns the primitive value of the specified object. */\n valueOf(): boolean;\n}\n\ninterface BooleanConstructor {\n new (value?: any): Boolean;\n (value?: any): boolean;\n readonly prototype: Boolean;\n}\n\ndeclare const Boolean: BooleanConstructor;\n\ninterface Number {\n /**\n * Returns a string representation of an object.\n * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers.\n */\n toString(radix?: number): string;\n\n /**\n * Returns a string representing a number in fixed-point notation.\n * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive.\n */\n toFixed(fractionDigits?: number): string;\n\n /**\n * Returns a string containing a number represented in exponential notation.\n * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive.\n */\n toExponential(fractionDigits?: number): string;\n\n /**\n * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits.\n * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive.\n */\n toPrecision(precision?: number): string;\n\n /** Returns the primitive value of the specified object. */\n valueOf(): number;\n}\n\ninterface NumberConstructor {\n new (value?: any): Number;\n (value?: any): number;\n readonly prototype: Number;\n\n /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */\n readonly MAX_VALUE: number;\n\n /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */\n readonly MIN_VALUE: number;\n\n /**\n * A value that is not a number.\n * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function.\n */\n readonly NaN: number;\n\n /**\n * A value that is less than the largest negative number that can be represented in JavaScript.\n * JavaScript displays NEGATIVE_INFINITY values as -infinity.\n */\n readonly NEGATIVE_INFINITY: number;\n\n /**\n * A value greater than the largest number that can be represented in JavaScript.\n * JavaScript displays POSITIVE_INFINITY values as infinity.\n */\n readonly POSITIVE_INFINITY: number;\n}\n\n/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */\ndeclare const Number: NumberConstructor;\n\ninterface TemplateStringsArray extends ReadonlyArray {\n readonly raw: ReadonlyArray\n}\n\ninterface Math {\n /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */\n readonly E: number;\n /** The natural logarithm of 10. */\n readonly LN10: number;\n /** The natural logarithm of 2. */\n readonly LN2: number;\n /** The base-2 logarithm of e. */\n readonly LOG2E: number;\n /** The base-10 logarithm of e. */\n readonly LOG10E: number;\n /** Pi. This is the ratio of the circumference of a circle to its diameter. */\n readonly PI: number;\n /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */\n readonly SQRT1_2: number;\n /** The square root of 2. */\n readonly SQRT2: number;\n /**\n * Returns the absolute value of a number (the value without regard to whether it is positive or negative).\n * For example, the absolute value of -5 is the same as the absolute value of 5.\n * @param x A numeric expression for which the absolute value is needed.\n */\n abs(x: number): number;\n /**\n * Returns the arc cosine (or inverse cosine) of a number.\n * @param x A numeric expression.\n */\n acos(x: number): number;\n /**\n * Returns the arcsine of a number.\n * @param x A numeric expression.\n */\n asin(x: number): number;\n /**\n * Returns the arctangent of a number.\n * @param x A numeric expression for which the arctangent is needed.\n */\n atan(x: number): number;\n /**\n * Returns the angle (in radians) from the X axis to a point.\n * @param y A numeric expression representing the cartesian y-coordinate.\n * @param x A numeric expression representing the cartesian x-coordinate.\n */\n atan2(y: number, x: number): number;\n /**\n * Returns the smallest number greater than or equal to its numeric argument.\n * @param x A numeric expression.\n */\n ceil(x: number): number;\n /**\n * Returns the cosine of a number.\n * @param x A numeric expression that contains an angle measured in radians.\n */\n cos(x: number): number;\n /**\n * Returns e (the base of natural logarithms) raised to a power.\n * @param x A numeric expression representing the power of e.\n */\n exp(x: number): number;\n /**\n * Returns the greatest number less than or equal to its numeric argument.\n * @param x A numeric expression.\n */\n floor(x: number): number;\n /**\n * Returns the natural logarithm (base e) of a number.\n * @param x A numeric expression.\n */\n log(x: number): number;\n /**\n * Returns the larger of a set of supplied numeric expressions.\n * @param values Numeric expressions to be evaluated.\n */\n max(...values: number[]): number;\n /**\n * Returns the smaller of a set of supplied numeric expressions.\n * @param values Numeric expressions to be evaluated.\n */\n min(...values: number[]): number;\n /**\n * Returns the value of a base expression taken to a specified power.\n * @param x The base value of the expression.\n * @param y The exponent value of the expression.\n */\n pow(x: number, y: number): number;\n /** Returns a pseudorandom number between 0 and 1. */\n random(): number;\n /**\n * Returns a supplied numeric expression rounded to the nearest number.\n * @param x The value to be rounded to the nearest number.\n */\n round(x: number): number;\n /**\n * Returns the sine of a number.\n * @param x A numeric expression that contains an angle measured in radians.\n */\n sin(x: number): number;\n /**\n * Returns the square root of a number.\n * @param x A numeric expression.\n */\n sqrt(x: number): number;\n /**\n * Returns the tangent of a number.\n * @param x A numeric expression that contains an angle measured in radians.\n */\n tan(x: number): number;\n}\n/** An intrinsic object that provides basic mathematics functionality and constants. */\ndeclare const Math: Math;\n\n/** Enables basic storage and retrieval of dates and times. */\ninterface Date {\n /** Returns a string representation of a date. The format of the string depends on the locale. */\n toString(): string;\n /** Returns a date as a string value. */\n toDateString(): string;\n /** Returns a time as a string value. */\n toTimeString(): string;\n /** Returns a value as a string value appropriate to the host environment's current locale. */\n toLocaleString(): string;\n /** Returns a date as a string value appropriate to the host environment's current locale. */\n toLocaleDateString(): string;\n /** Returns a time as a string value appropriate to the host environment's current locale. */\n toLocaleTimeString(): string;\n /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */\n valueOf(): number;\n /** Gets the time value in milliseconds. */\n getTime(): number;\n /** Gets the year, using local time. */\n getFullYear(): number;\n /** Gets the year using Universal Coordinated Time (UTC). */\n getUTCFullYear(): number;\n /** Gets the month, using local time. */\n getMonth(): number;\n /** Gets the month of a Date object using Universal Coordinated Time (UTC). */\n getUTCMonth(): number;\n /** Gets the day-of-the-month, using local time. */\n getDate(): number;\n /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */\n getUTCDate(): number;\n /** Gets the day of the week, using local time. */\n getDay(): number;\n /** Gets the day of the week using Universal Coordinated Time (UTC). */\n getUTCDay(): number;\n /** Gets the hours in a date, using local time. */\n getHours(): number;\n /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */\n getUTCHours(): number;\n /** Gets the minutes of a Date object, using local time. */\n getMinutes(): number;\n /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */\n getUTCMinutes(): number;\n /** Gets the seconds of a Date object, using local time. */\n getSeconds(): number;\n /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */\n getUTCSeconds(): number;\n /** Gets the milliseconds of a Date, using local time. */\n getMilliseconds(): number;\n /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */\n getUTCMilliseconds(): number;\n /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */\n getTimezoneOffset(): number;\n /**\n * Sets the date and time value in the Date object.\n * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT.\n */\n setTime(time: number): number;\n /**\n * Sets the milliseconds value in the Date object using local time.\n * @param ms A numeric value equal to the millisecond value.\n */\n setMilliseconds(ms: number): number;\n /**\n * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC).\n * @param ms A numeric value equal to the millisecond value.\n */\n setUTCMilliseconds(ms: number): number;\n\n /**\n * Sets the seconds value in the Date object using local time.\n * @param sec A numeric value equal to the seconds value.\n * @param ms A numeric value equal to the milliseconds value.\n */\n setSeconds(sec: number, ms?: number): number;\n /**\n * Sets the seconds value in the Date object using Universal Coordinated Time (UTC).\n * @param sec A numeric value equal to the seconds value.\n * @param ms A numeric value equal to the milliseconds value.\n */\n setUTCSeconds(sec: number, ms?: number): number;\n /**\n * Sets the minutes value in the Date object using local time.\n * @param min A numeric value equal to the minutes value.\n * @param sec A numeric value equal to the seconds value.\n * @param ms A numeric value equal to the milliseconds value.\n */\n setMinutes(min: number, sec?: number, ms?: number): number;\n /**\n * Sets the minutes value in the Date object using Universal Coordinated Time (UTC).\n * @param min A numeric value equal to the minutes value.\n * @param sec A numeric value equal to the seconds value.\n * @param ms A numeric value equal to the milliseconds value.\n */\n setUTCMinutes(min: number, sec?: number, ms?: number): number;\n /**\n * Sets the hour value in the Date object using local time.\n * @param hours A numeric value equal to the hours value.\n * @param min A numeric value equal to the minutes value.\n * @param sec A numeric value equal to the seconds value.\n * @param ms A numeric value equal to the milliseconds value.\n */\n setHours(hours: number, min?: number, sec?: number, ms?: number): number;\n /**\n * Sets the hours value in the Date object using Universal Coordinated Time (UTC).\n * @param hours A numeric value equal to the hours value.\n * @param min A numeric value equal to the minutes value.\n * @param sec A numeric value equal to the seconds value.\n * @param ms A numeric value equal to the milliseconds value.\n */\n setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number;\n /**\n * Sets the numeric day-of-the-month value of the Date object using local time.\n * @param date A numeric value equal to the day of the month.\n */\n setDate(date: number): number;\n /**\n * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC).\n * @param date A numeric value equal to the day of the month.\n */\n setUTCDate(date: number): number;\n /**\n * Sets the month value in the Date object using local time.\n * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively.\n * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used.\n */\n setMonth(month: number, date?: number): number;\n /**\n * Sets the month value in the Date object using Universal Coordinated Time (UTC).\n * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively.\n * @param date A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used.\n */\n setUTCMonth(month: number, date?: number): number;\n /**\n * Sets the year of the Date object using local time.\n * @param year A numeric value for the year.\n * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified.\n * @param date A numeric value equal for the day of the month.\n */\n setFullYear(year: number, month?: number, date?: number): number;\n /**\n * Sets the year value in the Date object using Universal Coordinated Time (UTC).\n * @param year A numeric value equal to the year.\n * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied.\n * @param date A numeric value equal to the day of the month.\n */\n setUTCFullYear(year: number, month?: number, date?: number): number;\n /** Returns a date converted to a string using Universal Coordinated Time (UTC). */\n toUTCString(): string;\n /** Returns a date as a string value in ISO format. */\n toISOString(): string;\n /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */\n toJSON(key?: any): string;\n}\n\ninterface DateConstructor {\n new (): Date;\n new (value: number): Date;\n new (value: string): Date;\n new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;\n (): string;\n readonly prototype: Date;\n /**\n * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970.\n * @param s A date string\n */\n parse(s: string): number;\n /**\n * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date.\n * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year.\n * @param month The month as an number between 0 and 11 (January to December).\n * @param date The date as an number between 1 and 31.\n * @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour.\n * @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes.\n * @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds.\n * @param ms An number from 0 to 999 that specifies the milliseconds.\n */\n UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number;\n now(): number;\n}\n\ndeclare const Date: DateConstructor;\n\ninterface RegExpMatchArray extends Array {\n index?: number;\n input?: string;\n}\n\ninterface RegExpExecArray extends Array {\n index: number;\n input: string;\n}\n\ninterface RegExp {\n /**\n * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search.\n * @param string The String object or string literal on which to perform the search.\n */\n exec(string: string): RegExpExecArray | null;\n\n /**\n * Returns a Boolean value that indicates whether or not a pattern exists in a searched string.\n * @param string String on which to perform the search.\n */\n test(string: string): boolean;\n\n /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */\n readonly source: string;\n\n /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */\n readonly global: boolean;\n\n /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */\n readonly ignoreCase: boolean;\n\n /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */\n readonly multiline: boolean;\n\n lastIndex: number;\n\n // Non-standard extensions\n compile(): this;\n}\n\ninterface RegExpConstructor {\n new (pattern: RegExp): RegExp;\n new (pattern: string, flags?: string): RegExp;\n (pattern: RegExp): RegExp;\n (pattern: string, flags?: string): RegExp;\n readonly prototype: RegExp;\n\n // Non-standard extensions\n $1: string;\n $2: string;\n $3: string;\n $4: string;\n $5: string;\n $6: string;\n $7: string;\n $8: string;\n $9: string;\n lastMatch: string;\n}\n\ndeclare const RegExp: RegExpConstructor;\n\ninterface Error {\n name: string;\n message: string;\n stack?: string;\n}\n\ninterface ErrorConstructor {\n new (message?: string): Error;\n (message?: string): Error;\n readonly prototype: Error;\n}\n\ndeclare const Error: ErrorConstructor;\n\ninterface EvalError extends Error {\n}\n\ninterface EvalErrorConstructor {\n new (message?: string): EvalError;\n (message?: string): EvalError;\n readonly prototype: EvalError;\n}\n\ndeclare const EvalError: EvalErrorConstructor;\n\ninterface RangeError extends Error {\n}\n\ninterface RangeErrorConstructor {\n new (message?: string): RangeError;\n (message?: string): RangeError;\n readonly prototype: RangeError;\n}\n\ndeclare const RangeError: RangeErrorConstructor;\n\ninterface ReferenceError extends Error {\n}\n\ninterface ReferenceErrorConstructor {\n new (message?: string): ReferenceError;\n (message?: string): ReferenceError;\n readonly prototype: ReferenceError;\n}\n\ndeclare const ReferenceError: ReferenceErrorConstructor;\n\ninterface SyntaxError extends Error {\n}\n\ninterface SyntaxErrorConstructor {\n new (message?: string): SyntaxError;\n (message?: string): SyntaxError;\n readonly prototype: SyntaxError;\n}\n\ndeclare const SyntaxError: SyntaxErrorConstructor;\n\ninterface TypeError extends Error {\n}\n\ninterface TypeErrorConstructor {\n new (message?: string): TypeError;\n (message?: string): TypeError;\n readonly prototype: TypeError;\n}\n\ndeclare const TypeError: TypeErrorConstructor;\n\ninterface URIError extends Error {\n}\n\ninterface URIErrorConstructor {\n new (message?: string): URIError;\n (message?: string): URIError;\n readonly prototype: URIError;\n}\n\ndeclare const URIError: URIErrorConstructor;\n\ninterface JSON {\n /**\n * Converts a JavaScript Object Notation (JSON) string into an object.\n * @param text A valid JSON string.\n * @param reviver A function that transforms the results. This function is called for each member of the object.\n * If a member contains nested objects, the nested objects are transformed before the parent object is.\n */\n parse(text: string, reviver?: (key: any, value: any) => any): any;\n /**\n * Converts a JavaScript value to a JavaScript Object Notation (JSON) string.\n * @param value A JavaScript value, usually an object or array, to be converted.\n * @param replacer A function that transforms the results.\n * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.\n */\n stringify(value: any, replacer?: (key: string, value: any) => any, space?: string | number): string;\n /**\n * Converts a JavaScript value to a JavaScript Object Notation (JSON) string.\n * @param value A JavaScript value, usually an object or array, to be converted.\n * @param replacer An array of strings and numbers that acts as a approved list for selecting the object properties that will be stringified.\n * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.\n */\n stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string;\n}\n\n/**\n * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.\n */\ndeclare const JSON: JSON;\n\n\n/////////////////////////////\n/// ECMAScript Array API (specially handled by compiler)\n/////////////////////////////\n\ninterface ReadonlyArray {\n /**\n * Gets the length of the array. This is a number one higher than the highest element defined in an array.\n */\n readonly length: number;\n /**\n * Returns a string representation of an array.\n */\n toString(): string;\n toLocaleString(): string;\n /**\n * Combines two or more arrays.\n * @param items Additional items to add to the end of array1.\n */\n concat>(...items: U[]): T[];\n /**\n * Combines two or more arrays.\n * @param items Additional items to add to the end of array1.\n */\n concat(...items: T[][]): T[];\n /**\n * Combines two or more arrays.\n * @param items Additional items to add to the end of array1.\n */\n concat(...items: (T | T[])[]): T[];\n /**\n * Adds all the elements of an array separated by the specified separator string.\n * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.\n */\n join(separator?: string): string;\n /**\n * Returns a section of an array.\n * @param start The beginning of the specified portion of the array.\n * @param end The end of the specified portion of the array.\n */\n slice(start?: number, end?: number): T[];\n /**\n * Returns the index of the first occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.\n */\n indexOf(searchElement: T, fromIndex?: number): number;\n\n /**\n * Returns the index of the last occurrence of a specified value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array.\n */\n lastIndexOf(searchElement: T, fromIndex?: number): number;\n /**\n * Determines whether all the members of an array satisfy the specified test.\n * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\n every(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean;\n /**\n * Determines whether the specified callback function returns true for any element of an array.\n * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\n some(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean;\n /**\n * Performs the specified action for each element in an array.\n * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\n forEach(callbackfn: (value: T, index: number, array: ReadonlyArray) => void, thisArg?: any): void;\n /**\n * Calls a defined callback function on each element of an array, and returns an array that contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\n map(callbackfn: (value: T, index: number, array: ReadonlyArray) => U, thisArg?: any): U[];\n /**\n * Returns the elements of an array that meet the condition specified in a callback function.\n * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\n filter(callbackfn: (value: T, index: number, array: ReadonlyArray) => value is S, thisArg?: any): S[];\n /**\n * Returns the elements of an array that meet the condition specified in a callback function.\n * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\n filter(callbackfn: (value: T, index: number, array: ReadonlyArray) => any, thisArg?: any): T[];\n /**\n * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n */\n reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T;\n /**\n * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n */\n reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U;\n /**\n * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T;\n /**\n * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U;\n\n readonly [n: number]: T;\n}\n\ninterface Array {\n /**\n * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array.\n */\n length: number;\n /**\n * Returns a string representation of an array.\n */\n toString(): string;\n toLocaleString(): string;\n /**\n * Appends new elements to an array, and returns the new length of the array.\n * @param items New elements of the Array.\n */\n push(...items: T[]): number;\n /**\n * Removes the last element from an array and returns it.\n */\n pop(): T | undefined;\n /**\n * Combines two or more arrays.\n * @param items Additional items to add to the end of array1.\n */\n concat(...items: T[][]): T[];\n /**\n * Combines two or more arrays.\n * @param items Additional items to add to the end of array1.\n */\n concat(...items: (T | T[])[]): T[];\n /**\n * Adds all the elements of an array separated by the specified separator string.\n * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.\n */\n join(separator?: string): string;\n /**\n * Reverses the elements in an Array.\n */\n reverse(): T[];\n /**\n * Removes the first element from an array and returns it.\n */\n shift(): T | undefined;\n /**\n * Returns a section of an array.\n * @param start The beginning of the specified portion of the array.\n * @param end The end of the specified portion of the array.\n */\n slice(start?: number, end?: number): T[];\n /**\n * Sorts an array.\n * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order.\n */\n sort(compareFn?: (a: T, b: T) => number): this;\n /**\n * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.\n * @param start The zero-based location in the array from which to start removing elements.\n */\n splice(start: number): T[];\n /**\n * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.\n * @param start The zero-based location in the array from which to start removing elements.\n * @param deleteCount The number of elements to remove.\n * @param items Elements to insert into the array in place of the deleted elements.\n */\n splice(start: number, deleteCount: number, ...items: T[]): T[];\n /**\n * Inserts new elements at the start of an array.\n * @param items Elements to insert at the start of the Array.\n */\n unshift(...items: T[]): number;\n /**\n * Returns the index of the first occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.\n */\n indexOf(searchElement: T, fromIndex?: number): number;\n /**\n * Returns the index of the last occurrence of a specified value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array.\n */\n lastIndexOf(searchElement: T, fromIndex?: number): number;\n /**\n * Determines whether all the members of an array satisfy the specified test.\n * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\n every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;\n /**\n * Determines whether the specified callback function returns true for any element of an array.\n * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\n some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;\n /**\n * Performs the specified action for each element in an array.\n * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\n forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void;\n /**\n * Calls a defined callback function on each element of an array, and returns an array that contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\n map(this: [T, T, T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U, U, U];\n /**\n * Calls a defined callback function on each element of an array, and returns an array that contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\n map(this: [T, T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U, U];\n /**\n * Calls a defined callback function on each element of an array, and returns an array that contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\n map(this: [T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U];\n /**\n * Calls a defined callback function on each element of an array, and returns an array that contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\n map(this: [T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U];\n /**\n * Calls a defined callback function on each element of an array, and returns an array that contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\n map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[];\n /**\n * Returns the elements of an array that meet the condition specified in a callback function.\n * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\n filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[];\n /**\n * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n */\n reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;\n /**\n * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n */\n reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;\n /**\n * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;\n /**\n * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;\n\n [n: number]: T;\n}\n\ninterface ArrayConstructor {\n new (arrayLength?: number): any[];\n new (arrayLength: number): T[];\n new (...items: T[]): T[];\n (arrayLength?: number): any[];\n (arrayLength: number): T[];\n (...items: T[]): T[];\n isArray(arg: any): arg is Array;\n readonly prototype: Array;\n}\n\ndeclare const Array: ArrayConstructor;\n\ninterface TypedPropertyDescriptor {\n enumerable?: boolean;\n configurable?: boolean;\n writable?: boolean;\n value?: T;\n get?: () => T;\n set?: (value: T) => void;\n}\n\ndeclare type ClassDecorator = (target: TFunction) => TFunction | void;\ndeclare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;\ndeclare type MethodDecorator = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void;\ndeclare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;\n\ndeclare type PromiseConstructorLike = new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike;\n\ninterface PromiseLike {\n /**\n * Attaches callbacks for the resolution and/or rejection of the Promise.\n * @param onfulfilled The callback to execute when the Promise is resolved.\n * @param onrejected The callback to execute when the Promise is rejected.\n * @returns A Promise for the completion of which ever callback is executed.\n */\n then(\n onfulfilled?: ((value: T) => T | PromiseLike) | undefined | null,\n onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): PromiseLike;\n\n /**\n * Attaches callbacks for the resolution and/or rejection of the Promise.\n * @param onfulfilled The callback to execute when the Promise is resolved.\n * @param onrejected The callback to execute when the Promise is rejected.\n * @returns A Promise for the completion of which ever callback is executed.\n */\n then(\n onfulfilled: ((value: T) => T | PromiseLike) | undefined | null,\n onrejected: (reason: any) => TResult | PromiseLike): PromiseLike;\n\n /**\n * Attaches callbacks for the resolution and/or rejection of the Promise.\n * @param onfulfilled The callback to execute when the Promise is resolved.\n * @param onrejected The callback to execute when the Promise is rejected.\n * @returns A Promise for the completion of which ever callback is executed.\n */\n then(\n onfulfilled: (value: T) => TResult | PromiseLike,\n onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): PromiseLike;\n\n /**\n * Attaches callbacks for the resolution and/or rejection of the Promise.\n * @param onfulfilled The callback to execute when the Promise is resolved.\n * @param onrejected The callback to execute when the Promise is rejected.\n * @returns A Promise for the completion of which ever callback is executed.\n */\n then(\n onfulfilled: (value: T) => TResult1 | PromiseLike,\n onrejected: (reason: any) => TResult2 | PromiseLike): PromiseLike;\n}\n\ninterface ArrayLike {\n readonly length: number;\n readonly [n: number]: T;\n}\n\n/**\n * Make all properties in T optional\n */\ntype Partial = {\n [P in keyof T]?: T[P];\n};\n\n/**\n * Make all properties in T readonly\n */\ntype Readonly = {\n readonly [P in keyof T]: T[P];\n};\n\n/**\n * From T pick a set of properties K\n */\ntype Pick = {\n [P in K]: T[P];\n}\n\n/**\n * Construct a type with a set of properties K of type T\n */\ntype Record = {\n [P in K]: T;\n}\n\n/**\n * Represents a raw buffer of binary data, which is used to store data for the\n * different typed arrays. ArrayBuffers cannot be read from or written to directly,\n * but can be passed to a typed array or DataView Object to interpret the raw\n * buffer as needed.\n */\ninterface ArrayBuffer {\n /**\n * Read-only. The length of the ArrayBuffer (in bytes).\n */\n readonly byteLength: number;\n\n /**\n * Returns a section of an ArrayBuffer.\n */\n slice(begin:number, end?:number): ArrayBuffer;\n}\n\ninterface ArrayBufferConstructor {\n readonly prototype: ArrayBuffer;\n new (byteLength: number): ArrayBuffer;\n isView(arg: any): arg is ArrayBufferView;\n}\ndeclare const ArrayBuffer: ArrayBufferConstructor;\n\ninterface ArrayBufferView {\n /**\n * The ArrayBuffer instance referenced by the array.\n */\n buffer: ArrayBuffer;\n\n /**\n * The length in bytes of the array.\n */\n byteLength: number;\n\n /**\n * The offset in bytes of the array.\n */\n byteOffset: number;\n}\n\ninterface DataView {\n readonly buffer: ArrayBuffer;\n readonly byteLength: number;\n readonly byteOffset: number;\n /**\n * Gets the Float32 value at the specified byte offset from the start of the view. There is\n * no alignment constraint; multi-byte values may be fetched from any offset.\n * @param byteOffset The place in the buffer at which the value should be retrieved.\n */\n getFloat32(byteOffset: number, littleEndian?: boolean): number;\n\n /**\n * Gets the Float64 value at the specified byte offset from the start of the view. There is\n * no alignment constraint; multi-byte values may be fetched from any offset.\n * @param byteOffset The place in the buffer at which the value should be retrieved.\n */\n getFloat64(byteOffset: number, littleEndian?: boolean): number;\n\n /**\n * Gets the Int8 value at the specified byte offset from the start of the view. There is\n * no alignment constraint; multi-byte values may be fetched from any offset.\n * @param byteOffset The place in the buffer at which the value should be retrieved.\n */\n getInt8(byteOffset: number): number;\n\n /**\n * Gets the Int16 value at the specified byte offset from the start of the view. There is\n * no alignment constraint; multi-byte values may be fetched from any offset.\n * @param byteOffset The place in the buffer at which the value should be retrieved.\n */\n getInt16(byteOffset: number, littleEndian?: boolean): number;\n /**\n * Gets the Int32 value at the specified byte offset from the start of the view. There is\n * no alignment constraint; multi-byte values may be fetched from any offset.\n * @param byteOffset The place in the buffer at which the value should be retrieved.\n */\n getInt32(byteOffset: number, littleEndian?: boolean): number;\n\n /**\n * Gets the Uint8 value at the specified byte offset from the start of the view. There is\n * no alignment constraint; multi-byte values may be fetched from any offset.\n * @param byteOffset The place in the buffer at which the value should be retrieved.\n */\n getUint8(byteOffset: number): number;\n\n /**\n * Gets the Uint16 value at the specified byte offset from the start of the view. There is\n * no alignment constraint; multi-byte values may be fetched from any offset.\n * @param byteOffset The place in the buffer at which the value should be retrieved.\n */\n getUint16(byteOffset: number, littleEndian?: boolean): number;\n\n /**\n * Gets the Uint32 value at the specified byte offset from the start of the view. There is\n * no alignment constraint; multi-byte values may be fetched from any offset.\n * @param byteOffset The place in the buffer at which the value should be retrieved.\n */\n getUint32(byteOffset: number, littleEndian?: boolean): number;\n\n /**\n * Stores an Float32 value at the specified byte offset from the start of the view.\n * @param byteOffset The place in the buffer at which the value should be set.\n * @param value The value to set.\n * @param littleEndian If false or undefined, a big-endian value should be written,\n * otherwise a little-endian value should be written.\n */\n setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void;\n\n /**\n * Stores an Float64 value at the specified byte offset from the start of the view.\n * @param byteOffset The place in the buffer at which the value should be set.\n * @param value The value to set.\n * @param littleEndian If false or undefined, a big-endian value should be written,\n * otherwise a little-endian value should be written.\n */\n setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void;\n\n /**\n * Stores an Int8 value at the specified byte offset from the start of the view.\n * @param byteOffset The place in the buffer at which the value should be set.\n * @param value The value to set.\n */\n setInt8(byteOffset: number, value: number): void;\n\n /**\n * Stores an Int16 value at the specified byte offset from the start of the view.\n * @param byteOffset The place in the buffer at which the value should be set.\n * @param value The value to set.\n * @param littleEndian If false or undefined, a big-endian value should be written,\n * otherwise a little-endian value should be written.\n */\n setInt16(byteOffset: number, value: number, littleEndian?: boolean): void;\n\n /**\n * Stores an Int32 value at the specified byte offset from the start of the view.\n * @param byteOffset The place in the buffer at which the value should be set.\n * @param value The value to set.\n * @param littleEndian If false or undefined, a big-endian value should be written,\n * otherwise a little-endian value should be written.\n */\n setInt32(byteOffset: number, value: number, littleEndian?: boolean): void;\n\n /**\n * Stores an Uint8 value at the specified byte offset from the start of the view.\n * @param byteOffset The place in the buffer at which the value should be set.\n * @param value The value to set.\n */\n setUint8(byteOffset: number, value: number): void;\n\n /**\n * Stores an Uint16 value at the specified byte offset from the start of the view.\n * @param byteOffset The place in the buffer at which the value should be set.\n * @param value The value to set.\n * @param littleEndian If false or undefined, a big-endian value should be written,\n * otherwise a little-endian value should be written.\n */\n setUint16(byteOffset: number, value: number, littleEndian?: boolean): void;\n\n /**\n * Stores an Uint32 value at the specified byte offset from the start of the view.\n * @param byteOffset The place in the buffer at which the value should be set.\n * @param value The value to set.\n * @param littleEndian If false or undefined, a big-endian value should be written,\n * otherwise a little-endian value should be written.\n */\n setUint32(byteOffset: number, value: number, littleEndian?: boolean): void;\n}\n\ninterface DataViewConstructor {\n new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView;\n}\ndeclare const DataView: DataViewConstructor;\n\n/**\n * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested\n * number of bytes could not be allocated an exception is raised.\n */\ninterface Int8Array {\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * The ArrayBuffer instance referenced by the array.\n */\n readonly buffer: ArrayBuffer;\n\n /**\n * The length in bytes of the array.\n */\n readonly byteLength: number;\n\n /**\n * The offset in bytes of the array.\n */\n readonly byteOffset: number;\n\n /**\n * Returns the this object after copying a section of the array identified by start and end\n * to the same array starting at position target\n * @param target If target is negative, it is treated as length+target where length is the\n * length of the array.\n * @param start If start is negative, it is treated as length+start. If end is negative, it\n * is treated as length+end.\n * @param end If not specified, length of the this object is used as its default value.\n */\n copyWithin(target: number, start: number, end?: number): this;\n\n /**\n * Determines whether all the members of an array satisfy the specified test.\n * @param callbackfn A function that accepts up to three arguments. The every method calls\n * the callbackfn function for each element in array1 until the callbackfn returns false,\n * or until the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean;\n\n /**\n * Returns the this object after filling the section identified by start and end with value\n * @param value value to fill array section with\n * @param start index to start filling the array at. If start is negative, it is treated as\n * length+start where length is the length of the array.\n * @param end index to stop filling the array at. If end is negative, it is treated as\n * length+end.\n */\n fill(value: number, start?: number, end?: number): this;\n\n /**\n * Returns the elements of an array that meet the condition specified in a callback function.\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\n * the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n filter(callbackfn: (value: number, index: number, array: Int8Array) => any, thisArg?: any): Int8Array;\n\n /**\n * Returns the value of the first element in the array where predicate is true, and undefined\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found, find\n * immediately returns that element value. Otherwise, find returns undefined.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\n\n /**\n * Returns the index of the first element in the array where predicate is true, and -1\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found,\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number;\n\n /**\n * Performs the specified action for each element in an array.\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void;\n\n /**\n * Returns the index of the first occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n indexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * Adds all the elements of an array separated by the specified separator string.\n * @param separator A string used to separate one element of an array from the next in the\n * resulting String. If omitted, the array elements are separated with a comma.\n */\n join(separator?: string): string;\n\n /**\n * Returns the index of the last occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * The length of the array.\n */\n readonly length: number;\n\n /**\n * Calls a defined callback function on each element of an array, and returns an array that\n * contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an\n * argument instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U;\n\n /**\n * Reverses the elements in an Array.\n */\n reverse(): Int8Array;\n\n /**\n * Sets a value or an array of values.\n * @param index The index of the location to set.\n * @param value The value to set.\n */\n set(index: number, value: number): void;\n\n /**\n * Sets a value or an array of values.\n * @param array A typed or untyped array of values to set.\n * @param offset The index in the current array at which the values are to be written.\n */\n set(array: ArrayLike, offset?: number): void;\n\n /**\n * Returns a section of an array.\n * @param start The beginning of the specified portion of the array.\n * @param end The end of the specified portion of the array.\n */\n slice(start?: number, end?: number): Int8Array;\n\n /**\n * Determines whether the specified callback function returns true for any element of an array.\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\n * the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean;\n\n /**\n * Sorts an array.\n * @param compareFn The name of the function used to determine the order of the elements. If\n * omitted, the elements are sorted in ascending, ASCII character order.\n */\n sort(compareFn?: (a: number, b: number) => number): this;\n\n /**\n * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements\n * at begin, inclusive, up to end, exclusive.\n * @param begin The index of the beginning of the array.\n * @param end The index of the end of the array.\n */\n subarray(begin: number, end?: number): Int8Array;\n\n /**\n * Converts a number to a string by using the current locale.\n */\n toLocaleString(): string;\n\n /**\n * Returns a string representation of an array.\n */\n toString(): string;\n\n [index: number]: number;\n}\ninterface Int8ArrayConstructor {\n readonly prototype: Int8Array;\n new (length: number): Int8Array;\n new (array: ArrayLike): Int8Array;\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array;\n\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * Returns a new array from a set of elements.\n * @param items A set of elements to include in the new array object.\n */\n of(...items: number[]): Int8Array;\n\n /**\n * Creates an array from an array-like or iterable object.\n * @param arrayLike An array-like or iterable object to convert to an array.\n * @param mapfn A mapping function to call on every element of the array.\n * @param thisArg Value of 'this' used to invoke the mapfn.\n */\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array;\n\n}\ndeclare const Int8Array: Int8ArrayConstructor;\n\n/**\n * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the\n * requested number of bytes could not be allocated an exception is raised.\n */\ninterface Uint8Array {\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * The ArrayBuffer instance referenced by the array.\n */\n readonly buffer: ArrayBuffer;\n\n /**\n * The length in bytes of the array.\n */\n readonly byteLength: number;\n\n /**\n * The offset in bytes of the array.\n */\n readonly byteOffset: number;\n\n /**\n * Returns the this object after copying a section of the array identified by start and end\n * to the same array starting at position target\n * @param target If target is negative, it is treated as length+target where length is the\n * length of the array.\n * @param start If start is negative, it is treated as length+start. If end is negative, it\n * is treated as length+end.\n * @param end If not specified, length of the this object is used as its default value.\n */\n copyWithin(target: number, start: number, end?: number): this;\n\n /**\n * Determines whether all the members of an array satisfy the specified test.\n * @param callbackfn A function that accepts up to three arguments. The every method calls\n * the callbackfn function for each element in array1 until the callbackfn returns false,\n * or until the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean;\n\n /**\n * Returns the this object after filling the section identified by start and end with value\n * @param value value to fill array section with\n * @param start index to start filling the array at. If start is negative, it is treated as\n * length+start where length is the length of the array.\n * @param end index to stop filling the array at. If end is negative, it is treated as\n * length+end.\n */\n fill(value: number, start?: number, end?: number): this;\n\n /**\n * Returns the elements of an array that meet the condition specified in a callback function.\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\n * the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n filter(callbackfn: (value: number, index: number, array: Uint8Array) => any, thisArg?: any): Uint8Array;\n\n /**\n * Returns the value of the first element in the array where predicate is true, and undefined\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found, find\n * immediately returns that element value. Otherwise, find returns undefined.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\n\n /**\n * Returns the index of the first element in the array where predicate is true, and -1\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found,\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number;\n\n /**\n * Performs the specified action for each element in an array.\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void;\n\n /**\n * Returns the index of the first occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n indexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * Adds all the elements of an array separated by the specified separator string.\n * @param separator A string used to separate one element of an array from the next in the\n * resulting String. If omitted, the array elements are separated with a comma.\n */\n join(separator?: string): string;\n\n /**\n * Returns the index of the last occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * The length of the array.\n */\n readonly length: number;\n\n /**\n * Calls a defined callback function on each element of an array, and returns an array that\n * contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an\n * argument instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U;\n\n /**\n * Reverses the elements in an Array.\n */\n reverse(): Uint8Array;\n\n /**\n * Sets a value or an array of values.\n * @param index The index of the location to set.\n * @param value The value to set.\n */\n set(index: number, value: number): void;\n\n /**\n * Sets a value or an array of values.\n * @param array A typed or untyped array of values to set.\n * @param offset The index in the current array at which the values are to be written.\n */\n set(array: ArrayLike, offset?: number): void;\n\n /**\n * Returns a section of an array.\n * @param start The beginning of the specified portion of the array.\n * @param end The end of the specified portion of the array.\n */\n slice(start?: number, end?: number): Uint8Array;\n\n /**\n * Determines whether the specified callback function returns true for any element of an array.\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\n * the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean;\n\n /**\n * Sorts an array.\n * @param compareFn The name of the function used to determine the order of the elements. If\n * omitted, the elements are sorted in ascending, ASCII character order.\n */\n sort(compareFn?: (a: number, b: number) => number): this;\n\n /**\n * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements\n * at begin, inclusive, up to end, exclusive.\n * @param begin The index of the beginning of the array.\n * @param end The index of the end of the array.\n */\n subarray(begin: number, end?: number): Uint8Array;\n\n /**\n * Converts a number to a string by using the current locale.\n */\n toLocaleString(): string;\n\n /**\n * Returns a string representation of an array.\n */\n toString(): string;\n\n [index: number]: number;\n}\n\ninterface Uint8ArrayConstructor {\n readonly prototype: Uint8Array;\n new (length: number): Uint8Array;\n new (array: ArrayLike): Uint8Array;\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array;\n\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * Returns a new array from a set of elements.\n * @param items A set of elements to include in the new array object.\n */\n of(...items: number[]): Uint8Array;\n\n /**\n * Creates an array from an array-like or iterable object.\n * @param arrayLike An array-like or iterable object to convert to an array.\n * @param mapfn A mapping function to call on every element of the array.\n * @param thisArg Value of 'this' used to invoke the mapfn.\n */\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array;\n\n}\ndeclare const Uint8Array: Uint8ArrayConstructor;\n\n/**\n * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0.\n * If the requested number of bytes could not be allocated an exception is raised.\n */\ninterface Uint8ClampedArray {\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * The ArrayBuffer instance referenced by the array.\n */\n readonly buffer: ArrayBuffer;\n\n /**\n * The length in bytes of the array.\n */\n readonly byteLength: number;\n\n /**\n * The offset in bytes of the array.\n */\n readonly byteOffset: number;\n\n /**\n * Returns the this object after copying a section of the array identified by start and end\n * to the same array starting at position target\n * @param target If target is negative, it is treated as length+target where length is the\n * length of the array.\n * @param start If start is negative, it is treated as length+start. If end is negative, it\n * is treated as length+end.\n * @param end If not specified, length of the this object is used as its default value.\n */\n copyWithin(target: number, start: number, end?: number): this;\n\n /**\n * Determines whether all the members of an array satisfy the specified test.\n * @param callbackfn A function that accepts up to three arguments. The every method calls\n * the callbackfn function for each element in array1 until the callbackfn returns false,\n * or until the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean;\n\n /**\n * Returns the this object after filling the section identified by start and end with value\n * @param value value to fill array section with\n * @param start index to start filling the array at. If start is negative, it is treated as\n * length+start where length is the length of the array.\n * @param end index to stop filling the array at. If end is negative, it is treated as\n * length+end.\n */\n fill(value: number, start?: number, end?: number): this;\n\n /**\n * Returns the elements of an array that meet the condition specified in a callback function.\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\n * the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => any, thisArg?: any): Uint8ClampedArray;\n\n /**\n * Returns the value of the first element in the array where predicate is true, and undefined\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found, find\n * immediately returns that element value. Otherwise, find returns undefined.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\n\n /**\n * Returns the index of the first element in the array where predicate is true, and -1\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found,\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number;\n\n /**\n * Performs the specified action for each element in an array.\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void;\n\n /**\n * Returns the index of the first occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n indexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * Adds all the elements of an array separated by the specified separator string.\n * @param separator A string used to separate one element of an array from the next in the\n * resulting String. If omitted, the array elements are separated with a comma.\n */\n join(separator?: string): string;\n\n /**\n * Returns the index of the last occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * The length of the array.\n */\n readonly length: number;\n\n /**\n * Calls a defined callback function on each element of an array, and returns an array that\n * contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an\n * argument instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U;\n\n /**\n * Reverses the elements in an Array.\n */\n reverse(): Uint8ClampedArray;\n\n /**\n * Sets a value or an array of values.\n * @param index The index of the location to set.\n * @param value The value to set.\n */\n set(index: number, value: number): void;\n\n /**\n * Sets a value or an array of values.\n * @param array A typed or untyped array of values to set.\n * @param offset The index in the current array at which the values are to be written.\n */\n set(array: Uint8ClampedArray, offset?: number): void;\n\n /**\n * Returns a section of an array.\n * @param start The beginning of the specified portion of the array.\n * @param end The end of the specified portion of the array.\n */\n slice(start?: number, end?: number): Uint8ClampedArray;\n\n /**\n * Determines whether the specified callback function returns true for any element of an array.\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\n * the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean;\n\n /**\n * Sorts an array.\n * @param compareFn The name of the function used to determine the order of the elements. If\n * omitted, the elements are sorted in ascending, ASCII character order.\n */\n sort(compareFn?: (a: number, b: number) => number): this;\n\n /**\n * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements\n * at begin, inclusive, up to end, exclusive.\n * @param begin The index of the beginning of the array.\n * @param end The index of the end of the array.\n */\n subarray(begin: number, end?: number): Uint8ClampedArray;\n\n /**\n * Converts a number to a string by using the current locale.\n */\n toLocaleString(): string;\n\n /**\n * Returns a string representation of an array.\n */\n toString(): string;\n\n [index: number]: number;\n}\n\ninterface Uint8ClampedArrayConstructor {\n readonly prototype: Uint8ClampedArray;\n new (length: number): Uint8ClampedArray;\n new (array: ArrayLike): Uint8ClampedArray;\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray;\n\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * Returns a new array from a set of elements.\n * @param items A set of elements to include in the new array object.\n */\n of(...items: number[]): Uint8ClampedArray;\n\n /**\n * Creates an array from an array-like or iterable object.\n * @param arrayLike An array-like or iterable object to convert to an array.\n * @param mapfn A mapping function to call on every element of the array.\n * @param thisArg Value of 'this' used to invoke the mapfn.\n */\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray;\n}\ndeclare const Uint8ClampedArray: Uint8ClampedArrayConstructor;\n\n/**\n * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the\n * requested number of bytes could not be allocated an exception is raised.\n */\ninterface Int16Array {\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * The ArrayBuffer instance referenced by the array.\n */\n readonly buffer: ArrayBuffer;\n\n /**\n * The length in bytes of the array.\n */\n readonly byteLength: number;\n\n /**\n * The offset in bytes of the array.\n */\n readonly byteOffset: number;\n\n /**\n * Returns the this object after copying a section of the array identified by start and end\n * to the same array starting at position target\n * @param target If target is negative, it is treated as length+target where length is the\n * length of the array.\n * @param start If start is negative, it is treated as length+start. If end is negative, it\n * is treated as length+end.\n * @param end If not specified, length of the this object is used as its default value.\n */\n copyWithin(target: number, start: number, end?: number): this;\n\n /**\n * Determines whether all the members of an array satisfy the specified test.\n * @param callbackfn A function that accepts up to three arguments. The every method calls\n * the callbackfn function for each element in array1 until the callbackfn returns false,\n * or until the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean;\n\n /**\n * Returns the this object after filling the section identified by start and end with value\n * @param value value to fill array section with\n * @param start index to start filling the array at. If start is negative, it is treated as\n * length+start where length is the length of the array.\n * @param end index to stop filling the array at. If end is negative, it is treated as\n * length+end.\n */\n fill(value: number, start?: number, end?: number): this;\n\n /**\n * Returns the elements of an array that meet the condition specified in a callback function.\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\n * the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n filter(callbackfn: (value: number, index: number, array: Int16Array) => any, thisArg?: any): Int16Array;\n\n /**\n * Returns the value of the first element in the array where predicate is true, and undefined\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found, find\n * immediately returns that element value. Otherwise, find returns undefined.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\n\n /**\n * Returns the index of the first element in the array where predicate is true, and -1\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found,\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number;\n\n /**\n * Performs the specified action for each element in an array.\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void;\n\n /**\n * Returns the index of the first occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n indexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * Adds all the elements of an array separated by the specified separator string.\n * @param separator A string used to separate one element of an array from the next in the\n * resulting String. If omitted, the array elements are separated with a comma.\n */\n join(separator?: string): string;\n\n /**\n * Returns the index of the last occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * The length of the array.\n */\n readonly length: number;\n\n /**\n * Calls a defined callback function on each element of an array, and returns an array that\n * contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an\n * argument instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U;\n\n /**\n * Reverses the elements in an Array.\n */\n reverse(): Int16Array;\n\n /**\n * Sets a value or an array of values.\n * @param index The index of the location to set.\n * @param value The value to set.\n */\n set(index: number, value: number): void;\n\n /**\n * Sets a value or an array of values.\n * @param array A typed or untyped array of values to set.\n * @param offset The index in the current array at which the values are to be written.\n */\n set(array: ArrayLike, offset?: number): void;\n\n /**\n * Returns a section of an array.\n * @param start The beginning of the specified portion of the array.\n * @param end The end of the specified portion of the array.\n */\n slice(start?: number, end?: number): Int16Array;\n\n /**\n * Determines whether the specified callback function returns true for any element of an array.\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\n * the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean;\n\n /**\n * Sorts an array.\n * @param compareFn The name of the function used to determine the order of the elements. If\n * omitted, the elements are sorted in ascending, ASCII character order.\n */\n sort(compareFn?: (a: number, b: number) => number): this;\n\n /**\n * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements\n * at begin, inclusive, up to end, exclusive.\n * @param begin The index of the beginning of the array.\n * @param end The index of the end of the array.\n */\n subarray(begin: number, end?: number): Int16Array;\n\n /**\n * Converts a number to a string by using the current locale.\n */\n toLocaleString(): string;\n\n /**\n * Returns a string representation of an array.\n */\n toString(): string;\n\n [index: number]: number;\n}\n\ninterface Int16ArrayConstructor {\n readonly prototype: Int16Array;\n new (length: number): Int16Array;\n new (array: ArrayLike): Int16Array;\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array;\n\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * Returns a new array from a set of elements.\n * @param items A set of elements to include in the new array object.\n */\n of(...items: number[]): Int16Array;\n\n /**\n * Creates an array from an array-like or iterable object.\n * @param arrayLike An array-like or iterable object to convert to an array.\n * @param mapfn A mapping function to call on every element of the array.\n * @param thisArg Value of 'this' used to invoke the mapfn.\n */\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array;\n\n}\ndeclare const Int16Array: Int16ArrayConstructor;\n\n/**\n * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the\n * requested number of bytes could not be allocated an exception is raised.\n */\ninterface Uint16Array {\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * The ArrayBuffer instance referenced by the array.\n */\n readonly buffer: ArrayBuffer;\n\n /**\n * The length in bytes of the array.\n */\n readonly byteLength: number;\n\n /**\n * The offset in bytes of the array.\n */\n readonly byteOffset: number;\n\n /**\n * Returns the this object after copying a section of the array identified by start and end\n * to the same array starting at position target\n * @param target If target is negative, it is treated as length+target where length is the\n * length of the array.\n * @param start If start is negative, it is treated as length+start. If end is negative, it\n * is treated as length+end.\n * @param end If not specified, length of the this object is used as its default value.\n */\n copyWithin(target: number, start: number, end?: number): this;\n\n /**\n * Determines whether all the members of an array satisfy the specified test.\n * @param callbackfn A function that accepts up to three arguments. The every method calls\n * the callbackfn function for each element in array1 until the callbackfn returns false,\n * or until the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean;\n\n /**\n * Returns the this object after filling the section identified by start and end with value\n * @param value value to fill array section with\n * @param start index to start filling the array at. If start is negative, it is treated as\n * length+start where length is the length of the array.\n * @param end index to stop filling the array at. If end is negative, it is treated as\n * length+end.\n */\n fill(value: number, start?: number, end?: number): this;\n\n /**\n * Returns the elements of an array that meet the condition specified in a callback function.\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\n * the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n filter(callbackfn: (value: number, index: number, array: Uint16Array) => any, thisArg?: any): Uint16Array;\n\n /**\n * Returns the value of the first element in the array where predicate is true, and undefined\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found, find\n * immediately returns that element value. Otherwise, find returns undefined.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\n\n /**\n * Returns the index of the first element in the array where predicate is true, and -1\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found,\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number;\n\n /**\n * Performs the specified action for each element in an array.\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void;\n\n /**\n * Returns the index of the first occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n indexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * Adds all the elements of an array separated by the specified separator string.\n * @param separator A string used to separate one element of an array from the next in the\n * resulting String. If omitted, the array elements are separated with a comma.\n */\n join(separator?: string): string;\n\n /**\n * Returns the index of the last occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * The length of the array.\n */\n readonly length: number;\n\n /**\n * Calls a defined callback function on each element of an array, and returns an array that\n * contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an\n * argument instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U;\n\n /**\n * Reverses the elements in an Array.\n */\n reverse(): Uint16Array;\n\n /**\n * Sets a value or an array of values.\n * @param index The index of the location to set.\n * @param value The value to set.\n */\n set(index: number, value: number): void;\n\n /**\n * Sets a value or an array of values.\n * @param array A typed or untyped array of values to set.\n * @param offset The index in the current array at which the values are to be written.\n */\n set(array: ArrayLike, offset?: number): void;\n\n /**\n * Returns a section of an array.\n * @param start The beginning of the specified portion of the array.\n * @param end The end of the specified portion of the array.\n */\n slice(start?: number, end?: number): Uint16Array;\n\n /**\n * Determines whether the specified callback function returns true for any element of an array.\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\n * the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean;\n\n /**\n * Sorts an array.\n * @param compareFn The name of the function used to determine the order of the elements. If\n * omitted, the elements are sorted in ascending, ASCII character order.\n */\n sort(compareFn?: (a: number, b: number) => number): this;\n\n /**\n * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements\n * at begin, inclusive, up to end, exclusive.\n * @param begin The index of the beginning of the array.\n * @param end The index of the end of the array.\n */\n subarray(begin: number, end?: number): Uint16Array;\n\n /**\n * Converts a number to a string by using the current locale.\n */\n toLocaleString(): string;\n\n /**\n * Returns a string representation of an array.\n */\n toString(): string;\n\n [index: number]: number;\n}\n\ninterface Uint16ArrayConstructor {\n readonly prototype: Uint16Array;\n new (length: number): Uint16Array;\n new (array: ArrayLike): Uint16Array;\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array;\n\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * Returns a new array from a set of elements.\n * @param items A set of elements to include in the new array object.\n */\n of(...items: number[]): Uint16Array;\n\n /**\n * Creates an array from an array-like or iterable object.\n * @param arrayLike An array-like or iterable object to convert to an array.\n * @param mapfn A mapping function to call on every element of the array.\n * @param thisArg Value of 'this' used to invoke the mapfn.\n */\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array;\n\n}\ndeclare const Uint16Array: Uint16ArrayConstructor;\n/**\n * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the\n * requested number of bytes could not be allocated an exception is raised.\n */\ninterface Int32Array {\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * The ArrayBuffer instance referenced by the array.\n */\n readonly buffer: ArrayBuffer;\n\n /**\n * The length in bytes of the array.\n */\n readonly byteLength: number;\n\n /**\n * The offset in bytes of the array.\n */\n readonly byteOffset: number;\n\n /**\n * Returns the this object after copying a section of the array identified by start and end\n * to the same array starting at position target\n * @param target If target is negative, it is treated as length+target where length is the\n * length of the array.\n * @param start If start is negative, it is treated as length+start. If end is negative, it\n * is treated as length+end.\n * @param end If not specified, length of the this object is used as its default value.\n */\n copyWithin(target: number, start: number, end?: number): this;\n\n /**\n * Determines whether all the members of an array satisfy the specified test.\n * @param callbackfn A function that accepts up to three arguments. The every method calls\n * the callbackfn function for each element in array1 until the callbackfn returns false,\n * or until the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean;\n\n /**\n * Returns the this object after filling the section identified by start and end with value\n * @param value value to fill array section with\n * @param start index to start filling the array at. If start is negative, it is treated as\n * length+start where length is the length of the array.\n * @param end index to stop filling the array at. If end is negative, it is treated as\n * length+end.\n */\n fill(value: number, start?: number, end?: number): this;\n\n /**\n * Returns the elements of an array that meet the condition specified in a callback function.\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\n * the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n filter(callbackfn: (value: number, index: number, array: Int32Array) => any, thisArg?: any): Int32Array;\n\n /**\n * Returns the value of the first element in the array where predicate is true, and undefined\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found, find\n * immediately returns that element value. Otherwise, find returns undefined.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\n\n /**\n * Returns the index of the first element in the array where predicate is true, and -1\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found,\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number;\n\n /**\n * Performs the specified action for each element in an array.\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void;\n\n /**\n * Returns the index of the first occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n indexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * Adds all the elements of an array separated by the specified separator string.\n * @param separator A string used to separate one element of an array from the next in the\n * resulting String. If omitted, the array elements are separated with a comma.\n */\n join(separator?: string): string;\n\n /**\n * Returns the index of the last occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * The length of the array.\n */\n readonly length: number;\n\n /**\n * Calls a defined callback function on each element of an array, and returns an array that\n * contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an\n * argument instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U;\n\n /**\n * Reverses the elements in an Array.\n */\n reverse(): Int32Array;\n\n /**\n * Sets a value or an array of values.\n * @param index The index of the location to set.\n * @param value The value to set.\n */\n set(index: number, value: number): void;\n\n /**\n * Sets a value or an array of values.\n * @param array A typed or untyped array of values to set.\n * @param offset The index in the current array at which the values are to be written.\n */\n set(array: ArrayLike, offset?: number): void;\n\n /**\n * Returns a section of an array.\n * @param start The beginning of the specified portion of the array.\n * @param end The end of the specified portion of the array.\n */\n slice(start?: number, end?: number): Int32Array;\n\n /**\n * Determines whether the specified callback function returns true for any element of an array.\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\n * the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean;\n\n /**\n * Sorts an array.\n * @param compareFn The name of the function used to determine the order of the elements. If\n * omitted, the elements are sorted in ascending, ASCII character order.\n */\n sort(compareFn?: (a: number, b: number) => number): this;\n\n /**\n * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements\n * at begin, inclusive, up to end, exclusive.\n * @param begin The index of the beginning of the array.\n * @param end The index of the end of the array.\n */\n subarray(begin: number, end?: number): Int32Array;\n\n /**\n * Converts a number to a string by using the current locale.\n */\n toLocaleString(): string;\n\n /**\n * Returns a string representation of an array.\n */\n toString(): string;\n\n [index: number]: number;\n}\n\ninterface Int32ArrayConstructor {\n readonly prototype: Int32Array;\n new (length: number): Int32Array;\n new (array: ArrayLike): Int32Array;\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array;\n\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * Returns a new array from a set of elements.\n * @param items A set of elements to include in the new array object.\n */\n of(...items: number[]): Int32Array;\n\n /**\n * Creates an array from an array-like or iterable object.\n * @param arrayLike An array-like or iterable object to convert to an array.\n * @param mapfn A mapping function to call on every element of the array.\n * @param thisArg Value of 'this' used to invoke the mapfn.\n */\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array;\n}\ndeclare const Int32Array: Int32ArrayConstructor;\n\n/**\n * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the\n * requested number of bytes could not be allocated an exception is raised.\n */\ninterface Uint32Array {\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * The ArrayBuffer instance referenced by the array.\n */\n readonly buffer: ArrayBuffer;\n\n /**\n * The length in bytes of the array.\n */\n readonly byteLength: number;\n\n /**\n * The offset in bytes of the array.\n */\n readonly byteOffset: number;\n\n /**\n * Returns the this object after copying a section of the array identified by start and end\n * to the same array starting at position target\n * @param target If target is negative, it is treated as length+target where length is the\n * length of the array.\n * @param start If start is negative, it is treated as length+start. If end is negative, it\n * is treated as length+end.\n * @param end If not specified, length of the this object is used as its default value.\n */\n copyWithin(target: number, start: number, end?: number): this;\n\n /**\n * Determines whether all the members of an array satisfy the specified test.\n * @param callbackfn A function that accepts up to three arguments. The every method calls\n * the callbackfn function for each element in array1 until the callbackfn returns false,\n * or until the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean;\n\n /**\n * Returns the this object after filling the section identified by start and end with value\n * @param value value to fill array section with\n * @param start index to start filling the array at. If start is negative, it is treated as\n * length+start where length is the length of the array.\n * @param end index to stop filling the array at. If end is negative, it is treated as\n * length+end.\n */\n fill(value: number, start?: number, end?: number): this;\n\n /**\n * Returns the elements of an array that meet the condition specified in a callback function.\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\n * the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n filter(callbackfn: (value: number, index: number, array: Uint32Array) => any, thisArg?: any): Uint32Array;\n\n /**\n * Returns the value of the first element in the array where predicate is true, and undefined\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found, find\n * immediately returns that element value. Otherwise, find returns undefined.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\n\n /**\n * Returns the index of the first element in the array where predicate is true, and -1\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found,\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number;\n\n /**\n * Performs the specified action for each element in an array.\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void;\n\n /**\n * Returns the index of the first occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n indexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * Adds all the elements of an array separated by the specified separator string.\n * @param separator A string used to separate one element of an array from the next in the\n * resulting String. If omitted, the array elements are separated with a comma.\n */\n join(separator?: string): string;\n\n /**\n * Returns the index of the last occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * The length of the array.\n */\n readonly length: number;\n\n /**\n * Calls a defined callback function on each element of an array, and returns an array that\n * contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an\n * argument instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U;\n\n /**\n * Reverses the elements in an Array.\n */\n reverse(): Uint32Array;\n\n /**\n * Sets a value or an array of values.\n * @param index The index of the location to set.\n * @param value The value to set.\n */\n set(index: number, value: number): void;\n\n /**\n * Sets a value or an array of values.\n * @param array A typed or untyped array of values to set.\n * @param offset The index in the current array at which the values are to be written.\n */\n set(array: ArrayLike, offset?: number): void;\n\n /**\n * Returns a section of an array.\n * @param start The beginning of the specified portion of the array.\n * @param end The end of the specified portion of the array.\n */\n slice(start?: number, end?: number): Uint32Array;\n\n /**\n * Determines whether the specified callback function returns true for any element of an array.\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\n * the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean;\n\n /**\n * Sorts an array.\n * @param compareFn The name of the function used to determine the order of the elements. If\n * omitted, the elements are sorted in ascending, ASCII character order.\n */\n sort(compareFn?: (a: number, b: number) => number): this;\n\n /**\n * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements\n * at begin, inclusive, up to end, exclusive.\n * @param begin The index of the beginning of the array.\n * @param end The index of the end of the array.\n */\n subarray(begin: number, end?: number): Uint32Array;\n\n /**\n * Converts a number to a string by using the current locale.\n */\n toLocaleString(): string;\n\n /**\n * Returns a string representation of an array.\n */\n toString(): string;\n\n [index: number]: number;\n}\n\ninterface Uint32ArrayConstructor {\n readonly prototype: Uint32Array;\n new (length: number): Uint32Array;\n new (array: ArrayLike): Uint32Array;\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array;\n\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * Returns a new array from a set of elements.\n * @param items A set of elements to include in the new array object.\n */\n of(...items: number[]): Uint32Array;\n\n /**\n * Creates an array from an array-like or iterable object.\n * @param arrayLike An array-like or iterable object to convert to an array.\n * @param mapfn A mapping function to call on every element of the array.\n * @param thisArg Value of 'this' used to invoke the mapfn.\n */\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array;\n}\ndeclare const Uint32Array: Uint32ArrayConstructor;\n\n/**\n * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number\n * of bytes could not be allocated an exception is raised.\n */\ninterface Float32Array {\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * The ArrayBuffer instance referenced by the array.\n */\n readonly buffer: ArrayBuffer;\n\n /**\n * The length in bytes of the array.\n */\n readonly byteLength: number;\n\n /**\n * The offset in bytes of the array.\n */\n readonly byteOffset: number;\n\n /**\n * Returns the this object after copying a section of the array identified by start and end\n * to the same array starting at position target\n * @param target If target is negative, it is treated as length+target where length is the\n * length of the array.\n * @param start If start is negative, it is treated as length+start. If end is negative, it\n * is treated as length+end.\n * @param end If not specified, length of the this object is used as its default value.\n */\n copyWithin(target: number, start: number, end?: number): this;\n\n /**\n * Determines whether all the members of an array satisfy the specified test.\n * @param callbackfn A function that accepts up to three arguments. The every method calls\n * the callbackfn function for each element in array1 until the callbackfn returns false,\n * or until the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean;\n\n /**\n * Returns the this object after filling the section identified by start and end with value\n * @param value value to fill array section with\n * @param start index to start filling the array at. If start is negative, it is treated as\n * length+start where length is the length of the array.\n * @param end index to stop filling the array at. If end is negative, it is treated as\n * length+end.\n */\n fill(value: number, start?: number, end?: number): this;\n\n /**\n * Returns the elements of an array that meet the condition specified in a callback function.\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\n * the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n filter(callbackfn: (value: number, index: number, array: Float32Array) => any, thisArg?: any): Float32Array;\n\n /**\n * Returns the value of the first element in the array where predicate is true, and undefined\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found, find\n * immediately returns that element value. Otherwise, find returns undefined.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\n\n /**\n * Returns the index of the first element in the array where predicate is true, and -1\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found,\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number;\n\n /**\n * Performs the specified action for each element in an array.\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void;\n\n /**\n * Returns the index of the first occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n indexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * Adds all the elements of an array separated by the specified separator string.\n * @param separator A string used to separate one element of an array from the next in the\n * resulting String. If omitted, the array elements are separated with a comma.\n */\n join(separator?: string): string;\n\n /**\n * Returns the index of the last occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * The length of the array.\n */\n readonly length: number;\n\n /**\n * Calls a defined callback function on each element of an array, and returns an array that\n * contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an\n * argument instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U;\n\n /**\n * Reverses the elements in an Array.\n */\n reverse(): Float32Array;\n\n /**\n * Sets a value or an array of values.\n * @param index The index of the location to set.\n * @param value The value to set.\n */\n set(index: number, value: number): void;\n\n /**\n * Sets a value or an array of values.\n * @param array A typed or untyped array of values to set.\n * @param offset The index in the current array at which the values are to be written.\n */\n set(array: ArrayLike, offset?: number): void;\n\n /**\n * Returns a section of an array.\n * @param start The beginning of the specified portion of the array.\n * @param end The end of the specified portion of the array.\n */\n slice(start?: number, end?: number): Float32Array;\n\n /**\n * Determines whether the specified callback function returns true for any element of an array.\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\n * the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean;\n\n /**\n * Sorts an array.\n * @param compareFn The name of the function used to determine the order of the elements. If\n * omitted, the elements are sorted in ascending, ASCII character order.\n */\n sort(compareFn?: (a: number, b: number) => number): this;\n\n /**\n * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements\n * at begin, inclusive, up to end, exclusive.\n * @param begin The index of the beginning of the array.\n * @param end The index of the end of the array.\n */\n subarray(begin: number, end?: number): Float32Array;\n\n /**\n * Converts a number to a string by using the current locale.\n */\n toLocaleString(): string;\n\n /**\n * Returns a string representation of an array.\n */\n toString(): string;\n\n [index: number]: number;\n}\n\ninterface Float32ArrayConstructor {\n readonly prototype: Float32Array;\n new (length: number): Float32Array;\n new (array: ArrayLike): Float32Array;\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array;\n\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * Returns a new array from a set of elements.\n * @param items A set of elements to include in the new array object.\n */\n of(...items: number[]): Float32Array;\n\n /**\n * Creates an array from an array-like or iterable object.\n * @param arrayLike An array-like or iterable object to convert to an array.\n * @param mapfn A mapping function to call on every element of the array.\n * @param thisArg Value of 'this' used to invoke the mapfn.\n */\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array;\n\n}\ndeclare const Float32Array: Float32ArrayConstructor;\n\n/**\n * A typed array of 64-bit float values. The contents are initialized to 0. If the requested\n * number of bytes could not be allocated an exception is raised.\n */\ninterface Float64Array {\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * The ArrayBuffer instance referenced by the array.\n */\n readonly buffer: ArrayBuffer;\n\n /**\n * The length in bytes of the array.\n */\n readonly byteLength: number;\n\n /**\n * The offset in bytes of the array.\n */\n readonly byteOffset: number;\n\n /**\n * Returns the this object after copying a section of the array identified by start and end\n * to the same array starting at position target\n * @param target If target is negative, it is treated as length+target where length is the\n * length of the array.\n * @param start If start is negative, it is treated as length+start. If end is negative, it\n * is treated as length+end.\n * @param end If not specified, length of the this object is used as its default value.\n */\n copyWithin(target: number, start: number, end?: number): this;\n\n /**\n * Determines whether all the members of an array satisfy the specified test.\n * @param callbackfn A function that accepts up to three arguments. The every method calls\n * the callbackfn function for each element in array1 until the callbackfn returns false,\n * or until the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean;\n\n /**\n * Returns the this object after filling the section identified by start and end with value\n * @param value value to fill array section with\n * @param start index to start filling the array at. If start is negative, it is treated as\n * length+start where length is the length of the array.\n * @param end index to stop filling the array at. If end is negative, it is treated as\n * length+end.\n */\n fill(value: number, start?: number, end?: number): this;\n\n /**\n * Returns the elements of an array that meet the condition specified in a callback function.\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\n * the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n filter(callbackfn: (value: number, index: number, array: Float64Array) => any, thisArg?: any): Float64Array;\n\n /**\n * Returns the value of the first element in the array where predicate is true, and undefined\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found, find\n * immediately returns that element value. Otherwise, find returns undefined.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\n\n /**\n * Returns the index of the first element in the array where predicate is true, and -1\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found,\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number;\n\n /**\n * Performs the specified action for each element in an array.\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void;\n\n /**\n * Returns the index of the first occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n indexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * Adds all the elements of an array separated by the specified separator string.\n * @param separator A string used to separate one element of an array from the next in the\n * resulting String. If omitted, the array elements are separated with a comma.\n */\n join(separator?: string): string;\n\n /**\n * Returns the index of the last occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * The length of the array.\n */\n readonly length: number;\n\n /**\n * Calls a defined callback function on each element of an array, and returns an array that\n * contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an\n * argument instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U;\n\n /**\n * Reverses the elements in an Array.\n */\n reverse(): Float64Array;\n\n /**\n * Sets a value or an array of values.\n * @param index The index of the location to set.\n * @param value The value to set.\n */\n set(index: number, value: number): void;\n\n /**\n * Sets a value or an array of values.\n * @param array A typed or untyped array of values to set.\n * @param offset The index in the current array at which the values are to be written.\n */\n set(array: ArrayLike, offset?: number): void;\n\n /**\n * Returns a section of an array.\n * @param start The beginning of the specified portion of the array.\n * @param end The end of the specified portion of the array.\n */\n slice(start?: number, end?: number): Float64Array;\n\n /**\n * Determines whether the specified callback function returns true for any element of an array.\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\n * the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean;\n\n /**\n * Sorts an array.\n * @param compareFn The name of the function used to determine the order of the elements. If\n * omitted, the elements are sorted in ascending, ASCII character order.\n */\n sort(compareFn?: (a: number, b: number) => number): this;\n\n /**\n * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements\n * at begin, inclusive, up to end, exclusive.\n * @param begin The index of the beginning of the array.\n * @param end The index of the end of the array.\n */\n subarray(begin: number, end?: number): Float64Array;\n\n /**\n * Converts a number to a string by using the current locale.\n */\n toLocaleString(): string;\n\n /**\n * Returns a string representation of an array.\n */\n toString(): string;\n\n [index: number]: number;\n}\n\ninterface Float64ArrayConstructor {\n readonly prototype: Float64Array;\n new (length: number): Float64Array;\n new (array: ArrayLike): Float64Array;\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array;\n\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * Returns a new array from a set of elements.\n * @param items A set of elements to include in the new array object.\n */\n of(...items: number[]): Float64Array;\n\n /**\n * Creates an array from an array-like or iterable object.\n * @param arrayLike An array-like or iterable object to convert to an array.\n * @param mapfn A mapping function to call on every element of the array.\n * @param thisArg Value of 'this' used to invoke the mapfn.\n */\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array;\n}\ndeclare const Float64Array: Float64ArrayConstructor;\n\n/////////////////////////////\n/// ECMAScript Internationalization API\n/////////////////////////////\n\ndeclare module Intl {\n interface CollatorOptions {\n usage?: string;\n localeMatcher?: string;\n numeric?: boolean;\n caseFirst?: string;\n sensitivity?: string;\n ignorePunctuation?: boolean;\n }\n\n interface ResolvedCollatorOptions {\n locale: string;\n usage: string;\n sensitivity: string;\n ignorePunctuation: boolean;\n collation: string;\n caseFirst: string;\n numeric: boolean;\n }\n\n interface Collator {\n compare(x: string, y: string): number;\n resolvedOptions(): ResolvedCollatorOptions;\n }\n var Collator: {\n new (locales?: string | string[], options?: CollatorOptions): Collator;\n (locales?: string | string[], options?: CollatorOptions): Collator;\n supportedLocalesOf(locales: string | string[], options?: CollatorOptions): string[];\n }\n\n interface NumberFormatOptions {\n localeMatcher?: string;\n style?: string;\n currency?: string;\n currencyDisplay?: string;\n useGrouping?: boolean;\n minimumIntegerDigits?: number;\n minimumFractionDigits?: number;\n maximumFractionDigits?: number;\n minimumSignificantDigits?: number;\n maximumSignificantDigits?: number;\n }\n\n interface ResolvedNumberFormatOptions {\n locale: string;\n numberingSystem: string;\n style: string;\n currency?: string;\n currencyDisplay?: string;\n minimumIntegerDigits: number;\n minimumFractionDigits: number;\n maximumFractionDigits: number;\n minimumSignificantDigits?: number;\n maximumSignificantDigits?: number;\n useGrouping: boolean;\n }\n\n interface NumberFormat {\n format(value: number): string;\n resolvedOptions(): ResolvedNumberFormatOptions;\n }\n var NumberFormat: {\n new (locales?: string | string[], options?: NumberFormatOptions): NumberFormat;\n (locales?: string | string[], options?: NumberFormatOptions): NumberFormat;\n supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[];\n }\n\n interface DateTimeFormatOptions {\n localeMatcher?: string;\n weekday?: string;\n era?: string;\n year?: string;\n month?: string;\n day?: string;\n hour?: string;\n minute?: string;\n second?: string;\n timeZoneName?: string;\n formatMatcher?: string;\n hour12?: boolean;\n timeZone?: string;\n }\n\n interface ResolvedDateTimeFormatOptions {\n locale: string;\n calendar: string;\n numberingSystem: string;\n timeZone: string;\n hour12?: boolean;\n weekday?: string;\n era?: string;\n year?: string;\n month?: string;\n day?: string;\n hour?: string;\n minute?: string;\n second?: string;\n timeZoneName?: string;\n }\n\n interface DateTimeFormat {\n format(date?: Date | number): string;\n resolvedOptions(): ResolvedDateTimeFormatOptions;\n }\n var DateTimeFormat: {\n new (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat;\n (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat;\n supportedLocalesOf(locales: string | string[], options?: DateTimeFormatOptions): string[];\n }\n}\n\ninterface String {\n /**\n * Determines whether two strings are equivalent in the current or specified locale.\n * @param that String to compare to target string\n * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.\n * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details.\n */\n localeCompare(that: string, locales?: string | string[], options?: Intl.CollatorOptions): number;\n}\n\ninterface Number {\n /**\n * Converts a number to a string by using the current or specified locale.\n * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.\n * @param options An object that contains one or more properties that specify comparison options.\n */\n toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string;\n}\n\ninterface Date {\n /**\n * Converts a date and time to a string by using the current or specified locale.\n * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.\n * @param options An object that contains one or more properties that specify comparison options.\n */\n toLocaleString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string;\n /**\n * Converts a date to a string by using the current or specified locale.\n * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.\n * @param options An object that contains one or more properties that specify comparison options.\n */\n toLocaleDateString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string;\n\n /**\n * Converts a time to a string by using the current or specified locale.\n * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.\n * @param options An object that contains one or more properties that specify comparison options.\n */\n toLocaleTimeString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string;\n}\n\n\ndeclare type PropertyKey = string | number | symbol;\n\ninterface Array {\n /**\n * Returns the value of the first element in the array where predicate is true, and undefined\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found, find\n * immediately returns that element value. Otherwise, find returns undefined.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T | undefined;\n\n /**\n * Returns the index of the first element in the array where predicate is true, and -1\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found,\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n findIndex(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): number;\n\n /**\n * Returns the this object after filling the section identified by start and end with value\n * @param value value to fill array section with\n * @param start index to start filling the array at. If start is negative, it is treated as\n * length+start where length is the length of the array.\n * @param end index to stop filling the array at. If end is negative, it is treated as\n * length+end.\n */\n fill(value: T, start?: number, end?: number): this;\n\n /**\n * Returns the this object after copying a section of the array identified by start and end\n * to the same array starting at position target\n * @param target If target is negative, it is treated as length+target where length is the\n * length of the array.\n * @param start If start is negative, it is treated as length+start. If end is negative, it\n * is treated as length+end.\n * @param end If not specified, length of the this object is used as its default value.\n */\n copyWithin(target: number, start: number, end?: number): this;\n}\n\ninterface ArrayConstructor {\n /**\n * Creates an array from an array-like object.\n * @param arrayLike An array-like object to convert to an array.\n * @param mapfn A mapping function to call on every element of the array.\n * @param thisArg Value of 'this' used to invoke the mapfn.\n */\n from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array;\n\n\n /**\n * Creates an array from an array-like object.\n * @param arrayLike An array-like object to convert to an array.\n */\n from(arrayLike: ArrayLike): Array;\n\n /**\n * Returns a new array from a set of elements.\n * @param items A set of elements to include in the new array object.\n */\n of(...items: T[]): Array;\n}\n\ninterface DateConstructor {\n new (value: Date): Date;\n}\n\ninterface Function {\n /**\n * Returns the name of the function. Function names are read-only and can not be changed.\n */\n readonly name: string;\n}\n\ninterface Math {\n /**\n * Returns the number of leading zero bits in the 32-bit binary representation of a number.\n * @param x A numeric expression.\n */\n clz32(x: number): number;\n\n /**\n * Returns the result of 32-bit multiplication of two numbers.\n * @param x First number\n * @param y Second number\n */\n imul(x: number, y: number): number;\n\n /**\n * Returns the sign of the x, indicating whether x is positive, negative or zero.\n * @param x The numeric expression to test\n */\n sign(x: number): number;\n\n /**\n * Returns the base 10 logarithm of a number.\n * @param x A numeric expression.\n */\n log10(x: number): number;\n\n /**\n * Returns the base 2 logarithm of a number.\n * @param x A numeric expression.\n */\n log2(x: number): number;\n\n /**\n * Returns the natural logarithm of 1 + x.\n * @param x A numeric expression.\n */\n log1p(x: number): number;\n\n /**\n * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of\n * the natural logarithms).\n * @param x A numeric expression.\n */\n expm1(x: number): number;\n\n /**\n * Returns the hyperbolic cosine of a number.\n * @param x A numeric expression that contains an angle measured in radians.\n */\n cosh(x: number): number;\n\n /**\n * Returns the hyperbolic sine of a number.\n * @param x A numeric expression that contains an angle measured in radians.\n */\n sinh(x: number): number;\n\n /**\n * Returns the hyperbolic tangent of a number.\n * @param x A numeric expression that contains an angle measured in radians.\n */\n tanh(x: number): number;\n\n /**\n * Returns the inverse hyperbolic cosine of a number.\n * @param x A numeric expression that contains an angle measured in radians.\n */\n acosh(x: number): number;\n\n /**\n * Returns the inverse hyperbolic sine of a number.\n * @param x A numeric expression that contains an angle measured in radians.\n */\n asinh(x: number): number;\n\n /**\n * Returns the inverse hyperbolic tangent of a number.\n * @param x A numeric expression that contains an angle measured in radians.\n */\n atanh(x: number): number;\n\n /**\n * Returns the square root of the sum of squares of its arguments.\n * @param values Values to compute the square root for.\n * If no arguments are passed, the result is +0.\n * If there is only one argument, the result is the absolute value.\n * If any argument is +Infinity or -Infinity, the result is +Infinity.\n * If any argument is NaN, the result is NaN.\n * If all arguments are either +0 or −0, the result is +0.\n */\n hypot(...values: number[] ): number;\n\n /**\n * Returns the integral part of the a numeric expression, x, removing any fractional digits.\n * If x is already an integer, the result is x.\n * @param x A numeric expression.\n */\n trunc(x: number): number;\n\n /**\n * Returns the nearest single precision float representation of a number.\n * @param x A numeric expression.\n */\n fround(x: number): number;\n\n /**\n * Returns an implementation-dependent approximation to the cube root of number.\n * @param x A numeric expression.\n */\n cbrt(x: number): number;\n}\n\ninterface NumberConstructor {\n /**\n * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1\n * that is representable as a Number value, which is approximately:\n * 2.2204460492503130808472633361816 x 10‍−‍16.\n */\n readonly EPSILON: number;\n\n /**\n * Returns true if passed value is finite.\n * Unlike the global isFinite, Number.isFinite doesn't forcibly convert the parameter to a\n * number. Only finite values of the type number, result in true.\n * @param number A numeric value.\n */\n isFinite(number: number): boolean;\n\n /**\n * Returns true if the value passed is an integer, false otherwise.\n * @param number A numeric value.\n */\n isInteger(number: number): boolean;\n\n /**\n * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a\n * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter\n * to a number. Only values of the type number, that are also NaN, result in true.\n * @param number A numeric value.\n */\n isNaN(number: number): boolean;\n\n /**\n * Returns true if the value passed is a safe integer.\n * @param number A numeric value.\n */\n isSafeInteger(number: number): boolean;\n\n /**\n * The value of the largest integer n such that n and n + 1 are both exactly representable as\n * a Number value.\n * The value of Number.MAX_SAFE_INTEGER is 9007199254740991 2^53 − 1.\n */\n readonly MAX_SAFE_INTEGER: number;\n\n /**\n * The value of the smallest integer n such that n and n − 1 are both exactly representable as\n * a Number value.\n * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)).\n */\n readonly MIN_SAFE_INTEGER: number;\n\n /**\n * Converts a string to a floating-point number.\n * @param string A string that contains a floating-point number.\n */\n parseFloat(string: string): number;\n\n /**\n * Converts A string to an integer.\n * @param s A string to convert into a number.\n * @param radix A value between 2 and 36 that specifies the base of the number in numString.\n * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\n * All other strings are considered decimal.\n */\n parseInt(string: string, radix?: number): number;\n}\n\ninterface Object {\n /**\n * Determines whether an object has a property with the specified name.\n * @param v A property name.\n */\n hasOwnProperty(v: PropertyKey): boolean\n\n /**\n * Determines whether a specified property is enumerable.\n * @param v A property name.\n */\n propertyIsEnumerable(v: PropertyKey): boolean;\n}\n\ninterface ObjectConstructor {\n /**\n * Copy the values of all of the enumerable own properties from one or more source objects to a\n * target object. Returns the target object.\n * @param target The target object to copy to.\n * @param source The source object from which to copy properties.\n */\n assign(target: T, source: U): T & U;\n\n /**\n * Copy the values of all of the enumerable own properties from one or more source objects to a\n * target object. Returns the target object.\n * @param target The target object to copy to.\n * @param source1 The first source object from which to copy properties.\n * @param source2 The second source object from which to copy properties.\n */\n assign(target: T, source1: U, source2: V): T & U & V;\n\n /**\n * Copy the values of all of the enumerable own properties from one or more source objects to a\n * target object. Returns the target object.\n * @param target The target object to copy to.\n * @param source1 The first source object from which to copy properties.\n * @param source2 The second source object from which to copy properties.\n * @param source3 The third source object from which to copy properties.\n */\n assign(target: T, source1: U, source2: V, source3: W): T & U & V & W;\n\n /**\n * Copy the values of all of the enumerable own properties from one or more source objects to a\n * target object. Returns the target object.\n * @param target The target object to copy to.\n * @param sources One or more source objects from which to copy properties\n */\n assign(target: any, ...sources: any[]): any;\n\n /**\n * Returns an array of all symbol properties found directly on object o.\n * @param o Object to retrieve the symbols from.\n */\n getOwnPropertySymbols(o: any): symbol[];\n\n /**\n * Returns true if the values are the same value, false otherwise.\n * @param value1 The first value.\n * @param value2 The second value.\n */\n is(value1: any, value2: any): boolean;\n\n /**\n * Sets the prototype of a specified object o to object proto or null. Returns the object o.\n * @param o The object to change its prototype.\n * @param proto The value of the new prototype or null.\n */\n setPrototypeOf(o: any, proto: any): any;\n\n /**\n * Gets the own property descriptor of the specified object.\n * An own property descriptor is one that is defined directly on the object and is not\n * inherited from the object's prototype.\n * @param o Object that contains the property.\n * @param p Name of the property.\n */\n getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor;\n\n /**\n * Adds a property to an object, or modifies attributes of an existing property.\n * @param o Object on which to add or modify the property. This can be a native JavaScript\n * object (that is, a user-defined object or a built in object) or a DOM object.\n * @param p The property name.\n * @param attributes Descriptor for the property. It can be for a data property or an accessor\n * property.\n */\n defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any;\n}\n\ninterface ReadonlyArray {\n /**\n * Returns the value of the first element in the array where predicate is true, and undefined\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found, find\n * immediately returns that element value. Otherwise, find returns undefined.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n find(predicate: (value: T, index: number, obj: ReadonlyArray) => boolean, thisArg?: any): T | undefined;\n\n /**\n * Returns the index of the first element in the array where predicate is true, and -1\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found,\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n findIndex(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): number;\n}\n\ninterface RegExp {\n /**\n * Returns a string indicating the flags of the regular expression in question. This field is read-only.\n * The characters in this string are sequenced and concatenated in the following order:\n *\n * - \"g\" for global\n * - \"i\" for ignoreCase\n * - \"m\" for multiline\n * - \"u\" for unicode\n * - \"y\" for sticky\n *\n * If no flags are set, the value is the empty string.\n */\n readonly flags: string;\n\n /**\n * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular\n * expression. Default is false. Read-only.\n */\n readonly sticky: boolean;\n\n /**\n * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular\n * expression. Default is false. Read-only.\n */\n readonly unicode: boolean;\n}\n\ninterface RegExpConstructor {\n new (pattern: RegExp, flags?: string): RegExp;\n (pattern: RegExp, flags?: string): RegExp;\n}\n\ninterface String {\n /**\n * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point\n * value of the UTF-16 encoded code point starting at the string element at position pos in\n * the String resulting from converting this object to a String.\n * If there is no element at that position, the result is undefined.\n * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos.\n */\n codePointAt(pos: number): number | undefined;\n\n /**\n * Returns true if searchString appears as a substring of the result of converting this\n * object to a String, at one or more positions that are\n * greater than or equal to position; otherwise, returns false.\n * @param searchString search string\n * @param position If position is undefined, 0 is assumed, so as to search all of the String.\n */\n includes(searchString: string, position?: number): boolean;\n\n /**\n * Returns true if the sequence of elements of searchString converted to a String is the\n * same as the corresponding elements of this object (converted to a String) starting at\n * endPosition – length(this). Otherwise returns false.\n */\n endsWith(searchString: string, endPosition?: number): boolean;\n\n /**\n * Returns the String value result of normalizing the string into the normalization form\n * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.\n * @param form Applicable values: \"NFC\", \"NFD\", \"NFKC\", or \"NFKD\", If not specified default\n * is \"NFC\"\n */\n normalize(form: \"NFC\" | \"NFD\" | \"NFKC\" | \"NFKD\"): string;\n\n /**\n * Returns the String value result of normalizing the string into the normalization form\n * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.\n * @param form Applicable values: \"NFC\", \"NFD\", \"NFKC\", or \"NFKD\", If not specified default\n * is \"NFC\"\n */\n normalize(form?: string): string;\n\n /**\n * Returns a String value that is made from count copies appended together. If count is 0,\n * T is the empty String is returned.\n * @param count number of copies to append\n */\n repeat(count: number): string;\n\n /**\n * Returns true if the sequence of elements of searchString converted to a String is the\n * same as the corresponding elements of this object (converted to a String) starting at\n * position. Otherwise returns false.\n */\n startsWith(searchString: string, position?: number): boolean;\n\n /**\n * Returns an HTML anchor element and sets the name attribute to the text value\n * @param name\n */\n anchor(name: string): string;\n\n /** Returns a HTML element */\n big(): string;\n\n /** Returns a HTML element */\n blink(): string;\n\n /** Returns a HTML element */\n bold(): string;\n\n /** Returns a HTML element */\n fixed(): string\n\n /** Returns a HTML element and sets the color attribute value */\n fontcolor(color: string): string\n\n /** Returns a HTML element and sets the size attribute value */\n fontsize(size: number): string;\n\n /** Returns a HTML element and sets the size attribute value */\n fontsize(size: string): string;\n\n /** Returns an HTML element */\n italics(): string;\n\n /** Returns an HTML element and sets the href attribute value */\n link(url: string): string;\n\n /** Returns a HTML element */\n small(): string;\n\n /** Returns a HTML element */\n strike(): string;\n\n /** Returns a HTML element */\n sub(): string;\n\n /** Returns a HTML element */\n sup(): string;\n}\n\ninterface StringConstructor {\n /**\n * Return the String value whose elements are, in order, the elements in the List elements.\n * If length is 0, the empty string is returned.\n */\n fromCodePoint(...codePoints: number[]): string;\n\n /**\n * String.raw is intended for use as a tag function of a Tagged Template String. When called\n * as such the first argument will be a well formed template call site object and the rest\n * parameter will contain the substitution values.\n * @param template A well-formed template string call site representation.\n * @param substitutions A set of substitution values.\n */\n raw(template: TemplateStringsArray, ...substitutions: any[]): string;\n}\n\n\ninterface Map {\n clear(): void;\n delete(key: K): boolean;\n forEach(callbackfn: (value: V, key: K, map: Map) => void, thisArg?: any): void;\n get(key: K): V | undefined;\n has(key: K): boolean;\n set(key: K, value?: V): this;\n readonly size: number;\n}\n\ninterface MapConstructor {\n new (): Map;\n new (entries?: [K, V][]): Map;\n readonly prototype: Map;\n}\ndeclare var Map: MapConstructor;\n\ninterface ReadonlyMap {\n forEach(callbackfn: (value: V, key: K, map: ReadonlyMap) => void, thisArg?: any): void;\n get(key: K): V|undefined;\n has(key: K): boolean;\n readonly size: number;\n}\n\ninterface WeakMap {\n delete(key: K): boolean;\n get(key: K): V | undefined;\n has(key: K): boolean;\n set(key: K, value?: V): this;\n}\n\ninterface WeakMapConstructor {\n new (): WeakMap;\n new (entries?: [K, V][]): WeakMap;\n readonly prototype: WeakMap;\n}\ndeclare var WeakMap: WeakMapConstructor;\n\ninterface Set {\n add(value: T): this;\n clear(): void;\n delete(value: T): boolean;\n forEach(callbackfn: (value: T, value2: T, set: Set) => void, thisArg?: any): void;\n has(value: T): boolean;\n readonly size: number;\n}\n\ninterface SetConstructor {\n new (): Set;\n new (values?: T[]): Set;\n readonly prototype: Set;\n}\ndeclare var Set: SetConstructor;\n\ninterface ReadonlySet {\n forEach(callbackfn: (value: T, value2: T, set: ReadonlySet) => void, thisArg?: any): void;\n has(value: T): boolean;\n readonly size: number;\n}\n\ninterface WeakSet {\n add(value: T): this;\n delete(value: T): boolean;\n has(value: T): boolean;\n}\n\ninterface WeakSetConstructor {\n new (): WeakSet;\n new (values?: T[]): WeakSet;\n readonly prototype: WeakSet;\n}\ndeclare var WeakSet: WeakSetConstructor;\n\n\ninterface GeneratorFunction extends Function { }\n\ninterface GeneratorFunctionConstructor {\n /**\n * Creates a new Generator function.\n * @param args A list of arguments the function accepts.\n */\n new (...args: string[]): GeneratorFunction;\n (...args: string[]): GeneratorFunction;\n readonly prototype: GeneratorFunction;\n}\ndeclare var GeneratorFunction: GeneratorFunctionConstructor;\n\n\n/// \n\ninterface SymbolConstructor {\n /** \n * A method that returns the default iterator for an object. Called by the semantics of the \n * for-of statement.\n */\n readonly iterator: symbol;\n}\n\ninterface IteratorResult {\n done: boolean;\n value: T;\n}\n\ninterface Iterator {\n next(value?: any): IteratorResult;\n return?(value?: any): IteratorResult;\n throw?(e?: any): IteratorResult;\n}\n\ninterface Iterable {\n [Symbol.iterator](): Iterator;\n}\n\ninterface IterableIterator extends Iterator {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface Array {\n /** Iterator */\n [Symbol.iterator](): IterableIterator;\n\n /** \n * Returns an array of key, value pairs for every entry in the array\n */\n entries(): IterableIterator<[number, T]>;\n\n /** \n * Returns an list of keys in the array\n */\n keys(): IterableIterator;\n\n /** \n * Returns an list of values in the array\n */\n values(): IterableIterator;\n}\n\ninterface ArrayConstructor {\n /**\n * Creates an array from an iterable object.\n * @param iterable An iterable object to convert to an array.\n * @param mapfn A mapping function to call on every element of the array.\n * @param thisArg Value of 'this' used to invoke the mapfn.\n */\n from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array;\n \n /**\n * Creates an array from an iterable object.\n * @param iterable An iterable object to convert to an array.\n */\n from(iterable: Iterable): Array;\n}\n\ninterface ReadonlyArray {\n /** Iterator */\n [Symbol.iterator](): IterableIterator;\n\n /** \n * Returns an array of key, value pairs for every entry in the array\n */\n entries(): IterableIterator<[number, T]>;\n\n /** \n * Returns an list of keys in the array\n */\n keys(): IterableIterator;\n\n /** \n * Returns an list of values in the array\n */\n values(): IterableIterator;\n}\n\ninterface IArguments {\n /** Iterator */\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface Map {\n [Symbol.iterator](): IterableIterator<[K,V]>;\n entries(): IterableIterator<[K, V]>;\n keys(): IterableIterator;\n values(): IterableIterator;\n}\n\ninterface MapConstructor {\n new (iterable: Iterable<[K, V]>): Map;\n}\n\ninterface WeakMap { }\n\ninterface WeakMapConstructor {\n new (iterable: Iterable<[K, V]>): WeakMap;\n}\n\ninterface Set {\n [Symbol.iterator](): IterableIterator;\n entries(): IterableIterator<[T, T]>;\n keys(): IterableIterator;\n values(): IterableIterator;\n}\n\ninterface SetConstructor {\n new (iterable: Iterable): Set;\n}\n\ninterface WeakSet { }\n\ninterface WeakSetConstructor {\n new (iterable: Iterable): WeakSet;\n}\n\ninterface Promise { }\n\ninterface PromiseConstructor {\n /**\n * Creates a Promise that is resolved with an array of results when all of the provided Promises \n * resolve, or rejected when any Promise is rejected.\n * @param values An array of Promises.\n * @returns A new Promise.\n */\n all(values: Iterable>): Promise;\n \n /**\n * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved \n * or rejected.\n * @param values An array of Promises.\n * @returns A new Promise.\n */\n race(values: Iterable>): Promise;\n}\n\ndeclare namespace Reflect {\n function enumerate(target: any): IterableIterator;\n}\n\ninterface String {\n /** Iterator */\n [Symbol.iterator](): IterableIterator;\n}\n\n/**\n * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested \n * number of bytes could not be allocated an exception is raised.\n */\ninterface Int8Array {\n [Symbol.iterator](): IterableIterator;\n /** \n * Returns an array of key, value pairs for every entry in the array\n */\n entries(): IterableIterator<[number, number]>;\n /** \n * Returns an list of keys in the array\n */\n keys(): IterableIterator;\n /** \n * Returns an list of values in the array\n */\n values(): IterableIterator;\n}\n\ninterface Int8ArrayConstructor {\n new (elements: Iterable): Int8Array;\n\n /**\n * Creates an array from an array-like or iterable object.\n * @param arrayLike An array-like or iterable object to convert to an array.\n * @param mapfn A mapping function to call on every element of the array.\n * @param thisArg Value of 'this' used to invoke the mapfn.\n */\n from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array;\n}\n\n/**\n * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the \n * requested number of bytes could not be allocated an exception is raised.\n */\ninterface Uint8Array {\n [Symbol.iterator](): IterableIterator;\n /** \n * Returns an array of key, value pairs for every entry in the array\n */\n entries(): IterableIterator<[number, number]>;\n /** \n * Returns an list of keys in the array\n */\n keys(): IterableIterator;\n /** \n * Returns an list of values in the array\n */\n values(): IterableIterator;\n}\n\ninterface Uint8ArrayConstructor {\n new (elements: Iterable): Uint8Array;\n\n /**\n * Creates an array from an array-like or iterable object.\n * @param arrayLike An array-like or iterable object to convert to an array.\n * @param mapfn A mapping function to call on every element of the array.\n * @param thisArg Value of 'this' used to invoke the mapfn.\n */\n from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array;\n}\n\n/**\n * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. \n * If the requested number of bytes could not be allocated an exception is raised.\n */\ninterface Uint8ClampedArray {\n [Symbol.iterator](): IterableIterator;\n /** \n * Returns an array of key, value pairs for every entry in the array\n */\n entries(): IterableIterator<[number, number]>;\n\n /** \n * Returns an list of keys in the array\n */\n keys(): IterableIterator;\n\n /** \n * Returns an list of values in the array\n */\n values(): IterableIterator;\n}\n\ninterface Uint8ClampedArrayConstructor {\n new (elements: Iterable): Uint8ClampedArray;\n\n\n /**\n * Creates an array from an array-like or iterable object.\n * @param arrayLike An array-like or iterable object to convert to an array.\n * @param mapfn A mapping function to call on every element of the array.\n * @param thisArg Value of 'this' used to invoke the mapfn.\n */\n from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray;\n}\n\n/**\n * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the \n * requested number of bytes could not be allocated an exception is raised.\n */\ninterface Int16Array {\n [Symbol.iterator](): IterableIterator;\n /** \n * Returns an array of key, value pairs for every entry in the array\n */\n entries(): IterableIterator<[number, number]>;\n\n /** \n * Returns an list of keys in the array\n */\n keys(): IterableIterator;\n\n /** \n * Returns an list of values in the array\n */\n values(): IterableIterator;\n}\n\ninterface Int16ArrayConstructor {\n new (elements: Iterable): Int16Array;\n\n /**\n * Creates an array from an array-like or iterable object.\n * @param arrayLike An array-like or iterable object to convert to an array.\n * @param mapfn A mapping function to call on every element of the array.\n * @param thisArg Value of 'this' used to invoke the mapfn.\n */\n from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array;\n}\n\n/**\n * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the \n * requested number of bytes could not be allocated an exception is raised.\n */\ninterface Uint16Array {\n [Symbol.iterator](): IterableIterator;\n /** \n * Returns an array of key, value pairs for every entry in the array\n */\n entries(): IterableIterator<[number, number]>;\n /** \n * Returns an list of keys in the array\n */\n keys(): IterableIterator;\n /** \n * Returns an list of values in the array\n */\n values(): IterableIterator;\n}\n\ninterface Uint16ArrayConstructor {\n new (elements: Iterable): Uint16Array;\n\n /**\n * Creates an array from an array-like or iterable object.\n * @param arrayLike An array-like or iterable object to convert to an array.\n * @param mapfn A mapping function to call on every element of the array.\n * @param thisArg Value of 'this' used to invoke the mapfn.\n */\n from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array;\n}\n\n/**\n * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the \n * requested number of bytes could not be allocated an exception is raised.\n */\ninterface Int32Array {\n [Symbol.iterator](): IterableIterator;\n /** \n * Returns an array of key, value pairs for every entry in the array\n */\n entries(): IterableIterator<[number, number]>;\n /** \n * Returns an list of keys in the array\n */\n keys(): IterableIterator;\n /** \n * Returns an list of values in the array\n */\n values(): IterableIterator;\n}\n\ninterface Int32ArrayConstructor {\n new (elements: Iterable): Int32Array;\n\n /**\n * Creates an array from an array-like or iterable object.\n * @param arrayLike An array-like or iterable object to convert to an array.\n * @param mapfn A mapping function to call on every element of the array.\n * @param thisArg Value of 'this' used to invoke the mapfn.\n */\n from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array;\n}\n\n/**\n * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the \n * requested number of bytes could not be allocated an exception is raised.\n */\ninterface Uint32Array {\n [Symbol.iterator](): IterableIterator;\n /** \n * Returns an array of key, value pairs for every entry in the array\n */\n entries(): IterableIterator<[number, number]>;\n /** \n * Returns an list of keys in the array\n */\n keys(): IterableIterator;\n /** \n * Returns an list of values in the array\n */\n values(): IterableIterator;\n}\n\ninterface Uint32ArrayConstructor {\n new (elements: Iterable): Uint32Array;\n\n /**\n * Creates an array from an array-like or iterable object.\n * @param arrayLike An array-like or iterable object to convert to an array.\n * @param mapfn A mapping function to call on every element of the array.\n * @param thisArg Value of 'this' used to invoke the mapfn.\n */\n from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array;\n}\n\n/**\n * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number\n * of bytes could not be allocated an exception is raised.\n */\ninterface Float32Array {\n [Symbol.iterator](): IterableIterator;\n /** \n * Returns an array of key, value pairs for every entry in the array\n */\n entries(): IterableIterator<[number, number]>;\n /** \n * Returns an list of keys in the array\n */\n keys(): IterableIterator;\n /** \n * Returns an list of values in the array\n */\n values(): IterableIterator;\n}\n\ninterface Float32ArrayConstructor {\n new (elements: Iterable): Float32Array;\n\n /**\n * Creates an array from an array-like or iterable object.\n * @param arrayLike An array-like or iterable object to convert to an array.\n * @param mapfn A mapping function to call on every element of the array.\n * @param thisArg Value of 'this' used to invoke the mapfn.\n */\n from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array;\n}\n\n/**\n * A typed array of 64-bit float values. The contents are initialized to 0. If the requested \n * number of bytes could not be allocated an exception is raised.\n */\ninterface Float64Array {\n [Symbol.iterator](): IterableIterator;\n /** \n * Returns an array of key, value pairs for every entry in the array\n */\n entries(): IterableIterator<[number, number]>;\n /** \n * Returns an list of keys in the array\n */\n keys(): IterableIterator;\n /** \n * Returns an list of values in the array\n */\n values(): IterableIterator;\n}\n\ninterface Float64ArrayConstructor {\n new (elements: Iterable): Float64Array;\n\n /**\n * Creates an array from an array-like or iterable object.\n * @param arrayLike An array-like or iterable object to convert to an array.\n * @param mapfn A mapping function to call on every element of the array.\n * @param thisArg Value of 'this' used to invoke the mapfn.\n */\n from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array;\n}\n\n/**\n * Represents the completion of an asynchronous operation\n */\ninterface Promise {\n /**\n * Attaches callbacks for the resolution and/or rejection of the Promise.\n * @param onfulfilled The callback to execute when the Promise is resolved.\n * @param onrejected The callback to execute when the Promise is rejected.\n * @returns A Promise for the completion of which ever callback is executed.\n */\n then(onfulfilled?: ((value: T) => T | PromiseLike) | undefined | null, onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): Promise;\n\n /**\n * Attaches callbacks for the resolution and/or rejection of the Promise.\n * @param onfulfilled The callback to execute when the Promise is resolved.\n * @param onrejected The callback to execute when the Promise is rejected.\n * @returns A Promise for the completion of which ever callback is executed.\n */\n then(onfulfilled: ((value: T) => T | PromiseLike) | undefined | null, onrejected: (reason: any) => TResult | PromiseLike): Promise;\n\n /**\n * Attaches callbacks for the resolution and/or rejection of the Promise.\n * @param onfulfilled The callback to execute when the Promise is resolved.\n * @param onrejected The callback to execute when the Promise is rejected.\n * @returns A Promise for the completion of which ever callback is executed.\n */\n then(onfulfilled: (value: T) => TResult | PromiseLike, onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise;\n\n /**\n * Attaches callbacks for the resolution and/or rejection of the Promise.\n * @param onfulfilled The callback to execute when the Promise is resolved.\n * @param onrejected The callback to execute when the Promise is rejected.\n * @returns A Promise for the completion of which ever callback is executed.\n */\n then(onfulfilled: (value: T) => TResult1 | PromiseLike, onrejected: (reason: any) => TResult2 | PromiseLike): Promise;\n\n /**\n * Attaches a callback for only the rejection of the Promise.\n * @param onrejected The callback to execute when the Promise is rejected.\n * @returns A Promise for the completion of the callback.\n */\n catch(onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): Promise;\n\n /**\n * Attaches a callback for only the rejection of the Promise.\n * @param onrejected The callback to execute when the Promise is rejected.\n * @returns A Promise for the completion of the callback.\n */\n catch(onrejected: (reason: any) => TResult | PromiseLike): Promise;\n}\n\ninterface PromiseConstructor {\n /**\n * A reference to the prototype.\n */\n readonly prototype: Promise;\n\n /**\n * Creates a new Promise.\n * @param executor A callback used to initialize the promise. This callback is passed two arguments:\n * a resolve callback used resolve the promise with a value or the result of another promise,\n * and a reject callback used to reject the promise with a provided reason or error.\n */\n new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise;\n\n /**\n * Creates a Promise that is resolved with an array of results when all of the provided Promises\n * resolve, or rejected when any Promise is rejected.\n * @param values An array of Promises.\n * @returns A new Promise.\n */\n all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;\n\n /**\n * Creates a Promise that is resolved with an array of results when all of the provided Promises\n * resolve, or rejected when any Promise is rejected.\n * @param values An array of Promises.\n * @returns A new Promise.\n */\n all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;\n\n /**\n * Creates a Promise that is resolved with an array of results when all of the provided Promises\n * resolve, or rejected when any Promise is rejected.\n * @param values An array of Promises.\n * @returns A new Promise.\n */\n all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;\n\n /**\n * Creates a Promise that is resolved with an array of results when all of the provided Promises\n * resolve, or rejected when any Promise is rejected.\n * @param values An array of Promises.\n * @returns A new Promise.\n */\n all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;\n\n /**\n * Creates a Promise that is resolved with an array of results when all of the provided Promises\n * resolve, or rejected when any Promise is rejected.\n * @param values An array of Promises.\n * @returns A new Promise.\n */\n all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>;\n\n /**\n * Creates a Promise that is resolved with an array of results when all of the provided Promises\n * resolve, or rejected when any Promise is rejected.\n * @param values An array of Promises.\n * @returns A new Promise.\n */\n all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>;\n\n /**\n * Creates a Promise that is resolved with an array of results when all of the provided Promises\n * resolve, or rejected when any Promise is rejected.\n * @param values An array of Promises.\n * @returns A new Promise.\n */\n all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike ]): Promise<[T1, T2, T3, T4]>;\n\n /**\n * Creates a Promise that is resolved with an array of results when all of the provided Promises\n * resolve, or rejected when any Promise is rejected.\n * @param values An array of Promises.\n * @returns A new Promise.\n */\n all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>;\n\n /**\n * Creates a Promise that is resolved with an array of results when all of the provided Promises\n * resolve, or rejected when any Promise is rejected.\n * @param values An array of Promises.\n * @returns A new Promise.\n */\n all(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>;\n\n /**\n * Creates a Promise that is resolved with an array of results when all of the provided Promises\n * resolve, or rejected when any Promise is rejected.\n * @param values An array of Promises.\n * @returns A new Promise.\n */\n all(values: (T | PromiseLike)[]): Promise;\n\n /**\n * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved\n * or rejected.\n * @param values An array of Promises.\n * @returns A new Promise.\n */\n race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise;\n\n /**\n * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved\n * or rejected.\n * @param values An array of Promises.\n * @returns A new Promise.\n */\n race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise;\n\n /**\n * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved\n * or rejected.\n * @param values An array of Promises.\n * @returns A new Promise.\n */\n race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise;\n\n /**\n * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved\n * or rejected.\n * @param values An array of Promises.\n * @returns A new Promise.\n */\n race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise;\n\n /**\n * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved\n * or rejected.\n * @param values An array of Promises.\n * @returns A new Promise.\n */\n race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise;\n\n /**\n * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved\n * or rejected.\n * @param values An array of Promises.\n * @returns A new Promise.\n */\n race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise;\n\n /**\n * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved\n * or rejected.\n * @param values An array of Promises.\n * @returns A new Promise.\n */\n race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise;\n\n /**\n * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved\n * or rejected.\n * @param values An array of Promises.\n * @returns A new Promise.\n */\n race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise;\n\n /**\n * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved\n * or rejected.\n * @param values An array of Promises.\n * @returns A new Promise.\n */\n race(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise;\n\n /**\n * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved\n * or rejected.\n * @param values An array of Promises.\n * @returns A new Promise.\n */\n race(values: (T | PromiseLike)[]): Promise;\n\n /**\n * Creates a new rejected promise for the provided reason.\n * @param reason The reason the promise was rejected.\n * @returns A new rejected Promise.\n */\n reject(reason: any): Promise;\n\n /**\n * Creates a new rejected promise for the provided reason.\n * @param reason The reason the promise was rejected.\n * @returns A new rejected Promise.\n */\n reject(reason: any): Promise;\n\n /**\n * Creates a new resolved promise for the provided value.\n * @param value A promise.\n * @returns A promise whose internal state matches the provided promise.\n */\n resolve(value: T | PromiseLike): Promise;\n\n /**\n * Creates a new resolved promise .\n * @returns A resolved promise.\n */\n resolve(): Promise;\n}\n\ndeclare var Promise: PromiseConstructor;\n\ninterface ProxyHandler {\n getPrototypeOf? (target: T): {} | null;\n setPrototypeOf? (target: T, v: any): boolean;\n isExtensible? (target: T): boolean;\n preventExtensions? (target: T): boolean;\n getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor;\n has? (target: T, p: PropertyKey): boolean;\n get? (target: T, p: PropertyKey, receiver: any): any;\n set? (target: T, p: PropertyKey, value: any, receiver: any): boolean;\n deleteProperty? (target: T, p: PropertyKey): boolean;\n defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean;\n enumerate? (target: T): PropertyKey[];\n ownKeys? (target: T): PropertyKey[];\n apply? (target: T, thisArg: any, argArray?: any): any;\n construct? (target: T, argArray: any, newTarget?: any): {};\n}\n\ninterface ProxyConstructor {\n revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; };\n new (target: T, handler: ProxyHandler): T\n}\ndeclare var Proxy: ProxyConstructor;\n\n\ndeclare namespace Reflect {\n function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any;\n function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any;\n function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;\n function deleteProperty(target: any, propertyKey: PropertyKey): boolean;\n function get(target: any, propertyKey: PropertyKey, receiver?: any): any;\n function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor;\n function getPrototypeOf(target: any): any;\n function has(target: any, propertyKey: PropertyKey): boolean;\n function isExtensible(target: any): boolean;\n function ownKeys(target: any): Array;\n function preventExtensions(target: any): boolean;\n function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean;\n function setPrototypeOf(target: any, proto: any): boolean;\n}\n\ninterface Symbol {\n /** Returns a string representation of an object. */\n toString(): string;\n\n /** Returns the primitive value of the specified object. */\n valueOf(): Object;\n}\n\ninterface SymbolConstructor {\n /** \n * A reference to the prototype. \n */\n readonly prototype: Symbol;\n\n /**\n * Returns a new unique Symbol value.\n * @param description Description of the new Symbol object.\n */\n (description?: string|number): symbol;\n\n /**\n * Returns a Symbol object from the global symbol registry matching the given key if found. \n * Otherwise, returns a new symbol with this key.\n * @param key key to search for.\n */\n for(key: string): symbol;\n\n /**\n * Returns a key from the global symbol registry matching the given Symbol if found. \n * Otherwise, returns a undefined.\n * @param sym Symbol to find the key for.\n */\n keyFor(sym: symbol): string | undefined;\n}\n\ndeclare var Symbol: SymbolConstructor;\n\n/// \n\ninterface SymbolConstructor {\n /** \n * A method that determines if a constructor object recognizes an object as one of the \n * constructor’s instances. Called by the semantics of the instanceof operator. \n */\n readonly hasInstance: symbol;\n\n /** \n * A Boolean value that if true indicates that an object should flatten to its array elements\n * by Array.prototype.concat.\n */\n readonly isConcatSpreadable: symbol;\n\n /**\n * A regular expression method that matches the regular expression against a string. Called \n * by the String.prototype.match method. \n */\n readonly match: symbol;\n\n /** \n * A regular expression method that replaces matched substrings of a string. Called by the \n * String.prototype.replace method.\n */\n readonly replace: symbol;\n\n /**\n * A regular expression method that returns the index within a string that matches the \n * regular expression. Called by the String.prototype.search method.\n */\n readonly search: symbol;\n\n /** \n * A function valued property that is the constructor function that is used to create \n * derived objects.\n */\n readonly species: symbol;\n\n /**\n * A regular expression method that splits a string at the indices that match the regular \n * expression. Called by the String.prototype.split method.\n */\n readonly split: symbol;\n\n /** \n * A method that converts an object to a corresponding primitive value.\n * Called by the ToPrimitive abstract operation.\n */\n readonly toPrimitive: symbol;\n\n /** \n * A String value that is used in the creation of the default string description of an object.\n * Called by the built-in method Object.prototype.toString.\n */\n readonly toStringTag: symbol;\n\n /**\n * An Object whose own property names are property names that are excluded from the 'with'\n * environment bindings of the associated objects.\n */\n readonly unscopables: symbol;\n}\n\ninterface Symbol {\n readonly [Symbol.toStringTag]: \"Symbol\";\n}\n\ninterface Array {\n /**\n * Returns an object whose properties have the value 'true'\n * when they will be absent when used in a 'with' statement.\n */\n [Symbol.unscopables](): {\n copyWithin: boolean;\n entries: boolean;\n fill: boolean;\n find: boolean;\n findIndex: boolean;\n keys: boolean;\n values: boolean;\n };\n}\n\ninterface Date {\n /**\n * Converts a Date object to a string.\n */\n [Symbol.toPrimitive](hint: \"default\"): string;\n /**\n * Converts a Date object to a string.\n */\n [Symbol.toPrimitive](hint: \"string\"): string;\n /**\n * Converts a Date object to a number.\n */\n [Symbol.toPrimitive](hint: \"number\"): number;\n /**\n * Converts a Date object to a string or number.\n *\n * @param hint The strings \"number\", \"string\", or \"default\" to specify what primitive to return.\n *\n * @throws {TypeError} If 'hint' was given something other than \"number\", \"string\", or \"default\".\n * @returns A number if 'hint' was \"number\", a string if 'hint' was \"string\" or \"default\".\n */\n [Symbol.toPrimitive](hint: string): string | number;\n}\n\ninterface Map {\n readonly [Symbol.toStringTag]: \"Map\";\n}\n\ninterface WeakMap{\n readonly [Symbol.toStringTag]: \"WeakMap\";\n}\n\ninterface Set {\n readonly [Symbol.toStringTag]: \"Set\";\n}\n\ninterface WeakSet {\n readonly [Symbol.toStringTag]: \"WeakSet\";\n}\n\ninterface JSON {\n readonly [Symbol.toStringTag]: \"JSON\";\n}\n\ninterface Function {\n /**\n * Determines whether the given value inherits from this function if this function was used\n * as a constructor function.\n *\n * A constructor function can control which objects are recognized as its instances by\n * 'instanceof' by overriding this method.\n */\n [Symbol.hasInstance](value: any): boolean;\n}\n\ninterface GeneratorFunction extends Function {\n readonly [Symbol.toStringTag]: \"GeneratorFunction\";\n}\n\ninterface Math {\n readonly [Symbol.toStringTag]: \"Math\";\n}\n\ninterface Promise {\n readonly [Symbol.toStringTag]: \"Promise\";\n}\n\ninterface PromiseConstructor {\n readonly [Symbol.species]: Function;\n}\n\ninterface RegExp {\n /**\n * Matches a string with this regular expression, and returns an array containing the results of\n * that search.\n * @param string A string to search within.\n */\n [Symbol.match](string: string): RegExpMatchArray | null;\n\n /**\n * Replaces text in a string, using this regular expression.\n * @param string A String object or string literal whose contents matching against\n * this regular expression will be replaced\n * @param replaceValue A String object or string literal containing the text to replace for every \n * successful match of this regular expression.\n */\n [Symbol.replace](string: string, replaceValue: string): string;\n\n /**\n * Replaces text in a string, using this regular expression.\n * @param string A String object or string literal whose contents matching against\n * this regular expression will be replaced\n * @param replacer A function that returns the replacement text.\n */\n [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string;\n\n /**\n * Finds the position beginning first substring match in a regular expression search\n * using this regular expression.\n *\n * @param string The string to search within.\n */\n [Symbol.search](string: string): number;\n\n /**\n * Returns an array of substrings that were delimited by strings in the original input that\n * match against this regular expression.\n *\n * If the regular expression contains capturing parentheses, then each time this\n * regular expression matches, the results (including any undefined results) of the\n * capturing parentheses are spliced.\n *\n * @param string string value to split\n * @param limit if not undefined, the output array is truncated so that it contains no more\n * than 'limit' elements.\n */\n [Symbol.split](string: string, limit?: number): string[];\n}\n\ninterface RegExpConstructor {\n [Symbol.species](): RegExpConstructor;\n}\n\ninterface String {\n /**\n * Matches a string an object that supports being matched against, and returns an array containing the results of that search.\n * @param matcher An object that supports being matched against.\n */\n match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null;\n\n /**\n * Replaces text in a string, using an object that supports replacement within a string.\n * @param searchValue A object can search for and replace matches within a string.\n * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string.\n */\n replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string;\n\n /**\n * Replaces text in a string, using an object that supports replacement within a string.\n * @param searchValue A object can search for and replace matches within a string.\n * @param replacer A function that returns the replacement text.\n */\n replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string;\n\n /**\n * Finds the first substring match in a regular expression search.\n * @param searcher An object which supports searching within a string.\n */\n search(searcher: { [Symbol.search](string: string): number; }): number;\n\n /**\n * Split a string into substrings using the specified separator and return them as an array.\n * @param splitter An object that can split a string.\n * @param limit A value used to limit the number of elements returned in the array.\n */\n split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[];\n}\n\n/**\n * Represents a raw buffer of binary data, which is used to store data for the \n * different typed arrays. ArrayBuffers cannot be read from or written to directly, \n * but can be passed to a typed array or DataView Object to interpret the raw \n * buffer as needed. \n */\ninterface ArrayBuffer {\n readonly [Symbol.toStringTag]: \"ArrayBuffer\";\n}\n\ninterface DataView {\n readonly [Symbol.toStringTag]: \"DataView\";\n}\n\n/**\n * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested \n * number of bytes could not be allocated an exception is raised.\n */\ninterface Int8Array {\n readonly [Symbol.toStringTag]: \"Int8Array\";\n}\n\n/**\n * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the \n * requested number of bytes could not be allocated an exception is raised.\n */\ninterface Uint8Array {\n readonly [Symbol.toStringTag]: \"UInt8Array\";\n}\n\n/**\n * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. \n * If the requested number of bytes could not be allocated an exception is raised.\n */\ninterface Uint8ClampedArray {\n readonly [Symbol.toStringTag]: \"Uint8ClampedArray\";\n}\n\n/**\n * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the \n * requested number of bytes could not be allocated an exception is raised.\n */\ninterface Int16Array {\n readonly [Symbol.toStringTag]: \"Int16Array\";\n}\n\n/**\n * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the \n * requested number of bytes could not be allocated an exception is raised.\n */\ninterface Uint16Array {\n readonly [Symbol.toStringTag]: \"Uint16Array\";\n}\n\n/**\n * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the \n * requested number of bytes could not be allocated an exception is raised.\n */\ninterface Int32Array {\n readonly [Symbol.toStringTag]: \"Int32Array\";\n}\n\n/**\n * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the \n * requested number of bytes could not be allocated an exception is raised.\n */\ninterface Uint32Array {\n readonly [Symbol.toStringTag]: \"Uint32Array\";\n}\n\n/**\n * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number\n * of bytes could not be allocated an exception is raised.\n */\ninterface Float32Array {\n readonly [Symbol.toStringTag]: \"Float32Array\";\n}\n\n/**\n * A typed array of 64-bit float values. The contents are initialized to 0. If the requested \n * number of bytes could not be allocated an exception is raised.\n */\ninterface Float64Array {\n readonly [Symbol.toStringTag]: \"Float64Array\";\n}\n\n\n/////////////////////////////\n/// IE DOM APIs\n/////////////////////////////\n\ninterface Algorithm {\n name: string;\n}\n\ninterface AriaRequestEventInit extends EventInit {\n attributeName?: string;\n attributeValue?: string;\n}\n\ninterface CommandEventInit extends EventInit {\n commandName?: string;\n detail?: string;\n}\n\ninterface CompositionEventInit extends UIEventInit {\n data?: string;\n}\n\ninterface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation {\n arrayOfDomainStrings?: string[];\n}\n\ninterface ConstrainBooleanParameters {\n exact?: boolean;\n ideal?: boolean;\n}\n\ninterface ConstrainDOMStringParameters {\n exact?: string | string[];\n ideal?: string | string[];\n}\n\ninterface ConstrainDoubleRange extends DoubleRange {\n exact?: number;\n ideal?: number;\n}\n\ninterface ConstrainLongRange extends LongRange {\n exact?: number;\n ideal?: number;\n}\n\ninterface ConstrainVideoFacingModeParameters {\n exact?: string | string[];\n ideal?: string | string[];\n}\n\ninterface CustomEventInit extends EventInit {\n detail?: any;\n}\n\ninterface DeviceAccelerationDict {\n x?: number;\n y?: number;\n z?: number;\n}\n\ninterface DeviceLightEventInit extends EventInit {\n value?: number;\n}\n\ninterface DeviceRotationRateDict {\n alpha?: number;\n beta?: number;\n gamma?: number;\n}\n\ninterface DoubleRange {\n max?: number;\n min?: number;\n}\n\ninterface EventInit {\n scoped?: boolean;\n bubbles?: boolean;\n cancelable?: boolean;\n}\n\ninterface EventModifierInit extends UIEventInit {\n ctrlKey?: boolean;\n shiftKey?: boolean;\n altKey?: boolean;\n metaKey?: boolean;\n modifierAltGraph?: boolean;\n modifierCapsLock?: boolean;\n modifierFn?: boolean;\n modifierFnLock?: boolean;\n modifierHyper?: boolean;\n modifierNumLock?: boolean;\n modifierOS?: boolean;\n modifierScrollLock?: boolean;\n modifierSuper?: boolean;\n modifierSymbol?: boolean;\n modifierSymbolLock?: boolean;\n}\n\ninterface ExceptionInformation {\n domain?: string;\n}\n\ninterface FocusEventInit extends UIEventInit {\n relatedTarget?: EventTarget;\n}\n\ninterface HashChangeEventInit extends EventInit {\n newURL?: string;\n oldURL?: string;\n}\n\ninterface IDBIndexParameters {\n multiEntry?: boolean;\n unique?: boolean;\n}\n\ninterface IDBObjectStoreParameters {\n autoIncrement?: boolean;\n keyPath?: IDBKeyPath;\n}\n\ninterface KeyAlgorithm {\n name?: string;\n}\n\ninterface KeyboardEventInit extends EventModifierInit {\n code?: string;\n key?: string;\n location?: number;\n repeat?: boolean;\n}\n\ninterface LongRange {\n max?: number;\n min?: number;\n}\n\ninterface MSAccountInfo {\n rpDisplayName?: string;\n userDisplayName?: string;\n accountName?: string;\n userId?: string;\n accountImageUri?: string;\n}\n\ninterface MSAudioLocalClientEvent extends MSLocalClientEventBase {\n networkSendQualityEventRatio?: number;\n networkDelayEventRatio?: number;\n cpuInsufficientEventRatio?: number;\n deviceHalfDuplexAECEventRatio?: number;\n deviceRenderNotFunctioningEventRatio?: number;\n deviceCaptureNotFunctioningEventRatio?: number;\n deviceGlitchesEventRatio?: number;\n deviceLowSNREventRatio?: number;\n deviceLowSpeechLevelEventRatio?: number;\n deviceClippingEventRatio?: number;\n deviceEchoEventRatio?: number;\n deviceNearEndToEchoRatioEventRatio?: number;\n deviceRenderZeroVolumeEventRatio?: number;\n deviceRenderMuteEventRatio?: number;\n deviceMultipleEndpointsEventCount?: number;\n deviceHowlingEventCount?: number;\n}\n\ninterface MSAudioRecvPayload extends MSPayloadBase {\n samplingRate?: number;\n signal?: MSAudioRecvSignal;\n packetReorderRatio?: number;\n packetReorderDepthAvg?: number;\n packetReorderDepthMax?: number;\n burstLossLength1?: number;\n burstLossLength2?: number;\n burstLossLength3?: number;\n burstLossLength4?: number;\n burstLossLength5?: number;\n burstLossLength6?: number;\n burstLossLength7?: number;\n burstLossLength8OrHigher?: number;\n fecRecvDistance1?: number;\n fecRecvDistance2?: number;\n fecRecvDistance3?: number;\n ratioConcealedSamplesAvg?: number;\n ratioStretchedSamplesAvg?: number;\n ratioCompressedSamplesAvg?: number;\n}\n\ninterface MSAudioRecvSignal {\n initialSignalLevelRMS?: number;\n recvSignalLevelCh1?: number;\n recvNoiseLevelCh1?: number;\n renderSignalLevel?: number;\n renderNoiseLevel?: number;\n renderLoopbackSignalLevel?: number;\n}\n\ninterface MSAudioSendPayload extends MSPayloadBase {\n samplingRate?: number;\n signal?: MSAudioSendSignal;\n audioFECUsed?: boolean;\n sendMutePercent?: number;\n}\n\ninterface MSAudioSendSignal {\n noiseLevel?: number;\n sendSignalLevelCh1?: number;\n sendNoiseLevelCh1?: number;\n}\n\ninterface MSConnectivity {\n iceType?: string;\n iceWarningFlags?: MSIceWarningFlags;\n relayAddress?: MSRelayAddress;\n}\n\ninterface MSCredentialFilter {\n accept?: MSCredentialSpec[];\n}\n\ninterface MSCredentialParameters {\n type?: string;\n}\n\ninterface MSCredentialSpec {\n type?: string;\n id?: string;\n}\n\ninterface MSDelay {\n roundTrip?: number;\n roundTripMax?: number;\n}\n\ninterface MSDescription extends RTCStats {\n connectivity?: MSConnectivity;\n transport?: string;\n networkconnectivity?: MSNetworkConnectivityInfo;\n localAddr?: MSIPAddressInfo;\n remoteAddr?: MSIPAddressInfo;\n deviceDevName?: string;\n reflexiveLocalIPAddr?: MSIPAddressInfo;\n}\n\ninterface MSFIDOCredentialParameters extends MSCredentialParameters {\n algorithm?: string | Algorithm;\n authenticators?: AAGUID[];\n}\n\ninterface MSIPAddressInfo {\n ipAddr?: string;\n port?: number;\n manufacturerMacAddrMask?: string;\n}\n\ninterface MSIceWarningFlags {\n turnTcpTimedOut?: boolean;\n turnUdpAllocateFailed?: boolean;\n turnUdpSendFailed?: boolean;\n turnTcpAllocateFailed?: boolean;\n turnTcpSendFailed?: boolean;\n udpLocalConnectivityFailed?: boolean;\n udpNatConnectivityFailed?: boolean;\n udpRelayConnectivityFailed?: boolean;\n tcpNatConnectivityFailed?: boolean;\n tcpRelayConnectivityFailed?: boolean;\n connCheckMessageIntegrityFailed?: boolean;\n allocationMessageIntegrityFailed?: boolean;\n connCheckOtherError?: boolean;\n turnAuthUnknownUsernameError?: boolean;\n noRelayServersConfigured?: boolean;\n multipleRelayServersAttempted?: boolean;\n portRangeExhausted?: boolean;\n alternateServerReceived?: boolean;\n pseudoTLSFailure?: boolean;\n turnTurnTcpConnectivityFailed?: boolean;\n useCandidateChecksFailed?: boolean;\n fipsAllocationFailure?: boolean;\n}\n\ninterface MSJitter {\n interArrival?: number;\n interArrivalMax?: number;\n interArrivalSD?: number;\n}\n\ninterface MSLocalClientEventBase extends RTCStats {\n networkReceiveQualityEventRatio?: number;\n networkBandwidthLowEventRatio?: number;\n}\n\ninterface MSNetwork extends RTCStats {\n jitter?: MSJitter;\n delay?: MSDelay;\n packetLoss?: MSPacketLoss;\n utilization?: MSUtilization;\n}\n\ninterface MSNetworkConnectivityInfo {\n vpn?: boolean;\n linkspeed?: number;\n networkConnectionDetails?: string;\n}\n\ninterface MSNetworkInterfaceType {\n interfaceTypeEthernet?: boolean;\n interfaceTypeWireless?: boolean;\n interfaceTypePPP?: boolean;\n interfaceTypeTunnel?: boolean;\n interfaceTypeWWAN?: boolean;\n}\n\ninterface MSOutboundNetwork extends MSNetwork {\n appliedBandwidthLimit?: number;\n}\n\ninterface MSPacketLoss {\n lossRate?: number;\n lossRateMax?: number;\n}\n\ninterface MSPayloadBase extends RTCStats {\n payloadDescription?: string;\n}\n\ninterface MSRelayAddress {\n relayAddress?: string;\n port?: number;\n}\n\ninterface MSSignatureParameters {\n userPrompt?: string;\n}\n\ninterface MSTransportDiagnosticsStats extends RTCStats {\n baseAddress?: string;\n localAddress?: string;\n localSite?: string;\n networkName?: string;\n remoteAddress?: string;\n remoteSite?: string;\n localMR?: string;\n remoteMR?: string;\n iceWarningFlags?: MSIceWarningFlags;\n portRangeMin?: number;\n portRangeMax?: number;\n localMRTCPPort?: number;\n remoteMRTCPPort?: number;\n stunVer?: number;\n numConsentReqSent?: number;\n numConsentReqReceived?: number;\n numConsentRespSent?: number;\n numConsentRespReceived?: number;\n interfaces?: MSNetworkInterfaceType;\n baseInterface?: MSNetworkInterfaceType;\n protocol?: string;\n localInterface?: MSNetworkInterfaceType;\n localAddrType?: string;\n remoteAddrType?: string;\n iceRole?: string;\n rtpRtcpMux?: boolean;\n allocationTimeInMs?: number;\n msRtcEngineVersion?: string;\n}\n\ninterface MSUtilization {\n packets?: number;\n bandwidthEstimation?: number;\n bandwidthEstimationMin?: number;\n bandwidthEstimationMax?: number;\n bandwidthEstimationStdDev?: number;\n bandwidthEstimationAvg?: number;\n}\n\ninterface MSVideoPayload extends MSPayloadBase {\n resoluton?: string;\n videoBitRateAvg?: number;\n videoBitRateMax?: number;\n videoFrameRateAvg?: number;\n videoPacketLossRate?: number;\n durationSeconds?: number;\n}\n\ninterface MSVideoRecvPayload extends MSVideoPayload {\n videoFrameLossRate?: number;\n recvCodecType?: string;\n recvResolutionWidth?: number;\n recvResolutionHeight?: number;\n videoResolutions?: MSVideoResolutionDistribution;\n recvFrameRateAverage?: number;\n recvBitRateMaximum?: number;\n recvBitRateAverage?: number;\n recvVideoStreamsMax?: number;\n recvVideoStreamsMin?: number;\n recvVideoStreamsMode?: number;\n videoPostFECPLR?: number;\n lowBitRateCallPercent?: number;\n lowFrameRateCallPercent?: number;\n reorderBufferTotalPackets?: number;\n recvReorderBufferReorderedPackets?: number;\n recvReorderBufferPacketsDroppedDueToBufferExhaustion?: number;\n recvReorderBufferMaxSuccessfullyOrderedExtent?: number;\n recvReorderBufferMaxSuccessfullyOrderedLateTime?: number;\n recvReorderBufferPacketsDroppedDueToTimeout?: number;\n recvFpsHarmonicAverage?: number;\n recvNumResSwitches?: number;\n}\n\ninterface MSVideoResolutionDistribution {\n cifQuality?: number;\n vgaQuality?: number;\n h720Quality?: number;\n h1080Quality?: number;\n h1440Quality?: number;\n h2160Quality?: number;\n}\n\ninterface MSVideoSendPayload extends MSVideoPayload {\n sendFrameRateAverage?: number;\n sendBitRateMaximum?: number;\n sendBitRateAverage?: number;\n sendVideoStreamsMax?: number;\n sendResolutionWidth?: number;\n sendResolutionHeight?: number;\n}\n\ninterface MediaEncryptedEventInit extends EventInit {\n initDataType?: string;\n initData?: ArrayBuffer;\n}\n\ninterface MediaKeyMessageEventInit extends EventInit {\n messageType?: string;\n message?: ArrayBuffer;\n}\n\ninterface MediaKeySystemConfiguration {\n initDataTypes?: string[];\n audioCapabilities?: MediaKeySystemMediaCapability[];\n videoCapabilities?: MediaKeySystemMediaCapability[];\n distinctiveIdentifier?: string;\n persistentState?: string;\n}\n\ninterface MediaKeySystemMediaCapability {\n contentType?: string;\n robustness?: string;\n}\n\ninterface MediaStreamConstraints {\n video?: boolean | MediaTrackConstraints;\n audio?: boolean | MediaTrackConstraints;\n}\n\ninterface MediaStreamErrorEventInit extends EventInit {\n error?: MediaStreamError;\n}\n\ninterface MediaStreamTrackEventInit extends EventInit {\n track?: MediaStreamTrack;\n}\n\ninterface MediaTrackCapabilities {\n width?: number | LongRange;\n height?: number | LongRange;\n aspectRatio?: number | DoubleRange;\n frameRate?: number | DoubleRange;\n facingMode?: string;\n volume?: number | DoubleRange;\n sampleRate?: number | LongRange;\n sampleSize?: number | LongRange;\n echoCancellation?: boolean[];\n deviceId?: string;\n groupId?: string;\n}\n\ninterface MediaTrackConstraintSet {\n width?: number | ConstrainLongRange;\n height?: number | ConstrainLongRange;\n aspectRatio?: number | ConstrainDoubleRange;\n frameRate?: number | ConstrainDoubleRange;\n facingMode?: string | string[] | ConstrainDOMStringParameters;\n volume?: number | ConstrainDoubleRange;\n sampleRate?: number | ConstrainLongRange;\n sampleSize?: number | ConstrainLongRange;\n echoCancelation?: boolean | ConstrainBooleanParameters;\n deviceId?: string | string[] | ConstrainDOMStringParameters;\n groupId?: string | string[] | ConstrainDOMStringParameters;\n}\n\ninterface MediaTrackConstraints extends MediaTrackConstraintSet {\n advanced?: MediaTrackConstraintSet[];\n}\n\ninterface MediaTrackSettings {\n width?: number;\n height?: number;\n aspectRatio?: number;\n frameRate?: number;\n facingMode?: string;\n volume?: number;\n sampleRate?: number;\n sampleSize?: number;\n echoCancellation?: boolean;\n deviceId?: string;\n groupId?: string;\n}\n\ninterface MediaTrackSupportedConstraints {\n width?: boolean;\n height?: boolean;\n aspectRatio?: boolean;\n frameRate?: boolean;\n facingMode?: boolean;\n volume?: boolean;\n sampleRate?: boolean;\n sampleSize?: boolean;\n echoCancellation?: boolean;\n deviceId?: boolean;\n groupId?: boolean;\n}\n\ninterface MouseEventInit extends EventModifierInit {\n screenX?: number;\n screenY?: number;\n clientX?: number;\n clientY?: number;\n button?: number;\n buttons?: number;\n relatedTarget?: EventTarget;\n}\n\ninterface MsZoomToOptions {\n contentX?: number;\n contentY?: number;\n viewportX?: string;\n viewportY?: string;\n scaleFactor?: number;\n animate?: string;\n}\n\ninterface MutationObserverInit {\n childList?: boolean;\n attributes?: boolean;\n characterData?: boolean;\n subtree?: boolean;\n attributeOldValue?: boolean;\n characterDataOldValue?: boolean;\n attributeFilter?: string[];\n}\n\ninterface ObjectURLOptions {\n oneTimeOnly?: boolean;\n}\n\ninterface PeriodicWaveConstraints {\n disableNormalization?: boolean;\n}\n\ninterface PointerEventInit extends MouseEventInit {\n pointerId?: number;\n width?: number;\n height?: number;\n pressure?: number;\n tiltX?: number;\n tiltY?: number;\n pointerType?: string;\n isPrimary?: boolean;\n}\n\ninterface PositionOptions {\n enableHighAccuracy?: boolean;\n timeout?: number;\n maximumAge?: number;\n}\n\ninterface RTCDTMFToneChangeEventInit extends EventInit {\n tone?: string;\n}\n\ninterface RTCDtlsFingerprint {\n algorithm?: string;\n value?: string;\n}\n\ninterface RTCDtlsParameters {\n role?: string;\n fingerprints?: RTCDtlsFingerprint[];\n}\n\ninterface RTCIceCandidate {\n foundation?: string;\n priority?: number;\n ip?: string;\n protocol?: string;\n port?: number;\n type?: string;\n tcpType?: string;\n relatedAddress?: string;\n relatedPort?: number;\n}\n\ninterface RTCIceCandidateAttributes extends RTCStats {\n ipAddress?: string;\n portNumber?: number;\n transport?: string;\n candidateType?: string;\n priority?: number;\n addressSourceUrl?: string;\n}\n\ninterface RTCIceCandidateComplete {\n}\n\ninterface RTCIceCandidatePair {\n local?: RTCIceCandidate;\n remote?: RTCIceCandidate;\n}\n\ninterface RTCIceCandidatePairStats extends RTCStats {\n transportId?: string;\n localCandidateId?: string;\n remoteCandidateId?: string;\n state?: string;\n priority?: number;\n nominated?: boolean;\n writable?: boolean;\n readable?: boolean;\n bytesSent?: number;\n bytesReceived?: number;\n roundTripTime?: number;\n availableOutgoingBitrate?: number;\n availableIncomingBitrate?: number;\n}\n\ninterface RTCIceGatherOptions {\n gatherPolicy?: string;\n iceservers?: RTCIceServer[];\n}\n\ninterface RTCIceParameters {\n usernameFragment?: string;\n password?: string;\n}\n\ninterface RTCIceServer {\n urls?: any;\n username?: string;\n credential?: string;\n}\n\ninterface RTCInboundRTPStreamStats extends RTCRTPStreamStats {\n packetsReceived?: number;\n bytesReceived?: number;\n packetsLost?: number;\n jitter?: number;\n fractionLost?: number;\n}\n\ninterface RTCMediaStreamTrackStats extends RTCStats {\n trackIdentifier?: string;\n remoteSource?: boolean;\n ssrcIds?: string[];\n frameWidth?: number;\n frameHeight?: number;\n framesPerSecond?: number;\n framesSent?: number;\n framesReceived?: number;\n framesDecoded?: number;\n framesDropped?: number;\n framesCorrupted?: number;\n audioLevel?: number;\n echoReturnLoss?: number;\n echoReturnLossEnhancement?: number;\n}\n\ninterface RTCOutboundRTPStreamStats extends RTCRTPStreamStats {\n packetsSent?: number;\n bytesSent?: number;\n targetBitrate?: number;\n roundTripTime?: number;\n}\n\ninterface RTCRTPStreamStats extends RTCStats {\n ssrc?: string;\n associateStatsId?: string;\n isRemote?: boolean;\n mediaTrackId?: string;\n transportId?: string;\n codecId?: string;\n firCount?: number;\n pliCount?: number;\n nackCount?: number;\n sliCount?: number;\n}\n\ninterface RTCRtcpFeedback {\n type?: string;\n parameter?: string;\n}\n\ninterface RTCRtcpParameters {\n ssrc?: number;\n cname?: string;\n reducedSize?: boolean;\n mux?: boolean;\n}\n\ninterface RTCRtpCapabilities {\n codecs?: RTCRtpCodecCapability[];\n headerExtensions?: RTCRtpHeaderExtension[];\n fecMechanisms?: string[];\n}\n\ninterface RTCRtpCodecCapability {\n name?: string;\n kind?: string;\n clockRate?: number;\n preferredPayloadType?: number;\n maxptime?: number;\n numChannels?: number;\n rtcpFeedback?: RTCRtcpFeedback[];\n parameters?: any;\n options?: any;\n maxTemporalLayers?: number;\n maxSpatialLayers?: number;\n svcMultiStreamSupport?: boolean;\n}\n\ninterface RTCRtpCodecParameters {\n name?: string;\n payloadType?: any;\n clockRate?: number;\n maxptime?: number;\n numChannels?: number;\n rtcpFeedback?: RTCRtcpFeedback[];\n parameters?: any;\n}\n\ninterface RTCRtpContributingSource {\n timestamp?: number;\n csrc?: number;\n audioLevel?: number;\n}\n\ninterface RTCRtpEncodingParameters {\n ssrc?: number;\n codecPayloadType?: number;\n fec?: RTCRtpFecParameters;\n rtx?: RTCRtpRtxParameters;\n priority?: number;\n maxBitrate?: number;\n minQuality?: number;\n framerateBias?: number;\n resolutionScale?: number;\n framerateScale?: number;\n active?: boolean;\n encodingId?: string;\n dependencyEncodingIds?: string[];\n ssrcRange?: RTCSsrcRange;\n}\n\ninterface RTCRtpFecParameters {\n ssrc?: number;\n mechanism?: string;\n}\n\ninterface RTCRtpHeaderExtension {\n kind?: string;\n uri?: string;\n preferredId?: number;\n preferredEncrypt?: boolean;\n}\n\ninterface RTCRtpHeaderExtensionParameters {\n uri?: string;\n id?: number;\n encrypt?: boolean;\n}\n\ninterface RTCRtpParameters {\n muxId?: string;\n codecs?: RTCRtpCodecParameters[];\n headerExtensions?: RTCRtpHeaderExtensionParameters[];\n encodings?: RTCRtpEncodingParameters[];\n rtcp?: RTCRtcpParameters;\n}\n\ninterface RTCRtpRtxParameters {\n ssrc?: number;\n}\n\ninterface RTCRtpUnhandled {\n ssrc?: number;\n payloadType?: number;\n muxId?: string;\n}\n\ninterface RTCSrtpKeyParam {\n keyMethod?: string;\n keySalt?: string;\n lifetime?: string;\n mkiValue?: number;\n mkiLength?: number;\n}\n\ninterface RTCSrtpSdesParameters {\n tag?: number;\n cryptoSuite?: string;\n keyParams?: RTCSrtpKeyParam[];\n sessionParams?: string[];\n}\n\ninterface RTCSsrcRange {\n min?: number;\n max?: number;\n}\n\ninterface RTCStats {\n timestamp?: number;\n type?: string;\n id?: string;\n msType?: string;\n}\n\ninterface RTCStatsReport {\n}\n\ninterface RTCTransportStats extends RTCStats {\n bytesSent?: number;\n bytesReceived?: number;\n rtcpTransportStatsId?: string;\n activeConnection?: boolean;\n selectedCandidatePairId?: string;\n localCertificateId?: string;\n remoteCertificateId?: string;\n}\n\ninterface StoreExceptionsInformation extends ExceptionInformation {\n siteName?: string;\n explanationString?: string;\n detailURI?: string;\n}\n\ninterface StoreSiteSpecificExceptionsInformation extends StoreExceptionsInformation {\n arrayOfDomainStrings?: string[];\n}\n\ninterface UIEventInit extends EventInit {\n view?: Window;\n detail?: number;\n}\n\ninterface WebGLContextAttributes {\n failIfMajorPerformanceCaveat?: boolean;\n alpha?: boolean;\n depth?: boolean;\n stencil?: boolean;\n antialias?: boolean;\n premultipliedAlpha?: boolean;\n preserveDrawingBuffer?: boolean;\n}\n\ninterface WebGLContextEventInit extends EventInit {\n statusMessage?: string;\n}\n\ninterface WheelEventInit extends MouseEventInit {\n deltaX?: number;\n deltaY?: number;\n deltaZ?: number;\n deltaMode?: number;\n}\n\ninterface EventListener {\n (evt: Event): void;\n}\n\ninterface ANGLE_instanced_arrays {\n drawArraysInstancedANGLE(mode: number, first: number, count: number, primcount: number): void;\n drawElementsInstancedANGLE(mode: number, count: number, type: number, offset: number, primcount: number): void;\n vertexAttribDivisorANGLE(index: number, divisor: number): void;\n readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number;\n}\n\ndeclare var ANGLE_instanced_arrays: {\n prototype: ANGLE_instanced_arrays;\n new(): ANGLE_instanced_arrays;\n readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number;\n}\n\ninterface AnalyserNode extends AudioNode {\n fftSize: number;\n readonly frequencyBinCount: number;\n maxDecibels: number;\n minDecibels: number;\n smoothingTimeConstant: number;\n getByteFrequencyData(array: Uint8Array): void;\n getByteTimeDomainData(array: Uint8Array): void;\n getFloatFrequencyData(array: Float32Array): void;\n getFloatTimeDomainData(array: Float32Array): void;\n}\n\ndeclare var AnalyserNode: {\n prototype: AnalyserNode;\n new(): AnalyserNode;\n}\n\ninterface AnimationEvent extends Event {\n readonly animationName: string;\n readonly elapsedTime: number;\n initAnimationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, animationNameArg: string, elapsedTimeArg: number): void;\n}\n\ndeclare var AnimationEvent: {\n prototype: AnimationEvent;\n new(): AnimationEvent;\n}\n\ninterface ApplicationCacheEventMap {\n \"cached\": Event;\n \"checking\": Event;\n \"downloading\": Event;\n \"error\": ErrorEvent;\n \"noupdate\": Event;\n \"obsolete\": Event;\n \"progress\": ProgressEvent;\n \"updateready\": Event;\n}\n\ninterface ApplicationCache extends EventTarget {\n oncached: (this: ApplicationCache, ev: Event) => any;\n onchecking: (this: ApplicationCache, ev: Event) => any;\n ondownloading: (this: ApplicationCache, ev: Event) => any;\n onerror: (this: ApplicationCache, ev: ErrorEvent) => any;\n onnoupdate: (this: ApplicationCache, ev: Event) => any;\n onobsolete: (this: ApplicationCache, ev: Event) => any;\n onprogress: (this: ApplicationCache, ev: ProgressEvent) => any;\n onupdateready: (this: ApplicationCache, ev: Event) => any;\n readonly status: number;\n abort(): void;\n swapCache(): void;\n update(): void;\n readonly CHECKING: number;\n readonly DOWNLOADING: number;\n readonly IDLE: number;\n readonly OBSOLETE: number;\n readonly UNCACHED: number;\n readonly UPDATEREADY: number;\n addEventListener(type: K, listener: (this: ApplicationCache, ev: ApplicationCacheEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var ApplicationCache: {\n prototype: ApplicationCache;\n new(): ApplicationCache;\n readonly CHECKING: number;\n readonly DOWNLOADING: number;\n readonly IDLE: number;\n readonly OBSOLETE: number;\n readonly UNCACHED: number;\n readonly UPDATEREADY: number;\n}\n\ninterface AriaRequestEvent extends Event {\n readonly attributeName: string;\n attributeValue: string | null;\n}\n\ndeclare var AriaRequestEvent: {\n prototype: AriaRequestEvent;\n new(type: string, eventInitDict?: AriaRequestEventInit): AriaRequestEvent;\n}\n\ninterface Attr extends Node {\n readonly name: string;\n readonly ownerElement: Element;\n readonly prefix: string | null;\n readonly specified: boolean;\n value: string;\n}\n\ndeclare var Attr: {\n prototype: Attr;\n new(): Attr;\n}\n\ninterface AudioBuffer {\n readonly duration: number;\n readonly length: number;\n readonly numberOfChannels: number;\n readonly sampleRate: number;\n copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void;\n copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void;\n getChannelData(channel: number): Float32Array;\n}\n\ndeclare var AudioBuffer: {\n prototype: AudioBuffer;\n new(): AudioBuffer;\n}\n\ninterface AudioBufferSourceNodeEventMap {\n \"ended\": MediaStreamErrorEvent;\n}\n\ninterface AudioBufferSourceNode extends AudioNode {\n buffer: AudioBuffer | null;\n readonly detune: AudioParam;\n loop: boolean;\n loopEnd: number;\n loopStart: number;\n onended: (this: AudioBufferSourceNode, ev: MediaStreamErrorEvent) => any;\n readonly playbackRate: AudioParam;\n start(when?: number, offset?: number, duration?: number): void;\n stop(when?: number): void;\n addEventListener(type: K, listener: (this: AudioBufferSourceNode, ev: AudioBufferSourceNodeEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var AudioBufferSourceNode: {\n prototype: AudioBufferSourceNode;\n new(): AudioBufferSourceNode;\n}\n\ninterface AudioContext extends EventTarget {\n readonly currentTime: number;\n readonly destination: AudioDestinationNode;\n readonly listener: AudioListener;\n readonly sampleRate: number;\n state: string;\n createAnalyser(): AnalyserNode;\n createBiquadFilter(): BiquadFilterNode;\n createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer;\n createBufferSource(): AudioBufferSourceNode;\n createChannelMerger(numberOfInputs?: number): ChannelMergerNode;\n createChannelSplitter(numberOfOutputs?: number): ChannelSplitterNode;\n createConvolver(): ConvolverNode;\n createDelay(maxDelayTime?: number): DelayNode;\n createDynamicsCompressor(): DynamicsCompressorNode;\n createGain(): GainNode;\n createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode;\n createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode;\n createOscillator(): OscillatorNode;\n createPanner(): PannerNode;\n createPeriodicWave(real: Float32Array, imag: Float32Array, constraints?: PeriodicWaveConstraints): PeriodicWave;\n createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode;\n createStereoPanner(): StereoPannerNode;\n createWaveShaper(): WaveShaperNode;\n decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): PromiseLike;\n}\n\ndeclare var AudioContext: {\n prototype: AudioContext;\n new(): AudioContext;\n}\n\ninterface AudioDestinationNode extends AudioNode {\n readonly maxChannelCount: number;\n}\n\ndeclare var AudioDestinationNode: {\n prototype: AudioDestinationNode;\n new(): AudioDestinationNode;\n}\n\ninterface AudioListener {\n dopplerFactor: number;\n speedOfSound: number;\n setOrientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): void;\n setPosition(x: number, y: number, z: number): void;\n setVelocity(x: number, y: number, z: number): void;\n}\n\ndeclare var AudioListener: {\n prototype: AudioListener;\n new(): AudioListener;\n}\n\ninterface AudioNode extends EventTarget {\n channelCount: number;\n channelCountMode: string;\n channelInterpretation: string;\n readonly context: AudioContext;\n readonly numberOfInputs: number;\n readonly numberOfOutputs: number;\n connect(destination: AudioNode, output?: number, input?: number): void;\n disconnect(output?: number): void;\n disconnect(destination: AudioNode, output?: number, input?: number): void;\n disconnect(destination: AudioParam, output?: number): void;\n}\n\ndeclare var AudioNode: {\n prototype: AudioNode;\n new(): AudioNode;\n}\n\ninterface AudioParam {\n readonly defaultValue: number;\n value: number;\n cancelScheduledValues(startTime: number): void;\n exponentialRampToValueAtTime(value: number, endTime: number): void;\n linearRampToValueAtTime(value: number, endTime: number): void;\n setTargetAtTime(target: number, startTime: number, timeConstant: number): void;\n setValueAtTime(value: number, startTime: number): void;\n setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void;\n}\n\ndeclare var AudioParam: {\n prototype: AudioParam;\n new(): AudioParam;\n}\n\ninterface AudioProcessingEvent extends Event {\n readonly inputBuffer: AudioBuffer;\n readonly outputBuffer: AudioBuffer;\n readonly playbackTime: number;\n}\n\ndeclare var AudioProcessingEvent: {\n prototype: AudioProcessingEvent;\n new(): AudioProcessingEvent;\n}\n\ninterface AudioTrack {\n enabled: boolean;\n readonly id: string;\n kind: string;\n readonly label: string;\n language: string;\n readonly sourceBuffer: SourceBuffer;\n}\n\ndeclare var AudioTrack: {\n prototype: AudioTrack;\n new(): AudioTrack;\n}\n\ninterface AudioTrackListEventMap {\n \"addtrack\": TrackEvent;\n \"change\": Event;\n \"removetrack\": TrackEvent;\n}\n\ninterface AudioTrackList extends EventTarget {\n readonly length: number;\n onaddtrack: (this: AudioTrackList, ev: TrackEvent) => any;\n onchange: (this: AudioTrackList, ev: Event) => any;\n onremovetrack: (this: AudioTrackList, ev: TrackEvent) => any;\n getTrackById(id: string): AudioTrack | null;\n item(index: number): AudioTrack;\n addEventListener(type: K, listener: (this: AudioTrackList, ev: AudioTrackListEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n [index: number]: AudioTrack;\n}\n\ndeclare var AudioTrackList: {\n prototype: AudioTrackList;\n new(): AudioTrackList;\n}\n\ninterface BarProp {\n readonly visible: boolean;\n}\n\ndeclare var BarProp: {\n prototype: BarProp;\n new(): BarProp;\n}\n\ninterface BeforeUnloadEvent extends Event {\n returnValue: any;\n}\n\ndeclare var BeforeUnloadEvent: {\n prototype: BeforeUnloadEvent;\n new(): BeforeUnloadEvent;\n}\n\ninterface BiquadFilterNode extends AudioNode {\n readonly Q: AudioParam;\n readonly detune: AudioParam;\n readonly frequency: AudioParam;\n readonly gain: AudioParam;\n type: string;\n getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void;\n}\n\ndeclare var BiquadFilterNode: {\n prototype: BiquadFilterNode;\n new(): BiquadFilterNode;\n}\n\ninterface Blob {\n readonly size: number;\n readonly type: string;\n msClose(): void;\n msDetachStream(): any;\n slice(start?: number, end?: number, contentType?: string): Blob;\n}\n\ndeclare var Blob: {\n prototype: Blob;\n new (blobParts?: any[], options?: BlobPropertyBag): Blob;\n}\n\ninterface CDATASection extends Text {\n}\n\ndeclare var CDATASection: {\n prototype: CDATASection;\n new(): CDATASection;\n}\n\ninterface CSS {\n supports(property: string, value?: string): boolean;\n}\ndeclare var CSS: CSS;\n\ninterface CSSConditionRule extends CSSGroupingRule {\n conditionText: string;\n}\n\ndeclare var CSSConditionRule: {\n prototype: CSSConditionRule;\n new(): CSSConditionRule;\n}\n\ninterface CSSFontFaceRule extends CSSRule {\n readonly style: CSSStyleDeclaration;\n}\n\ndeclare var CSSFontFaceRule: {\n prototype: CSSFontFaceRule;\n new(): CSSFontFaceRule;\n}\n\ninterface CSSGroupingRule extends CSSRule {\n readonly cssRules: CSSRuleList;\n deleteRule(index: number): void;\n insertRule(rule: string, index: number): number;\n}\n\ndeclare var CSSGroupingRule: {\n prototype: CSSGroupingRule;\n new(): CSSGroupingRule;\n}\n\ninterface CSSImportRule extends CSSRule {\n readonly href: string;\n readonly media: MediaList;\n readonly styleSheet: CSSStyleSheet;\n}\n\ndeclare var CSSImportRule: {\n prototype: CSSImportRule;\n new(): CSSImportRule;\n}\n\ninterface CSSKeyframeRule extends CSSRule {\n keyText: string;\n readonly style: CSSStyleDeclaration;\n}\n\ndeclare var CSSKeyframeRule: {\n prototype: CSSKeyframeRule;\n new(): CSSKeyframeRule;\n}\n\ninterface CSSKeyframesRule extends CSSRule {\n readonly cssRules: CSSRuleList;\n name: string;\n appendRule(rule: string): void;\n deleteRule(rule: string): void;\n findRule(rule: string): CSSKeyframeRule;\n}\n\ndeclare var CSSKeyframesRule: {\n prototype: CSSKeyframesRule;\n new(): CSSKeyframesRule;\n}\n\ninterface CSSMediaRule extends CSSConditionRule {\n readonly media: MediaList;\n}\n\ndeclare var CSSMediaRule: {\n prototype: CSSMediaRule;\n new(): CSSMediaRule;\n}\n\ninterface CSSNamespaceRule extends CSSRule {\n readonly namespaceURI: string;\n readonly prefix: string;\n}\n\ndeclare var CSSNamespaceRule: {\n prototype: CSSNamespaceRule;\n new(): CSSNamespaceRule;\n}\n\ninterface CSSPageRule extends CSSRule {\n readonly pseudoClass: string;\n readonly selector: string;\n selectorText: string;\n readonly style: CSSStyleDeclaration;\n}\n\ndeclare var CSSPageRule: {\n prototype: CSSPageRule;\n new(): CSSPageRule;\n}\n\ninterface CSSRule {\n cssText: string;\n readonly parentRule: CSSRule;\n readonly parentStyleSheet: CSSStyleSheet;\n readonly type: number;\n readonly CHARSET_RULE: number;\n readonly FONT_FACE_RULE: number;\n readonly IMPORT_RULE: number;\n readonly KEYFRAMES_RULE: number;\n readonly KEYFRAME_RULE: number;\n readonly MEDIA_RULE: number;\n readonly NAMESPACE_RULE: number;\n readonly PAGE_RULE: number;\n readonly STYLE_RULE: number;\n readonly SUPPORTS_RULE: number;\n readonly UNKNOWN_RULE: number;\n readonly VIEWPORT_RULE: number;\n}\n\ndeclare var CSSRule: {\n prototype: CSSRule;\n new(): CSSRule;\n readonly CHARSET_RULE: number;\n readonly FONT_FACE_RULE: number;\n readonly IMPORT_RULE: number;\n readonly KEYFRAMES_RULE: number;\n readonly KEYFRAME_RULE: number;\n readonly MEDIA_RULE: number;\n readonly NAMESPACE_RULE: number;\n readonly PAGE_RULE: number;\n readonly STYLE_RULE: number;\n readonly SUPPORTS_RULE: number;\n readonly UNKNOWN_RULE: number;\n readonly VIEWPORT_RULE: number;\n}\n\ninterface CSSRuleList {\n readonly length: number;\n item(index: number): CSSRule;\n [index: number]: CSSRule;\n}\n\ndeclare var CSSRuleList: {\n prototype: CSSRuleList;\n new(): CSSRuleList;\n}\n\ninterface CSSStyleDeclaration {\n alignContent: string | null;\n alignItems: string | null;\n alignSelf: string | null;\n alignmentBaseline: string | null;\n animation: string | null;\n animationDelay: string | null;\n animationDirection: string | null;\n animationDuration: string | null;\n animationFillMode: string | null;\n animationIterationCount: string | null;\n animationName: string | null;\n animationPlayState: string | null;\n animationTimingFunction: string | null;\n backfaceVisibility: string | null;\n background: string | null;\n backgroundAttachment: string | null;\n backgroundClip: string | null;\n backgroundColor: string | null;\n backgroundImage: string | null;\n backgroundOrigin: string | null;\n backgroundPosition: string | null;\n backgroundPositionX: string | null;\n backgroundPositionY: string | null;\n backgroundRepeat: string | null;\n backgroundSize: string | null;\n baselineShift: string | null;\n border: string | null;\n borderBottom: string | null;\n borderBottomColor: string | null;\n borderBottomLeftRadius: string | null;\n borderBottomRightRadius: string | null;\n borderBottomStyle: string | null;\n borderBottomWidth: string | null;\n borderCollapse: string | null;\n borderColor: string | null;\n borderImage: string | null;\n borderImageOutset: string | null;\n borderImageRepeat: string | null;\n borderImageSlice: string | null;\n borderImageSource: string | null;\n borderImageWidth: string | null;\n borderLeft: string | null;\n borderLeftColor: string | null;\n borderLeftStyle: string | null;\n borderLeftWidth: string | null;\n borderRadius: string | null;\n borderRight: string | null;\n borderRightColor: string | null;\n borderRightStyle: string | null;\n borderRightWidth: string | null;\n borderSpacing: string | null;\n borderStyle: string | null;\n borderTop: string | null;\n borderTopColor: string | null;\n borderTopLeftRadius: string | null;\n borderTopRightRadius: string | null;\n borderTopStyle: string | null;\n borderTopWidth: string | null;\n borderWidth: string | null;\n bottom: string | null;\n boxShadow: string | null;\n boxSizing: string | null;\n breakAfter: string | null;\n breakBefore: string | null;\n breakInside: string | null;\n captionSide: string | null;\n clear: string | null;\n clip: string | null;\n clipPath: string | null;\n clipRule: string | null;\n color: string | null;\n colorInterpolationFilters: string | null;\n columnCount: any;\n columnFill: string | null;\n columnGap: any;\n columnRule: string | null;\n columnRuleColor: any;\n columnRuleStyle: string | null;\n columnRuleWidth: any;\n columnSpan: string | null;\n columnWidth: any;\n columns: string | null;\n content: string | null;\n counterIncrement: string | null;\n counterReset: string | null;\n cssFloat: string | null;\n cssText: string;\n cursor: string | null;\n direction: string | null;\n display: string | null;\n dominantBaseline: string | null;\n emptyCells: string | null;\n enableBackground: string | null;\n fill: string | null;\n fillOpacity: string | null;\n fillRule: string | null;\n filter: string | null;\n flex: string | null;\n flexBasis: string | null;\n flexDirection: string | null;\n flexFlow: string | null;\n flexGrow: string | null;\n flexShrink: string | null;\n flexWrap: string | null;\n floodColor: string | null;\n floodOpacity: string | null;\n font: string | null;\n fontFamily: string | null;\n fontFeatureSettings: string | null;\n fontSize: string | null;\n fontSizeAdjust: string | null;\n fontStretch: string | null;\n fontStyle: string | null;\n fontVariant: string | null;\n fontWeight: string | null;\n glyphOrientationHorizontal: string | null;\n glyphOrientationVertical: string | null;\n height: string | null;\n imeMode: string | null;\n justifyContent: string | null;\n kerning: string | null;\n left: string | null;\n readonly length: number;\n letterSpacing: string | null;\n lightingColor: string | null;\n lineHeight: string | null;\n listStyle: string | null;\n listStyleImage: string | null;\n listStylePosition: string | null;\n listStyleType: string | null;\n margin: string | null;\n marginBottom: string | null;\n marginLeft: string | null;\n marginRight: string | null;\n marginTop: string | null;\n marker: string | null;\n markerEnd: string | null;\n markerMid: string | null;\n markerStart: string | null;\n mask: string | null;\n maxHeight: string | null;\n maxWidth: string | null;\n minHeight: string | null;\n minWidth: string | null;\n msContentZoomChaining: string | null;\n msContentZoomLimit: string | null;\n msContentZoomLimitMax: any;\n msContentZoomLimitMin: any;\n msContentZoomSnap: string | null;\n msContentZoomSnapPoints: string | null;\n msContentZoomSnapType: string | null;\n msContentZooming: string | null;\n msFlowFrom: string | null;\n msFlowInto: string | null;\n msFontFeatureSettings: string | null;\n msGridColumn: any;\n msGridColumnAlign: string | null;\n msGridColumnSpan: any;\n msGridColumns: string | null;\n msGridRow: any;\n msGridRowAlign: string | null;\n msGridRowSpan: any;\n msGridRows: string | null;\n msHighContrastAdjust: string | null;\n msHyphenateLimitChars: string | null;\n msHyphenateLimitLines: any;\n msHyphenateLimitZone: any;\n msHyphens: string | null;\n msImeAlign: string | null;\n msOverflowStyle: string | null;\n msScrollChaining: string | null;\n msScrollLimit: string | null;\n msScrollLimitXMax: any;\n msScrollLimitXMin: any;\n msScrollLimitYMax: any;\n msScrollLimitYMin: any;\n msScrollRails: string | null;\n msScrollSnapPointsX: string | null;\n msScrollSnapPointsY: string | null;\n msScrollSnapType: string | null;\n msScrollSnapX: string | null;\n msScrollSnapY: string | null;\n msScrollTranslation: string | null;\n msTextCombineHorizontal: string | null;\n msTextSizeAdjust: any;\n msTouchAction: string | null;\n msTouchSelect: string | null;\n msUserSelect: string | null;\n msWrapFlow: string;\n msWrapMargin: any;\n msWrapThrough: string;\n opacity: string | null;\n order: string | null;\n orphans: string | null;\n outline: string | null;\n outlineColor: string | null;\n outlineStyle: string | null;\n outlineWidth: string | null;\n overflow: string | null;\n overflowX: string | null;\n overflowY: string | null;\n padding: string | null;\n paddingBottom: string | null;\n paddingLeft: string | null;\n paddingRight: string | null;\n paddingTop: string | null;\n pageBreakAfter: string | null;\n pageBreakBefore: string | null;\n pageBreakInside: string | null;\n readonly parentRule: CSSRule;\n perspective: string | null;\n perspectiveOrigin: string | null;\n pointerEvents: string | null;\n position: string | null;\n quotes: string | null;\n right: string | null;\n rubyAlign: string | null;\n rubyOverhang: string | null;\n rubyPosition: string | null;\n stopColor: string | null;\n stopOpacity: string | null;\n stroke: string | null;\n strokeDasharray: string | null;\n strokeDashoffset: string | null;\n strokeLinecap: string | null;\n strokeLinejoin: string | null;\n strokeMiterlimit: string | null;\n strokeOpacity: string | null;\n strokeWidth: string | null;\n tableLayout: string | null;\n textAlign: string | null;\n textAlignLast: string | null;\n textAnchor: string | null;\n textDecoration: string | null;\n textIndent: string | null;\n textJustify: string | null;\n textKashida: string | null;\n textKashidaSpace: string | null;\n textOverflow: string | null;\n textShadow: string | null;\n textTransform: string | null;\n textUnderlinePosition: string | null;\n top: string | null;\n touchAction: string | null;\n transform: string | null;\n transformOrigin: string | null;\n transformStyle: string | null;\n transition: string | null;\n transitionDelay: string | null;\n transitionDuration: string | null;\n transitionProperty: string | null;\n transitionTimingFunction: string | null;\n unicodeBidi: string | null;\n verticalAlign: string | null;\n visibility: string | null;\n webkitAlignContent: string | null;\n webkitAlignItems: string | null;\n webkitAlignSelf: string | null;\n webkitAnimation: string | null;\n webkitAnimationDelay: string | null;\n webkitAnimationDirection: string | null;\n webkitAnimationDuration: string | null;\n webkitAnimationFillMode: string | null;\n webkitAnimationIterationCount: string | null;\n webkitAnimationName: string | null;\n webkitAnimationPlayState: string | null;\n webkitAnimationTimingFunction: string | null;\n webkitAppearance: string | null;\n webkitBackfaceVisibility: string | null;\n webkitBackgroundClip: string | null;\n webkitBackgroundOrigin: string | null;\n webkitBackgroundSize: string | null;\n webkitBorderBottomLeftRadius: string | null;\n webkitBorderBottomRightRadius: string | null;\n webkitBorderImage: string | null;\n webkitBorderRadius: string | null;\n webkitBorderTopLeftRadius: string | null;\n webkitBorderTopRightRadius: string | null;\n webkitBoxAlign: string | null;\n webkitBoxDirection: string | null;\n webkitBoxFlex: string | null;\n webkitBoxOrdinalGroup: string | null;\n webkitBoxOrient: string | null;\n webkitBoxPack: string | null;\n webkitBoxSizing: string | null;\n webkitColumnBreakAfter: string | null;\n webkitColumnBreakBefore: string | null;\n webkitColumnBreakInside: string | null;\n webkitColumnCount: any;\n webkitColumnGap: any;\n webkitColumnRule: string | null;\n webkitColumnRuleColor: any;\n webkitColumnRuleStyle: string | null;\n webkitColumnRuleWidth: any;\n webkitColumnSpan: string | null;\n webkitColumnWidth: any;\n webkitColumns: string | null;\n webkitFilter: string | null;\n webkitFlex: string | null;\n webkitFlexBasis: string | null;\n webkitFlexDirection: string | null;\n webkitFlexFlow: string | null;\n webkitFlexGrow: string | null;\n webkitFlexShrink: string | null;\n webkitFlexWrap: string | null;\n webkitJustifyContent: string | null;\n webkitOrder: string | null;\n webkitPerspective: string | null;\n webkitPerspectiveOrigin: string | null;\n webkitTapHighlightColor: string | null;\n webkitTextFillColor: string | null;\n webkitTextSizeAdjust: any;\n webkitTransform: string | null;\n webkitTransformOrigin: string | null;\n webkitTransformStyle: string | null;\n webkitTransition: string | null;\n webkitTransitionDelay: string | null;\n webkitTransitionDuration: string | null;\n webkitTransitionProperty: string | null;\n webkitTransitionTimingFunction: string | null;\n webkitUserModify: string | null;\n webkitUserSelect: string | null;\n webkitWritingMode: string | null;\n whiteSpace: string | null;\n widows: string | null;\n width: string | null;\n wordBreak: string | null;\n wordSpacing: string | null;\n wordWrap: string | null;\n writingMode: string | null;\n zIndex: string | null;\n zoom: string | null;\n resize: string | null;\n getPropertyPriority(propertyName: string): string;\n getPropertyValue(propertyName: string): string;\n item(index: number): string;\n removeProperty(propertyName: string): string;\n setProperty(propertyName: string, value: string | null, priority?: string): void;\n [index: number]: string;\n}\n\ndeclare var CSSStyleDeclaration: {\n prototype: CSSStyleDeclaration;\n new(): CSSStyleDeclaration;\n}\n\ninterface CSSStyleRule extends CSSRule {\n readonly readOnly: boolean;\n selectorText: string;\n readonly style: CSSStyleDeclaration;\n}\n\ndeclare var CSSStyleRule: {\n prototype: CSSStyleRule;\n new(): CSSStyleRule;\n}\n\ninterface CSSStyleSheet extends StyleSheet {\n readonly cssRules: CSSRuleList;\n cssText: string;\n readonly href: string;\n readonly id: string;\n readonly imports: StyleSheetList;\n readonly isAlternate: boolean;\n readonly isPrefAlternate: boolean;\n readonly ownerRule: CSSRule;\n readonly owningElement: Element;\n readonly pages: StyleSheetPageList;\n readonly readOnly: boolean;\n readonly rules: CSSRuleList;\n addImport(bstrURL: string, lIndex?: number): number;\n addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number;\n addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number;\n deleteRule(index?: number): void;\n insertRule(rule: string, index?: number): number;\n removeImport(lIndex: number): void;\n removeRule(lIndex: number): void;\n}\n\ndeclare var CSSStyleSheet: {\n prototype: CSSStyleSheet;\n new(): CSSStyleSheet;\n}\n\ninterface CSSSupportsRule extends CSSConditionRule {\n}\n\ndeclare var CSSSupportsRule: {\n prototype: CSSSupportsRule;\n new(): CSSSupportsRule;\n}\n\ninterface CanvasGradient {\n addColorStop(offset: number, color: string): void;\n}\n\ndeclare var CanvasGradient: {\n prototype: CanvasGradient;\n new(): CanvasGradient;\n}\n\ninterface CanvasPattern {\n setTransform(matrix: SVGMatrix): void;\n}\n\ndeclare var CanvasPattern: {\n prototype: CanvasPattern;\n new(): CanvasPattern;\n}\n\ninterface CanvasRenderingContext2D extends Object, CanvasPathMethods {\n readonly canvas: HTMLCanvasElement;\n fillStyle: string | CanvasGradient | CanvasPattern;\n font: string;\n globalAlpha: number;\n globalCompositeOperation: string;\n lineCap: string;\n lineDashOffset: number;\n lineJoin: string;\n lineWidth: number;\n miterLimit: number;\n msFillRule: string;\n msImageSmoothingEnabled: boolean;\n shadowBlur: number;\n shadowColor: string;\n shadowOffsetX: number;\n shadowOffsetY: number;\n strokeStyle: string | CanvasGradient | CanvasPattern;\n textAlign: string;\n textBaseline: string;\n mozImageSmoothingEnabled: boolean;\n webkitImageSmoothingEnabled: boolean;\n oImageSmoothingEnabled: boolean;\n beginPath(): void;\n clearRect(x: number, y: number, w: number, h: number): void;\n clip(fillRule?: string): void;\n createImageData(imageDataOrSw: number | ImageData, sh?: number): ImageData;\n createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient;\n createPattern(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, repetition: string): CanvasPattern;\n createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient;\n drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, offsetX: number, offsetY: number, width?: number, height?: number, canvasOffsetX?: number, canvasOffsetY?: number, canvasImageWidth?: number, canvasImageHeight?: number): void;\n fill(fillRule?: string): void;\n fillRect(x: number, y: number, w: number, h: number): void;\n fillText(text: string, x: number, y: number, maxWidth?: number): void;\n getImageData(sx: number, sy: number, sw: number, sh: number): ImageData;\n getLineDash(): number[];\n isPointInPath(x: number, y: number, fillRule?: string): boolean;\n measureText(text: string): TextMetrics;\n putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void;\n restore(): void;\n rotate(angle: number): void;\n save(): void;\n scale(x: number, y: number): void;\n setLineDash(segments: number[]): void;\n setTransform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void;\n stroke(): void;\n strokeRect(x: number, y: number, w: number, h: number): void;\n strokeText(text: string, x: number, y: number, maxWidth?: number): void;\n transform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void;\n translate(x: number, y: number): void;\n}\n\ndeclare var CanvasRenderingContext2D: {\n prototype: CanvasRenderingContext2D;\n new(): CanvasRenderingContext2D;\n}\n\ninterface ChannelMergerNode extends AudioNode {\n}\n\ndeclare var ChannelMergerNode: {\n prototype: ChannelMergerNode;\n new(): ChannelMergerNode;\n}\n\ninterface ChannelSplitterNode extends AudioNode {\n}\n\ndeclare var ChannelSplitterNode: {\n prototype: ChannelSplitterNode;\n new(): ChannelSplitterNode;\n}\n\ninterface CharacterData extends Node, ChildNode {\n data: string;\n readonly length: number;\n appendData(arg: string): void;\n deleteData(offset: number, count: number): void;\n insertData(offset: number, arg: string): void;\n replaceData(offset: number, count: number, arg: string): void;\n substringData(offset: number, count: number): string;\n}\n\ndeclare var CharacterData: {\n prototype: CharacterData;\n new(): CharacterData;\n}\n\ninterface ClientRect {\n bottom: number;\n readonly height: number;\n left: number;\n right: number;\n top: number;\n readonly width: number;\n}\n\ndeclare var ClientRect: {\n prototype: ClientRect;\n new(): ClientRect;\n}\n\ninterface ClientRectList {\n readonly length: number;\n item(index: number): ClientRect;\n [index: number]: ClientRect;\n}\n\ndeclare var ClientRectList: {\n prototype: ClientRectList;\n new(): ClientRectList;\n}\n\ninterface ClipboardEvent extends Event {\n readonly clipboardData: DataTransfer;\n}\n\ndeclare var ClipboardEvent: {\n prototype: ClipboardEvent;\n new(type: string, eventInitDict?: ClipboardEventInit): ClipboardEvent;\n}\n\ninterface CloseEvent extends Event {\n readonly code: number;\n readonly reason: string;\n readonly wasClean: boolean;\n initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void;\n}\n\ndeclare var CloseEvent: {\n prototype: CloseEvent;\n new(): CloseEvent;\n}\n\ninterface CommandEvent extends Event {\n readonly commandName: string;\n readonly detail: string | null;\n}\n\ndeclare var CommandEvent: {\n prototype: CommandEvent;\n new(type: string, eventInitDict?: CommandEventInit): CommandEvent;\n}\n\ninterface Comment extends CharacterData {\n text: string;\n}\n\ndeclare var Comment: {\n prototype: Comment;\n new(): Comment;\n}\n\ninterface CompositionEvent extends UIEvent {\n readonly data: string;\n readonly locale: string;\n initCompositionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, locale: string): void;\n}\n\ndeclare var CompositionEvent: {\n prototype: CompositionEvent;\n new(typeArg: string, eventInitDict?: CompositionEventInit): CompositionEvent;\n}\n\ninterface Console {\n assert(test?: boolean, message?: string, ...optionalParams: any[]): void;\n clear(): void;\n count(countTitle?: string): void;\n debug(message?: string, ...optionalParams: any[]): void;\n dir(value?: any, ...optionalParams: any[]): void;\n dirxml(value: any): void;\n error(message?: any, ...optionalParams: any[]): void;\n exception(message?: string, ...optionalParams: any[]): void;\n group(groupTitle?: string): void;\n groupCollapsed(groupTitle?: string): void;\n groupEnd(): void;\n info(message?: any, ...optionalParams: any[]): void;\n log(message?: any, ...optionalParams: any[]): void;\n msIsIndependentlyComposed(element: Element): boolean;\n profile(reportName?: string): void;\n profileEnd(): void;\n select(element: Element): void;\n table(...data: any[]): void;\n time(timerName?: string): void;\n timeEnd(timerName?: string): void;\n trace(message?: any, ...optionalParams: any[]): void;\n warn(message?: any, ...optionalParams: any[]): void;\n}\n\ndeclare var Console: {\n prototype: Console;\n new(): Console;\n}\n\ninterface ConvolverNode extends AudioNode {\n buffer: AudioBuffer | null;\n normalize: boolean;\n}\n\ndeclare var ConvolverNode: {\n prototype: ConvolverNode;\n new(): ConvolverNode;\n}\n\ninterface Coordinates {\n readonly accuracy: number;\n readonly altitude: number | null;\n readonly altitudeAccuracy: number | null;\n readonly heading: number | null;\n readonly latitude: number;\n readonly longitude: number;\n readonly speed: number | null;\n}\n\ndeclare var Coordinates: {\n prototype: Coordinates;\n new(): Coordinates;\n}\n\ninterface Crypto extends Object, RandomSource {\n readonly subtle: SubtleCrypto;\n}\n\ndeclare var Crypto: {\n prototype: Crypto;\n new(): Crypto;\n}\n\ninterface CryptoKey {\n readonly algorithm: KeyAlgorithm;\n readonly extractable: boolean;\n readonly type: string;\n readonly usages: string[];\n}\n\ndeclare var CryptoKey: {\n prototype: CryptoKey;\n new(): CryptoKey;\n}\n\ninterface CryptoKeyPair {\n privateKey: CryptoKey;\n publicKey: CryptoKey;\n}\n\ndeclare var CryptoKeyPair: {\n prototype: CryptoKeyPair;\n new(): CryptoKeyPair;\n}\n\ninterface CustomEvent extends Event {\n readonly detail: any;\n initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void;\n}\n\ndeclare var CustomEvent: {\n prototype: CustomEvent;\n new(typeArg: string, eventInitDict?: CustomEventInit): CustomEvent;\n}\n\ninterface DOMError {\n readonly name: string;\n toString(): string;\n}\n\ndeclare var DOMError: {\n prototype: DOMError;\n new(): DOMError;\n}\n\ninterface DOMException {\n readonly code: number;\n readonly message: string;\n readonly name: string;\n toString(): string;\n readonly ABORT_ERR: number;\n readonly DATA_CLONE_ERR: number;\n readonly DOMSTRING_SIZE_ERR: number;\n readonly HIERARCHY_REQUEST_ERR: number;\n readonly INDEX_SIZE_ERR: number;\n readonly INUSE_ATTRIBUTE_ERR: number;\n readonly INVALID_ACCESS_ERR: number;\n readonly INVALID_CHARACTER_ERR: number;\n readonly INVALID_MODIFICATION_ERR: number;\n readonly INVALID_NODE_TYPE_ERR: number;\n readonly INVALID_STATE_ERR: number;\n readonly NAMESPACE_ERR: number;\n readonly NETWORK_ERR: number;\n readonly NOT_FOUND_ERR: number;\n readonly NOT_SUPPORTED_ERR: number;\n readonly NO_DATA_ALLOWED_ERR: number;\n readonly NO_MODIFICATION_ALLOWED_ERR: number;\n readonly PARSE_ERR: number;\n readonly QUOTA_EXCEEDED_ERR: number;\n readonly SECURITY_ERR: number;\n readonly SERIALIZE_ERR: number;\n readonly SYNTAX_ERR: number;\n readonly TIMEOUT_ERR: number;\n readonly TYPE_MISMATCH_ERR: number;\n readonly URL_MISMATCH_ERR: number;\n readonly VALIDATION_ERR: number;\n readonly WRONG_DOCUMENT_ERR: number;\n}\n\ndeclare var DOMException: {\n prototype: DOMException;\n new(): DOMException;\n readonly ABORT_ERR: number;\n readonly DATA_CLONE_ERR: number;\n readonly DOMSTRING_SIZE_ERR: number;\n readonly HIERARCHY_REQUEST_ERR: number;\n readonly INDEX_SIZE_ERR: number;\n readonly INUSE_ATTRIBUTE_ERR: number;\n readonly INVALID_ACCESS_ERR: number;\n readonly INVALID_CHARACTER_ERR: number;\n readonly INVALID_MODIFICATION_ERR: number;\n readonly INVALID_NODE_TYPE_ERR: number;\n readonly INVALID_STATE_ERR: number;\n readonly NAMESPACE_ERR: number;\n readonly NETWORK_ERR: number;\n readonly NOT_FOUND_ERR: number;\n readonly NOT_SUPPORTED_ERR: number;\n readonly NO_DATA_ALLOWED_ERR: number;\n readonly NO_MODIFICATION_ALLOWED_ERR: number;\n readonly PARSE_ERR: number;\n readonly QUOTA_EXCEEDED_ERR: number;\n readonly SECURITY_ERR: number;\n readonly SERIALIZE_ERR: number;\n readonly SYNTAX_ERR: number;\n readonly TIMEOUT_ERR: number;\n readonly TYPE_MISMATCH_ERR: number;\n readonly URL_MISMATCH_ERR: number;\n readonly VALIDATION_ERR: number;\n readonly WRONG_DOCUMENT_ERR: number;\n}\n\ninterface DOMImplementation {\n createDocument(namespaceURI: string | null, qualifiedName: string | null, doctype: DocumentType): Document;\n createDocumentType(qualifiedName: string, publicId: string | null, systemId: string | null): DocumentType;\n createHTMLDocument(title: string): Document;\n hasFeature(feature: string | null, version: string | null): boolean;\n}\n\ndeclare var DOMImplementation: {\n prototype: DOMImplementation;\n new(): DOMImplementation;\n}\n\ninterface DOMParser {\n parseFromString(source: string, mimeType: string): Document;\n}\n\ndeclare var DOMParser: {\n prototype: DOMParser;\n new(): DOMParser;\n}\n\ninterface DOMSettableTokenList extends DOMTokenList {\n value: string;\n}\n\ndeclare var DOMSettableTokenList: {\n prototype: DOMSettableTokenList;\n new(): DOMSettableTokenList;\n}\n\ninterface DOMStringList {\n readonly length: number;\n contains(str: string): boolean;\n item(index: number): string | null;\n [index: number]: string;\n}\n\ndeclare var DOMStringList: {\n prototype: DOMStringList;\n new(): DOMStringList;\n}\n\ninterface DOMStringMap {\n [name: string]: string;\n}\n\ndeclare var DOMStringMap: {\n prototype: DOMStringMap;\n new(): DOMStringMap;\n}\n\ninterface DOMTokenList {\n readonly length: number;\n add(...token: string[]): void;\n contains(token: string): boolean;\n item(index: number): string;\n remove(...token: string[]): void;\n toString(): string;\n toggle(token: string, force?: boolean): boolean;\n [index: number]: string;\n}\n\ndeclare var DOMTokenList: {\n prototype: DOMTokenList;\n new(): DOMTokenList;\n}\n\ninterface DataCue extends TextTrackCue {\n data: ArrayBuffer;\n addEventListener(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var DataCue: {\n prototype: DataCue;\n new(): DataCue;\n}\n\ninterface DataTransfer {\n dropEffect: string;\n effectAllowed: string;\n readonly files: FileList;\n readonly items: DataTransferItemList;\n readonly types: string[];\n clearData(format?: string): boolean;\n getData(format: string): string;\n setData(format: string, data: string): boolean;\n}\n\ndeclare var DataTransfer: {\n prototype: DataTransfer;\n new(): DataTransfer;\n}\n\ninterface DataTransferItem {\n readonly kind: string;\n readonly type: string;\n getAsFile(): File | null;\n getAsString(_callback: FunctionStringCallback | null): void;\n}\n\ndeclare var DataTransferItem: {\n prototype: DataTransferItem;\n new(): DataTransferItem;\n}\n\ninterface DataTransferItemList {\n readonly length: number;\n add(data: File): DataTransferItem | null;\n clear(): void;\n item(index: number): DataTransferItem;\n remove(index: number): void;\n [index: number]: DataTransferItem;\n}\n\ndeclare var DataTransferItemList: {\n prototype: DataTransferItemList;\n new(): DataTransferItemList;\n}\n\ninterface DeferredPermissionRequest {\n readonly id: number;\n readonly type: string;\n readonly uri: string;\n allow(): void;\n deny(): void;\n}\n\ndeclare var DeferredPermissionRequest: {\n prototype: DeferredPermissionRequest;\n new(): DeferredPermissionRequest;\n}\n\ninterface DelayNode extends AudioNode {\n readonly delayTime: AudioParam;\n}\n\ndeclare var DelayNode: {\n prototype: DelayNode;\n new(): DelayNode;\n}\n\ninterface DeviceAcceleration {\n readonly x: number | null;\n readonly y: number | null;\n readonly z: number | null;\n}\n\ndeclare var DeviceAcceleration: {\n prototype: DeviceAcceleration;\n new(): DeviceAcceleration;\n}\n\ninterface DeviceLightEvent extends Event {\n readonly value: number;\n}\n\ndeclare var DeviceLightEvent: {\n prototype: DeviceLightEvent;\n new(type: string, eventInitDict?: DeviceLightEventInit): DeviceLightEvent;\n}\n\ninterface DeviceMotionEvent extends Event {\n readonly acceleration: DeviceAcceleration | null;\n readonly accelerationIncludingGravity: DeviceAcceleration | null;\n readonly interval: number | null;\n readonly rotationRate: DeviceRotationRate | null;\n initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict | null, accelerationIncludingGravity: DeviceAccelerationDict | null, rotationRate: DeviceRotationRateDict | null, interval: number | null): void;\n}\n\ndeclare var DeviceMotionEvent: {\n prototype: DeviceMotionEvent;\n new(): DeviceMotionEvent;\n}\n\ninterface DeviceOrientationEvent extends Event {\n readonly absolute: boolean;\n readonly alpha: number | null;\n readonly beta: number | null;\n readonly gamma: number | null;\n initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number | null, beta: number | null, gamma: number | null, absolute: boolean): void;\n}\n\ndeclare var DeviceOrientationEvent: {\n prototype: DeviceOrientationEvent;\n new(): DeviceOrientationEvent;\n}\n\ninterface DeviceRotationRate {\n readonly alpha: number | null;\n readonly beta: number | null;\n readonly gamma: number | null;\n}\n\ndeclare var DeviceRotationRate: {\n prototype: DeviceRotationRate;\n new(): DeviceRotationRate;\n}\n\ninterface DocumentEventMap extends GlobalEventHandlersEventMap {\n \"abort\": UIEvent;\n \"activate\": UIEvent;\n \"beforeactivate\": UIEvent;\n \"beforedeactivate\": UIEvent;\n \"blur\": FocusEvent;\n \"canplay\": Event;\n \"canplaythrough\": Event;\n \"change\": Event;\n \"click\": MouseEvent;\n \"contextmenu\": PointerEvent;\n \"dblclick\": MouseEvent;\n \"deactivate\": UIEvent;\n \"drag\": DragEvent;\n \"dragend\": DragEvent;\n \"dragenter\": DragEvent;\n \"dragleave\": DragEvent;\n \"dragover\": DragEvent;\n \"dragstart\": DragEvent;\n \"drop\": DragEvent;\n \"durationchange\": Event;\n \"emptied\": Event;\n \"ended\": MediaStreamErrorEvent;\n \"error\": ErrorEvent;\n \"focus\": FocusEvent;\n \"fullscreenchange\": Event;\n \"fullscreenerror\": Event;\n \"input\": Event;\n \"invalid\": Event;\n \"keydown\": KeyboardEvent;\n \"keypress\": KeyboardEvent;\n \"keyup\": KeyboardEvent;\n \"load\": Event;\n \"loadeddata\": Event;\n \"loadedmetadata\": Event;\n \"loadstart\": Event;\n \"mousedown\": MouseEvent;\n \"mousemove\": MouseEvent;\n \"mouseout\": MouseEvent;\n \"mouseover\": MouseEvent;\n \"mouseup\": MouseEvent;\n \"mousewheel\": WheelEvent;\n \"MSContentZoom\": UIEvent;\n \"MSGestureChange\": MSGestureEvent;\n \"MSGestureDoubleTap\": MSGestureEvent;\n \"MSGestureEnd\": MSGestureEvent;\n \"MSGestureHold\": MSGestureEvent;\n \"MSGestureStart\": MSGestureEvent;\n \"MSGestureTap\": MSGestureEvent;\n \"MSInertiaStart\": MSGestureEvent;\n \"MSManipulationStateChanged\": MSManipulationEvent;\n \"MSPointerCancel\": MSPointerEvent;\n \"MSPointerDown\": MSPointerEvent;\n \"MSPointerEnter\": MSPointerEvent;\n \"MSPointerLeave\": MSPointerEvent;\n \"MSPointerMove\": MSPointerEvent;\n \"MSPointerOut\": MSPointerEvent;\n \"MSPointerOver\": MSPointerEvent;\n \"MSPointerUp\": MSPointerEvent;\n \"mssitemodejumplistitemremoved\": MSSiteModeEvent;\n \"msthumbnailclick\": MSSiteModeEvent;\n \"pause\": Event;\n \"play\": Event;\n \"playing\": Event;\n \"pointerlockchange\": Event;\n \"pointerlockerror\": Event;\n \"progress\": ProgressEvent;\n \"ratechange\": Event;\n \"readystatechange\": ProgressEvent;\n \"reset\": Event;\n \"scroll\": UIEvent;\n \"seeked\": Event;\n \"seeking\": Event;\n \"select\": UIEvent;\n \"selectionchange\": Event;\n \"selectstart\": Event;\n \"stalled\": Event;\n \"stop\": Event;\n \"submit\": Event;\n \"suspend\": Event;\n \"timeupdate\": Event;\n \"touchcancel\": TouchEvent;\n \"touchend\": TouchEvent;\n \"touchmove\": TouchEvent;\n \"touchstart\": TouchEvent;\n \"volumechange\": Event;\n \"waiting\": Event;\n \"webkitfullscreenchange\": Event;\n \"webkitfullscreenerror\": Event;\n}\n\ninterface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode, DocumentOrShadowRoot {\n /**\n * Sets or gets the URL for the current document. \n */\n readonly URL: string;\n /**\n * Gets the URL for the document, stripped of any character encoding.\n */\n readonly URLUnencoded: string;\n /**\n * Gets the object that has the focus when the parent document has focus.\n */\n readonly activeElement: Element;\n /**\n * Sets or gets the color of all active links in the document.\n */\n alinkColor: string;\n /**\n * Returns a reference to the collection of elements contained by the object.\n */\n readonly all: HTMLAllCollection;\n /**\n * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order.\n */\n anchors: HTMLCollectionOf;\n /**\n * Retrieves a collection of all applet objects in the document.\n */\n applets: HTMLCollectionOf;\n /**\n * Deprecated. Sets or retrieves a value that indicates the background color behind the object. \n */\n bgColor: string;\n /**\n * Specifies the beginning and end of the document body.\n */\n body: HTMLElement;\n readonly characterSet: string;\n /**\n * Gets or sets the character set used to encode the object.\n */\n charset: string;\n /**\n * Gets a value that indicates whether standards-compliant mode is switched on for the object.\n */\n readonly compatMode: string;\n cookie: string;\n readonly currentScript: HTMLScriptElement | SVGScriptElement;\n /**\n * Gets the default character set from the current regional language settings.\n */\n readonly defaultCharset: string;\n readonly defaultView: Window;\n /**\n * Sets or gets a value that indicates whether the document can be edited.\n */\n designMode: string;\n /**\n * Sets or retrieves a value that indicates the reading order of the object. \n */\n dir: string;\n /**\n * Gets an object representing the document type declaration associated with the current document. \n */\n readonly doctype: DocumentType;\n /**\n * Gets a reference to the root node of the document. \n */\n documentElement: HTMLElement;\n /**\n * Sets or gets the security domain of the document. \n */\n domain: string;\n /**\n * Retrieves a collection of all embed objects in the document.\n */\n embeds: HTMLCollectionOf;\n /**\n * Sets or gets the foreground (text) color of the document.\n */\n fgColor: string;\n /**\n * Retrieves a collection, in source order, of all form objects in the document.\n */\n forms: HTMLCollectionOf;\n readonly fullscreenElement: Element | null;\n readonly fullscreenEnabled: boolean;\n readonly head: HTMLHeadElement;\n readonly hidden: boolean;\n /**\n * Retrieves a collection, in source order, of img objects in the document.\n */\n images: HTMLCollectionOf;\n /**\n * Gets the implementation object of the current document. \n */\n readonly implementation: DOMImplementation;\n /**\n * Returns the character encoding used to create the webpage that is loaded into the document object.\n */\n readonly inputEncoding: string | null;\n /**\n * Gets the date that the page was last modified, if the page supplies one. \n */\n readonly lastModified: string;\n /**\n * Sets or gets the color of the document links. \n */\n linkColor: string;\n /**\n * Retrieves a collection of all a objects that specify the href property and all area objects in the document.\n */\n links: HTMLCollectionOf;\n /**\n * Contains information about the current URL. \n */\n readonly location: Location;\n msCSSOMElementFloatMetrics: boolean;\n msCapsLockWarningOff: boolean;\n /**\n * Fires when the user aborts the download.\n * @param ev The event.\n */\n onabort: (this: Document, ev: UIEvent) => any;\n /**\n * Fires when the object is set as the active element.\n * @param ev The event.\n */\n onactivate: (this: Document, ev: UIEvent) => any;\n /**\n * Fires immediately before the object is set as the active element.\n * @param ev The event.\n */\n onbeforeactivate: (this: Document, ev: UIEvent) => any;\n /**\n * Fires immediately before the activeElement is changed from the current object to another object in the parent document.\n * @param ev The event.\n */\n onbeforedeactivate: (this: Document, ev: UIEvent) => any;\n /** \n * Fires when the object loses the input focus. \n * @param ev The focus event.\n */\n onblur: (this: Document, ev: FocusEvent) => any;\n /**\n * Occurs when playback is possible, but would require further buffering. \n * @param ev The event.\n */\n oncanplay: (this: Document, ev: Event) => any;\n oncanplaythrough: (this: Document, ev: Event) => any;\n /**\n * Fires when the contents of the object or selection have changed. \n * @param ev The event.\n */\n onchange: (this: Document, ev: Event) => any;\n /**\n * Fires when the user clicks the left mouse button on the object\n * @param ev The mouse event.\n */\n onclick: (this: Document, ev: MouseEvent) => any;\n /**\n * Fires when the user clicks the right mouse button in the client area, opening the context menu. \n * @param ev The mouse event.\n */\n oncontextmenu: (this: Document, ev: PointerEvent) => any;\n /**\n * Fires when the user double-clicks the object.\n * @param ev The mouse event.\n */\n ondblclick: (this: Document, ev: MouseEvent) => any;\n /**\n * Fires when the activeElement is changed from the current object to another object in the parent document.\n * @param ev The UI Event\n */\n ondeactivate: (this: Document, ev: UIEvent) => any;\n /**\n * Fires on the source object continuously during a drag operation.\n * @param ev The event.\n */\n ondrag: (this: Document, ev: DragEvent) => any;\n /**\n * Fires on the source object when the user releases the mouse at the close of a drag operation.\n * @param ev The event.\n */\n ondragend: (this: Document, ev: DragEvent) => any;\n /** \n * Fires on the target element when the user drags the object to a valid drop target.\n * @param ev The drag event.\n */\n ondragenter: (this: Document, ev: DragEvent) => any;\n /** \n * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation.\n * @param ev The drag event.\n */\n ondragleave: (this: Document, ev: DragEvent) => any;\n /**\n * Fires on the target element continuously while the user drags the object over a valid drop target.\n * @param ev The event.\n */\n ondragover: (this: Document, ev: DragEvent) => any;\n /**\n * Fires on the source object when the user starts to drag a text selection or selected object. \n * @param ev The event.\n */\n ondragstart: (this: Document, ev: DragEvent) => any;\n ondrop: (this: Document, ev: DragEvent) => any;\n /**\n * Occurs when the duration attribute is updated. \n * @param ev The event.\n */\n ondurationchange: (this: Document, ev: Event) => any;\n /**\n * Occurs when the media element is reset to its initial state. \n * @param ev The event.\n */\n onemptied: (this: Document, ev: Event) => any;\n /**\n * Occurs when the end of playback is reached. \n * @param ev The event\n */\n onended: (this: Document, ev: MediaStreamErrorEvent) => any;\n /**\n * Fires when an error occurs during object loading.\n * @param ev The event.\n */\n onerror: (this: Document, ev: ErrorEvent) => any;\n /**\n * Fires when the object receives focus. \n * @param ev The event.\n */\n onfocus: (this: Document, ev: FocusEvent) => any;\n onfullscreenchange: (this: Document, ev: Event) => any;\n onfullscreenerror: (this: Document, ev: Event) => any;\n oninput: (this: Document, ev: Event) => any;\n oninvalid: (this: Document, ev: Event) => any;\n /**\n * Fires when the user presses a key.\n * @param ev The keyboard event\n */\n onkeydown: (this: Document, ev: KeyboardEvent) => any;\n /**\n * Fires when the user presses an alphanumeric key.\n * @param ev The event.\n */\n onkeypress: (this: Document, ev: KeyboardEvent) => any;\n /**\n * Fires when the user releases a key.\n * @param ev The keyboard event\n */\n onkeyup: (this: Document, ev: KeyboardEvent) => any;\n /**\n * Fires immediately after the browser loads the object. \n * @param ev The event.\n */\n onload: (this: Document, ev: Event) => any;\n /**\n * Occurs when media data is loaded at the current playback position. \n * @param ev The event.\n */\n onloadeddata: (this: Document, ev: Event) => any;\n /**\n * Occurs when the duration and dimensions of the media have been determined.\n * @param ev The event.\n */\n onloadedmetadata: (this: Document, ev: Event) => any;\n /**\n * Occurs when Internet Explorer begins looking for media data. \n * @param ev The event.\n */\n onloadstart: (this: Document, ev: Event) => any;\n /**\n * Fires when the user clicks the object with either mouse button. \n * @param ev The mouse event.\n */\n onmousedown: (this: Document, ev: MouseEvent) => any;\n /**\n * Fires when the user moves the mouse over the object. \n * @param ev The mouse event.\n */\n onmousemove: (this: Document, ev: MouseEvent) => any;\n /**\n * Fires when the user moves the mouse pointer outside the boundaries of the object. \n * @param ev The mouse event.\n */\n onmouseout: (this: Document, ev: MouseEvent) => any;\n /**\n * Fires when the user moves the mouse pointer into the object.\n * @param ev The mouse event.\n */\n onmouseover: (this: Document, ev: MouseEvent) => any;\n /**\n * Fires when the user releases a mouse button while the mouse is over the object. \n * @param ev The mouse event.\n */\n onmouseup: (this: Document, ev: MouseEvent) => any;\n /**\n * Fires when the wheel button is rotated. \n * @param ev The mouse event\n */\n onmousewheel: (this: Document, ev: WheelEvent) => any;\n onmscontentzoom: (this: Document, ev: UIEvent) => any;\n onmsgesturechange: (this: Document, ev: MSGestureEvent) => any;\n onmsgesturedoubletap: (this: Document, ev: MSGestureEvent) => any;\n onmsgestureend: (this: Document, ev: MSGestureEvent) => any;\n onmsgesturehold: (this: Document, ev: MSGestureEvent) => any;\n onmsgesturestart: (this: Document, ev: MSGestureEvent) => any;\n onmsgesturetap: (this: Document, ev: MSGestureEvent) => any;\n onmsinertiastart: (this: Document, ev: MSGestureEvent) => any;\n onmsmanipulationstatechanged: (this: Document, ev: MSManipulationEvent) => any;\n onmspointercancel: (this: Document, ev: MSPointerEvent) => any;\n onmspointerdown: (this: Document, ev: MSPointerEvent) => any;\n onmspointerenter: (this: Document, ev: MSPointerEvent) => any;\n onmspointerleave: (this: Document, ev: MSPointerEvent) => any;\n onmspointermove: (this: Document, ev: MSPointerEvent) => any;\n onmspointerout: (this: Document, ev: MSPointerEvent) => any;\n onmspointerover: (this: Document, ev: MSPointerEvent) => any;\n onmspointerup: (this: Document, ev: MSPointerEvent) => any;\n /**\n * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. \n * @param ev The event.\n */\n onmssitemodejumplistitemremoved: (this: Document, ev: MSSiteModeEvent) => any;\n /**\n * Occurs when a user clicks a button in a Thumbnail Toolbar of a webpage running in Site Mode.\n * @param ev The event.\n */\n onmsthumbnailclick: (this: Document, ev: MSSiteModeEvent) => any;\n /**\n * Occurs when playback is paused.\n * @param ev The event.\n */\n onpause: (this: Document, ev: Event) => any;\n /**\n * Occurs when the play method is requested. \n * @param ev The event.\n */\n onplay: (this: Document, ev: Event) => any;\n /**\n * Occurs when the audio or video has started playing. \n * @param ev The event.\n */\n onplaying: (this: Document, ev: Event) => any;\n onpointerlockchange: (this: Document, ev: Event) => any;\n onpointerlockerror: (this: Document, ev: Event) => any;\n /**\n * Occurs to indicate progress while downloading media data. \n * @param ev The event.\n */\n onprogress: (this: Document, ev: ProgressEvent) => any;\n /**\n * Occurs when the playback rate is increased or decreased. \n * @param ev The event.\n */\n onratechange: (this: Document, ev: Event) => any;\n /**\n * Fires when the state of the object has changed.\n * @param ev The event\n */\n onreadystatechange: (this: Document, ev: ProgressEvent) => any;\n /**\n * Fires when the user resets a form. \n * @param ev The event.\n */\n onreset: (this: Document, ev: Event) => any;\n /**\n * Fires when the user repositions the scroll box in the scroll bar on the object. \n * @param ev The event.\n */\n onscroll: (this: Document, ev: UIEvent) => any;\n /**\n * Occurs when the seek operation ends. \n * @param ev The event.\n */\n onseeked: (this: Document, ev: Event) => any;\n /**\n * Occurs when the current playback position is moved. \n * @param ev The event.\n */\n onseeking: (this: Document, ev: Event) => any;\n /**\n * Fires when the current selection changes.\n * @param ev The event.\n */\n onselect: (this: Document, ev: UIEvent) => any;\n /**\n * Fires when the selection state of a document changes.\n * @param ev The event.\n */\n onselectionchange: (this: Document, ev: Event) => any;\n onselectstart: (this: Document, ev: Event) => any;\n /**\n * Occurs when the download has stopped. \n * @param ev The event.\n */\n onstalled: (this: Document, ev: Event) => any;\n /**\n * Fires when the user clicks the Stop button or leaves the Web page.\n * @param ev The event.\n */\n onstop: (this: Document, ev: Event) => any;\n onsubmit: (this: Document, ev: Event) => any;\n /**\n * Occurs if the load operation has been intentionally halted. \n * @param ev The event.\n */\n onsuspend: (this: Document, ev: Event) => any;\n /**\n * Occurs to indicate the current playback position.\n * @param ev The event.\n */\n ontimeupdate: (this: Document, ev: Event) => any;\n ontouchcancel: (ev: TouchEvent) => any;\n ontouchend: (ev: TouchEvent) => any;\n ontouchmove: (ev: TouchEvent) => any;\n ontouchstart: (ev: TouchEvent) => any;\n /**\n * Occurs when the volume is changed, or playback is muted or unmuted.\n * @param ev The event.\n */\n onvolumechange: (this: Document, ev: Event) => any;\n /**\n * Occurs when playback stops because the next frame of a video resource is not available. \n * @param ev The event.\n */\n onwaiting: (this: Document, ev: Event) => any;\n onwebkitfullscreenchange: (this: Document, ev: Event) => any;\n onwebkitfullscreenerror: (this: Document, ev: Event) => any;\n plugins: HTMLCollectionOf;\n readonly pointerLockElement: Element;\n /**\n * Retrieves a value that indicates the current state of the object.\n */\n readonly readyState: string;\n /**\n * Gets the URL of the location that referred the user to the current page.\n */\n readonly referrer: string;\n /**\n * Gets the root svg element in the document hierarchy.\n */\n readonly rootElement: SVGSVGElement;\n /**\n * Retrieves a collection of all script objects in the document.\n */\n scripts: HTMLCollectionOf;\n readonly scrollingElement: Element | null;\n /**\n * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document.\n */\n readonly styleSheets: StyleSheetList;\n /**\n * Contains the title of the document.\n */\n title: string;\n readonly visibilityState: string;\n /** \n * Sets or gets the color of the links that the user has visited.\n */\n vlinkColor: string;\n readonly webkitCurrentFullScreenElement: Element | null;\n readonly webkitFullscreenElement: Element | null;\n readonly webkitFullscreenEnabled: boolean;\n readonly webkitIsFullScreen: boolean;\n readonly xmlEncoding: string | null;\n xmlStandalone: boolean;\n /**\n * Gets or sets the version attribute specified in the declaration of an XML document.\n */\n xmlVersion: string | null;\n adoptNode(source: Node): Node;\n captureEvents(): void;\n caretRangeFromPoint(x: number, y: number): Range;\n clear(): void;\n /**\n * Closes an output stream and forces the sent data to display.\n */\n close(): void;\n /**\n * Creates an attribute object with a specified name.\n * @param name String that sets the attribute object's name.\n */\n createAttribute(name: string): Attr;\n createAttributeNS(namespaceURI: string | null, qualifiedName: string): Attr;\n createCDATASection(data: string): CDATASection;\n /**\n * Creates a comment object with the specified data.\n * @param data Sets the comment object's data.\n */\n createComment(data: string): Comment;\n /**\n * Creates a new document.\n */\n createDocumentFragment(): DocumentFragment;\n /**\n * Creates an instance of the element for the specified tag.\n * @param tagName The name of an element.\n */\n createElement(tagName: K): HTMLElementTagNameMap[K];\n createElement(tagName: string): HTMLElement;\n createElementNS(namespaceURI: \"http://www.w3.org/1999/xhtml\", qualifiedName: string): HTMLElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"a\"): SVGAElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"circle\"): SVGCircleElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"clipPath\"): SVGClipPathElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"componentTransferFunction\"): SVGComponentTransferFunctionElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"defs\"): SVGDefsElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"desc\"): SVGDescElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"ellipse\"): SVGEllipseElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feBlend\"): SVGFEBlendElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feColorMatrix\"): SVGFEColorMatrixElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feComponentTransfer\"): SVGFEComponentTransferElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feComposite\"): SVGFECompositeElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feConvolveMatrix\"): SVGFEConvolveMatrixElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feDiffuseLighting\"): SVGFEDiffuseLightingElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feDisplacementMap\"): SVGFEDisplacementMapElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feDistantLight\"): SVGFEDistantLightElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feFlood\"): SVGFEFloodElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feFuncA\"): SVGFEFuncAElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feFuncB\"): SVGFEFuncBElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feFuncG\"): SVGFEFuncGElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feFuncR\"): SVGFEFuncRElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feGaussianBlur\"): SVGFEGaussianBlurElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feImage\"): SVGFEImageElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feMerge\"): SVGFEMergeElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feMergeNode\"): SVGFEMergeNodeElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feMorphology\"): SVGFEMorphologyElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feOffset\"): SVGFEOffsetElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"fePointLight\"): SVGFEPointLightElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feSpecularLighting\"): SVGFESpecularLightingElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feSpotLight\"): SVGFESpotLightElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feTile\"): SVGFETileElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feTurbulence\"): SVGFETurbulenceElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"filter\"): SVGFilterElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"foreignObject\"): SVGForeignObjectElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"g\"): SVGGElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"image\"): SVGImageElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"gradient\"): SVGGradientElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"line\"): SVGLineElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"linearGradient\"): SVGLinearGradientElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"marker\"): SVGMarkerElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"mask\"): SVGMaskElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"path\"): SVGPathElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"metadata\"): SVGMetadataElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"pattern\"): SVGPatternElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"polygon\"): SVGPolygonElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"polyline\"): SVGPolylineElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"radialGradient\"): SVGRadialGradientElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"rect\"): SVGRectElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"svg\"): SVGSVGElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"script\"): SVGScriptElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"stop\"): SVGStopElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"style\"): SVGStyleElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"switch\"): SVGSwitchElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"symbol\"): SVGSymbolElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"tspan\"): SVGTSpanElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"textContent\"): SVGTextContentElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"text\"): SVGTextElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"textPath\"): SVGTextPathElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"textPositioning\"): SVGTextPositioningElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"title\"): SVGTitleElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"use\"): SVGUseElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"view\"): SVGViewElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: string): SVGElement\n createElementNS(namespaceURI: string | null, qualifiedName: string): Element;\n createExpression(expression: string, resolver: XPathNSResolver): XPathExpression;\n createNSResolver(nodeResolver: Node): XPathNSResolver;\n /**\n * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. \n * @param root The root element or node to start traversing on.\n * @param whatToShow The type of nodes or elements to appear in the node list\n * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter.\n * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded.\n */\n createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): NodeIterator;\n createProcessingInstruction(target: string, data: string): ProcessingInstruction;\n /**\n * Returns an empty range object that has both of its boundary points positioned at the beginning of the document. \n */\n createRange(): Range;\n /**\n * Creates a text string from the specified value. \n * @param data String that specifies the nodeValue property of the text node.\n */\n createTextNode(data: string): Text;\n createTouch(view: Window, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch;\n createTouchList(...touches: Touch[]): TouchList;\n /**\n * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document.\n * @param root The root element or node to start traversing on.\n * @param whatToShow The type of nodes or elements to appear in the node list. For more information, see whatToShow.\n * @param filter A custom NodeFilter function to use.\n * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded.\n */\n createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): TreeWalker;\n /**\n * Returns the element for the specified x coordinate and the specified y coordinate. \n * @param x The x-offset\n * @param y The y-offset\n */\n elementFromPoint(x: number, y: number): Element;\n evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult;\n /**\n * Executes a command on the current document, current selection, or the given range.\n * @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script.\n * @param showUI Display the user interface, defaults to false.\n * @param value Value to assign.\n */\n execCommand(commandId: string, showUI?: boolean, value?: any): boolean;\n /**\n * Displays help information for the given command identifier.\n * @param commandId Displays help information for the given command identifier.\n */\n execCommandShowHelp(commandId: string): boolean;\n exitFullscreen(): void;\n exitPointerLock(): void;\n /**\n * Causes the element to receive the focus and executes the code specified by the onfocus event.\n */\n focus(): void;\n /**\n * Returns a reference to the first object with the specified value of the ID or NAME attribute.\n * @param elementId String that specifies the ID value. Case-insensitive.\n */\n getElementById(elementId: string): HTMLElement | null;\n getElementsByClassName(classNames: string): HTMLCollectionOf;\n /**\n * Gets a collection of objects based on the value of the NAME or ID attribute.\n * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute.\n */\n getElementsByName(elementName: string): NodeListOf;\n /**\n * Retrieves a collection of objects based on the specified element name.\n * @param name Specifies the name of an element.\n */\n getElementsByTagName(tagname: K): ElementListTagNameMap[K];\n getElementsByTagName(tagname: string): NodeListOf;\n getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/1999/xhtml\", localName: string): HTMLCollectionOf;\n getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/2000/svg\", localName: string): HTMLCollectionOf;\n getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf;\n /**\n * Returns an object representing the current selection of the document that is loaded into the object displaying a webpage.\n */\n getSelection(): Selection;\n /**\n * Gets a value indicating whether the object currently has focus.\n */\n hasFocus(): boolean;\n importNode(importedNode: Node, deep: boolean): Node;\n msElementsFromPoint(x: number, y: number): NodeListOf;\n msElementsFromRect(left: number, top: number, width: number, height: number): NodeListOf;\n /**\n * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method.\n * @param url Specifies a MIME type for the document.\n * @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element.\n * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, \"fullscreen=yes, toolbar=yes\"). The following values are supported.\n * @param replace Specifies whether the existing entry for the document is replaced in the history list.\n */\n open(url?: string, name?: string, features?: string, replace?: boolean): Document;\n /** \n * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document.\n * @param commandId Specifies a command identifier.\n */\n queryCommandEnabled(commandId: string): boolean;\n /**\n * Returns a Boolean value that indicates whether the specified command is in the indeterminate state.\n * @param commandId String that specifies a command identifier.\n */\n queryCommandIndeterm(commandId: string): boolean;\n /**\n * Returns a Boolean value that indicates the current state of the command.\n * @param commandId String that specifies a command identifier.\n */\n queryCommandState(commandId: string): boolean;\n /**\n * Returns a Boolean value that indicates whether the current command is supported on the current range.\n * @param commandId Specifies a command identifier.\n */\n queryCommandSupported(commandId: string): boolean;\n /**\n * Retrieves the string associated with a command.\n * @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers. \n */\n queryCommandText(commandId: string): string;\n /**\n * Returns the current value of the document, range, or current selection for the given command.\n * @param commandId String that specifies a command identifier.\n */\n queryCommandValue(commandId: string): string;\n releaseEvents(): void;\n /**\n * Allows updating the print settings for the page.\n */\n updateSettings(): void;\n webkitCancelFullScreen(): void;\n webkitExitFullscreen(): void;\n /**\n * Writes one or more HTML expressions to a document in the specified window. \n * @param content Specifies the text and HTML tags to write.\n */\n write(...content: string[]): void;\n /**\n * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. \n * @param content The text and HTML tags to write.\n */\n writeln(...content: string[]): void;\n addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var Document: {\n prototype: Document;\n new(): Document;\n}\n\ninterface DocumentFragment extends Node, NodeSelector, ParentNode {\n}\n\ndeclare var DocumentFragment: {\n prototype: DocumentFragment;\n new(): DocumentFragment;\n}\n\ninterface DocumentType extends Node, ChildNode {\n readonly entities: NamedNodeMap;\n readonly internalSubset: string | null;\n readonly name: string;\n readonly notations: NamedNodeMap;\n readonly publicId: string | null;\n readonly systemId: string | null;\n}\n\ndeclare var DocumentType: {\n prototype: DocumentType;\n new(): DocumentType;\n}\n\ninterface DragEvent extends MouseEvent {\n readonly dataTransfer: DataTransfer;\n initDragEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, dataTransferArg: DataTransfer): void;\n msConvertURL(file: File, targetType: string, targetURL?: string): void;\n}\n\ndeclare var DragEvent: {\n prototype: DragEvent;\n new(): DragEvent;\n}\n\ninterface DynamicsCompressorNode extends AudioNode {\n readonly attack: AudioParam;\n readonly knee: AudioParam;\n readonly ratio: AudioParam;\n readonly reduction: AudioParam;\n readonly release: AudioParam;\n readonly threshold: AudioParam;\n}\n\ndeclare var DynamicsCompressorNode: {\n prototype: DynamicsCompressorNode;\n new(): DynamicsCompressorNode;\n}\n\ninterface EXT_frag_depth {\n}\n\ndeclare var EXT_frag_depth: {\n prototype: EXT_frag_depth;\n new(): EXT_frag_depth;\n}\n\ninterface EXT_texture_filter_anisotropic {\n readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number;\n readonly TEXTURE_MAX_ANISOTROPY_EXT: number;\n}\n\ndeclare var EXT_texture_filter_anisotropic: {\n prototype: EXT_texture_filter_anisotropic;\n new(): EXT_texture_filter_anisotropic;\n readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number;\n readonly TEXTURE_MAX_ANISOTROPY_EXT: number;\n}\n\ninterface ElementEventMap extends GlobalEventHandlersEventMap {\n \"ariarequest\": AriaRequestEvent;\n \"command\": CommandEvent;\n \"gotpointercapture\": PointerEvent;\n \"lostpointercapture\": PointerEvent;\n \"MSGestureChange\": MSGestureEvent;\n \"MSGestureDoubleTap\": MSGestureEvent;\n \"MSGestureEnd\": MSGestureEvent;\n \"MSGestureHold\": MSGestureEvent;\n \"MSGestureStart\": MSGestureEvent;\n \"MSGestureTap\": MSGestureEvent;\n \"MSGotPointerCapture\": MSPointerEvent;\n \"MSInertiaStart\": MSGestureEvent;\n \"MSLostPointerCapture\": MSPointerEvent;\n \"MSPointerCancel\": MSPointerEvent;\n \"MSPointerDown\": MSPointerEvent;\n \"MSPointerEnter\": MSPointerEvent;\n \"MSPointerLeave\": MSPointerEvent;\n \"MSPointerMove\": MSPointerEvent;\n \"MSPointerOut\": MSPointerEvent;\n \"MSPointerOver\": MSPointerEvent;\n \"MSPointerUp\": MSPointerEvent;\n \"touchcancel\": TouchEvent;\n \"touchend\": TouchEvent;\n \"touchmove\": TouchEvent;\n \"touchstart\": TouchEvent;\n \"webkitfullscreenchange\": Event;\n \"webkitfullscreenerror\": Event;\n}\n\ninterface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode, ParentNode {\n readonly classList: DOMTokenList;\n className: string;\n readonly clientHeight: number;\n readonly clientLeft: number;\n readonly clientTop: number;\n readonly clientWidth: number;\n id: string;\n msContentZoomFactor: number;\n readonly msRegionOverflow: string;\n onariarequest: (this: Element, ev: AriaRequestEvent) => any;\n oncommand: (this: Element, ev: CommandEvent) => any;\n ongotpointercapture: (this: Element, ev: PointerEvent) => any;\n onlostpointercapture: (this: Element, ev: PointerEvent) => any;\n onmsgesturechange: (this: Element, ev: MSGestureEvent) => any;\n onmsgesturedoubletap: (this: Element, ev: MSGestureEvent) => any;\n onmsgestureend: (this: Element, ev: MSGestureEvent) => any;\n onmsgesturehold: (this: Element, ev: MSGestureEvent) => any;\n onmsgesturestart: (this: Element, ev: MSGestureEvent) => any;\n onmsgesturetap: (this: Element, ev: MSGestureEvent) => any;\n onmsgotpointercapture: (this: Element, ev: MSPointerEvent) => any;\n onmsinertiastart: (this: Element, ev: MSGestureEvent) => any;\n onmslostpointercapture: (this: Element, ev: MSPointerEvent) => any;\n onmspointercancel: (this: Element, ev: MSPointerEvent) => any;\n onmspointerdown: (this: Element, ev: MSPointerEvent) => any;\n onmspointerenter: (this: Element, ev: MSPointerEvent) => any;\n onmspointerleave: (this: Element, ev: MSPointerEvent) => any;\n onmspointermove: (this: Element, ev: MSPointerEvent) => any;\n onmspointerout: (this: Element, ev: MSPointerEvent) => any;\n onmspointerover: (this: Element, ev: MSPointerEvent) => any;\n onmspointerup: (this: Element, ev: MSPointerEvent) => any;\n ontouchcancel: (ev: TouchEvent) => any;\n ontouchend: (ev: TouchEvent) => any;\n ontouchmove: (ev: TouchEvent) => any;\n ontouchstart: (ev: TouchEvent) => any;\n onwebkitfullscreenchange: (this: Element, ev: Event) => any;\n onwebkitfullscreenerror: (this: Element, ev: Event) => any;\n readonly prefix: string | null;\n readonly scrollHeight: number;\n scrollLeft: number;\n scrollTop: number;\n readonly scrollWidth: number;\n readonly tagName: string;\n innerHTML: string;\n readonly assignedSlot: HTMLSlotElement | null;\n slot: string;\n readonly shadowRoot: ShadowRoot | null;\n getAttribute(name: string): string | null;\n getAttributeNS(namespaceURI: string, localName: string): string;\n getAttributeNode(name: string): Attr;\n getAttributeNodeNS(namespaceURI: string, localName: string): Attr;\n getBoundingClientRect(): ClientRect;\n getClientRects(): ClientRectList;\n getElementsByTagName(name: K): ElementListTagNameMap[K];\n getElementsByTagName(name: string): NodeListOf;\n getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/1999/xhtml\", localName: string): HTMLCollectionOf;\n getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/2000/svg\", localName: string): HTMLCollectionOf;\n getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf;\n hasAttribute(name: string): boolean;\n hasAttributeNS(namespaceURI: string, localName: string): boolean;\n msGetRegionContent(): MSRangeCollection;\n msGetUntransformedBounds(): ClientRect;\n msMatchesSelector(selectors: string): boolean;\n msReleasePointerCapture(pointerId: number): void;\n msSetPointerCapture(pointerId: number): void;\n msZoomTo(args: MsZoomToOptions): void;\n releasePointerCapture(pointerId: number): void;\n removeAttribute(name?: string): void;\n removeAttributeNS(namespaceURI: string, localName: string): void;\n removeAttributeNode(oldAttr: Attr): Attr;\n requestFullscreen(): void;\n requestPointerLock(): void;\n setAttribute(name: string, value: string): void;\n setAttributeNS(namespaceURI: string, qualifiedName: string, value: string): void;\n setAttributeNode(newAttr: Attr): Attr;\n setAttributeNodeNS(newAttr: Attr): Attr;\n setPointerCapture(pointerId: number): void;\n webkitMatchesSelector(selectors: string): boolean;\n webkitRequestFullScreen(): void;\n webkitRequestFullscreen(): void;\n getElementsByClassName(classNames: string): NodeListOf;\n matches(selector: string): boolean;\n closest(selector: string): Element | null;\n scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;\n scroll(options?: ScrollToOptions): void;\n scroll(x: number, y: number): void;\n scrollTo(options?: ScrollToOptions): void;\n scrollTo(x: number, y: number): void;\n scrollBy(options?: ScrollToOptions): void;\n scrollBy(x: number, y: number): void;\n insertAdjacentElement(position: string, insertedElement: Element): Element | null;\n insertAdjacentHTML(where: string, html: string): void;\n insertAdjacentText(where: string, text: string): void;\n attachShadow(shadowRootInitDict: ShadowRootInit): ShadowRoot;\n addEventListener(type: K, listener: (this: Element, ev: ElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var Element: {\n prototype: Element;\n new(): Element;\n}\n\ninterface ErrorEvent extends Event {\n readonly colno: number;\n readonly error: any;\n readonly filename: string;\n readonly lineno: number;\n readonly message: string;\n initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void;\n}\n\ndeclare var ErrorEvent: {\n prototype: ErrorEvent;\n new(): ErrorEvent;\n}\n\ninterface Event {\n readonly bubbles: boolean;\n cancelBubble: boolean;\n readonly cancelable: boolean;\n readonly currentTarget: EventTarget;\n readonly defaultPrevented: boolean;\n readonly eventPhase: number;\n readonly isTrusted: boolean;\n returnValue: boolean;\n readonly srcElement: Element | null;\n readonly target: EventTarget;\n readonly timeStamp: number;\n readonly type: string;\n readonly scoped: boolean;\n initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void;\n preventDefault(): void;\n stopImmediatePropagation(): void;\n stopPropagation(): void;\n deepPath(): EventTarget[];\n readonly AT_TARGET: number;\n readonly BUBBLING_PHASE: number;\n readonly CAPTURING_PHASE: number;\n}\n\ndeclare var Event: {\n prototype: Event;\n new(type: string, eventInitDict?: EventInit): Event;\n readonly AT_TARGET: number;\n readonly BUBBLING_PHASE: number;\n readonly CAPTURING_PHASE: number;\n}\n\ninterface EventTarget {\n addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n dispatchEvent(evt: Event): boolean;\n removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var EventTarget: {\n prototype: EventTarget;\n new(): EventTarget;\n}\n\ninterface External {\n}\n\ndeclare var External: {\n prototype: External;\n new(): External;\n}\n\ninterface File extends Blob {\n readonly lastModifiedDate: any;\n readonly name: string;\n readonly webkitRelativePath: string;\n}\n\ndeclare var File: {\n prototype: File;\n new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File;\n}\n\ninterface FileList {\n readonly length: number;\n item(index: number): File;\n [index: number]: File;\n}\n\ndeclare var FileList: {\n prototype: FileList;\n new(): FileList;\n}\n\ninterface FileReader extends EventTarget, MSBaseReader {\n readonly error: DOMError;\n readAsArrayBuffer(blob: Blob): void;\n readAsBinaryString(blob: Blob): void;\n readAsDataURL(blob: Blob): void;\n readAsText(blob: Blob, encoding?: string): void;\n addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var FileReader: {\n prototype: FileReader;\n new(): FileReader;\n}\n\ninterface FocusEvent extends UIEvent {\n readonly relatedTarget: EventTarget;\n initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void;\n}\n\ndeclare var FocusEvent: {\n prototype: FocusEvent;\n new(typeArg: string, eventInitDict?: FocusEventInit): FocusEvent;\n}\n\ninterface FormData {\n append(name: any, value: any, blobName?: string): void;\n}\n\ndeclare var FormData: {\n prototype: FormData;\n new (form?: HTMLFormElement): FormData;\n}\n\ninterface GainNode extends AudioNode {\n readonly gain: AudioParam;\n}\n\ndeclare var GainNode: {\n prototype: GainNode;\n new(): GainNode;\n}\n\ninterface Gamepad {\n readonly axes: number[];\n readonly buttons: GamepadButton[];\n readonly connected: boolean;\n readonly id: string;\n readonly index: number;\n readonly mapping: string;\n readonly timestamp: number;\n}\n\ndeclare var Gamepad: {\n prototype: Gamepad;\n new(): Gamepad;\n}\n\ninterface GamepadButton {\n readonly pressed: boolean;\n readonly value: number;\n}\n\ndeclare var GamepadButton: {\n prototype: GamepadButton;\n new(): GamepadButton;\n}\n\ninterface GamepadEvent extends Event {\n readonly gamepad: Gamepad;\n}\n\ndeclare var GamepadEvent: {\n prototype: GamepadEvent;\n new(): GamepadEvent;\n}\n\ninterface Geolocation {\n clearWatch(watchId: number): void;\n getCurrentPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): void;\n watchPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): number;\n}\n\ndeclare var Geolocation: {\n prototype: Geolocation;\n new(): Geolocation;\n}\n\ninterface HTMLAllCollection extends HTMLCollection {\n namedItem(name: string): Element;\n}\n\ndeclare var HTMLAllCollection: {\n prototype: HTMLAllCollection;\n new(): HTMLAllCollection;\n}\n\ninterface HTMLAnchorElement extends HTMLElement {\n Methods: string;\n /**\n * Sets or retrieves the character set used to encode the object.\n */\n charset: string;\n /**\n * Sets or retrieves the coordinates of the object.\n */\n coords: string;\n download: string;\n /**\n * Contains the anchor portion of the URL including the hash sign (#).\n */\n hash: string;\n /**\n * Contains the hostname and port values of the URL.\n */\n host: string;\n /**\n * Contains the hostname of a URL.\n */\n hostname: string;\n /**\n * Sets or retrieves a destination URL or an anchor point.\n */\n href: string;\n /**\n * Sets or retrieves the language code of the object.\n */\n hreflang: string;\n readonly mimeType: string;\n /**\n * Sets or retrieves the shape of the object.\n */\n name: string;\n readonly nameProp: string;\n /**\n * Contains the pathname of the URL.\n */\n pathname: string;\n /**\n * Sets or retrieves the port number associated with a URL.\n */\n port: string;\n /**\n * Contains the protocol of the URL.\n */\n protocol: string;\n readonly protocolLong: string;\n /**\n * Sets or retrieves the relationship between the object and the destination of the link.\n */\n rel: string;\n /**\n * Sets or retrieves the relationship between the object and the destination of the link.\n */\n rev: string;\n /**\n * Sets or retrieves the substring of the href property that follows the question mark.\n */\n search: string;\n /**\n * Sets or retrieves the shape of the object.\n */\n shape: string;\n /**\n * Sets or retrieves the window or frame at which to target content.\n */\n target: string;\n /**\n * Retrieves or sets the text of the object as a string. \n */\n text: string;\n type: string;\n urn: string;\n /** \n * Returns a string representation of an object.\n */\n toString(): string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLAnchorElement: {\n prototype: HTMLAnchorElement;\n new(): HTMLAnchorElement;\n}\n\ninterface HTMLAppletElement extends HTMLElement {\n /**\n * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element.\n */\n readonly BaseHref: string;\n align: string;\n /**\n * Sets or retrieves a text alternative to the graphic.\n */\n alt: string;\n /**\n * Gets or sets the optional alternative HTML script to execute if the object fails to load.\n */\n altHtml: string;\n /**\n * Sets or retrieves a character string that can be used to implement your own archive functionality for the object.\n */\n archive: string;\n border: string;\n code: string;\n /**\n * Sets or retrieves the URL of the component.\n */\n codeBase: string;\n /**\n * Sets or retrieves the Internet media type for the code associated with the object.\n */\n codeType: string;\n /**\n * Address of a pointer to the document this page or frame contains. If there is no document, then null will be returned.\n */\n readonly contentDocument: Document;\n /**\n * Sets or retrieves the URL that references the data of the object.\n */\n data: string;\n /**\n * Sets or retrieves a character string that can be used to implement your own declare functionality for the object.\n */\n declare: boolean;\n readonly form: HTMLFormElement;\n /**\n * Sets or retrieves the height of the object.\n */\n height: string;\n hspace: number;\n /**\n * Sets or retrieves the shape of the object.\n */\n name: string;\n object: string | null;\n /**\n * Sets or retrieves a message to be displayed while an object is loading.\n */\n standby: string;\n /**\n * Returns the content type of the object.\n */\n type: string;\n /**\n * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map.\n */\n useMap: string;\n vspace: number;\n width: number;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLAppletElement: {\n prototype: HTMLAppletElement;\n new(): HTMLAppletElement;\n}\n\ninterface HTMLAreaElement extends HTMLElement {\n /**\n * Sets or retrieves a text alternative to the graphic.\n */\n alt: string;\n /**\n * Sets or retrieves the coordinates of the object.\n */\n coords: string;\n download: string;\n /**\n * Sets or retrieves the subsection of the href property that follows the number sign (#).\n */\n hash: string;\n /**\n * Sets or retrieves the hostname and port number of the location or URL.\n */\n host: string;\n /**\n * Sets or retrieves the host name part of the location or URL. \n */\n hostname: string;\n /**\n * Sets or retrieves a destination URL or an anchor point.\n */\n href: string;\n /**\n * Sets or gets whether clicks in this region cause action.\n */\n noHref: boolean;\n /**\n * Sets or retrieves the file name or path specified by the object.\n */\n pathname: string;\n /**\n * Sets or retrieves the port number associated with a URL.\n */\n port: string;\n /**\n * Sets or retrieves the protocol portion of a URL.\n */\n protocol: string;\n rel: string;\n /**\n * Sets or retrieves the substring of the href property that follows the question mark.\n */\n search: string;\n /**\n * Sets or retrieves the shape of the object.\n */\n shape: string;\n /**\n * Sets or retrieves the window or frame at which to target content.\n */\n target: string;\n /** \n * Returns a string representation of an object.\n */\n toString(): string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLAreaElement: {\n prototype: HTMLAreaElement;\n new(): HTMLAreaElement;\n}\n\ninterface HTMLAreasCollection extends HTMLCollection {\n /**\n * Adds an element to the areas, controlRange, or options collection.\n */\n add(element: HTMLElement, before?: HTMLElement | number): void;\n /**\n * Removes an element from the collection.\n */\n remove(index?: number): void;\n}\n\ndeclare var HTMLAreasCollection: {\n prototype: HTMLAreasCollection;\n new(): HTMLAreasCollection;\n}\n\ninterface HTMLAudioElement extends HTMLMediaElement {\n addEventListener(type: K, listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLAudioElement: {\n prototype: HTMLAudioElement;\n new(): HTMLAudioElement;\n}\n\ninterface HTMLBRElement extends HTMLElement {\n /**\n * Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document.\n */\n clear: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLBRElement: {\n prototype: HTMLBRElement;\n new(): HTMLBRElement;\n}\n\ninterface HTMLBaseElement extends HTMLElement {\n /**\n * Gets or sets the baseline URL on which relative links are based.\n */\n href: string;\n /**\n * Sets or retrieves the window or frame at which to target content.\n */\n target: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLBaseElement: {\n prototype: HTMLBaseElement;\n new(): HTMLBaseElement;\n}\n\ninterface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedColorProperty {\n /**\n * Sets or retrieves the current typeface family.\n */\n face: string;\n /**\n * Sets or retrieves the font size of the object.\n */\n size: number;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLBaseFontElement: {\n prototype: HTMLBaseFontElement;\n new(): HTMLBaseFontElement;\n}\n\ninterface HTMLBodyElementEventMap extends HTMLElementEventMap {\n \"afterprint\": Event;\n \"beforeprint\": Event;\n \"beforeunload\": BeforeUnloadEvent;\n \"blur\": FocusEvent;\n \"error\": ErrorEvent;\n \"focus\": FocusEvent;\n \"hashchange\": HashChangeEvent;\n \"load\": Event;\n \"message\": MessageEvent;\n \"offline\": Event;\n \"online\": Event;\n \"orientationchange\": Event;\n \"pagehide\": PageTransitionEvent;\n \"pageshow\": PageTransitionEvent;\n \"popstate\": PopStateEvent;\n \"resize\": UIEvent;\n \"storage\": StorageEvent;\n \"unload\": Event;\n}\n\ninterface HTMLBodyElement extends HTMLElement {\n aLink: any;\n background: string;\n bgColor: any;\n bgProperties: string;\n link: any;\n noWrap: boolean;\n onafterprint: (this: HTMLBodyElement, ev: Event) => any;\n onbeforeprint: (this: HTMLBodyElement, ev: Event) => any;\n onbeforeunload: (this: HTMLBodyElement, ev: BeforeUnloadEvent) => any;\n onblur: (this: HTMLBodyElement, ev: FocusEvent) => any;\n onerror: (this: HTMLBodyElement, ev: ErrorEvent) => any;\n onfocus: (this: HTMLBodyElement, ev: FocusEvent) => any;\n onhashchange: (this: HTMLBodyElement, ev: HashChangeEvent) => any;\n onload: (this: HTMLBodyElement, ev: Event) => any;\n onmessage: (this: HTMLBodyElement, ev: MessageEvent) => any;\n onoffline: (this: HTMLBodyElement, ev: Event) => any;\n ononline: (this: HTMLBodyElement, ev: Event) => any;\n onorientationchange: (this: HTMLBodyElement, ev: Event) => any;\n onpagehide: (this: HTMLBodyElement, ev: PageTransitionEvent) => any;\n onpageshow: (this: HTMLBodyElement, ev: PageTransitionEvent) => any;\n onpopstate: (this: HTMLBodyElement, ev: PopStateEvent) => any;\n onresize: (this: HTMLBodyElement, ev: UIEvent) => any;\n onstorage: (this: HTMLBodyElement, ev: StorageEvent) => any;\n onunload: (this: HTMLBodyElement, ev: Event) => any;\n text: any;\n vLink: any;\n addEventListener(type: K, listener: (this: HTMLBodyElement, ev: HTMLBodyElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLBodyElement: {\n prototype: HTMLBodyElement;\n new(): HTMLBodyElement;\n}\n\ninterface HTMLButtonElement extends HTMLElement {\n /**\n * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing.\n */\n autofocus: boolean;\n disabled: boolean;\n /**\n * Retrieves a reference to the form that the object is embedded in.\n */\n readonly form: HTMLFormElement;\n /**\n * Overrides the action attribute (where the data on a form is sent) on the parent form element.\n */\n formAction: string;\n /**\n * Used to override the encoding (formEnctype attribute) specified on the form element.\n */\n formEnctype: string;\n /**\n * Overrides the submit method attribute previously specified on a form element.\n */\n formMethod: string;\n /**\n * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a \"save draft\"-type submit option.\n */\n formNoValidate: string;\n /**\n * Overrides the target attribute on a form element.\n */\n formTarget: string;\n /** \n * Sets or retrieves the name of the object.\n */\n name: string;\n status: any;\n /**\n * Gets the classification and default behavior of the button.\n */\n type: string;\n /**\n * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\n */\n readonly validationMessage: string;\n /**\n * Returns a ValidityState object that represents the validity states of an element.\n */\n readonly validity: ValidityState;\n /** \n * Sets or retrieves the default or selected value of the control.\n */\n value: string;\n /**\n * Returns whether an element will successfully validate based on forms validation rules and constraints.\n */\n readonly willValidate: boolean;\n /**\n * Returns whether a form will validate when it is submitted, without having to submit it.\n */\n checkValidity(): boolean;\n /**\n * Sets a custom error message that is displayed when a form is submitted.\n * @param error Sets a custom error message that is displayed when a form is submitted.\n */\n setCustomValidity(error: string): void;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLButtonElement: {\n prototype: HTMLButtonElement;\n new(): HTMLButtonElement;\n}\n\ninterface HTMLCanvasElement extends HTMLElement {\n /**\n * Gets or sets the height of a canvas element on a document.\n */\n height: number;\n /**\n * Gets or sets the width of a canvas element on a document.\n */\n width: number;\n /**\n * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas.\n * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext(\"2d\"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext(\"experimental-webgl\");\n */\n getContext(contextId: \"2d\", contextAttributes?: Canvas2DContextAttributes): CanvasRenderingContext2D | null;\n getContext(contextId: \"webgl\" | \"experimental-webgl\", contextAttributes?: WebGLContextAttributes): WebGLRenderingContext | null;\n getContext(contextId: string, contextAttributes?: {}): CanvasRenderingContext2D | WebGLRenderingContext | null;\n /**\n * Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing.\n */\n msToBlob(): Blob;\n /**\n * Returns the content of the current canvas as an image that you can use as a source for another canvas or an HTML element.\n * @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image.\n */\n toDataURL(type?: string, ...args: any[]): string;\n toBlob(callback: (result: Blob | null) => void, type?: string, ...arguments: any[]): void;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLCanvasElement: {\n prototype: HTMLCanvasElement;\n new(): HTMLCanvasElement;\n}\n\ninterface HTMLCollection {\n /**\n * Sets or retrieves the number of objects in a collection.\n */\n readonly length: number;\n /**\n * Retrieves an object from various collections.\n */\n item(index: number): Element;\n /**\n * Retrieves a select object or an object from an options collection.\n */\n namedItem(name: string): Element;\n [index: number]: Element;\n}\n\ndeclare var HTMLCollection: {\n prototype: HTMLCollection;\n new(): HTMLCollection;\n}\n\ninterface HTMLDListElement extends HTMLElement {\n compact: boolean;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLDListElement: {\n prototype: HTMLDListElement;\n new(): HTMLDListElement;\n}\n\ninterface HTMLDataListElement extends HTMLElement {\n options: HTMLCollectionOf;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLDataListElement: {\n prototype: HTMLDataListElement;\n new(): HTMLDataListElement;\n}\n\ninterface HTMLDirectoryElement extends HTMLElement {\n compact: boolean;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLDirectoryElement: {\n prototype: HTMLDirectoryElement;\n new(): HTMLDirectoryElement;\n}\n\ninterface HTMLDivElement extends HTMLElement {\n /**\n * Sets or retrieves how the object is aligned with adjacent text. \n */\n align: string;\n /**\n * Sets or retrieves whether the browser automatically performs wordwrap.\n */\n noWrap: boolean;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLDivElement: {\n prototype: HTMLDivElement;\n new(): HTMLDivElement;\n}\n\ninterface HTMLDocument extends Document {\n addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLDocument: {\n prototype: HTMLDocument;\n new(): HTMLDocument;\n}\n\ninterface HTMLElementEventMap extends ElementEventMap {\n \"abort\": UIEvent;\n \"activate\": UIEvent;\n \"beforeactivate\": UIEvent;\n \"beforecopy\": ClipboardEvent;\n \"beforecut\": ClipboardEvent;\n \"beforedeactivate\": UIEvent;\n \"beforepaste\": ClipboardEvent;\n \"blur\": FocusEvent;\n \"canplay\": Event;\n \"canplaythrough\": Event;\n \"change\": Event;\n \"click\": MouseEvent;\n \"contextmenu\": PointerEvent;\n \"copy\": ClipboardEvent;\n \"cuechange\": Event;\n \"cut\": ClipboardEvent;\n \"dblclick\": MouseEvent;\n \"deactivate\": UIEvent;\n \"drag\": DragEvent;\n \"dragend\": DragEvent;\n \"dragenter\": DragEvent;\n \"dragleave\": DragEvent;\n \"dragover\": DragEvent;\n \"dragstart\": DragEvent;\n \"drop\": DragEvent;\n \"durationchange\": Event;\n \"emptied\": Event;\n \"ended\": MediaStreamErrorEvent;\n \"error\": ErrorEvent;\n \"focus\": FocusEvent;\n \"input\": Event;\n \"invalid\": Event;\n \"keydown\": KeyboardEvent;\n \"keypress\": KeyboardEvent;\n \"keyup\": KeyboardEvent;\n \"load\": Event;\n \"loadeddata\": Event;\n \"loadedmetadata\": Event;\n \"loadstart\": Event;\n \"mousedown\": MouseEvent;\n \"mouseenter\": MouseEvent;\n \"mouseleave\": MouseEvent;\n \"mousemove\": MouseEvent;\n \"mouseout\": MouseEvent;\n \"mouseover\": MouseEvent;\n \"mouseup\": MouseEvent;\n \"mousewheel\": WheelEvent;\n \"MSContentZoom\": UIEvent;\n \"MSManipulationStateChanged\": MSManipulationEvent;\n \"paste\": ClipboardEvent;\n \"pause\": Event;\n \"play\": Event;\n \"playing\": Event;\n \"progress\": ProgressEvent;\n \"ratechange\": Event;\n \"reset\": Event;\n \"scroll\": UIEvent;\n \"seeked\": Event;\n \"seeking\": Event;\n \"select\": UIEvent;\n \"selectstart\": Event;\n \"stalled\": Event;\n \"submit\": Event;\n \"suspend\": Event;\n \"timeupdate\": Event;\n \"volumechange\": Event;\n \"waiting\": Event;\n}\n\ninterface HTMLElement extends Element {\n accessKey: string;\n readonly children: HTMLCollection;\n contentEditable: string;\n readonly dataset: DOMStringMap;\n dir: string;\n draggable: boolean;\n hidden: boolean;\n hideFocus: boolean;\n innerHTML: string;\n innerText: string;\n readonly isContentEditable: boolean;\n lang: string;\n readonly offsetHeight: number;\n readonly offsetLeft: number;\n readonly offsetParent: Element;\n readonly offsetTop: number;\n readonly offsetWidth: number;\n onabort: (this: HTMLElement, ev: UIEvent) => any;\n onactivate: (this: HTMLElement, ev: UIEvent) => any;\n onbeforeactivate: (this: HTMLElement, ev: UIEvent) => any;\n onbeforecopy: (this: HTMLElement, ev: ClipboardEvent) => any;\n onbeforecut: (this: HTMLElement, ev: ClipboardEvent) => any;\n onbeforedeactivate: (this: HTMLElement, ev: UIEvent) => any;\n onbeforepaste: (this: HTMLElement, ev: ClipboardEvent) => any;\n onblur: (this: HTMLElement, ev: FocusEvent) => any;\n oncanplay: (this: HTMLElement, ev: Event) => any;\n oncanplaythrough: (this: HTMLElement, ev: Event) => any;\n onchange: (this: HTMLElement, ev: Event) => any;\n onclick: (this: HTMLElement, ev: MouseEvent) => any;\n oncontextmenu: (this: HTMLElement, ev: PointerEvent) => any;\n oncopy: (this: HTMLElement, ev: ClipboardEvent) => any;\n oncuechange: (this: HTMLElement, ev: Event) => any;\n oncut: (this: HTMLElement, ev: ClipboardEvent) => any;\n ondblclick: (this: HTMLElement, ev: MouseEvent) => any;\n ondeactivate: (this: HTMLElement, ev: UIEvent) => any;\n ondrag: (this: HTMLElement, ev: DragEvent) => any;\n ondragend: (this: HTMLElement, ev: DragEvent) => any;\n ondragenter: (this: HTMLElement, ev: DragEvent) => any;\n ondragleave: (this: HTMLElement, ev: DragEvent) => any;\n ondragover: (this: HTMLElement, ev: DragEvent) => any;\n ondragstart: (this: HTMLElement, ev: DragEvent) => any;\n ondrop: (this: HTMLElement, ev: DragEvent) => any;\n ondurationchange: (this: HTMLElement, ev: Event) => any;\n onemptied: (this: HTMLElement, ev: Event) => any;\n onended: (this: HTMLElement, ev: MediaStreamErrorEvent) => any;\n onerror: (this: HTMLElement, ev: ErrorEvent) => any;\n onfocus: (this: HTMLElement, ev: FocusEvent) => any;\n oninput: (this: HTMLElement, ev: Event) => any;\n oninvalid: (this: HTMLElement, ev: Event) => any;\n onkeydown: (this: HTMLElement, ev: KeyboardEvent) => any;\n onkeypress: (this: HTMLElement, ev: KeyboardEvent) => any;\n onkeyup: (this: HTMLElement, ev: KeyboardEvent) => any;\n onload: (this: HTMLElement, ev: Event) => any;\n onloadeddata: (this: HTMLElement, ev: Event) => any;\n onloadedmetadata: (this: HTMLElement, ev: Event) => any;\n onloadstart: (this: HTMLElement, ev: Event) => any;\n onmousedown: (this: HTMLElement, ev: MouseEvent) => any;\n onmouseenter: (this: HTMLElement, ev: MouseEvent) => any;\n onmouseleave: (this: HTMLElement, ev: MouseEvent) => any;\n onmousemove: (this: HTMLElement, ev: MouseEvent) => any;\n onmouseout: (this: HTMLElement, ev: MouseEvent) => any;\n onmouseover: (this: HTMLElement, ev: MouseEvent) => any;\n onmouseup: (this: HTMLElement, ev: MouseEvent) => any;\n onmousewheel: (this: HTMLElement, ev: WheelEvent) => any;\n onmscontentzoom: (this: HTMLElement, ev: UIEvent) => any;\n onmsmanipulationstatechanged: (this: HTMLElement, ev: MSManipulationEvent) => any;\n onpaste: (this: HTMLElement, ev: ClipboardEvent) => any;\n onpause: (this: HTMLElement, ev: Event) => any;\n onplay: (this: HTMLElement, ev: Event) => any;\n onplaying: (this: HTMLElement, ev: Event) => any;\n onprogress: (this: HTMLElement, ev: ProgressEvent) => any;\n onratechange: (this: HTMLElement, ev: Event) => any;\n onreset: (this: HTMLElement, ev: Event) => any;\n onscroll: (this: HTMLElement, ev: UIEvent) => any;\n onseeked: (this: HTMLElement, ev: Event) => any;\n onseeking: (this: HTMLElement, ev: Event) => any;\n onselect: (this: HTMLElement, ev: UIEvent) => any;\n onselectstart: (this: HTMLElement, ev: Event) => any;\n onstalled: (this: HTMLElement, ev: Event) => any;\n onsubmit: (this: HTMLElement, ev: Event) => any;\n onsuspend: (this: HTMLElement, ev: Event) => any;\n ontimeupdate: (this: HTMLElement, ev: Event) => any;\n onvolumechange: (this: HTMLElement, ev: Event) => any;\n onwaiting: (this: HTMLElement, ev: Event) => any;\n outerHTML: string;\n outerText: string;\n spellcheck: boolean;\n readonly style: CSSStyleDeclaration;\n tabIndex: number;\n title: string;\n blur(): void;\n click(): void;\n dragDrop(): boolean;\n focus(): void;\n msGetInputContext(): MSInputMethodContext;\n setActive(): void;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLElement: {\n prototype: HTMLElement;\n new(): HTMLElement;\n}\n\ninterface HTMLEmbedElement extends HTMLElement, GetSVGDocument {\n /**\n * Sets or retrieves the height of the object.\n */\n height: string;\n hidden: any;\n /**\n * Gets or sets whether the DLNA PlayTo device is available.\n */\n msPlayToDisabled: boolean;\n /**\n * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server.\n */\n msPlayToPreferredSourceUri: string;\n /**\n * Gets or sets the primary DLNA PlayTo device.\n */\n msPlayToPrimary: boolean;\n /**\n * Gets the source associated with the media element for use by the PlayToManager.\n */\n readonly msPlayToSource: any;\n /**\n * Sets or retrieves the name of the object.\n */\n name: string;\n /**\n * Retrieves the palette used for the embedded document.\n */\n readonly palette: string;\n /**\n * Retrieves the URL of the plug-in used to view an embedded document.\n */\n readonly pluginspage: string;\n readonly readyState: string;\n /**\n * Sets or retrieves a URL to be loaded by the object.\n */\n src: string;\n /**\n * Sets or retrieves the height and width units of the embed object.\n */\n units: string;\n /**\n * Sets or retrieves the width of the object.\n */\n width: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLEmbedElement: {\n prototype: HTMLEmbedElement;\n new(): HTMLEmbedElement;\n}\n\ninterface HTMLFieldSetElement extends HTMLElement {\n /**\n * Sets or retrieves how the object is aligned with adjacent text.\n */\n align: string;\n disabled: boolean;\n /**\n * Retrieves a reference to the form that the object is embedded in.\n */\n readonly form: HTMLFormElement;\n /**\n * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\n */\n readonly validationMessage: string;\n /**\n * Returns a ValidityState object that represents the validity states of an element.\n */\n readonly validity: ValidityState;\n /**\n * Returns whether an element will successfully validate based on forms validation rules and constraints.\n */\n readonly willValidate: boolean;\n /**\n * Returns whether a form will validate when it is submitted, without having to submit it.\n */\n checkValidity(): boolean;\n /**\n * Sets a custom error message that is displayed when a form is submitted.\n * @param error Sets a custom error message that is displayed when a form is submitted.\n */\n setCustomValidity(error: string): void;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLFieldSetElement: {\n prototype: HTMLFieldSetElement;\n new(): HTMLFieldSetElement;\n}\n\ninterface HTMLFontElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty {\n /**\n * Sets or retrieves the current typeface family.\n */\n face: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLFontElement: {\n prototype: HTMLFontElement;\n new(): HTMLFontElement;\n}\n\ninterface HTMLFormElement extends HTMLElement {\n /**\n * Sets or retrieves a list of character encodings for input data that must be accepted by the server processing the form.\n */\n acceptCharset: string;\n /**\n * Sets or retrieves the URL to which the form content is sent for processing.\n */\n action: string;\n /**\n * Specifies whether autocomplete is applied to an editable text field.\n */\n autocomplete: string;\n /**\n * Retrieves a collection, in source order, of all controls in a given form.\n */\n readonly elements: HTMLCollection;\n /**\n * Sets or retrieves the MIME encoding for the form.\n */\n encoding: string;\n /**\n * Sets or retrieves the encoding type for the form.\n */\n enctype: string;\n /**\n * Sets or retrieves the number of objects in a collection.\n */\n readonly length: number;\n /**\n * Sets or retrieves how to send the form data to the server.\n */\n method: string;\n /**\n * Sets or retrieves the name of the object.\n */\n name: string;\n /**\n * Designates a form that is not validated when submitted.\n */\n noValidate: boolean;\n /**\n * Sets or retrieves the window or frame at which to target content.\n */\n target: string;\n /**\n * Returns whether a form will validate when it is submitted, without having to submit it.\n */\n checkValidity(): boolean;\n /**\n * Retrieves a form object or an object from an elements collection.\n * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is a Number, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made.\n * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned.\n */\n item(name?: any, index?: any): any;\n /**\n * Retrieves a form object or an object from an elements collection.\n */\n namedItem(name: string): any;\n /**\n * Fires when the user resets a form.\n */\n reset(): void;\n /**\n * Fires when a FORM is about to be submitted.\n */\n submit(): void;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n [name: string]: any;\n}\n\ndeclare var HTMLFormElement: {\n prototype: HTMLFormElement;\n new(): HTMLFormElement;\n}\n\ninterface HTMLFrameElementEventMap extends HTMLElementEventMap {\n \"load\": Event;\n}\n\ninterface HTMLFrameElement extends HTMLElement, GetSVGDocument {\n /**\n * Specifies the properties of a border drawn around an object.\n */\n border: string;\n /**\n * Sets or retrieves the border color of the object.\n */\n borderColor: any;\n /**\n * Retrieves the document object of the page or frame.\n */\n readonly contentDocument: Document;\n /**\n * Retrieves the object of the specified.\n */\n readonly contentWindow: Window;\n /**\n * Sets or retrieves whether to display a border for the frame.\n */\n frameBorder: string;\n /**\n * Sets or retrieves the amount of additional space between the frames.\n */\n frameSpacing: any;\n /**\n * Sets or retrieves the height of the object.\n */\n height: string | number;\n /**\n * Sets or retrieves a URI to a long description of the object.\n */\n longDesc: string;\n /**\n * Sets or retrieves the top and bottom margin heights before displaying the text in a frame.\n */\n marginHeight: string;\n /**\n * Sets or retrieves the left and right margin widths before displaying the text in a frame.\n */\n marginWidth: string;\n /**\n * Sets or retrieves the frame name.\n */\n name: string;\n /**\n * Sets or retrieves whether the user can resize the frame.\n */\n noResize: boolean;\n /**\n * Raised when the object has been completely received from the server.\n */\n onload: (this: HTMLFrameElement, ev: Event) => any;\n /**\n * Sets or retrieves whether the frame can be scrolled.\n */\n scrolling: string;\n /**\n * Sets or retrieves a URL to be loaded by the object.\n */\n src: string;\n /**\n * Sets or retrieves the width of the object.\n */\n width: string | number;\n addEventListener(type: K, listener: (this: HTMLFrameElement, ev: HTMLFrameElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLFrameElement: {\n prototype: HTMLFrameElement;\n new(): HTMLFrameElement;\n}\n\ninterface HTMLFrameSetElementEventMap extends HTMLElementEventMap {\n \"beforeprint\": Event;\n \"beforeunload\": BeforeUnloadEvent;\n \"blur\": FocusEvent;\n \"error\": ErrorEvent;\n \"focus\": FocusEvent;\n \"hashchange\": HashChangeEvent;\n \"load\": Event;\n \"message\": MessageEvent;\n \"offline\": Event;\n \"online\": Event;\n \"orientationchange\": Event;\n \"pagehide\": PageTransitionEvent;\n \"pageshow\": PageTransitionEvent;\n \"resize\": UIEvent;\n \"storage\": StorageEvent;\n \"unload\": Event;\n}\n\ninterface HTMLFrameSetElement extends HTMLElement {\n border: string;\n /**\n * Sets or retrieves the border color of the object.\n */\n borderColor: any;\n /**\n * Sets or retrieves the frame widths of the object.\n */\n cols: string;\n /**\n * Sets or retrieves whether to display a border for the frame.\n */\n frameBorder: string;\n /**\n * Sets or retrieves the amount of additional space between the frames.\n */\n frameSpacing: any;\n name: string;\n onafterprint: (this: HTMLFrameSetElement, ev: Event) => any;\n onbeforeprint: (this: HTMLFrameSetElement, ev: Event) => any;\n onbeforeunload: (this: HTMLFrameSetElement, ev: BeforeUnloadEvent) => any;\n /**\n * Fires when the object loses the input focus.\n */\n onblur: (this: HTMLFrameSetElement, ev: FocusEvent) => any;\n onerror: (this: HTMLFrameSetElement, ev: ErrorEvent) => any;\n /**\n * Fires when the object receives focus.\n */\n onfocus: (this: HTMLFrameSetElement, ev: FocusEvent) => any;\n onhashchange: (this: HTMLFrameSetElement, ev: HashChangeEvent) => any;\n onload: (this: HTMLFrameSetElement, ev: Event) => any;\n onmessage: (this: HTMLFrameSetElement, ev: MessageEvent) => any;\n onoffline: (this: HTMLFrameSetElement, ev: Event) => any;\n ononline: (this: HTMLFrameSetElement, ev: Event) => any;\n onorientationchange: (this: HTMLFrameSetElement, ev: Event) => any;\n onpagehide: (this: HTMLFrameSetElement, ev: PageTransitionEvent) => any;\n onpageshow: (this: HTMLFrameSetElement, ev: PageTransitionEvent) => any;\n onresize: (this: HTMLFrameSetElement, ev: UIEvent) => any;\n onstorage: (this: HTMLFrameSetElement, ev: StorageEvent) => any;\n onunload: (this: HTMLFrameSetElement, ev: Event) => any;\n /**\n * Sets or retrieves the frame heights of the object.\n */\n rows: string;\n addEventListener(type: K, listener: (this: HTMLFrameSetElement, ev: HTMLFrameSetElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLFrameSetElement: {\n prototype: HTMLFrameSetElement;\n new(): HTMLFrameSetElement;\n}\n\ninterface HTMLHRElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty {\n /**\n * Sets or retrieves how the object is aligned with adjacent text.\n */\n align: string;\n /**\n * Sets or retrieves whether the horizontal rule is drawn with 3-D shading.\n */\n noShade: boolean;\n /**\n * Sets or retrieves the width of the object.\n */\n width: number;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLHRElement: {\n prototype: HTMLHRElement;\n new(): HTMLHRElement;\n}\n\ninterface HTMLHeadElement extends HTMLElement {\n profile: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLHeadElement: {\n prototype: HTMLHeadElement;\n new(): HTMLHeadElement;\n}\n\ninterface HTMLHeadingElement extends HTMLElement {\n /**\n * Sets or retrieves a value that indicates the table alignment.\n */\n align: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLHeadingElement: {\n prototype: HTMLHeadingElement;\n new(): HTMLHeadingElement;\n}\n\ninterface HTMLHtmlElement extends HTMLElement {\n /**\n * Sets or retrieves the DTD version that governs the current document.\n */\n version: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLHtmlElement: {\n prototype: HTMLHtmlElement;\n new(): HTMLHtmlElement;\n}\n\ninterface HTMLIFrameElementEventMap extends HTMLElementEventMap {\n \"load\": Event;\n}\n\ninterface HTMLIFrameElement extends HTMLElement, GetSVGDocument {\n /**\n * Sets or retrieves how the object is aligned with adjacent text.\n */\n align: string;\n allowFullscreen: boolean;\n /**\n * Specifies the properties of a border drawn around an object.\n */\n border: string;\n /**\n * Retrieves the document object of the page or frame.\n */\n readonly contentDocument: Document;\n /**\n * Retrieves the object of the specified.\n */\n readonly contentWindow: Window;\n /**\n * Sets or retrieves whether to display a border for the frame.\n */\n frameBorder: string;\n /**\n * Sets or retrieves the amount of additional space between the frames.\n */\n frameSpacing: any;\n /**\n * Sets or retrieves the height of the object.\n */\n height: string;\n /**\n * Sets or retrieves the horizontal margin for the object.\n */\n hspace: number;\n /**\n * Sets or retrieves a URI to a long description of the object.\n */\n longDesc: string;\n /**\n * Sets or retrieves the top and bottom margin heights before displaying the text in a frame.\n */\n marginHeight: string;\n /**\n * Sets or retrieves the left and right margin widths before displaying the text in a frame.\n */\n marginWidth: string;\n /**\n * Sets or retrieves the frame name.\n */\n name: string;\n /**\n * Sets or retrieves whether the user can resize the frame.\n */\n noResize: boolean;\n /**\n * Raised when the object has been completely received from the server.\n */\n onload: (this: HTMLIFrameElement, ev: Event) => any;\n readonly sandbox: DOMSettableTokenList;\n /**\n * Sets or retrieves whether the frame can be scrolled.\n */\n scrolling: string;\n /**\n * Sets or retrieves a URL to be loaded by the object.\n */\n src: string;\n /**\n * Sets or retrieves the vertical margin for the object.\n */\n vspace: number;\n /**\n * Sets or retrieves the width of the object.\n */\n width: string;\n addEventListener(type: K, listener: (this: HTMLIFrameElement, ev: HTMLIFrameElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLIFrameElement: {\n prototype: HTMLIFrameElement;\n new(): HTMLIFrameElement;\n}\n\ninterface HTMLImageElement extends HTMLElement {\n /**\n * Sets or retrieves how the object is aligned with adjacent text.\n */\n align: string;\n /**\n * Sets or retrieves a text alternative to the graphic.\n */\n alt: string;\n /**\n * Specifies the properties of a border drawn around an object.\n */\n border: string;\n /**\n * Retrieves whether the object is fully loaded.\n */\n readonly complete: boolean;\n crossOrigin: string;\n readonly currentSrc: string;\n /**\n * Sets or retrieves the height of the object.\n */\n height: number;\n /**\n * Sets or retrieves the width of the border to draw around the object.\n */\n hspace: number;\n /**\n * Sets or retrieves whether the image is a server-side image map.\n */\n isMap: boolean;\n /**\n * Sets or retrieves a Uniform Resource Identifier (URI) to a long description of the object.\n */\n longDesc: string;\n lowsrc: string;\n /**\n * Gets or sets whether the DLNA PlayTo device is available.\n */\n msPlayToDisabled: boolean;\n msPlayToPreferredSourceUri: string;\n /**\n * Gets or sets the primary DLNA PlayTo device.\n */\n msPlayToPrimary: boolean;\n /**\n * Gets the source associated with the media element for use by the PlayToManager.\n */\n readonly msPlayToSource: any;\n /**\n * Sets or retrieves the name of the object.\n */\n name: string;\n /**\n * The original height of the image resource before sizing.\n */\n readonly naturalHeight: number;\n /**\n * The original width of the image resource before sizing.\n */\n readonly naturalWidth: number;\n sizes: string;\n /**\n * The address or URL of the a media resource that is to be considered.\n */\n src: string;\n srcset: string;\n /**\n * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map.\n */\n useMap: string;\n /**\n * Sets or retrieves the vertical margin for the object.\n */\n vspace: number;\n /**\n * Sets or retrieves the width of the object.\n */\n width: number;\n readonly x: number;\n readonly y: number;\n msGetAsCastingSource(): any;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLImageElement: {\n prototype: HTMLImageElement;\n new(): HTMLImageElement;\n create(): HTMLImageElement;\n}\n\ninterface HTMLInputElement extends HTMLElement {\n /**\n * Sets or retrieves a comma-separated list of content types.\n */\n accept: string;\n /**\n * Sets or retrieves how the object is aligned with adjacent text.\n */\n align: string;\n /**\n * Sets or retrieves a text alternative to the graphic.\n */\n alt: string;\n /**\n * Specifies whether autocomplete is applied to an editable text field.\n */\n autocomplete: string;\n /**\n * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing.\n */\n autofocus: boolean;\n /**\n * Sets or retrieves the width of the border to draw around the object.\n */\n border: string;\n /**\n * Sets or retrieves the state of the check box or radio button.\n */\n checked: boolean;\n /**\n * Retrieves whether the object is fully loaded.\n */\n readonly complete: boolean;\n /**\n * Sets or retrieves the state of the check box or radio button.\n */\n defaultChecked: boolean;\n /**\n * Sets or retrieves the initial contents of the object.\n */\n defaultValue: string;\n disabled: boolean;\n /**\n * Returns a FileList object on a file type input object.\n */\n readonly files: FileList | null;\n /**\n * Retrieves a reference to the form that the object is embedded in. \n */\n readonly form: HTMLFormElement;\n /**\n * Overrides the action attribute (where the data on a form is sent) on the parent form element.\n */\n formAction: string;\n /**\n * Used to override the encoding (formEnctype attribute) specified on the form element.\n */\n formEnctype: string;\n /**\n * Overrides the submit method attribute previously specified on a form element.\n */\n formMethod: string;\n /**\n * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a \"save draft\"-type submit option.\n */\n formNoValidate: string;\n /**\n * Overrides the target attribute on a form element.\n */\n formTarget: string;\n /**\n * Sets or retrieves the height of the object.\n */\n height: string;\n /**\n * Sets or retrieves the width of the border to draw around the object.\n */\n hspace: number;\n indeterminate: boolean;\n /**\n * Specifies the ID of a pre-defined datalist of options for an input element.\n */\n readonly list: HTMLElement;\n /**\n * Defines the maximum acceptable value for an input element with type=\"number\".When used with the min and step attributes, lets you control the range and increment (such as only even numbers) that the user can enter into an input field.\n */\n max: string;\n /**\n * Sets or retrieves the maximum number of characters that the user can enter in a text control.\n */\n maxLength: number;\n /**\n * Defines the minimum acceptable value for an input element with type=\"number\". When used with the max and step attributes, lets you control the range and increment (such as even numbers only) that the user can enter into an input field.\n */\n min: string;\n /**\n * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list.\n */\n multiple: boolean;\n /**\n * Sets or retrieves the name of the object.\n */\n name: string;\n /**\n * Gets or sets a string containing a regular expression that the user's input must match.\n */\n pattern: string;\n /**\n * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field.\n */\n placeholder: string;\n readOnly: boolean;\n /**\n * When present, marks an element that can't be submitted without a value.\n */\n required: boolean;\n selectionDirection: string;\n /**\n * Gets or sets the end position or offset of a text selection.\n */\n selectionEnd: number;\n /**\n * Gets or sets the starting position or offset of a text selection.\n */\n selectionStart: number;\n size: number;\n /**\n * The address or URL of the a media resource that is to be considered.\n */\n src: string;\n status: boolean;\n /**\n * Defines an increment or jump between values that you want to allow the user to enter. When used with the max and min attributes, lets you control the range and increment (for example, allow only even numbers) that the user can enter into an input field.\n */\n step: string;\n /**\n * Returns the content type of the object.\n */\n type: string;\n /**\n * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map.\n */\n useMap: string;\n /**\n * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\n */\n readonly validationMessage: string;\n /**\n * Returns a ValidityState object that represents the validity states of an element.\n */\n readonly validity: ValidityState;\n /**\n * Returns the value of the data at the cursor's current position.\n */\n value: string;\n valueAsDate: Date;\n /**\n * Returns the input field value as a number.\n */\n valueAsNumber: number;\n /**\n * Sets or retrieves the vertical margin for the object.\n */\n vspace: number;\n webkitdirectory: boolean;\n /**\n * Sets or retrieves the width of the object.\n */\n width: string;\n /**\n * Returns whether an element will successfully validate based on forms validation rules and constraints.\n */\n readonly willValidate: boolean;\n minLength: number;\n /**\n * Returns whether a form will validate when it is submitted, without having to submit it.\n */\n checkValidity(): boolean;\n /**\n * Makes the selection equal to the current object.\n */\n select(): void;\n /**\n * Sets a custom error message that is displayed when a form is submitted.\n * @param error Sets a custom error message that is displayed when a form is submitted.\n */\n setCustomValidity(error: string): void;\n /**\n * Sets the start and end positions of a selection in a text field.\n * @param start The offset into the text field for the start of the selection.\n * @param end The offset into the text field for the end of the selection.\n */\n setSelectionRange(start?: number, end?: number, direction?: string): void;\n /**\n * Decrements a range input control's value by the value given by the Step attribute. If the optional parameter is used, it will decrement the input control's step value multiplied by the parameter's value.\n * @param n Value to decrement the value by.\n */\n stepDown(n?: number): void;\n /**\n * Increments a range input control's value by the value given by the Step attribute. If the optional parameter is used, will increment the input control's value by that value.\n * @param n Value to increment the value by.\n */\n stepUp(n?: number): void;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLInputElement: {\n prototype: HTMLInputElement;\n new(): HTMLInputElement;\n}\n\ninterface HTMLLIElement extends HTMLElement {\n type: string;\n /**\n * Sets or retrieves the value of a list item.\n */\n value: number;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLLIElement: {\n prototype: HTMLLIElement;\n new(): HTMLLIElement;\n}\n\ninterface HTMLLabelElement extends HTMLElement {\n /**\n * Retrieves a reference to the form that the object is embedded in.\n */\n readonly form: HTMLFormElement;\n /**\n * Sets or retrieves the object to which the given label object is assigned.\n */\n htmlFor: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLLabelElement: {\n prototype: HTMLLabelElement;\n new(): HTMLLabelElement;\n}\n\ninterface HTMLLegendElement extends HTMLElement {\n /**\n * Retrieves a reference to the form that the object is embedded in.\n */\n align: string;\n /**\n * Retrieves a reference to the form that the object is embedded in.\n */\n readonly form: HTMLFormElement;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLLegendElement: {\n prototype: HTMLLegendElement;\n new(): HTMLLegendElement;\n}\n\ninterface HTMLLinkElement extends HTMLElement, LinkStyle {\n /**\n * Sets or retrieves the character set used to encode the object.\n */\n charset: string;\n disabled: boolean;\n /**\n * Sets or retrieves a destination URL or an anchor point.\n */\n href: string;\n /**\n * Sets or retrieves the language code of the object.\n */\n hreflang: string;\n /**\n * Sets or retrieves the media type.\n */\n media: string;\n /**\n * Sets or retrieves the relationship between the object and the destination of the link.\n */\n rel: string;\n /**\n * Sets or retrieves the relationship between the object and the destination of the link.\n */\n rev: string;\n /**\n * Sets or retrieves the window or frame at which to target content.\n */\n target: string;\n /**\n * Sets or retrieves the MIME type of the object.\n */\n type: string;\n import?: Document;\n integrity: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLLinkElement: {\n prototype: HTMLLinkElement;\n new(): HTMLLinkElement;\n}\n\ninterface HTMLMapElement extends HTMLElement {\n /**\n * Retrieves a collection of the area objects defined for the given map object.\n */\n readonly areas: HTMLAreasCollection;\n /**\n * Sets or retrieves the name of the object.\n */\n name: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLMapElement: {\n prototype: HTMLMapElement;\n new(): HTMLMapElement;\n}\n\ninterface HTMLMarqueeElementEventMap extends HTMLElementEventMap {\n \"bounce\": Event;\n \"finish\": Event;\n \"start\": Event;\n}\n\ninterface HTMLMarqueeElement extends HTMLElement {\n behavior: string;\n bgColor: any;\n direction: string;\n height: string;\n hspace: number;\n loop: number;\n onbounce: (this: HTMLMarqueeElement, ev: Event) => any;\n onfinish: (this: HTMLMarqueeElement, ev: Event) => any;\n onstart: (this: HTMLMarqueeElement, ev: Event) => any;\n scrollAmount: number;\n scrollDelay: number;\n trueSpeed: boolean;\n vspace: number;\n width: string;\n start(): void;\n stop(): void;\n addEventListener(type: K, listener: (this: HTMLMarqueeElement, ev: HTMLMarqueeElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLMarqueeElement: {\n prototype: HTMLMarqueeElement;\n new(): HTMLMarqueeElement;\n}\n\ninterface HTMLMediaElementEventMap extends HTMLElementEventMap {\n \"encrypted\": MediaEncryptedEvent;\n \"msneedkey\": MSMediaKeyNeededEvent;\n}\n\ninterface HTMLMediaElement extends HTMLElement {\n /**\n * Returns an AudioTrackList object with the audio tracks for a given video element.\n */\n readonly audioTracks: AudioTrackList;\n /**\n * Gets or sets a value that indicates whether to start playing the media automatically.\n */\n autoplay: boolean;\n /**\n * Gets a collection of buffered time ranges.\n */\n readonly buffered: TimeRanges;\n /**\n * Gets or sets a flag that indicates whether the client provides a set of controls for the media (in case the developer does not include controls for the player).\n */\n controls: boolean;\n crossOrigin: string;\n /**\n * Gets the address or URL of the current media resource that is selected by IHTMLMediaElement.\n */\n readonly currentSrc: string;\n /**\n * Gets or sets the current playback position, in seconds.\n */\n currentTime: number;\n defaultMuted: boolean;\n /**\n * Gets or sets the default playback rate when the user is not using fast forward or reverse for a video or audio resource.\n */\n defaultPlaybackRate: number;\n /**\n * Returns the duration in seconds of the current media resource. A NaN value is returned if duration is not available, or Infinity if the media resource is streaming.\n */\n readonly duration: number;\n /**\n * Gets information about whether the playback has ended or not.\n */\n readonly ended: boolean;\n /**\n * Returns an object representing the current error state of the audio or video element.\n */\n readonly error: MediaError;\n /**\n * Gets or sets a flag to specify whether playback should restart after it completes.\n */\n loop: boolean;\n readonly mediaKeys: MediaKeys | null;\n /**\n * Specifies the purpose of the audio or video media, such as background audio or alerts.\n */\n msAudioCategory: string;\n /**\n * Specifies the output device id that the audio will be sent to.\n */\n msAudioDeviceType: string;\n readonly msGraphicsTrustStatus: MSGraphicsTrust;\n /**\n * Gets the MSMediaKeys object, which is used for decrypting media data, that is associated with this media element.\n */\n readonly msKeys: MSMediaKeys;\n /**\n * Gets or sets whether the DLNA PlayTo device is available.\n */\n msPlayToDisabled: boolean;\n /**\n * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server.\n */\n msPlayToPreferredSourceUri: string;\n /**\n * Gets or sets the primary DLNA PlayTo device.\n */\n msPlayToPrimary: boolean;\n /**\n * Gets the source associated with the media element for use by the PlayToManager.\n */\n readonly msPlayToSource: any;\n /**\n * Specifies whether or not to enable low-latency playback on the media element.\n */\n msRealTime: boolean;\n /**\n * Gets or sets a flag that indicates whether the audio (either audio or the audio track on video media) is muted.\n */\n muted: boolean;\n /**\n * Gets the current network activity for the element.\n */\n readonly networkState: number;\n onencrypted: (this: HTMLMediaElement, ev: MediaEncryptedEvent) => any;\n onmsneedkey: (this: HTMLMediaElement, ev: MSMediaKeyNeededEvent) => any;\n /**\n * Gets a flag that specifies whether playback is paused.\n */\n readonly paused: boolean;\n /**\n * Gets or sets the current rate of speed for the media resource to play. This speed is expressed as a multiple of the normal speed of the media resource.\n */\n playbackRate: number;\n /**\n * Gets TimeRanges for the current media resource that has been played.\n */\n readonly played: TimeRanges;\n /**\n * Gets or sets the current playback position, in seconds.\n */\n preload: string;\n readyState: number;\n /**\n * Returns a TimeRanges object that represents the ranges of the current media resource that can be seeked.\n */\n readonly seekable: TimeRanges;\n /**\n * Gets a flag that indicates whether the the client is currently moving to a new playback position in the media resource.\n */\n readonly seeking: boolean;\n /**\n * The address or URL of the a media resource that is to be considered.\n */\n src: string;\n srcObject: MediaStream | null;\n readonly textTracks: TextTrackList;\n readonly videoTracks: VideoTrackList;\n /**\n * Gets or sets the volume level for audio portions of the media element.\n */\n volume: number;\n addTextTrack(kind: string, label?: string, language?: string): TextTrack;\n /**\n * Returns a string that specifies whether the client can play a given media resource type.\n */\n canPlayType(type: string): string;\n /**\n * Resets the audio or video object and loads a new media resource.\n */\n load(): void;\n /**\n * Clears all effects from the media pipeline.\n */\n msClearEffects(): void;\n msGetAsCastingSource(): any;\n /**\n * Inserts the specified audio effect into media pipeline.\n */\n msInsertAudioEffect(activatableClassId: string, effectRequired: boolean, config?: any): void;\n msSetMediaKeys(mediaKeys: MSMediaKeys): void;\n /**\n * Specifies the media protection manager for a given media pipeline.\n */\n msSetMediaProtectionManager(mediaProtectionManager?: any): void;\n /**\n * Pauses the current playback and sets paused to TRUE. This can be used to test whether the media is playing or paused. You can also use the pause or play events to tell whether the media is playing or not.\n */\n pause(): void;\n /**\n * Loads and starts playback of a media resource.\n */\n play(): void;\n setMediaKeys(mediaKeys: MediaKeys | null): PromiseLike;\n readonly HAVE_CURRENT_DATA: number;\n readonly HAVE_ENOUGH_DATA: number;\n readonly HAVE_FUTURE_DATA: number;\n readonly HAVE_METADATA: number;\n readonly HAVE_NOTHING: number;\n readonly NETWORK_EMPTY: number;\n readonly NETWORK_IDLE: number;\n readonly NETWORK_LOADING: number;\n readonly NETWORK_NO_SOURCE: number;\n addEventListener(type: K, listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLMediaElement: {\n prototype: HTMLMediaElement;\n new(): HTMLMediaElement;\n readonly HAVE_CURRENT_DATA: number;\n readonly HAVE_ENOUGH_DATA: number;\n readonly HAVE_FUTURE_DATA: number;\n readonly HAVE_METADATA: number;\n readonly HAVE_NOTHING: number;\n readonly NETWORK_EMPTY: number;\n readonly NETWORK_IDLE: number;\n readonly NETWORK_LOADING: number;\n readonly NETWORK_NO_SOURCE: number;\n}\n\ninterface HTMLMenuElement extends HTMLElement {\n compact: boolean;\n type: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLMenuElement: {\n prototype: HTMLMenuElement;\n new(): HTMLMenuElement;\n}\n\ninterface HTMLMetaElement extends HTMLElement {\n /**\n * Sets or retrieves the character set used to encode the object.\n */\n charset: string;\n /**\n * Gets or sets meta-information to associate with httpEquiv or name.\n */\n content: string;\n /**\n * Gets or sets information used to bind the value of a content attribute of a meta element to an HTTP response header.\n */\n httpEquiv: string;\n /**\n * Sets or retrieves the value specified in the content attribute of the meta object.\n */\n name: string;\n /**\n * Sets or retrieves a scheme to be used in interpreting the value of a property specified for the object.\n */\n scheme: string;\n /**\n * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. \n */\n url: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLMetaElement: {\n prototype: HTMLMetaElement;\n new(): HTMLMetaElement;\n}\n\ninterface HTMLMeterElement extends HTMLElement {\n high: number;\n low: number;\n max: number;\n min: number;\n optimum: number;\n value: number;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLMeterElement: {\n prototype: HTMLMeterElement;\n new(): HTMLMeterElement;\n}\n\ninterface HTMLModElement extends HTMLElement {\n /**\n * Sets or retrieves reference information about the object.\n */\n cite: string;\n /**\n * Sets or retrieves the date and time of a modification to the object.\n */\n dateTime: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLModElement: {\n prototype: HTMLModElement;\n new(): HTMLModElement;\n}\n\ninterface HTMLOListElement extends HTMLElement {\n compact: boolean;\n /**\n * The starting number.\n */\n start: number;\n type: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLOListElement: {\n prototype: HTMLOListElement;\n new(): HTMLOListElement;\n}\n\ninterface HTMLObjectElement extends HTMLElement, GetSVGDocument {\n /**\n * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element.\n */\n readonly BaseHref: string;\n align: string;\n /**\n * Sets or retrieves a text alternative to the graphic.\n */\n alt: string;\n /**\n * Gets or sets the optional alternative HTML script to execute if the object fails to load.\n */\n altHtml: string;\n /**\n * Sets or retrieves a character string that can be used to implement your own archive functionality for the object.\n */\n archive: string;\n border: string;\n /**\n * Sets or retrieves the URL of the file containing the compiled Java class.\n */\n code: string;\n /**\n * Sets or retrieves the URL of the component.\n */\n codeBase: string;\n /**\n * Sets or retrieves the Internet media type for the code associated with the object.\n */\n codeType: string;\n /**\n * Retrieves the document object of the page or frame.\n */\n readonly contentDocument: Document;\n /**\n * Sets or retrieves the URL that references the data of the object.\n */\n data: string;\n declare: boolean;\n /**\n * Retrieves a reference to the form that the object is embedded in.\n */\n readonly form: HTMLFormElement;\n /**\n * Sets or retrieves the height of the object.\n */\n height: string;\n hspace: number;\n /**\n * Gets or sets whether the DLNA PlayTo device is available.\n */\n msPlayToDisabled: boolean;\n /**\n * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server.\n */\n msPlayToPreferredSourceUri: string;\n /**\n * Gets or sets the primary DLNA PlayTo device.\n */\n msPlayToPrimary: boolean;\n /**\n * Gets the source associated with the media element for use by the PlayToManager.\n */\n readonly msPlayToSource: any;\n /**\n * Sets or retrieves the name of the object.\n */\n name: string;\n /**\n * Retrieves the contained object.\n */\n readonly object: any;\n readonly readyState: number;\n /**\n * Sets or retrieves a message to be displayed while an object is loading.\n */\n standby: string;\n /**\n * Sets or retrieves the MIME type of the object.\n */\n type: string;\n /**\n * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map.\n */\n useMap: string;\n /**\n * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\n */\n readonly validationMessage: string;\n /**\n * Returns a ValidityState object that represents the validity states of an element.\n */\n readonly validity: ValidityState;\n vspace: number;\n /**\n * Sets or retrieves the width of the object.\n */\n width: string;\n /**\n * Returns whether an element will successfully validate based on forms validation rules and constraints.\n */\n readonly willValidate: boolean;\n /**\n * Returns whether a form will validate when it is submitted, without having to submit it.\n */\n checkValidity(): boolean;\n /**\n * Sets a custom error message that is displayed when a form is submitted.\n * @param error Sets a custom error message that is displayed when a form is submitted.\n */\n setCustomValidity(error: string): void;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLObjectElement: {\n prototype: HTMLObjectElement;\n new(): HTMLObjectElement;\n}\n\ninterface HTMLOptGroupElement extends HTMLElement {\n /**\n * Sets or retrieves the status of an option.\n */\n defaultSelected: boolean;\n disabled: boolean;\n /**\n * Retrieves a reference to the form that the object is embedded in.\n */\n readonly form: HTMLFormElement;\n /**\n * Sets or retrieves the ordinal position of an option in a list box.\n */\n readonly index: number;\n /**\n * Sets or retrieves a value that you can use to implement your own label functionality for the object.\n */\n label: string;\n /**\n * Sets or retrieves whether the option in the list box is the default item.\n */\n selected: boolean;\n /**\n * Sets or retrieves the text string specified by the option tag.\n */\n readonly text: string;\n /**\n * Sets or retrieves the value which is returned to the server when the form control is submitted.\n */\n value: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLOptGroupElement: {\n prototype: HTMLOptGroupElement;\n new(): HTMLOptGroupElement;\n}\n\ninterface HTMLOptionElement extends HTMLElement {\n /**\n * Sets or retrieves the status of an option.\n */\n defaultSelected: boolean;\n disabled: boolean;\n /**\n * Retrieves a reference to the form that the object is embedded in.\n */\n readonly form: HTMLFormElement;\n /**\n * Sets or retrieves the ordinal position of an option in a list box.\n */\n readonly index: number;\n /**\n * Sets or retrieves a value that you can use to implement your own label functionality for the object.\n */\n label: string;\n /**\n * Sets or retrieves whether the option in the list box is the default item.\n */\n selected: boolean;\n /**\n * Sets or retrieves the text string specified by the option tag.\n */\n text: string;\n /**\n * Sets or retrieves the value which is returned to the server when the form control is submitted.\n */\n value: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLOptionElement: {\n prototype: HTMLOptionElement;\n new(): HTMLOptionElement;\n create(): HTMLOptionElement;\n}\n\ninterface HTMLOptionsCollection extends HTMLCollectionOf {\n length: number;\n selectedIndex: number;\n add(element: HTMLOptionElement | HTMLOptGroupElement, before?: HTMLElement | number): void;\n remove(index: number): void;\n}\n\ndeclare var HTMLOptionsCollection: {\n prototype: HTMLOptionsCollection;\n new(): HTMLOptionsCollection;\n}\n\ninterface HTMLParagraphElement extends HTMLElement {\n /**\n * Sets or retrieves how the object is aligned with adjacent text. \n */\n align: string;\n clear: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLParagraphElement: {\n prototype: HTMLParagraphElement;\n new(): HTMLParagraphElement;\n}\n\ninterface HTMLParamElement extends HTMLElement {\n /**\n * Sets or retrieves the name of an input parameter for an element.\n */\n name: string;\n /**\n * Sets or retrieves the content type of the resource designated by the value attribute.\n */\n type: string;\n /**\n * Sets or retrieves the value of an input parameter for an element.\n */\n value: string;\n /**\n * Sets or retrieves the data type of the value attribute.\n */\n valueType: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLParamElement: {\n prototype: HTMLParamElement;\n new(): HTMLParamElement;\n}\n\ninterface HTMLPictureElement extends HTMLElement {\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLPictureElement: {\n prototype: HTMLPictureElement;\n new(): HTMLPictureElement;\n}\n\ninterface HTMLPreElement extends HTMLElement {\n /**\n * Sets or gets a value that you can use to implement your own width functionality for the object.\n */\n width: number;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLPreElement: {\n prototype: HTMLPreElement;\n new(): HTMLPreElement;\n}\n\ninterface HTMLProgressElement extends HTMLElement {\n /**\n * Retrieves a reference to the form that the object is embedded in.\n */\n readonly form: HTMLFormElement;\n /**\n * Defines the maximum, or \"done\" value for a progress element.\n */\n max: number;\n /**\n * Returns the quotient of value/max when the value attribute is set (determinate progress bar), or -1 when the value attribute is missing (indeterminate progress bar).\n */\n readonly position: number;\n /**\n * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value.\n */\n value: number;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLProgressElement: {\n prototype: HTMLProgressElement;\n new(): HTMLProgressElement;\n}\n\ninterface HTMLQuoteElement extends HTMLElement {\n /**\n * Sets or retrieves reference information about the object.\n */\n cite: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLQuoteElement: {\n prototype: HTMLQuoteElement;\n new(): HTMLQuoteElement;\n}\n\ninterface HTMLScriptElement extends HTMLElement {\n async: boolean;\n /**\n * Sets or retrieves the character set used to encode the object.\n */\n charset: string;\n /**\n * Sets or retrieves the status of the script.\n */\n defer: boolean;\n /**\n * Sets or retrieves the event for which the script is written. \n */\n event: string;\n /** \n * Sets or retrieves the object that is bound to the event script.\n */\n htmlFor: string;\n /**\n * Retrieves the URL to an external file that contains the source code or data.\n */\n src: string;\n /**\n * Retrieves or sets the text of the object as a string. \n */\n text: string;\n /**\n * Sets or retrieves the MIME type for the associated scripting engine.\n */\n type: string;\n integrity: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLScriptElement: {\n prototype: HTMLScriptElement;\n new(): HTMLScriptElement;\n}\n\ninterface HTMLSelectElement extends HTMLElement {\n /**\n * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing.\n */\n autofocus: boolean;\n disabled: boolean;\n /**\n * Retrieves a reference to the form that the object is embedded in. \n */\n readonly form: HTMLFormElement;\n /**\n * Sets or retrieves the number of objects in a collection.\n */\n length: number;\n /**\n * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list.\n */\n multiple: boolean;\n /**\n * Sets or retrieves the name of the object.\n */\n name: string;\n readonly options: HTMLOptionsCollection;\n /**\n * When present, marks an element that can't be submitted without a value.\n */\n required: boolean;\n /**\n * Sets or retrieves the index of the selected option in a select object.\n */\n selectedIndex: number;\n selectedOptions: HTMLCollectionOf;\n /**\n * Sets or retrieves the number of rows in the list box. \n */\n size: number;\n /**\n * Retrieves the type of select control based on the value of the MULTIPLE attribute.\n */\n readonly type: string;\n /**\n * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\n */\n readonly validationMessage: string;\n /**\n * Returns a ValidityState object that represents the validity states of an element.\n */\n readonly validity: ValidityState;\n /**\n * Sets or retrieves the value which is returned to the server when the form control is submitted.\n */\n value: string;\n /**\n * Returns whether an element will successfully validate based on forms validation rules and constraints.\n */\n readonly willValidate: boolean;\n /**\n * Adds an element to the areas, controlRange, or options collection.\n * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection.\n * @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection. \n */\n add(element: HTMLElement, before?: HTMLElement | number): void;\n /**\n * Returns whether a form will validate when it is submitted, without having to submit it.\n */\n checkValidity(): boolean;\n /**\n * Retrieves a select object or an object from an options collection.\n * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is an integer, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made.\n * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned.\n */\n item(name?: any, index?: any): any;\n /**\n * Retrieves a select object or an object from an options collection.\n * @param namedItem A String that specifies the name or id property of the object to retrieve. A collection is returned if more than one match is made.\n */\n namedItem(name: string): any;\n /**\n * Removes an element from the collection.\n * @param index Number that specifies the zero-based index of the element to remove from the collection.\n */\n remove(index?: number): void;\n /**\n * Sets a custom error message that is displayed when a form is submitted.\n * @param error Sets a custom error message that is displayed when a form is submitted.\n */\n setCustomValidity(error: string): void;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n [name: string]: any;\n}\n\ndeclare var HTMLSelectElement: {\n prototype: HTMLSelectElement;\n new(): HTMLSelectElement;\n}\n\ninterface HTMLSourceElement extends HTMLElement {\n /**\n * Gets or sets the intended media type of the media source.\n */\n media: string;\n msKeySystem: string;\n sizes: string;\n /**\n * The address or URL of the a media resource that is to be considered.\n */\n src: string;\n srcset: string;\n /**\n * Gets or sets the MIME type of a media resource.\n */\n type: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLSourceElement: {\n prototype: HTMLSourceElement;\n new(): HTMLSourceElement;\n}\n\ninterface HTMLSpanElement extends HTMLElement {\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLSpanElement: {\n prototype: HTMLSpanElement;\n new(): HTMLSpanElement;\n}\n\ninterface HTMLStyleElement extends HTMLElement, LinkStyle {\n disabled: boolean;\n /**\n * Sets or retrieves the media type.\n */\n media: string;\n /**\n * Retrieves the CSS language in which the style sheet is written.\n */\n type: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLStyleElement: {\n prototype: HTMLStyleElement;\n new(): HTMLStyleElement;\n}\n\ninterface HTMLTableCaptionElement extends HTMLElement {\n /**\n * Sets or retrieves the alignment of the caption or legend.\n */\n align: string;\n /**\n * Sets or retrieves whether the caption appears at the top or bottom of the table.\n */\n vAlign: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTableCaptionElement: {\n prototype: HTMLTableCaptionElement;\n new(): HTMLTableCaptionElement;\n}\n\ninterface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment {\n /**\n * Sets or retrieves abbreviated text for the object.\n */\n abbr: string;\n /**\n * Sets or retrieves how the object is aligned with adjacent text.\n */\n align: string;\n /**\n * Sets or retrieves a comma-delimited list of conceptual categories associated with the object.\n */\n axis: string;\n bgColor: any;\n /**\n * Retrieves the position of the object in the cells collection of a row.\n */\n readonly cellIndex: number;\n /**\n * Sets or retrieves the number columns in the table that the object should span.\n */\n colSpan: number;\n /**\n * Sets or retrieves a list of header cells that provide information for the object.\n */\n headers: string;\n /**\n * Sets or retrieves the height of the object.\n */\n height: any;\n /**\n * Sets or retrieves whether the browser automatically performs wordwrap.\n */\n noWrap: boolean;\n /**\n * Sets or retrieves how many rows in a table the cell should span.\n */\n rowSpan: number;\n /**\n * Sets or retrieves the group of cells in a table to which the object's information applies.\n */\n scope: string;\n /**\n * Sets or retrieves the width of the object.\n */\n width: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTableCellElement: {\n prototype: HTMLTableCellElement;\n new(): HTMLTableCellElement;\n}\n\ninterface HTMLTableColElement extends HTMLElement, HTMLTableAlignment {\n /**\n * Sets or retrieves the alignment of the object relative to the display or table.\n */\n align: string;\n /**\n * Sets or retrieves the number of columns in the group.\n */\n span: number;\n /**\n * Sets or retrieves the width of the object.\n */\n width: any;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTableColElement: {\n prototype: HTMLTableColElement;\n new(): HTMLTableColElement;\n}\n\ninterface HTMLTableDataCellElement extends HTMLTableCellElement {\n}\n\ndeclare var HTMLTableDataCellElement: {\n prototype: HTMLTableDataCellElement;\n new(): HTMLTableDataCellElement;\n}\n\ninterface HTMLTableElement extends HTMLElement {\n /**\n * Sets or retrieves a value that indicates the table alignment.\n */\n align: string;\n bgColor: any;\n /**\n * Sets or retrieves the width of the border to draw around the object.\n */\n border: string;\n /**\n * Sets or retrieves the border color of the object. \n */\n borderColor: any;\n /**\n * Retrieves the caption object of a table.\n */\n caption: HTMLTableCaptionElement;\n /**\n * Sets or retrieves the amount of space between the border of the cell and the content of the cell.\n */\n cellPadding: string;\n /**\n * Sets or retrieves the amount of space between cells in a table.\n */\n cellSpacing: string;\n /**\n * Sets or retrieves the number of columns in the table.\n */\n cols: number;\n /**\n * Sets or retrieves the way the border frame around the table is displayed.\n */\n frame: string;\n /**\n * Sets or retrieves the height of the object.\n */\n height: any;\n /**\n * Sets or retrieves the number of horizontal rows contained in the object.\n */\n rows: HTMLCollectionOf;\n /**\n * Sets or retrieves which dividing lines (inner borders) are displayed.\n */\n rules: string;\n /**\n * Sets or retrieves a description and/or structure of the object.\n */\n summary: string;\n /**\n * Retrieves a collection of all tBody objects in the table. Objects in this collection are in source order.\n */\n tBodies: HTMLCollectionOf;\n /**\n * Retrieves the tFoot object of the table.\n */\n tFoot: HTMLTableSectionElement;\n /**\n * Retrieves the tHead object of the table.\n */\n tHead: HTMLTableSectionElement;\n /**\n * Sets or retrieves the width of the object.\n */\n width: string;\n /**\n * Creates an empty caption element in the table.\n */\n createCaption(): HTMLTableCaptionElement;\n /**\n * Creates an empty tBody element in the table.\n */\n createTBody(): HTMLTableSectionElement;\n /**\n * Creates an empty tFoot element in the table.\n */\n createTFoot(): HTMLTableSectionElement;\n /**\n * Returns the tHead element object if successful, or null otherwise.\n */\n createTHead(): HTMLTableSectionElement;\n /**\n * Deletes the caption element and its contents from the table.\n */\n deleteCaption(): void;\n /**\n * Removes the specified row (tr) from the element and from the rows collection.\n * @param index Number that specifies the zero-based position in the rows collection of the row to remove.\n */\n deleteRow(index?: number): void;\n /**\n * Deletes the tFoot element and its contents from the table.\n */\n deleteTFoot(): void;\n /**\n * Deletes the tHead element and its contents from the table.\n */\n deleteTHead(): void;\n /**\n * Creates a new row (tr) in the table, and adds the row to the rows collection.\n * @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.\n */\n insertRow(index?: number): HTMLTableRowElement;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTableElement: {\n prototype: HTMLTableElement;\n new(): HTMLTableElement;\n}\n\ninterface HTMLTableHeaderCellElement extends HTMLTableCellElement {\n /**\n * Sets or retrieves the group of cells in a table to which the object's information applies.\n */\n scope: string;\n}\n\ndeclare var HTMLTableHeaderCellElement: {\n prototype: HTMLTableHeaderCellElement;\n new(): HTMLTableHeaderCellElement;\n}\n\ninterface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment {\n /**\n * Sets or retrieves how the object is aligned with adjacent text.\n */\n align: string;\n bgColor: any;\n /**\n * Retrieves a collection of all cells in the table row.\n */\n cells: HTMLCollectionOf;\n /**\n * Sets or retrieves the height of the object.\n */\n height: any;\n /**\n * Retrieves the position of the object in the rows collection for the table.\n */\n readonly rowIndex: number;\n /**\n * Retrieves the position of the object in the collection.\n */\n readonly sectionRowIndex: number;\n /**\n * Removes the specified cell from the table row, as well as from the cells collection.\n * @param index Number that specifies the zero-based position of the cell to remove from the table row. If no value is provided, the last cell in the cells collection is deleted.\n */\n deleteCell(index?: number): void;\n /**\n * Creates a new cell in the table row, and adds the cell to the cells collection.\n * @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.\n */\n insertCell(index?: number): HTMLTableDataCellElement;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTableRowElement: {\n prototype: HTMLTableRowElement;\n new(): HTMLTableRowElement;\n}\n\ninterface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment {\n /**\n * Sets or retrieves a value that indicates the table alignment.\n */\n align: string;\n /**\n * Sets or retrieves the number of horizontal rows contained in the object.\n */\n rows: HTMLCollectionOf;\n /**\n * Removes the specified row (tr) from the element and from the rows collection.\n * @param index Number that specifies the zero-based position in the rows collection of the row to remove.\n */\n deleteRow(index?: number): void;\n /**\n * Creates a new row (tr) in the table, and adds the row to the rows collection.\n * @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.\n */\n insertRow(index?: number): HTMLTableRowElement;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTableSectionElement: {\n prototype: HTMLTableSectionElement;\n new(): HTMLTableSectionElement;\n}\n\ninterface HTMLTemplateElement extends HTMLElement {\n readonly content: DocumentFragment;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTemplateElement: {\n prototype: HTMLTemplateElement;\n new(): HTMLTemplateElement;\n}\n\ninterface HTMLTextAreaElement extends HTMLElement {\n /**\n * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing.\n */\n autofocus: boolean;\n /**\n * Sets or retrieves the width of the object.\n */\n cols: number;\n /**\n * Sets or retrieves the initial contents of the object.\n */\n defaultValue: string;\n disabled: boolean;\n /**\n * Retrieves a reference to the form that the object is embedded in.\n */\n readonly form: HTMLFormElement;\n /**\n * Sets or retrieves the maximum number of characters that the user can enter in a text control.\n */\n maxLength: number;\n /**\n * Sets or retrieves the name of the object.\n */\n name: string;\n /**\n * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field.\n */\n placeholder: string;\n /**\n * Sets or retrieves the value indicated whether the content of the object is read-only.\n */\n readOnly: boolean;\n /**\n * When present, marks an element that can't be submitted without a value.\n */\n required: boolean;\n /**\n * Sets or retrieves the number of horizontal rows contained in the object.\n */\n rows: number;\n /**\n * Gets or sets the end position or offset of a text selection.\n */\n selectionEnd: number;\n /**\n * Gets or sets the starting position or offset of a text selection.\n */\n selectionStart: number;\n /**\n * Sets or retrieves the value indicating whether the control is selected.\n */\n status: any;\n /**\n * Retrieves the type of control.\n */\n readonly type: string;\n /**\n * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\n */\n readonly validationMessage: string;\n /**\n * Returns a ValidityState object that represents the validity states of an element.\n */\n readonly validity: ValidityState;\n /**\n * Retrieves or sets the text in the entry field of the textArea element.\n */\n value: string;\n /**\n * Returns whether an element will successfully validate based on forms validation rules and constraints.\n */\n readonly willValidate: boolean;\n /**\n * Sets or retrieves how to handle wordwrapping in the object.\n */\n wrap: string;\n minLength: number;\n /**\n * Returns whether a form will validate when it is submitted, without having to submit it.\n */\n checkValidity(): boolean;\n /**\n * Highlights the input area of a form element.\n */\n select(): void;\n /**\n * Sets a custom error message that is displayed when a form is submitted.\n * @param error Sets a custom error message that is displayed when a form is submitted.\n */\n setCustomValidity(error: string): void;\n /**\n * Sets the start and end positions of a selection in a text field.\n * @param start The offset into the text field for the start of the selection.\n * @param end The offset into the text field for the end of the selection.\n */\n setSelectionRange(start: number, end: number): void;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTextAreaElement: {\n prototype: HTMLTextAreaElement;\n new(): HTMLTextAreaElement;\n}\n\ninterface HTMLTitleElement extends HTMLElement {\n /**\n * Retrieves or sets the text of the object as a string. \n */\n text: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTitleElement: {\n prototype: HTMLTitleElement;\n new(): HTMLTitleElement;\n}\n\ninterface HTMLTrackElement extends HTMLElement {\n default: boolean;\n kind: string;\n label: string;\n readonly readyState: number;\n src: string;\n srclang: string;\n readonly track: TextTrack;\n readonly ERROR: number;\n readonly LOADED: number;\n readonly LOADING: number;\n readonly NONE: number;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTrackElement: {\n prototype: HTMLTrackElement;\n new(): HTMLTrackElement;\n readonly ERROR: number;\n readonly LOADED: number;\n readonly LOADING: number;\n readonly NONE: number;\n}\n\ninterface HTMLUListElement extends HTMLElement {\n compact: boolean;\n type: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLUListElement: {\n prototype: HTMLUListElement;\n new(): HTMLUListElement;\n}\n\ninterface HTMLUnknownElement extends HTMLElement {\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLUnknownElement: {\n prototype: HTMLUnknownElement;\n new(): HTMLUnknownElement;\n}\n\ninterface HTMLVideoElementEventMap extends HTMLMediaElementEventMap {\n \"MSVideoFormatChanged\": Event;\n \"MSVideoFrameStepCompleted\": Event;\n \"MSVideoOptimalLayoutChanged\": Event;\n}\n\ninterface HTMLVideoElement extends HTMLMediaElement {\n /**\n * Gets or sets the height of the video element.\n */\n height: number;\n msHorizontalMirror: boolean;\n readonly msIsLayoutOptimalForPlayback: boolean;\n readonly msIsStereo3D: boolean;\n msStereo3DPackingMode: string;\n msStereo3DRenderMode: string;\n msZoom: boolean;\n onMSVideoFormatChanged: (this: HTMLVideoElement, ev: Event) => any;\n onMSVideoFrameStepCompleted: (this: HTMLVideoElement, ev: Event) => any;\n onMSVideoOptimalLayoutChanged: (this: HTMLVideoElement, ev: Event) => any;\n /**\n * 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.\n */\n poster: string;\n /**\n * Gets the intrinsic height of a video in CSS pixels, or zero if the dimensions are not known.\n */\n readonly videoHeight: number;\n /**\n * Gets the intrinsic width of a video in CSS pixels, or zero if the dimensions are not known.\n */\n readonly videoWidth: number;\n readonly webkitDisplayingFullscreen: boolean;\n readonly webkitSupportsFullscreen: boolean;\n /**\n * Gets or sets the width of the video element.\n */\n width: number;\n getVideoPlaybackQuality(): VideoPlaybackQuality;\n msFrameStep(forward: boolean): void;\n msInsertVideoEffect(activatableClassId: string, effectRequired: boolean, config?: any): void;\n msSetVideoRectangle(left: number, top: number, right: number, bottom: number): void;\n webkitEnterFullScreen(): void;\n webkitEnterFullscreen(): void;\n webkitExitFullScreen(): void;\n webkitExitFullscreen(): void;\n addEventListener(type: K, listener: (this: HTMLVideoElement, ev: HTMLVideoElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLVideoElement: {\n prototype: HTMLVideoElement;\n new(): HTMLVideoElement;\n}\n\ninterface HashChangeEvent extends Event {\n readonly newURL: string | null;\n readonly oldURL: string | null;\n}\n\ndeclare var HashChangeEvent: {\n prototype: HashChangeEvent;\n new(type: string, eventInitDict?: HashChangeEventInit): HashChangeEvent;\n}\n\ninterface History {\n readonly length: number;\n readonly state: any;\n scrollRestoration: ScrollRestoration;\n back(): void;\n forward(): void;\n go(delta?: number): void;\n pushState(data: any, title: string, url?: string | null): void;\n replaceState(data: any, title: string, url?: string | null): void;\n}\n\ndeclare var History: {\n prototype: History;\n new(): History;\n}\n\ninterface IDBCursor {\n readonly direction: string;\n key: IDBKeyRange | IDBValidKey;\n readonly primaryKey: any;\n source: IDBObjectStore | IDBIndex;\n advance(count: number): void;\n continue(key?: IDBKeyRange | IDBValidKey): void;\n delete(): IDBRequest;\n update(value: any): IDBRequest;\n readonly NEXT: string;\n readonly NEXT_NO_DUPLICATE: string;\n readonly PREV: string;\n readonly PREV_NO_DUPLICATE: string;\n}\n\ndeclare var IDBCursor: {\n prototype: IDBCursor;\n new(): IDBCursor;\n readonly NEXT: string;\n readonly NEXT_NO_DUPLICATE: string;\n readonly PREV: string;\n readonly PREV_NO_DUPLICATE: string;\n}\n\ninterface IDBCursorWithValue extends IDBCursor {\n readonly value: any;\n}\n\ndeclare var IDBCursorWithValue: {\n prototype: IDBCursorWithValue;\n new(): IDBCursorWithValue;\n}\n\ninterface IDBDatabaseEventMap {\n \"abort\": Event;\n \"error\": ErrorEvent;\n}\n\ninterface IDBDatabase extends EventTarget {\n readonly name: string;\n readonly objectStoreNames: DOMStringList;\n onabort: (this: IDBDatabase, ev: Event) => any;\n onerror: (this: IDBDatabase, ev: ErrorEvent) => any;\n version: number;\n onversionchange: (ev: IDBVersionChangeEvent) => any;\n close(): void;\n createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore;\n deleteObjectStore(name: string): void;\n transaction(storeNames: string | string[], mode?: string): IDBTransaction;\n addEventListener(type: \"versionchange\", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void;\n addEventListener(type: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var IDBDatabase: {\n prototype: IDBDatabase;\n new(): IDBDatabase;\n}\n\ninterface IDBFactory {\n cmp(first: any, second: any): number;\n deleteDatabase(name: string): IDBOpenDBRequest;\n open(name: string, version?: number): IDBOpenDBRequest;\n}\n\ndeclare var IDBFactory: {\n prototype: IDBFactory;\n new(): IDBFactory;\n}\n\ninterface IDBIndex {\n keyPath: string | string[];\n readonly name: string;\n readonly objectStore: IDBObjectStore;\n readonly unique: boolean;\n multiEntry: boolean;\n count(key?: IDBKeyRange | IDBValidKey): IDBRequest;\n get(key: IDBKeyRange | IDBValidKey): IDBRequest;\n getKey(key: IDBKeyRange | IDBValidKey): IDBRequest;\n openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest;\n openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest;\n}\n\ndeclare var IDBIndex: {\n prototype: IDBIndex;\n new(): IDBIndex;\n}\n\ninterface IDBKeyRange {\n readonly lower: any;\n readonly lowerOpen: boolean;\n readonly upper: any;\n readonly upperOpen: boolean;\n}\n\ndeclare var IDBKeyRange: {\n prototype: IDBKeyRange;\n new(): IDBKeyRange;\n bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange;\n lowerBound(lower: any, open?: boolean): IDBKeyRange;\n only(value: any): IDBKeyRange;\n upperBound(upper: any, open?: boolean): IDBKeyRange;\n}\n\ninterface IDBObjectStore {\n readonly indexNames: DOMStringList;\n keyPath: string | string[];\n readonly name: string;\n readonly transaction: IDBTransaction;\n autoIncrement: boolean;\n add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest;\n clear(): IDBRequest;\n count(key?: IDBKeyRange | IDBValidKey): IDBRequest;\n createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex;\n delete(key: IDBKeyRange | IDBValidKey): IDBRequest;\n deleteIndex(indexName: string): void;\n get(key: any): IDBRequest;\n index(name: string): IDBIndex;\n openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest;\n put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest;\n}\n\ndeclare var IDBObjectStore: {\n prototype: IDBObjectStore;\n new(): IDBObjectStore;\n}\n\ninterface IDBOpenDBRequestEventMap extends IDBRequestEventMap {\n \"blocked\": Event;\n \"upgradeneeded\": IDBVersionChangeEvent;\n}\n\ninterface IDBOpenDBRequest extends IDBRequest {\n onblocked: (this: IDBOpenDBRequest, ev: Event) => any;\n onupgradeneeded: (this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any;\n addEventListener(type: K, listener: (this: IDBOpenDBRequest, ev: IDBOpenDBRequestEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var IDBOpenDBRequest: {\n prototype: IDBOpenDBRequest;\n new(): IDBOpenDBRequest;\n}\n\ninterface IDBRequestEventMap {\n \"error\": ErrorEvent;\n \"success\": Event;\n}\n\ninterface IDBRequest extends EventTarget {\n readonly error: DOMError;\n onerror: (this: IDBRequest, ev: ErrorEvent) => any;\n onsuccess: (this: IDBRequest, ev: Event) => any;\n readonly readyState: string;\n readonly result: any;\n source: IDBObjectStore | IDBIndex | IDBCursor;\n readonly transaction: IDBTransaction;\n addEventListener(type: K, listener: (this: IDBRequest, ev: IDBRequestEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var IDBRequest: {\n prototype: IDBRequest;\n new(): IDBRequest;\n}\n\ninterface IDBTransactionEventMap {\n \"abort\": Event;\n \"complete\": Event;\n \"error\": ErrorEvent;\n}\n\ninterface IDBTransaction extends EventTarget {\n readonly db: IDBDatabase;\n readonly error: DOMError;\n readonly mode: string;\n onabort: (this: IDBTransaction, ev: Event) => any;\n oncomplete: (this: IDBTransaction, ev: Event) => any;\n onerror: (this: IDBTransaction, ev: ErrorEvent) => any;\n abort(): void;\n objectStore(name: string): IDBObjectStore;\n readonly READ_ONLY: string;\n readonly READ_WRITE: string;\n readonly VERSION_CHANGE: string;\n addEventListener(type: K, listener: (this: IDBTransaction, ev: IDBTransactionEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var IDBTransaction: {\n prototype: IDBTransaction;\n new(): IDBTransaction;\n readonly READ_ONLY: string;\n readonly READ_WRITE: string;\n readonly VERSION_CHANGE: string;\n}\n\ninterface IDBVersionChangeEvent extends Event {\n readonly newVersion: number | null;\n readonly oldVersion: number;\n}\n\ndeclare var IDBVersionChangeEvent: {\n prototype: IDBVersionChangeEvent;\n new(): IDBVersionChangeEvent;\n}\n\ninterface ImageData {\n data: Uint8ClampedArray;\n readonly height: number;\n readonly width: number;\n}\n\ndeclare var ImageData: {\n prototype: ImageData;\n new(width: number, height: number): ImageData;\n new(array: Uint8ClampedArray, width: number, height: number): ImageData;\n}\n\ninterface KeyboardEvent extends UIEvent {\n readonly altKey: boolean;\n readonly char: string | null;\n readonly charCode: number;\n readonly ctrlKey: boolean;\n readonly key: string;\n readonly keyCode: number;\n readonly locale: string;\n readonly location: number;\n readonly metaKey: boolean;\n readonly repeat: boolean;\n readonly shiftKey: boolean;\n readonly which: number;\n readonly code: string;\n getModifierState(keyArg: string): boolean;\n initKeyboardEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, keyArg: string, locationArg: number, modifiersListArg: string, repeat: boolean, locale: string): void;\n readonly DOM_KEY_LOCATION_JOYSTICK: number;\n readonly DOM_KEY_LOCATION_LEFT: number;\n readonly DOM_KEY_LOCATION_MOBILE: number;\n readonly DOM_KEY_LOCATION_NUMPAD: number;\n readonly DOM_KEY_LOCATION_RIGHT: number;\n readonly DOM_KEY_LOCATION_STANDARD: number;\n}\n\ndeclare var KeyboardEvent: {\n prototype: KeyboardEvent;\n new(typeArg: string, eventInitDict?: KeyboardEventInit): KeyboardEvent;\n readonly DOM_KEY_LOCATION_JOYSTICK: number;\n readonly DOM_KEY_LOCATION_LEFT: number;\n readonly DOM_KEY_LOCATION_MOBILE: number;\n readonly DOM_KEY_LOCATION_NUMPAD: number;\n readonly DOM_KEY_LOCATION_RIGHT: number;\n readonly DOM_KEY_LOCATION_STANDARD: number;\n}\n\ninterface ListeningStateChangedEvent extends Event {\n readonly label: string;\n readonly state: string;\n}\n\ndeclare var ListeningStateChangedEvent: {\n prototype: ListeningStateChangedEvent;\n new(): ListeningStateChangedEvent;\n}\n\ninterface Location {\n hash: string;\n host: string;\n hostname: string;\n href: string;\n readonly origin: string;\n pathname: string;\n port: string;\n protocol: string;\n search: string;\n assign(url: string): void;\n reload(forcedReload?: boolean): void;\n replace(url: string): void;\n toString(): string;\n}\n\ndeclare var Location: {\n prototype: Location;\n new(): Location;\n}\n\ninterface LongRunningScriptDetectedEvent extends Event {\n readonly executionTime: number;\n stopPageScriptExecution: boolean;\n}\n\ndeclare var LongRunningScriptDetectedEvent: {\n prototype: LongRunningScriptDetectedEvent;\n new(): LongRunningScriptDetectedEvent;\n}\n\ninterface MSApp {\n clearTemporaryWebDataAsync(): MSAppAsyncOperation;\n createBlobFromRandomAccessStream(type: string, seeker: any): Blob;\n createDataPackage(object: any): any;\n createDataPackageFromSelection(): any;\n createFileFromStorageFile(storageFile: any): File;\n createStreamFromInputStream(type: string, inputStream: any): MSStream;\n execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void;\n execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any;\n getCurrentPriority(): string;\n getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike;\n getViewId(view: any): any;\n isTaskScheduledAtPriorityOrHigher(priority: string): boolean;\n pageHandlesAllApplicationActivations(enabled: boolean): void;\n suppressSubdownloadCredentialPrompts(suppress: boolean): void;\n terminateApp(exceptionObject: any): void;\n readonly CURRENT: string;\n readonly HIGH: string;\n readonly IDLE: string;\n readonly NORMAL: string;\n}\ndeclare var MSApp: MSApp;\n\ninterface MSAppAsyncOperationEventMap {\n \"complete\": Event;\n \"error\": ErrorEvent;\n}\n\ninterface MSAppAsyncOperation extends EventTarget {\n readonly error: DOMError;\n oncomplete: (this: MSAppAsyncOperation, ev: Event) => any;\n onerror: (this: MSAppAsyncOperation, ev: ErrorEvent) => any;\n readonly readyState: number;\n readonly result: any;\n start(): void;\n readonly COMPLETED: number;\n readonly ERROR: number;\n readonly STARTED: number;\n addEventListener(type: K, listener: (this: MSAppAsyncOperation, ev: MSAppAsyncOperationEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MSAppAsyncOperation: {\n prototype: MSAppAsyncOperation;\n new(): MSAppAsyncOperation;\n readonly COMPLETED: number;\n readonly ERROR: number;\n readonly STARTED: number;\n}\n\ninterface MSAssertion {\n readonly id: string;\n readonly type: string;\n}\n\ndeclare var MSAssertion: {\n prototype: MSAssertion;\n new(): MSAssertion;\n}\n\ninterface MSBlobBuilder {\n append(data: any, endings?: string): void;\n getBlob(contentType?: string): Blob;\n}\n\ndeclare var MSBlobBuilder: {\n prototype: MSBlobBuilder;\n new(): MSBlobBuilder;\n}\n\ninterface MSCredentials {\n getAssertion(challenge: string, filter?: MSCredentialFilter, params?: MSSignatureParameters): PromiseLike;\n makeCredential(accountInfo: MSAccountInfo, params: MSCredentialParameters[], challenge?: string): PromiseLike;\n}\n\ndeclare var MSCredentials: {\n prototype: MSCredentials;\n new(): MSCredentials;\n}\n\ninterface MSFIDOCredentialAssertion extends MSAssertion {\n readonly algorithm: string | Algorithm;\n readonly attestation: any;\n readonly publicKey: string;\n readonly transportHints: string[];\n}\n\ndeclare var MSFIDOCredentialAssertion: {\n prototype: MSFIDOCredentialAssertion;\n new(): MSFIDOCredentialAssertion;\n}\n\ninterface MSFIDOSignature {\n readonly authnrData: string;\n readonly clientData: string;\n readonly signature: string;\n}\n\ndeclare var MSFIDOSignature: {\n prototype: MSFIDOSignature;\n new(): MSFIDOSignature;\n}\n\ninterface MSFIDOSignatureAssertion extends MSAssertion {\n readonly signature: MSFIDOSignature;\n}\n\ndeclare var MSFIDOSignatureAssertion: {\n prototype: MSFIDOSignatureAssertion;\n new(): MSFIDOSignatureAssertion;\n}\n\ninterface MSGesture {\n target: Element;\n addPointer(pointerId: number): void;\n stop(): void;\n}\n\ndeclare var MSGesture: {\n prototype: MSGesture;\n new(): MSGesture;\n}\n\ninterface MSGestureEvent extends UIEvent {\n readonly clientX: number;\n readonly clientY: number;\n readonly expansion: number;\n readonly gestureObject: any;\n readonly hwTimestamp: number;\n readonly offsetX: number;\n readonly offsetY: number;\n readonly rotation: number;\n readonly scale: number;\n readonly screenX: number;\n readonly screenY: number;\n readonly translationX: number;\n readonly translationY: number;\n readonly velocityAngular: number;\n readonly velocityExpansion: number;\n readonly velocityX: number;\n readonly velocityY: number;\n initGestureEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, offsetXArg: number, offsetYArg: number, translationXArg: number, translationYArg: number, scaleArg: number, expansionArg: number, rotationArg: number, velocityXArg: number, velocityYArg: number, velocityExpansionArg: number, velocityAngularArg: number, hwTimestampArg: number): void;\n readonly MSGESTURE_FLAG_BEGIN: number;\n readonly MSGESTURE_FLAG_CANCEL: number;\n readonly MSGESTURE_FLAG_END: number;\n readonly MSGESTURE_FLAG_INERTIA: number;\n readonly MSGESTURE_FLAG_NONE: number;\n}\n\ndeclare var MSGestureEvent: {\n prototype: MSGestureEvent;\n new(): MSGestureEvent;\n readonly MSGESTURE_FLAG_BEGIN: number;\n readonly MSGESTURE_FLAG_CANCEL: number;\n readonly MSGESTURE_FLAG_END: number;\n readonly MSGESTURE_FLAG_INERTIA: number;\n readonly MSGESTURE_FLAG_NONE: number;\n}\n\ninterface MSGraphicsTrust {\n readonly constrictionActive: boolean;\n readonly status: string;\n}\n\ndeclare var MSGraphicsTrust: {\n prototype: MSGraphicsTrust;\n new(): MSGraphicsTrust;\n}\n\ninterface MSHTMLWebViewElement extends HTMLElement {\n readonly canGoBack: boolean;\n readonly canGoForward: boolean;\n readonly containsFullScreenElement: boolean;\n readonly documentTitle: string;\n height: number;\n readonly settings: MSWebViewSettings;\n src: string;\n width: number;\n addWebAllowedObject(name: string, applicationObject: any): void;\n buildLocalStreamUri(contentIdentifier: string, relativePath: string): string;\n capturePreviewToBlobAsync(): MSWebViewAsyncOperation;\n captureSelectedContentToDataPackageAsync(): MSWebViewAsyncOperation;\n getDeferredPermissionRequestById(id: number): DeferredPermissionRequest;\n getDeferredPermissionRequests(): DeferredPermissionRequest[];\n goBack(): void;\n goForward(): void;\n invokeScriptAsync(scriptName: string, ...args: any[]): MSWebViewAsyncOperation;\n navigate(uri: string): void;\n navigateToLocalStreamUri(source: string, streamResolver: any): void;\n navigateToString(contents: string): void;\n navigateWithHttpRequestMessage(requestMessage: any): void;\n refresh(): void;\n stop(): void;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MSHTMLWebViewElement: {\n prototype: MSHTMLWebViewElement;\n new(): MSHTMLWebViewElement;\n}\n\ninterface MSInputMethodContextEventMap {\n \"MSCandidateWindowHide\": Event;\n \"MSCandidateWindowShow\": Event;\n \"MSCandidateWindowUpdate\": Event;\n}\n\ninterface MSInputMethodContext extends EventTarget {\n readonly compositionEndOffset: number;\n readonly compositionStartOffset: number;\n oncandidatewindowhide: (this: MSInputMethodContext, ev: Event) => any;\n oncandidatewindowshow: (this: MSInputMethodContext, ev: Event) => any;\n oncandidatewindowupdate: (this: MSInputMethodContext, ev: Event) => any;\n readonly target: HTMLElement;\n getCandidateWindowClientRect(): ClientRect;\n getCompositionAlternatives(): string[];\n hasComposition(): boolean;\n isCandidateWindowVisible(): boolean;\n addEventListener(type: K, listener: (this: MSInputMethodContext, ev: MSInputMethodContextEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MSInputMethodContext: {\n prototype: MSInputMethodContext;\n new(): MSInputMethodContext;\n}\n\ninterface MSManipulationEvent extends UIEvent {\n readonly currentState: number;\n readonly inertiaDestinationX: number;\n readonly inertiaDestinationY: number;\n readonly lastState: number;\n initMSManipulationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, lastState: number, currentState: number): void;\n readonly MS_MANIPULATION_STATE_ACTIVE: number;\n readonly MS_MANIPULATION_STATE_CANCELLED: number;\n readonly MS_MANIPULATION_STATE_COMMITTED: number;\n readonly MS_MANIPULATION_STATE_DRAGGING: number;\n readonly MS_MANIPULATION_STATE_INERTIA: number;\n readonly MS_MANIPULATION_STATE_PRESELECT: number;\n readonly MS_MANIPULATION_STATE_SELECTING: number;\n readonly MS_MANIPULATION_STATE_STOPPED: number;\n}\n\ndeclare var MSManipulationEvent: {\n prototype: MSManipulationEvent;\n new(): MSManipulationEvent;\n readonly MS_MANIPULATION_STATE_ACTIVE: number;\n readonly MS_MANIPULATION_STATE_CANCELLED: number;\n readonly MS_MANIPULATION_STATE_COMMITTED: number;\n readonly MS_MANIPULATION_STATE_DRAGGING: number;\n readonly MS_MANIPULATION_STATE_INERTIA: number;\n readonly MS_MANIPULATION_STATE_PRESELECT: number;\n readonly MS_MANIPULATION_STATE_SELECTING: number;\n readonly MS_MANIPULATION_STATE_STOPPED: number;\n}\n\ninterface MSMediaKeyError {\n readonly code: number;\n readonly systemCode: number;\n readonly MS_MEDIA_KEYERR_CLIENT: number;\n readonly MS_MEDIA_KEYERR_DOMAIN: number;\n readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number;\n readonly MS_MEDIA_KEYERR_OUTPUT: number;\n readonly MS_MEDIA_KEYERR_SERVICE: number;\n readonly MS_MEDIA_KEYERR_UNKNOWN: number;\n}\n\ndeclare var MSMediaKeyError: {\n prototype: MSMediaKeyError;\n new(): MSMediaKeyError;\n readonly MS_MEDIA_KEYERR_CLIENT: number;\n readonly MS_MEDIA_KEYERR_DOMAIN: number;\n readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number;\n readonly MS_MEDIA_KEYERR_OUTPUT: number;\n readonly MS_MEDIA_KEYERR_SERVICE: number;\n readonly MS_MEDIA_KEYERR_UNKNOWN: number;\n}\n\ninterface MSMediaKeyMessageEvent extends Event {\n readonly destinationURL: string | null;\n readonly message: Uint8Array;\n}\n\ndeclare var MSMediaKeyMessageEvent: {\n prototype: MSMediaKeyMessageEvent;\n new(): MSMediaKeyMessageEvent;\n}\n\ninterface MSMediaKeyNeededEvent extends Event {\n readonly initData: Uint8Array | null;\n}\n\ndeclare var MSMediaKeyNeededEvent: {\n prototype: MSMediaKeyNeededEvent;\n new(): MSMediaKeyNeededEvent;\n}\n\ninterface MSMediaKeySession extends EventTarget {\n readonly error: MSMediaKeyError | null;\n readonly keySystem: string;\n readonly sessionId: string;\n close(): void;\n update(key: Uint8Array): void;\n}\n\ndeclare var MSMediaKeySession: {\n prototype: MSMediaKeySession;\n new(): MSMediaKeySession;\n}\n\ninterface MSMediaKeys {\n readonly keySystem: string;\n createSession(type: string, initData: Uint8Array, cdmData?: Uint8Array): MSMediaKeySession;\n}\n\ndeclare var MSMediaKeys: {\n prototype: MSMediaKeys;\n new(keySystem: string): MSMediaKeys;\n isTypeSupported(keySystem: string, type?: string): boolean;\n isTypeSupportedWithFeatures(keySystem: string, type?: string): string;\n}\n\ninterface MSPointerEvent extends MouseEvent {\n readonly currentPoint: any;\n readonly height: number;\n readonly hwTimestamp: number;\n readonly intermediatePoints: any;\n readonly isPrimary: boolean;\n readonly pointerId: number;\n readonly pointerType: any;\n readonly pressure: number;\n readonly rotation: number;\n readonly tiltX: number;\n readonly tiltY: number;\n readonly width: number;\n getCurrentPoint(element: Element): void;\n getIntermediatePoints(element: Element): void;\n initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void;\n}\n\ndeclare var MSPointerEvent: {\n prototype: MSPointerEvent;\n new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent;\n}\n\ninterface MSRangeCollection {\n readonly length: number;\n item(index: number): Range;\n [index: number]: Range;\n}\n\ndeclare var MSRangeCollection: {\n prototype: MSRangeCollection;\n new(): MSRangeCollection;\n}\n\ninterface MSSiteModeEvent extends Event {\n readonly actionURL: string;\n readonly buttonID: number;\n}\n\ndeclare var MSSiteModeEvent: {\n prototype: MSSiteModeEvent;\n new(): MSSiteModeEvent;\n}\n\ninterface MSStream {\n readonly type: string;\n msClose(): void;\n msDetachStream(): any;\n}\n\ndeclare var MSStream: {\n prototype: MSStream;\n new(): MSStream;\n}\n\ninterface MSStreamReader extends EventTarget, MSBaseReader {\n readonly error: DOMError;\n readAsArrayBuffer(stream: MSStream, size?: number): void;\n readAsBinaryString(stream: MSStream, size?: number): void;\n readAsBlob(stream: MSStream, size?: number): void;\n readAsDataURL(stream: MSStream, size?: number): void;\n readAsText(stream: MSStream, encoding?: string, size?: number): void;\n addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MSStreamReader: {\n prototype: MSStreamReader;\n new(): MSStreamReader;\n}\n\ninterface MSWebViewAsyncOperationEventMap {\n \"complete\": Event;\n \"error\": ErrorEvent;\n}\n\ninterface MSWebViewAsyncOperation extends EventTarget {\n readonly error: DOMError;\n oncomplete: (this: MSWebViewAsyncOperation, ev: Event) => any;\n onerror: (this: MSWebViewAsyncOperation, ev: ErrorEvent) => any;\n readonly readyState: number;\n readonly result: any;\n readonly target: MSHTMLWebViewElement;\n readonly type: number;\n start(): void;\n readonly COMPLETED: number;\n readonly ERROR: number;\n readonly STARTED: number;\n readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number;\n readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number;\n readonly TYPE_INVOKE_SCRIPT: number;\n addEventListener(type: K, listener: (this: MSWebViewAsyncOperation, ev: MSWebViewAsyncOperationEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MSWebViewAsyncOperation: {\n prototype: MSWebViewAsyncOperation;\n new(): MSWebViewAsyncOperation;\n readonly COMPLETED: number;\n readonly ERROR: number;\n readonly STARTED: number;\n readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number;\n readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number;\n readonly TYPE_INVOKE_SCRIPT: number;\n}\n\ninterface MSWebViewSettings {\n isIndexedDBEnabled: boolean;\n isJavaScriptEnabled: boolean;\n}\n\ndeclare var MSWebViewSettings: {\n prototype: MSWebViewSettings;\n new(): MSWebViewSettings;\n}\n\ninterface MediaDeviceInfo {\n readonly deviceId: string;\n readonly groupId: string;\n readonly kind: string;\n readonly label: string;\n}\n\ndeclare var MediaDeviceInfo: {\n prototype: MediaDeviceInfo;\n new(): MediaDeviceInfo;\n}\n\ninterface MediaDevicesEventMap {\n \"devicechange\": Event;\n}\n\ninterface MediaDevices extends EventTarget {\n ondevicechange: (this: MediaDevices, ev: Event) => any;\n enumerateDevices(): any;\n getSupportedConstraints(): MediaTrackSupportedConstraints;\n getUserMedia(constraints: MediaStreamConstraints): PromiseLike;\n addEventListener(type: K, listener: (this: MediaDevices, ev: MediaDevicesEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MediaDevices: {\n prototype: MediaDevices;\n new(): MediaDevices;\n}\n\ninterface MediaElementAudioSourceNode extends AudioNode {\n}\n\ndeclare var MediaElementAudioSourceNode: {\n prototype: MediaElementAudioSourceNode;\n new(): MediaElementAudioSourceNode;\n}\n\ninterface MediaEncryptedEvent extends Event {\n readonly initData: ArrayBuffer | null;\n readonly initDataType: string;\n}\n\ndeclare var MediaEncryptedEvent: {\n prototype: MediaEncryptedEvent;\n new(type: string, eventInitDict?: MediaEncryptedEventInit): MediaEncryptedEvent;\n}\n\ninterface MediaError {\n readonly code: number;\n readonly msExtendedCode: number;\n readonly MEDIA_ERR_ABORTED: number;\n readonly MEDIA_ERR_DECODE: number;\n readonly MEDIA_ERR_NETWORK: number;\n readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number;\n readonly MS_MEDIA_ERR_ENCRYPTED: number;\n}\n\ndeclare var MediaError: {\n prototype: MediaError;\n new(): MediaError;\n readonly MEDIA_ERR_ABORTED: number;\n readonly MEDIA_ERR_DECODE: number;\n readonly MEDIA_ERR_NETWORK: number;\n readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number;\n readonly MS_MEDIA_ERR_ENCRYPTED: number;\n}\n\ninterface MediaKeyMessageEvent extends Event {\n readonly message: ArrayBuffer;\n readonly messageType: string;\n}\n\ndeclare var MediaKeyMessageEvent: {\n prototype: MediaKeyMessageEvent;\n new(type: string, eventInitDict?: MediaKeyMessageEventInit): MediaKeyMessageEvent;\n}\n\ninterface MediaKeySession extends EventTarget {\n readonly closed: PromiseLike;\n readonly expiration: number;\n readonly keyStatuses: MediaKeyStatusMap;\n readonly sessionId: string;\n close(): PromiseLike;\n generateRequest(initDataType: string, initData: any): PromiseLike;\n load(sessionId: string): PromiseLike;\n remove(): PromiseLike;\n update(response: any): PromiseLike;\n}\n\ndeclare var MediaKeySession: {\n prototype: MediaKeySession;\n new(): MediaKeySession;\n}\n\ninterface MediaKeyStatusMap {\n readonly size: number;\n forEach(callback: ForEachCallback): void;\n get(keyId: any): string;\n has(keyId: any): boolean;\n}\n\ndeclare var MediaKeyStatusMap: {\n prototype: MediaKeyStatusMap;\n new(): MediaKeyStatusMap;\n}\n\ninterface MediaKeySystemAccess {\n readonly keySystem: string;\n createMediaKeys(): PromiseLike;\n getConfiguration(): MediaKeySystemConfiguration;\n}\n\ndeclare var MediaKeySystemAccess: {\n prototype: MediaKeySystemAccess;\n new(): MediaKeySystemAccess;\n}\n\ninterface MediaKeys {\n createSession(sessionType?: string): MediaKeySession;\n setServerCertificate(serverCertificate: any): PromiseLike;\n}\n\ndeclare var MediaKeys: {\n prototype: MediaKeys;\n new(): MediaKeys;\n}\n\ninterface MediaList {\n readonly length: number;\n mediaText: string;\n appendMedium(newMedium: string): void;\n deleteMedium(oldMedium: string): void;\n item(index: number): string;\n toString(): string;\n [index: number]: string;\n}\n\ndeclare var MediaList: {\n prototype: MediaList;\n new(): MediaList;\n}\n\ninterface MediaQueryList {\n readonly matches: boolean;\n readonly media: string;\n addListener(listener: MediaQueryListListener): void;\n removeListener(listener: MediaQueryListListener): void;\n}\n\ndeclare var MediaQueryList: {\n prototype: MediaQueryList;\n new(): MediaQueryList;\n}\n\ninterface MediaSource extends EventTarget {\n readonly activeSourceBuffers: SourceBufferList;\n duration: number;\n readonly readyState: string;\n readonly sourceBuffers: SourceBufferList;\n addSourceBuffer(type: string): SourceBuffer;\n endOfStream(error?: number): void;\n removeSourceBuffer(sourceBuffer: SourceBuffer): void;\n}\n\ndeclare var MediaSource: {\n prototype: MediaSource;\n new(): MediaSource;\n isTypeSupported(type: string): boolean;\n}\n\ninterface MediaStreamEventMap {\n \"active\": Event;\n \"addtrack\": TrackEvent;\n \"inactive\": Event;\n \"removetrack\": TrackEvent;\n}\n\ninterface MediaStream extends EventTarget {\n readonly active: boolean;\n readonly id: string;\n onactive: (this: MediaStream, ev: Event) => any;\n onaddtrack: (this: MediaStream, ev: TrackEvent) => any;\n oninactive: (this: MediaStream, ev: Event) => any;\n onremovetrack: (this: MediaStream, ev: TrackEvent) => any;\n addTrack(track: MediaStreamTrack): void;\n clone(): MediaStream;\n getAudioTracks(): MediaStreamTrack[];\n getTrackById(trackId: string): MediaStreamTrack | null;\n getTracks(): MediaStreamTrack[];\n getVideoTracks(): MediaStreamTrack[];\n removeTrack(track: MediaStreamTrack): void;\n stop(): void;\n addEventListener(type: K, listener: (this: MediaStream, ev: MediaStreamEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MediaStream: {\n prototype: MediaStream;\n new(streamOrTracks?: MediaStream | MediaStreamTrack[]): MediaStream;\n}\n\ninterface MediaStreamAudioSourceNode extends AudioNode {\n}\n\ndeclare var MediaStreamAudioSourceNode: {\n prototype: MediaStreamAudioSourceNode;\n new(): MediaStreamAudioSourceNode;\n}\n\ninterface MediaStreamError {\n readonly constraintName: string | null;\n readonly message: string | null;\n readonly name: string;\n}\n\ndeclare var MediaStreamError: {\n prototype: MediaStreamError;\n new(): MediaStreamError;\n}\n\ninterface MediaStreamErrorEvent extends Event {\n readonly error: MediaStreamError | null;\n}\n\ndeclare var MediaStreamErrorEvent: {\n prototype: MediaStreamErrorEvent;\n new(type: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent;\n}\n\ninterface MediaStreamTrackEventMap {\n \"ended\": MediaStreamErrorEvent;\n \"mute\": Event;\n \"overconstrained\": MediaStreamErrorEvent;\n \"unmute\": Event;\n}\n\ninterface MediaStreamTrack extends EventTarget {\n enabled: boolean;\n readonly id: string;\n readonly kind: string;\n readonly label: string;\n readonly muted: boolean;\n onended: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any;\n onmute: (this: MediaStreamTrack, ev: Event) => any;\n onoverconstrained: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any;\n onunmute: (this: MediaStreamTrack, ev: Event) => any;\n readonly readonly: boolean;\n readonly readyState: string;\n readonly remote: boolean;\n applyConstraints(constraints: MediaTrackConstraints): PromiseLike;\n clone(): MediaStreamTrack;\n getCapabilities(): MediaTrackCapabilities;\n getConstraints(): MediaTrackConstraints;\n getSettings(): MediaTrackSettings;\n stop(): void;\n addEventListener(type: K, listener: (this: MediaStreamTrack, ev: MediaStreamTrackEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MediaStreamTrack: {\n prototype: MediaStreamTrack;\n new(): MediaStreamTrack;\n}\n\ninterface MediaStreamTrackEvent extends Event {\n readonly track: MediaStreamTrack;\n}\n\ndeclare var MediaStreamTrackEvent: {\n prototype: MediaStreamTrackEvent;\n new(type: string, eventInitDict?: MediaStreamTrackEventInit): MediaStreamTrackEvent;\n}\n\ninterface MessageChannel {\n readonly port1: MessagePort;\n readonly port2: MessagePort;\n}\n\ndeclare var MessageChannel: {\n prototype: MessageChannel;\n new(): MessageChannel;\n}\n\ninterface MessageEvent extends Event {\n readonly data: any;\n readonly origin: string;\n readonly ports: any;\n readonly source: Window;\n initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: Window): void;\n}\n\ndeclare var MessageEvent: {\n prototype: MessageEvent;\n new(type: string, eventInitDict?: MessageEventInit): MessageEvent;\n}\n\ninterface MessagePortEventMap {\n \"message\": MessageEvent;\n}\n\ninterface MessagePort extends EventTarget {\n onmessage: (this: MessagePort, ev: MessageEvent) => any;\n close(): void;\n postMessage(message?: any, ports?: any): void;\n start(): void;\n addEventListener(type: K, listener: (this: MessagePort, ev: MessagePortEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MessagePort: {\n prototype: MessagePort;\n new(): MessagePort;\n}\n\ninterface MimeType {\n readonly description: string;\n readonly enabledPlugin: Plugin;\n readonly suffixes: string;\n readonly type: string;\n}\n\ndeclare var MimeType: {\n prototype: MimeType;\n new(): MimeType;\n}\n\ninterface MimeTypeArray {\n readonly length: number;\n item(index: number): Plugin;\n namedItem(type: string): Plugin;\n [index: number]: Plugin;\n}\n\ndeclare var MimeTypeArray: {\n prototype: MimeTypeArray;\n new(): MimeTypeArray;\n}\n\ninterface MouseEvent extends UIEvent {\n readonly altKey: boolean;\n readonly button: number;\n readonly buttons: number;\n readonly clientX: number;\n readonly clientY: number;\n readonly ctrlKey: boolean;\n readonly fromElement: Element;\n readonly layerX: number;\n readonly layerY: number;\n readonly metaKey: boolean;\n readonly movementX: number;\n readonly movementY: number;\n readonly offsetX: number;\n readonly offsetY: number;\n readonly pageX: number;\n readonly pageY: number;\n readonly relatedTarget: EventTarget;\n readonly screenX: number;\n readonly screenY: number;\n readonly shiftKey: boolean;\n readonly toElement: Element;\n readonly which: number;\n readonly x: number;\n readonly y: number;\n getModifierState(keyArg: string): boolean;\n initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget | null): void;\n}\n\ndeclare var MouseEvent: {\n prototype: MouseEvent;\n new(typeArg: string, eventInitDict?: MouseEventInit): MouseEvent;\n}\n\ninterface MutationEvent extends Event {\n readonly attrChange: number;\n readonly attrName: string;\n readonly newValue: string;\n readonly prevValue: string;\n readonly relatedNode: Node;\n initMutationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, relatedNodeArg: Node, prevValueArg: string, newValueArg: string, attrNameArg: string, attrChangeArg: number): void;\n readonly ADDITION: number;\n readonly MODIFICATION: number;\n readonly REMOVAL: number;\n}\n\ndeclare var MutationEvent: {\n prototype: MutationEvent;\n new(): MutationEvent;\n readonly ADDITION: number;\n readonly MODIFICATION: number;\n readonly REMOVAL: number;\n}\n\ninterface MutationObserver {\n disconnect(): void;\n observe(target: Node, options: MutationObserverInit): void;\n takeRecords(): MutationRecord[];\n}\n\ndeclare var MutationObserver: {\n prototype: MutationObserver;\n new(callback: MutationCallback): MutationObserver;\n}\n\ninterface MutationRecord {\n readonly addedNodes: NodeList;\n readonly attributeName: string | null;\n readonly attributeNamespace: string | null;\n readonly nextSibling: Node | null;\n readonly oldValue: string | null;\n readonly previousSibling: Node | null;\n readonly removedNodes: NodeList;\n readonly target: Node;\n readonly type: string;\n}\n\ndeclare var MutationRecord: {\n prototype: MutationRecord;\n new(): MutationRecord;\n}\n\ninterface NamedNodeMap {\n readonly length: number;\n getNamedItem(name: string): Attr;\n getNamedItemNS(namespaceURI: string | null, localName: string | null): Attr;\n item(index: number): Attr;\n removeNamedItem(name: string): Attr;\n removeNamedItemNS(namespaceURI: string | null, localName: string | null): Attr;\n setNamedItem(arg: Attr): Attr;\n setNamedItemNS(arg: Attr): Attr;\n [index: number]: Attr;\n}\n\ndeclare var NamedNodeMap: {\n prototype: NamedNodeMap;\n new(): NamedNodeMap;\n}\n\ninterface NavigationCompletedEvent extends NavigationEvent {\n readonly isSuccess: boolean;\n readonly webErrorStatus: number;\n}\n\ndeclare var NavigationCompletedEvent: {\n prototype: NavigationCompletedEvent;\n new(): NavigationCompletedEvent;\n}\n\ninterface NavigationEvent extends Event {\n readonly uri: string;\n}\n\ndeclare var NavigationEvent: {\n prototype: NavigationEvent;\n new(): NavigationEvent;\n}\n\ninterface NavigationEventWithReferrer extends NavigationEvent {\n readonly referer: string;\n}\n\ndeclare var NavigationEventWithReferrer: {\n prototype: NavigationEventWithReferrer;\n new(): NavigationEventWithReferrer;\n}\n\ninterface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver, NavigatorUserMedia {\n readonly appCodeName: string;\n readonly cookieEnabled: boolean;\n readonly language: string;\n readonly maxTouchPoints: number;\n readonly mimeTypes: MimeTypeArray;\n readonly msManipulationViewsEnabled: boolean;\n readonly msMaxTouchPoints: number;\n readonly msPointerEnabled: boolean;\n readonly plugins: PluginArray;\n readonly pointerEnabled: boolean;\n readonly webdriver: boolean;\n readonly hardwareConcurrency: number;\n getGamepads(): Gamepad[];\n javaEnabled(): boolean;\n msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void;\n requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): PromiseLike;\n vibrate(pattern: number | number[]): boolean;\n}\n\ndeclare var Navigator: {\n prototype: Navigator;\n new(): Navigator;\n}\n\ninterface Node extends EventTarget {\n readonly attributes: NamedNodeMap;\n readonly baseURI: string | null;\n readonly childNodes: NodeList;\n readonly firstChild: Node | null;\n readonly lastChild: Node | null;\n readonly localName: string | null;\n readonly namespaceURI: string | null;\n readonly nextSibling: Node | null;\n readonly nodeName: string;\n readonly nodeType: number;\n nodeValue: string | null;\n readonly ownerDocument: Document;\n readonly parentElement: HTMLElement | null;\n readonly parentNode: Node | null;\n readonly previousSibling: Node | null;\n textContent: string | null;\n appendChild(newChild: Node): Node;\n cloneNode(deep?: boolean): Node;\n compareDocumentPosition(other: Node): number;\n contains(child: Node): boolean;\n hasAttributes(): boolean;\n hasChildNodes(): boolean;\n insertBefore(newChild: Node, refChild: Node | null): Node;\n isDefaultNamespace(namespaceURI: string | null): boolean;\n isEqualNode(arg: Node): boolean;\n isSameNode(other: Node): boolean;\n lookupNamespaceURI(prefix: string | null): string | null;\n lookupPrefix(namespaceURI: string | null): string | null;\n normalize(): void;\n removeChild(oldChild: Node): Node;\n replaceChild(newChild: Node, oldChild: Node): Node;\n readonly ATTRIBUTE_NODE: number;\n readonly CDATA_SECTION_NODE: number;\n readonly COMMENT_NODE: number;\n readonly DOCUMENT_FRAGMENT_NODE: number;\n readonly DOCUMENT_NODE: number;\n readonly DOCUMENT_POSITION_CONTAINED_BY: number;\n readonly DOCUMENT_POSITION_CONTAINS: number;\n readonly DOCUMENT_POSITION_DISCONNECTED: number;\n readonly DOCUMENT_POSITION_FOLLOWING: number;\n readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number;\n readonly DOCUMENT_POSITION_PRECEDING: number;\n readonly DOCUMENT_TYPE_NODE: number;\n readonly ELEMENT_NODE: number;\n readonly ENTITY_NODE: number;\n readonly ENTITY_REFERENCE_NODE: number;\n readonly NOTATION_NODE: number;\n readonly PROCESSING_INSTRUCTION_NODE: number;\n readonly TEXT_NODE: number;\n}\n\ndeclare var Node: {\n prototype: Node;\n new(): Node;\n readonly ATTRIBUTE_NODE: number;\n readonly CDATA_SECTION_NODE: number;\n readonly COMMENT_NODE: number;\n readonly DOCUMENT_FRAGMENT_NODE: number;\n readonly DOCUMENT_NODE: number;\n readonly DOCUMENT_POSITION_CONTAINED_BY: number;\n readonly DOCUMENT_POSITION_CONTAINS: number;\n readonly DOCUMENT_POSITION_DISCONNECTED: number;\n readonly DOCUMENT_POSITION_FOLLOWING: number;\n readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number;\n readonly DOCUMENT_POSITION_PRECEDING: number;\n readonly DOCUMENT_TYPE_NODE: number;\n readonly ELEMENT_NODE: number;\n readonly ENTITY_NODE: number;\n readonly ENTITY_REFERENCE_NODE: number;\n readonly NOTATION_NODE: number;\n readonly PROCESSING_INSTRUCTION_NODE: number;\n readonly TEXT_NODE: number;\n}\n\ninterface NodeFilter {\n acceptNode(n: Node): number;\n}\n\ndeclare var NodeFilter: {\n readonly FILTER_ACCEPT: number;\n readonly FILTER_REJECT: number;\n readonly FILTER_SKIP: number;\n readonly SHOW_ALL: number;\n readonly SHOW_ATTRIBUTE: number;\n readonly SHOW_CDATA_SECTION: number;\n readonly SHOW_COMMENT: number;\n readonly SHOW_DOCUMENT: number;\n readonly SHOW_DOCUMENT_FRAGMENT: number;\n readonly SHOW_DOCUMENT_TYPE: number;\n readonly SHOW_ELEMENT: number;\n readonly SHOW_ENTITY: number;\n readonly SHOW_ENTITY_REFERENCE: number;\n readonly SHOW_NOTATION: number;\n readonly SHOW_PROCESSING_INSTRUCTION: number;\n readonly SHOW_TEXT: number;\n}\n\ninterface NodeIterator {\n readonly expandEntityReferences: boolean;\n readonly filter: NodeFilter;\n readonly root: Node;\n readonly whatToShow: number;\n detach(): void;\n nextNode(): Node;\n previousNode(): Node;\n}\n\ndeclare var NodeIterator: {\n prototype: NodeIterator;\n new(): NodeIterator;\n}\n\ninterface NodeList {\n readonly length: number;\n item(index: number): Node;\n [index: number]: Node;\n}\n\ndeclare var NodeList: {\n prototype: NodeList;\n new(): NodeList;\n}\n\ninterface OES_element_index_uint {\n}\n\ndeclare var OES_element_index_uint: {\n prototype: OES_element_index_uint;\n new(): OES_element_index_uint;\n}\n\ninterface OES_standard_derivatives {\n readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number;\n}\n\ndeclare var OES_standard_derivatives: {\n prototype: OES_standard_derivatives;\n new(): OES_standard_derivatives;\n readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number;\n}\n\ninterface OES_texture_float {\n}\n\ndeclare var OES_texture_float: {\n prototype: OES_texture_float;\n new(): OES_texture_float;\n}\n\ninterface OES_texture_float_linear {\n}\n\ndeclare var OES_texture_float_linear: {\n prototype: OES_texture_float_linear;\n new(): OES_texture_float_linear;\n}\n\ninterface OfflineAudioCompletionEvent extends Event {\n readonly renderedBuffer: AudioBuffer;\n}\n\ndeclare var OfflineAudioCompletionEvent: {\n prototype: OfflineAudioCompletionEvent;\n new(): OfflineAudioCompletionEvent;\n}\n\ninterface OfflineAudioContextEventMap {\n \"complete\": Event;\n}\n\ninterface OfflineAudioContext extends AudioContext {\n oncomplete: (this: OfflineAudioContext, ev: Event) => any;\n startRendering(): PromiseLike;\n addEventListener(type: K, listener: (this: OfflineAudioContext, ev: OfflineAudioContextEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var OfflineAudioContext: {\n prototype: OfflineAudioContext;\n new(numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext;\n}\n\ninterface OscillatorNodeEventMap {\n \"ended\": MediaStreamErrorEvent;\n}\n\ninterface OscillatorNode extends AudioNode {\n readonly detune: AudioParam;\n readonly frequency: AudioParam;\n onended: (this: OscillatorNode, ev: MediaStreamErrorEvent) => any;\n type: string;\n setPeriodicWave(periodicWave: PeriodicWave): void;\n start(when?: number): void;\n stop(when?: number): void;\n addEventListener(type: K, listener: (this: OscillatorNode, ev: OscillatorNodeEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var OscillatorNode: {\n prototype: OscillatorNode;\n new(): OscillatorNode;\n}\n\ninterface OverflowEvent extends UIEvent {\n readonly horizontalOverflow: boolean;\n readonly orient: number;\n readonly verticalOverflow: boolean;\n readonly BOTH: number;\n readonly HORIZONTAL: number;\n readonly VERTICAL: number;\n}\n\ndeclare var OverflowEvent: {\n prototype: OverflowEvent;\n new(): OverflowEvent;\n readonly BOTH: number;\n readonly HORIZONTAL: number;\n readonly VERTICAL: number;\n}\n\ninterface PageTransitionEvent extends Event {\n readonly persisted: boolean;\n}\n\ndeclare var PageTransitionEvent: {\n prototype: PageTransitionEvent;\n new(): PageTransitionEvent;\n}\n\ninterface PannerNode extends AudioNode {\n coneInnerAngle: number;\n coneOuterAngle: number;\n coneOuterGain: number;\n distanceModel: string;\n maxDistance: number;\n panningModel: string;\n refDistance: number;\n rolloffFactor: number;\n setOrientation(x: number, y: number, z: number): void;\n setPosition(x: number, y: number, z: number): void;\n setVelocity(x: number, y: number, z: number): void;\n}\n\ndeclare var PannerNode: {\n prototype: PannerNode;\n new(): PannerNode;\n}\n\ninterface PerfWidgetExternal {\n readonly activeNetworkRequestCount: number;\n readonly averageFrameTime: number;\n readonly averagePaintTime: number;\n readonly extraInformationEnabled: boolean;\n readonly independentRenderingEnabled: boolean;\n readonly irDisablingContentString: string;\n readonly irStatusAvailable: boolean;\n readonly maxCpuSpeed: number;\n readonly paintRequestsPerSecond: number;\n readonly performanceCounter: number;\n readonly performanceCounterFrequency: number;\n addEventListener(eventType: string, callback: Function): void;\n getMemoryUsage(): number;\n getProcessCpuUsage(): number;\n getRecentCpuUsage(last: number | null): any;\n getRecentFrames(last: number | null): any;\n getRecentMemoryUsage(last: number | null): any;\n getRecentPaintRequests(last: number | null): any;\n removeEventListener(eventType: string, callback: Function): void;\n repositionWindow(x: number, y: number): void;\n resizeWindow(width: number, height: number): void;\n}\n\ndeclare var PerfWidgetExternal: {\n prototype: PerfWidgetExternal;\n new(): PerfWidgetExternal;\n}\n\ninterface Performance {\n readonly navigation: PerformanceNavigation;\n readonly timing: PerformanceTiming;\n clearMarks(markName?: string): void;\n clearMeasures(measureName?: string): void;\n clearResourceTimings(): void;\n getEntries(): any;\n getEntriesByName(name: string, entryType?: string): any;\n getEntriesByType(entryType: string): any;\n getMarks(markName?: string): any;\n getMeasures(measureName?: string): any;\n mark(markName: string): void;\n measure(measureName: string, startMarkName?: string, endMarkName?: string): void;\n now(): number;\n setResourceTimingBufferSize(maxSize: number): void;\n toJSON(): any;\n}\n\ndeclare var Performance: {\n prototype: Performance;\n new(): Performance;\n}\n\ninterface PerformanceEntry {\n readonly duration: number;\n readonly entryType: string;\n readonly name: string;\n readonly startTime: number;\n}\n\ndeclare var PerformanceEntry: {\n prototype: PerformanceEntry;\n new(): PerformanceEntry;\n}\n\ninterface PerformanceMark extends PerformanceEntry {\n}\n\ndeclare var PerformanceMark: {\n prototype: PerformanceMark;\n new(): PerformanceMark;\n}\n\ninterface PerformanceMeasure extends PerformanceEntry {\n}\n\ndeclare var PerformanceMeasure: {\n prototype: PerformanceMeasure;\n new(): PerformanceMeasure;\n}\n\ninterface PerformanceNavigation {\n readonly redirectCount: number;\n readonly type: number;\n toJSON(): any;\n readonly TYPE_BACK_FORWARD: number;\n readonly TYPE_NAVIGATE: number;\n readonly TYPE_RELOAD: number;\n readonly TYPE_RESERVED: number;\n}\n\ndeclare var PerformanceNavigation: {\n prototype: PerformanceNavigation;\n new(): PerformanceNavigation;\n readonly TYPE_BACK_FORWARD: number;\n readonly TYPE_NAVIGATE: number;\n readonly TYPE_RELOAD: number;\n readonly TYPE_RESERVED: number;\n}\n\ninterface PerformanceNavigationTiming extends PerformanceEntry {\n readonly connectEnd: number;\n readonly connectStart: number;\n readonly domComplete: number;\n readonly domContentLoadedEventEnd: number;\n readonly domContentLoadedEventStart: number;\n readonly domInteractive: number;\n readonly domLoading: number;\n readonly domainLookupEnd: number;\n readonly domainLookupStart: number;\n readonly fetchStart: number;\n readonly loadEventEnd: number;\n readonly loadEventStart: number;\n readonly navigationStart: number;\n readonly redirectCount: number;\n readonly redirectEnd: number;\n readonly redirectStart: number;\n readonly requestStart: number;\n readonly responseEnd: number;\n readonly responseStart: number;\n readonly type: string;\n readonly unloadEventEnd: number;\n readonly unloadEventStart: number;\n}\n\ndeclare var PerformanceNavigationTiming: {\n prototype: PerformanceNavigationTiming;\n new(): PerformanceNavigationTiming;\n}\n\ninterface PerformanceResourceTiming extends PerformanceEntry {\n readonly connectEnd: number;\n readonly connectStart: number;\n readonly domainLookupEnd: number;\n readonly domainLookupStart: number;\n readonly fetchStart: number;\n readonly initiatorType: string;\n readonly redirectEnd: number;\n readonly redirectStart: number;\n readonly requestStart: number;\n readonly responseEnd: number;\n readonly responseStart: number;\n}\n\ndeclare var PerformanceResourceTiming: {\n prototype: PerformanceResourceTiming;\n new(): PerformanceResourceTiming;\n}\n\ninterface PerformanceTiming {\n readonly connectEnd: number;\n readonly connectStart: number;\n readonly domComplete: number;\n readonly domContentLoadedEventEnd: number;\n readonly domContentLoadedEventStart: number;\n readonly domInteractive: number;\n readonly domLoading: number;\n readonly domainLookupEnd: number;\n readonly domainLookupStart: number;\n readonly fetchStart: number;\n readonly loadEventEnd: number;\n readonly loadEventStart: number;\n readonly msFirstPaint: number;\n readonly navigationStart: number;\n readonly redirectEnd: number;\n readonly redirectStart: number;\n readonly requestStart: number;\n readonly responseEnd: number;\n readonly responseStart: number;\n readonly unloadEventEnd: number;\n readonly unloadEventStart: number;\n readonly secureConnectionStart: number;\n toJSON(): any;\n}\n\ndeclare var PerformanceTiming: {\n prototype: PerformanceTiming;\n new(): PerformanceTiming;\n}\n\ninterface PeriodicWave {\n}\n\ndeclare var PeriodicWave: {\n prototype: PeriodicWave;\n new(): PeriodicWave;\n}\n\ninterface PermissionRequest extends DeferredPermissionRequest {\n readonly state: string;\n defer(): void;\n}\n\ndeclare var PermissionRequest: {\n prototype: PermissionRequest;\n new(): PermissionRequest;\n}\n\ninterface PermissionRequestedEvent extends Event {\n readonly permissionRequest: PermissionRequest;\n}\n\ndeclare var PermissionRequestedEvent: {\n prototype: PermissionRequestedEvent;\n new(): PermissionRequestedEvent;\n}\n\ninterface Plugin {\n readonly description: string;\n readonly filename: string;\n readonly length: number;\n readonly name: string;\n readonly version: string;\n item(index: number): MimeType;\n namedItem(type: string): MimeType;\n [index: number]: MimeType;\n}\n\ndeclare var Plugin: {\n prototype: Plugin;\n new(): Plugin;\n}\n\ninterface PluginArray {\n readonly length: number;\n item(index: number): Plugin;\n namedItem(name: string): Plugin;\n refresh(reload?: boolean): void;\n [index: number]: Plugin;\n}\n\ndeclare var PluginArray: {\n prototype: PluginArray;\n new(): PluginArray;\n}\n\ninterface PointerEvent extends MouseEvent {\n readonly currentPoint: any;\n readonly height: number;\n readonly hwTimestamp: number;\n readonly intermediatePoints: any;\n readonly isPrimary: boolean;\n readonly pointerId: number;\n readonly pointerType: any;\n readonly pressure: number;\n readonly rotation: number;\n readonly tiltX: number;\n readonly tiltY: number;\n readonly width: number;\n getCurrentPoint(element: Element): void;\n getIntermediatePoints(element: Element): void;\n initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void;\n}\n\ndeclare var PointerEvent: {\n prototype: PointerEvent;\n new(typeArg: string, eventInitDict?: PointerEventInit): PointerEvent;\n}\n\ninterface PopStateEvent extends Event {\n readonly state: any;\n initPopStateEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, stateArg: any): void;\n}\n\ndeclare var PopStateEvent: {\n prototype: PopStateEvent;\n new(): PopStateEvent;\n}\n\ninterface Position {\n readonly coords: Coordinates;\n readonly timestamp: number;\n}\n\ndeclare var Position: {\n prototype: Position;\n new(): Position;\n}\n\ninterface PositionError {\n readonly code: number;\n readonly message: string;\n toString(): string;\n readonly PERMISSION_DENIED: number;\n readonly POSITION_UNAVAILABLE: number;\n readonly TIMEOUT: number;\n}\n\ndeclare var PositionError: {\n prototype: PositionError;\n new(): PositionError;\n readonly PERMISSION_DENIED: number;\n readonly POSITION_UNAVAILABLE: number;\n readonly TIMEOUT: number;\n}\n\ninterface ProcessingInstruction extends CharacterData {\n readonly target: string;\n}\n\ndeclare var ProcessingInstruction: {\n prototype: ProcessingInstruction;\n new(): ProcessingInstruction;\n}\n\ninterface ProgressEvent extends Event {\n readonly lengthComputable: boolean;\n readonly loaded: number;\n readonly total: number;\n initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void;\n}\n\ndeclare var ProgressEvent: {\n prototype: ProgressEvent;\n new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent;\n}\n\ninterface RTCDTMFToneChangeEvent extends Event {\n readonly tone: string;\n}\n\ndeclare var RTCDTMFToneChangeEvent: {\n prototype: RTCDTMFToneChangeEvent;\n new(type: string, eventInitDict: RTCDTMFToneChangeEventInit): RTCDTMFToneChangeEvent;\n}\n\ninterface RTCDtlsTransportEventMap {\n \"dtlsstatechange\": RTCDtlsTransportStateChangedEvent;\n \"error\": ErrorEvent;\n}\n\ninterface RTCDtlsTransport extends RTCStatsProvider {\n ondtlsstatechange: ((this: RTCDtlsTransport, ev: RTCDtlsTransportStateChangedEvent) => any) | null;\n onerror: ((this: RTCDtlsTransport, ev: ErrorEvent) => any) | null;\n readonly state: string;\n readonly transport: RTCIceTransport;\n getLocalParameters(): RTCDtlsParameters;\n getRemoteCertificates(): ArrayBuffer[];\n getRemoteParameters(): RTCDtlsParameters | null;\n start(remoteParameters: RTCDtlsParameters): void;\n stop(): void;\n addEventListener(type: K, listener: (this: RTCDtlsTransport, ev: RTCDtlsTransportEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var RTCDtlsTransport: {\n prototype: RTCDtlsTransport;\n new(transport: RTCIceTransport): RTCDtlsTransport;\n}\n\ninterface RTCDtlsTransportStateChangedEvent extends Event {\n readonly state: string;\n}\n\ndeclare var RTCDtlsTransportStateChangedEvent: {\n prototype: RTCDtlsTransportStateChangedEvent;\n new(): RTCDtlsTransportStateChangedEvent;\n}\n\ninterface RTCDtmfSenderEventMap {\n \"tonechange\": RTCDTMFToneChangeEvent;\n}\n\ninterface RTCDtmfSender extends EventTarget {\n readonly canInsertDTMF: boolean;\n readonly duration: number;\n readonly interToneGap: number;\n ontonechange: (this: RTCDtmfSender, ev: RTCDTMFToneChangeEvent) => any;\n readonly sender: RTCRtpSender;\n readonly toneBuffer: string;\n insertDTMF(tones: string, duration?: number, interToneGap?: number): void;\n addEventListener(type: K, listener: (this: RTCDtmfSender, ev: RTCDtmfSenderEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var RTCDtmfSender: {\n prototype: RTCDtmfSender;\n new(sender: RTCRtpSender): RTCDtmfSender;\n}\n\ninterface RTCIceCandidatePairChangedEvent extends Event {\n readonly pair: RTCIceCandidatePair;\n}\n\ndeclare var RTCIceCandidatePairChangedEvent: {\n prototype: RTCIceCandidatePairChangedEvent;\n new(): RTCIceCandidatePairChangedEvent;\n}\n\ninterface RTCIceGathererEventMap {\n \"error\": ErrorEvent;\n \"localcandidate\": RTCIceGathererEvent;\n}\n\ninterface RTCIceGatherer extends RTCStatsProvider {\n readonly component: string;\n onerror: ((this: RTCIceGatherer, ev: ErrorEvent) => any) | null;\n onlocalcandidate: ((this: RTCIceGatherer, ev: RTCIceGathererEvent) => any) | null;\n createAssociatedGatherer(): RTCIceGatherer;\n getLocalCandidates(): RTCIceCandidate[];\n getLocalParameters(): RTCIceParameters;\n addEventListener(type: K, listener: (this: RTCIceGatherer, ev: RTCIceGathererEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var RTCIceGatherer: {\n prototype: RTCIceGatherer;\n new(options: RTCIceGatherOptions): RTCIceGatherer;\n}\n\ninterface RTCIceGathererEvent extends Event {\n readonly candidate: RTCIceCandidate | RTCIceCandidateComplete;\n}\n\ndeclare var RTCIceGathererEvent: {\n prototype: RTCIceGathererEvent;\n new(): RTCIceGathererEvent;\n}\n\ninterface RTCIceTransportEventMap {\n \"candidatepairchange\": RTCIceCandidatePairChangedEvent;\n \"icestatechange\": RTCIceTransportStateChangedEvent;\n}\n\ninterface RTCIceTransport extends RTCStatsProvider {\n readonly component: string;\n readonly iceGatherer: RTCIceGatherer | null;\n oncandidatepairchange: ((this: RTCIceTransport, ev: RTCIceCandidatePairChangedEvent) => any) | null;\n onicestatechange: ((this: RTCIceTransport, ev: RTCIceTransportStateChangedEvent) => any) | null;\n readonly role: string;\n readonly state: string;\n addRemoteCandidate(remoteCandidate: RTCIceCandidate | RTCIceCandidateComplete): void;\n createAssociatedTransport(): RTCIceTransport;\n getNominatedCandidatePair(): RTCIceCandidatePair | null;\n getRemoteCandidates(): RTCIceCandidate[];\n getRemoteParameters(): RTCIceParameters | null;\n setRemoteCandidates(remoteCandidates: RTCIceCandidate[]): void;\n start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: string): void;\n stop(): void;\n addEventListener(type: K, listener: (this: RTCIceTransport, ev: RTCIceTransportEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var RTCIceTransport: {\n prototype: RTCIceTransport;\n new(): RTCIceTransport;\n}\n\ninterface RTCIceTransportStateChangedEvent extends Event {\n readonly state: string;\n}\n\ndeclare var RTCIceTransportStateChangedEvent: {\n prototype: RTCIceTransportStateChangedEvent;\n new(): RTCIceTransportStateChangedEvent;\n}\n\ninterface RTCRtpReceiverEventMap {\n \"error\": ErrorEvent;\n}\n\ninterface RTCRtpReceiver extends RTCStatsProvider {\n onerror: ((this: RTCRtpReceiver, ev: ErrorEvent) => any) | null;\n readonly rtcpTransport: RTCDtlsTransport;\n readonly track: MediaStreamTrack | null;\n readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport;\n getContributingSources(): RTCRtpContributingSource[];\n receive(parameters: RTCRtpParameters): void;\n requestSendCSRC(csrc: number): void;\n setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void;\n stop(): void;\n addEventListener(type: K, listener: (this: RTCRtpReceiver, ev: RTCRtpReceiverEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var RTCRtpReceiver: {\n prototype: RTCRtpReceiver;\n new(transport: RTCDtlsTransport | RTCSrtpSdesTransport, kind: string, rtcpTransport?: RTCDtlsTransport): RTCRtpReceiver;\n getCapabilities(kind?: string): RTCRtpCapabilities;\n}\n\ninterface RTCRtpSenderEventMap {\n \"error\": ErrorEvent;\n \"ssrcconflict\": RTCSsrcConflictEvent;\n}\n\ninterface RTCRtpSender extends RTCStatsProvider {\n onerror: ((this: RTCRtpSender, ev: ErrorEvent) => any) | null;\n onssrcconflict: ((this: RTCRtpSender, ev: RTCSsrcConflictEvent) => any) | null;\n readonly rtcpTransport: RTCDtlsTransport;\n readonly track: MediaStreamTrack;\n readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport;\n send(parameters: RTCRtpParameters): void;\n setTrack(track: MediaStreamTrack): void;\n setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void;\n stop(): void;\n addEventListener(type: K, listener: (this: RTCRtpSender, ev: RTCRtpSenderEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var RTCRtpSender: {\n prototype: RTCRtpSender;\n new(track: MediaStreamTrack, transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): RTCRtpSender;\n getCapabilities(kind?: string): RTCRtpCapabilities;\n}\n\ninterface RTCSrtpSdesTransportEventMap {\n \"error\": ErrorEvent;\n}\n\ninterface RTCSrtpSdesTransport extends EventTarget {\n onerror: ((this: RTCSrtpSdesTransport, ev: ErrorEvent) => any) | null;\n readonly transport: RTCIceTransport;\n addEventListener(type: K, listener: (this: RTCSrtpSdesTransport, ev: RTCSrtpSdesTransportEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var RTCSrtpSdesTransport: {\n prototype: RTCSrtpSdesTransport;\n new(transport: RTCIceTransport, encryptParameters: RTCSrtpSdesParameters, decryptParameters: RTCSrtpSdesParameters): RTCSrtpSdesTransport;\n getLocalParameters(): RTCSrtpSdesParameters[];\n}\n\ninterface RTCSsrcConflictEvent extends Event {\n readonly ssrc: number;\n}\n\ndeclare var RTCSsrcConflictEvent: {\n prototype: RTCSsrcConflictEvent;\n new(): RTCSsrcConflictEvent;\n}\n\ninterface RTCStatsProvider extends EventTarget {\n getStats(): PromiseLike;\n msGetStats(): PromiseLike;\n}\n\ndeclare var RTCStatsProvider: {\n prototype: RTCStatsProvider;\n new(): RTCStatsProvider;\n}\n\ninterface Range {\n readonly collapsed: boolean;\n readonly commonAncestorContainer: Node;\n readonly endContainer: Node;\n readonly endOffset: number;\n readonly startContainer: Node;\n readonly startOffset: number;\n cloneContents(): DocumentFragment;\n cloneRange(): Range;\n collapse(toStart: boolean): void;\n compareBoundaryPoints(how: number, sourceRange: Range): number;\n createContextualFragment(fragment: string): DocumentFragment;\n deleteContents(): void;\n detach(): void;\n expand(Unit: string): boolean;\n extractContents(): DocumentFragment;\n getBoundingClientRect(): ClientRect;\n getClientRects(): ClientRectList;\n insertNode(newNode: Node): void;\n selectNode(refNode: Node): void;\n selectNodeContents(refNode: Node): void;\n setEnd(refNode: Node, offset: number): void;\n setEndAfter(refNode: Node): void;\n setEndBefore(refNode: Node): void;\n setStart(refNode: Node, offset: number): void;\n setStartAfter(refNode: Node): void;\n setStartBefore(refNode: Node): void;\n surroundContents(newParent: Node): void;\n toString(): string;\n readonly END_TO_END: number;\n readonly END_TO_START: number;\n readonly START_TO_END: number;\n readonly START_TO_START: number;\n}\n\ndeclare var Range: {\n prototype: Range;\n new(): Range;\n readonly END_TO_END: number;\n readonly END_TO_START: number;\n readonly START_TO_END: number;\n readonly START_TO_START: number;\n}\n\ninterface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference {\n readonly target: SVGAnimatedString;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGAElement: {\n prototype: SVGAElement;\n new(): SVGAElement;\n}\n\ninterface SVGAngle {\n readonly unitType: number;\n value: number;\n valueAsString: string;\n valueInSpecifiedUnits: number;\n convertToSpecifiedUnits(unitType: number): void;\n newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void;\n readonly SVG_ANGLETYPE_DEG: number;\n readonly SVG_ANGLETYPE_GRAD: number;\n readonly SVG_ANGLETYPE_RAD: number;\n readonly SVG_ANGLETYPE_UNKNOWN: number;\n readonly SVG_ANGLETYPE_UNSPECIFIED: number;\n}\n\ndeclare var SVGAngle: {\n prototype: SVGAngle;\n new(): SVGAngle;\n readonly SVG_ANGLETYPE_DEG: number;\n readonly SVG_ANGLETYPE_GRAD: number;\n readonly SVG_ANGLETYPE_RAD: number;\n readonly SVG_ANGLETYPE_UNKNOWN: number;\n readonly SVG_ANGLETYPE_UNSPECIFIED: number;\n}\n\ninterface SVGAnimatedAngle {\n readonly animVal: SVGAngle;\n readonly baseVal: SVGAngle;\n}\n\ndeclare var SVGAnimatedAngle: {\n prototype: SVGAnimatedAngle;\n new(): SVGAnimatedAngle;\n}\n\ninterface SVGAnimatedBoolean {\n readonly animVal: boolean;\n baseVal: boolean;\n}\n\ndeclare var SVGAnimatedBoolean: {\n prototype: SVGAnimatedBoolean;\n new(): SVGAnimatedBoolean;\n}\n\ninterface SVGAnimatedEnumeration {\n readonly animVal: number;\n baseVal: number;\n}\n\ndeclare var SVGAnimatedEnumeration: {\n prototype: SVGAnimatedEnumeration;\n new(): SVGAnimatedEnumeration;\n}\n\ninterface SVGAnimatedInteger {\n readonly animVal: number;\n baseVal: number;\n}\n\ndeclare var SVGAnimatedInteger: {\n prototype: SVGAnimatedInteger;\n new(): SVGAnimatedInteger;\n}\n\ninterface SVGAnimatedLength {\n readonly animVal: SVGLength;\n readonly baseVal: SVGLength;\n}\n\ndeclare var SVGAnimatedLength: {\n prototype: SVGAnimatedLength;\n new(): SVGAnimatedLength;\n}\n\ninterface SVGAnimatedLengthList {\n readonly animVal: SVGLengthList;\n readonly baseVal: SVGLengthList;\n}\n\ndeclare var SVGAnimatedLengthList: {\n prototype: SVGAnimatedLengthList;\n new(): SVGAnimatedLengthList;\n}\n\ninterface SVGAnimatedNumber {\n readonly animVal: number;\n baseVal: number;\n}\n\ndeclare var SVGAnimatedNumber: {\n prototype: SVGAnimatedNumber;\n new(): SVGAnimatedNumber;\n}\n\ninterface SVGAnimatedNumberList {\n readonly animVal: SVGNumberList;\n readonly baseVal: SVGNumberList;\n}\n\ndeclare var SVGAnimatedNumberList: {\n prototype: SVGAnimatedNumberList;\n new(): SVGAnimatedNumberList;\n}\n\ninterface SVGAnimatedPreserveAspectRatio {\n readonly animVal: SVGPreserveAspectRatio;\n readonly baseVal: SVGPreserveAspectRatio;\n}\n\ndeclare var SVGAnimatedPreserveAspectRatio: {\n prototype: SVGAnimatedPreserveAspectRatio;\n new(): SVGAnimatedPreserveAspectRatio;\n}\n\ninterface SVGAnimatedRect {\n readonly animVal: SVGRect;\n readonly baseVal: SVGRect;\n}\n\ndeclare var SVGAnimatedRect: {\n prototype: SVGAnimatedRect;\n new(): SVGAnimatedRect;\n}\n\ninterface SVGAnimatedString {\n readonly animVal: string;\n baseVal: string;\n}\n\ndeclare var SVGAnimatedString: {\n prototype: SVGAnimatedString;\n new(): SVGAnimatedString;\n}\n\ninterface SVGAnimatedTransformList {\n readonly animVal: SVGTransformList;\n readonly baseVal: SVGTransformList;\n}\n\ndeclare var SVGAnimatedTransformList: {\n prototype: SVGAnimatedTransformList;\n new(): SVGAnimatedTransformList;\n}\n\ninterface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n readonly cx: SVGAnimatedLength;\n readonly cy: SVGAnimatedLength;\n readonly r: SVGAnimatedLength;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGCircleElement: {\n prototype: SVGCircleElement;\n new(): SVGCircleElement;\n}\n\ninterface SVGClipPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes {\n readonly clipPathUnits: SVGAnimatedEnumeration;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGClipPathElement: {\n prototype: SVGClipPathElement;\n new(): SVGClipPathElement;\n}\n\ninterface SVGComponentTransferFunctionElement extends SVGElement {\n readonly amplitude: SVGAnimatedNumber;\n readonly exponent: SVGAnimatedNumber;\n readonly intercept: SVGAnimatedNumber;\n readonly offset: SVGAnimatedNumber;\n readonly slope: SVGAnimatedNumber;\n readonly tableValues: SVGAnimatedNumberList;\n readonly type: SVGAnimatedEnumeration;\n readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number;\n readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number;\n readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number;\n readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number;\n readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number;\n readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGComponentTransferFunctionElement: {\n prototype: SVGComponentTransferFunctionElement;\n new(): SVGComponentTransferFunctionElement;\n readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number;\n readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number;\n readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number;\n readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number;\n readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number;\n readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number;\n}\n\ninterface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGDefsElement: {\n prototype: SVGDefsElement;\n new(): SVGDefsElement;\n}\n\ninterface SVGDescElement extends SVGElement, SVGStylable, SVGLangSpace {\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGDescElement: {\n prototype: SVGDescElement;\n new(): SVGDescElement;\n}\n\ninterface SVGElementEventMap extends ElementEventMap {\n \"click\": MouseEvent;\n \"dblclick\": MouseEvent;\n \"focusin\": FocusEvent;\n \"focusout\": FocusEvent;\n \"load\": Event;\n \"mousedown\": MouseEvent;\n \"mousemove\": MouseEvent;\n \"mouseout\": MouseEvent;\n \"mouseover\": MouseEvent;\n \"mouseup\": MouseEvent;\n}\n\ninterface SVGElement extends Element {\n onclick: (this: SVGElement, ev: MouseEvent) => any;\n ondblclick: (this: SVGElement, ev: MouseEvent) => any;\n onfocusin: (this: SVGElement, ev: FocusEvent) => any;\n onfocusout: (this: SVGElement, ev: FocusEvent) => any;\n onload: (this: SVGElement, ev: Event) => any;\n onmousedown: (this: SVGElement, ev: MouseEvent) => any;\n onmousemove: (this: SVGElement, ev: MouseEvent) => any;\n onmouseout: (this: SVGElement, ev: MouseEvent) => any;\n onmouseover: (this: SVGElement, ev: MouseEvent) => any;\n onmouseup: (this: SVGElement, ev: MouseEvent) => any;\n readonly ownerSVGElement: SVGSVGElement;\n readonly viewportElement: SVGElement;\n xmlbase: string;\n className: any;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGElement: {\n prototype: SVGElement;\n new(): SVGElement;\n}\n\ninterface SVGElementInstance extends EventTarget {\n readonly childNodes: SVGElementInstanceList;\n readonly correspondingElement: SVGElement;\n readonly correspondingUseElement: SVGUseElement;\n readonly firstChild: SVGElementInstance;\n readonly lastChild: SVGElementInstance;\n readonly nextSibling: SVGElementInstance;\n readonly parentNode: SVGElementInstance;\n readonly previousSibling: SVGElementInstance;\n}\n\ndeclare var SVGElementInstance: {\n prototype: SVGElementInstance;\n new(): SVGElementInstance;\n}\n\ninterface SVGElementInstanceList {\n readonly length: number;\n item(index: number): SVGElementInstance;\n}\n\ndeclare var SVGElementInstanceList: {\n prototype: SVGElementInstanceList;\n new(): SVGElementInstanceList;\n}\n\ninterface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n readonly cx: SVGAnimatedLength;\n readonly cy: SVGAnimatedLength;\n readonly rx: SVGAnimatedLength;\n readonly ry: SVGAnimatedLength;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGEllipseElement: {\n prototype: SVGEllipseElement;\n new(): SVGEllipseElement;\n}\n\ninterface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n readonly in1: SVGAnimatedString;\n readonly in2: SVGAnimatedString;\n readonly mode: SVGAnimatedEnumeration;\n readonly SVG_FEBLEND_MODE_COLOR: number;\n readonly SVG_FEBLEND_MODE_COLOR_BURN: number;\n readonly SVG_FEBLEND_MODE_COLOR_DODGE: number;\n readonly SVG_FEBLEND_MODE_DARKEN: number;\n readonly SVG_FEBLEND_MODE_DIFFERENCE: number;\n readonly SVG_FEBLEND_MODE_EXCLUSION: number;\n readonly SVG_FEBLEND_MODE_HARD_LIGHT: number;\n readonly SVG_FEBLEND_MODE_HUE: number;\n readonly SVG_FEBLEND_MODE_LIGHTEN: number;\n readonly SVG_FEBLEND_MODE_LUMINOSITY: number;\n readonly SVG_FEBLEND_MODE_MULTIPLY: number;\n readonly SVG_FEBLEND_MODE_NORMAL: number;\n readonly SVG_FEBLEND_MODE_OVERLAY: number;\n readonly SVG_FEBLEND_MODE_SATURATION: number;\n readonly SVG_FEBLEND_MODE_SCREEN: number;\n readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number;\n readonly SVG_FEBLEND_MODE_UNKNOWN: number;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEBlendElement: {\n prototype: SVGFEBlendElement;\n new(): SVGFEBlendElement;\n readonly SVG_FEBLEND_MODE_COLOR: number;\n readonly SVG_FEBLEND_MODE_COLOR_BURN: number;\n readonly SVG_FEBLEND_MODE_COLOR_DODGE: number;\n readonly SVG_FEBLEND_MODE_DARKEN: number;\n readonly SVG_FEBLEND_MODE_DIFFERENCE: number;\n readonly SVG_FEBLEND_MODE_EXCLUSION: number;\n readonly SVG_FEBLEND_MODE_HARD_LIGHT: number;\n readonly SVG_FEBLEND_MODE_HUE: number;\n readonly SVG_FEBLEND_MODE_LIGHTEN: number;\n readonly SVG_FEBLEND_MODE_LUMINOSITY: number;\n readonly SVG_FEBLEND_MODE_MULTIPLY: number;\n readonly SVG_FEBLEND_MODE_NORMAL: number;\n readonly SVG_FEBLEND_MODE_OVERLAY: number;\n readonly SVG_FEBLEND_MODE_SATURATION: number;\n readonly SVG_FEBLEND_MODE_SCREEN: number;\n readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number;\n readonly SVG_FEBLEND_MODE_UNKNOWN: number;\n}\n\ninterface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n readonly in1: SVGAnimatedString;\n readonly type: SVGAnimatedEnumeration;\n readonly values: SVGAnimatedNumberList;\n readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number;\n readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number;\n readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number;\n readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number;\n readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEColorMatrixElement: {\n prototype: SVGFEColorMatrixElement;\n new(): SVGFEColorMatrixElement;\n readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number;\n readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number;\n readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number;\n readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number;\n readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number;\n}\n\ninterface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n readonly in1: SVGAnimatedString;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEComponentTransferElement: {\n prototype: SVGFEComponentTransferElement;\n new(): SVGFEComponentTransferElement;\n}\n\ninterface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n readonly in1: SVGAnimatedString;\n readonly in2: SVGAnimatedString;\n readonly k1: SVGAnimatedNumber;\n readonly k2: SVGAnimatedNumber;\n readonly k3: SVGAnimatedNumber;\n readonly k4: SVGAnimatedNumber;\n readonly operator: SVGAnimatedEnumeration;\n readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number;\n readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number;\n readonly SVG_FECOMPOSITE_OPERATOR_IN: number;\n readonly SVG_FECOMPOSITE_OPERATOR_OUT: number;\n readonly SVG_FECOMPOSITE_OPERATOR_OVER: number;\n readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number;\n readonly SVG_FECOMPOSITE_OPERATOR_XOR: number;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFECompositeElement: {\n prototype: SVGFECompositeElement;\n new(): SVGFECompositeElement;\n readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number;\n readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number;\n readonly SVG_FECOMPOSITE_OPERATOR_IN: number;\n readonly SVG_FECOMPOSITE_OPERATOR_OUT: number;\n readonly SVG_FECOMPOSITE_OPERATOR_OVER: number;\n readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number;\n readonly SVG_FECOMPOSITE_OPERATOR_XOR: number;\n}\n\ninterface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n readonly bias: SVGAnimatedNumber;\n readonly divisor: SVGAnimatedNumber;\n readonly edgeMode: SVGAnimatedEnumeration;\n readonly in1: SVGAnimatedString;\n readonly kernelMatrix: SVGAnimatedNumberList;\n readonly kernelUnitLengthX: SVGAnimatedNumber;\n readonly kernelUnitLengthY: SVGAnimatedNumber;\n readonly orderX: SVGAnimatedInteger;\n readonly orderY: SVGAnimatedInteger;\n readonly preserveAlpha: SVGAnimatedBoolean;\n readonly targetX: SVGAnimatedInteger;\n readonly targetY: SVGAnimatedInteger;\n readonly SVG_EDGEMODE_DUPLICATE: number;\n readonly SVG_EDGEMODE_NONE: number;\n readonly SVG_EDGEMODE_UNKNOWN: number;\n readonly SVG_EDGEMODE_WRAP: number;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEConvolveMatrixElement: {\n prototype: SVGFEConvolveMatrixElement;\n new(): SVGFEConvolveMatrixElement;\n readonly SVG_EDGEMODE_DUPLICATE: number;\n readonly SVG_EDGEMODE_NONE: number;\n readonly SVG_EDGEMODE_UNKNOWN: number;\n readonly SVG_EDGEMODE_WRAP: number;\n}\n\ninterface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n readonly diffuseConstant: SVGAnimatedNumber;\n readonly in1: SVGAnimatedString;\n readonly kernelUnitLengthX: SVGAnimatedNumber;\n readonly kernelUnitLengthY: SVGAnimatedNumber;\n readonly surfaceScale: SVGAnimatedNumber;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEDiffuseLightingElement: {\n prototype: SVGFEDiffuseLightingElement;\n new(): SVGFEDiffuseLightingElement;\n}\n\ninterface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n readonly in1: SVGAnimatedString;\n readonly in2: SVGAnimatedString;\n readonly scale: SVGAnimatedNumber;\n readonly xChannelSelector: SVGAnimatedEnumeration;\n readonly yChannelSelector: SVGAnimatedEnumeration;\n readonly SVG_CHANNEL_A: number;\n readonly SVG_CHANNEL_B: number;\n readonly SVG_CHANNEL_G: number;\n readonly SVG_CHANNEL_R: number;\n readonly SVG_CHANNEL_UNKNOWN: number;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEDisplacementMapElement: {\n prototype: SVGFEDisplacementMapElement;\n new(): SVGFEDisplacementMapElement;\n readonly SVG_CHANNEL_A: number;\n readonly SVG_CHANNEL_B: number;\n readonly SVG_CHANNEL_G: number;\n readonly SVG_CHANNEL_R: number;\n readonly SVG_CHANNEL_UNKNOWN: number;\n}\n\ninterface SVGFEDistantLightElement extends SVGElement {\n readonly azimuth: SVGAnimatedNumber;\n readonly elevation: SVGAnimatedNumber;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEDistantLightElement: {\n prototype: SVGFEDistantLightElement;\n new(): SVGFEDistantLightElement;\n}\n\ninterface SVGFEFloodElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEFloodElement: {\n prototype: SVGFEFloodElement;\n new(): SVGFEFloodElement;\n}\n\ninterface SVGFEFuncAElement extends SVGComponentTransferFunctionElement {\n}\n\ndeclare var SVGFEFuncAElement: {\n prototype: SVGFEFuncAElement;\n new(): SVGFEFuncAElement;\n}\n\ninterface SVGFEFuncBElement extends SVGComponentTransferFunctionElement {\n}\n\ndeclare var SVGFEFuncBElement: {\n prototype: SVGFEFuncBElement;\n new(): SVGFEFuncBElement;\n}\n\ninterface SVGFEFuncGElement extends SVGComponentTransferFunctionElement {\n}\n\ndeclare var SVGFEFuncGElement: {\n prototype: SVGFEFuncGElement;\n new(): SVGFEFuncGElement;\n}\n\ninterface SVGFEFuncRElement extends SVGComponentTransferFunctionElement {\n}\n\ndeclare var SVGFEFuncRElement: {\n prototype: SVGFEFuncRElement;\n new(): SVGFEFuncRElement;\n}\n\ninterface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n readonly in1: SVGAnimatedString;\n readonly stdDeviationX: SVGAnimatedNumber;\n readonly stdDeviationY: SVGAnimatedNumber;\n setStdDeviation(stdDeviationX: number, stdDeviationY: number): void;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEGaussianBlurElement: {\n prototype: SVGFEGaussianBlurElement;\n new(): SVGFEGaussianBlurElement;\n}\n\ninterface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired {\n readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEImageElement: {\n prototype: SVGFEImageElement;\n new(): SVGFEImageElement;\n}\n\ninterface SVGFEMergeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEMergeElement: {\n prototype: SVGFEMergeElement;\n new(): SVGFEMergeElement;\n}\n\ninterface SVGFEMergeNodeElement extends SVGElement {\n readonly in1: SVGAnimatedString;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEMergeNodeElement: {\n prototype: SVGFEMergeNodeElement;\n new(): SVGFEMergeNodeElement;\n}\n\ninterface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n readonly in1: SVGAnimatedString;\n readonly operator: SVGAnimatedEnumeration;\n readonly radiusX: SVGAnimatedNumber;\n readonly radiusY: SVGAnimatedNumber;\n readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number;\n readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number;\n readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEMorphologyElement: {\n prototype: SVGFEMorphologyElement;\n new(): SVGFEMorphologyElement;\n readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number;\n readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number;\n readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number;\n}\n\ninterface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n readonly dx: SVGAnimatedNumber;\n readonly dy: SVGAnimatedNumber;\n readonly in1: SVGAnimatedString;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEOffsetElement: {\n prototype: SVGFEOffsetElement;\n new(): SVGFEOffsetElement;\n}\n\ninterface SVGFEPointLightElement extends SVGElement {\n readonly x: SVGAnimatedNumber;\n readonly y: SVGAnimatedNumber;\n readonly z: SVGAnimatedNumber;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEPointLightElement: {\n prototype: SVGFEPointLightElement;\n new(): SVGFEPointLightElement;\n}\n\ninterface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n readonly in1: SVGAnimatedString;\n readonly kernelUnitLengthX: SVGAnimatedNumber;\n readonly kernelUnitLengthY: SVGAnimatedNumber;\n readonly specularConstant: SVGAnimatedNumber;\n readonly specularExponent: SVGAnimatedNumber;\n readonly surfaceScale: SVGAnimatedNumber;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFESpecularLightingElement: {\n prototype: SVGFESpecularLightingElement;\n new(): SVGFESpecularLightingElement;\n}\n\ninterface SVGFESpotLightElement extends SVGElement {\n readonly limitingConeAngle: SVGAnimatedNumber;\n readonly pointsAtX: SVGAnimatedNumber;\n readonly pointsAtY: SVGAnimatedNumber;\n readonly pointsAtZ: SVGAnimatedNumber;\n readonly specularExponent: SVGAnimatedNumber;\n readonly x: SVGAnimatedNumber;\n readonly y: SVGAnimatedNumber;\n readonly z: SVGAnimatedNumber;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFESpotLightElement: {\n prototype: SVGFESpotLightElement;\n new(): SVGFESpotLightElement;\n}\n\ninterface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n readonly in1: SVGAnimatedString;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFETileElement: {\n prototype: SVGFETileElement;\n new(): SVGFETileElement;\n}\n\ninterface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n readonly baseFrequencyX: SVGAnimatedNumber;\n readonly baseFrequencyY: SVGAnimatedNumber;\n readonly numOctaves: SVGAnimatedInteger;\n readonly seed: SVGAnimatedNumber;\n readonly stitchTiles: SVGAnimatedEnumeration;\n readonly type: SVGAnimatedEnumeration;\n readonly SVG_STITCHTYPE_NOSTITCH: number;\n readonly SVG_STITCHTYPE_STITCH: number;\n readonly SVG_STITCHTYPE_UNKNOWN: number;\n readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number;\n readonly SVG_TURBULENCE_TYPE_TURBULENCE: number;\n readonly SVG_TURBULENCE_TYPE_UNKNOWN: number;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFETurbulenceElement: {\n prototype: SVGFETurbulenceElement;\n new(): SVGFETurbulenceElement;\n readonly SVG_STITCHTYPE_NOSTITCH: number;\n readonly SVG_STITCHTYPE_STITCH: number;\n readonly SVG_STITCHTYPE_UNKNOWN: number;\n readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number;\n readonly SVG_TURBULENCE_TYPE_TURBULENCE: number;\n readonly SVG_TURBULENCE_TYPE_UNKNOWN: number;\n}\n\ninterface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired {\n readonly filterResX: SVGAnimatedInteger;\n readonly filterResY: SVGAnimatedInteger;\n readonly filterUnits: SVGAnimatedEnumeration;\n readonly height: SVGAnimatedLength;\n readonly primitiveUnits: SVGAnimatedEnumeration;\n readonly width: SVGAnimatedLength;\n readonly x: SVGAnimatedLength;\n readonly y: SVGAnimatedLength;\n setFilterRes(filterResX: number, filterResY: number): void;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFilterElement: {\n prototype: SVGFilterElement;\n new(): SVGFilterElement;\n}\n\ninterface SVGForeignObjectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n readonly height: SVGAnimatedLength;\n readonly width: SVGAnimatedLength;\n readonly x: SVGAnimatedLength;\n readonly y: SVGAnimatedLength;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGForeignObjectElement: {\n prototype: SVGForeignObjectElement;\n new(): SVGForeignObjectElement;\n}\n\ninterface SVGGElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGGElement: {\n prototype: SVGGElement;\n new(): SVGGElement;\n}\n\ninterface SVGGradientElement extends SVGElement, SVGStylable, SVGExternalResourcesRequired, SVGURIReference, SVGUnitTypes {\n readonly gradientTransform: SVGAnimatedTransformList;\n readonly gradientUnits: SVGAnimatedEnumeration;\n readonly spreadMethod: SVGAnimatedEnumeration;\n readonly SVG_SPREADMETHOD_PAD: number;\n readonly SVG_SPREADMETHOD_REFLECT: number;\n readonly SVG_SPREADMETHOD_REPEAT: number;\n readonly SVG_SPREADMETHOD_UNKNOWN: number;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGGradientElement: {\n prototype: SVGGradientElement;\n new(): SVGGradientElement;\n readonly SVG_SPREADMETHOD_PAD: number;\n readonly SVG_SPREADMETHOD_REFLECT: number;\n readonly SVG_SPREADMETHOD_REPEAT: number;\n readonly SVG_SPREADMETHOD_UNKNOWN: number;\n}\n\ninterface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference {\n readonly height: SVGAnimatedLength;\n readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio;\n readonly width: SVGAnimatedLength;\n readonly x: SVGAnimatedLength;\n readonly y: SVGAnimatedLength;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGImageElement: {\n prototype: SVGImageElement;\n new(): SVGImageElement;\n}\n\ninterface SVGLength {\n readonly unitType: number;\n value: number;\n valueAsString: string;\n valueInSpecifiedUnits: number;\n convertToSpecifiedUnits(unitType: number): void;\n newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void;\n readonly SVG_LENGTHTYPE_CM: number;\n readonly SVG_LENGTHTYPE_EMS: number;\n readonly SVG_LENGTHTYPE_EXS: number;\n readonly SVG_LENGTHTYPE_IN: number;\n readonly SVG_LENGTHTYPE_MM: number;\n readonly SVG_LENGTHTYPE_NUMBER: number;\n readonly SVG_LENGTHTYPE_PC: number;\n readonly SVG_LENGTHTYPE_PERCENTAGE: number;\n readonly SVG_LENGTHTYPE_PT: number;\n readonly SVG_LENGTHTYPE_PX: number;\n readonly SVG_LENGTHTYPE_UNKNOWN: number;\n}\n\ndeclare var SVGLength: {\n prototype: SVGLength;\n new(): SVGLength;\n readonly SVG_LENGTHTYPE_CM: number;\n readonly SVG_LENGTHTYPE_EMS: number;\n readonly SVG_LENGTHTYPE_EXS: number;\n readonly SVG_LENGTHTYPE_IN: number;\n readonly SVG_LENGTHTYPE_MM: number;\n readonly SVG_LENGTHTYPE_NUMBER: number;\n readonly SVG_LENGTHTYPE_PC: number;\n readonly SVG_LENGTHTYPE_PERCENTAGE: number;\n readonly SVG_LENGTHTYPE_PT: number;\n readonly SVG_LENGTHTYPE_PX: number;\n readonly SVG_LENGTHTYPE_UNKNOWN: number;\n}\n\ninterface SVGLengthList {\n readonly numberOfItems: number;\n appendItem(newItem: SVGLength): SVGLength;\n clear(): void;\n getItem(index: number): SVGLength;\n initialize(newItem: SVGLength): SVGLength;\n insertItemBefore(newItem: SVGLength, index: number): SVGLength;\n removeItem(index: number): SVGLength;\n replaceItem(newItem: SVGLength, index: number): SVGLength;\n}\n\ndeclare var SVGLengthList: {\n prototype: SVGLengthList;\n new(): SVGLengthList;\n}\n\ninterface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n readonly x1: SVGAnimatedLength;\n readonly x2: SVGAnimatedLength;\n readonly y1: SVGAnimatedLength;\n readonly y2: SVGAnimatedLength;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGLineElement: {\n prototype: SVGLineElement;\n new(): SVGLineElement;\n}\n\ninterface SVGLinearGradientElement extends SVGGradientElement {\n readonly x1: SVGAnimatedLength;\n readonly x2: SVGAnimatedLength;\n readonly y1: SVGAnimatedLength;\n readonly y2: SVGAnimatedLength;\n}\n\ndeclare var SVGLinearGradientElement: {\n prototype: SVGLinearGradientElement;\n new(): SVGLinearGradientElement;\n}\n\ninterface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox {\n readonly markerHeight: SVGAnimatedLength;\n readonly markerUnits: SVGAnimatedEnumeration;\n readonly markerWidth: SVGAnimatedLength;\n readonly orientAngle: SVGAnimatedAngle;\n readonly orientType: SVGAnimatedEnumeration;\n readonly refX: SVGAnimatedLength;\n readonly refY: SVGAnimatedLength;\n setOrientToAngle(angle: SVGAngle): void;\n setOrientToAuto(): void;\n readonly SVG_MARKERUNITS_STROKEWIDTH: number;\n readonly SVG_MARKERUNITS_UNKNOWN: number;\n readonly SVG_MARKERUNITS_USERSPACEONUSE: number;\n readonly SVG_MARKER_ORIENT_ANGLE: number;\n readonly SVG_MARKER_ORIENT_AUTO: number;\n readonly SVG_MARKER_ORIENT_UNKNOWN: number;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGMarkerElement: {\n prototype: SVGMarkerElement;\n new(): SVGMarkerElement;\n readonly SVG_MARKERUNITS_STROKEWIDTH: number;\n readonly SVG_MARKERUNITS_UNKNOWN: number;\n readonly SVG_MARKERUNITS_USERSPACEONUSE: number;\n readonly SVG_MARKER_ORIENT_ANGLE: number;\n readonly SVG_MARKER_ORIENT_AUTO: number;\n readonly SVG_MARKER_ORIENT_UNKNOWN: number;\n}\n\ninterface SVGMaskElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes {\n readonly height: SVGAnimatedLength;\n readonly maskContentUnits: SVGAnimatedEnumeration;\n readonly maskUnits: SVGAnimatedEnumeration;\n readonly width: SVGAnimatedLength;\n readonly x: SVGAnimatedLength;\n readonly y: SVGAnimatedLength;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGMaskElement: {\n prototype: SVGMaskElement;\n new(): SVGMaskElement;\n}\n\ninterface SVGMatrix {\n a: number;\n b: number;\n c: number;\n d: number;\n e: number;\n f: number;\n flipX(): SVGMatrix;\n flipY(): SVGMatrix;\n inverse(): SVGMatrix;\n multiply(secondMatrix: SVGMatrix): SVGMatrix;\n rotate(angle: number): SVGMatrix;\n rotateFromVector(x: number, y: number): SVGMatrix;\n scale(scaleFactor: number): SVGMatrix;\n scaleNonUniform(scaleFactorX: number, scaleFactorY: number): SVGMatrix;\n skewX(angle: number): SVGMatrix;\n skewY(angle: number): SVGMatrix;\n translate(x: number, y: number): SVGMatrix;\n}\n\ndeclare var SVGMatrix: {\n prototype: SVGMatrix;\n new(): SVGMatrix;\n}\n\ninterface SVGMetadataElement extends SVGElement {\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGMetadataElement: {\n prototype: SVGMetadataElement;\n new(): SVGMetadataElement;\n}\n\ninterface SVGNumber {\n value: number;\n}\n\ndeclare var SVGNumber: {\n prototype: SVGNumber;\n new(): SVGNumber;\n}\n\ninterface SVGNumberList {\n readonly numberOfItems: number;\n appendItem(newItem: SVGNumber): SVGNumber;\n clear(): void;\n getItem(index: number): SVGNumber;\n initialize(newItem: SVGNumber): SVGNumber;\n insertItemBefore(newItem: SVGNumber, index: number): SVGNumber;\n removeItem(index: number): SVGNumber;\n replaceItem(newItem: SVGNumber, index: number): SVGNumber;\n}\n\ndeclare var SVGNumberList: {\n prototype: SVGNumberList;\n new(): SVGNumberList;\n}\n\ninterface SVGPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPathData {\n createSVGPathSegArcAbs(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcAbs;\n createSVGPathSegArcRel(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcRel;\n createSVGPathSegClosePath(): SVGPathSegClosePath;\n createSVGPathSegCurvetoCubicAbs(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicAbs;\n createSVGPathSegCurvetoCubicRel(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicRel;\n createSVGPathSegCurvetoCubicSmoothAbs(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothAbs;\n createSVGPathSegCurvetoCubicSmoothRel(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothRel;\n createSVGPathSegCurvetoQuadraticAbs(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticAbs;\n createSVGPathSegCurvetoQuadraticRel(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticRel;\n createSVGPathSegCurvetoQuadraticSmoothAbs(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothAbs;\n createSVGPathSegCurvetoQuadraticSmoothRel(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothRel;\n createSVGPathSegLinetoAbs(x: number, y: number): SVGPathSegLinetoAbs;\n createSVGPathSegLinetoHorizontalAbs(x: number): SVGPathSegLinetoHorizontalAbs;\n createSVGPathSegLinetoHorizontalRel(x: number): SVGPathSegLinetoHorizontalRel;\n createSVGPathSegLinetoRel(x: number, y: number): SVGPathSegLinetoRel;\n createSVGPathSegLinetoVerticalAbs(y: number): SVGPathSegLinetoVerticalAbs;\n createSVGPathSegLinetoVerticalRel(y: number): SVGPathSegLinetoVerticalRel;\n createSVGPathSegMovetoAbs(x: number, y: number): SVGPathSegMovetoAbs;\n createSVGPathSegMovetoRel(x: number, y: number): SVGPathSegMovetoRel;\n getPathSegAtLength(distance: number): number;\n getPointAtLength(distance: number): SVGPoint;\n getTotalLength(): number;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGPathElement: {\n prototype: SVGPathElement;\n new(): SVGPathElement;\n}\n\ninterface SVGPathSeg {\n readonly pathSegType: number;\n readonly pathSegTypeAsLetter: string;\n readonly PATHSEG_ARC_ABS: number;\n readonly PATHSEG_ARC_REL: number;\n readonly PATHSEG_CLOSEPATH: number;\n readonly PATHSEG_CURVETO_CUBIC_ABS: number;\n readonly PATHSEG_CURVETO_CUBIC_REL: number;\n readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number;\n readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number;\n readonly PATHSEG_CURVETO_QUADRATIC_ABS: number;\n readonly PATHSEG_CURVETO_QUADRATIC_REL: number;\n readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number;\n readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number;\n readonly PATHSEG_LINETO_ABS: number;\n readonly PATHSEG_LINETO_HORIZONTAL_ABS: number;\n readonly PATHSEG_LINETO_HORIZONTAL_REL: number;\n readonly PATHSEG_LINETO_REL: number;\n readonly PATHSEG_LINETO_VERTICAL_ABS: number;\n readonly PATHSEG_LINETO_VERTICAL_REL: number;\n readonly PATHSEG_MOVETO_ABS: number;\n readonly PATHSEG_MOVETO_REL: number;\n readonly PATHSEG_UNKNOWN: number;\n}\n\ndeclare var SVGPathSeg: {\n prototype: SVGPathSeg;\n new(): SVGPathSeg;\n readonly PATHSEG_ARC_ABS: number;\n readonly PATHSEG_ARC_REL: number;\n readonly PATHSEG_CLOSEPATH: number;\n readonly PATHSEG_CURVETO_CUBIC_ABS: number;\n readonly PATHSEG_CURVETO_CUBIC_REL: number;\n readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number;\n readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number;\n readonly PATHSEG_CURVETO_QUADRATIC_ABS: number;\n readonly PATHSEG_CURVETO_QUADRATIC_REL: number;\n readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number;\n readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number;\n readonly PATHSEG_LINETO_ABS: number;\n readonly PATHSEG_LINETO_HORIZONTAL_ABS: number;\n readonly PATHSEG_LINETO_HORIZONTAL_REL: number;\n readonly PATHSEG_LINETO_REL: number;\n readonly PATHSEG_LINETO_VERTICAL_ABS: number;\n readonly PATHSEG_LINETO_VERTICAL_REL: number;\n readonly PATHSEG_MOVETO_ABS: number;\n readonly PATHSEG_MOVETO_REL: number;\n readonly PATHSEG_UNKNOWN: number;\n}\n\ninterface SVGPathSegArcAbs extends SVGPathSeg {\n angle: number;\n largeArcFlag: boolean;\n r1: number;\n r2: number;\n sweepFlag: boolean;\n x: number;\n y: number;\n}\n\ndeclare var SVGPathSegArcAbs: {\n prototype: SVGPathSegArcAbs;\n new(): SVGPathSegArcAbs;\n}\n\ninterface SVGPathSegArcRel extends SVGPathSeg {\n angle: number;\n largeArcFlag: boolean;\n r1: number;\n r2: number;\n sweepFlag: boolean;\n x: number;\n y: number;\n}\n\ndeclare var SVGPathSegArcRel: {\n prototype: SVGPathSegArcRel;\n new(): SVGPathSegArcRel;\n}\n\ninterface SVGPathSegClosePath extends SVGPathSeg {\n}\n\ndeclare var SVGPathSegClosePath: {\n prototype: SVGPathSegClosePath;\n new(): SVGPathSegClosePath;\n}\n\ninterface SVGPathSegCurvetoCubicAbs extends SVGPathSeg {\n x: number;\n x1: number;\n x2: number;\n y: number;\n y1: number;\n y2: number;\n}\n\ndeclare var SVGPathSegCurvetoCubicAbs: {\n prototype: SVGPathSegCurvetoCubicAbs;\n new(): SVGPathSegCurvetoCubicAbs;\n}\n\ninterface SVGPathSegCurvetoCubicRel extends SVGPathSeg {\n x: number;\n x1: number;\n x2: number;\n y: number;\n y1: number;\n y2: number;\n}\n\ndeclare var SVGPathSegCurvetoCubicRel: {\n prototype: SVGPathSegCurvetoCubicRel;\n new(): SVGPathSegCurvetoCubicRel;\n}\n\ninterface SVGPathSegCurvetoCubicSmoothAbs extends SVGPathSeg {\n x: number;\n x2: number;\n y: number;\n y2: number;\n}\n\ndeclare var SVGPathSegCurvetoCubicSmoothAbs: {\n prototype: SVGPathSegCurvetoCubicSmoothAbs;\n new(): SVGPathSegCurvetoCubicSmoothAbs;\n}\n\ninterface SVGPathSegCurvetoCubicSmoothRel extends SVGPathSeg {\n x: number;\n x2: number;\n y: number;\n y2: number;\n}\n\ndeclare var SVGPathSegCurvetoCubicSmoothRel: {\n prototype: SVGPathSegCurvetoCubicSmoothRel;\n new(): SVGPathSegCurvetoCubicSmoothRel;\n}\n\ninterface SVGPathSegCurvetoQuadraticAbs extends SVGPathSeg {\n x: number;\n x1: number;\n y: number;\n y1: number;\n}\n\ndeclare var SVGPathSegCurvetoQuadraticAbs: {\n prototype: SVGPathSegCurvetoQuadraticAbs;\n new(): SVGPathSegCurvetoQuadraticAbs;\n}\n\ninterface SVGPathSegCurvetoQuadraticRel extends SVGPathSeg {\n x: number;\n x1: number;\n y: number;\n y1: number;\n}\n\ndeclare var SVGPathSegCurvetoQuadraticRel: {\n prototype: SVGPathSegCurvetoQuadraticRel;\n new(): SVGPathSegCurvetoQuadraticRel;\n}\n\ninterface SVGPathSegCurvetoQuadraticSmoothAbs extends SVGPathSeg {\n x: number;\n y: number;\n}\n\ndeclare var SVGPathSegCurvetoQuadraticSmoothAbs: {\n prototype: SVGPathSegCurvetoQuadraticSmoothAbs;\n new(): SVGPathSegCurvetoQuadraticSmoothAbs;\n}\n\ninterface SVGPathSegCurvetoQuadraticSmoothRel extends SVGPathSeg {\n x: number;\n y: number;\n}\n\ndeclare var SVGPathSegCurvetoQuadraticSmoothRel: {\n prototype: SVGPathSegCurvetoQuadraticSmoothRel;\n new(): SVGPathSegCurvetoQuadraticSmoothRel;\n}\n\ninterface SVGPathSegLinetoAbs extends SVGPathSeg {\n x: number;\n y: number;\n}\n\ndeclare var SVGPathSegLinetoAbs: {\n prototype: SVGPathSegLinetoAbs;\n new(): SVGPathSegLinetoAbs;\n}\n\ninterface SVGPathSegLinetoHorizontalAbs extends SVGPathSeg {\n x: number;\n}\n\ndeclare var SVGPathSegLinetoHorizontalAbs: {\n prototype: SVGPathSegLinetoHorizontalAbs;\n new(): SVGPathSegLinetoHorizontalAbs;\n}\n\ninterface SVGPathSegLinetoHorizontalRel extends SVGPathSeg {\n x: number;\n}\n\ndeclare var SVGPathSegLinetoHorizontalRel: {\n prototype: SVGPathSegLinetoHorizontalRel;\n new(): SVGPathSegLinetoHorizontalRel;\n}\n\ninterface SVGPathSegLinetoRel extends SVGPathSeg {\n x: number;\n y: number;\n}\n\ndeclare var SVGPathSegLinetoRel: {\n prototype: SVGPathSegLinetoRel;\n new(): SVGPathSegLinetoRel;\n}\n\ninterface SVGPathSegLinetoVerticalAbs extends SVGPathSeg {\n y: number;\n}\n\ndeclare var SVGPathSegLinetoVerticalAbs: {\n prototype: SVGPathSegLinetoVerticalAbs;\n new(): SVGPathSegLinetoVerticalAbs;\n}\n\ninterface SVGPathSegLinetoVerticalRel extends SVGPathSeg {\n y: number;\n}\n\ndeclare var SVGPathSegLinetoVerticalRel: {\n prototype: SVGPathSegLinetoVerticalRel;\n new(): SVGPathSegLinetoVerticalRel;\n}\n\ninterface SVGPathSegList {\n readonly numberOfItems: number;\n appendItem(newItem: SVGPathSeg): SVGPathSeg;\n clear(): void;\n getItem(index: number): SVGPathSeg;\n initialize(newItem: SVGPathSeg): SVGPathSeg;\n insertItemBefore(newItem: SVGPathSeg, index: number): SVGPathSeg;\n removeItem(index: number): SVGPathSeg;\n replaceItem(newItem: SVGPathSeg, index: number): SVGPathSeg;\n}\n\ndeclare var SVGPathSegList: {\n prototype: SVGPathSegList;\n new(): SVGPathSegList;\n}\n\ninterface SVGPathSegMovetoAbs extends SVGPathSeg {\n x: number;\n y: number;\n}\n\ndeclare var SVGPathSegMovetoAbs: {\n prototype: SVGPathSegMovetoAbs;\n new(): SVGPathSegMovetoAbs;\n}\n\ninterface SVGPathSegMovetoRel extends SVGPathSeg {\n x: number;\n y: number;\n}\n\ndeclare var SVGPathSegMovetoRel: {\n prototype: SVGPathSegMovetoRel;\n new(): SVGPathSegMovetoRel;\n}\n\ninterface SVGPatternElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGURIReference, SVGUnitTypes {\n readonly height: SVGAnimatedLength;\n readonly patternContentUnits: SVGAnimatedEnumeration;\n readonly patternTransform: SVGAnimatedTransformList;\n readonly patternUnits: SVGAnimatedEnumeration;\n readonly width: SVGAnimatedLength;\n readonly x: SVGAnimatedLength;\n readonly y: SVGAnimatedLength;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGPatternElement: {\n prototype: SVGPatternElement;\n new(): SVGPatternElement;\n}\n\ninterface SVGPoint {\n x: number;\n y: number;\n matrixTransform(matrix: SVGMatrix): SVGPoint;\n}\n\ndeclare var SVGPoint: {\n prototype: SVGPoint;\n new(): SVGPoint;\n}\n\ninterface SVGPointList {\n readonly numberOfItems: number;\n appendItem(newItem: SVGPoint): SVGPoint;\n clear(): void;\n getItem(index: number): SVGPoint;\n initialize(newItem: SVGPoint): SVGPoint;\n insertItemBefore(newItem: SVGPoint, index: number): SVGPoint;\n removeItem(index: number): SVGPoint;\n replaceItem(newItem: SVGPoint, index: number): SVGPoint;\n}\n\ndeclare var SVGPointList: {\n prototype: SVGPointList;\n new(): SVGPointList;\n}\n\ninterface SVGPolygonElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints {\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGPolygonElement: {\n prototype: SVGPolygonElement;\n new(): SVGPolygonElement;\n}\n\ninterface SVGPolylineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints {\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGPolylineElement: {\n prototype: SVGPolylineElement;\n new(): SVGPolylineElement;\n}\n\ninterface SVGPreserveAspectRatio {\n align: number;\n meetOrSlice: number;\n readonly SVG_MEETORSLICE_MEET: number;\n readonly SVG_MEETORSLICE_SLICE: number;\n readonly SVG_MEETORSLICE_UNKNOWN: number;\n readonly SVG_PRESERVEASPECTRATIO_NONE: number;\n readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number;\n readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number;\n readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number;\n readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number;\n readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number;\n readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number;\n readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number;\n readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number;\n readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number;\n readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number;\n}\n\ndeclare var SVGPreserveAspectRatio: {\n prototype: SVGPreserveAspectRatio;\n new(): SVGPreserveAspectRatio;\n readonly SVG_MEETORSLICE_MEET: number;\n readonly SVG_MEETORSLICE_SLICE: number;\n readonly SVG_MEETORSLICE_UNKNOWN: number;\n readonly SVG_PRESERVEASPECTRATIO_NONE: number;\n readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number;\n readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number;\n readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number;\n readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number;\n readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number;\n readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number;\n readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number;\n readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number;\n readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number;\n readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number;\n}\n\ninterface SVGRadialGradientElement extends SVGGradientElement {\n readonly cx: SVGAnimatedLength;\n readonly cy: SVGAnimatedLength;\n readonly fx: SVGAnimatedLength;\n readonly fy: SVGAnimatedLength;\n readonly r: SVGAnimatedLength;\n}\n\ndeclare var SVGRadialGradientElement: {\n prototype: SVGRadialGradientElement;\n new(): SVGRadialGradientElement;\n}\n\ninterface SVGRect {\n height: number;\n width: number;\n x: number;\n y: number;\n}\n\ndeclare var SVGRect: {\n prototype: SVGRect;\n new(): SVGRect;\n}\n\ninterface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n readonly height: SVGAnimatedLength;\n readonly rx: SVGAnimatedLength;\n readonly ry: SVGAnimatedLength;\n readonly width: SVGAnimatedLength;\n readonly x: SVGAnimatedLength;\n readonly y: SVGAnimatedLength;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGRectElement: {\n prototype: SVGRectElement;\n new(): SVGRectElement;\n}\n\ninterface SVGSVGElementEventMap extends SVGElementEventMap {\n \"SVGAbort\": Event;\n \"SVGError\": Event;\n \"resize\": UIEvent;\n \"scroll\": UIEvent;\n \"SVGUnload\": Event;\n \"SVGZoom\": SVGZoomEvent;\n}\n\ninterface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTests, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan {\n contentScriptType: string;\n contentStyleType: string;\n currentScale: number;\n readonly currentTranslate: SVGPoint;\n readonly height: SVGAnimatedLength;\n onabort: (this: SVGSVGElement, ev: Event) => any;\n onerror: (this: SVGSVGElement, ev: Event) => any;\n onresize: (this: SVGSVGElement, ev: UIEvent) => any;\n onscroll: (this: SVGSVGElement, ev: UIEvent) => any;\n onunload: (this: SVGSVGElement, ev: Event) => any;\n onzoom: (this: SVGSVGElement, ev: SVGZoomEvent) => any;\n readonly pixelUnitToMillimeterX: number;\n readonly pixelUnitToMillimeterY: number;\n readonly screenPixelToMillimeterX: number;\n readonly screenPixelToMillimeterY: number;\n readonly viewport: SVGRect;\n readonly width: SVGAnimatedLength;\n readonly x: SVGAnimatedLength;\n readonly y: SVGAnimatedLength;\n checkEnclosure(element: SVGElement, rect: SVGRect): boolean;\n checkIntersection(element: SVGElement, rect: SVGRect): boolean;\n createSVGAngle(): SVGAngle;\n createSVGLength(): SVGLength;\n createSVGMatrix(): SVGMatrix;\n createSVGNumber(): SVGNumber;\n createSVGPoint(): SVGPoint;\n createSVGRect(): SVGRect;\n createSVGTransform(): SVGTransform;\n createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform;\n deselectAll(): void;\n forceRedraw(): void;\n getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration;\n getCurrentTime(): number;\n getElementById(elementId: string): Element;\n getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeListOf;\n getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeListOf;\n pauseAnimations(): void;\n setCurrentTime(seconds: number): void;\n suspendRedraw(maxWaitMilliseconds: number): number;\n unpauseAnimations(): void;\n unsuspendRedraw(suspendHandleID: number): void;\n unsuspendRedrawAll(): void;\n addEventListener(type: K, listener: (this: SVGSVGElement, ev: SVGSVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGSVGElement: {\n prototype: SVGSVGElement;\n new(): SVGSVGElement;\n}\n\ninterface SVGScriptElement extends SVGElement, SVGExternalResourcesRequired, SVGURIReference {\n type: string;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGScriptElement: {\n prototype: SVGScriptElement;\n new(): SVGScriptElement;\n}\n\ninterface SVGStopElement extends SVGElement, SVGStylable {\n readonly offset: SVGAnimatedNumber;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGStopElement: {\n prototype: SVGStopElement;\n new(): SVGStopElement;\n}\n\ninterface SVGStringList {\n readonly numberOfItems: number;\n appendItem(newItem: string): string;\n clear(): void;\n getItem(index: number): string;\n initialize(newItem: string): string;\n insertItemBefore(newItem: string, index: number): string;\n removeItem(index: number): string;\n replaceItem(newItem: string, index: number): string;\n}\n\ndeclare var SVGStringList: {\n prototype: SVGStringList;\n new(): SVGStringList;\n}\n\ninterface SVGStyleElement extends SVGElement, SVGLangSpace {\n disabled: boolean;\n media: string;\n title: string;\n type: string;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGStyleElement: {\n prototype: SVGStyleElement;\n new(): SVGStyleElement;\n}\n\ninterface SVGSwitchElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGSwitchElement: {\n prototype: SVGSwitchElement;\n new(): SVGSwitchElement;\n}\n\ninterface SVGSymbolElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox {\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGSymbolElement: {\n prototype: SVGSymbolElement;\n new(): SVGSymbolElement;\n}\n\ninterface SVGTSpanElement extends SVGTextPositioningElement {\n}\n\ndeclare var SVGTSpanElement: {\n prototype: SVGTSpanElement;\n new(): SVGTSpanElement;\n}\n\ninterface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n readonly lengthAdjust: SVGAnimatedEnumeration;\n readonly textLength: SVGAnimatedLength;\n getCharNumAtPosition(point: SVGPoint): number;\n getComputedTextLength(): number;\n getEndPositionOfChar(charnum: number): SVGPoint;\n getExtentOfChar(charnum: number): SVGRect;\n getNumberOfChars(): number;\n getRotationOfChar(charnum: number): number;\n getStartPositionOfChar(charnum: number): SVGPoint;\n getSubStringLength(charnum: number, nchars: number): number;\n selectSubString(charnum: number, nchars: number): void;\n readonly LENGTHADJUST_SPACING: number;\n readonly LENGTHADJUST_SPACINGANDGLYPHS: number;\n readonly LENGTHADJUST_UNKNOWN: number;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGTextContentElement: {\n prototype: SVGTextContentElement;\n new(): SVGTextContentElement;\n readonly LENGTHADJUST_SPACING: number;\n readonly LENGTHADJUST_SPACINGANDGLYPHS: number;\n readonly LENGTHADJUST_UNKNOWN: number;\n}\n\ninterface SVGTextElement extends SVGTextPositioningElement, SVGTransformable {\n}\n\ndeclare var SVGTextElement: {\n prototype: SVGTextElement;\n new(): SVGTextElement;\n}\n\ninterface SVGTextPathElement extends SVGTextContentElement, SVGURIReference {\n readonly method: SVGAnimatedEnumeration;\n readonly spacing: SVGAnimatedEnumeration;\n readonly startOffset: SVGAnimatedLength;\n readonly TEXTPATH_METHODTYPE_ALIGN: number;\n readonly TEXTPATH_METHODTYPE_STRETCH: number;\n readonly TEXTPATH_METHODTYPE_UNKNOWN: number;\n readonly TEXTPATH_SPACINGTYPE_AUTO: number;\n readonly TEXTPATH_SPACINGTYPE_EXACT: number;\n readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number;\n}\n\ndeclare var SVGTextPathElement: {\n prototype: SVGTextPathElement;\n new(): SVGTextPathElement;\n readonly TEXTPATH_METHODTYPE_ALIGN: number;\n readonly TEXTPATH_METHODTYPE_STRETCH: number;\n readonly TEXTPATH_METHODTYPE_UNKNOWN: number;\n readonly TEXTPATH_SPACINGTYPE_AUTO: number;\n readonly TEXTPATH_SPACINGTYPE_EXACT: number;\n readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number;\n}\n\ninterface SVGTextPositioningElement extends SVGTextContentElement {\n readonly dx: SVGAnimatedLengthList;\n readonly dy: SVGAnimatedLengthList;\n readonly rotate: SVGAnimatedNumberList;\n readonly x: SVGAnimatedLengthList;\n readonly y: SVGAnimatedLengthList;\n}\n\ndeclare var SVGTextPositioningElement: {\n prototype: SVGTextPositioningElement;\n new(): SVGTextPositioningElement;\n}\n\ninterface SVGTitleElement extends SVGElement, SVGStylable, SVGLangSpace {\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGTitleElement: {\n prototype: SVGTitleElement;\n new(): SVGTitleElement;\n}\n\ninterface SVGTransform {\n readonly angle: number;\n readonly matrix: SVGMatrix;\n readonly type: number;\n setMatrix(matrix: SVGMatrix): void;\n setRotate(angle: number, cx: number, cy: number): void;\n setScale(sx: number, sy: number): void;\n setSkewX(angle: number): void;\n setSkewY(angle: number): void;\n setTranslate(tx: number, ty: number): void;\n readonly SVG_TRANSFORM_MATRIX: number;\n readonly SVG_TRANSFORM_ROTATE: number;\n readonly SVG_TRANSFORM_SCALE: number;\n readonly SVG_TRANSFORM_SKEWX: number;\n readonly SVG_TRANSFORM_SKEWY: number;\n readonly SVG_TRANSFORM_TRANSLATE: number;\n readonly SVG_TRANSFORM_UNKNOWN: number;\n}\n\ndeclare var SVGTransform: {\n prototype: SVGTransform;\n new(): SVGTransform;\n readonly SVG_TRANSFORM_MATRIX: number;\n readonly SVG_TRANSFORM_ROTATE: number;\n readonly SVG_TRANSFORM_SCALE: number;\n readonly SVG_TRANSFORM_SKEWX: number;\n readonly SVG_TRANSFORM_SKEWY: number;\n readonly SVG_TRANSFORM_TRANSLATE: number;\n readonly SVG_TRANSFORM_UNKNOWN: number;\n}\n\ninterface SVGTransformList {\n readonly numberOfItems: number;\n appendItem(newItem: SVGTransform): SVGTransform;\n clear(): void;\n consolidate(): SVGTransform;\n createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform;\n getItem(index: number): SVGTransform;\n initialize(newItem: SVGTransform): SVGTransform;\n insertItemBefore(newItem: SVGTransform, index: number): SVGTransform;\n removeItem(index: number): SVGTransform;\n replaceItem(newItem: SVGTransform, index: number): SVGTransform;\n}\n\ndeclare var SVGTransformList: {\n prototype: SVGTransformList;\n new(): SVGTransformList;\n}\n\ninterface SVGUnitTypes {\n readonly SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number;\n readonly SVG_UNIT_TYPE_UNKNOWN: number;\n readonly SVG_UNIT_TYPE_USERSPACEONUSE: number;\n}\ndeclare var SVGUnitTypes: SVGUnitTypes;\n\ninterface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference {\n readonly animatedInstanceRoot: SVGElementInstance;\n readonly height: SVGAnimatedLength;\n readonly instanceRoot: SVGElementInstance;\n readonly width: SVGAnimatedLength;\n readonly x: SVGAnimatedLength;\n readonly y: SVGAnimatedLength;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGUseElement: {\n prototype: SVGUseElement;\n new(): SVGUseElement;\n}\n\ninterface SVGViewElement extends SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan {\n readonly viewTarget: SVGStringList;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGViewElement: {\n prototype: SVGViewElement;\n new(): SVGViewElement;\n}\n\ninterface SVGZoomAndPan {\n readonly zoomAndPan: number;\n}\n\ndeclare var SVGZoomAndPan: {\n readonly SVG_ZOOMANDPAN_DISABLE: number;\n readonly SVG_ZOOMANDPAN_MAGNIFY: number;\n readonly SVG_ZOOMANDPAN_UNKNOWN: number;\n}\n\ninterface SVGZoomEvent extends UIEvent {\n readonly newScale: number;\n readonly newTranslate: SVGPoint;\n readonly previousScale: number;\n readonly previousTranslate: SVGPoint;\n readonly zoomRectScreen: SVGRect;\n}\n\ndeclare var SVGZoomEvent: {\n prototype: SVGZoomEvent;\n new(): SVGZoomEvent;\n}\n\ninterface ScreenEventMap {\n \"MSOrientationChange\": Event;\n}\n\ninterface Screen extends EventTarget {\n readonly availHeight: number;\n readonly availWidth: number;\n bufferDepth: number;\n readonly colorDepth: number;\n readonly deviceXDPI: number;\n readonly deviceYDPI: number;\n readonly fontSmoothingEnabled: boolean;\n readonly height: number;\n readonly logicalXDPI: number;\n readonly logicalYDPI: number;\n readonly msOrientation: string;\n onmsorientationchange: (this: Screen, ev: Event) => any;\n readonly pixelDepth: number;\n readonly systemXDPI: number;\n readonly systemYDPI: number;\n readonly width: number;\n msLockOrientation(orientations: string | string[]): boolean;\n msUnlockOrientation(): void;\n addEventListener(type: K, listener: (this: Screen, ev: ScreenEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var Screen: {\n prototype: Screen;\n new(): Screen;\n}\n\ninterface ScriptNotifyEvent extends Event {\n readonly callingUri: string;\n readonly value: string;\n}\n\ndeclare var ScriptNotifyEvent: {\n prototype: ScriptNotifyEvent;\n new(): ScriptNotifyEvent;\n}\n\ninterface ScriptProcessorNodeEventMap {\n \"audioprocess\": AudioProcessingEvent;\n}\n\ninterface ScriptProcessorNode extends AudioNode {\n readonly bufferSize: number;\n onaudioprocess: (this: ScriptProcessorNode, ev: AudioProcessingEvent) => any;\n addEventListener(type: K, listener: (this: ScriptProcessorNode, ev: ScriptProcessorNodeEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var ScriptProcessorNode: {\n prototype: ScriptProcessorNode;\n new(): ScriptProcessorNode;\n}\n\ninterface Selection {\n readonly anchorNode: Node;\n readonly anchorOffset: number;\n readonly focusNode: Node;\n readonly focusOffset: number;\n readonly isCollapsed: boolean;\n readonly rangeCount: number;\n readonly type: string;\n addRange(range: Range): void;\n collapse(parentNode: Node, offset: number): void;\n collapseToEnd(): void;\n collapseToStart(): void;\n containsNode(node: Node, partlyContained: boolean): boolean;\n deleteFromDocument(): void;\n empty(): void;\n extend(newNode: Node, offset: number): void;\n getRangeAt(index: number): Range;\n removeAllRanges(): void;\n removeRange(range: Range): void;\n selectAllChildren(parentNode: Node): void;\n setBaseAndExtent(baseNode: Node, baseOffset: number, extentNode: Node, extentOffset: number): void;\n toString(): string;\n}\n\ndeclare var Selection: {\n prototype: Selection;\n new(): Selection;\n}\n\ninterface SourceBuffer extends EventTarget {\n appendWindowEnd: number;\n appendWindowStart: number;\n readonly audioTracks: AudioTrackList;\n readonly buffered: TimeRanges;\n mode: string;\n timestampOffset: number;\n readonly updating: boolean;\n readonly videoTracks: VideoTrackList;\n abort(): void;\n appendBuffer(data: ArrayBuffer | ArrayBufferView): void;\n appendStream(stream: MSStream, maxSize?: number): void;\n remove(start: number, end: number): void;\n}\n\ndeclare var SourceBuffer: {\n prototype: SourceBuffer;\n new(): SourceBuffer;\n}\n\ninterface SourceBufferList extends EventTarget {\n readonly length: number;\n item(index: number): SourceBuffer;\n [index: number]: SourceBuffer;\n}\n\ndeclare var SourceBufferList: {\n prototype: SourceBufferList;\n new(): SourceBufferList;\n}\n\ninterface StereoPannerNode extends AudioNode {\n readonly pan: AudioParam;\n}\n\ndeclare var StereoPannerNode: {\n prototype: StereoPannerNode;\n new(): StereoPannerNode;\n}\n\ninterface Storage {\n readonly length: number;\n clear(): void;\n getItem(key: string): string | null;\n key(index: number): string | null;\n removeItem(key: string): void;\n setItem(key: string, data: string): void;\n [key: string]: any;\n [index: number]: string;\n}\n\ndeclare var Storage: {\n prototype: Storage;\n new(): Storage;\n}\n\ninterface StorageEvent extends Event {\n readonly url: string;\n key?: string;\n oldValue?: string;\n newValue?: string;\n storageArea?: Storage;\n}\n\ndeclare var StorageEvent: {\n prototype: StorageEvent;\n new (type: string, eventInitDict?: StorageEventInit): StorageEvent;\n}\n\ninterface StyleMedia {\n readonly type: string;\n matchMedium(mediaquery: string): boolean;\n}\n\ndeclare var StyleMedia: {\n prototype: StyleMedia;\n new(): StyleMedia;\n}\n\ninterface StyleSheet {\n disabled: boolean;\n readonly href: string;\n readonly media: MediaList;\n readonly ownerNode: Node;\n readonly parentStyleSheet: StyleSheet;\n readonly title: string;\n readonly type: string;\n}\n\ndeclare var StyleSheet: {\n prototype: StyleSheet;\n new(): StyleSheet;\n}\n\ninterface StyleSheetList {\n readonly length: number;\n item(index?: number): StyleSheet;\n [index: number]: StyleSheet;\n}\n\ndeclare var StyleSheetList: {\n prototype: StyleSheetList;\n new(): StyleSheetList;\n}\n\ninterface StyleSheetPageList {\n readonly length: number;\n item(index: number): CSSPageRule;\n [index: number]: CSSPageRule;\n}\n\ndeclare var StyleSheetPageList: {\n prototype: StyleSheetPageList;\n new(): StyleSheetPageList;\n}\n\ninterface SubtleCrypto {\n decrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike;\n deriveBits(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, length: number): PromiseLike;\n deriveKey(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: string | AesDerivedKeyParams | HmacImportParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike;\n digest(algorithm: AlgorithmIdentifier, data: BufferSource): PromiseLike;\n encrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike;\n exportKey(format: \"jwk\", key: CryptoKey): PromiseLike;\n exportKey(format: \"raw\" | \"pkcs8\" | \"spki\", key: CryptoKey): PromiseLike;\n exportKey(format: string, key: CryptoKey): PromiseLike;\n generateKey(algorithm: string, extractable: boolean, keyUsages: string[]): PromiseLike;\n generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams | DhKeyGenParams, extractable: boolean, keyUsages: string[]): PromiseLike;\n generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike;\n importKey(format: \"jwk\", keyData: JsonWebKey, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike;\n importKey(format: \"raw\" | \"pkcs8\" | \"spki\", keyData: BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike;\n importKey(format: string, keyData: JsonWebKey | BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike;\n sign(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, data: BufferSource): PromiseLike;\n unwrapKey(format: string, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier, unwrappedKeyAlgorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: string[]): PromiseLike;\n verify(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, signature: BufferSource, data: BufferSource): PromiseLike;\n wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier): PromiseLike;\n}\n\ndeclare var SubtleCrypto: {\n prototype: SubtleCrypto;\n new(): SubtleCrypto;\n}\n\ninterface Text extends CharacterData {\n readonly wholeText: string;\n readonly assignedSlot: HTMLSlotElement | null;\n splitText(offset: number): Text;\n}\n\ndeclare var Text: {\n prototype: Text;\n new(): Text;\n}\n\ninterface TextEvent extends UIEvent {\n readonly data: string;\n readonly inputMethod: number;\n readonly locale: string;\n initTextEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, inputMethod: number, locale: string): void;\n readonly DOM_INPUT_METHOD_DROP: number;\n readonly DOM_INPUT_METHOD_HANDWRITING: number;\n readonly DOM_INPUT_METHOD_IME: number;\n readonly DOM_INPUT_METHOD_KEYBOARD: number;\n readonly DOM_INPUT_METHOD_MULTIMODAL: number;\n readonly DOM_INPUT_METHOD_OPTION: number;\n readonly DOM_INPUT_METHOD_PASTE: number;\n readonly DOM_INPUT_METHOD_SCRIPT: number;\n readonly DOM_INPUT_METHOD_UNKNOWN: number;\n readonly DOM_INPUT_METHOD_VOICE: number;\n}\n\ndeclare var TextEvent: {\n prototype: TextEvent;\n new(): TextEvent;\n readonly DOM_INPUT_METHOD_DROP: number;\n readonly DOM_INPUT_METHOD_HANDWRITING: number;\n readonly DOM_INPUT_METHOD_IME: number;\n readonly DOM_INPUT_METHOD_KEYBOARD: number;\n readonly DOM_INPUT_METHOD_MULTIMODAL: number;\n readonly DOM_INPUT_METHOD_OPTION: number;\n readonly DOM_INPUT_METHOD_PASTE: number;\n readonly DOM_INPUT_METHOD_SCRIPT: number;\n readonly DOM_INPUT_METHOD_UNKNOWN: number;\n readonly DOM_INPUT_METHOD_VOICE: number;\n}\n\ninterface TextMetrics {\n readonly width: number;\n}\n\ndeclare var TextMetrics: {\n prototype: TextMetrics;\n new(): TextMetrics;\n}\n\ninterface TextTrackEventMap {\n \"cuechange\": Event;\n \"error\": ErrorEvent;\n \"load\": Event;\n}\n\ninterface TextTrack extends EventTarget {\n readonly activeCues: TextTrackCueList;\n readonly cues: TextTrackCueList;\n readonly inBandMetadataTrackDispatchType: string;\n readonly kind: string;\n readonly label: string;\n readonly language: string;\n mode: any;\n oncuechange: (this: TextTrack, ev: Event) => any;\n onerror: (this: TextTrack, ev: ErrorEvent) => any;\n onload: (this: TextTrack, ev: Event) => any;\n readonly readyState: number;\n addCue(cue: TextTrackCue): void;\n removeCue(cue: TextTrackCue): void;\n readonly DISABLED: number;\n readonly ERROR: number;\n readonly HIDDEN: number;\n readonly LOADED: number;\n readonly LOADING: number;\n readonly NONE: number;\n readonly SHOWING: number;\n addEventListener(type: K, listener: (this: TextTrack, ev: TextTrackEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var TextTrack: {\n prototype: TextTrack;\n new(): TextTrack;\n readonly DISABLED: number;\n readonly ERROR: number;\n readonly HIDDEN: number;\n readonly LOADED: number;\n readonly LOADING: number;\n readonly NONE: number;\n readonly SHOWING: number;\n}\n\ninterface TextTrackCueEventMap {\n \"enter\": Event;\n \"exit\": Event;\n}\n\ninterface TextTrackCue extends EventTarget {\n endTime: number;\n id: string;\n onenter: (this: TextTrackCue, ev: Event) => any;\n onexit: (this: TextTrackCue, ev: Event) => any;\n pauseOnExit: boolean;\n startTime: number;\n text: string;\n readonly track: TextTrack;\n getCueAsHTML(): DocumentFragment;\n addEventListener(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var TextTrackCue: {\n prototype: TextTrackCue;\n new(startTime: number, endTime: number, text: string): TextTrackCue;\n}\n\ninterface TextTrackCueList {\n readonly length: number;\n getCueById(id: string): TextTrackCue;\n item(index: number): TextTrackCue;\n [index: number]: TextTrackCue;\n}\n\ndeclare var TextTrackCueList: {\n prototype: TextTrackCueList;\n new(): TextTrackCueList;\n}\n\ninterface TextTrackListEventMap {\n \"addtrack\": TrackEvent;\n}\n\ninterface TextTrackList extends EventTarget {\n readonly length: number;\n onaddtrack: ((this: TextTrackList, ev: TrackEvent) => any) | null;\n item(index: number): TextTrack;\n addEventListener(type: K, listener: (this: TextTrackList, ev: TextTrackListEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n [index: number]: TextTrack;\n}\n\ndeclare var TextTrackList: {\n prototype: TextTrackList;\n new(): TextTrackList;\n}\n\ninterface TimeRanges {\n readonly length: number;\n end(index: number): number;\n start(index: number): number;\n}\n\ndeclare var TimeRanges: {\n prototype: TimeRanges;\n new(): TimeRanges;\n}\n\ninterface Touch {\n readonly clientX: number;\n readonly clientY: number;\n readonly identifier: number;\n readonly pageX: number;\n readonly pageY: number;\n readonly screenX: number;\n readonly screenY: number;\n readonly target: EventTarget;\n}\n\ndeclare var Touch: {\n prototype: Touch;\n new(): Touch;\n}\n\ninterface TouchEvent extends UIEvent {\n readonly altKey: boolean;\n readonly changedTouches: TouchList;\n readonly ctrlKey: boolean;\n readonly metaKey: boolean;\n readonly shiftKey: boolean;\n readonly targetTouches: TouchList;\n readonly touches: TouchList;\n}\n\ndeclare var TouchEvent: {\n prototype: TouchEvent;\n new(): TouchEvent;\n}\n\ninterface TouchList {\n readonly length: number;\n item(index: number): Touch | null;\n [index: number]: Touch;\n}\n\ndeclare var TouchList: {\n prototype: TouchList;\n new(): TouchList;\n}\n\ninterface TrackEvent extends Event {\n readonly track: any;\n}\n\ndeclare var TrackEvent: {\n prototype: TrackEvent;\n new(): TrackEvent;\n}\n\ninterface TransitionEvent extends Event {\n readonly elapsedTime: number;\n readonly propertyName: string;\n initTransitionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, propertyNameArg: string, elapsedTimeArg: number): void;\n}\n\ndeclare var TransitionEvent: {\n prototype: TransitionEvent;\n new(): TransitionEvent;\n}\n\ninterface TreeWalker {\n currentNode: Node;\n readonly expandEntityReferences: boolean;\n readonly filter: NodeFilter;\n readonly root: Node;\n readonly whatToShow: number;\n firstChild(): Node;\n lastChild(): Node;\n nextNode(): Node;\n nextSibling(): Node;\n parentNode(): Node;\n previousNode(): Node;\n previousSibling(): Node;\n}\n\ndeclare var TreeWalker: {\n prototype: TreeWalker;\n new(): TreeWalker;\n}\n\ninterface UIEvent extends Event {\n readonly detail: number;\n readonly view: Window;\n initUIEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number): void;\n}\n\ndeclare var UIEvent: {\n prototype: UIEvent;\n new(type: string, eventInitDict?: UIEventInit): UIEvent;\n}\n\ninterface URL {\n hash: string;\n host: string;\n hostname: string;\n href: string;\n readonly origin: string;\n password: string;\n pathname: string;\n port: string;\n protocol: string;\n search: string;\n username: string;\n toString(): string;\n}\n\ndeclare var URL: {\n prototype: URL;\n new(url: string, base?: string): URL;\n createObjectURL(object: any, options?: ObjectURLOptions): string;\n revokeObjectURL(url: string): void;\n}\n\ninterface UnviewableContentIdentifiedEvent extends NavigationEventWithReferrer {\n readonly mediaType: string;\n}\n\ndeclare var UnviewableContentIdentifiedEvent: {\n prototype: UnviewableContentIdentifiedEvent;\n new(): UnviewableContentIdentifiedEvent;\n}\n\ninterface ValidityState {\n readonly badInput: boolean;\n readonly customError: boolean;\n readonly patternMismatch: boolean;\n readonly rangeOverflow: boolean;\n readonly rangeUnderflow: boolean;\n readonly stepMismatch: boolean;\n readonly tooLong: boolean;\n readonly typeMismatch: boolean;\n readonly valid: boolean;\n readonly valueMissing: boolean;\n}\n\ndeclare var ValidityState: {\n prototype: ValidityState;\n new(): ValidityState;\n}\n\ninterface VideoPlaybackQuality {\n readonly corruptedVideoFrames: number;\n readonly creationTime: number;\n readonly droppedVideoFrames: number;\n readonly totalFrameDelay: number;\n readonly totalVideoFrames: number;\n}\n\ndeclare var VideoPlaybackQuality: {\n prototype: VideoPlaybackQuality;\n new(): VideoPlaybackQuality;\n}\n\ninterface VideoTrack {\n readonly id: string;\n kind: string;\n readonly label: string;\n language: string;\n selected: boolean;\n readonly sourceBuffer: SourceBuffer;\n}\n\ndeclare var VideoTrack: {\n prototype: VideoTrack;\n new(): VideoTrack;\n}\n\ninterface VideoTrackListEventMap {\n \"addtrack\": TrackEvent;\n \"change\": Event;\n \"removetrack\": TrackEvent;\n}\n\ninterface VideoTrackList extends EventTarget {\n readonly length: number;\n onaddtrack: (this: VideoTrackList, ev: TrackEvent) => any;\n onchange: (this: VideoTrackList, ev: Event) => any;\n onremovetrack: (this: VideoTrackList, ev: TrackEvent) => any;\n readonly selectedIndex: number;\n getTrackById(id: string): VideoTrack | null;\n item(index: number): VideoTrack;\n addEventListener(type: K, listener: (this: VideoTrackList, ev: VideoTrackListEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n [index: number]: VideoTrack;\n}\n\ndeclare var VideoTrackList: {\n prototype: VideoTrackList;\n new(): VideoTrackList;\n}\n\ninterface WEBGL_compressed_texture_s3tc {\n readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number;\n readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number;\n readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number;\n readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number;\n}\n\ndeclare var WEBGL_compressed_texture_s3tc: {\n prototype: WEBGL_compressed_texture_s3tc;\n new(): WEBGL_compressed_texture_s3tc;\n readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number;\n readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number;\n readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number;\n readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number;\n}\n\ninterface WEBGL_debug_renderer_info {\n readonly UNMASKED_RENDERER_WEBGL: number;\n readonly UNMASKED_VENDOR_WEBGL: number;\n}\n\ndeclare var WEBGL_debug_renderer_info: {\n prototype: WEBGL_debug_renderer_info;\n new(): WEBGL_debug_renderer_info;\n readonly UNMASKED_RENDERER_WEBGL: number;\n readonly UNMASKED_VENDOR_WEBGL: number;\n}\n\ninterface WEBGL_depth_texture {\n readonly UNSIGNED_INT_24_8_WEBGL: number;\n}\n\ndeclare var WEBGL_depth_texture: {\n prototype: WEBGL_depth_texture;\n new(): WEBGL_depth_texture;\n readonly UNSIGNED_INT_24_8_WEBGL: number;\n}\n\ninterface WaveShaperNode extends AudioNode {\n curve: Float32Array | null;\n oversample: string;\n}\n\ndeclare var WaveShaperNode: {\n prototype: WaveShaperNode;\n new(): WaveShaperNode;\n}\n\ninterface WebGLActiveInfo {\n readonly name: string;\n readonly size: number;\n readonly type: number;\n}\n\ndeclare var WebGLActiveInfo: {\n prototype: WebGLActiveInfo;\n new(): WebGLActiveInfo;\n}\n\ninterface WebGLBuffer extends WebGLObject {\n}\n\ndeclare var WebGLBuffer: {\n prototype: WebGLBuffer;\n new(): WebGLBuffer;\n}\n\ninterface WebGLContextEvent extends Event {\n readonly statusMessage: string;\n}\n\ndeclare var WebGLContextEvent: {\n prototype: WebGLContextEvent;\n new(type: string, eventInitDict?: WebGLContextEventInit): WebGLContextEvent;\n}\n\ninterface WebGLFramebuffer extends WebGLObject {\n}\n\ndeclare var WebGLFramebuffer: {\n prototype: WebGLFramebuffer;\n new(): WebGLFramebuffer;\n}\n\ninterface WebGLObject {\n}\n\ndeclare var WebGLObject: {\n prototype: WebGLObject;\n new(): WebGLObject;\n}\n\ninterface WebGLProgram extends WebGLObject {\n}\n\ndeclare var WebGLProgram: {\n prototype: WebGLProgram;\n new(): WebGLProgram;\n}\n\ninterface WebGLRenderbuffer extends WebGLObject {\n}\n\ndeclare var WebGLRenderbuffer: {\n prototype: WebGLRenderbuffer;\n new(): WebGLRenderbuffer;\n}\n\ninterface WebGLRenderingContext {\n readonly canvas: HTMLCanvasElement;\n readonly drawingBufferHeight: number;\n readonly drawingBufferWidth: number;\n activeTexture(texture: number): void;\n attachShader(program: WebGLProgram | null, shader: WebGLShader | null): void;\n bindAttribLocation(program: WebGLProgram | null, index: number, name: string): void;\n bindBuffer(target: number, buffer: WebGLBuffer | null): void;\n bindFramebuffer(target: number, framebuffer: WebGLFramebuffer | null): void;\n bindRenderbuffer(target: number, renderbuffer: WebGLRenderbuffer | null): void;\n bindTexture(target: number, texture: WebGLTexture | null): void;\n blendColor(red: number, green: number, blue: number, alpha: number): void;\n blendEquation(mode: number): void;\n blendEquationSeparate(modeRGB: number, modeAlpha: number): void;\n blendFunc(sfactor: number, dfactor: number): void;\n blendFuncSeparate(srcRGB: number, dstRGB: number, srcAlpha: number, dstAlpha: number): void;\n bufferData(target: number, size: number | ArrayBufferView | ArrayBuffer, usage: number): void;\n bufferSubData(target: number, offset: number, data: ArrayBufferView | ArrayBuffer): void;\n checkFramebufferStatus(target: number): number;\n clear(mask: number): void;\n clearColor(red: number, green: number, blue: number, alpha: number): void;\n clearDepth(depth: number): void;\n clearStencil(s: number): void;\n colorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void;\n compileShader(shader: WebGLShader | null): void;\n compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: ArrayBufferView): void;\n compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: ArrayBufferView): void;\n copyTexImage2D(target: number, level: number, internalformat: number, x: number, y: number, width: number, height: number, border: number): void;\n copyTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, x: number, y: number, width: number, height: number): void;\n createBuffer(): WebGLBuffer | null;\n createFramebuffer(): WebGLFramebuffer | null;\n createProgram(): WebGLProgram | null;\n createRenderbuffer(): WebGLRenderbuffer | null;\n createShader(type: number): WebGLShader | null;\n createTexture(): WebGLTexture | null;\n cullFace(mode: number): void;\n deleteBuffer(buffer: WebGLBuffer | null): void;\n deleteFramebuffer(framebuffer: WebGLFramebuffer | null): void;\n deleteProgram(program: WebGLProgram | null): void;\n deleteRenderbuffer(renderbuffer: WebGLRenderbuffer | null): void;\n deleteShader(shader: WebGLShader | null): void;\n deleteTexture(texture: WebGLTexture | null): void;\n depthFunc(func: number): void;\n depthMask(flag: boolean): void;\n depthRange(zNear: number, zFar: number): void;\n detachShader(program: WebGLProgram | null, shader: WebGLShader | null): void;\n disable(cap: number): void;\n disableVertexAttribArray(index: number): void;\n drawArrays(mode: number, first: number, count: number): void;\n drawElements(mode: number, count: number, type: number, offset: number): void;\n enable(cap: number): void;\n enableVertexAttribArray(index: number): void;\n finish(): void;\n flush(): void;\n framebufferRenderbuffer(target: number, attachment: number, renderbuffertarget: number, renderbuffer: WebGLRenderbuffer | null): void;\n framebufferTexture2D(target: number, attachment: number, textarget: number, texture: WebGLTexture | null, level: number): void;\n frontFace(mode: number): void;\n generateMipmap(target: number): void;\n getActiveAttrib(program: WebGLProgram | null, index: number): WebGLActiveInfo | null;\n getActiveUniform(program: WebGLProgram | null, index: number): WebGLActiveInfo | null;\n getAttachedShaders(program: WebGLProgram | null): WebGLShader[] | null;\n getAttribLocation(program: WebGLProgram | null, name: string): number;\n getBufferParameter(target: number, pname: number): any;\n getContextAttributes(): WebGLContextAttributes;\n getError(): number;\n getExtension(name: string): any;\n getFramebufferAttachmentParameter(target: number, attachment: number, pname: number): any;\n getParameter(pname: number): any;\n getProgramInfoLog(program: WebGLProgram | null): string | null;\n getProgramParameter(program: WebGLProgram | null, pname: number): any;\n getRenderbufferParameter(target: number, pname: number): any;\n getShaderInfoLog(shader: WebGLShader | null): string | null;\n getShaderParameter(shader: WebGLShader | null, pname: number): any;\n getShaderPrecisionFormat(shadertype: number, precisiontype: number): WebGLShaderPrecisionFormat | null;\n getShaderSource(shader: WebGLShader | null): string | null;\n getSupportedExtensions(): string[] | null;\n getTexParameter(target: number, pname: number): any;\n getUniform(program: WebGLProgram | null, location: WebGLUniformLocation | null): any;\n getUniformLocation(program: WebGLProgram | null, name: string): WebGLUniformLocation | null;\n getVertexAttrib(index: number, pname: number): any;\n getVertexAttribOffset(index: number, pname: number): number;\n hint(target: number, mode: number): void;\n isBuffer(buffer: WebGLBuffer | null): boolean;\n isContextLost(): boolean;\n isEnabled(cap: number): boolean;\n isFramebuffer(framebuffer: WebGLFramebuffer | null): boolean;\n isProgram(program: WebGLProgram | null): boolean;\n isRenderbuffer(renderbuffer: WebGLRenderbuffer | null): boolean;\n isShader(shader: WebGLShader | null): boolean;\n isTexture(texture: WebGLTexture | null): boolean;\n lineWidth(width: number): void;\n linkProgram(program: WebGLProgram | null): void;\n pixelStorei(pname: number, param: number): void;\n polygonOffset(factor: number, units: number): void;\n readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void;\n renderbufferStorage(target: number, internalformat: number, width: number, height: number): void;\n sampleCoverage(value: number, invert: boolean): void;\n scissor(x: number, y: number, width: number, height: number): void;\n shaderSource(shader: WebGLShader | null, source: string): void;\n stencilFunc(func: number, ref: number, mask: number): void;\n stencilFuncSeparate(face: number, func: number, ref: number, mask: number): void;\n stencilMask(mask: number): void;\n stencilMaskSeparate(face: number, mask: number): void;\n stencilOp(fail: number, zfail: number, zpass: number): void;\n stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void;\n texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels?: ArrayBufferView): void;\n texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void;\n texParameterf(target: number, pname: number, param: number): void;\n texParameteri(target: number, pname: number, param: number): void;\n texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels?: ArrayBufferView): void;\n texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void;\n uniform1f(location: WebGLUniformLocation | null, x: number): void;\n uniform1fv(location: WebGLUniformLocation, v: Float32Array | number[]): void;\n uniform1i(location: WebGLUniformLocation | null, x: number): void;\n uniform1iv(location: WebGLUniformLocation, v: Int32Array | number[]): void;\n uniform2f(location: WebGLUniformLocation | null, x: number, y: number): void;\n uniform2fv(location: WebGLUniformLocation, v: Float32Array | number[]): void;\n uniform2i(location: WebGLUniformLocation | null, x: number, y: number): void;\n uniform2iv(location: WebGLUniformLocation, v: Int32Array | number[]): void;\n uniform3f(location: WebGLUniformLocation | null, x: number, y: number, z: number): void;\n uniform3fv(location: WebGLUniformLocation, v: Float32Array | number[]): void;\n uniform3i(location: WebGLUniformLocation | null, x: number, y: number, z: number): void;\n uniform3iv(location: WebGLUniformLocation, v: Int32Array | number[]): void;\n uniform4f(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void;\n uniform4fv(location: WebGLUniformLocation, v: Float32Array | number[]): void;\n uniform4i(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void;\n uniform4iv(location: WebGLUniformLocation, v: Int32Array | number[]): void;\n uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void;\n uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void;\n uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void;\n useProgram(program: WebGLProgram | null): void;\n validateProgram(program: WebGLProgram | null): void;\n vertexAttrib1f(indx: number, x: number): void;\n vertexAttrib1fv(indx: number, values: Float32Array | number[]): void;\n vertexAttrib2f(indx: number, x: number, y: number): void;\n vertexAttrib2fv(indx: number, values: Float32Array | number[]): void;\n vertexAttrib3f(indx: number, x: number, y: number, z: number): void;\n vertexAttrib3fv(indx: number, values: Float32Array | number[]): void;\n vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void;\n vertexAttrib4fv(indx: number, values: Float32Array | number[]): void;\n vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void;\n viewport(x: number, y: number, width: number, height: number): void;\n readonly ACTIVE_ATTRIBUTES: number;\n readonly ACTIVE_TEXTURE: number;\n readonly ACTIVE_UNIFORMS: number;\n readonly ALIASED_LINE_WIDTH_RANGE: number;\n readonly ALIASED_POINT_SIZE_RANGE: number;\n readonly ALPHA: number;\n readonly ALPHA_BITS: number;\n readonly ALWAYS: number;\n readonly ARRAY_BUFFER: number;\n readonly ARRAY_BUFFER_BINDING: number;\n readonly ATTACHED_SHADERS: number;\n readonly BACK: number;\n readonly BLEND: number;\n readonly BLEND_COLOR: number;\n readonly BLEND_DST_ALPHA: number;\n readonly BLEND_DST_RGB: number;\n readonly BLEND_EQUATION: number;\n readonly BLEND_EQUATION_ALPHA: number;\n readonly BLEND_EQUATION_RGB: number;\n readonly BLEND_SRC_ALPHA: number;\n readonly BLEND_SRC_RGB: number;\n readonly BLUE_BITS: number;\n readonly BOOL: number;\n readonly BOOL_VEC2: number;\n readonly BOOL_VEC3: number;\n readonly BOOL_VEC4: number;\n readonly BROWSER_DEFAULT_WEBGL: number;\n readonly BUFFER_SIZE: number;\n readonly BUFFER_USAGE: number;\n readonly BYTE: number;\n readonly CCW: number;\n readonly CLAMP_TO_EDGE: number;\n readonly COLOR_ATTACHMENT0: number;\n readonly COLOR_BUFFER_BIT: number;\n readonly COLOR_CLEAR_VALUE: number;\n readonly COLOR_WRITEMASK: number;\n readonly COMPILE_STATUS: number;\n readonly COMPRESSED_TEXTURE_FORMATS: number;\n readonly CONSTANT_ALPHA: number;\n readonly CONSTANT_COLOR: number;\n readonly CONTEXT_LOST_WEBGL: number;\n readonly CULL_FACE: number;\n readonly CULL_FACE_MODE: number;\n readonly CURRENT_PROGRAM: number;\n readonly CURRENT_VERTEX_ATTRIB: number;\n readonly CW: number;\n readonly DECR: number;\n readonly DECR_WRAP: number;\n readonly DELETE_STATUS: number;\n readonly DEPTH_ATTACHMENT: number;\n readonly DEPTH_BITS: number;\n readonly DEPTH_BUFFER_BIT: number;\n readonly DEPTH_CLEAR_VALUE: number;\n readonly DEPTH_COMPONENT: number;\n readonly DEPTH_COMPONENT16: number;\n readonly DEPTH_FUNC: number;\n readonly DEPTH_RANGE: number;\n readonly DEPTH_STENCIL: number;\n readonly DEPTH_STENCIL_ATTACHMENT: number;\n readonly DEPTH_TEST: number;\n readonly DEPTH_WRITEMASK: number;\n readonly DITHER: number;\n readonly DONT_CARE: number;\n readonly DST_ALPHA: number;\n readonly DST_COLOR: number;\n readonly DYNAMIC_DRAW: number;\n readonly ELEMENT_ARRAY_BUFFER: number;\n readonly ELEMENT_ARRAY_BUFFER_BINDING: number;\n readonly EQUAL: number;\n readonly FASTEST: number;\n readonly FLOAT: number;\n readonly FLOAT_MAT2: number;\n readonly FLOAT_MAT3: number;\n readonly FLOAT_MAT4: number;\n readonly FLOAT_VEC2: number;\n readonly FLOAT_VEC3: number;\n readonly FLOAT_VEC4: number;\n readonly FRAGMENT_SHADER: number;\n readonly FRAMEBUFFER: number;\n readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number;\n readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number;\n readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number;\n readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number;\n readonly FRAMEBUFFER_BINDING: number;\n readonly FRAMEBUFFER_COMPLETE: number;\n readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number;\n readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number;\n readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number;\n readonly FRAMEBUFFER_UNSUPPORTED: number;\n readonly FRONT: number;\n readonly FRONT_AND_BACK: number;\n readonly FRONT_FACE: number;\n readonly FUNC_ADD: number;\n readonly FUNC_REVERSE_SUBTRACT: number;\n readonly FUNC_SUBTRACT: number;\n readonly GENERATE_MIPMAP_HINT: number;\n readonly GEQUAL: number;\n readonly GREATER: number;\n readonly GREEN_BITS: number;\n readonly HIGH_FLOAT: number;\n readonly HIGH_INT: number;\n readonly IMPLEMENTATION_COLOR_READ_FORMAT: number;\n readonly IMPLEMENTATION_COLOR_READ_TYPE: number;\n readonly INCR: number;\n readonly INCR_WRAP: number;\n readonly INT: number;\n readonly INT_VEC2: number;\n readonly INT_VEC3: number;\n readonly INT_VEC4: number;\n readonly INVALID_ENUM: number;\n readonly INVALID_FRAMEBUFFER_OPERATION: number;\n readonly INVALID_OPERATION: number;\n readonly INVALID_VALUE: number;\n readonly INVERT: number;\n readonly KEEP: number;\n readonly LEQUAL: number;\n readonly LESS: number;\n readonly LINEAR: number;\n readonly LINEAR_MIPMAP_LINEAR: number;\n readonly LINEAR_MIPMAP_NEAREST: number;\n readonly LINES: number;\n readonly LINE_LOOP: number;\n readonly LINE_STRIP: number;\n readonly LINE_WIDTH: number;\n readonly LINK_STATUS: number;\n readonly LOW_FLOAT: number;\n readonly LOW_INT: number;\n readonly LUMINANCE: number;\n readonly LUMINANCE_ALPHA: number;\n readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number;\n readonly MAX_CUBE_MAP_TEXTURE_SIZE: number;\n readonly MAX_FRAGMENT_UNIFORM_VECTORS: number;\n readonly MAX_RENDERBUFFER_SIZE: number;\n readonly MAX_TEXTURE_IMAGE_UNITS: number;\n readonly MAX_TEXTURE_SIZE: number;\n readonly MAX_VARYING_VECTORS: number;\n readonly MAX_VERTEX_ATTRIBS: number;\n readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number;\n readonly MAX_VERTEX_UNIFORM_VECTORS: number;\n readonly MAX_VIEWPORT_DIMS: number;\n readonly MEDIUM_FLOAT: number;\n readonly MEDIUM_INT: number;\n readonly MIRRORED_REPEAT: number;\n readonly NEAREST: number;\n readonly NEAREST_MIPMAP_LINEAR: number;\n readonly NEAREST_MIPMAP_NEAREST: number;\n readonly NEVER: number;\n readonly NICEST: number;\n readonly NONE: number;\n readonly NOTEQUAL: number;\n readonly NO_ERROR: number;\n readonly ONE: number;\n readonly ONE_MINUS_CONSTANT_ALPHA: number;\n readonly ONE_MINUS_CONSTANT_COLOR: number;\n readonly ONE_MINUS_DST_ALPHA: number;\n readonly ONE_MINUS_DST_COLOR: number;\n readonly ONE_MINUS_SRC_ALPHA: number;\n readonly ONE_MINUS_SRC_COLOR: number;\n readonly OUT_OF_MEMORY: number;\n readonly PACK_ALIGNMENT: number;\n readonly POINTS: number;\n readonly POLYGON_OFFSET_FACTOR: number;\n readonly POLYGON_OFFSET_FILL: number;\n readonly POLYGON_OFFSET_UNITS: number;\n readonly RED_BITS: number;\n readonly RENDERBUFFER: number;\n readonly RENDERBUFFER_ALPHA_SIZE: number;\n readonly RENDERBUFFER_BINDING: number;\n readonly RENDERBUFFER_BLUE_SIZE: number;\n readonly RENDERBUFFER_DEPTH_SIZE: number;\n readonly RENDERBUFFER_GREEN_SIZE: number;\n readonly RENDERBUFFER_HEIGHT: number;\n readonly RENDERBUFFER_INTERNAL_FORMAT: number;\n readonly RENDERBUFFER_RED_SIZE: number;\n readonly RENDERBUFFER_STENCIL_SIZE: number;\n readonly RENDERBUFFER_WIDTH: number;\n readonly RENDERER: number;\n readonly REPEAT: number;\n readonly REPLACE: number;\n readonly RGB: number;\n readonly RGB565: number;\n readonly RGB5_A1: number;\n readonly RGBA: number;\n readonly RGBA4: number;\n readonly SAMPLER_2D: number;\n readonly SAMPLER_CUBE: number;\n readonly SAMPLES: number;\n readonly SAMPLE_ALPHA_TO_COVERAGE: number;\n readonly SAMPLE_BUFFERS: number;\n readonly SAMPLE_COVERAGE: number;\n readonly SAMPLE_COVERAGE_INVERT: number;\n readonly SAMPLE_COVERAGE_VALUE: number;\n readonly SCISSOR_BOX: number;\n readonly SCISSOR_TEST: number;\n readonly SHADER_TYPE: number;\n readonly SHADING_LANGUAGE_VERSION: number;\n readonly SHORT: number;\n readonly SRC_ALPHA: number;\n readonly SRC_ALPHA_SATURATE: number;\n readonly SRC_COLOR: number;\n readonly STATIC_DRAW: number;\n readonly STENCIL_ATTACHMENT: number;\n readonly STENCIL_BACK_FAIL: number;\n readonly STENCIL_BACK_FUNC: number;\n readonly STENCIL_BACK_PASS_DEPTH_FAIL: number;\n readonly STENCIL_BACK_PASS_DEPTH_PASS: number;\n readonly STENCIL_BACK_REF: number;\n readonly STENCIL_BACK_VALUE_MASK: number;\n readonly STENCIL_BACK_WRITEMASK: number;\n readonly STENCIL_BITS: number;\n readonly STENCIL_BUFFER_BIT: number;\n readonly STENCIL_CLEAR_VALUE: number;\n readonly STENCIL_FAIL: number;\n readonly STENCIL_FUNC: number;\n readonly STENCIL_INDEX: number;\n readonly STENCIL_INDEX8: number;\n readonly STENCIL_PASS_DEPTH_FAIL: number;\n readonly STENCIL_PASS_DEPTH_PASS: number;\n readonly STENCIL_REF: number;\n readonly STENCIL_TEST: number;\n readonly STENCIL_VALUE_MASK: number;\n readonly STENCIL_WRITEMASK: number;\n readonly STREAM_DRAW: number;\n readonly SUBPIXEL_BITS: number;\n readonly TEXTURE: number;\n readonly TEXTURE0: number;\n readonly TEXTURE1: number;\n readonly TEXTURE10: number;\n readonly TEXTURE11: number;\n readonly TEXTURE12: number;\n readonly TEXTURE13: number;\n readonly TEXTURE14: number;\n readonly TEXTURE15: number;\n readonly TEXTURE16: number;\n readonly TEXTURE17: number;\n readonly TEXTURE18: number;\n readonly TEXTURE19: number;\n readonly TEXTURE2: number;\n readonly TEXTURE20: number;\n readonly TEXTURE21: number;\n readonly TEXTURE22: number;\n readonly TEXTURE23: number;\n readonly TEXTURE24: number;\n readonly TEXTURE25: number;\n readonly TEXTURE26: number;\n readonly TEXTURE27: number;\n readonly TEXTURE28: number;\n readonly TEXTURE29: number;\n readonly TEXTURE3: number;\n readonly TEXTURE30: number;\n readonly TEXTURE31: number;\n readonly TEXTURE4: number;\n readonly TEXTURE5: number;\n readonly TEXTURE6: number;\n readonly TEXTURE7: number;\n readonly TEXTURE8: number;\n readonly TEXTURE9: number;\n readonly TEXTURE_2D: number;\n readonly TEXTURE_BINDING_2D: number;\n readonly TEXTURE_BINDING_CUBE_MAP: number;\n readonly TEXTURE_CUBE_MAP: number;\n readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number;\n readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number;\n readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number;\n readonly TEXTURE_CUBE_MAP_POSITIVE_X: number;\n readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number;\n readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number;\n readonly TEXTURE_MAG_FILTER: number;\n readonly TEXTURE_MIN_FILTER: number;\n readonly TEXTURE_WRAP_S: number;\n readonly TEXTURE_WRAP_T: number;\n readonly TRIANGLES: number;\n readonly TRIANGLE_FAN: number;\n readonly TRIANGLE_STRIP: number;\n readonly UNPACK_ALIGNMENT: number;\n readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number;\n readonly UNPACK_FLIP_Y_WEBGL: number;\n readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number;\n readonly UNSIGNED_BYTE: number;\n readonly UNSIGNED_INT: number;\n readonly UNSIGNED_SHORT: number;\n readonly UNSIGNED_SHORT_4_4_4_4: number;\n readonly UNSIGNED_SHORT_5_5_5_1: number;\n readonly UNSIGNED_SHORT_5_6_5: number;\n readonly VALIDATE_STATUS: number;\n readonly VENDOR: number;\n readonly VERSION: number;\n readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number;\n readonly VERTEX_ATTRIB_ARRAY_ENABLED: number;\n readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number;\n readonly VERTEX_ATTRIB_ARRAY_POINTER: number;\n readonly VERTEX_ATTRIB_ARRAY_SIZE: number;\n readonly VERTEX_ATTRIB_ARRAY_STRIDE: number;\n readonly VERTEX_ATTRIB_ARRAY_TYPE: number;\n readonly VERTEX_SHADER: number;\n readonly VIEWPORT: number;\n readonly ZERO: number;\n}\n\ndeclare var WebGLRenderingContext: {\n prototype: WebGLRenderingContext;\n new(): WebGLRenderingContext;\n readonly ACTIVE_ATTRIBUTES: number;\n readonly ACTIVE_TEXTURE: number;\n readonly ACTIVE_UNIFORMS: number;\n readonly ALIASED_LINE_WIDTH_RANGE: number;\n readonly ALIASED_POINT_SIZE_RANGE: number;\n readonly ALPHA: number;\n readonly ALPHA_BITS: number;\n readonly ALWAYS: number;\n readonly ARRAY_BUFFER: number;\n readonly ARRAY_BUFFER_BINDING: number;\n readonly ATTACHED_SHADERS: number;\n readonly BACK: number;\n readonly BLEND: number;\n readonly BLEND_COLOR: number;\n readonly BLEND_DST_ALPHA: number;\n readonly BLEND_DST_RGB: number;\n readonly BLEND_EQUATION: number;\n readonly BLEND_EQUATION_ALPHA: number;\n readonly BLEND_EQUATION_RGB: number;\n readonly BLEND_SRC_ALPHA: number;\n readonly BLEND_SRC_RGB: number;\n readonly BLUE_BITS: number;\n readonly BOOL: number;\n readonly BOOL_VEC2: number;\n readonly BOOL_VEC3: number;\n readonly BOOL_VEC4: number;\n readonly BROWSER_DEFAULT_WEBGL: number;\n readonly BUFFER_SIZE: number;\n readonly BUFFER_USAGE: number;\n readonly BYTE: number;\n readonly CCW: number;\n readonly CLAMP_TO_EDGE: number;\n readonly COLOR_ATTACHMENT0: number;\n readonly COLOR_BUFFER_BIT: number;\n readonly COLOR_CLEAR_VALUE: number;\n readonly COLOR_WRITEMASK: number;\n readonly COMPILE_STATUS: number;\n readonly COMPRESSED_TEXTURE_FORMATS: number;\n readonly CONSTANT_ALPHA: number;\n readonly CONSTANT_COLOR: number;\n readonly CONTEXT_LOST_WEBGL: number;\n readonly CULL_FACE: number;\n readonly CULL_FACE_MODE: number;\n readonly CURRENT_PROGRAM: number;\n readonly CURRENT_VERTEX_ATTRIB: number;\n readonly CW: number;\n readonly DECR: number;\n readonly DECR_WRAP: number;\n readonly DELETE_STATUS: number;\n readonly DEPTH_ATTACHMENT: number;\n readonly DEPTH_BITS: number;\n readonly DEPTH_BUFFER_BIT: number;\n readonly DEPTH_CLEAR_VALUE: number;\n readonly DEPTH_COMPONENT: number;\n readonly DEPTH_COMPONENT16: number;\n readonly DEPTH_FUNC: number;\n readonly DEPTH_RANGE: number;\n readonly DEPTH_STENCIL: number;\n readonly DEPTH_STENCIL_ATTACHMENT: number;\n readonly DEPTH_TEST: number;\n readonly DEPTH_WRITEMASK: number;\n readonly DITHER: number;\n readonly DONT_CARE: number;\n readonly DST_ALPHA: number;\n readonly DST_COLOR: number;\n readonly DYNAMIC_DRAW: number;\n readonly ELEMENT_ARRAY_BUFFER: number;\n readonly ELEMENT_ARRAY_BUFFER_BINDING: number;\n readonly EQUAL: number;\n readonly FASTEST: number;\n readonly FLOAT: number;\n readonly FLOAT_MAT2: number;\n readonly FLOAT_MAT3: number;\n readonly FLOAT_MAT4: number;\n readonly FLOAT_VEC2: number;\n readonly FLOAT_VEC3: number;\n readonly FLOAT_VEC4: number;\n readonly FRAGMENT_SHADER: number;\n readonly FRAMEBUFFER: number;\n readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number;\n readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number;\n readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number;\n readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number;\n readonly FRAMEBUFFER_BINDING: number;\n readonly FRAMEBUFFER_COMPLETE: number;\n readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number;\n readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number;\n readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number;\n readonly FRAMEBUFFER_UNSUPPORTED: number;\n readonly FRONT: number;\n readonly FRONT_AND_BACK: number;\n readonly FRONT_FACE: number;\n readonly FUNC_ADD: number;\n readonly FUNC_REVERSE_SUBTRACT: number;\n readonly FUNC_SUBTRACT: number;\n readonly GENERATE_MIPMAP_HINT: number;\n readonly GEQUAL: number;\n readonly GREATER: number;\n readonly GREEN_BITS: number;\n readonly HIGH_FLOAT: number;\n readonly HIGH_INT: number;\n readonly IMPLEMENTATION_COLOR_READ_FORMAT: number;\n readonly IMPLEMENTATION_COLOR_READ_TYPE: number;\n readonly INCR: number;\n readonly INCR_WRAP: number;\n readonly INT: number;\n readonly INT_VEC2: number;\n readonly INT_VEC3: number;\n readonly INT_VEC4: number;\n readonly INVALID_ENUM: number;\n readonly INVALID_FRAMEBUFFER_OPERATION: number;\n readonly INVALID_OPERATION: number;\n readonly INVALID_VALUE: number;\n readonly INVERT: number;\n readonly KEEP: number;\n readonly LEQUAL: number;\n readonly LESS: number;\n readonly LINEAR: number;\n readonly LINEAR_MIPMAP_LINEAR: number;\n readonly LINEAR_MIPMAP_NEAREST: number;\n readonly LINES: number;\n readonly LINE_LOOP: number;\n readonly LINE_STRIP: number;\n readonly LINE_WIDTH: number;\n readonly LINK_STATUS: number;\n readonly LOW_FLOAT: number;\n readonly LOW_INT: number;\n readonly LUMINANCE: number;\n readonly LUMINANCE_ALPHA: number;\n readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number;\n readonly MAX_CUBE_MAP_TEXTURE_SIZE: number;\n readonly MAX_FRAGMENT_UNIFORM_VECTORS: number;\n readonly MAX_RENDERBUFFER_SIZE: number;\n readonly MAX_TEXTURE_IMAGE_UNITS: number;\n readonly MAX_TEXTURE_SIZE: number;\n readonly MAX_VARYING_VECTORS: number;\n readonly MAX_VERTEX_ATTRIBS: number;\n readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number;\n readonly MAX_VERTEX_UNIFORM_VECTORS: number;\n readonly MAX_VIEWPORT_DIMS: number;\n readonly MEDIUM_FLOAT: number;\n readonly MEDIUM_INT: number;\n readonly MIRRORED_REPEAT: number;\n readonly NEAREST: number;\n readonly NEAREST_MIPMAP_LINEAR: number;\n readonly NEAREST_MIPMAP_NEAREST: number;\n readonly NEVER: number;\n readonly NICEST: number;\n readonly NONE: number;\n readonly NOTEQUAL: number;\n readonly NO_ERROR: number;\n readonly ONE: number;\n readonly ONE_MINUS_CONSTANT_ALPHA: number;\n readonly ONE_MINUS_CONSTANT_COLOR: number;\n readonly ONE_MINUS_DST_ALPHA: number;\n readonly ONE_MINUS_DST_COLOR: number;\n readonly ONE_MINUS_SRC_ALPHA: number;\n readonly ONE_MINUS_SRC_COLOR: number;\n readonly OUT_OF_MEMORY: number;\n readonly PACK_ALIGNMENT: number;\n readonly POINTS: number;\n readonly POLYGON_OFFSET_FACTOR: number;\n readonly POLYGON_OFFSET_FILL: number;\n readonly POLYGON_OFFSET_UNITS: number;\n readonly RED_BITS: number;\n readonly RENDERBUFFER: number;\n readonly RENDERBUFFER_ALPHA_SIZE: number;\n readonly RENDERBUFFER_BINDING: number;\n readonly RENDERBUFFER_BLUE_SIZE: number;\n readonly RENDERBUFFER_DEPTH_SIZE: number;\n readonly RENDERBUFFER_GREEN_SIZE: number;\n readonly RENDERBUFFER_HEIGHT: number;\n readonly RENDERBUFFER_INTERNAL_FORMAT: number;\n readonly RENDERBUFFER_RED_SIZE: number;\n readonly RENDERBUFFER_STENCIL_SIZE: number;\n readonly RENDERBUFFER_WIDTH: number;\n readonly RENDERER: number;\n readonly REPEAT: number;\n readonly REPLACE: number;\n readonly RGB: number;\n readonly RGB565: number;\n readonly RGB5_A1: number;\n readonly RGBA: number;\n readonly RGBA4: number;\n readonly SAMPLER_2D: number;\n readonly SAMPLER_CUBE: number;\n readonly SAMPLES: number;\n readonly SAMPLE_ALPHA_TO_COVERAGE: number;\n readonly SAMPLE_BUFFERS: number;\n readonly SAMPLE_COVERAGE: number;\n readonly SAMPLE_COVERAGE_INVERT: number;\n readonly SAMPLE_COVERAGE_VALUE: number;\n readonly SCISSOR_BOX: number;\n readonly SCISSOR_TEST: number;\n readonly SHADER_TYPE: number;\n readonly SHADING_LANGUAGE_VERSION: number;\n readonly SHORT: number;\n readonly SRC_ALPHA: number;\n readonly SRC_ALPHA_SATURATE: number;\n readonly SRC_COLOR: number;\n readonly STATIC_DRAW: number;\n readonly STENCIL_ATTACHMENT: number;\n readonly STENCIL_BACK_FAIL: number;\n readonly STENCIL_BACK_FUNC: number;\n readonly STENCIL_BACK_PASS_DEPTH_FAIL: number;\n readonly STENCIL_BACK_PASS_DEPTH_PASS: number;\n readonly STENCIL_BACK_REF: number;\n readonly STENCIL_BACK_VALUE_MASK: number;\n readonly STENCIL_BACK_WRITEMASK: number;\n readonly STENCIL_BITS: number;\n readonly STENCIL_BUFFER_BIT: number;\n readonly STENCIL_CLEAR_VALUE: number;\n readonly STENCIL_FAIL: number;\n readonly STENCIL_FUNC: number;\n readonly STENCIL_INDEX: number;\n readonly STENCIL_INDEX8: number;\n readonly STENCIL_PASS_DEPTH_FAIL: number;\n readonly STENCIL_PASS_DEPTH_PASS: number;\n readonly STENCIL_REF: number;\n readonly STENCIL_TEST: number;\n readonly STENCIL_VALUE_MASK: number;\n readonly STENCIL_WRITEMASK: number;\n readonly STREAM_DRAW: number;\n readonly SUBPIXEL_BITS: number;\n readonly TEXTURE: number;\n readonly TEXTURE0: number;\n readonly TEXTURE1: number;\n readonly TEXTURE10: number;\n readonly TEXTURE11: number;\n readonly TEXTURE12: number;\n readonly TEXTURE13: number;\n readonly TEXTURE14: number;\n readonly TEXTURE15: number;\n readonly TEXTURE16: number;\n readonly TEXTURE17: number;\n readonly TEXTURE18: number;\n readonly TEXTURE19: number;\n readonly TEXTURE2: number;\n readonly TEXTURE20: number;\n readonly TEXTURE21: number;\n readonly TEXTURE22: number;\n readonly TEXTURE23: number;\n readonly TEXTURE24: number;\n readonly TEXTURE25: number;\n readonly TEXTURE26: number;\n readonly TEXTURE27: number;\n readonly TEXTURE28: number;\n readonly TEXTURE29: number;\n readonly TEXTURE3: number;\n readonly TEXTURE30: number;\n readonly TEXTURE31: number;\n readonly TEXTURE4: number;\n readonly TEXTURE5: number;\n readonly TEXTURE6: number;\n readonly TEXTURE7: number;\n readonly TEXTURE8: number;\n readonly TEXTURE9: number;\n readonly TEXTURE_2D: number;\n readonly TEXTURE_BINDING_2D: number;\n readonly TEXTURE_BINDING_CUBE_MAP: number;\n readonly TEXTURE_CUBE_MAP: number;\n readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number;\n readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number;\n readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number;\n readonly TEXTURE_CUBE_MAP_POSITIVE_X: number;\n readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number;\n readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number;\n readonly TEXTURE_MAG_FILTER: number;\n readonly TEXTURE_MIN_FILTER: number;\n readonly TEXTURE_WRAP_S: number;\n readonly TEXTURE_WRAP_T: number;\n readonly TRIANGLES: number;\n readonly TRIANGLE_FAN: number;\n readonly TRIANGLE_STRIP: number;\n readonly UNPACK_ALIGNMENT: number;\n readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number;\n readonly UNPACK_FLIP_Y_WEBGL: number;\n readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number;\n readonly UNSIGNED_BYTE: number;\n readonly UNSIGNED_INT: number;\n readonly UNSIGNED_SHORT: number;\n readonly UNSIGNED_SHORT_4_4_4_4: number;\n readonly UNSIGNED_SHORT_5_5_5_1: number;\n readonly UNSIGNED_SHORT_5_6_5: number;\n readonly VALIDATE_STATUS: number;\n readonly VENDOR: number;\n readonly VERSION: number;\n readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number;\n readonly VERTEX_ATTRIB_ARRAY_ENABLED: number;\n readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number;\n readonly VERTEX_ATTRIB_ARRAY_POINTER: number;\n readonly VERTEX_ATTRIB_ARRAY_SIZE: number;\n readonly VERTEX_ATTRIB_ARRAY_STRIDE: number;\n readonly VERTEX_ATTRIB_ARRAY_TYPE: number;\n readonly VERTEX_SHADER: number;\n readonly VIEWPORT: number;\n readonly ZERO: number;\n}\n\ninterface WebGLShader extends WebGLObject {\n}\n\ndeclare var WebGLShader: {\n prototype: WebGLShader;\n new(): WebGLShader;\n}\n\ninterface WebGLShaderPrecisionFormat {\n readonly precision: number;\n readonly rangeMax: number;\n readonly rangeMin: number;\n}\n\ndeclare var WebGLShaderPrecisionFormat: {\n prototype: WebGLShaderPrecisionFormat;\n new(): WebGLShaderPrecisionFormat;\n}\n\ninterface WebGLTexture extends WebGLObject {\n}\n\ndeclare var WebGLTexture: {\n prototype: WebGLTexture;\n new(): WebGLTexture;\n}\n\ninterface WebGLUniformLocation {\n}\n\ndeclare var WebGLUniformLocation: {\n prototype: WebGLUniformLocation;\n new(): WebGLUniformLocation;\n}\n\ninterface WebKitCSSMatrix {\n a: number;\n b: number;\n c: number;\n d: number;\n e: number;\n f: number;\n m11: number;\n m12: number;\n m13: number;\n m14: number;\n m21: number;\n m22: number;\n m23: number;\n m24: number;\n m31: number;\n m32: number;\n m33: number;\n m34: number;\n m41: number;\n m42: number;\n m43: number;\n m44: number;\n inverse(): WebKitCSSMatrix;\n multiply(secondMatrix: WebKitCSSMatrix): WebKitCSSMatrix;\n rotate(angleX: number, angleY?: number, angleZ?: number): WebKitCSSMatrix;\n rotateAxisAngle(x: number, y: number, z: number, angle: number): WebKitCSSMatrix;\n scale(scaleX: number, scaleY?: number, scaleZ?: number): WebKitCSSMatrix;\n setMatrixValue(value: string): void;\n skewX(angle: number): WebKitCSSMatrix;\n skewY(angle: number): WebKitCSSMatrix;\n toString(): string;\n translate(x: number, y: number, z?: number): WebKitCSSMatrix;\n}\n\ndeclare var WebKitCSSMatrix: {\n prototype: WebKitCSSMatrix;\n new(text?: string): WebKitCSSMatrix;\n}\n\ninterface WebKitPoint {\n x: number;\n y: number;\n}\n\ndeclare var WebKitPoint: {\n prototype: WebKitPoint;\n new(x?: number, y?: number): WebKitPoint;\n}\n\ninterface WebSocketEventMap {\n \"close\": CloseEvent;\n \"error\": ErrorEvent;\n \"message\": MessageEvent;\n \"open\": Event;\n}\n\ninterface WebSocket extends EventTarget {\n binaryType: string;\n readonly bufferedAmount: number;\n readonly extensions: string;\n onclose: (this: WebSocket, ev: CloseEvent) => any;\n onerror: (this: WebSocket, ev: ErrorEvent) => any;\n onmessage: (this: WebSocket, ev: MessageEvent) => any;\n onopen: (this: WebSocket, ev: Event) => any;\n readonly protocol: string;\n readonly readyState: number;\n readonly url: string;\n close(code?: number, reason?: string): void;\n send(data: any): void;\n readonly CLOSED: number;\n readonly CLOSING: number;\n readonly CONNECTING: number;\n readonly OPEN: number;\n addEventListener(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var WebSocket: {\n prototype: WebSocket;\n new(url: string, protocols?: string | string[]): WebSocket;\n readonly CLOSED: number;\n readonly CLOSING: number;\n readonly CONNECTING: number;\n readonly OPEN: number;\n}\n\ninterface WheelEvent extends MouseEvent {\n readonly deltaMode: number;\n readonly deltaX: number;\n readonly deltaY: number;\n readonly deltaZ: number;\n readonly wheelDelta: number;\n readonly wheelDeltaX: number;\n readonly wheelDeltaY: number;\n getCurrentPoint(element: Element): void;\n initWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, deltaXArg: number, deltaYArg: number, deltaZArg: number, deltaMode: number): void;\n readonly DOM_DELTA_LINE: number;\n readonly DOM_DELTA_PAGE: number;\n readonly DOM_DELTA_PIXEL: number;\n}\n\ndeclare var WheelEvent: {\n prototype: WheelEvent;\n new(typeArg: string, eventInitDict?: WheelEventInit): WheelEvent;\n readonly DOM_DELTA_LINE: number;\n readonly DOM_DELTA_PAGE: number;\n readonly DOM_DELTA_PIXEL: number;\n}\n\ninterface WindowEventMap extends GlobalEventHandlersEventMap {\n \"abort\": UIEvent;\n \"afterprint\": Event;\n \"beforeprint\": Event;\n \"beforeunload\": BeforeUnloadEvent;\n \"blur\": FocusEvent;\n \"canplay\": Event;\n \"canplaythrough\": Event;\n \"change\": Event;\n \"click\": MouseEvent;\n \"compassneedscalibration\": Event;\n \"contextmenu\": PointerEvent;\n \"dblclick\": MouseEvent;\n \"devicelight\": DeviceLightEvent;\n \"devicemotion\": DeviceMotionEvent;\n \"deviceorientation\": DeviceOrientationEvent;\n \"drag\": DragEvent;\n \"dragend\": DragEvent;\n \"dragenter\": DragEvent;\n \"dragleave\": DragEvent;\n \"dragover\": DragEvent;\n \"dragstart\": DragEvent;\n \"drop\": DragEvent;\n \"durationchange\": Event;\n \"emptied\": Event;\n \"ended\": MediaStreamErrorEvent;\n \"focus\": FocusEvent;\n \"hashchange\": HashChangeEvent;\n \"input\": Event;\n \"invalid\": Event;\n \"keydown\": KeyboardEvent;\n \"keypress\": KeyboardEvent;\n \"keyup\": KeyboardEvent;\n \"load\": Event;\n \"loadeddata\": Event;\n \"loadedmetadata\": Event;\n \"loadstart\": Event;\n \"message\": MessageEvent;\n \"mousedown\": MouseEvent;\n \"mouseenter\": MouseEvent;\n \"mouseleave\": MouseEvent;\n \"mousemove\": MouseEvent;\n \"mouseout\": MouseEvent;\n \"mouseover\": MouseEvent;\n \"mouseup\": MouseEvent;\n \"mousewheel\": WheelEvent;\n \"MSGestureChange\": MSGestureEvent;\n \"MSGestureDoubleTap\": MSGestureEvent;\n \"MSGestureEnd\": MSGestureEvent;\n \"MSGestureHold\": MSGestureEvent;\n \"MSGestureStart\": MSGestureEvent;\n \"MSGestureTap\": MSGestureEvent;\n \"MSInertiaStart\": MSGestureEvent;\n \"MSPointerCancel\": MSPointerEvent;\n \"MSPointerDown\": MSPointerEvent;\n \"MSPointerEnter\": MSPointerEvent;\n \"MSPointerLeave\": MSPointerEvent;\n \"MSPointerMove\": MSPointerEvent;\n \"MSPointerOut\": MSPointerEvent;\n \"MSPointerOver\": MSPointerEvent;\n \"MSPointerUp\": MSPointerEvent;\n \"offline\": Event;\n \"online\": Event;\n \"orientationchange\": Event;\n \"pagehide\": PageTransitionEvent;\n \"pageshow\": PageTransitionEvent;\n \"pause\": Event;\n \"play\": Event;\n \"playing\": Event;\n \"popstate\": PopStateEvent;\n \"progress\": ProgressEvent;\n \"ratechange\": Event;\n \"readystatechange\": ProgressEvent;\n \"reset\": Event;\n \"resize\": UIEvent;\n \"scroll\": UIEvent;\n \"seeked\": Event;\n \"seeking\": Event;\n \"select\": UIEvent;\n \"stalled\": Event;\n \"storage\": StorageEvent;\n \"submit\": Event;\n \"suspend\": Event;\n \"timeupdate\": Event;\n \"unload\": Event;\n \"volumechange\": Event;\n \"waiting\": Event;\n}\n\ninterface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64 {\n readonly applicationCache: ApplicationCache;\n readonly clientInformation: Navigator;\n readonly closed: boolean;\n readonly crypto: Crypto;\n defaultStatus: string;\n readonly devicePixelRatio: number;\n readonly doNotTrack: string;\n readonly document: Document;\n event: Event | undefined;\n readonly external: External;\n readonly frameElement: Element;\n readonly frames: Window;\n readonly history: History;\n readonly innerHeight: number;\n readonly innerWidth: number;\n readonly length: number;\n readonly location: Location;\n readonly locationbar: BarProp;\n readonly menubar: BarProp;\n readonly msCredentials: MSCredentials;\n name: string;\n readonly navigator: Navigator;\n offscreenBuffering: string | boolean;\n onabort: (this: Window, ev: UIEvent) => any;\n onafterprint: (this: Window, ev: Event) => any;\n onbeforeprint: (this: Window, ev: Event) => any;\n onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any;\n onblur: (this: Window, ev: FocusEvent) => any;\n oncanplay: (this: Window, ev: Event) => any;\n oncanplaythrough: (this: Window, ev: Event) => any;\n onchange: (this: Window, ev: Event) => any;\n onclick: (this: Window, ev: MouseEvent) => any;\n oncompassneedscalibration: (this: Window, ev: Event) => any;\n oncontextmenu: (this: Window, ev: PointerEvent) => any;\n ondblclick: (this: Window, ev: MouseEvent) => any;\n ondevicelight: (this: Window, ev: DeviceLightEvent) => any;\n ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any;\n ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any;\n ondrag: (this: Window, ev: DragEvent) => any;\n ondragend: (this: Window, ev: DragEvent) => any;\n ondragenter: (this: Window, ev: DragEvent) => any;\n ondragleave: (this: Window, ev: DragEvent) => any;\n ondragover: (this: Window, ev: DragEvent) => any;\n ondragstart: (this: Window, ev: DragEvent) => any;\n ondrop: (this: Window, ev: DragEvent) => any;\n ondurationchange: (this: Window, ev: Event) => any;\n onemptied: (this: Window, ev: Event) => any;\n onended: (this: Window, ev: MediaStreamErrorEvent) => any;\n onerror: ErrorEventHandler;\n onfocus: (this: Window, ev: FocusEvent) => any;\n onhashchange: (this: Window, ev: HashChangeEvent) => any;\n oninput: (this: Window, ev: Event) => any;\n oninvalid: (this: Window, ev: Event) => any;\n onkeydown: (this: Window, ev: KeyboardEvent) => any;\n onkeypress: (this: Window, ev: KeyboardEvent) => any;\n onkeyup: (this: Window, ev: KeyboardEvent) => any;\n onload: (this: Window, ev: Event) => any;\n onloadeddata: (this: Window, ev: Event) => any;\n onloadedmetadata: (this: Window, ev: Event) => any;\n onloadstart: (this: Window, ev: Event) => any;\n onmessage: (this: Window, ev: MessageEvent) => any;\n onmousedown: (this: Window, ev: MouseEvent) => any;\n onmouseenter: (this: Window, ev: MouseEvent) => any;\n onmouseleave: (this: Window, ev: MouseEvent) => any;\n onmousemove: (this: Window, ev: MouseEvent) => any;\n onmouseout: (this: Window, ev: MouseEvent) => any;\n onmouseover: (this: Window, ev: MouseEvent) => any;\n onmouseup: (this: Window, ev: MouseEvent) => any;\n onmousewheel: (this: Window, ev: WheelEvent) => any;\n onmsgesturechange: (this: Window, ev: MSGestureEvent) => any;\n onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any;\n onmsgestureend: (this: Window, ev: MSGestureEvent) => any;\n onmsgesturehold: (this: Window, ev: MSGestureEvent) => any;\n onmsgesturestart: (this: Window, ev: MSGestureEvent) => any;\n onmsgesturetap: (this: Window, ev: MSGestureEvent) => any;\n onmsinertiastart: (this: Window, ev: MSGestureEvent) => any;\n onmspointercancel: (this: Window, ev: MSPointerEvent) => any;\n onmspointerdown: (this: Window, ev: MSPointerEvent) => any;\n onmspointerenter: (this: Window, ev: MSPointerEvent) => any;\n onmspointerleave: (this: Window, ev: MSPointerEvent) => any;\n onmspointermove: (this: Window, ev: MSPointerEvent) => any;\n onmspointerout: (this: Window, ev: MSPointerEvent) => any;\n onmspointerover: (this: Window, ev: MSPointerEvent) => any;\n onmspointerup: (this: Window, ev: MSPointerEvent) => any;\n onoffline: (this: Window, ev: Event) => any;\n ononline: (this: Window, ev: Event) => any;\n onorientationchange: (this: Window, ev: Event) => any;\n onpagehide: (this: Window, ev: PageTransitionEvent) => any;\n onpageshow: (this: Window, ev: PageTransitionEvent) => any;\n onpause: (this: Window, ev: Event) => any;\n onplay: (this: Window, ev: Event) => any;\n onplaying: (this: Window, ev: Event) => any;\n onpopstate: (this: Window, ev: PopStateEvent) => any;\n onprogress: (this: Window, ev: ProgressEvent) => any;\n onratechange: (this: Window, ev: Event) => any;\n onreadystatechange: (this: Window, ev: ProgressEvent) => any;\n onreset: (this: Window, ev: Event) => any;\n onresize: (this: Window, ev: UIEvent) => any;\n onscroll: (this: Window, ev: UIEvent) => any;\n onseeked: (this: Window, ev: Event) => any;\n onseeking: (this: Window, ev: Event) => any;\n onselect: (this: Window, ev: UIEvent) => any;\n onstalled: (this: Window, ev: Event) => any;\n onstorage: (this: Window, ev: StorageEvent) => any;\n onsubmit: (this: Window, ev: Event) => any;\n onsuspend: (this: Window, ev: Event) => any;\n ontimeupdate: (this: Window, ev: Event) => any;\n ontouchcancel: (ev: TouchEvent) => any;\n ontouchend: (ev: TouchEvent) => any;\n ontouchmove: (ev: TouchEvent) => any;\n ontouchstart: (ev: TouchEvent) => any;\n onunload: (this: Window, ev: Event) => any;\n onvolumechange: (this: Window, ev: Event) => any;\n onwaiting: (this: Window, ev: Event) => any;\n opener: any;\n orientation: string | number;\n readonly outerHeight: number;\n readonly outerWidth: number;\n readonly pageXOffset: number;\n readonly pageYOffset: number;\n readonly parent: Window;\n readonly performance: Performance;\n readonly personalbar: BarProp;\n readonly screen: Screen;\n readonly screenLeft: number;\n readonly screenTop: number;\n readonly screenX: number;\n readonly screenY: number;\n readonly scrollX: number;\n readonly scrollY: number;\n readonly scrollbars: BarProp;\n readonly self: Window;\n status: string;\n readonly statusbar: BarProp;\n readonly styleMedia: StyleMedia;\n readonly toolbar: BarProp;\n readonly top: Window;\n readonly window: Window;\n URL: typeof URL;\n Blob: typeof Blob;\n alert(message?: any): void;\n blur(): void;\n cancelAnimationFrame(handle: number): void;\n captureEvents(): void;\n close(): void;\n confirm(message?: string): boolean;\n focus(): void;\n getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration;\n getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList;\n getSelection(): Selection;\n matchMedia(mediaQuery: string): MediaQueryList;\n moveBy(x?: number, y?: number): void;\n moveTo(x?: number, y?: number): void;\n msWriteProfilerMark(profilerMarkName: string): void;\n open(url?: string, target?: string, features?: string, replace?: boolean): Window;\n postMessage(message: any, targetOrigin: string, transfer?: any[]): void;\n print(): void;\n prompt(message?: string, _default?: string): string | null;\n releaseEvents(): void;\n requestAnimationFrame(callback: FrameRequestCallback): number;\n resizeBy(x?: number, y?: number): void;\n resizeTo(x?: number, y?: number): void;\n scroll(x?: number, y?: number): void;\n scrollBy(x?: number, y?: number): void;\n scrollTo(x?: number, y?: number): void;\n webkitCancelAnimationFrame(handle: number): void;\n webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint;\n webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint;\n webkitRequestAnimationFrame(callback: FrameRequestCallback): number;\n scroll(options?: ScrollToOptions): void;\n scrollTo(options?: ScrollToOptions): void;\n scrollBy(options?: ScrollToOptions): void;\n addEventListener(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var Window: {\n prototype: Window;\n new(): Window;\n}\n\ninterface WorkerEventMap extends AbstractWorkerEventMap {\n \"message\": MessageEvent;\n}\n\ninterface Worker extends EventTarget, AbstractWorker {\n onmessage: (this: Worker, ev: MessageEvent) => any;\n postMessage(message: any, ports?: any): void;\n terminate(): void;\n addEventListener(type: K, listener: (this: Worker, ev: WorkerEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var Worker: {\n prototype: Worker;\n new(stringUrl: string): Worker;\n}\n\ninterface XMLDocument extends Document {\n addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var XMLDocument: {\n prototype: XMLDocument;\n new(): XMLDocument;\n}\n\ninterface XMLHttpRequestEventMap extends XMLHttpRequestEventTargetEventMap {\n \"readystatechange\": Event;\n}\n\ninterface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {\n onreadystatechange: (this: XMLHttpRequest, ev: Event) => any;\n readonly readyState: number;\n readonly response: any;\n readonly responseText: string;\n responseType: string;\n readonly responseXML: any;\n readonly status: number;\n readonly statusText: string;\n timeout: number;\n readonly upload: XMLHttpRequestUpload;\n withCredentials: boolean;\n msCaching?: string;\n readonly responseURL: string;\n abort(): void;\n getAllResponseHeaders(): string;\n getResponseHeader(header: string): string | null;\n msCachingEnabled(): boolean;\n open(method: string, url: string, async?: boolean, user?: string, password?: string): void;\n overrideMimeType(mime: string): void;\n send(data?: Document): void;\n send(data?: string): void;\n send(data?: any): void;\n setRequestHeader(header: string, value: string): void;\n readonly DONE: number;\n readonly HEADERS_RECEIVED: number;\n readonly LOADING: number;\n readonly OPENED: number;\n readonly UNSENT: number;\n addEventListener(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var XMLHttpRequest: {\n prototype: XMLHttpRequest;\n new(): XMLHttpRequest;\n readonly DONE: number;\n readonly HEADERS_RECEIVED: number;\n readonly LOADING: number;\n readonly OPENED: number;\n readonly UNSENT: number;\n create(): XMLHttpRequest;\n}\n\ninterface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget {\n addEventListener(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var XMLHttpRequestUpload: {\n prototype: XMLHttpRequestUpload;\n new(): XMLHttpRequestUpload;\n}\n\ninterface XMLSerializer {\n serializeToString(target: Node): string;\n}\n\ndeclare var XMLSerializer: {\n prototype: XMLSerializer;\n new(): XMLSerializer;\n}\n\ninterface XPathEvaluator {\n createExpression(expression: string, resolver: XPathNSResolver): XPathExpression;\n createNSResolver(nodeResolver?: Node): XPathNSResolver;\n evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult;\n}\n\ndeclare var XPathEvaluator: {\n prototype: XPathEvaluator;\n new(): XPathEvaluator;\n}\n\ninterface XPathExpression {\n evaluate(contextNode: Node, type: number, result: XPathResult | null): XPathResult;\n}\n\ndeclare var XPathExpression: {\n prototype: XPathExpression;\n new(): XPathExpression;\n}\n\ninterface XPathNSResolver {\n lookupNamespaceURI(prefix: string): string;\n}\n\ndeclare var XPathNSResolver: {\n prototype: XPathNSResolver;\n new(): XPathNSResolver;\n}\n\ninterface XPathResult {\n readonly booleanValue: boolean;\n readonly invalidIteratorState: boolean;\n readonly numberValue: number;\n readonly resultType: number;\n readonly singleNodeValue: Node;\n readonly snapshotLength: number;\n readonly stringValue: string;\n iterateNext(): Node;\n snapshotItem(index: number): Node;\n readonly ANY_TYPE: number;\n readonly ANY_UNORDERED_NODE_TYPE: number;\n readonly BOOLEAN_TYPE: number;\n readonly FIRST_ORDERED_NODE_TYPE: number;\n readonly NUMBER_TYPE: number;\n readonly ORDERED_NODE_ITERATOR_TYPE: number;\n readonly ORDERED_NODE_SNAPSHOT_TYPE: number;\n readonly STRING_TYPE: number;\n readonly UNORDERED_NODE_ITERATOR_TYPE: number;\n readonly UNORDERED_NODE_SNAPSHOT_TYPE: number;\n}\n\ndeclare var XPathResult: {\n prototype: XPathResult;\n new(): XPathResult;\n readonly ANY_TYPE: number;\n readonly ANY_UNORDERED_NODE_TYPE: number;\n readonly BOOLEAN_TYPE: number;\n readonly FIRST_ORDERED_NODE_TYPE: number;\n readonly NUMBER_TYPE: number;\n readonly ORDERED_NODE_ITERATOR_TYPE: number;\n readonly ORDERED_NODE_SNAPSHOT_TYPE: number;\n readonly STRING_TYPE: number;\n readonly UNORDERED_NODE_ITERATOR_TYPE: number;\n readonly UNORDERED_NODE_SNAPSHOT_TYPE: number;\n}\n\ninterface XSLTProcessor {\n clearParameters(): void;\n getParameter(namespaceURI: string, localName: string): any;\n importStylesheet(style: Node): void;\n removeParameter(namespaceURI: string, localName: string): void;\n reset(): void;\n setParameter(namespaceURI: string, localName: string, value: any): void;\n transformToDocument(source: Node): Document;\n transformToFragment(source: Node, document: Document): DocumentFragment;\n}\n\ndeclare var XSLTProcessor: {\n prototype: XSLTProcessor;\n new(): XSLTProcessor;\n}\n\ninterface AbstractWorkerEventMap {\n \"error\": ErrorEvent;\n}\n\ninterface AbstractWorker {\n onerror: (this: AbstractWorker, ev: ErrorEvent) => any;\n addEventListener(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ninterface CanvasPathMethods {\n arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;\n arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void;\n bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void;\n closePath(): void;\n ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;\n lineTo(x: number, y: number): void;\n moveTo(x: number, y: number): void;\n quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;\n rect(x: number, y: number, w: number, h: number): void;\n}\n\ninterface ChildNode {\n remove(): void;\n}\n\ninterface DOML2DeprecatedColorProperty {\n color: string;\n}\n\ninterface DOML2DeprecatedSizeProperty {\n size: number;\n}\n\ninterface DocumentEvent {\n createEvent(eventInterface:\"AnimationEvent\"): AnimationEvent;\n createEvent(eventInterface:\"AriaRequestEvent\"): AriaRequestEvent;\n createEvent(eventInterface:\"AudioProcessingEvent\"): AudioProcessingEvent;\n createEvent(eventInterface:\"BeforeUnloadEvent\"): BeforeUnloadEvent;\n createEvent(eventInterface:\"ClipboardEvent\"): ClipboardEvent;\n createEvent(eventInterface:\"CloseEvent\"): CloseEvent;\n createEvent(eventInterface:\"CommandEvent\"): CommandEvent;\n createEvent(eventInterface:\"CompositionEvent\"): CompositionEvent;\n createEvent(eventInterface:\"CustomEvent\"): CustomEvent;\n createEvent(eventInterface:\"DeviceLightEvent\"): DeviceLightEvent;\n createEvent(eventInterface:\"DeviceMotionEvent\"): DeviceMotionEvent;\n createEvent(eventInterface:\"DeviceOrientationEvent\"): DeviceOrientationEvent;\n createEvent(eventInterface:\"DragEvent\"): DragEvent;\n createEvent(eventInterface:\"ErrorEvent\"): ErrorEvent;\n createEvent(eventInterface:\"Event\"): Event;\n createEvent(eventInterface:\"Events\"): Event;\n createEvent(eventInterface:\"FocusEvent\"): FocusEvent;\n createEvent(eventInterface:\"GamepadEvent\"): GamepadEvent;\n createEvent(eventInterface:\"HashChangeEvent\"): HashChangeEvent;\n createEvent(eventInterface:\"IDBVersionChangeEvent\"): IDBVersionChangeEvent;\n createEvent(eventInterface:\"KeyboardEvent\"): KeyboardEvent;\n createEvent(eventInterface:\"ListeningStateChangedEvent\"): ListeningStateChangedEvent;\n createEvent(eventInterface:\"LongRunningScriptDetectedEvent\"): LongRunningScriptDetectedEvent;\n createEvent(eventInterface:\"MSGestureEvent\"): MSGestureEvent;\n createEvent(eventInterface:\"MSManipulationEvent\"): MSManipulationEvent;\n createEvent(eventInterface:\"MSMediaKeyMessageEvent\"): MSMediaKeyMessageEvent;\n createEvent(eventInterface:\"MSMediaKeyNeededEvent\"): MSMediaKeyNeededEvent;\n createEvent(eventInterface:\"MSPointerEvent\"): MSPointerEvent;\n createEvent(eventInterface:\"MSSiteModeEvent\"): MSSiteModeEvent;\n createEvent(eventInterface:\"MediaEncryptedEvent\"): MediaEncryptedEvent;\n createEvent(eventInterface:\"MediaKeyMessageEvent\"): MediaKeyMessageEvent;\n createEvent(eventInterface:\"MediaStreamErrorEvent\"): MediaStreamErrorEvent;\n createEvent(eventInterface:\"MediaStreamTrackEvent\"): MediaStreamTrackEvent;\n createEvent(eventInterface:\"MessageEvent\"): MessageEvent;\n createEvent(eventInterface:\"MouseEvent\"): MouseEvent;\n createEvent(eventInterface:\"MouseEvents\"): MouseEvent;\n createEvent(eventInterface:\"MutationEvent\"): MutationEvent;\n createEvent(eventInterface:\"MutationEvents\"): MutationEvent;\n createEvent(eventInterface:\"NavigationCompletedEvent\"): NavigationCompletedEvent;\n createEvent(eventInterface:\"NavigationEvent\"): NavigationEvent;\n createEvent(eventInterface:\"NavigationEventWithReferrer\"): NavigationEventWithReferrer;\n createEvent(eventInterface:\"OfflineAudioCompletionEvent\"): OfflineAudioCompletionEvent;\n createEvent(eventInterface:\"OverflowEvent\"): OverflowEvent;\n createEvent(eventInterface:\"PageTransitionEvent\"): PageTransitionEvent;\n createEvent(eventInterface:\"PermissionRequestedEvent\"): PermissionRequestedEvent;\n createEvent(eventInterface:\"PointerEvent\"): PointerEvent;\n createEvent(eventInterface:\"PopStateEvent\"): PopStateEvent;\n createEvent(eventInterface:\"ProgressEvent\"): ProgressEvent;\n createEvent(eventInterface:\"RTCDTMFToneChangeEvent\"): RTCDTMFToneChangeEvent;\n createEvent(eventInterface:\"RTCDtlsTransportStateChangedEvent\"): RTCDtlsTransportStateChangedEvent;\n createEvent(eventInterface:\"RTCIceCandidatePairChangedEvent\"): RTCIceCandidatePairChangedEvent;\n createEvent(eventInterface:\"RTCIceGathererEvent\"): RTCIceGathererEvent;\n createEvent(eventInterface:\"RTCIceTransportStateChangedEvent\"): RTCIceTransportStateChangedEvent;\n createEvent(eventInterface:\"RTCSsrcConflictEvent\"): RTCSsrcConflictEvent;\n createEvent(eventInterface:\"SVGZoomEvent\"): SVGZoomEvent;\n createEvent(eventInterface:\"SVGZoomEvents\"): SVGZoomEvent;\n createEvent(eventInterface:\"ScriptNotifyEvent\"): ScriptNotifyEvent;\n createEvent(eventInterface:\"StorageEvent\"): StorageEvent;\n createEvent(eventInterface:\"TextEvent\"): TextEvent;\n createEvent(eventInterface:\"TouchEvent\"): TouchEvent;\n createEvent(eventInterface:\"TrackEvent\"): TrackEvent;\n createEvent(eventInterface:\"TransitionEvent\"): TransitionEvent;\n createEvent(eventInterface:\"UIEvent\"): UIEvent;\n createEvent(eventInterface:\"UIEvents\"): UIEvent;\n createEvent(eventInterface:\"UnviewableContentIdentifiedEvent\"): UnviewableContentIdentifiedEvent;\n createEvent(eventInterface:\"WebGLContextEvent\"): WebGLContextEvent;\n createEvent(eventInterface:\"WheelEvent\"): WheelEvent;\n createEvent(eventInterface: string): Event;\n}\n\ninterface ElementTraversal {\n readonly childElementCount: number;\n readonly firstElementChild: Element;\n readonly lastElementChild: Element;\n readonly nextElementSibling: Element;\n readonly previousElementSibling: Element;\n}\n\ninterface GetSVGDocument {\n getSVGDocument(): Document;\n}\n\ninterface GlobalEventHandlersEventMap {\n \"pointercancel\": PointerEvent;\n \"pointerdown\": PointerEvent;\n \"pointerenter\": PointerEvent;\n \"pointerleave\": PointerEvent;\n \"pointermove\": PointerEvent;\n \"pointerout\": PointerEvent;\n \"pointerover\": PointerEvent;\n \"pointerup\": PointerEvent;\n \"wheel\": WheelEvent;\n}\n\ninterface GlobalEventHandlers {\n onpointercancel: (this: GlobalEventHandlers, ev: PointerEvent) => any;\n onpointerdown: (this: GlobalEventHandlers, ev: PointerEvent) => any;\n onpointerenter: (this: GlobalEventHandlers, ev: PointerEvent) => any;\n onpointerleave: (this: GlobalEventHandlers, ev: PointerEvent) => any;\n onpointermove: (this: GlobalEventHandlers, ev: PointerEvent) => any;\n onpointerout: (this: GlobalEventHandlers, ev: PointerEvent) => any;\n onpointerover: (this: GlobalEventHandlers, ev: PointerEvent) => any;\n onpointerup: (this: GlobalEventHandlers, ev: PointerEvent) => any;\n onwheel: (this: GlobalEventHandlers, ev: WheelEvent) => any;\n addEventListener(type: K, listener: (this: GlobalEventHandlers, ev: GlobalEventHandlersEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ninterface HTMLTableAlignment {\n /**\n * Sets or retrieves a value that you can use to implement your own ch functionality for the object.\n */\n ch: string;\n /**\n * Sets or retrieves a value that you can use to implement your own chOff functionality for the object.\n */\n chOff: string;\n /**\n * Sets or retrieves how text and other content are vertically aligned within the object that contains them.\n */\n vAlign: string;\n}\n\ninterface IDBEnvironment {\n readonly indexedDB: IDBFactory;\n}\n\ninterface LinkStyle {\n readonly sheet: StyleSheet;\n}\n\ninterface MSBaseReaderEventMap {\n \"abort\": Event;\n \"error\": ErrorEvent;\n \"load\": Event;\n \"loadend\": ProgressEvent;\n \"loadstart\": Event;\n \"progress\": ProgressEvent;\n}\n\ninterface MSBaseReader {\n onabort: (this: MSBaseReader, ev: Event) => any;\n onerror: (this: MSBaseReader, ev: ErrorEvent) => any;\n onload: (this: MSBaseReader, ev: Event) => any;\n onloadend: (this: MSBaseReader, ev: ProgressEvent) => any;\n onloadstart: (this: MSBaseReader, ev: Event) => any;\n onprogress: (this: MSBaseReader, ev: ProgressEvent) => any;\n readonly readyState: number;\n readonly result: any;\n abort(): void;\n readonly DONE: number;\n readonly EMPTY: number;\n readonly LOADING: number;\n addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ninterface MSFileSaver {\n msSaveBlob(blob: any, defaultName?: string): boolean;\n msSaveOrOpenBlob(blob: any, defaultName?: string): boolean;\n}\n\ninterface MSNavigatorDoNotTrack {\n confirmSiteSpecificTrackingException(args: ConfirmSiteSpecificExceptionsInformation): boolean;\n confirmWebWideTrackingException(args: ExceptionInformation): boolean;\n removeSiteSpecificTrackingException(args: ExceptionInformation): void;\n removeWebWideTrackingException(args: ExceptionInformation): void;\n storeSiteSpecificTrackingException(args: StoreSiteSpecificExceptionsInformation): void;\n storeWebWideTrackingException(args: StoreExceptionsInformation): void;\n}\n\ninterface NavigatorContentUtils {\n}\n\ninterface NavigatorGeolocation {\n readonly geolocation: Geolocation;\n}\n\ninterface NavigatorID {\n readonly appName: string;\n readonly appVersion: string;\n readonly platform: string;\n readonly product: string;\n readonly productSub: string;\n readonly userAgent: string;\n readonly vendor: string;\n readonly vendorSub: string;\n}\n\ninterface NavigatorOnLine {\n readonly onLine: boolean;\n}\n\ninterface NavigatorStorageUtils {\n}\n\ninterface NavigatorUserMedia {\n readonly mediaDevices: MediaDevices;\n getUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void;\n}\n\ninterface NodeSelector {\n querySelector(selectors: K): ElementTagNameMap[K] | null;\n querySelector(selectors: string): Element | null;\n querySelectorAll(selectors: K): ElementListTagNameMap[K];\n querySelectorAll(selectors: string): NodeListOf;\n}\n\ninterface RandomSource {\n getRandomValues(array: ArrayBufferView): ArrayBufferView;\n}\n\ninterface SVGAnimatedPathData {\n readonly pathSegList: SVGPathSegList;\n}\n\ninterface SVGAnimatedPoints {\n readonly animatedPoints: SVGPointList;\n readonly points: SVGPointList;\n}\n\ninterface SVGExternalResourcesRequired {\n readonly externalResourcesRequired: SVGAnimatedBoolean;\n}\n\ninterface SVGFilterPrimitiveStandardAttributes extends SVGStylable {\n readonly height: SVGAnimatedLength;\n readonly result: SVGAnimatedString;\n readonly width: SVGAnimatedLength;\n readonly x: SVGAnimatedLength;\n readonly y: SVGAnimatedLength;\n}\n\ninterface SVGFitToViewBox {\n readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio;\n readonly viewBox: SVGAnimatedRect;\n}\n\ninterface SVGLangSpace {\n xmllang: string;\n xmlspace: string;\n}\n\ninterface SVGLocatable {\n readonly farthestViewportElement: SVGElement;\n readonly nearestViewportElement: SVGElement;\n getBBox(): SVGRect;\n getCTM(): SVGMatrix;\n getScreenCTM(): SVGMatrix;\n getTransformToElement(element: SVGElement): SVGMatrix;\n}\n\ninterface SVGStylable {\n className: any;\n readonly style: CSSStyleDeclaration;\n}\n\ninterface SVGTests {\n readonly requiredExtensions: SVGStringList;\n readonly requiredFeatures: SVGStringList;\n readonly systemLanguage: SVGStringList;\n hasExtension(extension: string): boolean;\n}\n\ninterface SVGTransformable extends SVGLocatable {\n readonly transform: SVGAnimatedTransformList;\n}\n\ninterface SVGURIReference {\n readonly href: SVGAnimatedString;\n}\n\ninterface WindowBase64 {\n atob(encodedString: string): string;\n btoa(rawString: string): string;\n}\n\ninterface WindowConsole {\n readonly console: Console;\n}\n\ninterface WindowLocalStorage {\n readonly localStorage: Storage;\n}\n\ninterface WindowSessionStorage {\n readonly sessionStorage: Storage;\n}\n\ninterface WindowTimers extends Object, WindowTimersExtension {\n clearInterval(handle: number): void;\n clearTimeout(handle: number): void;\n setInterval(handler: (...args: any[]) => void, timeout: number): number;\n setInterval(handler: any, timeout?: any, ...args: any[]): number;\n setTimeout(handler: (...args: any[]) => void, timeout: number): number;\n setTimeout(handler: any, timeout?: any, ...args: any[]): number;\n}\n\ninterface WindowTimersExtension {\n clearImmediate(handle: number): void;\n setImmediate(handler: (...args: any[]) => void): number;\n setImmediate(handler: any, ...args: any[]): number;\n}\n\ninterface XMLHttpRequestEventTargetEventMap {\n \"abort\": Event;\n \"error\": ErrorEvent;\n \"load\": Event;\n \"loadend\": ProgressEvent;\n \"loadstart\": Event;\n \"progress\": ProgressEvent;\n \"timeout\": ProgressEvent;\n}\n\ninterface XMLHttpRequestEventTarget {\n onabort: (this: XMLHttpRequestEventTarget, ev: Event) => any;\n onerror: (this: XMLHttpRequestEventTarget, ev: ErrorEvent) => any;\n onload: (this: XMLHttpRequestEventTarget, ev: Event) => any;\n onloadend: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any;\n onloadstart: (this: XMLHttpRequestEventTarget, ev: Event) => any;\n onprogress: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any;\n ontimeout: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any;\n addEventListener(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ninterface StorageEventInit extends EventInit {\n key?: string;\n oldValue?: string;\n newValue?: string;\n url: string;\n storageArea?: Storage;\n}\n\ninterface Canvas2DContextAttributes {\n alpha?: boolean;\n willReadFrequently?: boolean;\n storage?: boolean;\n [attribute: string]: boolean | string | undefined;\n}\n\ninterface NodeListOf extends NodeList {\n length: number;\n item(index: number): TNode;\n [index: number]: TNode;\n}\n\ninterface HTMLCollectionOf extends HTMLCollection {\n item(index: number): T;\n namedItem(name: string): T;\n [index: number]: T;\n}\n\ninterface BlobPropertyBag {\n type?: string;\n endings?: string;\n}\n\ninterface FilePropertyBag {\n type?: string;\n lastModified?: number;\n}\n\ninterface EventListenerObject {\n handleEvent(evt: Event): void;\n}\n\ninterface MessageEventInit extends EventInit {\n data?: any;\n origin?: string;\n lastEventId?: string;\n channel?: string;\n source?: any;\n ports?: MessagePort[];\n}\n\ninterface ProgressEventInit extends EventInit {\n lengthComputable?: boolean;\n loaded?: number;\n total?: number;\n}\n\ninterface ScrollOptions {\n behavior?: ScrollBehavior;\n}\n\ninterface ScrollToOptions extends ScrollOptions {\n left?: number;\n top?: number;\n}\n\ninterface ScrollIntoViewOptions extends ScrollOptions {\n block?: ScrollLogicalPosition;\n inline?: ScrollLogicalPosition;\n}\n\ninterface ClipboardEventInit extends EventInit {\n data?: string;\n dataType?: string;\n}\n\ninterface IDBArrayKey extends Array {\n}\n\ninterface RsaKeyGenParams extends Algorithm {\n modulusLength: number;\n publicExponent: Uint8Array;\n}\n\ninterface RsaHashedKeyGenParams extends RsaKeyGenParams {\n hash: AlgorithmIdentifier;\n}\n\ninterface RsaKeyAlgorithm extends KeyAlgorithm {\n modulusLength: number;\n publicExponent: Uint8Array;\n}\n\ninterface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm {\n hash: AlgorithmIdentifier;\n}\n\ninterface RsaHashedImportParams {\n hash: AlgorithmIdentifier;\n}\n\ninterface RsaPssParams {\n saltLength: number;\n}\n\ninterface RsaOaepParams extends Algorithm {\n label?: BufferSource;\n}\n\ninterface EcdsaParams extends Algorithm {\n hash: AlgorithmIdentifier;\n}\n\ninterface EcKeyGenParams extends Algorithm {\n namedCurve: string;\n}\n\ninterface EcKeyAlgorithm extends KeyAlgorithm {\n typedCurve: string;\n}\n\ninterface EcKeyImportParams {\n namedCurve: string;\n}\n\ninterface EcdhKeyDeriveParams extends Algorithm {\n public: CryptoKey;\n}\n\ninterface AesCtrParams extends Algorithm {\n counter: BufferSource;\n length: number;\n}\n\ninterface AesKeyAlgorithm extends KeyAlgorithm {\n length: number;\n}\n\ninterface AesKeyGenParams extends Algorithm {\n length: number;\n}\n\ninterface AesDerivedKeyParams extends Algorithm {\n length: number;\n}\n\ninterface AesCbcParams extends Algorithm {\n iv: BufferSource;\n}\n\ninterface AesCmacParams extends Algorithm {\n length: number;\n}\n\ninterface AesGcmParams extends Algorithm {\n iv: BufferSource;\n additionalData?: BufferSource;\n tagLength?: number;\n}\n\ninterface AesCfbParams extends Algorithm {\n iv: BufferSource;\n}\n\ninterface HmacImportParams extends Algorithm {\n hash?: AlgorithmIdentifier;\n length?: number;\n}\n\ninterface HmacKeyAlgorithm extends KeyAlgorithm {\n hash: AlgorithmIdentifier;\n length: number;\n}\n\ninterface HmacKeyGenParams extends Algorithm {\n hash: AlgorithmIdentifier;\n length?: number;\n}\n\ninterface DhKeyGenParams extends Algorithm {\n prime: Uint8Array;\n generator: Uint8Array;\n}\n\ninterface DhKeyAlgorithm extends KeyAlgorithm {\n prime: Uint8Array;\n generator: Uint8Array;\n}\n\ninterface DhKeyDeriveParams extends Algorithm {\n public: CryptoKey;\n}\n\ninterface DhImportKeyParams extends Algorithm {\n prime: Uint8Array;\n generator: Uint8Array;\n}\n\ninterface ConcatParams extends Algorithm {\n hash?: AlgorithmIdentifier;\n algorithmId: Uint8Array;\n partyUInfo: Uint8Array;\n partyVInfo: Uint8Array;\n publicInfo?: Uint8Array;\n privateInfo?: Uint8Array;\n}\n\ninterface HkdfCtrParams extends Algorithm {\n hash: AlgorithmIdentifier;\n label: BufferSource;\n context: BufferSource;\n}\n\ninterface Pbkdf2Params extends Algorithm {\n salt: BufferSource;\n iterations: number;\n hash: AlgorithmIdentifier;\n}\n\ninterface RsaOtherPrimesInfo {\n r: string;\n d: string;\n t: string;\n}\n\ninterface JsonWebKey {\n kty: string;\n use?: string;\n key_ops?: string[];\n alg?: string;\n kid?: string;\n x5u?: string;\n x5c?: string;\n x5t?: string;\n ext?: boolean;\n crv?: string;\n x?: string;\n y?: string;\n d?: string;\n n?: string;\n e?: string;\n p?: string;\n q?: string;\n dp?: string;\n dq?: string;\n qi?: string;\n oth?: RsaOtherPrimesInfo[];\n k?: string;\n}\n\ninterface ParentNode {\n readonly children: HTMLCollection;\n readonly firstElementChild: Element;\n readonly lastElementChild: Element;\n readonly childElementCount: number;\n}\n\ninterface DocumentOrShadowRoot {\n readonly activeElement: Element | null;\n readonly stylesheets: StyleSheetList;\n getSelection(): Selection | null;\n elementFromPoint(x: number, y: number): Element | null;\n elementsFromPoint(x: number, y: number): Element[];\n}\n\ninterface ShadowRoot extends DocumentOrShadowRoot, DocumentFragment {\n readonly host: Element;\n innerHTML: string;\n}\n\ninterface ShadowRootInit {\n mode: 'open'|'closed';\n delegatesFocus?: boolean;\n}\n\ninterface HTMLSlotElement extends HTMLElement {\n name: string;\n assignedNodes(options?: AssignedNodesOptions): Node[];\n}\n\ninterface AssignedNodesOptions {\n flatten?: boolean;\n}\n\ndeclare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;\n\ninterface ErrorEventHandler {\n (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void;\n}\ninterface PositionCallback {\n (position: Position): void;\n}\ninterface PositionErrorCallback {\n (error: PositionError): void;\n}\ninterface MediaQueryListListener {\n (mql: MediaQueryList): void;\n}\ninterface MSLaunchUriCallback {\n (): void;\n}\ninterface FrameRequestCallback {\n (time: number): void;\n}\ninterface MSUnsafeFunctionCallback {\n (): any;\n}\ninterface MSExecAtPriorityFunctionCallback {\n (...args: any[]): any;\n}\ninterface MutationCallback {\n (mutations: MutationRecord[], observer: MutationObserver): void;\n}\ninterface DecodeSuccessCallback {\n (decodedData: AudioBuffer): void;\n}\ninterface DecodeErrorCallback {\n (error: DOMException): void;\n}\ninterface FunctionStringCallback {\n (data: string): void;\n}\ninterface NavigatorUserMediaSuccessCallback {\n (stream: MediaStream): void;\n}\ninterface NavigatorUserMediaErrorCallback {\n (error: MediaStreamError): void;\n}\ninterface ForEachCallback {\n (keyId: any, status: string): void;\n}\ninterface HTMLElementTagNameMap {\n \"a\": HTMLAnchorElement;\n \"applet\": HTMLAppletElement;\n \"area\": HTMLAreaElement;\n \"audio\": HTMLAudioElement;\n \"base\": HTMLBaseElement;\n \"basefont\": HTMLBaseFontElement;\n \"blockquote\": HTMLQuoteElement;\n \"body\": HTMLBodyElement;\n \"br\": HTMLBRElement;\n \"button\": HTMLButtonElement;\n \"canvas\": HTMLCanvasElement;\n \"caption\": HTMLTableCaptionElement;\n \"col\": HTMLTableColElement;\n \"colgroup\": HTMLTableColElement;\n \"datalist\": HTMLDataListElement;\n \"del\": HTMLModElement;\n \"dir\": HTMLDirectoryElement;\n \"div\": HTMLDivElement;\n \"dl\": HTMLDListElement;\n \"embed\": HTMLEmbedElement;\n \"fieldset\": HTMLFieldSetElement;\n \"font\": HTMLFontElement;\n \"form\": HTMLFormElement;\n \"frame\": HTMLFrameElement;\n \"frameset\": HTMLFrameSetElement;\n \"h1\": HTMLHeadingElement;\n \"h2\": HTMLHeadingElement;\n \"h3\": HTMLHeadingElement;\n \"h4\": HTMLHeadingElement;\n \"h5\": HTMLHeadingElement;\n \"h6\": HTMLHeadingElement;\n \"head\": HTMLHeadElement;\n \"hr\": HTMLHRElement;\n \"html\": HTMLHtmlElement;\n \"iframe\": HTMLIFrameElement;\n \"img\": HTMLImageElement;\n \"input\": HTMLInputElement;\n \"ins\": HTMLModElement;\n \"isindex\": HTMLUnknownElement;\n \"label\": HTMLLabelElement;\n \"legend\": HTMLLegendElement;\n \"li\": HTMLLIElement;\n \"link\": HTMLLinkElement;\n \"listing\": HTMLPreElement;\n \"map\": HTMLMapElement;\n \"marquee\": HTMLMarqueeElement;\n \"menu\": HTMLMenuElement;\n \"meta\": HTMLMetaElement;\n \"meter\": HTMLMeterElement;\n \"nextid\": HTMLUnknownElement;\n \"object\": HTMLObjectElement;\n \"ol\": HTMLOListElement;\n \"optgroup\": HTMLOptGroupElement;\n \"option\": HTMLOptionElement;\n \"p\": HTMLParagraphElement;\n \"param\": HTMLParamElement;\n \"picture\": HTMLPictureElement;\n \"pre\": HTMLPreElement;\n \"progress\": HTMLProgressElement;\n \"q\": HTMLQuoteElement;\n \"script\": HTMLScriptElement;\n \"select\": HTMLSelectElement;\n \"source\": HTMLSourceElement;\n \"span\": HTMLSpanElement;\n \"style\": HTMLStyleElement;\n \"table\": HTMLTableElement;\n \"tbody\": HTMLTableSectionElement;\n \"td\": HTMLTableDataCellElement;\n \"template\": HTMLTemplateElement;\n \"textarea\": HTMLTextAreaElement;\n \"tfoot\": HTMLTableSectionElement;\n \"th\": HTMLTableHeaderCellElement;\n \"thead\": HTMLTableSectionElement;\n \"title\": HTMLTitleElement;\n \"tr\": HTMLTableRowElement;\n \"track\": HTMLTrackElement;\n \"ul\": HTMLUListElement;\n \"video\": HTMLVideoElement;\n \"x-ms-webview\": MSHTMLWebViewElement;\n \"xmp\": HTMLPreElement;\n}\n\ninterface ElementTagNameMap {\n \"a\": HTMLAnchorElement;\n \"abbr\": HTMLElement;\n \"acronym\": HTMLElement;\n \"address\": HTMLElement;\n \"applet\": HTMLAppletElement;\n \"area\": HTMLAreaElement;\n \"article\": HTMLElement;\n \"aside\": HTMLElement;\n \"audio\": HTMLAudioElement;\n \"b\": HTMLElement;\n \"base\": HTMLBaseElement;\n \"basefont\": HTMLBaseFontElement;\n \"bdo\": HTMLElement;\n \"big\": HTMLElement;\n \"blockquote\": HTMLQuoteElement;\n \"body\": HTMLBodyElement;\n \"br\": HTMLBRElement;\n \"button\": HTMLButtonElement;\n \"canvas\": HTMLCanvasElement;\n \"caption\": HTMLTableCaptionElement;\n \"center\": HTMLElement;\n \"circle\": SVGCircleElement;\n \"cite\": HTMLElement;\n \"clippath\": SVGClipPathElement;\n \"code\": HTMLElement;\n \"col\": HTMLTableColElement;\n \"colgroup\": HTMLTableColElement;\n \"datalist\": HTMLDataListElement;\n \"dd\": HTMLElement;\n \"defs\": SVGDefsElement;\n \"del\": HTMLModElement;\n \"desc\": SVGDescElement;\n \"dfn\": HTMLElement;\n \"dir\": HTMLDirectoryElement;\n \"div\": HTMLDivElement;\n \"dl\": HTMLDListElement;\n \"dt\": HTMLElement;\n \"ellipse\": SVGEllipseElement;\n \"em\": HTMLElement;\n \"embed\": HTMLEmbedElement;\n \"feblend\": SVGFEBlendElement;\n \"fecolormatrix\": SVGFEColorMatrixElement;\n \"fecomponenttransfer\": SVGFEComponentTransferElement;\n \"fecomposite\": SVGFECompositeElement;\n \"feconvolvematrix\": SVGFEConvolveMatrixElement;\n \"fediffuselighting\": SVGFEDiffuseLightingElement;\n \"fedisplacementmap\": SVGFEDisplacementMapElement;\n \"fedistantlight\": SVGFEDistantLightElement;\n \"feflood\": SVGFEFloodElement;\n \"fefunca\": SVGFEFuncAElement;\n \"fefuncb\": SVGFEFuncBElement;\n \"fefuncg\": SVGFEFuncGElement;\n \"fefuncr\": SVGFEFuncRElement;\n \"fegaussianblur\": SVGFEGaussianBlurElement;\n \"feimage\": SVGFEImageElement;\n \"femerge\": SVGFEMergeElement;\n \"femergenode\": SVGFEMergeNodeElement;\n \"femorphology\": SVGFEMorphologyElement;\n \"feoffset\": SVGFEOffsetElement;\n \"fepointlight\": SVGFEPointLightElement;\n \"fespecularlighting\": SVGFESpecularLightingElement;\n \"fespotlight\": SVGFESpotLightElement;\n \"fetile\": SVGFETileElement;\n \"feturbulence\": SVGFETurbulenceElement;\n \"fieldset\": HTMLFieldSetElement;\n \"figcaption\": HTMLElement;\n \"figure\": HTMLElement;\n \"filter\": SVGFilterElement;\n \"font\": HTMLFontElement;\n \"footer\": HTMLElement;\n \"foreignobject\": SVGForeignObjectElement;\n \"form\": HTMLFormElement;\n \"frame\": HTMLFrameElement;\n \"frameset\": HTMLFrameSetElement;\n \"g\": SVGGElement;\n \"h1\": HTMLHeadingElement;\n \"h2\": HTMLHeadingElement;\n \"h3\": HTMLHeadingElement;\n \"h4\": HTMLHeadingElement;\n \"h5\": HTMLHeadingElement;\n \"h6\": HTMLHeadingElement;\n \"head\": HTMLHeadElement;\n \"header\": HTMLElement;\n \"hgroup\": HTMLElement;\n \"hr\": HTMLHRElement;\n \"html\": HTMLHtmlElement;\n \"i\": HTMLElement;\n \"iframe\": HTMLIFrameElement;\n \"image\": SVGImageElement;\n \"img\": HTMLImageElement;\n \"input\": HTMLInputElement;\n \"ins\": HTMLModElement;\n \"isindex\": HTMLUnknownElement;\n \"kbd\": HTMLElement;\n \"keygen\": HTMLElement;\n \"label\": HTMLLabelElement;\n \"legend\": HTMLLegendElement;\n \"li\": HTMLLIElement;\n \"line\": SVGLineElement;\n \"lineargradient\": SVGLinearGradientElement;\n \"link\": HTMLLinkElement;\n \"listing\": HTMLPreElement;\n \"map\": HTMLMapElement;\n \"mark\": HTMLElement;\n \"marker\": SVGMarkerElement;\n \"marquee\": HTMLMarqueeElement;\n \"mask\": SVGMaskElement;\n \"menu\": HTMLMenuElement;\n \"meta\": HTMLMetaElement;\n \"metadata\": SVGMetadataElement;\n \"meter\": HTMLMeterElement;\n \"nav\": HTMLElement;\n \"nextid\": HTMLUnknownElement;\n \"nobr\": HTMLElement;\n \"noframes\": HTMLElement;\n \"noscript\": HTMLElement;\n \"object\": HTMLObjectElement;\n \"ol\": HTMLOListElement;\n \"optgroup\": HTMLOptGroupElement;\n \"option\": HTMLOptionElement;\n \"p\": HTMLParagraphElement;\n \"param\": HTMLParamElement;\n \"path\": SVGPathElement;\n \"pattern\": SVGPatternElement;\n \"picture\": HTMLPictureElement;\n \"plaintext\": HTMLElement;\n \"polygon\": SVGPolygonElement;\n \"polyline\": SVGPolylineElement;\n \"pre\": HTMLPreElement;\n \"progress\": HTMLProgressElement;\n \"q\": HTMLQuoteElement;\n \"radialgradient\": SVGRadialGradientElement;\n \"rect\": SVGRectElement;\n \"rt\": HTMLElement;\n \"ruby\": HTMLElement;\n \"s\": HTMLElement;\n \"samp\": HTMLElement;\n \"script\": HTMLScriptElement;\n \"section\": HTMLElement;\n \"select\": HTMLSelectElement;\n \"small\": HTMLElement;\n \"source\": HTMLSourceElement;\n \"span\": HTMLSpanElement;\n \"stop\": SVGStopElement;\n \"strike\": HTMLElement;\n \"strong\": HTMLElement;\n \"style\": HTMLStyleElement;\n \"sub\": HTMLElement;\n \"sup\": HTMLElement;\n \"svg\": SVGSVGElement;\n \"switch\": SVGSwitchElement;\n \"symbol\": SVGSymbolElement;\n \"table\": HTMLTableElement;\n \"tbody\": HTMLTableSectionElement;\n \"td\": HTMLTableDataCellElement;\n \"template\": HTMLTemplateElement;\n \"text\": SVGTextElement;\n \"textpath\": SVGTextPathElement;\n \"textarea\": HTMLTextAreaElement;\n \"tfoot\": HTMLTableSectionElement;\n \"th\": HTMLTableHeaderCellElement;\n \"thead\": HTMLTableSectionElement;\n \"title\": HTMLTitleElement;\n \"tr\": HTMLTableRowElement;\n \"track\": HTMLTrackElement;\n \"tspan\": SVGTSpanElement;\n \"tt\": HTMLElement;\n \"u\": HTMLElement;\n \"ul\": HTMLUListElement;\n \"use\": SVGUseElement;\n \"var\": HTMLElement;\n \"video\": HTMLVideoElement;\n \"view\": SVGViewElement;\n \"wbr\": HTMLElement;\n \"x-ms-webview\": MSHTMLWebViewElement;\n \"xmp\": HTMLPreElement;\n}\n\ninterface ElementListTagNameMap {\n \"a\": NodeListOf;\n \"abbr\": NodeListOf;\n \"acronym\": NodeListOf;\n \"address\": NodeListOf;\n \"applet\": NodeListOf;\n \"area\": NodeListOf;\n \"article\": NodeListOf;\n \"aside\": NodeListOf;\n \"audio\": NodeListOf;\n \"b\": NodeListOf;\n \"base\": NodeListOf;\n \"basefont\": NodeListOf;\n \"bdo\": NodeListOf;\n \"big\": NodeListOf;\n \"blockquote\": NodeListOf;\n \"body\": NodeListOf;\n \"br\": NodeListOf;\n \"button\": NodeListOf;\n \"canvas\": NodeListOf;\n \"caption\": NodeListOf;\n \"center\": NodeListOf;\n \"circle\": NodeListOf;\n \"cite\": NodeListOf;\n \"clippath\": NodeListOf;\n \"code\": NodeListOf;\n \"col\": NodeListOf;\n \"colgroup\": NodeListOf;\n \"datalist\": NodeListOf;\n \"dd\": NodeListOf;\n \"defs\": NodeListOf;\n \"del\": NodeListOf;\n \"desc\": NodeListOf;\n \"dfn\": NodeListOf;\n \"dir\": NodeListOf;\n \"div\": NodeListOf;\n \"dl\": NodeListOf;\n \"dt\": NodeListOf;\n \"ellipse\": NodeListOf;\n \"em\": NodeListOf;\n \"embed\": NodeListOf;\n \"feblend\": NodeListOf;\n \"fecolormatrix\": NodeListOf;\n \"fecomponenttransfer\": NodeListOf;\n \"fecomposite\": NodeListOf;\n \"feconvolvematrix\": NodeListOf;\n \"fediffuselighting\": NodeListOf;\n \"fedisplacementmap\": NodeListOf;\n \"fedistantlight\": NodeListOf;\n \"feflood\": NodeListOf;\n \"fefunca\": NodeListOf;\n \"fefuncb\": NodeListOf;\n \"fefuncg\": NodeListOf;\n \"fefuncr\": NodeListOf;\n \"fegaussianblur\": NodeListOf;\n \"feimage\": NodeListOf;\n \"femerge\": NodeListOf;\n \"femergenode\": NodeListOf;\n \"femorphology\": NodeListOf;\n \"feoffset\": NodeListOf;\n \"fepointlight\": NodeListOf;\n \"fespecularlighting\": NodeListOf;\n \"fespotlight\": NodeListOf;\n \"fetile\": NodeListOf;\n \"feturbulence\": NodeListOf;\n \"fieldset\": NodeListOf;\n \"figcaption\": NodeListOf;\n \"figure\": NodeListOf;\n \"filter\": NodeListOf;\n \"font\": NodeListOf;\n \"footer\": NodeListOf;\n \"foreignobject\": NodeListOf;\n \"form\": NodeListOf;\n \"frame\": NodeListOf;\n \"frameset\": NodeListOf;\n \"g\": NodeListOf;\n \"h1\": NodeListOf;\n \"h2\": NodeListOf;\n \"h3\": NodeListOf;\n \"h4\": NodeListOf;\n \"h5\": NodeListOf;\n \"h6\": NodeListOf;\n \"head\": NodeListOf;\n \"header\": NodeListOf;\n \"hgroup\": NodeListOf;\n \"hr\": NodeListOf;\n \"html\": NodeListOf;\n \"i\": NodeListOf;\n \"iframe\": NodeListOf;\n \"image\": NodeListOf;\n \"img\": NodeListOf;\n \"input\": NodeListOf;\n \"ins\": NodeListOf;\n \"isindex\": NodeListOf;\n \"kbd\": NodeListOf;\n \"keygen\": NodeListOf;\n \"label\": NodeListOf;\n \"legend\": NodeListOf;\n \"li\": NodeListOf;\n \"line\": NodeListOf;\n \"lineargradient\": NodeListOf;\n \"link\": NodeListOf;\n \"listing\": NodeListOf;\n \"map\": NodeListOf;\n \"mark\": NodeListOf;\n \"marker\": NodeListOf;\n \"marquee\": NodeListOf;\n \"mask\": NodeListOf;\n \"menu\": NodeListOf;\n \"meta\": NodeListOf;\n \"metadata\": NodeListOf;\n \"meter\": NodeListOf;\n \"nav\": NodeListOf;\n \"nextid\": NodeListOf;\n \"nobr\": NodeListOf;\n \"noframes\": NodeListOf;\n \"noscript\": NodeListOf;\n \"object\": NodeListOf;\n \"ol\": NodeListOf;\n \"optgroup\": NodeListOf;\n \"option\": NodeListOf;\n \"p\": NodeListOf;\n \"param\": NodeListOf;\n \"path\": NodeListOf;\n \"pattern\": NodeListOf;\n \"picture\": NodeListOf;\n \"plaintext\": NodeListOf;\n \"polygon\": NodeListOf;\n \"polyline\": NodeListOf;\n \"pre\": NodeListOf;\n \"progress\": NodeListOf;\n \"q\": NodeListOf;\n \"radialgradient\": NodeListOf;\n \"rect\": NodeListOf;\n \"rt\": NodeListOf;\n \"ruby\": NodeListOf;\n \"s\": NodeListOf;\n \"samp\": NodeListOf;\n \"script\": NodeListOf;\n \"section\": NodeListOf;\n \"select\": NodeListOf;\n \"small\": NodeListOf;\n \"source\": NodeListOf;\n \"span\": NodeListOf;\n \"stop\": NodeListOf;\n \"strike\": NodeListOf;\n \"strong\": NodeListOf;\n \"style\": NodeListOf;\n \"sub\": NodeListOf;\n \"sup\": NodeListOf;\n \"svg\": NodeListOf;\n \"switch\": NodeListOf;\n \"symbol\": NodeListOf;\n \"table\": NodeListOf;\n \"tbody\": NodeListOf;\n \"td\": NodeListOf;\n \"template\": NodeListOf;\n \"text\": NodeListOf;\n \"textpath\": NodeListOf;\n \"textarea\": NodeListOf;\n \"tfoot\": NodeListOf;\n \"th\": NodeListOf;\n \"thead\": NodeListOf;\n \"title\": NodeListOf;\n \"tr\": NodeListOf;\n \"track\": NodeListOf;\n \"tspan\": NodeListOf;\n \"tt\": NodeListOf;\n \"u\": NodeListOf;\n \"ul\": NodeListOf;\n \"use\": NodeListOf;\n \"var\": NodeListOf;\n \"video\": NodeListOf;\n \"view\": NodeListOf;\n \"wbr\": NodeListOf;\n \"x-ms-webview\": NodeListOf;\n \"xmp\": NodeListOf;\n}\n\ndeclare var Audio: {new(src?: string): HTMLAudioElement; };\ndeclare var Image: {new(width?: number, height?: number): HTMLImageElement; };\ndeclare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; };\ndeclare var applicationCache: ApplicationCache;\ndeclare var clientInformation: Navigator;\ndeclare var closed: boolean;\ndeclare var crypto: Crypto;\ndeclare var defaultStatus: string;\ndeclare var devicePixelRatio: number;\ndeclare var doNotTrack: string;\ndeclare var document: Document;\ndeclare var event: Event | undefined;\ndeclare var external: External;\ndeclare var frameElement: Element;\ndeclare var frames: Window;\ndeclare var history: History;\ndeclare var innerHeight: number;\ndeclare var innerWidth: number;\ndeclare var length: number;\ndeclare var location: Location;\ndeclare var locationbar: BarProp;\ndeclare var menubar: BarProp;\ndeclare var msCredentials: MSCredentials;\ndeclare const name: never;\ndeclare var navigator: Navigator;\ndeclare var offscreenBuffering: string | boolean;\ndeclare var onabort: (this: Window, ev: UIEvent) => any;\ndeclare var onafterprint: (this: Window, ev: Event) => any;\ndeclare var onbeforeprint: (this: Window, ev: Event) => any;\ndeclare var onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any;\ndeclare var onblur: (this: Window, ev: FocusEvent) => any;\ndeclare var oncanplay: (this: Window, ev: Event) => any;\ndeclare var oncanplaythrough: (this: Window, ev: Event) => any;\ndeclare var onchange: (this: Window, ev: Event) => any;\ndeclare var onclick: (this: Window, ev: MouseEvent) => any;\ndeclare var oncompassneedscalibration: (this: Window, ev: Event) => any;\ndeclare var oncontextmenu: (this: Window, ev: PointerEvent) => any;\ndeclare var ondblclick: (this: Window, ev: MouseEvent) => any;\ndeclare var ondevicelight: (this: Window, ev: DeviceLightEvent) => any;\ndeclare var ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any;\ndeclare var ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any;\ndeclare var ondrag: (this: Window, ev: DragEvent) => any;\ndeclare var ondragend: (this: Window, ev: DragEvent) => any;\ndeclare var ondragenter: (this: Window, ev: DragEvent) => any;\ndeclare var ondragleave: (this: Window, ev: DragEvent) => any;\ndeclare var ondragover: (this: Window, ev: DragEvent) => any;\ndeclare var ondragstart: (this: Window, ev: DragEvent) => any;\ndeclare var ondrop: (this: Window, ev: DragEvent) => any;\ndeclare var ondurationchange: (this: Window, ev: Event) => any;\ndeclare var onemptied: (this: Window, ev: Event) => any;\ndeclare var onended: (this: Window, ev: MediaStreamErrorEvent) => any;\ndeclare var onerror: ErrorEventHandler;\ndeclare var onfocus: (this: Window, ev: FocusEvent) => any;\ndeclare var onhashchange: (this: Window, ev: HashChangeEvent) => any;\ndeclare var oninput: (this: Window, ev: Event) => any;\ndeclare var oninvalid: (this: Window, ev: Event) => any;\ndeclare var onkeydown: (this: Window, ev: KeyboardEvent) => any;\ndeclare var onkeypress: (this: Window, ev: KeyboardEvent) => any;\ndeclare var onkeyup: (this: Window, ev: KeyboardEvent) => any;\ndeclare var onload: (this: Window, ev: Event) => any;\ndeclare var onloadeddata: (this: Window, ev: Event) => any;\ndeclare var onloadedmetadata: (this: Window, ev: Event) => any;\ndeclare var onloadstart: (this: Window, ev: Event) => any;\ndeclare var onmessage: (this: Window, ev: MessageEvent) => any;\ndeclare var onmousedown: (this: Window, ev: MouseEvent) => any;\ndeclare var onmouseenter: (this: Window, ev: MouseEvent) => any;\ndeclare var onmouseleave: (this: Window, ev: MouseEvent) => any;\ndeclare var onmousemove: (this: Window, ev: MouseEvent) => any;\ndeclare var onmouseout: (this: Window, ev: MouseEvent) => any;\ndeclare var onmouseover: (this: Window, ev: MouseEvent) => any;\ndeclare var onmouseup: (this: Window, ev: MouseEvent) => any;\ndeclare var onmousewheel: (this: Window, ev: WheelEvent) => any;\ndeclare var onmsgesturechange: (this: Window, ev: MSGestureEvent) => any;\ndeclare var onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any;\ndeclare var onmsgestureend: (this: Window, ev: MSGestureEvent) => any;\ndeclare var onmsgesturehold: (this: Window, ev: MSGestureEvent) => any;\ndeclare var onmsgesturestart: (this: Window, ev: MSGestureEvent) => any;\ndeclare var onmsgesturetap: (this: Window, ev: MSGestureEvent) => any;\ndeclare var onmsinertiastart: (this: Window, ev: MSGestureEvent) => any;\ndeclare var onmspointercancel: (this: Window, ev: MSPointerEvent) => any;\ndeclare var onmspointerdown: (this: Window, ev: MSPointerEvent) => any;\ndeclare var onmspointerenter: (this: Window, ev: MSPointerEvent) => any;\ndeclare var onmspointerleave: (this: Window, ev: MSPointerEvent) => any;\ndeclare var onmspointermove: (this: Window, ev: MSPointerEvent) => any;\ndeclare var onmspointerout: (this: Window, ev: MSPointerEvent) => any;\ndeclare var onmspointerover: (this: Window, ev: MSPointerEvent) => any;\ndeclare var onmspointerup: (this: Window, ev: MSPointerEvent) => any;\ndeclare var onoffline: (this: Window, ev: Event) => any;\ndeclare var ononline: (this: Window, ev: Event) => any;\ndeclare var onorientationchange: (this: Window, ev: Event) => any;\ndeclare var onpagehide: (this: Window, ev: PageTransitionEvent) => any;\ndeclare var onpageshow: (this: Window, ev: PageTransitionEvent) => any;\ndeclare var onpause: (this: Window, ev: Event) => any;\ndeclare var onplay: (this: Window, ev: Event) => any;\ndeclare var onplaying: (this: Window, ev: Event) => any;\ndeclare var onpopstate: (this: Window, ev: PopStateEvent) => any;\ndeclare var onprogress: (this: Window, ev: ProgressEvent) => any;\ndeclare var onratechange: (this: Window, ev: Event) => any;\ndeclare var onreadystatechange: (this: Window, ev: ProgressEvent) => any;\ndeclare var onreset: (this: Window, ev: Event) => any;\ndeclare var onresize: (this: Window, ev: UIEvent) => any;\ndeclare var onscroll: (this: Window, ev: UIEvent) => any;\ndeclare var onseeked: (this: Window, ev: Event) => any;\ndeclare var onseeking: (this: Window, ev: Event) => any;\ndeclare var onselect: (this: Window, ev: UIEvent) => any;\ndeclare var onstalled: (this: Window, ev: Event) => any;\ndeclare var onstorage: (this: Window, ev: StorageEvent) => any;\ndeclare var onsubmit: (this: Window, ev: Event) => any;\ndeclare var onsuspend: (this: Window, ev: Event) => any;\ndeclare var ontimeupdate: (this: Window, ev: Event) => any;\ndeclare var ontouchcancel: (ev: TouchEvent) => any;\ndeclare var ontouchend: (ev: TouchEvent) => any;\ndeclare var ontouchmove: (ev: TouchEvent) => any;\ndeclare var ontouchstart: (ev: TouchEvent) => any;\ndeclare var onunload: (this: Window, ev: Event) => any;\ndeclare var onvolumechange: (this: Window, ev: Event) => any;\ndeclare var onwaiting: (this: Window, ev: Event) => any;\ndeclare var opener: any;\ndeclare var orientation: string | number;\ndeclare var outerHeight: number;\ndeclare var outerWidth: number;\ndeclare var pageXOffset: number;\ndeclare var pageYOffset: number;\ndeclare var parent: Window;\ndeclare var performance: Performance;\ndeclare var personalbar: BarProp;\ndeclare var screen: Screen;\ndeclare var screenLeft: number;\ndeclare var screenTop: number;\ndeclare var screenX: number;\ndeclare var screenY: number;\ndeclare var scrollX: number;\ndeclare var scrollY: number;\ndeclare var scrollbars: BarProp;\ndeclare var self: Window;\ndeclare var status: string;\ndeclare var statusbar: BarProp;\ndeclare var styleMedia: StyleMedia;\ndeclare var toolbar: BarProp;\ndeclare var top: Window;\ndeclare var window: Window;\ndeclare function alert(message?: any): void;\ndeclare function blur(): void;\ndeclare function cancelAnimationFrame(handle: number): void;\ndeclare function captureEvents(): void;\ndeclare function close(): void;\ndeclare function confirm(message?: string): boolean;\ndeclare function focus(): void;\ndeclare function getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration;\ndeclare function getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList;\ndeclare function getSelection(): Selection;\ndeclare function matchMedia(mediaQuery: string): MediaQueryList;\ndeclare function moveBy(x?: number, y?: number): void;\ndeclare function moveTo(x?: number, y?: number): void;\ndeclare function msWriteProfilerMark(profilerMarkName: string): void;\ndeclare function open(url?: string, target?: string, features?: string, replace?: boolean): Window;\ndeclare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void;\ndeclare function print(): void;\ndeclare function prompt(message?: string, _default?: string): string | null;\ndeclare function releaseEvents(): void;\ndeclare function requestAnimationFrame(callback: FrameRequestCallback): number;\ndeclare function resizeBy(x?: number, y?: number): void;\ndeclare function resizeTo(x?: number, y?: number): void;\ndeclare function scroll(x?: number, y?: number): void;\ndeclare function scrollBy(x?: number, y?: number): void;\ndeclare function scrollTo(x?: number, y?: number): void;\ndeclare function webkitCancelAnimationFrame(handle: number): void;\ndeclare function webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint;\ndeclare function webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint;\ndeclare function webkitRequestAnimationFrame(callback: FrameRequestCallback): number;\ndeclare function scroll(options?: ScrollToOptions): void;\ndeclare function scrollTo(options?: ScrollToOptions): void;\ndeclare function scrollBy(options?: ScrollToOptions): void;\ndeclare function toString(): string;\ndeclare function dispatchEvent(evt: Event): boolean;\ndeclare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;\ndeclare function clearInterval(handle: number): void;\ndeclare function clearTimeout(handle: number): void;\ndeclare function setInterval(handler: (...args: any[]) => void, timeout: number): number;\ndeclare function setInterval(handler: any, timeout?: any, ...args: any[]): number;\ndeclare function setTimeout(handler: (...args: any[]) => void, timeout: number): number;\ndeclare function setTimeout(handler: any, timeout?: any, ...args: any[]): number;\ndeclare function clearImmediate(handle: number): void;\ndeclare function setImmediate(handler: (...args: any[]) => void): number;\ndeclare function setImmediate(handler: any, ...args: any[]): number;\ndeclare var sessionStorage: Storage;\ndeclare var localStorage: Storage;\ndeclare var console: Console;\ndeclare var onpointercancel: (this: Window, ev: PointerEvent) => any;\ndeclare var onpointerdown: (this: Window, ev: PointerEvent) => any;\ndeclare var onpointerenter: (this: Window, ev: PointerEvent) => any;\ndeclare var onpointerleave: (this: Window, ev: PointerEvent) => any;\ndeclare var onpointermove: (this: Window, ev: PointerEvent) => any;\ndeclare var onpointerout: (this: Window, ev: PointerEvent) => any;\ndeclare var onpointerover: (this: Window, ev: PointerEvent) => any;\ndeclare var onpointerup: (this: Window, ev: PointerEvent) => any;\ndeclare var onwheel: (this: Window, ev: WheelEvent) => any;\ndeclare var indexedDB: IDBFactory;\ndeclare function atob(encodedString: string): string;\ndeclare function btoa(rawString: string): string;\ndeclare function addEventListener(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void;\ndeclare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\ntype AAGUID = string;\ntype AlgorithmIdentifier = string | Algorithm;\ntype ConstrainBoolean = boolean | ConstrainBooleanParameters;\ntype ConstrainDOMString = string | string[] | ConstrainDOMStringParameters;\ntype ConstrainDouble = number | ConstrainDoubleRange;\ntype ConstrainLong = number | ConstrainLongRange;\ntype CryptoOperationData = ArrayBufferView;\ntype GLbitfield = number;\ntype GLboolean = boolean;\ntype GLbyte = number;\ntype GLclampf = number;\ntype GLenum = number;\ntype GLfloat = number;\ntype GLint = number;\ntype GLintptr = number;\ntype GLshort = number;\ntype GLsizei = number;\ntype GLsizeiptr = number;\ntype GLubyte = number;\ntype GLuint = number;\ntype GLushort = number;\ntype IDBKeyPath = string;\ntype KeyFormat = string;\ntype KeyType = string;\ntype KeyUsage = string;\ntype MSInboundPayload = MSVideoRecvPayload | MSAudioRecvPayload;\ntype MSLocalClientEvent = MSLocalClientEventBase | MSAudioLocalClientEvent;\ntype MSOutboundPayload = MSVideoSendPayload | MSAudioSendPayload;\ntype RTCIceGatherCandidate = RTCIceCandidate | RTCIceCandidateComplete;\ntype RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport;\ntype payloadtype = number;\ntype ScrollBehavior = \"auto\" | \"instant\" | \"smooth\";\ntype ScrollLogicalPosition = \"start\" | \"center\" | \"end\" | \"nearest\";\ntype IDBValidKey = number | string | Date | IDBArrayKey;\ntype BufferSource = ArrayBuffer | ArrayBufferView;\ntype MouseWheelEvent = WheelEvent;\ntype ScrollRestoration = \"auto\" | \"manual\";\n\n\n/////////////////////////////\n/// WorkerGlobalScope APIs \n/////////////////////////////\n// These are only available in a Web Worker \ndeclare function importScripts(...urls: string[]): void;\n\n\n\n\n/////////////////////////////\n/// Windows Script Host APIS\n/////////////////////////////\n\n\ninterface ActiveXObject {\n new (s: string): any;\n}\ndeclare var ActiveXObject: ActiveXObject;\n\ninterface ITextWriter {\n Write(s: string): void;\n WriteLine(s: string): void;\n Close(): void;\n}\n\ninterface TextStreamBase {\n /**\n * The column number of the current character position in an input stream.\n */\n Column: number;\n\n /**\n * The current line number in an input stream.\n */\n Line: number;\n\n /**\n * Closes a text stream.\n * It is not necessary to close standard streams; they close automatically when the process ends. If \n * you close a standard stream, be aware that any other pointers to that standard stream become invalid.\n */\n Close(): void;\n}\n\ninterface TextStreamWriter extends TextStreamBase {\n /**\n * Sends a string to an output stream.\n */\n Write(s: string): void;\n\n /**\n * Sends a specified number of blank lines (newline characters) to an output stream.\n */\n WriteBlankLines(intLines: number): void;\n\n /**\n * Sends a string followed by a newline character to an output stream.\n */\n WriteLine(s: string): void;\n}\n\ninterface TextStreamReader extends TextStreamBase {\n /**\n * Returns a specified number of characters from an input stream, starting at the current pointer position.\n * Does not return until the ENTER key is pressed.\n * Can only be used on a stream in reading mode; causes an error in writing or appending mode.\n */\n Read(characters: number): string;\n\n /**\n * Returns all characters from an input stream.\n * Can only be used on a stream in reading mode; causes an error in writing or appending mode.\n */\n ReadAll(): string;\n\n /**\n * Returns an entire line from an input stream.\n * Although this method extracts the newline character, it does not add it to the returned string.\n * Can only be used on a stream in reading mode; causes an error in writing or appending mode.\n */\n ReadLine(): string;\n\n /**\n * Skips a specified number of characters when reading from an input text stream.\n * Can only be used on a stream in reading mode; causes an error in writing or appending mode.\n * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.)\n */\n Skip(characters: number): void;\n\n /**\n * Skips the next line when reading from an input text stream.\n * Can only be used on a stream in reading mode, not writing or appending mode.\n */\n SkipLine(): void;\n\n /**\n * Indicates whether the stream pointer position is at the end of a line.\n */\n AtEndOfLine: boolean;\n\n /**\n * Indicates whether the stream pointer position is at the end of a stream.\n */\n AtEndOfStream: boolean;\n}\n\ndeclare var WScript: {\n /**\n * Outputs text to either a message box (under WScript.exe) or the command console window followed by\n * a newline (under CScript.exe).\n */\n Echo(s: any): void;\n\n /**\n * Exposes the write-only error output stream for the current script.\n * Can be accessed only while using CScript.exe.\n */\n StdErr: TextStreamWriter;\n\n /**\n * Exposes the write-only output stream for the current script.\n * Can be accessed only while using CScript.exe.\n */\n StdOut: TextStreamWriter;\n Arguments: { length: number; Item(n: number): string; };\n\n /**\n * The full path of the currently running script.\n */\n ScriptFullName: string;\n\n /**\n * Forces the script to stop immediately, with an optional exit code.\n */\n Quit(exitCode?: number): number;\n\n /**\n * The Windows Script Host build version number.\n */\n BuildVersion: number;\n\n /**\n * Fully qualified path of the host executable.\n */\n FullName: string;\n\n /**\n * Gets/sets the script mode - interactive(true) or batch(false).\n */\n Interactive: boolean;\n\n /**\n * The name of the host executable (WScript.exe or CScript.exe).\n */\n Name: string;\n\n /**\n * Path of the directory containing the host executable.\n */\n Path: string;\n\n /**\n * The filename of the currently running script.\n */\n ScriptName: string;\n\n /**\n * Exposes the read-only input stream for the current script.\n * Can be accessed only while using CScript.exe.\n */\n StdIn: TextStreamReader;\n\n /**\n * Windows Script Host version\n */\n Version: string;\n\n /**\n * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event.\n */\n ConnectObject(objEventSource: any, strPrefix: string): void;\n\n /**\n * Creates a COM object.\n * @param strProgiID\n * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.\n */\n CreateObject(strProgID: string, strPrefix?: string): any;\n\n /**\n * Disconnects a COM object from its event sources.\n */\n DisconnectObject(obj: any): void;\n\n /**\n * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file.\n * @param strPathname Fully qualified path to the file containing the object persisted to disk.\n * For objects in memory, pass a zero-length string.\n * @param strProgID\n * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.\n */\n GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any;\n\n /**\n * Suspends script execution for a specified length of time, then continues execution.\n * @param intTime Interval (in milliseconds) to suspend script execution.\n */\n Sleep(intTime: number): void;\n};\n\n/**\n * Allows enumerating over a COM collection, which may not have indexed item access.\n */\ninterface Enumerator {\n /**\n * Returns true if the current item is the last one in the collection, or the collection is empty,\n * or the current item is undefined.\n */\n atEnd(): boolean;\n\n /**\n * Returns the current item in the collection\n */\n item(): T;\n\n /**\n * Resets the current item in the collection to the first item. If there are no items in the collection,\n * the current item is set to undefined.\n */\n moveFirst(): void;\n\n /**\n * Moves the current item to the next item in the collection. If the enumerator is at the end of\n * the collection or the collection is empty, the current item is set to undefined.\n */\n moveNext(): void;\n}\n\ninterface EnumeratorConstructor {\n new (collection: any): Enumerator;\n new (collection: any): Enumerator;\n}\n\ndeclare var Enumerator: EnumeratorConstructor;\n\n/**\n * Enables reading from a COM safe array, which might have an alternate lower bound, or multiple dimensions.\n */\ninterface VBArray {\n /**\n * Returns the number of dimensions (1-based).\n */\n dimensions(): number;\n\n /**\n * Takes an index for each dimension in the array, and returns the item at the corresponding location.\n */\n getItem(dimension1Index: number, ...dimensionNIndexes: number[]): T;\n\n /**\n * Returns the smallest available index for a given dimension.\n * @param dimension 1-based dimension (defaults to 1)\n */\n lbound(dimension?: number): number;\n\n /**\n * Returns the largest available index for a given dimension.\n * @param dimension 1-based dimension (defaults to 1)\n */\n ubound(dimension?: number): number;\n\n /**\n * Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions,\n * each successive dimension is appended to the end of the array.\n * Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6]\n */\n toArray(): T[];\n}\n\ninterface VBArrayConstructor {\n new (safeArray: any): VBArray;\n new (safeArray: any): VBArray;\n}\n\ndeclare var VBArray: VBArrayConstructor;\n\n/**\n * Automation date (VT_DATE)\n */\ninterface VarDate { }\n\ninterface DateConstructor {\n new (vd: VarDate): Date;\n}\n\ninterface Date {\n getVarDate: () => VarDate;\n}\n\n\n/// \n\ninterface DOMTokenList {\n [Symbol.iterator](): IterableIterator;\n}\n\ninterface NodeList {\n [Symbol.iterator](): IterableIterator\n}\n\ninterface NodeListOf {\n [Symbol.iterator](): IterableIterator\n}\n"}; }); diff --git a/lib/lib-ts.js b/lib/lib-ts.js index d0f4d07a..86841cea 100644 --- a/lib/lib-ts.js +++ b/lib/lib-ts.js @@ -5,5 +5,5 @@ // This is a generated file from lib.d.ts -define([], function() { return { contents: "/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved. \r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0 \r\n \r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, \r\nMERCHANTABLITY OR NON-INFRINGEMENT. \r\n \r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n\r\n/// \r\n/////////////////////////////\r\n/// ECMAScript APIs\r\n/////////////////////////////\r\n\r\ndeclare const NaN: number;\r\ndeclare const Infinity: number;\r\n\r\n/**\r\n * Evaluates JavaScript code and executes it.\r\n * @param x A String value that contains valid JavaScript code.\r\n */\r\ndeclare function eval(x: string): any;\r\n\r\n/**\r\n * Converts A string to an integer.\r\n * @param s A string to convert into a number.\r\n * @param radix A value between 2 and 36 that specifies the base of the number in numString.\r\n * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\r\n * All other strings are considered decimal.\r\n */\r\ndeclare function parseInt(s: string, radix?: number): number;\r\n\r\n/**\r\n * Converts a string to a floating-point number.\r\n * @param string A string that contains a floating-point number.\r\n */\r\ndeclare function parseFloat(string: string): number;\r\n\r\n/**\r\n * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number).\r\n * @param number A numeric value.\r\n */\r\ndeclare function isNaN(number: number): boolean;\r\n\r\n/**\r\n * Determines whether a supplied number is finite.\r\n * @param number Any numeric value.\r\n */\r\ndeclare function isFinite(number: number): boolean;\r\n\r\n/**\r\n * Gets the unencoded version of an encoded Uniform Resource Identifier (URI).\r\n * @param encodedURI A value representing an encoded URI.\r\n */\r\ndeclare function decodeURI(encodedURI: string): string;\r\n\r\n/**\r\n * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI).\r\n * @param encodedURIComponent A value representing an encoded URI component.\r\n */\r\ndeclare function decodeURIComponent(encodedURIComponent: string): string;\r\n\r\n/**\r\n * Encodes a text string as a valid Uniform Resource Identifier (URI)\r\n * @param uri A value representing an encoded URI.\r\n */\r\ndeclare function encodeURI(uri: string): string;\r\n\r\n/**\r\n * Encodes a text string as a valid component of a Uniform Resource Identifier (URI).\r\n * @param uriComponent A value representing an encoded URI component.\r\n */\r\ndeclare function encodeURIComponent(uriComponent: string): string;\r\n\r\ninterface PropertyDescriptor {\r\n configurable?: boolean;\r\n enumerable?: boolean;\r\n value?: any;\r\n writable?: boolean;\r\n get? (): any;\r\n set? (v: any): void;\r\n}\r\n\r\ninterface PropertyDescriptorMap {\r\n [s: string]: PropertyDescriptor;\r\n}\r\n\r\ninterface Object {\r\n /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */\r\n constructor: Function;\r\n\r\n /** Returns a string representation of an object. */\r\n toString(): string;\r\n\r\n /** Returns a date converted to a string using the current locale. */\r\n toLocaleString(): string;\r\n\r\n /** Returns the primitive value of the specified object. */\r\n valueOf(): Object;\r\n\r\n /**\r\n * Determines whether an object has a property with the specified name.\r\n * @param v A property name.\r\n */\r\n hasOwnProperty(v: string): boolean;\r\n\r\n /**\r\n * Determines whether an object exists in another object's prototype chain.\r\n * @param v Another object whose prototype chain is to be checked.\r\n */\r\n isPrototypeOf(v: Object): boolean;\r\n\r\n /**\r\n * Determines whether a specified property is enumerable.\r\n * @param v A property name.\r\n */\r\n propertyIsEnumerable(v: string): boolean;\r\n}\r\n\r\ninterface ObjectConstructor {\r\n new (value?: any): Object;\r\n (): any;\r\n (value: any): any;\r\n\r\n /** A reference to the prototype for a class of objects. */\r\n readonly prototype: Object;\r\n\r\n /**\r\n * Returns the prototype of an object.\r\n * @param o The object that references the prototype.\r\n */\r\n getPrototypeOf(o: any): any;\r\n\r\n /**\r\n * Gets the own property descriptor of the specified object.\r\n * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype.\r\n * @param o Object that contains the property.\r\n * @param p Name of the property.\r\n */\r\n getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor;\r\n\r\n /**\r\n * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly\r\n * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions.\r\n * @param o Object that contains the own properties.\r\n */\r\n getOwnPropertyNames(o: any): string[];\r\n\r\n /**\r\n * Creates an object that has null prototype.\r\n * @param o Object to use as a prototype. May be null\r\n */\r\n create(o: null): any;\r\n\r\n /**\r\n * Creates an object that has the specified prototype, and that optionally contains specified properties.\r\n * @param o Object to use as a prototype. May be null\r\n */\r\n create(o: T): T;\r\n\r\n /**\r\n * Creates an object that has the specified prototype, and that optionally contains specified properties.\r\n * @param o Object to use as a prototype. May be null\r\n * @param properties JavaScript object that contains one or more property descriptors.\r\n */\r\n create(o: any, properties: PropertyDescriptorMap): any;\r\n\r\n /**\r\n * Adds a property to an object, or modifies attributes of an existing property.\r\n * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object.\r\n * @param p The property name.\r\n * @param attributes Descriptor for the property. It can be for a data property or an accessor property.\r\n */\r\n defineProperty(o: any, p: string, attributes: PropertyDescriptor): any;\r\n\r\n /**\r\n * Adds one or more properties to an object, and/or modifies attributes of existing properties.\r\n * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object.\r\n * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property.\r\n */\r\n defineProperties(o: any, properties: PropertyDescriptorMap): any;\r\n\r\n /**\r\n * Prevents the modification of attributes of existing properties, and prevents the addition of new properties.\r\n * @param o Object on which to lock the attributes.\r\n */\r\n seal(o: T): T;\r\n\r\n /**\r\n * Prevents the modification of existing property attributes and values, and prevents the addition of new properties.\r\n * @param o Object on which to lock the attributes.\r\n */\r\n freeze(o: T): T;\r\n\r\n /**\r\n * Prevents the addition of new properties to an object.\r\n * @param o Object to make non-extensible.\r\n */\r\n preventExtensions(o: T): T;\r\n\r\n /**\r\n * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object.\r\n * @param o Object to test.\r\n */\r\n isSealed(o: any): boolean;\r\n\r\n /**\r\n * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object.\r\n * @param o Object to test.\r\n */\r\n isFrozen(o: any): boolean;\r\n\r\n /**\r\n * Returns a value that indicates whether new properties can be added to an object.\r\n * @param o Object to test.\r\n */\r\n isExtensible(o: any): boolean;\r\n\r\n /**\r\n * Returns the names of the enumerable properties and methods of an object.\r\n * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.\r\n */\r\n keys(o: any): string[];\r\n}\r\n\r\n/**\r\n * Provides functionality common to all JavaScript objects.\r\n */\r\ndeclare const Object: ObjectConstructor;\r\n\r\n/**\r\n * Creates a new function.\r\n */\r\ninterface Function {\r\n /**\r\n * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function.\r\n * @param thisArg The object to be used as the this object.\r\n * @param argArray A set of arguments to be passed to the function.\r\n */\r\n apply(this: Function, thisArg: any, argArray?: any): any;\r\n\r\n /**\r\n * Calls a method of an object, substituting another object for the current object.\r\n * @param thisArg The object to be used as the current object.\r\n * @param argArray A list of arguments to be passed to the method.\r\n */\r\n call(this: Function, thisArg: any, ...argArray: any[]): any;\r\n\r\n /**\r\n * For a given function, creates a bound function that has the same body as the original function.\r\n * The this object of the bound function is associated with the specified object, and has the specified initial parameters.\r\n * @param thisArg An object to which the this keyword can refer inside the new function.\r\n * @param argArray A list of arguments to be passed to the new function.\r\n */\r\n bind(this: Function, thisArg: any, ...argArray: any[]): any;\r\n\r\n prototype: any;\r\n readonly length: number;\r\n\r\n // Non-standard extensions\r\n arguments: any;\r\n caller: Function;\r\n}\r\n\r\ninterface FunctionConstructor {\r\n /**\r\n * Creates a new function.\r\n * @param args A list of arguments the function accepts.\r\n */\r\n new (...args: string[]): Function;\r\n (...args: string[]): Function;\r\n readonly prototype: Function;\r\n}\r\n\r\ndeclare const Function: FunctionConstructor;\r\n\r\ninterface IArguments {\r\n [index: number]: any;\r\n length: number;\r\n callee: Function;\r\n}\r\n\r\ninterface String {\r\n /** Returns a string representation of a string. */\r\n toString(): string;\r\n\r\n /**\r\n * Returns the character at the specified index.\r\n * @param pos The zero-based index of the desired character.\r\n */\r\n charAt(pos: number): string;\r\n\r\n /**\r\n * Returns the Unicode value of the character at the specified location.\r\n * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned.\r\n */\r\n charCodeAt(index: number): number;\r\n\r\n /**\r\n * Returns a string that contains the concatenation of two or more strings.\r\n * @param strings The strings to append to the end of the string.\r\n */\r\n concat(...strings: string[]): string;\r\n\r\n /**\r\n * Returns the position of the first occurrence of a substring.\r\n * @param searchString The substring to search for in the string\r\n * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string.\r\n */\r\n indexOf(searchString: string, position?: number): number;\r\n\r\n /**\r\n * Returns the last occurrence of a substring in the string.\r\n * @param searchString The substring to search for.\r\n * @param position The index at which to begin searching. If omitted, the search begins at the end of the string.\r\n */\r\n lastIndexOf(searchString: string, position?: number): number;\r\n\r\n /**\r\n * Determines whether two strings are equivalent in the current locale.\r\n * @param that String to compare to target string\r\n */\r\n localeCompare(that: string): number;\r\n\r\n /**\r\n * Matches a string with a regular expression, and returns an array containing the results of that search.\r\n * @param regexp A variable name or string literal containing the regular expression pattern and flags.\r\n */\r\n match(regexp: string): RegExpMatchArray | null;\r\n\r\n /**\r\n * Matches a string with a regular expression, and returns an array containing the results of that search.\r\n * @param regexp A regular expression object that contains the regular expression pattern and applicable flags.\r\n */\r\n match(regexp: RegExp): RegExpMatchArray | null;\r\n\r\n /**\r\n * Replaces text in a string, using a regular expression or search string.\r\n * @param searchValue A string that represents the regular expression.\r\n * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string.\r\n */\r\n replace(searchValue: string, replaceValue: string): string;\r\n\r\n /**\r\n * Replaces text in a string, using a regular expression or search string.\r\n * @param searchValue A string that represents the regular expression.\r\n * @param replacer A function that returns the replacement text.\r\n */\r\n replace(searchValue: string, replacer: (substring: string, ...args: any[]) => string): string;\r\n\r\n /**\r\n * Replaces text in a string, using a regular expression or search string.\r\n * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags.\r\n * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string.\r\n */\r\n replace(searchValue: RegExp, replaceValue: string): string;\r\n\r\n /**\r\n * Replaces text in a string, using a regular expression or search string.\r\n * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags\r\n * @param replacer A function that returns the replacement text.\r\n */\r\n replace(searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string;\r\n\r\n /**\r\n * Finds the first substring match in a regular expression search.\r\n * @param regexp The regular expression pattern and applicable flags.\r\n */\r\n search(regexp: string): number;\r\n\r\n /**\r\n * Finds the first substring match in a regular expression search.\r\n * @param regexp The regular expression pattern and applicable flags.\r\n */\r\n search(regexp: RegExp): number;\r\n\r\n /**\r\n * Returns a section of a string.\r\n * @param start The index to the beginning of the specified portion of stringObj.\r\n * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end.\r\n * If this value is not specified, the substring continues to the end of stringObj.\r\n */\r\n slice(start?: number, end?: number): string;\r\n\r\n /**\r\n * Split a string into substrings using the specified separator and return them as an array.\r\n * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned.\r\n * @param limit A value used to limit the number of elements returned in the array.\r\n */\r\n split(separator: string, limit?: number): string[];\r\n\r\n /**\r\n * Split a string into substrings using the specified separator and return them as an array.\r\n * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned.\r\n * @param limit A value used to limit the number of elements returned in the array.\r\n */\r\n split(separator: RegExp, limit?: number): string[];\r\n\r\n /**\r\n * Returns the substring at the specified location within a String object.\r\n * @param start The zero-based index number indicating the beginning of the substring.\r\n * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end.\r\n * If end is omitted, the characters from start through the end of the original string are returned.\r\n */\r\n substring(start: number, end?: number): string;\r\n\r\n /** Converts all the alphabetic characters in a string to lowercase. */\r\n toLowerCase(): string;\r\n\r\n /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */\r\n toLocaleLowerCase(): string;\r\n\r\n /** Converts all the alphabetic characters in a string to uppercase. */\r\n toUpperCase(): string;\r\n\r\n /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */\r\n toLocaleUpperCase(): string;\r\n\r\n /** Removes the leading and trailing white space and line terminator characters from a string. */\r\n trim(): string;\r\n\r\n /** Returns the length of a String object. */\r\n readonly length: number;\r\n\r\n // IE extensions\r\n /**\r\n * Gets a substring beginning at the specified location and having the specified length.\r\n * @param from The starting position of the desired substring. The index of the first character in the string is zero.\r\n * @param length The number of characters to include in the returned substring.\r\n */\r\n substr(from: number, length?: number): string;\r\n\r\n /** Returns the primitive value of the specified object. */\r\n valueOf(): string;\r\n\r\n readonly [index: number]: string;\r\n}\r\n\r\ninterface StringConstructor {\r\n new (value?: any): String;\r\n (value?: any): string;\r\n readonly prototype: String;\r\n fromCharCode(...codes: number[]): string;\r\n}\r\n\r\n/**\r\n * Allows manipulation and formatting of text strings and determination and location of substrings within strings.\r\n */\r\ndeclare const String: StringConstructor;\r\n\r\ninterface Boolean {\r\n /** Returns the primitive value of the specified object. */\r\n valueOf(): boolean;\r\n}\r\n\r\ninterface BooleanConstructor {\r\n new (value?: any): Boolean;\r\n (value?: any): boolean;\r\n readonly prototype: Boolean;\r\n}\r\n\r\ndeclare const Boolean: BooleanConstructor;\r\n\r\ninterface Number {\r\n /**\r\n * Returns a string representation of an object.\r\n * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers.\r\n */\r\n toString(radix?: number): string;\r\n\r\n /**\r\n * Returns a string representing a number in fixed-point notation.\r\n * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive.\r\n */\r\n toFixed(fractionDigits?: number): string;\r\n\r\n /**\r\n * Returns a string containing a number represented in exponential notation.\r\n * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive.\r\n */\r\n toExponential(fractionDigits?: number): string;\r\n\r\n /**\r\n * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits.\r\n * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive.\r\n */\r\n toPrecision(precision?: number): string;\r\n\r\n /** Returns the primitive value of the specified object. */\r\n valueOf(): number;\r\n}\r\n\r\ninterface NumberConstructor {\r\n new (value?: any): Number;\r\n (value?: any): number;\r\n readonly prototype: Number;\r\n\r\n /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */\r\n readonly MAX_VALUE: number;\r\n\r\n /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */\r\n readonly MIN_VALUE: number;\r\n\r\n /**\r\n * A value that is not a number.\r\n * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function.\r\n */\r\n readonly NaN: number;\r\n\r\n /**\r\n * A value that is less than the largest negative number that can be represented in JavaScript.\r\n * JavaScript displays NEGATIVE_INFINITY values as -infinity.\r\n */\r\n readonly NEGATIVE_INFINITY: number;\r\n\r\n /**\r\n * A value greater than the largest number that can be represented in JavaScript.\r\n * JavaScript displays POSITIVE_INFINITY values as infinity.\r\n */\r\n readonly POSITIVE_INFINITY: number;\r\n}\r\n\r\n/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */\r\ndeclare const Number: NumberConstructor;\r\n\r\ninterface TemplateStringsArray extends ReadonlyArray {\r\n readonly raw: ReadonlyArray\r\n}\r\n\r\ninterface Math {\r\n /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */\r\n readonly E: number;\r\n /** The natural logarithm of 10. */\r\n readonly LN10: number;\r\n /** The natural logarithm of 2. */\r\n readonly LN2: number;\r\n /** The base-2 logarithm of e. */\r\n readonly LOG2E: number;\r\n /** The base-10 logarithm of e. */\r\n readonly LOG10E: number;\r\n /** Pi. This is the ratio of the circumference of a circle to its diameter. */\r\n readonly PI: number;\r\n /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */\r\n readonly SQRT1_2: number;\r\n /** The square root of 2. */\r\n readonly SQRT2: number;\r\n /**\r\n * Returns the absolute value of a number (the value without regard to whether it is positive or negative).\r\n * For example, the absolute value of -5 is the same as the absolute value of 5.\r\n * @param x A numeric expression for which the absolute value is needed.\r\n */\r\n abs(x: number): number;\r\n /**\r\n * Returns the arc cosine (or inverse cosine) of a number.\r\n * @param x A numeric expression.\r\n */\r\n acos(x: number): number;\r\n /**\r\n * Returns the arcsine of a number.\r\n * @param x A numeric expression.\r\n */\r\n asin(x: number): number;\r\n /**\r\n * Returns the arctangent of a number.\r\n * @param x A numeric expression for which the arctangent is needed.\r\n */\r\n atan(x: number): number;\r\n /**\r\n * Returns the angle (in radians) from the X axis to a point.\r\n * @param y A numeric expression representing the cartesian y-coordinate.\r\n * @param x A numeric expression representing the cartesian x-coordinate.\r\n */\r\n atan2(y: number, x: number): number;\r\n /**\r\n * Returns the smallest number greater than or equal to its numeric argument.\r\n * @param x A numeric expression.\r\n */\r\n ceil(x: number): number;\r\n /**\r\n * Returns the cosine of a number.\r\n * @param x A numeric expression that contains an angle measured in radians.\r\n */\r\n cos(x: number): number;\r\n /**\r\n * Returns e (the base of natural logarithms) raised to a power.\r\n * @param x A numeric expression representing the power of e.\r\n */\r\n exp(x: number): number;\r\n /**\r\n * Returns the greatest number less than or equal to its numeric argument.\r\n * @param x A numeric expression.\r\n */\r\n floor(x: number): number;\r\n /**\r\n * Returns the natural logarithm (base e) of a number.\r\n * @param x A numeric expression.\r\n */\r\n log(x: number): number;\r\n /**\r\n * Returns the larger of a set of supplied numeric expressions.\r\n * @param values Numeric expressions to be evaluated.\r\n */\r\n max(...values: number[]): number;\r\n /**\r\n * Returns the smaller of a set of supplied numeric expressions.\r\n * @param values Numeric expressions to be evaluated.\r\n */\r\n min(...values: number[]): number;\r\n /**\r\n * Returns the value of a base expression taken to a specified power.\r\n * @param x The base value of the expression.\r\n * @param y The exponent value of the expression.\r\n */\r\n pow(x: number, y: number): number;\r\n /** Returns a pseudorandom number between 0 and 1. */\r\n random(): number;\r\n /**\r\n * Returns a supplied numeric expression rounded to the nearest number.\r\n * @param x The value to be rounded to the nearest number.\r\n */\r\n round(x: number): number;\r\n /**\r\n * Returns the sine of a number.\r\n * @param x A numeric expression that contains an angle measured in radians.\r\n */\r\n sin(x: number): number;\r\n /**\r\n * Returns the square root of a number.\r\n * @param x A numeric expression.\r\n */\r\n sqrt(x: number): number;\r\n /**\r\n * Returns the tangent of a number.\r\n * @param x A numeric expression that contains an angle measured in radians.\r\n */\r\n tan(x: number): number;\r\n}\r\n/** An intrinsic object that provides basic mathematics functionality and constants. */\r\ndeclare const Math: Math;\r\n\r\n/** Enables basic storage and retrieval of dates and times. */\r\ninterface Date {\r\n /** Returns a string representation of a date. The format of the string depends on the locale. */\r\n toString(): string;\r\n /** Returns a date as a string value. */\r\n toDateString(): string;\r\n /** Returns a time as a string value. */\r\n toTimeString(): string;\r\n /** Returns a value as a string value appropriate to the host environment's current locale. */\r\n toLocaleString(): string;\r\n /** Returns a date as a string value appropriate to the host environment's current locale. */\r\n toLocaleDateString(): string;\r\n /** Returns a time as a string value appropriate to the host environment's current locale. */\r\n toLocaleTimeString(): string;\r\n /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */\r\n valueOf(): number;\r\n /** Gets the time value in milliseconds. */\r\n getTime(): number;\r\n /** Gets the year, using local time. */\r\n getFullYear(): number;\r\n /** Gets the year using Universal Coordinated Time (UTC). */\r\n getUTCFullYear(): number;\r\n /** Gets the month, using local time. */\r\n getMonth(): number;\r\n /** Gets the month of a Date object using Universal Coordinated Time (UTC). */\r\n getUTCMonth(): number;\r\n /** Gets the day-of-the-month, using local time. */\r\n getDate(): number;\r\n /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */\r\n getUTCDate(): number;\r\n /** Gets the day of the week, using local time. */\r\n getDay(): number;\r\n /** Gets the day of the week using Universal Coordinated Time (UTC). */\r\n getUTCDay(): number;\r\n /** Gets the hours in a date, using local time. */\r\n getHours(): number;\r\n /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */\r\n getUTCHours(): number;\r\n /** Gets the minutes of a Date object, using local time. */\r\n getMinutes(): number;\r\n /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */\r\n getUTCMinutes(): number;\r\n /** Gets the seconds of a Date object, using local time. */\r\n getSeconds(): number;\r\n /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */\r\n getUTCSeconds(): number;\r\n /** Gets the milliseconds of a Date, using local time. */\r\n getMilliseconds(): number;\r\n /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */\r\n getUTCMilliseconds(): number;\r\n /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */\r\n getTimezoneOffset(): number;\r\n /**\r\n * Sets the date and time value in the Date object.\r\n * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT.\r\n */\r\n setTime(time: number): number;\r\n /**\r\n * Sets the milliseconds value in the Date object using local time.\r\n * @param ms A numeric value equal to the millisecond value.\r\n */\r\n setMilliseconds(ms: number): number;\r\n /**\r\n * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC).\r\n * @param ms A numeric value equal to the millisecond value.\r\n */\r\n setUTCMilliseconds(ms: number): number;\r\n\r\n /**\r\n * Sets the seconds value in the Date object using local time.\r\n * @param sec A numeric value equal to the seconds value.\r\n * @param ms A numeric value equal to the milliseconds value.\r\n */\r\n setSeconds(sec: number, ms?: number): number;\r\n /**\r\n * Sets the seconds value in the Date object using Universal Coordinated Time (UTC).\r\n * @param sec A numeric value equal to the seconds value.\r\n * @param ms A numeric value equal to the milliseconds value.\r\n */\r\n setUTCSeconds(sec: number, ms?: number): number;\r\n /**\r\n * Sets the minutes value in the Date object using local time.\r\n * @param min A numeric value equal to the minutes value.\r\n * @param sec A numeric value equal to the seconds value.\r\n * @param ms A numeric value equal to the milliseconds value.\r\n */\r\n setMinutes(min: number, sec?: number, ms?: number): number;\r\n /**\r\n * Sets the minutes value in the Date object using Universal Coordinated Time (UTC).\r\n * @param min A numeric value equal to the minutes value.\r\n * @param sec A numeric value equal to the seconds value.\r\n * @param ms A numeric value equal to the milliseconds value.\r\n */\r\n setUTCMinutes(min: number, sec?: number, ms?: number): number;\r\n /**\r\n * Sets the hour value in the Date object using local time.\r\n * @param hours A numeric value equal to the hours value.\r\n * @param min A numeric value equal to the minutes value.\r\n * @param sec A numeric value equal to the seconds value.\r\n * @param ms A numeric value equal to the milliseconds value.\r\n */\r\n setHours(hours: number, min?: number, sec?: number, ms?: number): number;\r\n /**\r\n * Sets the hours value in the Date object using Universal Coordinated Time (UTC).\r\n * @param hours A numeric value equal to the hours value.\r\n * @param min A numeric value equal to the minutes value.\r\n * @param sec A numeric value equal to the seconds value.\r\n * @param ms A numeric value equal to the milliseconds value.\r\n */\r\n setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number;\r\n /**\r\n * Sets the numeric day-of-the-month value of the Date object using local time.\r\n * @param date A numeric value equal to the day of the month.\r\n */\r\n setDate(date: number): number;\r\n /**\r\n * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC).\r\n * @param date A numeric value equal to the day of the month.\r\n */\r\n setUTCDate(date: number): number;\r\n /**\r\n * Sets the month value in the Date object using local time.\r\n * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively.\r\n * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used.\r\n */\r\n setMonth(month: number, date?: number): number;\r\n /**\r\n * Sets the month value in the Date object using Universal Coordinated Time (UTC).\r\n * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively.\r\n * @param date A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used.\r\n */\r\n setUTCMonth(month: number, date?: number): number;\r\n /**\r\n * Sets the year of the Date object using local time.\r\n * @param year A numeric value for the year.\r\n * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified.\r\n * @param date A numeric value equal for the day of the month.\r\n */\r\n setFullYear(year: number, month?: number, date?: number): number;\r\n /**\r\n * Sets the year value in the Date object using Universal Coordinated Time (UTC).\r\n * @param year A numeric value equal to the year.\r\n * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied.\r\n * @param date A numeric value equal to the day of the month.\r\n */\r\n setUTCFullYear(year: number, month?: number, date?: number): number;\r\n /** Returns a date converted to a string using Universal Coordinated Time (UTC). */\r\n toUTCString(): string;\r\n /** Returns a date as a string value in ISO format. */\r\n toISOString(): string;\r\n /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */\r\n toJSON(key?: any): string;\r\n}\r\n\r\ninterface DateConstructor {\r\n new (): Date;\r\n new (value: number): Date;\r\n new (value: string): Date;\r\n new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;\r\n (): string;\r\n readonly prototype: Date;\r\n /**\r\n * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970.\r\n * @param s A date string\r\n */\r\n parse(s: string): number;\r\n /**\r\n * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date.\r\n * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year.\r\n * @param month The month as an number between 0 and 11 (January to December).\r\n * @param date The date as an number between 1 and 31.\r\n * @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour.\r\n * @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes.\r\n * @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds.\r\n * @param ms An number from 0 to 999 that specifies the milliseconds.\r\n */\r\n UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number;\r\n now(): number;\r\n}\r\n\r\ndeclare const Date: DateConstructor;\r\n\r\ninterface RegExpMatchArray extends Array {\r\n index?: number;\r\n input?: string;\r\n}\r\n\r\ninterface RegExpExecArray extends Array {\r\n index: number;\r\n input: string;\r\n}\r\n\r\ninterface RegExp {\r\n /**\r\n * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search.\r\n * @param string The String object or string literal on which to perform the search.\r\n */\r\n exec(string: string): RegExpExecArray | null;\r\n\r\n /**\r\n * Returns a Boolean value that indicates whether or not a pattern exists in a searched string.\r\n * @param string String on which to perform the search.\r\n */\r\n test(string: string): boolean;\r\n\r\n /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */\r\n readonly source: string;\r\n\r\n /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */\r\n readonly global: boolean;\r\n\r\n /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */\r\n readonly ignoreCase: boolean;\r\n\r\n /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */\r\n readonly multiline: boolean;\r\n\r\n lastIndex: number;\r\n\r\n // Non-standard extensions\r\n compile(): this;\r\n}\r\n\r\ninterface RegExpConstructor {\r\n new (pattern: RegExp): RegExp;\r\n new (pattern: string, flags?: string): RegExp;\r\n (pattern: RegExp): RegExp;\r\n (pattern: string, flags?: string): RegExp;\r\n readonly prototype: RegExp;\r\n\r\n // Non-standard extensions\r\n $1: string;\r\n $2: string;\r\n $3: string;\r\n $4: string;\r\n $5: string;\r\n $6: string;\r\n $7: string;\r\n $8: string;\r\n $9: string;\r\n lastMatch: string;\r\n}\r\n\r\ndeclare const RegExp: RegExpConstructor;\r\n\r\ninterface Error {\r\n name: string;\r\n message: string;\r\n stack?: string;\r\n}\r\n\r\ninterface ErrorConstructor {\r\n new (message?: string): Error;\r\n (message?: string): Error;\r\n readonly prototype: Error;\r\n}\r\n\r\ndeclare const Error: ErrorConstructor;\r\n\r\ninterface EvalError extends Error {\r\n}\r\n\r\ninterface EvalErrorConstructor {\r\n new (message?: string): EvalError;\r\n (message?: string): EvalError;\r\n readonly prototype: EvalError;\r\n}\r\n\r\ndeclare const EvalError: EvalErrorConstructor;\r\n\r\ninterface RangeError extends Error {\r\n}\r\n\r\ninterface RangeErrorConstructor {\r\n new (message?: string): RangeError;\r\n (message?: string): RangeError;\r\n readonly prototype: RangeError;\r\n}\r\n\r\ndeclare const RangeError: RangeErrorConstructor;\r\n\r\ninterface ReferenceError extends Error {\r\n}\r\n\r\ninterface ReferenceErrorConstructor {\r\n new (message?: string): ReferenceError;\r\n (message?: string): ReferenceError;\r\n readonly prototype: ReferenceError;\r\n}\r\n\r\ndeclare const ReferenceError: ReferenceErrorConstructor;\r\n\r\ninterface SyntaxError extends Error {\r\n}\r\n\r\ninterface SyntaxErrorConstructor {\r\n new (message?: string): SyntaxError;\r\n (message?: string): SyntaxError;\r\n readonly prototype: SyntaxError;\r\n}\r\n\r\ndeclare const SyntaxError: SyntaxErrorConstructor;\r\n\r\ninterface TypeError extends Error {\r\n}\r\n\r\ninterface TypeErrorConstructor {\r\n new (message?: string): TypeError;\r\n (message?: string): TypeError;\r\n readonly prototype: TypeError;\r\n}\r\n\r\ndeclare const TypeError: TypeErrorConstructor;\r\n\r\ninterface URIError extends Error {\r\n}\r\n\r\ninterface URIErrorConstructor {\r\n new (message?: string): URIError;\r\n (message?: string): URIError;\r\n readonly prototype: URIError;\r\n}\r\n\r\ndeclare const URIError: URIErrorConstructor;\r\n\r\ninterface JSON {\r\n /**\r\n * Converts a JavaScript Object Notation (JSON) string into an object.\r\n * @param text A valid JSON string.\r\n * @param reviver A function that transforms the results. This function is called for each member of the object.\r\n * If a member contains nested objects, the nested objects are transformed before the parent object is.\r\n */\r\n parse(text: string, reviver?: (key: any, value: any) => any): any;\r\n /**\r\n * Converts a JavaScript value to a JavaScript Object Notation (JSON) string.\r\n * @param value A JavaScript value, usually an object or array, to be converted.\r\n * @param replacer A function that transforms the results.\r\n * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.\r\n */\r\n stringify(value: any, replacer?: (key: string, value: any) => any, space?: string | number): string;\r\n /**\r\n * Converts a JavaScript value to a JavaScript Object Notation (JSON) string.\r\n * @param value A JavaScript value, usually an object or array, to be converted.\r\n * @param replacer An array of strings and numbers that acts as a approved list for selecting the object properties that will be stringified.\r\n * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.\r\n */\r\n stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string;\r\n}\r\n\r\n/**\r\n * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.\r\n */\r\ndeclare const JSON: JSON;\r\n\r\n\r\n/////////////////////////////\r\n/// ECMAScript Array API (specially handled by compiler)\r\n/////////////////////////////\r\n\r\ninterface ReadonlyArray {\r\n /**\r\n * Gets the length of the array. This is a number one higher than the highest element defined in an array.\r\n */\r\n readonly length: number;\r\n /**\r\n * Returns a string representation of an array.\r\n */\r\n toString(): string;\r\n toLocaleString(): string;\r\n /**\r\n * Combines two or more arrays.\r\n * @param items Additional items to add to the end of array1.\r\n */\r\n concat>(...items: U[]): T[];\r\n /**\r\n * Combines two or more arrays.\r\n * @param items Additional items to add to the end of array1.\r\n */\r\n concat(...items: T[][]): T[];\r\n /**\r\n * Combines two or more arrays.\r\n * @param items Additional items to add to the end of array1.\r\n */\r\n concat(...items: (T | T[])[]): T[];\r\n /**\r\n * Adds all the elements of an array separated by the specified separator string.\r\n * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.\r\n */\r\n join(separator?: string): string;\r\n /**\r\n * Returns a section of an array.\r\n * @param start The beginning of the specified portion of the array.\r\n * @param end The end of the specified portion of the array.\r\n */\r\n slice(start?: number, end?: number): T[];\r\n /**\r\n * Returns the index of the first occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.\r\n */\r\n indexOf(searchElement: T, fromIndex?: number): number;\r\n\r\n /**\r\n * Returns the index of the last occurrence of a specified value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array.\r\n */\r\n lastIndexOf(searchElement: T, fromIndex?: number): number;\r\n /**\r\n * Determines whether all the members of an array satisfy the specified test.\r\n * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\r\n */\r\n every(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean;\r\n /**\r\n * Determines whether the specified callback function returns true for any element of an array.\r\n * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\r\n */\r\n some(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean;\r\n /**\r\n * Performs the specified action for each element in an array.\r\n * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\r\n */\r\n forEach(callbackfn: (value: T, index: number, array: ReadonlyArray) => void, thisArg?: any): void;\r\n /**\r\n * Calls a defined callback function on each element of an array, and returns an array that contains the results.\r\n * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\r\n */\r\n map(callbackfn: (value: T, index: number, array: ReadonlyArray) => U, thisArg?: any): U[];\r\n /**\r\n * Returns the elements of an array that meet the condition specified in a callback function.\r\n * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\r\n */\r\n filter(callbackfn: (value: T, index: number, array: ReadonlyArray) => any, thisArg?: any): T[];\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T;\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U;\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T;\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U;\r\n\r\n readonly [n: number]: T;\r\n}\r\n\r\ninterface Array {\r\n /**\r\n * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array.\r\n */\r\n length: number;\r\n /**\r\n * Returns a string representation of an array.\r\n */\r\n toString(): string;\r\n toLocaleString(): string;\r\n /**\r\n * Appends new elements to an array, and returns the new length of the array.\r\n * @param items New elements of the Array.\r\n */\r\n push(...items: T[]): number;\r\n /**\r\n * Removes the last element from an array and returns it.\r\n */\r\n pop(): T | undefined;\r\n /**\r\n * Combines two or more arrays.\r\n * @param items Additional items to add to the end of array1.\r\n */\r\n concat(...items: T[][]): T[];\r\n /**\r\n * Combines two or more arrays.\r\n * @param items Additional items to add to the end of array1.\r\n */\r\n concat(...items: (T | T[])[]): T[];\r\n /**\r\n * Adds all the elements of an array separated by the specified separator string.\r\n * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.\r\n */\r\n join(separator?: string): string;\r\n /**\r\n * Reverses the elements in an Array.\r\n */\r\n reverse(): T[];\r\n /**\r\n * Removes the first element from an array and returns it.\r\n */\r\n shift(): T | undefined;\r\n /**\r\n * Returns a section of an array.\r\n * @param start The beginning of the specified portion of the array.\r\n * @param end The end of the specified portion of the array.\r\n */\r\n slice(start?: number, end?: number): T[];\r\n /**\r\n * Sorts an array.\r\n * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order.\r\n */\r\n sort(compareFn?: (a: T, b: T) => number): this;\r\n /**\r\n * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.\r\n * @param start The zero-based location in the array from which to start removing elements.\r\n */\r\n splice(start: number): T[];\r\n /**\r\n * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.\r\n * @param start The zero-based location in the array from which to start removing elements.\r\n * @param deleteCount The number of elements to remove.\r\n * @param items Elements to insert into the array in place of the deleted elements.\r\n */\r\n splice(start: number, deleteCount: number, ...items: T[]): T[];\r\n /**\r\n * Inserts new elements at the start of an array.\r\n * @param items Elements to insert at the start of the Array.\r\n */\r\n unshift(...items: T[]): number;\r\n /**\r\n * Returns the index of the first occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.\r\n */\r\n indexOf(searchElement: T, fromIndex?: number): number;\r\n /**\r\n * Returns the index of the last occurrence of a specified value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array.\r\n */\r\n lastIndexOf(searchElement: T, fromIndex?: number): number;\r\n /**\r\n * Determines whether all the members of an array satisfy the specified test.\r\n * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\r\n */\r\n every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;\r\n /**\r\n * Determines whether the specified callback function returns true for any element of an array.\r\n * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\r\n */\r\n some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;\r\n /**\r\n * Performs the specified action for each element in an array.\r\n * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\r\n */\r\n forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void;\r\n /**\r\n * Calls a defined callback function on each element of an array, and returns an array that contains the results.\r\n * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\r\n */\r\n map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[];\r\n /**\r\n * Returns the elements of an array that meet the condition specified in a callback function.\r\n * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\r\n */\r\n filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[];\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;\r\n\r\n [n: number]: T;\r\n}\r\n\r\ninterface ArrayConstructor {\r\n new (arrayLength?: number): any[];\r\n new (arrayLength: number): T[];\r\n new (...items: T[]): T[];\r\n (arrayLength?: number): any[];\r\n (arrayLength: number): T[];\r\n (...items: T[]): T[];\r\n isArray(arg: any): arg is Array;\r\n readonly prototype: Array;\r\n}\r\n\r\ndeclare const Array: ArrayConstructor;\r\n\r\ninterface TypedPropertyDescriptor {\r\n enumerable?: boolean;\r\n configurable?: boolean;\r\n writable?: boolean;\r\n value?: T;\r\n get?: () => T;\r\n set?: (value: T) => void;\r\n}\r\n\r\ndeclare type ClassDecorator = (target: TFunction) => TFunction | void;\r\ndeclare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;\r\ndeclare type MethodDecorator = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void;\r\ndeclare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;\r\n\r\ndeclare type PromiseConstructorLike = new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike;\r\n\r\ninterface PromiseLike {\r\n /**\r\n * Attaches callbacks for the resolution and/or rejection of the Promise.\r\n * @param onfulfilled The callback to execute when the Promise is resolved.\r\n * @param onrejected The callback to execute when the Promise is rejected.\r\n * @returns A Promise for the completion of which ever callback is executed.\r\n */\r\n then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike;\r\n then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike;\r\n}\r\n\r\ninterface ArrayLike {\r\n readonly length: number;\r\n readonly [n: number]: T;\r\n}\r\n\r\n/**\r\n * Represents a raw buffer of binary data, which is used to store data for the\r\n * different typed arrays. ArrayBuffers cannot be read from or written to directly,\r\n * but can be passed to a typed array or DataView Object to interpret the raw\r\n * buffer as needed.\r\n */\r\ninterface ArrayBuffer {\r\n /**\r\n * Read-only. The length of the ArrayBuffer (in bytes).\r\n */\r\n readonly byteLength: number;\r\n\r\n /**\r\n * Returns a section of an ArrayBuffer.\r\n */\r\n slice(begin:number, end?:number): ArrayBuffer;\r\n}\r\n\r\ninterface ArrayBufferConstructor {\r\n readonly prototype: ArrayBuffer;\r\n new (byteLength: number): ArrayBuffer;\r\n isView(arg: any): arg is ArrayBufferView;\r\n}\r\ndeclare const ArrayBuffer: ArrayBufferConstructor;\r\n\r\ninterface ArrayBufferView {\r\n /**\r\n * The ArrayBuffer instance referenced by the array.\r\n */\r\n buffer: ArrayBuffer;\r\n\r\n /**\r\n * The length in bytes of the array.\r\n */\r\n byteLength: number;\r\n\r\n /**\r\n * The offset in bytes of the array.\r\n */\r\n byteOffset: number;\r\n}\r\n\r\ninterface DataView {\r\n readonly buffer: ArrayBuffer;\r\n readonly byteLength: number;\r\n readonly byteOffset: number;\r\n /**\r\n * Gets the Float32 value at the specified byte offset from the start of the view. There is\r\n * no alignment constraint; multi-byte values may be fetched from any offset.\r\n * @param byteOffset The place in the buffer at which the value should be retrieved.\r\n */\r\n getFloat32(byteOffset: number, littleEndian?: boolean): number;\r\n\r\n /**\r\n * Gets the Float64 value at the specified byte offset from the start of the view. There is\r\n * no alignment constraint; multi-byte values may be fetched from any offset.\r\n * @param byteOffset The place in the buffer at which the value should be retrieved.\r\n */\r\n getFloat64(byteOffset: number, littleEndian?: boolean): number;\r\n\r\n /**\r\n * Gets the Int8 value at the specified byte offset from the start of the view. There is\r\n * no alignment constraint; multi-byte values may be fetched from any offset.\r\n * @param byteOffset The place in the buffer at which the value should be retrieved.\r\n */\r\n getInt8(byteOffset: number): number;\r\n\r\n /**\r\n * Gets the Int16 value at the specified byte offset from the start of the view. There is\r\n * no alignment constraint; multi-byte values may be fetched from any offset.\r\n * @param byteOffset The place in the buffer at which the value should be retrieved.\r\n */\r\n getInt16(byteOffset: number, littleEndian?: boolean): number;\r\n /**\r\n * Gets the Int32 value at the specified byte offset from the start of the view. There is\r\n * no alignment constraint; multi-byte values may be fetched from any offset.\r\n * @param byteOffset The place in the buffer at which the value should be retrieved.\r\n */\r\n getInt32(byteOffset: number, littleEndian?: boolean): number;\r\n\r\n /**\r\n * Gets the Uint8 value at the specified byte offset from the start of the view. There is\r\n * no alignment constraint; multi-byte values may be fetched from any offset.\r\n * @param byteOffset The place in the buffer at which the value should be retrieved.\r\n */\r\n getUint8(byteOffset: number): number;\r\n\r\n /**\r\n * Gets the Uint16 value at the specified byte offset from the start of the view. There is\r\n * no alignment constraint; multi-byte values may be fetched from any offset.\r\n * @param byteOffset The place in the buffer at which the value should be retrieved.\r\n */\r\n getUint16(byteOffset: number, littleEndian?: boolean): number;\r\n\r\n /**\r\n * Gets the Uint32 value at the specified byte offset from the start of the view. There is\r\n * no alignment constraint; multi-byte values may be fetched from any offset.\r\n * @param byteOffset The place in the buffer at which the value should be retrieved.\r\n */\r\n getUint32(byteOffset: number, littleEndian?: boolean): number;\r\n\r\n /**\r\n * Stores an Float32 value at the specified byte offset from the start of the view.\r\n * @param byteOffset The place in the buffer at which the value should be set.\r\n * @param value The value to set.\r\n * @param littleEndian If false or undefined, a big-endian value should be written,\r\n * otherwise a little-endian value should be written.\r\n */\r\n setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void;\r\n\r\n /**\r\n * Stores an Float64 value at the specified byte offset from the start of the view.\r\n * @param byteOffset The place in the buffer at which the value should be set.\r\n * @param value The value to set.\r\n * @param littleEndian If false or undefined, a big-endian value should be written,\r\n * otherwise a little-endian value should be written.\r\n */\r\n setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void;\r\n\r\n /**\r\n * Stores an Int8 value at the specified byte offset from the start of the view.\r\n * @param byteOffset The place in the buffer at which the value should be set.\r\n * @param value The value to set.\r\n */\r\n setInt8(byteOffset: number, value: number): void;\r\n\r\n /**\r\n * Stores an Int16 value at the specified byte offset from the start of the view.\r\n * @param byteOffset The place in the buffer at which the value should be set.\r\n * @param value The value to set.\r\n * @param littleEndian If false or undefined, a big-endian value should be written,\r\n * otherwise a little-endian value should be written.\r\n */\r\n setInt16(byteOffset: number, value: number, littleEndian?: boolean): void;\r\n\r\n /**\r\n * Stores an Int32 value at the specified byte offset from the start of the view.\r\n * @param byteOffset The place in the buffer at which the value should be set.\r\n * @param value The value to set.\r\n * @param littleEndian If false or undefined, a big-endian value should be written,\r\n * otherwise a little-endian value should be written.\r\n */\r\n setInt32(byteOffset: number, value: number, littleEndian?: boolean): void;\r\n\r\n /**\r\n * Stores an Uint8 value at the specified byte offset from the start of the view.\r\n * @param byteOffset The place in the buffer at which the value should be set.\r\n * @param value The value to set.\r\n */\r\n setUint8(byteOffset: number, value: number): void;\r\n\r\n /**\r\n * Stores an Uint16 value at the specified byte offset from the start of the view.\r\n * @param byteOffset The place in the buffer at which the value should be set.\r\n * @param value The value to set.\r\n * @param littleEndian If false or undefined, a big-endian value should be written,\r\n * otherwise a little-endian value should be written.\r\n */\r\n setUint16(byteOffset: number, value: number, littleEndian?: boolean): void;\r\n\r\n /**\r\n * Stores an Uint32 value at the specified byte offset from the start of the view.\r\n * @param byteOffset The place in the buffer at which the value should be set.\r\n * @param value The value to set.\r\n * @param littleEndian If false or undefined, a big-endian value should be written,\r\n * otherwise a little-endian value should be written.\r\n */\r\n setUint32(byteOffset: number, value: number, littleEndian?: boolean): void;\r\n}\r\n\r\ninterface DataViewConstructor {\r\n new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView;\r\n}\r\ndeclare const DataView: DataViewConstructor;\r\n\r\n/**\r\n * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested\r\n * number of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Int8Array {\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * The ArrayBuffer instance referenced by the array.\r\n */\r\n readonly buffer: ArrayBuffer;\r\n\r\n /**\r\n * The length in bytes of the array.\r\n */\r\n readonly byteLength: number;\r\n\r\n /**\r\n * The offset in bytes of the array.\r\n */\r\n readonly byteOffset: number;\r\n\r\n /**\r\n * Returns the this object after copying a section of the array identified by start and end\r\n * to the same array starting at position target\r\n * @param target If target is negative, it is treated as length+target where length is the\r\n * length of the array.\r\n * @param start If start is negative, it is treated as length+start. If end is negative, it\r\n * is treated as length+end.\r\n * @param end If not specified, length of the this object is used as its default value.\r\n */\r\n copyWithin(target: number, start: number, end?: number): this;\r\n\r\n /**\r\n * Determines whether all the members of an array satisfy the specified test.\r\n * @param callbackfn A function that accepts up to three arguments. The every method calls\r\n * the callbackfn function for each element in array1 until the callbackfn returns false,\r\n * or until the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Returns the this object after filling the section identified by start and end with value\r\n * @param value value to fill array section with\r\n * @param start index to start filling the array at. If start is negative, it is treated as\r\n * length+start where length is the length of the array.\r\n * @param end index to stop filling the array at. If end is negative, it is treated as\r\n * length+end.\r\n */\r\n fill(value: number, start?: number, end?: number): this;\r\n\r\n /**\r\n * Returns the elements of an array that meet the condition specified in a callback function.\r\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n filter(callbackfn: (value: number, index: number, array: Int8Array) => any, thisArg?: any): Int8Array;\r\n\r\n /**\r\n * Returns the value of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found, find\r\n * immediately returns that element value. Otherwise, find returns undefined.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\r\n\r\n /**\r\n * Returns the index of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found,\r\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n findIndex(predicate: (value: number) => boolean, thisArg?: any): number;\r\n\r\n /**\r\n * Performs the specified action for each element in an array.\r\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void;\r\n\r\n /**\r\n * Returns the index of the first occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n indexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * Adds all the elements of an array separated by the specified separator string.\r\n * @param separator A string used to separate one element of an array from the next in the\r\n * resulting String. If omitted, the array elements are separated with a comma.\r\n */\r\n join(separator?: string): string;\r\n\r\n /**\r\n * Returns the index of the last occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n lastIndexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * The length of the array.\r\n */\r\n readonly length: number;\r\n\r\n /**\r\n * Calls a defined callback function on each element of an array, and returns an array that\r\n * contains the results.\r\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an\r\n * argument instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U;\r\n\r\n /**\r\n * Reverses the elements in an Array.\r\n */\r\n reverse(): Int8Array;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param index The index of the location to set.\r\n * @param value The value to set.\r\n */\r\n set(index: number, value: number): void;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param array A typed or untyped array of values to set.\r\n * @param offset The index in the current array at which the values are to be written.\r\n */\r\n set(array: ArrayLike, offset?: number): void;\r\n\r\n /**\r\n * Returns a section of an array.\r\n * @param start The beginning of the specified portion of the array.\r\n * @param end The end of the specified portion of the array.\r\n */\r\n slice(start?: number, end?: number): Int8Array;\r\n\r\n /**\r\n * Determines whether the specified callback function returns true for any element of an array.\r\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\r\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\r\n * the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Sorts an array.\r\n * @param compareFn The name of the function used to determine the order of the elements. If\r\n * omitted, the elements are sorted in ascending, ASCII character order.\r\n */\r\n sort(compareFn?: (a: number, b: number) => number): this;\r\n\r\n /**\r\n * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements\r\n * at begin, inclusive, up to end, exclusive.\r\n * @param begin The index of the beginning of the array.\r\n * @param end The index of the end of the array.\r\n */\r\n subarray(begin: number, end?: number): Int8Array;\r\n\r\n /**\r\n * Converts a number to a string by using the current locale.\r\n */\r\n toLocaleString(): string;\r\n\r\n /**\r\n * Returns a string representation of an array.\r\n */\r\n toString(): string;\r\n\r\n [index: number]: number;\r\n}\r\ninterface Int8ArrayConstructor {\r\n readonly prototype: Int8Array;\r\n new (length: number): Int8Array;\r\n new (array: ArrayLike): Int8Array;\r\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array;\r\n\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * Returns a new array from a set of elements.\r\n * @param items A set of elements to include in the new array object.\r\n */\r\n of(...items: number[]): Int8Array;\r\n\r\n /**\r\n * Creates an array from an array-like or iterable object.\r\n * @param arrayLike An array-like or iterable object to convert to an array.\r\n * @param mapfn A mapping function to call on every element of the array.\r\n * @param thisArg Value of 'this' used to invoke the mapfn.\r\n */\r\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array;\r\n\r\n}\r\ndeclare const Int8Array: Int8ArrayConstructor;\r\n\r\n/**\r\n * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the\r\n * requested number of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Uint8Array {\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * The ArrayBuffer instance referenced by the array.\r\n */\r\n readonly buffer: ArrayBuffer;\r\n\r\n /**\r\n * The length in bytes of the array.\r\n */\r\n readonly byteLength: number;\r\n\r\n /**\r\n * The offset in bytes of the array.\r\n */\r\n readonly byteOffset: number;\r\n\r\n /**\r\n * Returns the this object after copying a section of the array identified by start and end\r\n * to the same array starting at position target\r\n * @param target If target is negative, it is treated as length+target where length is the\r\n * length of the array.\r\n * @param start If start is negative, it is treated as length+start. If end is negative, it\r\n * is treated as length+end.\r\n * @param end If not specified, length of the this object is used as its default value.\r\n */\r\n copyWithin(target: number, start: number, end?: number): this;\r\n\r\n /**\r\n * Determines whether all the members of an array satisfy the specified test.\r\n * @param callbackfn A function that accepts up to three arguments. The every method calls\r\n * the callbackfn function for each element in array1 until the callbackfn returns false,\r\n * or until the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Returns the this object after filling the section identified by start and end with value\r\n * @param value value to fill array section with\r\n * @param start index to start filling the array at. If start is negative, it is treated as\r\n * length+start where length is the length of the array.\r\n * @param end index to stop filling the array at. If end is negative, it is treated as\r\n * length+end.\r\n */\r\n fill(value: number, start?: number, end?: number): this;\r\n\r\n /**\r\n * Returns the elements of an array that meet the condition specified in a callback function.\r\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n filter(callbackfn: (value: number, index: number, array: Uint8Array) => any, thisArg?: any): Uint8Array;\r\n\r\n /**\r\n * Returns the value of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found, find\r\n * immediately returns that element value. Otherwise, find returns undefined.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\r\n\r\n /**\r\n * Returns the index of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found,\r\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n findIndex(predicate: (value: number) => boolean, thisArg?: any): number;\r\n\r\n /**\r\n * Performs the specified action for each element in an array.\r\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void;\r\n\r\n /**\r\n * Returns the index of the first occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n indexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * Adds all the elements of an array separated by the specified separator string.\r\n * @param separator A string used to separate one element of an array from the next in the\r\n * resulting String. If omitted, the array elements are separated with a comma.\r\n */\r\n join(separator?: string): string;\r\n\r\n /**\r\n * Returns the index of the last occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n lastIndexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * The length of the array.\r\n */\r\n readonly length: number;\r\n\r\n /**\r\n * Calls a defined callback function on each element of an array, and returns an array that\r\n * contains the results.\r\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an\r\n * argument instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U;\r\n\r\n /**\r\n * Reverses the elements in an Array.\r\n */\r\n reverse(): Uint8Array;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param index The index of the location to set.\r\n * @param value The value to set.\r\n */\r\n set(index: number, value: number): void;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param array A typed or untyped array of values to set.\r\n * @param offset The index in the current array at which the values are to be written.\r\n */\r\n set(array: ArrayLike, offset?: number): void;\r\n\r\n /**\r\n * Returns a section of an array.\r\n * @param start The beginning of the specified portion of the array.\r\n * @param end The end of the specified portion of the array.\r\n */\r\n slice(start?: number, end?: number): Uint8Array;\r\n\r\n /**\r\n * Determines whether the specified callback function returns true for any element of an array.\r\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\r\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\r\n * the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Sorts an array.\r\n * @param compareFn The name of the function used to determine the order of the elements. If\r\n * omitted, the elements are sorted in ascending, ASCII character order.\r\n */\r\n sort(compareFn?: (a: number, b: number) => number): this;\r\n\r\n /**\r\n * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements\r\n * at begin, inclusive, up to end, exclusive.\r\n * @param begin The index of the beginning of the array.\r\n * @param end The index of the end of the array.\r\n */\r\n subarray(begin: number, end?: number): Uint8Array;\r\n\r\n /**\r\n * Converts a number to a string by using the current locale.\r\n */\r\n toLocaleString(): string;\r\n\r\n /**\r\n * Returns a string representation of an array.\r\n */\r\n toString(): string;\r\n\r\n [index: number]: number;\r\n}\r\n\r\ninterface Uint8ArrayConstructor {\r\n readonly prototype: Uint8Array;\r\n new (length: number): Uint8Array;\r\n new (array: ArrayLike): Uint8Array;\r\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array;\r\n\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * Returns a new array from a set of elements.\r\n * @param items A set of elements to include in the new array object.\r\n */\r\n of(...items: number[]): Uint8Array;\r\n\r\n /**\r\n * Creates an array from an array-like or iterable object.\r\n * @param arrayLike An array-like or iterable object to convert to an array.\r\n * @param mapfn A mapping function to call on every element of the array.\r\n * @param thisArg Value of 'this' used to invoke the mapfn.\r\n */\r\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array;\r\n\r\n}\r\ndeclare const Uint8Array: Uint8ArrayConstructor;\r\n\r\n/**\r\n * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0.\r\n * If the requested number of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Uint8ClampedArray {\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * The ArrayBuffer instance referenced by the array.\r\n */\r\n readonly buffer: ArrayBuffer;\r\n\r\n /**\r\n * The length in bytes of the array.\r\n */\r\n readonly byteLength: number;\r\n\r\n /**\r\n * The offset in bytes of the array.\r\n */\r\n readonly byteOffset: number;\r\n\r\n /**\r\n * Returns the this object after copying a section of the array identified by start and end\r\n * to the same array starting at position target\r\n * @param target If target is negative, it is treated as length+target where length is the\r\n * length of the array.\r\n * @param start If start is negative, it is treated as length+start. If end is negative, it\r\n * is treated as length+end.\r\n * @param end If not specified, length of the this object is used as its default value.\r\n */\r\n copyWithin(target: number, start: number, end?: number): this;\r\n\r\n /**\r\n * Determines whether all the members of an array satisfy the specified test.\r\n * @param callbackfn A function that accepts up to three arguments. The every method calls\r\n * the callbackfn function for each element in array1 until the callbackfn returns false,\r\n * or until the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Returns the this object after filling the section identified by start and end with value\r\n * @param value value to fill array section with\r\n * @param start index to start filling the array at. If start is negative, it is treated as\r\n * length+start where length is the length of the array.\r\n * @param end index to stop filling the array at. If end is negative, it is treated as\r\n * length+end.\r\n */\r\n fill(value: number, start?: number, end?: number): this;\r\n\r\n /**\r\n * Returns the elements of an array that meet the condition specified in a callback function.\r\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => any, thisArg?: any): Uint8ClampedArray;\r\n\r\n /**\r\n * Returns the value of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found, find\r\n * immediately returns that element value. Otherwise, find returns undefined.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\r\n\r\n /**\r\n * Returns the index of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found,\r\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n findIndex(predicate: (value: number) => boolean, thisArg?: any): number;\r\n\r\n /**\r\n * Performs the specified action for each element in an array.\r\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void;\r\n\r\n /**\r\n * Returns the index of the first occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n indexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * Adds all the elements of an array separated by the specified separator string.\r\n * @param separator A string used to separate one element of an array from the next in the\r\n * resulting String. If omitted, the array elements are separated with a comma.\r\n */\r\n join(separator?: string): string;\r\n\r\n /**\r\n * Returns the index of the last occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n lastIndexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * The length of the array.\r\n */\r\n readonly length: number;\r\n\r\n /**\r\n * Calls a defined callback function on each element of an array, and returns an array that\r\n * contains the results.\r\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an\r\n * argument instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U;\r\n\r\n /**\r\n * Reverses the elements in an Array.\r\n */\r\n reverse(): Uint8ClampedArray;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param index The index of the location to set.\r\n * @param value The value to set.\r\n */\r\n set(index: number, value: number): void;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param array A typed or untyped array of values to set.\r\n * @param offset The index in the current array at which the values are to be written.\r\n */\r\n set(array: Uint8ClampedArray, offset?: number): void;\r\n\r\n /**\r\n * Returns a section of an array.\r\n * @param start The beginning of the specified portion of the array.\r\n * @param end The end of the specified portion of the array.\r\n */\r\n slice(start?: number, end?: number): Uint8ClampedArray;\r\n\r\n /**\r\n * Determines whether the specified callback function returns true for any element of an array.\r\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\r\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\r\n * the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Sorts an array.\r\n * @param compareFn The name of the function used to determine the order of the elements. If\r\n * omitted, the elements are sorted in ascending, ASCII character order.\r\n */\r\n sort(compareFn?: (a: number, b: number) => number): this;\r\n\r\n /**\r\n * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements\r\n * at begin, inclusive, up to end, exclusive.\r\n * @param begin The index of the beginning of the array.\r\n * @param end The index of the end of the array.\r\n */\r\n subarray(begin: number, end?: number): Uint8ClampedArray;\r\n\r\n /**\r\n * Converts a number to a string by using the current locale.\r\n */\r\n toLocaleString(): string;\r\n\r\n /**\r\n * Returns a string representation of an array.\r\n */\r\n toString(): string;\r\n\r\n [index: number]: number;\r\n}\r\n\r\ninterface Uint8ClampedArrayConstructor {\r\n readonly prototype: Uint8ClampedArray;\r\n new (length: number): Uint8ClampedArray;\r\n new (array: ArrayLike): Uint8ClampedArray;\r\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray;\r\n\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * Returns a new array from a set of elements.\r\n * @param items A set of elements to include in the new array object.\r\n */\r\n of(...items: number[]): Uint8ClampedArray;\r\n\r\n /**\r\n * Creates an array from an array-like or iterable object.\r\n * @param arrayLike An array-like or iterable object to convert to an array.\r\n * @param mapfn A mapping function to call on every element of the array.\r\n * @param thisArg Value of 'this' used to invoke the mapfn.\r\n */\r\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray;\r\n}\r\ndeclare const Uint8ClampedArray: Uint8ClampedArrayConstructor;\r\n\r\n/**\r\n * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the\r\n * requested number of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Int16Array {\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * The ArrayBuffer instance referenced by the array.\r\n */\r\n readonly buffer: ArrayBuffer;\r\n\r\n /**\r\n * The length in bytes of the array.\r\n */\r\n readonly byteLength: number;\r\n\r\n /**\r\n * The offset in bytes of the array.\r\n */\r\n readonly byteOffset: number;\r\n\r\n /**\r\n * Returns the this object after copying a section of the array identified by start and end\r\n * to the same array starting at position target\r\n * @param target If target is negative, it is treated as length+target where length is the\r\n * length of the array.\r\n * @param start If start is negative, it is treated as length+start. If end is negative, it\r\n * is treated as length+end.\r\n * @param end If not specified, length of the this object is used as its default value.\r\n */\r\n copyWithin(target: number, start: number, end?: number): this;\r\n\r\n /**\r\n * Determines whether all the members of an array satisfy the specified test.\r\n * @param callbackfn A function that accepts up to three arguments. The every method calls\r\n * the callbackfn function for each element in array1 until the callbackfn returns false,\r\n * or until the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Returns the this object after filling the section identified by start and end with value\r\n * @param value value to fill array section with\r\n * @param start index to start filling the array at. If start is negative, it is treated as\r\n * length+start where length is the length of the array.\r\n * @param end index to stop filling the array at. If end is negative, it is treated as\r\n * length+end.\r\n */\r\n fill(value: number, start?: number, end?: number): this;\r\n\r\n /**\r\n * Returns the elements of an array that meet the condition specified in a callback function.\r\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n filter(callbackfn: (value: number, index: number, array: Int16Array) => any, thisArg?: any): Int16Array;\r\n\r\n /**\r\n * Returns the value of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found, find\r\n * immediately returns that element value. Otherwise, find returns undefined.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\r\n\r\n /**\r\n * Returns the index of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found,\r\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n findIndex(predicate: (value: number) => boolean, thisArg?: any): number;\r\n\r\n /**\r\n * Performs the specified action for each element in an array.\r\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void;\r\n\r\n /**\r\n * Returns the index of the first occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n indexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * Adds all the elements of an array separated by the specified separator string.\r\n * @param separator A string used to separate one element of an array from the next in the\r\n * resulting String. If omitted, the array elements are separated with a comma.\r\n */\r\n join(separator?: string): string;\r\n\r\n /**\r\n * Returns the index of the last occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n lastIndexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * The length of the array.\r\n */\r\n readonly length: number;\r\n\r\n /**\r\n * Calls a defined callback function on each element of an array, and returns an array that\r\n * contains the results.\r\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an\r\n * argument instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U;\r\n\r\n /**\r\n * Reverses the elements in an Array.\r\n */\r\n reverse(): Int16Array;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param index The index of the location to set.\r\n * @param value The value to set.\r\n */\r\n set(index: number, value: number): void;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param array A typed or untyped array of values to set.\r\n * @param offset The index in the current array at which the values are to be written.\r\n */\r\n set(array: ArrayLike, offset?: number): void;\r\n\r\n /**\r\n * Returns a section of an array.\r\n * @param start The beginning of the specified portion of the array.\r\n * @param end The end of the specified portion of the array.\r\n */\r\n slice(start?: number, end?: number): Int16Array;\r\n\r\n /**\r\n * Determines whether the specified callback function returns true for any element of an array.\r\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\r\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\r\n * the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Sorts an array.\r\n * @param compareFn The name of the function used to determine the order of the elements. If\r\n * omitted, the elements are sorted in ascending, ASCII character order.\r\n */\r\n sort(compareFn?: (a: number, b: number) => number): this;\r\n\r\n /**\r\n * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements\r\n * at begin, inclusive, up to end, exclusive.\r\n * @param begin The index of the beginning of the array.\r\n * @param end The index of the end of the array.\r\n */\r\n subarray(begin: number, end?: number): Int16Array;\r\n\r\n /**\r\n * Converts a number to a string by using the current locale.\r\n */\r\n toLocaleString(): string;\r\n\r\n /**\r\n * Returns a string representation of an array.\r\n */\r\n toString(): string;\r\n\r\n [index: number]: number;\r\n}\r\n\r\ninterface Int16ArrayConstructor {\r\n readonly prototype: Int16Array;\r\n new (length: number): Int16Array;\r\n new (array: ArrayLike): Int16Array;\r\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array;\r\n\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * Returns a new array from a set of elements.\r\n * @param items A set of elements to include in the new array object.\r\n */\r\n of(...items: number[]): Int16Array;\r\n\r\n /**\r\n * Creates an array from an array-like or iterable object.\r\n * @param arrayLike An array-like or iterable object to convert to an array.\r\n * @param mapfn A mapping function to call on every element of the array.\r\n * @param thisArg Value of 'this' used to invoke the mapfn.\r\n */\r\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array;\r\n\r\n}\r\ndeclare const Int16Array: Int16ArrayConstructor;\r\n\r\n/**\r\n * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the\r\n * requested number of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Uint16Array {\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * The ArrayBuffer instance referenced by the array.\r\n */\r\n readonly buffer: ArrayBuffer;\r\n\r\n /**\r\n * The length in bytes of the array.\r\n */\r\n readonly byteLength: number;\r\n\r\n /**\r\n * The offset in bytes of the array.\r\n */\r\n readonly byteOffset: number;\r\n\r\n /**\r\n * Returns the this object after copying a section of the array identified by start and end\r\n * to the same array starting at position target\r\n * @param target If target is negative, it is treated as length+target where length is the\r\n * length of the array.\r\n * @param start If start is negative, it is treated as length+start. If end is negative, it\r\n * is treated as length+end.\r\n * @param end If not specified, length of the this object is used as its default value.\r\n */\r\n copyWithin(target: number, start: number, end?: number): this;\r\n\r\n /**\r\n * Determines whether all the members of an array satisfy the specified test.\r\n * @param callbackfn A function that accepts up to three arguments. The every method calls\r\n * the callbackfn function for each element in array1 until the callbackfn returns false,\r\n * or until the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Returns the this object after filling the section identified by start and end with value\r\n * @param value value to fill array section with\r\n * @param start index to start filling the array at. If start is negative, it is treated as\r\n * length+start where length is the length of the array.\r\n * @param end index to stop filling the array at. If end is negative, it is treated as\r\n * length+end.\r\n */\r\n fill(value: number, start?: number, end?: number): this;\r\n\r\n /**\r\n * Returns the elements of an array that meet the condition specified in a callback function.\r\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n filter(callbackfn: (value: number, index: number, array: Uint16Array) => any, thisArg?: any): Uint16Array;\r\n\r\n /**\r\n * Returns the value of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found, find\r\n * immediately returns that element value. Otherwise, find returns undefined.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\r\n\r\n /**\r\n * Returns the index of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found,\r\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n findIndex(predicate: (value: number) => boolean, thisArg?: any): number;\r\n\r\n /**\r\n * Performs the specified action for each element in an array.\r\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void;\r\n\r\n /**\r\n * Returns the index of the first occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n indexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * Adds all the elements of an array separated by the specified separator string.\r\n * @param separator A string used to separate one element of an array from the next in the\r\n * resulting String. If omitted, the array elements are separated with a comma.\r\n */\r\n join(separator?: string): string;\r\n\r\n /**\r\n * Returns the index of the last occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n lastIndexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * The length of the array.\r\n */\r\n readonly length: number;\r\n\r\n /**\r\n * Calls a defined callback function on each element of an array, and returns an array that\r\n * contains the results.\r\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an\r\n * argument instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U;\r\n\r\n /**\r\n * Reverses the elements in an Array.\r\n */\r\n reverse(): Uint16Array;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param index The index of the location to set.\r\n * @param value The value to set.\r\n */\r\n set(index: number, value: number): void;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param array A typed or untyped array of values to set.\r\n * @param offset The index in the current array at which the values are to be written.\r\n */\r\n set(array: ArrayLike, offset?: number): void;\r\n\r\n /**\r\n * Returns a section of an array.\r\n * @param start The beginning of the specified portion of the array.\r\n * @param end The end of the specified portion of the array.\r\n */\r\n slice(start?: number, end?: number): Uint16Array;\r\n\r\n /**\r\n * Determines whether the specified callback function returns true for any element of an array.\r\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\r\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\r\n * the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Sorts an array.\r\n * @param compareFn The name of the function used to determine the order of the elements. If\r\n * omitted, the elements are sorted in ascending, ASCII character order.\r\n */\r\n sort(compareFn?: (a: number, b: number) => number): this;\r\n\r\n /**\r\n * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements\r\n * at begin, inclusive, up to end, exclusive.\r\n * @param begin The index of the beginning of the array.\r\n * @param end The index of the end of the array.\r\n */\r\n subarray(begin: number, end?: number): Uint16Array;\r\n\r\n /**\r\n * Converts a number to a string by using the current locale.\r\n */\r\n toLocaleString(): string;\r\n\r\n /**\r\n * Returns a string representation of an array.\r\n */\r\n toString(): string;\r\n\r\n [index: number]: number;\r\n}\r\n\r\ninterface Uint16ArrayConstructor {\r\n readonly prototype: Uint16Array;\r\n new (length: number): Uint16Array;\r\n new (array: ArrayLike): Uint16Array;\r\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array;\r\n\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * Returns a new array from a set of elements.\r\n * @param items A set of elements to include in the new array object.\r\n */\r\n of(...items: number[]): Uint16Array;\r\n\r\n /**\r\n * Creates an array from an array-like or iterable object.\r\n * @param arrayLike An array-like or iterable object to convert to an array.\r\n * @param mapfn A mapping function to call on every element of the array.\r\n * @param thisArg Value of 'this' used to invoke the mapfn.\r\n */\r\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array;\r\n\r\n}\r\ndeclare const Uint16Array: Uint16ArrayConstructor;\r\n/**\r\n * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the\r\n * requested number of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Int32Array {\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * The ArrayBuffer instance referenced by the array.\r\n */\r\n readonly buffer: ArrayBuffer;\r\n\r\n /**\r\n * The length in bytes of the array.\r\n */\r\n readonly byteLength: number;\r\n\r\n /**\r\n * The offset in bytes of the array.\r\n */\r\n readonly byteOffset: number;\r\n\r\n /**\r\n * Returns the this object after copying a section of the array identified by start and end\r\n * to the same array starting at position target\r\n * @param target If target is negative, it is treated as length+target where length is the\r\n * length of the array.\r\n * @param start If start is negative, it is treated as length+start. If end is negative, it\r\n * is treated as length+end.\r\n * @param end If not specified, length of the this object is used as its default value.\r\n */\r\n copyWithin(target: number, start: number, end?: number): this;\r\n\r\n /**\r\n * Determines whether all the members of an array satisfy the specified test.\r\n * @param callbackfn A function that accepts up to three arguments. The every method calls\r\n * the callbackfn function for each element in array1 until the callbackfn returns false,\r\n * or until the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Returns the this object after filling the section identified by start and end with value\r\n * @param value value to fill array section with\r\n * @param start index to start filling the array at. If start is negative, it is treated as\r\n * length+start where length is the length of the array.\r\n * @param end index to stop filling the array at. If end is negative, it is treated as\r\n * length+end.\r\n */\r\n fill(value: number, start?: number, end?: number): this;\r\n\r\n /**\r\n * Returns the elements of an array that meet the condition specified in a callback function.\r\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n filter(callbackfn: (value: number, index: number, array: Int32Array) => any, thisArg?: any): Int32Array;\r\n\r\n /**\r\n * Returns the value of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found, find\r\n * immediately returns that element value. Otherwise, find returns undefined.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\r\n\r\n /**\r\n * Returns the index of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found,\r\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n findIndex(predicate: (value: number) => boolean, thisArg?: any): number;\r\n\r\n /**\r\n * Performs the specified action for each element in an array.\r\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void;\r\n\r\n /**\r\n * Returns the index of the first occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n indexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * Adds all the elements of an array separated by the specified separator string.\r\n * @param separator A string used to separate one element of an array from the next in the\r\n * resulting String. If omitted, the array elements are separated with a comma.\r\n */\r\n join(separator?: string): string;\r\n\r\n /**\r\n * Returns the index of the last occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n lastIndexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * The length of the array.\r\n */\r\n readonly length: number;\r\n\r\n /**\r\n * Calls a defined callback function on each element of an array, and returns an array that\r\n * contains the results.\r\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an\r\n * argument instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U;\r\n\r\n /**\r\n * Reverses the elements in an Array.\r\n */\r\n reverse(): Int32Array;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param index The index of the location to set.\r\n * @param value The value to set.\r\n */\r\n set(index: number, value: number): void;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param array A typed or untyped array of values to set.\r\n * @param offset The index in the current array at which the values are to be written.\r\n */\r\n set(array: ArrayLike, offset?: number): void;\r\n\r\n /**\r\n * Returns a section of an array.\r\n * @param start The beginning of the specified portion of the array.\r\n * @param end The end of the specified portion of the array.\r\n */\r\n slice(start?: number, end?: number): Int32Array;\r\n\r\n /**\r\n * Determines whether the specified callback function returns true for any element of an array.\r\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\r\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\r\n * the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Sorts an array.\r\n * @param compareFn The name of the function used to determine the order of the elements. If\r\n * omitted, the elements are sorted in ascending, ASCII character order.\r\n */\r\n sort(compareFn?: (a: number, b: number) => number): this;\r\n\r\n /**\r\n * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements\r\n * at begin, inclusive, up to end, exclusive.\r\n * @param begin The index of the beginning of the array.\r\n * @param end The index of the end of the array.\r\n */\r\n subarray(begin: number, end?: number): Int32Array;\r\n\r\n /**\r\n * Converts a number to a string by using the current locale.\r\n */\r\n toLocaleString(): string;\r\n\r\n /**\r\n * Returns a string representation of an array.\r\n */\r\n toString(): string;\r\n\r\n [index: number]: number;\r\n}\r\n\r\ninterface Int32ArrayConstructor {\r\n readonly prototype: Int32Array;\r\n new (length: number): Int32Array;\r\n new (array: ArrayLike): Int32Array;\r\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array;\r\n\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * Returns a new array from a set of elements.\r\n * @param items A set of elements to include in the new array object.\r\n */\r\n of(...items: number[]): Int32Array;\r\n\r\n /**\r\n * Creates an array from an array-like or iterable object.\r\n * @param arrayLike An array-like or iterable object to convert to an array.\r\n * @param mapfn A mapping function to call on every element of the array.\r\n * @param thisArg Value of 'this' used to invoke the mapfn.\r\n */\r\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array;\r\n}\r\ndeclare const Int32Array: Int32ArrayConstructor;\r\n\r\n/**\r\n * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the\r\n * requested number of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Uint32Array {\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * The ArrayBuffer instance referenced by the array.\r\n */\r\n readonly buffer: ArrayBuffer;\r\n\r\n /**\r\n * The length in bytes of the array.\r\n */\r\n readonly byteLength: number;\r\n\r\n /**\r\n * The offset in bytes of the array.\r\n */\r\n readonly byteOffset: number;\r\n\r\n /**\r\n * Returns the this object after copying a section of the array identified by start and end\r\n * to the same array starting at position target\r\n * @param target If target is negative, it is treated as length+target where length is the\r\n * length of the array.\r\n * @param start If start is negative, it is treated as length+start. If end is negative, it\r\n * is treated as length+end.\r\n * @param end If not specified, length of the this object is used as its default value.\r\n */\r\n copyWithin(target: number, start: number, end?: number): this;\r\n\r\n /**\r\n * Determines whether all the members of an array satisfy the specified test.\r\n * @param callbackfn A function that accepts up to three arguments. The every method calls\r\n * the callbackfn function for each element in array1 until the callbackfn returns false,\r\n * or until the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Returns the this object after filling the section identified by start and end with value\r\n * @param value value to fill array section with\r\n * @param start index to start filling the array at. If start is negative, it is treated as\r\n * length+start where length is the length of the array.\r\n * @param end index to stop filling the array at. If end is negative, it is treated as\r\n * length+end.\r\n */\r\n fill(value: number, start?: number, end?: number): this;\r\n\r\n /**\r\n * Returns the elements of an array that meet the condition specified in a callback function.\r\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n filter(callbackfn: (value: number, index: number, array: Uint32Array) => any, thisArg?: any): Uint32Array;\r\n\r\n /**\r\n * Returns the value of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found, find\r\n * immediately returns that element value. Otherwise, find returns undefined.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\r\n\r\n /**\r\n * Returns the index of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found,\r\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n findIndex(predicate: (value: number) => boolean, thisArg?: any): number;\r\n\r\n /**\r\n * Performs the specified action for each element in an array.\r\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void;\r\n\r\n /**\r\n * Returns the index of the first occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n indexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * Adds all the elements of an array separated by the specified separator string.\r\n * @param separator A string used to separate one element of an array from the next in the\r\n * resulting String. If omitted, the array elements are separated with a comma.\r\n */\r\n join(separator?: string): string;\r\n\r\n /**\r\n * Returns the index of the last occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n lastIndexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * The length of the array.\r\n */\r\n readonly length: number;\r\n\r\n /**\r\n * Calls a defined callback function on each element of an array, and returns an array that\r\n * contains the results.\r\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an\r\n * argument instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U;\r\n\r\n /**\r\n * Reverses the elements in an Array.\r\n */\r\n reverse(): Uint32Array;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param index The index of the location to set.\r\n * @param value The value to set.\r\n */\r\n set(index: number, value: number): void;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param array A typed or untyped array of values to set.\r\n * @param offset The index in the current array at which the values are to be written.\r\n */\r\n set(array: ArrayLike, offset?: number): void;\r\n\r\n /**\r\n * Returns a section of an array.\r\n * @param start The beginning of the specified portion of the array.\r\n * @param end The end of the specified portion of the array.\r\n */\r\n slice(start?: number, end?: number): Uint32Array;\r\n\r\n /**\r\n * Determines whether the specified callback function returns true for any element of an array.\r\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\r\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\r\n * the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Sorts an array.\r\n * @param compareFn The name of the function used to determine the order of the elements. If\r\n * omitted, the elements are sorted in ascending, ASCII character order.\r\n */\r\n sort(compareFn?: (a: number, b: number) => number): this;\r\n\r\n /**\r\n * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements\r\n * at begin, inclusive, up to end, exclusive.\r\n * @param begin The index of the beginning of the array.\r\n * @param end The index of the end of the array.\r\n */\r\n subarray(begin: number, end?: number): Uint32Array;\r\n\r\n /**\r\n * Converts a number to a string by using the current locale.\r\n */\r\n toLocaleString(): string;\r\n\r\n /**\r\n * Returns a string representation of an array.\r\n */\r\n toString(): string;\r\n\r\n [index: number]: number;\r\n}\r\n\r\ninterface Uint32ArrayConstructor {\r\n readonly prototype: Uint32Array;\r\n new (length: number): Uint32Array;\r\n new (array: ArrayLike): Uint32Array;\r\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array;\r\n\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * Returns a new array from a set of elements.\r\n * @param items A set of elements to include in the new array object.\r\n */\r\n of(...items: number[]): Uint32Array;\r\n\r\n /**\r\n * Creates an array from an array-like or iterable object.\r\n * @param arrayLike An array-like or iterable object to convert to an array.\r\n * @param mapfn A mapping function to call on every element of the array.\r\n * @param thisArg Value of 'this' used to invoke the mapfn.\r\n */\r\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array;\r\n}\r\ndeclare const Uint32Array: Uint32ArrayConstructor;\r\n\r\n/**\r\n * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number\r\n * of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Float32Array {\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * The ArrayBuffer instance referenced by the array.\r\n */\r\n readonly buffer: ArrayBuffer;\r\n\r\n /**\r\n * The length in bytes of the array.\r\n */\r\n readonly byteLength: number;\r\n\r\n /**\r\n * The offset in bytes of the array.\r\n */\r\n readonly byteOffset: number;\r\n\r\n /**\r\n * Returns the this object after copying a section of the array identified by start and end\r\n * to the same array starting at position target\r\n * @param target If target is negative, it is treated as length+target where length is the\r\n * length of the array.\r\n * @param start If start is negative, it is treated as length+start. If end is negative, it\r\n * is treated as length+end.\r\n * @param end If not specified, length of the this object is used as its default value.\r\n */\r\n copyWithin(target: number, start: number, end?: number): this;\r\n\r\n /**\r\n * Determines whether all the members of an array satisfy the specified test.\r\n * @param callbackfn A function that accepts up to three arguments. The every method calls\r\n * the callbackfn function for each element in array1 until the callbackfn returns false,\r\n * or until the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Returns the this object after filling the section identified by start and end with value\r\n * @param value value to fill array section with\r\n * @param start index to start filling the array at. If start is negative, it is treated as\r\n * length+start where length is the length of the array.\r\n * @param end index to stop filling the array at. If end is negative, it is treated as\r\n * length+end.\r\n */\r\n fill(value: number, start?: number, end?: number): this;\r\n\r\n /**\r\n * Returns the elements of an array that meet the condition specified in a callback function.\r\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n filter(callbackfn: (value: number, index: number, array: Float32Array) => any, thisArg?: any): Float32Array;\r\n\r\n /**\r\n * Returns the value of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found, find\r\n * immediately returns that element value. Otherwise, find returns undefined.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\r\n\r\n /**\r\n * Returns the index of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found,\r\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n findIndex(predicate: (value: number) => boolean, thisArg?: any): number;\r\n\r\n /**\r\n * Performs the specified action for each element in an array.\r\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void;\r\n\r\n /**\r\n * Returns the index of the first occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n indexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * Adds all the elements of an array separated by the specified separator string.\r\n * @param separator A string used to separate one element of an array from the next in the\r\n * resulting String. If omitted, the array elements are separated with a comma.\r\n */\r\n join(separator?: string): string;\r\n\r\n /**\r\n * Returns the index of the last occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n lastIndexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * The length of the array.\r\n */\r\n readonly length: number;\r\n\r\n /**\r\n * Calls a defined callback function on each element of an array, and returns an array that\r\n * contains the results.\r\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an\r\n * argument instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U;\r\n\r\n /**\r\n * Reverses the elements in an Array.\r\n */\r\n reverse(): Float32Array;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param index The index of the location to set.\r\n * @param value The value to set.\r\n */\r\n set(index: number, value: number): void;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param array A typed or untyped array of values to set.\r\n * @param offset The index in the current array at which the values are to be written.\r\n */\r\n set(array: ArrayLike, offset?: number): void;\r\n\r\n /**\r\n * Returns a section of an array.\r\n * @param start The beginning of the specified portion of the array.\r\n * @param end The end of the specified portion of the array.\r\n */\r\n slice(start?: number, end?: number): Float32Array;\r\n\r\n /**\r\n * Determines whether the specified callback function returns true for any element of an array.\r\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\r\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\r\n * the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Sorts an array.\r\n * @param compareFn The name of the function used to determine the order of the elements. If\r\n * omitted, the elements are sorted in ascending, ASCII character order.\r\n */\r\n sort(compareFn?: (a: number, b: number) => number): this;\r\n\r\n /**\r\n * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements\r\n * at begin, inclusive, up to end, exclusive.\r\n * @param begin The index of the beginning of the array.\r\n * @param end The index of the end of the array.\r\n */\r\n subarray(begin: number, end?: number): Float32Array;\r\n\r\n /**\r\n * Converts a number to a string by using the current locale.\r\n */\r\n toLocaleString(): string;\r\n\r\n /**\r\n * Returns a string representation of an array.\r\n */\r\n toString(): string;\r\n\r\n [index: number]: number;\r\n}\r\n\r\ninterface Float32ArrayConstructor {\r\n readonly prototype: Float32Array;\r\n new (length: number): Float32Array;\r\n new (array: ArrayLike): Float32Array;\r\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array;\r\n\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * Returns a new array from a set of elements.\r\n * @param items A set of elements to include in the new array object.\r\n */\r\n of(...items: number[]): Float32Array;\r\n\r\n /**\r\n * Creates an array from an array-like or iterable object.\r\n * @param arrayLike An array-like or iterable object to convert to an array.\r\n * @param mapfn A mapping function to call on every element of the array.\r\n * @param thisArg Value of 'this' used to invoke the mapfn.\r\n */\r\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array;\r\n\r\n}\r\ndeclare const Float32Array: Float32ArrayConstructor;\r\n\r\n/**\r\n * A typed array of 64-bit float values. The contents are initialized to 0. If the requested\r\n * number of bytes could not be allocated an exception is raised.\r\n */\r\ninterface Float64Array {\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * The ArrayBuffer instance referenced by the array.\r\n */\r\n readonly buffer: ArrayBuffer;\r\n\r\n /**\r\n * The length in bytes of the array.\r\n */\r\n readonly byteLength: number;\r\n\r\n /**\r\n * The offset in bytes of the array.\r\n */\r\n readonly byteOffset: number;\r\n\r\n /**\r\n * Returns the this object after copying a section of the array identified by start and end\r\n * to the same array starting at position target\r\n * @param target If target is negative, it is treated as length+target where length is the\r\n * length of the array.\r\n * @param start If start is negative, it is treated as length+start. If end is negative, it\r\n * is treated as length+end.\r\n * @param end If not specified, length of the this object is used as its default value.\r\n */\r\n copyWithin(target: number, start: number, end?: number): this;\r\n\r\n /**\r\n * Determines whether all the members of an array satisfy the specified test.\r\n * @param callbackfn A function that accepts up to three arguments. The every method calls\r\n * the callbackfn function for each element in array1 until the callbackfn returns false,\r\n * or until the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Returns the this object after filling the section identified by start and end with value\r\n * @param value value to fill array section with\r\n * @param start index to start filling the array at. If start is negative, it is treated as\r\n * length+start where length is the length of the array.\r\n * @param end index to stop filling the array at. If end is negative, it is treated as\r\n * length+end.\r\n */\r\n fill(value: number, start?: number, end?: number): this;\r\n\r\n /**\r\n * Returns the elements of an array that meet the condition specified in a callback function.\r\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n filter(callbackfn: (value: number, index: number, array: Float64Array) => any, thisArg?: any): Float64Array;\r\n\r\n /**\r\n * Returns the value of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found, find\r\n * immediately returns that element value. Otherwise, find returns undefined.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\r\n\r\n /**\r\n * Returns the index of the first element in the array where predicate is true, and undefined\r\n * otherwise.\r\n * @param predicate find calls predicate once for each element of the array, in ascending\r\n * order, until it finds one where predicate returns true. If such an element is found,\r\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\r\n * @param thisArg If provided, it will be used as the this value for each invocation of\r\n * predicate. If it is not provided, undefined is used instead.\r\n */\r\n findIndex(predicate: (value: number) => boolean, thisArg?: any): number;\r\n\r\n /**\r\n * Performs the specified action for each element in an array.\r\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void;\r\n\r\n /**\r\n * Returns the index of the first occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n indexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * Adds all the elements of an array separated by the specified separator string.\r\n * @param separator A string used to separate one element of an array from the next in the\r\n * resulting String. If omitted, the array elements are separated with a comma.\r\n */\r\n join(separator?: string): string;\r\n\r\n /**\r\n * Returns the index of the last occurrence of a value in an array.\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\r\n * search starts at index 0.\r\n */\r\n lastIndexOf(searchElement: number, fromIndex?: number): number;\r\n\r\n /**\r\n * The length of the array.\r\n */\r\n readonly length: number;\r\n\r\n /**\r\n * Calls a defined callback function on each element of an array, and returns an array that\r\n * contains the results.\r\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array. The return value of\r\n * the callback function is the accumulated result, and is provided as an argument in the next\r\n * call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\r\n * callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an\r\n * argument instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number;\r\n\r\n /**\r\n * Calls the specified callback function for all the elements in an array, in descending order.\r\n * The return value of the callback function is the accumulated result, and is provided as an\r\n * argument in the next call to the callback function.\r\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\r\n * the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start\r\n * the accumulation. The first call to the callbackfn function provides this value as an argument\r\n * instead of an array value.\r\n */\r\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U;\r\n\r\n /**\r\n * Reverses the elements in an Array.\r\n */\r\n reverse(): Float64Array;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param index The index of the location to set.\r\n * @param value The value to set.\r\n */\r\n set(index: number, value: number): void;\r\n\r\n /**\r\n * Sets a value or an array of values.\r\n * @param array A typed or untyped array of values to set.\r\n * @param offset The index in the current array at which the values are to be written.\r\n */\r\n set(array: ArrayLike, offset?: number): void;\r\n\r\n /**\r\n * Returns a section of an array.\r\n * @param start The beginning of the specified portion of the array.\r\n * @param end The end of the specified portion of the array.\r\n */\r\n slice(start?: number, end?: number): Float64Array;\r\n\r\n /**\r\n * Determines whether the specified callback function returns true for any element of an array.\r\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\r\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\r\n * the end of the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\r\n * If thisArg is omitted, undefined is used as the this value.\r\n */\r\n some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean;\r\n\r\n /**\r\n * Sorts an array.\r\n * @param compareFn The name of the function used to determine the order of the elements. If\r\n * omitted, the elements are sorted in ascending, ASCII character order.\r\n */\r\n sort(compareFn?: (a: number, b: number) => number): this;\r\n\r\n /**\r\n * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements\r\n * at begin, inclusive, up to end, exclusive.\r\n * @param begin The index of the beginning of the array.\r\n * @param end The index of the end of the array.\r\n */\r\n subarray(begin: number, end?: number): Float64Array;\r\n\r\n /**\r\n * Converts a number to a string by using the current locale.\r\n */\r\n toLocaleString(): string;\r\n\r\n /**\r\n * Returns a string representation of an array.\r\n */\r\n toString(): string;\r\n\r\n [index: number]: number;\r\n}\r\n\r\ninterface Float64ArrayConstructor {\r\n readonly prototype: Float64Array;\r\n new (length: number): Float64Array;\r\n new (array: ArrayLike): Float64Array;\r\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array;\r\n\r\n /**\r\n * The size in bytes of each element in the array.\r\n */\r\n readonly BYTES_PER_ELEMENT: number;\r\n\r\n /**\r\n * Returns a new array from a set of elements.\r\n * @param items A set of elements to include in the new array object.\r\n */\r\n of(...items: number[]): Float64Array;\r\n\r\n /**\r\n * Creates an array from an array-like or iterable object.\r\n * @param arrayLike An array-like or iterable object to convert to an array.\r\n * @param mapfn A mapping function to call on every element of the array.\r\n * @param thisArg Value of 'this' used to invoke the mapfn.\r\n */\r\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array;\r\n}\r\ndeclare const Float64Array: Float64ArrayConstructor;\r\n\r\n/////////////////////////////\r\n/// ECMAScript Internationalization API\r\n/////////////////////////////\r\n\r\ndeclare module Intl {\r\n interface CollatorOptions {\r\n usage?: string;\r\n localeMatcher?: string;\r\n numeric?: boolean;\r\n caseFirst?: string;\r\n sensitivity?: string;\r\n ignorePunctuation?: boolean;\r\n }\r\n\r\n interface ResolvedCollatorOptions {\r\n locale: string;\r\n usage: string;\r\n sensitivity: string;\r\n ignorePunctuation: boolean;\r\n collation: string;\r\n caseFirst: string;\r\n numeric: boolean;\r\n }\r\n\r\n interface Collator {\r\n compare(x: string, y: string): number;\r\n resolvedOptions(): ResolvedCollatorOptions;\r\n }\r\n var Collator: {\r\n new (locales?: string[], options?: CollatorOptions): Collator;\r\n new (locale?: string, options?: CollatorOptions): Collator;\r\n (locales?: string[], options?: CollatorOptions): Collator;\r\n (locale?: string, options?: CollatorOptions): Collator;\r\n supportedLocalesOf(locales: string[], options?: CollatorOptions): string[];\r\n supportedLocalesOf(locale: string, options?: CollatorOptions): string[];\r\n }\r\n\r\n interface NumberFormatOptions {\r\n localeMatcher?: string;\r\n style?: string;\r\n currency?: string;\r\n currencyDisplay?: string;\r\n useGrouping?: boolean;\r\n minimumIntegerDigits?: number;\r\n minimumFractionDigits?: number;\r\n maximumFractionDigits?: number;\r\n minimumSignificantDigits?: number;\r\n maximumSignificantDigits?: number;\r\n }\r\n\r\n interface ResolvedNumberFormatOptions {\r\n locale: string;\r\n numberingSystem: string;\r\n style: string;\r\n currency?: string;\r\n currencyDisplay?: string;\r\n minimumIntegerDigits: number;\r\n minimumFractionDigits: number;\r\n maximumFractionDigits: number;\r\n minimumSignificantDigits?: number;\r\n maximumSignificantDigits?: number;\r\n useGrouping: boolean;\r\n }\r\n\r\n interface NumberFormat {\r\n format(value: number): string;\r\n resolvedOptions(): ResolvedNumberFormatOptions;\r\n }\r\n var NumberFormat: {\r\n new (locales?: string[], options?: NumberFormatOptions): NumberFormat;\r\n new (locale?: string, options?: NumberFormatOptions): NumberFormat;\r\n (locales?: string[], options?: NumberFormatOptions): NumberFormat;\r\n (locale?: string, options?: NumberFormatOptions): NumberFormat;\r\n supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[];\r\n supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[];\r\n }\r\n\r\n interface DateTimeFormatOptions {\r\n localeMatcher?: string;\r\n weekday?: string;\r\n era?: string;\r\n year?: string;\r\n month?: string;\r\n day?: string;\r\n hour?: string;\r\n minute?: string;\r\n second?: string;\r\n timeZoneName?: string;\r\n formatMatcher?: string;\r\n hour12?: boolean;\r\n timeZone?: string;\r\n }\r\n\r\n interface ResolvedDateTimeFormatOptions {\r\n locale: string;\r\n calendar: string;\r\n numberingSystem: string;\r\n timeZone: string;\r\n hour12?: boolean;\r\n weekday?: string;\r\n era?: string;\r\n year?: string;\r\n month?: string;\r\n day?: string;\r\n hour?: string;\r\n minute?: string;\r\n second?: string;\r\n timeZoneName?: string;\r\n }\r\n\r\n interface DateTimeFormat {\r\n format(date?: Date | number): string;\r\n resolvedOptions(): ResolvedDateTimeFormatOptions;\r\n }\r\n var DateTimeFormat: {\r\n new (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat;\r\n new (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat;\r\n (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat;\r\n (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat;\r\n supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[];\r\n supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[];\r\n }\r\n}\r\n\r\ninterface String {\r\n /**\r\n * Determines whether two strings are equivalent in the current locale.\r\n * @param that String to compare to target string\r\n * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.\r\n * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details.\r\n */\r\n localeCompare(that: string, locales: string[], options?: Intl.CollatorOptions): number;\r\n\r\n /**\r\n * Determines whether two strings are equivalent in the current locale.\r\n * @param that String to compare to target string\r\n * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.\r\n * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details.\r\n */\r\n localeCompare(that: string, locale: string, options?: Intl.CollatorOptions): number;\r\n}\r\n\r\ninterface Number {\r\n /**\r\n * Converts a number to a string by using the current or specified locale.\r\n * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.\r\n * @param options An object that contains one or more properties that specify comparison options.\r\n */\r\n toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string;\r\n\r\n /**\r\n * Converts a number to a string by using the current or specified locale.\r\n * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.\r\n * @param options An object that contains one or more properties that specify comparison options.\r\n */\r\n toLocaleString(locale?: string, options?: Intl.NumberFormatOptions): string;\r\n}\r\n\r\ninterface Date {\r\n /**\r\n * Converts a date and time to a string by using the current or specified locale.\r\n * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.\r\n * @param options An object that contains one or more properties that specify comparison options.\r\n */\r\n toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;\r\n /**\r\n * Converts a date to a string by using the current or specified locale.\r\n * @param locales An array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.\r\n * @param options An object that contains one or more properties that specify comparison options.\r\n */\r\n toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string;\r\n\r\n /**\r\n * Converts a time to a string by using the current or specified locale.\r\n * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.\r\n * @param options An object that contains one or more properties that specify comparison options.\r\n */\r\n toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string;\r\n\r\n /**\r\n * Converts a date and time to a string by using the current or specified locale.\r\n * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.\r\n * @param options An object that contains one or more properties that specify comparison options.\r\n */\r\n toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string;\r\n\r\n /**\r\n * Converts a date to a string by using the current or specified locale.\r\n * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.\r\n * @param options An object that contains one or more properties that specify comparison options.\r\n */\r\n toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string;\r\n\r\n /**\r\n * Converts a time to a string by using the current or specified locale.\r\n * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used.\r\n * @param options An object that contains one or more properties that specify comparison options.\r\n */\r\n toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string;\r\n}\r\n\r\n/////////////////////////////\r\n/// IE DOM APIs\r\n/////////////////////////////\r\n\r\ninterface Algorithm {\r\n name: string;\r\n}\r\n\r\ninterface AriaRequestEventInit extends EventInit {\r\n attributeName?: string;\r\n attributeValue?: string;\r\n}\r\n\r\ninterface CommandEventInit extends EventInit {\r\n commandName?: string;\r\n detail?: string;\r\n}\r\n\r\ninterface CompositionEventInit extends UIEventInit {\r\n data?: string;\r\n}\r\n\r\ninterface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation {\r\n arrayOfDomainStrings?: string[];\r\n}\r\n\r\ninterface ConstrainBooleanParameters {\r\n exact?: boolean;\r\n ideal?: boolean;\r\n}\r\n\r\ninterface ConstrainDOMStringParameters {\r\n exact?: string | string[];\r\n ideal?: string | string[];\r\n}\r\n\r\ninterface ConstrainDoubleRange extends DoubleRange {\r\n exact?: number;\r\n ideal?: number;\r\n}\r\n\r\ninterface ConstrainLongRange extends LongRange {\r\n exact?: number;\r\n ideal?: number;\r\n}\r\n\r\ninterface ConstrainVideoFacingModeParameters {\r\n exact?: string | string[];\r\n ideal?: string | string[];\r\n}\r\n\r\ninterface CustomEventInit extends EventInit {\r\n detail?: any;\r\n}\r\n\r\ninterface DeviceAccelerationDict {\r\n x?: number;\r\n y?: number;\r\n z?: number;\r\n}\r\n\r\ninterface DeviceLightEventInit extends EventInit {\r\n value?: number;\r\n}\r\n\r\ninterface DeviceRotationRateDict {\r\n alpha?: number;\r\n beta?: number;\r\n gamma?: number;\r\n}\r\n\r\ninterface DoubleRange {\r\n max?: number;\r\n min?: number;\r\n}\r\n\r\ninterface EventInit {\r\n bubbles?: boolean;\r\n cancelable?: boolean;\r\n}\r\n\r\ninterface EventModifierInit extends UIEventInit {\r\n ctrlKey?: boolean;\r\n shiftKey?: boolean;\r\n altKey?: boolean;\r\n metaKey?: boolean;\r\n modifierAltGraph?: boolean;\r\n modifierCapsLock?: boolean;\r\n modifierFn?: boolean;\r\n modifierFnLock?: boolean;\r\n modifierHyper?: boolean;\r\n modifierNumLock?: boolean;\r\n modifierOS?: boolean;\r\n modifierScrollLock?: boolean;\r\n modifierSuper?: boolean;\r\n modifierSymbol?: boolean;\r\n modifierSymbolLock?: boolean;\r\n}\r\n\r\ninterface ExceptionInformation {\r\n domain?: string;\r\n}\r\n\r\ninterface FocusEventInit extends UIEventInit {\r\n relatedTarget?: EventTarget;\r\n}\r\n\r\ninterface HashChangeEventInit extends EventInit {\r\n newURL?: string;\r\n oldURL?: string;\r\n}\r\n\r\ninterface IDBIndexParameters {\r\n multiEntry?: boolean;\r\n unique?: boolean;\r\n}\r\n\r\ninterface IDBObjectStoreParameters {\r\n autoIncrement?: boolean;\r\n keyPath?: IDBKeyPath;\r\n}\r\n\r\ninterface KeyAlgorithm {\r\n name?: string;\r\n}\r\n\r\ninterface KeyboardEventInit extends EventModifierInit {\r\n code?: string;\r\n key?: string;\r\n location?: number;\r\n repeat?: boolean;\r\n}\r\n\r\ninterface LongRange {\r\n max?: number;\r\n min?: number;\r\n}\r\n\r\ninterface MSAccountInfo {\r\n rpDisplayName?: string;\r\n userDisplayName?: string;\r\n accountName?: string;\r\n userId?: string;\r\n accountImageUri?: string;\r\n}\r\n\r\ninterface MSAudioLocalClientEvent extends MSLocalClientEventBase {\r\n networkSendQualityEventRatio?: number;\r\n networkDelayEventRatio?: number;\r\n cpuInsufficientEventRatio?: number;\r\n deviceHalfDuplexAECEventRatio?: number;\r\n deviceRenderNotFunctioningEventRatio?: number;\r\n deviceCaptureNotFunctioningEventRatio?: number;\r\n deviceGlitchesEventRatio?: number;\r\n deviceLowSNREventRatio?: number;\r\n deviceLowSpeechLevelEventRatio?: number;\r\n deviceClippingEventRatio?: number;\r\n deviceEchoEventRatio?: number;\r\n deviceNearEndToEchoRatioEventRatio?: number;\r\n deviceRenderZeroVolumeEventRatio?: number;\r\n deviceRenderMuteEventRatio?: number;\r\n deviceMultipleEndpointsEventCount?: number;\r\n deviceHowlingEventCount?: number;\r\n}\r\n\r\ninterface MSAudioRecvPayload extends MSPayloadBase {\r\n samplingRate?: number;\r\n signal?: MSAudioRecvSignal;\r\n packetReorderRatio?: number;\r\n packetReorderDepthAvg?: number;\r\n packetReorderDepthMax?: number;\r\n burstLossLength1?: number;\r\n burstLossLength2?: number;\r\n burstLossLength3?: number;\r\n burstLossLength4?: number;\r\n burstLossLength5?: number;\r\n burstLossLength6?: number;\r\n burstLossLength7?: number;\r\n burstLossLength8OrHigher?: number;\r\n fecRecvDistance1?: number;\r\n fecRecvDistance2?: number;\r\n fecRecvDistance3?: number;\r\n ratioConcealedSamplesAvg?: number;\r\n ratioStretchedSamplesAvg?: number;\r\n ratioCompressedSamplesAvg?: number;\r\n}\r\n\r\ninterface MSAudioRecvSignal {\r\n initialSignalLevelRMS?: number;\r\n recvSignalLevelCh1?: number;\r\n recvNoiseLevelCh1?: number;\r\n renderSignalLevel?: number;\r\n renderNoiseLevel?: number;\r\n renderLoopbackSignalLevel?: number;\r\n}\r\n\r\ninterface MSAudioSendPayload extends MSPayloadBase {\r\n samplingRate?: number;\r\n signal?: MSAudioSendSignal;\r\n audioFECUsed?: boolean;\r\n sendMutePercent?: number;\r\n}\r\n\r\ninterface MSAudioSendSignal {\r\n noiseLevel?: number;\r\n sendSignalLevelCh1?: number;\r\n sendNoiseLevelCh1?: number;\r\n}\r\n\r\ninterface MSConnectivity {\r\n iceType?: string;\r\n iceWarningFlags?: MSIceWarningFlags;\r\n relayAddress?: MSRelayAddress;\r\n}\r\n\r\ninterface MSCredentialFilter {\r\n accept?: MSCredentialSpec[];\r\n}\r\n\r\ninterface MSCredentialParameters {\r\n type?: string;\r\n}\r\n\r\ninterface MSCredentialSpec {\r\n type?: string;\r\n id?: string;\r\n}\r\n\r\ninterface MSDelay {\r\n roundTrip?: number;\r\n roundTripMax?: number;\r\n}\r\n\r\ninterface MSDescription extends RTCStats {\r\n connectivity?: MSConnectivity;\r\n transport?: string;\r\n networkconnectivity?: MSNetworkConnectivityInfo;\r\n localAddr?: MSIPAddressInfo;\r\n remoteAddr?: MSIPAddressInfo;\r\n deviceDevName?: string;\r\n reflexiveLocalIPAddr?: MSIPAddressInfo;\r\n}\r\n\r\ninterface MSFIDOCredentialParameters extends MSCredentialParameters {\r\n algorithm?: string | Algorithm;\r\n authenticators?: AAGUID[];\r\n}\r\n\r\ninterface MSIPAddressInfo {\r\n ipAddr?: string;\r\n port?: number;\r\n manufacturerMacAddrMask?: string;\r\n}\r\n\r\ninterface MSIceWarningFlags {\r\n turnTcpTimedOut?: boolean;\r\n turnUdpAllocateFailed?: boolean;\r\n turnUdpSendFailed?: boolean;\r\n turnTcpAllocateFailed?: boolean;\r\n turnTcpSendFailed?: boolean;\r\n udpLocalConnectivityFailed?: boolean;\r\n udpNatConnectivityFailed?: boolean;\r\n udpRelayConnectivityFailed?: boolean;\r\n tcpNatConnectivityFailed?: boolean;\r\n tcpRelayConnectivityFailed?: boolean;\r\n connCheckMessageIntegrityFailed?: boolean;\r\n allocationMessageIntegrityFailed?: boolean;\r\n connCheckOtherError?: boolean;\r\n turnAuthUnknownUsernameError?: boolean;\r\n noRelayServersConfigured?: boolean;\r\n multipleRelayServersAttempted?: boolean;\r\n portRangeExhausted?: boolean;\r\n alternateServerReceived?: boolean;\r\n pseudoTLSFailure?: boolean;\r\n turnTurnTcpConnectivityFailed?: boolean;\r\n useCandidateChecksFailed?: boolean;\r\n fipsAllocationFailure?: boolean;\r\n}\r\n\r\ninterface MSJitter {\r\n interArrival?: number;\r\n interArrivalMax?: number;\r\n interArrivalSD?: number;\r\n}\r\n\r\ninterface MSLocalClientEventBase extends RTCStats {\r\n networkReceiveQualityEventRatio?: number;\r\n networkBandwidthLowEventRatio?: number;\r\n}\r\n\r\ninterface MSNetwork extends RTCStats {\r\n jitter?: MSJitter;\r\n delay?: MSDelay;\r\n packetLoss?: MSPacketLoss;\r\n utilization?: MSUtilization;\r\n}\r\n\r\ninterface MSNetworkConnectivityInfo {\r\n vpn?: boolean;\r\n linkspeed?: number;\r\n networkConnectionDetails?: string;\r\n}\r\n\r\ninterface MSNetworkInterfaceType {\r\n interfaceTypeEthernet?: boolean;\r\n interfaceTypeWireless?: boolean;\r\n interfaceTypePPP?: boolean;\r\n interfaceTypeTunnel?: boolean;\r\n interfaceTypeWWAN?: boolean;\r\n}\r\n\r\ninterface MSOutboundNetwork extends MSNetwork {\r\n appliedBandwidthLimit?: number;\r\n}\r\n\r\ninterface MSPacketLoss {\r\n lossRate?: number;\r\n lossRateMax?: number;\r\n}\r\n\r\ninterface MSPayloadBase extends RTCStats {\r\n payloadDescription?: string;\r\n}\r\n\r\ninterface MSRelayAddress {\r\n relayAddress?: string;\r\n port?: number;\r\n}\r\n\r\ninterface MSSignatureParameters {\r\n userPrompt?: string;\r\n}\r\n\r\ninterface MSTransportDiagnosticsStats extends RTCStats {\r\n baseAddress?: string;\r\n localAddress?: string;\r\n localSite?: string;\r\n networkName?: string;\r\n remoteAddress?: string;\r\n remoteSite?: string;\r\n localMR?: string;\r\n remoteMR?: string;\r\n iceWarningFlags?: MSIceWarningFlags;\r\n portRangeMin?: number;\r\n portRangeMax?: number;\r\n localMRTCPPort?: number;\r\n remoteMRTCPPort?: number;\r\n stunVer?: number;\r\n numConsentReqSent?: number;\r\n numConsentReqReceived?: number;\r\n numConsentRespSent?: number;\r\n numConsentRespReceived?: number;\r\n interfaces?: MSNetworkInterfaceType;\r\n baseInterface?: MSNetworkInterfaceType;\r\n protocol?: string;\r\n localInterface?: MSNetworkInterfaceType;\r\n localAddrType?: string;\r\n remoteAddrType?: string;\r\n iceRole?: string;\r\n rtpRtcpMux?: boolean;\r\n allocationTimeInMs?: number;\r\n msRtcEngineVersion?: string;\r\n}\r\n\r\ninterface MSUtilization {\r\n packets?: number;\r\n bandwidthEstimation?: number;\r\n bandwidthEstimationMin?: number;\r\n bandwidthEstimationMax?: number;\r\n bandwidthEstimationStdDev?: number;\r\n bandwidthEstimationAvg?: number;\r\n}\r\n\r\ninterface MSVideoPayload extends MSPayloadBase {\r\n resoluton?: string;\r\n videoBitRateAvg?: number;\r\n videoBitRateMax?: number;\r\n videoFrameRateAvg?: number;\r\n videoPacketLossRate?: number;\r\n durationSeconds?: number;\r\n}\r\n\r\ninterface MSVideoRecvPayload extends MSVideoPayload {\r\n videoFrameLossRate?: number;\r\n recvCodecType?: string;\r\n recvResolutionWidth?: number;\r\n recvResolutionHeight?: number;\r\n videoResolutions?: MSVideoResolutionDistribution;\r\n recvFrameRateAverage?: number;\r\n recvBitRateMaximum?: number;\r\n recvBitRateAverage?: number;\r\n recvVideoStreamsMax?: number;\r\n recvVideoStreamsMin?: number;\r\n recvVideoStreamsMode?: number;\r\n videoPostFECPLR?: number;\r\n lowBitRateCallPercent?: number;\r\n lowFrameRateCallPercent?: number;\r\n reorderBufferTotalPackets?: number;\r\n recvReorderBufferReorderedPackets?: number;\r\n recvReorderBufferPacketsDroppedDueToBufferExhaustion?: number;\r\n recvReorderBufferMaxSuccessfullyOrderedExtent?: number;\r\n recvReorderBufferMaxSuccessfullyOrderedLateTime?: number;\r\n recvReorderBufferPacketsDroppedDueToTimeout?: number;\r\n recvFpsHarmonicAverage?: number;\r\n recvNumResSwitches?: number;\r\n}\r\n\r\ninterface MSVideoResolutionDistribution {\r\n cifQuality?: number;\r\n vgaQuality?: number;\r\n h720Quality?: number;\r\n h1080Quality?: number;\r\n h1440Quality?: number;\r\n h2160Quality?: number;\r\n}\r\n\r\ninterface MSVideoSendPayload extends MSVideoPayload {\r\n sendFrameRateAverage?: number;\r\n sendBitRateMaximum?: number;\r\n sendBitRateAverage?: number;\r\n sendVideoStreamsMax?: number;\r\n sendResolutionWidth?: number;\r\n sendResolutionHeight?: number;\r\n}\r\n\r\ninterface MediaEncryptedEventInit extends EventInit {\r\n initDataType?: string;\r\n initData?: ArrayBuffer;\r\n}\r\n\r\ninterface MediaKeyMessageEventInit extends EventInit {\r\n messageType?: string;\r\n message?: ArrayBuffer;\r\n}\r\n\r\ninterface MediaKeySystemConfiguration {\r\n initDataTypes?: string[];\r\n audioCapabilities?: MediaKeySystemMediaCapability[];\r\n videoCapabilities?: MediaKeySystemMediaCapability[];\r\n distinctiveIdentifier?: string;\r\n persistentState?: string;\r\n}\r\n\r\ninterface MediaKeySystemMediaCapability {\r\n contentType?: string;\r\n robustness?: string;\r\n}\r\n\r\ninterface MediaStreamConstraints {\r\n video?: boolean | MediaTrackConstraints;\r\n audio?: boolean | MediaTrackConstraints;\r\n}\r\n\r\ninterface MediaStreamErrorEventInit extends EventInit {\r\n error?: MediaStreamError;\r\n}\r\n\r\ninterface MediaStreamTrackEventInit extends EventInit {\r\n track?: MediaStreamTrack;\r\n}\r\n\r\ninterface MediaTrackCapabilities {\r\n width?: number | LongRange;\r\n height?: number | LongRange;\r\n aspectRatio?: number | DoubleRange;\r\n frameRate?: number | DoubleRange;\r\n facingMode?: string;\r\n volume?: number | DoubleRange;\r\n sampleRate?: number | LongRange;\r\n sampleSize?: number | LongRange;\r\n echoCancellation?: boolean[];\r\n deviceId?: string;\r\n groupId?: string;\r\n}\r\n\r\ninterface MediaTrackConstraintSet {\r\n width?: number | ConstrainLongRange;\r\n height?: number | ConstrainLongRange;\r\n aspectRatio?: number | ConstrainDoubleRange;\r\n frameRate?: number | ConstrainDoubleRange;\r\n facingMode?: string | string[] | ConstrainDOMStringParameters;\r\n volume?: number | ConstrainDoubleRange;\r\n sampleRate?: number | ConstrainLongRange;\r\n sampleSize?: number | ConstrainLongRange;\r\n echoCancelation?: boolean | ConstrainBooleanParameters;\r\n deviceId?: string | string[] | ConstrainDOMStringParameters;\r\n groupId?: string | string[] | ConstrainDOMStringParameters;\r\n}\r\n\r\ninterface MediaTrackConstraints extends MediaTrackConstraintSet {\r\n advanced?: MediaTrackConstraintSet[];\r\n}\r\n\r\ninterface MediaTrackSettings {\r\n width?: number;\r\n height?: number;\r\n aspectRatio?: number;\r\n frameRate?: number;\r\n facingMode?: string;\r\n volume?: number;\r\n sampleRate?: number;\r\n sampleSize?: number;\r\n echoCancellation?: boolean;\r\n deviceId?: string;\r\n groupId?: string;\r\n}\r\n\r\ninterface MediaTrackSupportedConstraints {\r\n width?: boolean;\r\n height?: boolean;\r\n aspectRatio?: boolean;\r\n frameRate?: boolean;\r\n facingMode?: boolean;\r\n volume?: boolean;\r\n sampleRate?: boolean;\r\n sampleSize?: boolean;\r\n echoCancellation?: boolean;\r\n deviceId?: boolean;\r\n groupId?: boolean;\r\n}\r\n\r\ninterface MouseEventInit extends EventModifierInit {\r\n screenX?: number;\r\n screenY?: number;\r\n clientX?: number;\r\n clientY?: number;\r\n button?: number;\r\n buttons?: number;\r\n relatedTarget?: EventTarget;\r\n}\r\n\r\ninterface MsZoomToOptions {\r\n contentX?: number;\r\n contentY?: number;\r\n viewportX?: string;\r\n viewportY?: string;\r\n scaleFactor?: number;\r\n animate?: string;\r\n}\r\n\r\ninterface MutationObserverInit {\r\n childList?: boolean;\r\n attributes?: boolean;\r\n characterData?: boolean;\r\n subtree?: boolean;\r\n attributeOldValue?: boolean;\r\n characterDataOldValue?: boolean;\r\n attributeFilter?: string[];\r\n}\r\n\r\ninterface ObjectURLOptions {\r\n oneTimeOnly?: boolean;\r\n}\r\n\r\ninterface PeriodicWaveConstraints {\r\n disableNormalization?: boolean;\r\n}\r\n\r\ninterface PointerEventInit extends MouseEventInit {\r\n pointerId?: number;\r\n width?: number;\r\n height?: number;\r\n pressure?: number;\r\n tiltX?: number;\r\n tiltY?: number;\r\n pointerType?: string;\r\n isPrimary?: boolean;\r\n}\r\n\r\ninterface PositionOptions {\r\n enableHighAccuracy?: boolean;\r\n timeout?: number;\r\n maximumAge?: number;\r\n}\r\n\r\ninterface RTCDTMFToneChangeEventInit extends EventInit {\r\n tone?: string;\r\n}\r\n\r\ninterface RTCDtlsFingerprint {\r\n algorithm?: string;\r\n value?: string;\r\n}\r\n\r\ninterface RTCDtlsParameters {\r\n role?: string;\r\n fingerprints?: RTCDtlsFingerprint[];\r\n}\r\n\r\ninterface RTCIceCandidate {\r\n foundation?: string;\r\n priority?: number;\r\n ip?: string;\r\n protocol?: string;\r\n port?: number;\r\n type?: string;\r\n tcpType?: string;\r\n relatedAddress?: string;\r\n relatedPort?: number;\r\n}\r\n\r\ninterface RTCIceCandidateAttributes extends RTCStats {\r\n ipAddress?: string;\r\n portNumber?: number;\r\n transport?: string;\r\n candidateType?: string;\r\n priority?: number;\r\n addressSourceUrl?: string;\r\n}\r\n\r\ninterface RTCIceCandidateComplete {\r\n}\r\n\r\ninterface RTCIceCandidatePair {\r\n local?: RTCIceCandidate;\r\n remote?: RTCIceCandidate;\r\n}\r\n\r\ninterface RTCIceCandidatePairStats extends RTCStats {\r\n transportId?: string;\r\n localCandidateId?: string;\r\n remoteCandidateId?: string;\r\n state?: string;\r\n priority?: number;\r\n nominated?: boolean;\r\n writable?: boolean;\r\n readable?: boolean;\r\n bytesSent?: number;\r\n bytesReceived?: number;\r\n roundTripTime?: number;\r\n availableOutgoingBitrate?: number;\r\n availableIncomingBitrate?: number;\r\n}\r\n\r\ninterface RTCIceGatherOptions {\r\n gatherPolicy?: string;\r\n iceservers?: RTCIceServer[];\r\n}\r\n\r\ninterface RTCIceParameters {\r\n usernameFragment?: string;\r\n password?: string;\r\n}\r\n\r\ninterface RTCIceServer {\r\n urls?: any;\r\n username?: string;\r\n credential?: string;\r\n}\r\n\r\ninterface RTCInboundRTPStreamStats extends RTCRTPStreamStats {\r\n packetsReceived?: number;\r\n bytesReceived?: number;\r\n packetsLost?: number;\r\n jitter?: number;\r\n fractionLost?: number;\r\n}\r\n\r\ninterface RTCMediaStreamTrackStats extends RTCStats {\r\n trackIdentifier?: string;\r\n remoteSource?: boolean;\r\n ssrcIds?: string[];\r\n frameWidth?: number;\r\n frameHeight?: number;\r\n framesPerSecond?: number;\r\n framesSent?: number;\r\n framesReceived?: number;\r\n framesDecoded?: number;\r\n framesDropped?: number;\r\n framesCorrupted?: number;\r\n audioLevel?: number;\r\n echoReturnLoss?: number;\r\n echoReturnLossEnhancement?: number;\r\n}\r\n\r\ninterface RTCOutboundRTPStreamStats extends RTCRTPStreamStats {\r\n packetsSent?: number;\r\n bytesSent?: number;\r\n targetBitrate?: number;\r\n roundTripTime?: number;\r\n}\r\n\r\ninterface RTCRTPStreamStats extends RTCStats {\r\n ssrc?: string;\r\n associateStatsId?: string;\r\n isRemote?: boolean;\r\n mediaTrackId?: string;\r\n transportId?: string;\r\n codecId?: string;\r\n firCount?: number;\r\n pliCount?: number;\r\n nackCount?: number;\r\n sliCount?: number;\r\n}\r\n\r\ninterface RTCRtcpFeedback {\r\n type?: string;\r\n parameter?: string;\r\n}\r\n\r\ninterface RTCRtcpParameters {\r\n ssrc?: number;\r\n cname?: string;\r\n reducedSize?: boolean;\r\n mux?: boolean;\r\n}\r\n\r\ninterface RTCRtpCapabilities {\r\n codecs?: RTCRtpCodecCapability[];\r\n headerExtensions?: RTCRtpHeaderExtension[];\r\n fecMechanisms?: string[];\r\n}\r\n\r\ninterface RTCRtpCodecCapability {\r\n name?: string;\r\n kind?: string;\r\n clockRate?: number;\r\n preferredPayloadType?: number;\r\n maxptime?: number;\r\n numChannels?: number;\r\n rtcpFeedback?: RTCRtcpFeedback[];\r\n parameters?: any;\r\n options?: any;\r\n maxTemporalLayers?: number;\r\n maxSpatialLayers?: number;\r\n svcMultiStreamSupport?: boolean;\r\n}\r\n\r\ninterface RTCRtpCodecParameters {\r\n name?: string;\r\n payloadType?: any;\r\n clockRate?: number;\r\n maxptime?: number;\r\n numChannels?: number;\r\n rtcpFeedback?: RTCRtcpFeedback[];\r\n parameters?: any;\r\n}\r\n\r\ninterface RTCRtpContributingSource {\r\n timestamp?: number;\r\n csrc?: number;\r\n audioLevel?: number;\r\n}\r\n\r\ninterface RTCRtpEncodingParameters {\r\n ssrc?: number;\r\n codecPayloadType?: number;\r\n fec?: RTCRtpFecParameters;\r\n rtx?: RTCRtpRtxParameters;\r\n priority?: number;\r\n maxBitrate?: number;\r\n minQuality?: number;\r\n framerateBias?: number;\r\n resolutionScale?: number;\r\n framerateScale?: number;\r\n active?: boolean;\r\n encodingId?: string;\r\n dependencyEncodingIds?: string[];\r\n ssrcRange?: RTCSsrcRange;\r\n}\r\n\r\ninterface RTCRtpFecParameters {\r\n ssrc?: number;\r\n mechanism?: string;\r\n}\r\n\r\ninterface RTCRtpHeaderExtension {\r\n kind?: string;\r\n uri?: string;\r\n preferredId?: number;\r\n preferredEncrypt?: boolean;\r\n}\r\n\r\ninterface RTCRtpHeaderExtensionParameters {\r\n uri?: string;\r\n id?: number;\r\n encrypt?: boolean;\r\n}\r\n\r\ninterface RTCRtpParameters {\r\n muxId?: string;\r\n codecs?: RTCRtpCodecParameters[];\r\n headerExtensions?: RTCRtpHeaderExtensionParameters[];\r\n encodings?: RTCRtpEncodingParameters[];\r\n rtcp?: RTCRtcpParameters;\r\n}\r\n\r\ninterface RTCRtpRtxParameters {\r\n ssrc?: number;\r\n}\r\n\r\ninterface RTCRtpUnhandled {\r\n ssrc?: number;\r\n payloadType?: number;\r\n muxId?: string;\r\n}\r\n\r\ninterface RTCSrtpKeyParam {\r\n keyMethod?: string;\r\n keySalt?: string;\r\n lifetime?: string;\r\n mkiValue?: number;\r\n mkiLength?: number;\r\n}\r\n\r\ninterface RTCSrtpSdesParameters {\r\n tag?: number;\r\n cryptoSuite?: string;\r\n keyParams?: RTCSrtpKeyParam[];\r\n sessionParams?: string[];\r\n}\r\n\r\ninterface RTCSsrcRange {\r\n min?: number;\r\n max?: number;\r\n}\r\n\r\ninterface RTCStats {\r\n timestamp?: number;\r\n type?: string;\r\n id?: string;\r\n msType?: string;\r\n}\r\n\r\ninterface RTCStatsReport {\r\n}\r\n\r\ninterface RTCTransportStats extends RTCStats {\r\n bytesSent?: number;\r\n bytesReceived?: number;\r\n rtcpTransportStatsId?: string;\r\n activeConnection?: boolean;\r\n selectedCandidatePairId?: string;\r\n localCertificateId?: string;\r\n remoteCertificateId?: string;\r\n}\r\n\r\ninterface StoreExceptionsInformation extends ExceptionInformation {\r\n siteName?: string;\r\n explanationString?: string;\r\n detailURI?: string;\r\n}\r\n\r\ninterface StoreSiteSpecificExceptionsInformation extends StoreExceptionsInformation {\r\n arrayOfDomainStrings?: string[];\r\n}\r\n\r\ninterface UIEventInit extends EventInit {\r\n view?: Window;\r\n detail?: number;\r\n}\r\n\r\ninterface WebGLContextAttributes {\r\n failIfMajorPerformanceCaveat?: boolean;\r\n alpha?: boolean;\r\n depth?: boolean;\r\n stencil?: boolean;\r\n antialias?: boolean;\r\n premultipliedAlpha?: boolean;\r\n preserveDrawingBuffer?: boolean;\r\n}\r\n\r\ninterface WebGLContextEventInit extends EventInit {\r\n statusMessage?: string;\r\n}\r\n\r\ninterface WheelEventInit extends MouseEventInit {\r\n deltaX?: number;\r\n deltaY?: number;\r\n deltaZ?: number;\r\n deltaMode?: number;\r\n}\r\n\r\ninterface EventListener {\r\n (evt: Event): void;\r\n}\r\n\r\ninterface ANGLE_instanced_arrays {\r\n drawArraysInstancedANGLE(mode: number, first: number, count: number, primcount: number): void;\r\n drawElementsInstancedANGLE(mode: number, count: number, type: number, offset: number, primcount: number): void;\r\n vertexAttribDivisorANGLE(index: number, divisor: number): void;\r\n readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number;\r\n}\r\n\r\ndeclare var ANGLE_instanced_arrays: {\r\n prototype: ANGLE_instanced_arrays;\r\n new(): ANGLE_instanced_arrays;\r\n readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number;\r\n}\r\n\r\ninterface AnalyserNode extends AudioNode {\r\n fftSize: number;\r\n readonly frequencyBinCount: number;\r\n maxDecibels: number;\r\n minDecibels: number;\r\n smoothingTimeConstant: number;\r\n getByteFrequencyData(array: Uint8Array): void;\r\n getByteTimeDomainData(array: Uint8Array): void;\r\n getFloatFrequencyData(array: Float32Array): void;\r\n getFloatTimeDomainData(array: Float32Array): void;\r\n}\r\n\r\ndeclare var AnalyserNode: {\r\n prototype: AnalyserNode;\r\n new(): AnalyserNode;\r\n}\r\n\r\ninterface AnimationEvent extends Event {\r\n readonly animationName: string;\r\n readonly elapsedTime: number;\r\n initAnimationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, animationNameArg: string, elapsedTimeArg: number): void;\r\n}\r\n\r\ndeclare var AnimationEvent: {\r\n prototype: AnimationEvent;\r\n new(): AnimationEvent;\r\n}\r\n\r\ninterface ApplicationCache extends EventTarget {\r\n oncached: (this: this, ev: Event) => any;\r\n onchecking: (this: this, ev: Event) => any;\r\n ondownloading: (this: this, ev: Event) => any;\r\n onerror: (this: this, ev: ErrorEvent) => any;\r\n onnoupdate: (this: this, ev: Event) => any;\r\n onobsolete: (this: this, ev: Event) => any;\r\n onprogress: (this: this, ev: ProgressEvent) => any;\r\n onupdateready: (this: this, ev: Event) => any;\r\n readonly status: number;\r\n abort(): void;\r\n swapCache(): void;\r\n update(): void;\r\n readonly CHECKING: number;\r\n readonly DOWNLOADING: number;\r\n readonly IDLE: number;\r\n readonly OBSOLETE: number;\r\n readonly UNCACHED: number;\r\n readonly UPDATEREADY: number;\r\n addEventListener(type: \"cached\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"checking\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"downloading\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"noupdate\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"obsolete\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"progress\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"updateready\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var ApplicationCache: {\r\n prototype: ApplicationCache;\r\n new(): ApplicationCache;\r\n readonly CHECKING: number;\r\n readonly DOWNLOADING: number;\r\n readonly IDLE: number;\r\n readonly OBSOLETE: number;\r\n readonly UNCACHED: number;\r\n readonly UPDATEREADY: number;\r\n}\r\n\r\ninterface AriaRequestEvent extends Event {\r\n readonly attributeName: string;\r\n attributeValue: string | null;\r\n}\r\n\r\ndeclare var AriaRequestEvent: {\r\n prototype: AriaRequestEvent;\r\n new(type: string, eventInitDict?: AriaRequestEventInit): AriaRequestEvent;\r\n}\r\n\r\ninterface Attr extends Node {\r\n readonly name: string;\r\n readonly ownerElement: Element;\r\n readonly prefix: string | null;\r\n readonly specified: boolean;\r\n value: string;\r\n}\r\n\r\ndeclare var Attr: {\r\n prototype: Attr;\r\n new(): Attr;\r\n}\r\n\r\ninterface AudioBuffer {\r\n readonly duration: number;\r\n readonly length: number;\r\n readonly numberOfChannels: number;\r\n readonly sampleRate: number;\r\n copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void;\r\n copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void;\r\n getChannelData(channel: number): Float32Array;\r\n}\r\n\r\ndeclare var AudioBuffer: {\r\n prototype: AudioBuffer;\r\n new(): AudioBuffer;\r\n}\r\n\r\ninterface AudioBufferSourceNode extends AudioNode {\r\n buffer: AudioBuffer | null;\r\n readonly detune: AudioParam;\r\n loop: boolean;\r\n loopEnd: number;\r\n loopStart: number;\r\n onended: (this: this, ev: MediaStreamErrorEvent) => any;\r\n readonly playbackRate: AudioParam;\r\n start(when?: number, offset?: number, duration?: number): void;\r\n stop(when?: number): void;\r\n addEventListener(type: \"ended\", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var AudioBufferSourceNode: {\r\n prototype: AudioBufferSourceNode;\r\n new(): AudioBufferSourceNode;\r\n}\r\n\r\ninterface AudioContext extends EventTarget {\r\n readonly currentTime: number;\r\n readonly destination: AudioDestinationNode;\r\n readonly listener: AudioListener;\r\n readonly sampleRate: number;\r\n state: string;\r\n createAnalyser(): AnalyserNode;\r\n createBiquadFilter(): BiquadFilterNode;\r\n createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer;\r\n createBufferSource(): AudioBufferSourceNode;\r\n createChannelMerger(numberOfInputs?: number): ChannelMergerNode;\r\n createChannelSplitter(numberOfOutputs?: number): ChannelSplitterNode;\r\n createConvolver(): ConvolverNode;\r\n createDelay(maxDelayTime?: number): DelayNode;\r\n createDynamicsCompressor(): DynamicsCompressorNode;\r\n createGain(): GainNode;\r\n createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode;\r\n createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode;\r\n createOscillator(): OscillatorNode;\r\n createPanner(): PannerNode;\r\n createPeriodicWave(real: Float32Array, imag: Float32Array, constraints?: PeriodicWaveConstraints): PeriodicWave;\r\n createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode;\r\n createStereoPanner(): StereoPannerNode;\r\n createWaveShaper(): WaveShaperNode;\r\n decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): PromiseLike;\r\n}\r\n\r\ndeclare var AudioContext: {\r\n prototype: AudioContext;\r\n new(): AudioContext;\r\n}\r\n\r\ninterface AudioDestinationNode extends AudioNode {\r\n readonly maxChannelCount: number;\r\n}\r\n\r\ndeclare var AudioDestinationNode: {\r\n prototype: AudioDestinationNode;\r\n new(): AudioDestinationNode;\r\n}\r\n\r\ninterface AudioListener {\r\n dopplerFactor: number;\r\n speedOfSound: number;\r\n setOrientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): void;\r\n setPosition(x: number, y: number, z: number): void;\r\n setVelocity(x: number, y: number, z: number): void;\r\n}\r\n\r\ndeclare var AudioListener: {\r\n prototype: AudioListener;\r\n new(): AudioListener;\r\n}\r\n\r\ninterface AudioNode extends EventTarget {\r\n channelCount: number;\r\n channelCountMode: string;\r\n channelInterpretation: string;\r\n readonly context: AudioContext;\r\n readonly numberOfInputs: number;\r\n readonly numberOfOutputs: number;\r\n connect(destination: AudioNode, output?: number, input?: number): void;\r\n disconnect(output?: number): void;\r\n disconnect(destination: AudioNode, output?: number, input?: number): void;\r\n disconnect(destination: AudioParam, output?: number): void;\r\n}\r\n\r\ndeclare var AudioNode: {\r\n prototype: AudioNode;\r\n new(): AudioNode;\r\n}\r\n\r\ninterface AudioParam {\r\n readonly defaultValue: number;\r\n value: number;\r\n cancelScheduledValues(startTime: number): void;\r\n exponentialRampToValueAtTime(value: number, endTime: number): void;\r\n linearRampToValueAtTime(value: number, endTime: number): void;\r\n setTargetAtTime(target: number, startTime: number, timeConstant: number): void;\r\n setValueAtTime(value: number, startTime: number): void;\r\n setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void;\r\n}\r\n\r\ndeclare var AudioParam: {\r\n prototype: AudioParam;\r\n new(): AudioParam;\r\n}\r\n\r\ninterface AudioProcessingEvent extends Event {\r\n readonly inputBuffer: AudioBuffer;\r\n readonly outputBuffer: AudioBuffer;\r\n readonly playbackTime: number;\r\n}\r\n\r\ndeclare var AudioProcessingEvent: {\r\n prototype: AudioProcessingEvent;\r\n new(): AudioProcessingEvent;\r\n}\r\n\r\ninterface AudioTrack {\r\n enabled: boolean;\r\n readonly id: string;\r\n kind: string;\r\n readonly label: string;\r\n language: string;\r\n readonly sourceBuffer: SourceBuffer;\r\n}\r\n\r\ndeclare var AudioTrack: {\r\n prototype: AudioTrack;\r\n new(): AudioTrack;\r\n}\r\n\r\ninterface AudioTrackList extends EventTarget {\r\n readonly length: number;\r\n onaddtrack: (this: this, ev: TrackEvent) => any;\r\n onchange: (this: this, ev: Event) => any;\r\n onremovetrack: (this: this, ev: TrackEvent) => any;\r\n getTrackById(id: string): AudioTrack | null;\r\n item(index: number): AudioTrack;\r\n addEventListener(type: \"addtrack\", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"change\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"removetrack\", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n [index: number]: AudioTrack;\r\n}\r\n\r\ndeclare var AudioTrackList: {\r\n prototype: AudioTrackList;\r\n new(): AudioTrackList;\r\n}\r\n\r\ninterface BarProp {\r\n readonly visible: boolean;\r\n}\r\n\r\ndeclare var BarProp: {\r\n prototype: BarProp;\r\n new(): BarProp;\r\n}\r\n\r\ninterface BeforeUnloadEvent extends Event {\r\n returnValue: any;\r\n}\r\n\r\ndeclare var BeforeUnloadEvent: {\r\n prototype: BeforeUnloadEvent;\r\n new(): BeforeUnloadEvent;\r\n}\r\n\r\ninterface BiquadFilterNode extends AudioNode {\r\n readonly Q: AudioParam;\r\n readonly detune: AudioParam;\r\n readonly frequency: AudioParam;\r\n readonly gain: AudioParam;\r\n type: string;\r\n getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void;\r\n}\r\n\r\ndeclare var BiquadFilterNode: {\r\n prototype: BiquadFilterNode;\r\n new(): BiquadFilterNode;\r\n}\r\n\r\ninterface Blob {\r\n readonly size: number;\r\n readonly type: string;\r\n msClose(): void;\r\n msDetachStream(): any;\r\n slice(start?: number, end?: number, contentType?: string): Blob;\r\n}\r\n\r\ndeclare var Blob: {\r\n prototype: Blob;\r\n new (blobParts?: any[], options?: BlobPropertyBag): Blob;\r\n}\r\n\r\ninterface CDATASection extends Text {\r\n}\r\n\r\ndeclare var CDATASection: {\r\n prototype: CDATASection;\r\n new(): CDATASection;\r\n}\r\n\r\ninterface CSS {\r\n supports(property: string, value?: string): boolean;\r\n}\r\ndeclare var CSS: CSS;\r\n\r\ninterface CSSConditionRule extends CSSGroupingRule {\r\n conditionText: string;\r\n}\r\n\r\ndeclare var CSSConditionRule: {\r\n prototype: CSSConditionRule;\r\n new(): CSSConditionRule;\r\n}\r\n\r\ninterface CSSFontFaceRule extends CSSRule {\r\n readonly style: CSSStyleDeclaration;\r\n}\r\n\r\ndeclare var CSSFontFaceRule: {\r\n prototype: CSSFontFaceRule;\r\n new(): CSSFontFaceRule;\r\n}\r\n\r\ninterface CSSGroupingRule extends CSSRule {\r\n readonly cssRules: CSSRuleList;\r\n deleteRule(index: number): void;\r\n insertRule(rule: string, index: number): number;\r\n}\r\n\r\ndeclare var CSSGroupingRule: {\r\n prototype: CSSGroupingRule;\r\n new(): CSSGroupingRule;\r\n}\r\n\r\ninterface CSSImportRule extends CSSRule {\r\n readonly href: string;\r\n readonly media: MediaList;\r\n readonly styleSheet: CSSStyleSheet;\r\n}\r\n\r\ndeclare var CSSImportRule: {\r\n prototype: CSSImportRule;\r\n new(): CSSImportRule;\r\n}\r\n\r\ninterface CSSKeyframeRule extends CSSRule {\r\n keyText: string;\r\n readonly style: CSSStyleDeclaration;\r\n}\r\n\r\ndeclare var CSSKeyframeRule: {\r\n prototype: CSSKeyframeRule;\r\n new(): CSSKeyframeRule;\r\n}\r\n\r\ninterface CSSKeyframesRule extends CSSRule {\r\n readonly cssRules: CSSRuleList;\r\n name: string;\r\n appendRule(rule: string): void;\r\n deleteRule(rule: string): void;\r\n findRule(rule: string): CSSKeyframeRule;\r\n}\r\n\r\ndeclare var CSSKeyframesRule: {\r\n prototype: CSSKeyframesRule;\r\n new(): CSSKeyframesRule;\r\n}\r\n\r\ninterface CSSMediaRule extends CSSConditionRule {\r\n readonly media: MediaList;\r\n}\r\n\r\ndeclare var CSSMediaRule: {\r\n prototype: CSSMediaRule;\r\n new(): CSSMediaRule;\r\n}\r\n\r\ninterface CSSNamespaceRule extends CSSRule {\r\n readonly namespaceURI: string;\r\n readonly prefix: string;\r\n}\r\n\r\ndeclare var CSSNamespaceRule: {\r\n prototype: CSSNamespaceRule;\r\n new(): CSSNamespaceRule;\r\n}\r\n\r\ninterface CSSPageRule extends CSSRule {\r\n readonly pseudoClass: string;\r\n readonly selector: string;\r\n selectorText: string;\r\n readonly style: CSSStyleDeclaration;\r\n}\r\n\r\ndeclare var CSSPageRule: {\r\n prototype: CSSPageRule;\r\n new(): CSSPageRule;\r\n}\r\n\r\ninterface CSSRule {\r\n cssText: string;\r\n readonly parentRule: CSSRule;\r\n readonly parentStyleSheet: CSSStyleSheet;\r\n readonly type: number;\r\n readonly CHARSET_RULE: number;\r\n readonly FONT_FACE_RULE: number;\r\n readonly IMPORT_RULE: number;\r\n readonly KEYFRAMES_RULE: number;\r\n readonly KEYFRAME_RULE: number;\r\n readonly MEDIA_RULE: number;\r\n readonly NAMESPACE_RULE: number;\r\n readonly PAGE_RULE: number;\r\n readonly STYLE_RULE: number;\r\n readonly SUPPORTS_RULE: number;\r\n readonly UNKNOWN_RULE: number;\r\n readonly VIEWPORT_RULE: number;\r\n}\r\n\r\ndeclare var CSSRule: {\r\n prototype: CSSRule;\r\n new(): CSSRule;\r\n readonly CHARSET_RULE: number;\r\n readonly FONT_FACE_RULE: number;\r\n readonly IMPORT_RULE: number;\r\n readonly KEYFRAMES_RULE: number;\r\n readonly KEYFRAME_RULE: number;\r\n readonly MEDIA_RULE: number;\r\n readonly NAMESPACE_RULE: number;\r\n readonly PAGE_RULE: number;\r\n readonly STYLE_RULE: number;\r\n readonly SUPPORTS_RULE: number;\r\n readonly UNKNOWN_RULE: number;\r\n readonly VIEWPORT_RULE: number;\r\n}\r\n\r\ninterface CSSRuleList {\r\n readonly length: number;\r\n item(index: number): CSSRule;\r\n [index: number]: CSSRule;\r\n}\r\n\r\ndeclare var CSSRuleList: {\r\n prototype: CSSRuleList;\r\n new(): CSSRuleList;\r\n}\r\n\r\ninterface CSSStyleDeclaration {\r\n alignContent: string | null;\r\n alignItems: string | null;\r\n alignSelf: string | null;\r\n alignmentBaseline: string | null;\r\n animation: string | null;\r\n animationDelay: string | null;\r\n animationDirection: string | null;\r\n animationDuration: string | null;\r\n animationFillMode: string | null;\r\n animationIterationCount: string | null;\r\n animationName: string | null;\r\n animationPlayState: string | null;\r\n animationTimingFunction: string | null;\r\n backfaceVisibility: string | null;\r\n background: string | null;\r\n backgroundAttachment: string | null;\r\n backgroundClip: string | null;\r\n backgroundColor: string | null;\r\n backgroundImage: string | null;\r\n backgroundOrigin: string | null;\r\n backgroundPosition: string | null;\r\n backgroundPositionX: string | null;\r\n backgroundPositionY: string | null;\r\n backgroundRepeat: string | null;\r\n backgroundSize: string | null;\r\n baselineShift: string | null;\r\n border: string | null;\r\n borderBottom: string | null;\r\n borderBottomColor: string | null;\r\n borderBottomLeftRadius: string | null;\r\n borderBottomRightRadius: string | null;\r\n borderBottomStyle: string | null;\r\n borderBottomWidth: string | null;\r\n borderCollapse: string | null;\r\n borderColor: string | null;\r\n borderImage: string | null;\r\n borderImageOutset: string | null;\r\n borderImageRepeat: string | null;\r\n borderImageSlice: string | null;\r\n borderImageSource: string | null;\r\n borderImageWidth: string | null;\r\n borderLeft: string | null;\r\n borderLeftColor: string | null;\r\n borderLeftStyle: string | null;\r\n borderLeftWidth: string | null;\r\n borderRadius: string | null;\r\n borderRight: string | null;\r\n borderRightColor: string | null;\r\n borderRightStyle: string | null;\r\n borderRightWidth: string | null;\r\n borderSpacing: string | null;\r\n borderStyle: string | null;\r\n borderTop: string | null;\r\n borderTopColor: string | null;\r\n borderTopLeftRadius: string | null;\r\n borderTopRightRadius: string | null;\r\n borderTopStyle: string | null;\r\n borderTopWidth: string | null;\r\n borderWidth: string | null;\r\n bottom: string | null;\r\n boxShadow: string | null;\r\n boxSizing: string | null;\r\n breakAfter: string | null;\r\n breakBefore: string | null;\r\n breakInside: string | null;\r\n captionSide: string | null;\r\n clear: string | null;\r\n clip: string | null;\r\n clipPath: string | null;\r\n clipRule: string | null;\r\n color: string | null;\r\n colorInterpolationFilters: string | null;\r\n columnCount: any;\r\n columnFill: string | null;\r\n columnGap: any;\r\n columnRule: string | null;\r\n columnRuleColor: any;\r\n columnRuleStyle: string | null;\r\n columnRuleWidth: any;\r\n columnSpan: string | null;\r\n columnWidth: any;\r\n columns: string | null;\r\n content: string | null;\r\n counterIncrement: string | null;\r\n counterReset: string | null;\r\n cssFloat: string | null;\r\n cssText: string;\r\n cursor: string | null;\r\n direction: string | null;\r\n display: string | null;\r\n dominantBaseline: string | null;\r\n emptyCells: string | null;\r\n enableBackground: string | null;\r\n fill: string | null;\r\n fillOpacity: string | null;\r\n fillRule: string | null;\r\n filter: string | null;\r\n flex: string | null;\r\n flexBasis: string | null;\r\n flexDirection: string | null;\r\n flexFlow: string | null;\r\n flexGrow: string | null;\r\n flexShrink: string | null;\r\n flexWrap: string | null;\r\n floodColor: string | null;\r\n floodOpacity: string | null;\r\n font: string | null;\r\n fontFamily: string | null;\r\n fontFeatureSettings: string | null;\r\n fontSize: string | null;\r\n fontSizeAdjust: string | null;\r\n fontStretch: string | null;\r\n fontStyle: string | null;\r\n fontVariant: string | null;\r\n fontWeight: string | null;\r\n glyphOrientationHorizontal: string | null;\r\n glyphOrientationVertical: string | null;\r\n height: string | null;\r\n imeMode: string | null;\r\n justifyContent: string | null;\r\n kerning: string | null;\r\n left: string | null;\r\n readonly length: number;\r\n letterSpacing: string | null;\r\n lightingColor: string | null;\r\n lineHeight: string | null;\r\n listStyle: string | null;\r\n listStyleImage: string | null;\r\n listStylePosition: string | null;\r\n listStyleType: string | null;\r\n margin: string | null;\r\n marginBottom: string | null;\r\n marginLeft: string | null;\r\n marginRight: string | null;\r\n marginTop: string | null;\r\n marker: string | null;\r\n markerEnd: string | null;\r\n markerMid: string | null;\r\n markerStart: string | null;\r\n mask: string | null;\r\n maxHeight: string | null;\r\n maxWidth: string | null;\r\n minHeight: string | null;\r\n minWidth: string | null;\r\n msContentZoomChaining: string | null;\r\n msContentZoomLimit: string | null;\r\n msContentZoomLimitMax: any;\r\n msContentZoomLimitMin: any;\r\n msContentZoomSnap: string | null;\r\n msContentZoomSnapPoints: string | null;\r\n msContentZoomSnapType: string | null;\r\n msContentZooming: string | null;\r\n msFlowFrom: string | null;\r\n msFlowInto: string | null;\r\n msFontFeatureSettings: string | null;\r\n msGridColumn: any;\r\n msGridColumnAlign: string | null;\r\n msGridColumnSpan: any;\r\n msGridColumns: string | null;\r\n msGridRow: any;\r\n msGridRowAlign: string | null;\r\n msGridRowSpan: any;\r\n msGridRows: string | null;\r\n msHighContrastAdjust: string | null;\r\n msHyphenateLimitChars: string | null;\r\n msHyphenateLimitLines: any;\r\n msHyphenateLimitZone: any;\r\n msHyphens: string | null;\r\n msImeAlign: string | null;\r\n msOverflowStyle: string | null;\r\n msScrollChaining: string | null;\r\n msScrollLimit: string | null;\r\n msScrollLimitXMax: any;\r\n msScrollLimitXMin: any;\r\n msScrollLimitYMax: any;\r\n msScrollLimitYMin: any;\r\n msScrollRails: string | null;\r\n msScrollSnapPointsX: string | null;\r\n msScrollSnapPointsY: string | null;\r\n msScrollSnapType: string | null;\r\n msScrollSnapX: string | null;\r\n msScrollSnapY: string | null;\r\n msScrollTranslation: string | null;\r\n msTextCombineHorizontal: string | null;\r\n msTextSizeAdjust: any;\r\n msTouchAction: string | null;\r\n msTouchSelect: string | null;\r\n msUserSelect: string | null;\r\n msWrapFlow: string;\r\n msWrapMargin: any;\r\n msWrapThrough: string;\r\n opacity: string | null;\r\n order: string | null;\r\n orphans: string | null;\r\n outline: string | null;\r\n outlineColor: string | null;\r\n outlineStyle: string | null;\r\n outlineWidth: string | null;\r\n overflow: string | null;\r\n overflowX: string | null;\r\n overflowY: string | null;\r\n padding: string | null;\r\n paddingBottom: string | null;\r\n paddingLeft: string | null;\r\n paddingRight: string | null;\r\n paddingTop: string | null;\r\n pageBreakAfter: string | null;\r\n pageBreakBefore: string | null;\r\n pageBreakInside: string | null;\r\n readonly parentRule: CSSRule;\r\n perspective: string | null;\r\n perspectiveOrigin: string | null;\r\n pointerEvents: string | null;\r\n position: string | null;\r\n quotes: string | null;\r\n right: string | null;\r\n rubyAlign: string | null;\r\n rubyOverhang: string | null;\r\n rubyPosition: string | null;\r\n stopColor: string | null;\r\n stopOpacity: string | null;\r\n stroke: string | null;\r\n strokeDasharray: string | null;\r\n strokeDashoffset: string | null;\r\n strokeLinecap: string | null;\r\n strokeLinejoin: string | null;\r\n strokeMiterlimit: string | null;\r\n strokeOpacity: string | null;\r\n strokeWidth: string | null;\r\n tableLayout: string | null;\r\n textAlign: string | null;\r\n textAlignLast: string | null;\r\n textAnchor: string | null;\r\n textDecoration: string | null;\r\n textIndent: string | null;\r\n textJustify: string | null;\r\n textKashida: string | null;\r\n textKashidaSpace: string | null;\r\n textOverflow: string | null;\r\n textShadow: string | null;\r\n textTransform: string | null;\r\n textUnderlinePosition: string | null;\r\n top: string | null;\r\n touchAction: string | null;\r\n transform: string | null;\r\n transformOrigin: string | null;\r\n transformStyle: string | null;\r\n transition: string | null;\r\n transitionDelay: string | null;\r\n transitionDuration: string | null;\r\n transitionProperty: string | null;\r\n transitionTimingFunction: string | null;\r\n unicodeBidi: string | null;\r\n verticalAlign: string | null;\r\n visibility: string | null;\r\n webkitAlignContent: string | null;\r\n webkitAlignItems: string | null;\r\n webkitAlignSelf: string | null;\r\n webkitAnimation: string | null;\r\n webkitAnimationDelay: string | null;\r\n webkitAnimationDirection: string | null;\r\n webkitAnimationDuration: string | null;\r\n webkitAnimationFillMode: string | null;\r\n webkitAnimationIterationCount: string | null;\r\n webkitAnimationName: string | null;\r\n webkitAnimationPlayState: string | null;\r\n webkitAnimationTimingFunction: string | null;\r\n webkitAppearance: string | null;\r\n webkitBackfaceVisibility: string | null;\r\n webkitBackgroundClip: string | null;\r\n webkitBackgroundOrigin: string | null;\r\n webkitBackgroundSize: string | null;\r\n webkitBorderBottomLeftRadius: string | null;\r\n webkitBorderBottomRightRadius: string | null;\r\n webkitBorderImage: string | null;\r\n webkitBorderRadius: string | null;\r\n webkitBorderTopLeftRadius: string | null;\r\n webkitBorderTopRightRadius: string | null;\r\n webkitBoxAlign: string | null;\r\n webkitBoxDirection: string | null;\r\n webkitBoxFlex: string | null;\r\n webkitBoxOrdinalGroup: string | null;\r\n webkitBoxOrient: string | null;\r\n webkitBoxPack: string | null;\r\n webkitBoxSizing: string | null;\r\n webkitColumnBreakAfter: string | null;\r\n webkitColumnBreakBefore: string | null;\r\n webkitColumnBreakInside: string | null;\r\n webkitColumnCount: any;\r\n webkitColumnGap: any;\r\n webkitColumnRule: string | null;\r\n webkitColumnRuleColor: any;\r\n webkitColumnRuleStyle: string | null;\r\n webkitColumnRuleWidth: any;\r\n webkitColumnSpan: string | null;\r\n webkitColumnWidth: any;\r\n webkitColumns: string | null;\r\n webkitFilter: string | null;\r\n webkitFlex: string | null;\r\n webkitFlexBasis: string | null;\r\n webkitFlexDirection: string | null;\r\n webkitFlexFlow: string | null;\r\n webkitFlexGrow: string | null;\r\n webkitFlexShrink: string | null;\r\n webkitFlexWrap: string | null;\r\n webkitJustifyContent: string | null;\r\n webkitOrder: string | null;\r\n webkitPerspective: string | null;\r\n webkitPerspectiveOrigin: string | null;\r\n webkitTapHighlightColor: string | null;\r\n webkitTextFillColor: string | null;\r\n webkitTextSizeAdjust: any;\r\n webkitTransform: string | null;\r\n webkitTransformOrigin: string | null;\r\n webkitTransformStyle: string | null;\r\n webkitTransition: string | null;\r\n webkitTransitionDelay: string | null;\r\n webkitTransitionDuration: string | null;\r\n webkitTransitionProperty: string | null;\r\n webkitTransitionTimingFunction: string | null;\r\n webkitUserModify: string | null;\r\n webkitUserSelect: string | null;\r\n webkitWritingMode: string | null;\r\n whiteSpace: string | null;\r\n widows: string | null;\r\n width: string | null;\r\n wordBreak: string | null;\r\n wordSpacing: string | null;\r\n wordWrap: string | null;\r\n writingMode: string | null;\r\n zIndex: string | null;\r\n zoom: string | null;\r\n getPropertyPriority(propertyName: string): string;\r\n getPropertyValue(propertyName: string): string;\r\n item(index: number): string;\r\n removeProperty(propertyName: string): string;\r\n setProperty(propertyName: string, value: string | null, priority?: string): void;\r\n [index: number]: string;\r\n}\r\n\r\ndeclare var CSSStyleDeclaration: {\r\n prototype: CSSStyleDeclaration;\r\n new(): CSSStyleDeclaration;\r\n}\r\n\r\ninterface CSSStyleRule extends CSSRule {\r\n readonly readOnly: boolean;\r\n selectorText: string;\r\n readonly style: CSSStyleDeclaration;\r\n}\r\n\r\ndeclare var CSSStyleRule: {\r\n prototype: CSSStyleRule;\r\n new(): CSSStyleRule;\r\n}\r\n\r\ninterface CSSStyleSheet extends StyleSheet {\r\n readonly cssRules: CSSRuleList;\r\n cssText: string;\r\n readonly href: string;\r\n readonly id: string;\r\n readonly imports: StyleSheetList;\r\n readonly isAlternate: boolean;\r\n readonly isPrefAlternate: boolean;\r\n readonly ownerRule: CSSRule;\r\n readonly owningElement: Element;\r\n readonly pages: StyleSheetPageList;\r\n readonly readOnly: boolean;\r\n readonly rules: CSSRuleList;\r\n addImport(bstrURL: string, lIndex?: number): number;\r\n addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number;\r\n addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number;\r\n deleteRule(index?: number): void;\r\n insertRule(rule: string, index?: number): number;\r\n removeImport(lIndex: number): void;\r\n removeRule(lIndex: number): void;\r\n}\r\n\r\ndeclare var CSSStyleSheet: {\r\n prototype: CSSStyleSheet;\r\n new(): CSSStyleSheet;\r\n}\r\n\r\ninterface CSSSupportsRule extends CSSConditionRule {\r\n}\r\n\r\ndeclare var CSSSupportsRule: {\r\n prototype: CSSSupportsRule;\r\n new(): CSSSupportsRule;\r\n}\r\n\r\ninterface CanvasGradient {\r\n addColorStop(offset: number, color: string): void;\r\n}\r\n\r\ndeclare var CanvasGradient: {\r\n prototype: CanvasGradient;\r\n new(): CanvasGradient;\r\n}\r\n\r\ninterface CanvasPattern {\r\n}\r\n\r\ndeclare var CanvasPattern: {\r\n prototype: CanvasPattern;\r\n new(): CanvasPattern;\r\n}\r\n\r\ninterface CanvasRenderingContext2D extends Object, CanvasPathMethods {\r\n readonly canvas: HTMLCanvasElement;\r\n fillStyle: string | CanvasGradient | CanvasPattern;\r\n font: string;\r\n globalAlpha: number;\r\n globalCompositeOperation: string;\r\n lineCap: string;\r\n lineDashOffset: number;\r\n lineJoin: string;\r\n lineWidth: number;\r\n miterLimit: number;\r\n msFillRule: string;\r\n msImageSmoothingEnabled: boolean;\r\n shadowBlur: number;\r\n shadowColor: string;\r\n shadowOffsetX: number;\r\n shadowOffsetY: number;\r\n strokeStyle: string | CanvasGradient | CanvasPattern;\r\n textAlign: string;\r\n textBaseline: string;\r\n mozImageSmoothingEnabled: boolean;\r\n webkitImageSmoothingEnabled: boolean;\r\n oImageSmoothingEnabled: boolean;\r\n beginPath(): void;\r\n clearRect(x: number, y: number, w: number, h: number): void;\r\n clip(fillRule?: string): void;\r\n createImageData(imageDataOrSw: number | ImageData, sh?: number): ImageData;\r\n createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient;\r\n createPattern(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, repetition: string): CanvasPattern;\r\n createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient;\r\n drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, offsetX: number, offsetY: number, width?: number, height?: number, canvasOffsetX?: number, canvasOffsetY?: number, canvasImageWidth?: number, canvasImageHeight?: number): void;\r\n fill(fillRule?: string): void;\r\n fillRect(x: number, y: number, w: number, h: number): void;\r\n fillText(text: string, x: number, y: number, maxWidth?: number): void;\r\n getImageData(sx: number, sy: number, sw: number, sh: number): ImageData;\r\n getLineDash(): number[];\r\n isPointInPath(x: number, y: number, fillRule?: string): boolean;\r\n measureText(text: string): TextMetrics;\r\n putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void;\r\n restore(): void;\r\n rotate(angle: number): void;\r\n save(): void;\r\n scale(x: number, y: number): void;\r\n setLineDash(segments: number[]): void;\r\n setTransform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void;\r\n stroke(): void;\r\n strokeRect(x: number, y: number, w: number, h: number): void;\r\n strokeText(text: string, x: number, y: number, maxWidth?: number): void;\r\n transform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void;\r\n translate(x: number, y: number): void;\r\n}\r\n\r\ndeclare var CanvasRenderingContext2D: {\r\n prototype: CanvasRenderingContext2D;\r\n new(): CanvasRenderingContext2D;\r\n}\r\n\r\ninterface ChannelMergerNode extends AudioNode {\r\n}\r\n\r\ndeclare var ChannelMergerNode: {\r\n prototype: ChannelMergerNode;\r\n new(): ChannelMergerNode;\r\n}\r\n\r\ninterface ChannelSplitterNode extends AudioNode {\r\n}\r\n\r\ndeclare var ChannelSplitterNode: {\r\n prototype: ChannelSplitterNode;\r\n new(): ChannelSplitterNode;\r\n}\r\n\r\ninterface CharacterData extends Node, ChildNode {\r\n data: string;\r\n readonly length: number;\r\n appendData(arg: string): void;\r\n deleteData(offset: number, count: number): void;\r\n insertData(offset: number, arg: string): void;\r\n replaceData(offset: number, count: number, arg: string): void;\r\n substringData(offset: number, count: number): string;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var CharacterData: {\r\n prototype: CharacterData;\r\n new(): CharacterData;\r\n}\r\n\r\ninterface ClientRect {\r\n bottom: number;\r\n readonly height: number;\r\n left: number;\r\n right: number;\r\n top: number;\r\n readonly width: number;\r\n}\r\n\r\ndeclare var ClientRect: {\r\n prototype: ClientRect;\r\n new(): ClientRect;\r\n}\r\n\r\ninterface ClientRectList {\r\n readonly length: number;\r\n item(index: number): ClientRect;\r\n [index: number]: ClientRect;\r\n}\r\n\r\ndeclare var ClientRectList: {\r\n prototype: ClientRectList;\r\n new(): ClientRectList;\r\n}\r\n\r\ninterface ClipboardEvent extends Event {\r\n readonly clipboardData: DataTransfer;\r\n}\r\n\r\ndeclare var ClipboardEvent: {\r\n prototype: ClipboardEvent;\r\n new(type: string, eventInitDict?: ClipboardEventInit): ClipboardEvent;\r\n}\r\n\r\ninterface CloseEvent extends Event {\r\n readonly code: number;\r\n readonly reason: string;\r\n readonly wasClean: boolean;\r\n initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void;\r\n}\r\n\r\ndeclare var CloseEvent: {\r\n prototype: CloseEvent;\r\n new(): CloseEvent;\r\n}\r\n\r\ninterface CommandEvent extends Event {\r\n readonly commandName: string;\r\n readonly detail: string | null;\r\n}\r\n\r\ndeclare var CommandEvent: {\r\n prototype: CommandEvent;\r\n new(type: string, eventInitDict?: CommandEventInit): CommandEvent;\r\n}\r\n\r\ninterface Comment extends CharacterData {\r\n text: string;\r\n}\r\n\r\ndeclare var Comment: {\r\n prototype: Comment;\r\n new(): Comment;\r\n}\r\n\r\ninterface CompositionEvent extends UIEvent {\r\n readonly data: string;\r\n readonly locale: string;\r\n initCompositionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, locale: string): void;\r\n}\r\n\r\ndeclare var CompositionEvent: {\r\n prototype: CompositionEvent;\r\n new(typeArg: string, eventInitDict?: CompositionEventInit): CompositionEvent;\r\n}\r\n\r\ninterface Console {\r\n assert(test?: boolean, message?: string, ...optionalParams: any[]): void;\r\n clear(): void;\r\n count(countTitle?: string): void;\r\n debug(message?: string, ...optionalParams: any[]): void;\r\n dir(value?: any, ...optionalParams: any[]): void;\r\n dirxml(value: any): void;\r\n error(message?: any, ...optionalParams: any[]): void;\r\n exception(message?: string, ...optionalParams: any[]): void;\r\n group(groupTitle?: string): void;\r\n groupCollapsed(groupTitle?: string): void;\r\n groupEnd(): void;\r\n info(message?: any, ...optionalParams: any[]): void;\r\n log(message?: any, ...optionalParams: any[]): void;\r\n msIsIndependentlyComposed(element: Element): boolean;\r\n profile(reportName?: string): void;\r\n profileEnd(): void;\r\n select(element: Element): void;\r\n table(...data: any[]): void;\r\n time(timerName?: string): void;\r\n timeEnd(timerName?: string): void;\r\n trace(message?: any, ...optionalParams: any[]): void;\r\n warn(message?: any, ...optionalParams: any[]): void;\r\n}\r\n\r\ndeclare var Console: {\r\n prototype: Console;\r\n new(): Console;\r\n}\r\n\r\ninterface ConvolverNode extends AudioNode {\r\n buffer: AudioBuffer | null;\r\n normalize: boolean;\r\n}\r\n\r\ndeclare var ConvolverNode: {\r\n prototype: ConvolverNode;\r\n new(): ConvolverNode;\r\n}\r\n\r\ninterface Coordinates {\r\n readonly accuracy: number;\r\n readonly altitude: number | null;\r\n readonly altitudeAccuracy: number | null;\r\n readonly heading: number | null;\r\n readonly latitude: number;\r\n readonly longitude: number;\r\n readonly speed: number | null;\r\n}\r\n\r\ndeclare var Coordinates: {\r\n prototype: Coordinates;\r\n new(): Coordinates;\r\n}\r\n\r\ninterface Crypto extends Object, RandomSource {\r\n readonly subtle: SubtleCrypto;\r\n}\r\n\r\ndeclare var Crypto: {\r\n prototype: Crypto;\r\n new(): Crypto;\r\n}\r\n\r\ninterface CryptoKey {\r\n readonly algorithm: KeyAlgorithm;\r\n readonly extractable: boolean;\r\n readonly type: string;\r\n readonly usages: string[];\r\n}\r\n\r\ndeclare var CryptoKey: {\r\n prototype: CryptoKey;\r\n new(): CryptoKey;\r\n}\r\n\r\ninterface CryptoKeyPair {\r\n privateKey: CryptoKey;\r\n publicKey: CryptoKey;\r\n}\r\n\r\ndeclare var CryptoKeyPair: {\r\n prototype: CryptoKeyPair;\r\n new(): CryptoKeyPair;\r\n}\r\n\r\ninterface CustomEvent extends Event {\r\n readonly detail: any;\r\n initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void;\r\n}\r\n\r\ndeclare var CustomEvent: {\r\n prototype: CustomEvent;\r\n new(typeArg: string, eventInitDict?: CustomEventInit): CustomEvent;\r\n}\r\n\r\ninterface DOMError {\r\n readonly name: string;\r\n toString(): string;\r\n}\r\n\r\ndeclare var DOMError: {\r\n prototype: DOMError;\r\n new(): DOMError;\r\n}\r\n\r\ninterface DOMException {\r\n readonly code: number;\r\n readonly message: string;\r\n readonly name: string;\r\n toString(): string;\r\n readonly ABORT_ERR: number;\r\n readonly DATA_CLONE_ERR: number;\r\n readonly DOMSTRING_SIZE_ERR: number;\r\n readonly HIERARCHY_REQUEST_ERR: number;\r\n readonly INDEX_SIZE_ERR: number;\r\n readonly INUSE_ATTRIBUTE_ERR: number;\r\n readonly INVALID_ACCESS_ERR: number;\r\n readonly INVALID_CHARACTER_ERR: number;\r\n readonly INVALID_MODIFICATION_ERR: number;\r\n readonly INVALID_NODE_TYPE_ERR: number;\r\n readonly INVALID_STATE_ERR: number;\r\n readonly NAMESPACE_ERR: number;\r\n readonly NETWORK_ERR: number;\r\n readonly NOT_FOUND_ERR: number;\r\n readonly NOT_SUPPORTED_ERR: number;\r\n readonly NO_DATA_ALLOWED_ERR: number;\r\n readonly NO_MODIFICATION_ALLOWED_ERR: number;\r\n readonly PARSE_ERR: number;\r\n readonly QUOTA_EXCEEDED_ERR: number;\r\n readonly SECURITY_ERR: number;\r\n readonly SERIALIZE_ERR: number;\r\n readonly SYNTAX_ERR: number;\r\n readonly TIMEOUT_ERR: number;\r\n readonly TYPE_MISMATCH_ERR: number;\r\n readonly URL_MISMATCH_ERR: number;\r\n readonly VALIDATION_ERR: number;\r\n readonly WRONG_DOCUMENT_ERR: number;\r\n}\r\n\r\ndeclare var DOMException: {\r\n prototype: DOMException;\r\n new(): DOMException;\r\n readonly ABORT_ERR: number;\r\n readonly DATA_CLONE_ERR: number;\r\n readonly DOMSTRING_SIZE_ERR: number;\r\n readonly HIERARCHY_REQUEST_ERR: number;\r\n readonly INDEX_SIZE_ERR: number;\r\n readonly INUSE_ATTRIBUTE_ERR: number;\r\n readonly INVALID_ACCESS_ERR: number;\r\n readonly INVALID_CHARACTER_ERR: number;\r\n readonly INVALID_MODIFICATION_ERR: number;\r\n readonly INVALID_NODE_TYPE_ERR: number;\r\n readonly INVALID_STATE_ERR: number;\r\n readonly NAMESPACE_ERR: number;\r\n readonly NETWORK_ERR: number;\r\n readonly NOT_FOUND_ERR: number;\r\n readonly NOT_SUPPORTED_ERR: number;\r\n readonly NO_DATA_ALLOWED_ERR: number;\r\n readonly NO_MODIFICATION_ALLOWED_ERR: number;\r\n readonly PARSE_ERR: number;\r\n readonly QUOTA_EXCEEDED_ERR: number;\r\n readonly SECURITY_ERR: number;\r\n readonly SERIALIZE_ERR: number;\r\n readonly SYNTAX_ERR: number;\r\n readonly TIMEOUT_ERR: number;\r\n readonly TYPE_MISMATCH_ERR: number;\r\n readonly URL_MISMATCH_ERR: number;\r\n readonly VALIDATION_ERR: number;\r\n readonly WRONG_DOCUMENT_ERR: number;\r\n}\r\n\r\ninterface DOMImplementation {\r\n createDocument(namespaceURI: string | null, qualifiedName: string | null, doctype: DocumentType): Document;\r\n createDocumentType(qualifiedName: string, publicId: string | null, systemId: string | null): DocumentType;\r\n createHTMLDocument(title: string): Document;\r\n hasFeature(feature: string | null, version: string | null): boolean;\r\n}\r\n\r\ndeclare var DOMImplementation: {\r\n prototype: DOMImplementation;\r\n new(): DOMImplementation;\r\n}\r\n\r\ninterface DOMParser {\r\n parseFromString(source: string, mimeType: string): Document;\r\n}\r\n\r\ndeclare var DOMParser: {\r\n prototype: DOMParser;\r\n new(): DOMParser;\r\n}\r\n\r\ninterface DOMSettableTokenList extends DOMTokenList {\r\n value: string;\r\n}\r\n\r\ndeclare var DOMSettableTokenList: {\r\n prototype: DOMSettableTokenList;\r\n new(): DOMSettableTokenList;\r\n}\r\n\r\ninterface DOMStringList {\r\n readonly length: number;\r\n contains(str: string): boolean;\r\n item(index: number): string | null;\r\n [index: number]: string;\r\n}\r\n\r\ndeclare var DOMStringList: {\r\n prototype: DOMStringList;\r\n new(): DOMStringList;\r\n}\r\n\r\ninterface DOMStringMap {\r\n [name: string]: string;\r\n}\r\n\r\ndeclare var DOMStringMap: {\r\n prototype: DOMStringMap;\r\n new(): DOMStringMap;\r\n}\r\n\r\ninterface DOMTokenList {\r\n readonly length: number;\r\n add(...token: string[]): void;\r\n contains(token: string): boolean;\r\n item(index: number): string;\r\n remove(...token: string[]): void;\r\n toString(): string;\r\n toggle(token: string, force?: boolean): boolean;\r\n [index: number]: string;\r\n}\r\n\r\ndeclare var DOMTokenList: {\r\n prototype: DOMTokenList;\r\n new(): DOMTokenList;\r\n}\r\n\r\ninterface DataCue extends TextTrackCue {\r\n data: ArrayBuffer;\r\n}\r\n\r\ndeclare var DataCue: {\r\n prototype: DataCue;\r\n new(): DataCue;\r\n}\r\n\r\ninterface DataTransfer {\r\n dropEffect: string;\r\n effectAllowed: string;\r\n readonly files: FileList;\r\n readonly items: DataTransferItemList;\r\n readonly types: DOMStringList;\r\n clearData(format?: string): boolean;\r\n getData(format: string): string;\r\n setData(format: string, data: string): boolean;\r\n}\r\n\r\ndeclare var DataTransfer: {\r\n prototype: DataTransfer;\r\n new(): DataTransfer;\r\n}\r\n\r\ninterface DataTransferItem {\r\n readonly kind: string;\r\n readonly type: string;\r\n getAsFile(): File | null;\r\n getAsString(_callback: FunctionStringCallback | null): void;\r\n}\r\n\r\ndeclare var DataTransferItem: {\r\n prototype: DataTransferItem;\r\n new(): DataTransferItem;\r\n}\r\n\r\ninterface DataTransferItemList {\r\n readonly length: number;\r\n add(data: File): DataTransferItem | null;\r\n clear(): void;\r\n item(index: number): DataTransferItem;\r\n remove(index: number): void;\r\n [index: number]: DataTransferItem;\r\n}\r\n\r\ndeclare var DataTransferItemList: {\r\n prototype: DataTransferItemList;\r\n new(): DataTransferItemList;\r\n}\r\n\r\ninterface DeferredPermissionRequest {\r\n readonly id: number;\r\n readonly type: string;\r\n readonly uri: string;\r\n allow(): void;\r\n deny(): void;\r\n}\r\n\r\ndeclare var DeferredPermissionRequest: {\r\n prototype: DeferredPermissionRequest;\r\n new(): DeferredPermissionRequest;\r\n}\r\n\r\ninterface DelayNode extends AudioNode {\r\n readonly delayTime: AudioParam;\r\n}\r\n\r\ndeclare var DelayNode: {\r\n prototype: DelayNode;\r\n new(): DelayNode;\r\n}\r\n\r\ninterface DeviceAcceleration {\r\n readonly x: number | null;\r\n readonly y: number | null;\r\n readonly z: number | null;\r\n}\r\n\r\ndeclare var DeviceAcceleration: {\r\n prototype: DeviceAcceleration;\r\n new(): DeviceAcceleration;\r\n}\r\n\r\ninterface DeviceLightEvent extends Event {\r\n readonly value: number;\r\n}\r\n\r\ndeclare var DeviceLightEvent: {\r\n prototype: DeviceLightEvent;\r\n new(type: string, eventInitDict?: DeviceLightEventInit): DeviceLightEvent;\r\n}\r\n\r\ninterface DeviceMotionEvent extends Event {\r\n readonly acceleration: DeviceAcceleration | null;\r\n readonly accelerationIncludingGravity: DeviceAcceleration | null;\r\n readonly interval: number | null;\r\n readonly rotationRate: DeviceRotationRate | null;\r\n initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict | null, accelerationIncludingGravity: DeviceAccelerationDict | null, rotationRate: DeviceRotationRateDict | null, interval: number | null): void;\r\n}\r\n\r\ndeclare var DeviceMotionEvent: {\r\n prototype: DeviceMotionEvent;\r\n new(): DeviceMotionEvent;\r\n}\r\n\r\ninterface DeviceOrientationEvent extends Event {\r\n readonly absolute: boolean;\r\n readonly alpha: number | null;\r\n readonly beta: number | null;\r\n readonly gamma: number | null;\r\n initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number | null, beta: number | null, gamma: number | null, absolute: boolean): void;\r\n}\r\n\r\ndeclare var DeviceOrientationEvent: {\r\n prototype: DeviceOrientationEvent;\r\n new(): DeviceOrientationEvent;\r\n}\r\n\r\ninterface DeviceRotationRate {\r\n readonly alpha: number | null;\r\n readonly beta: number | null;\r\n readonly gamma: number | null;\r\n}\r\n\r\ndeclare var DeviceRotationRate: {\r\n prototype: DeviceRotationRate;\r\n new(): DeviceRotationRate;\r\n}\r\n\r\ninterface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode {\r\n /**\r\n * Sets or gets the URL for the current document. \r\n */\r\n readonly URL: string;\r\n /**\r\n * Gets the URL for the document, stripped of any character encoding.\r\n */\r\n readonly URLUnencoded: string;\r\n /**\r\n * Gets the object that has the focus when the parent document has focus.\r\n */\r\n readonly activeElement: Element;\r\n /**\r\n * Sets or gets the color of all active links in the document.\r\n */\r\n alinkColor: string;\r\n /**\r\n * Returns a reference to the collection of elements contained by the object.\r\n */\r\n readonly all: HTMLAllCollection;\r\n /**\r\n * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order.\r\n */\r\n anchors: HTMLCollectionOf;\r\n /**\r\n * Retrieves a collection of all applet objects in the document.\r\n */\r\n applets: HTMLCollectionOf;\r\n /**\r\n * Deprecated. Sets or retrieves a value that indicates the background color behind the object. \r\n */\r\n bgColor: string;\r\n /**\r\n * Specifies the beginning and end of the document body.\r\n */\r\n body: HTMLElement;\r\n readonly characterSet: string;\r\n /**\r\n * Gets or sets the character set used to encode the object.\r\n */\r\n charset: string;\r\n /**\r\n * Gets a value that indicates whether standards-compliant mode is switched on for the object.\r\n */\r\n readonly compatMode: string;\r\n cookie: string;\r\n readonly currentScript: HTMLScriptElement | SVGScriptElement;\r\n /**\r\n * Gets the default character set from the current regional language settings.\r\n */\r\n readonly defaultCharset: string;\r\n readonly defaultView: Window;\r\n /**\r\n * Sets or gets a value that indicates whether the document can be edited.\r\n */\r\n designMode: string;\r\n /**\r\n * Sets or retrieves a value that indicates the reading order of the object. \r\n */\r\n dir: string;\r\n /**\r\n * Gets an object representing the document type declaration associated with the current document. \r\n */\r\n readonly doctype: DocumentType;\r\n /**\r\n * Gets a reference to the root node of the document. \r\n */\r\n documentElement: HTMLElement;\r\n /**\r\n * Sets or gets the security domain of the document. \r\n */\r\n domain: string;\r\n /**\r\n * Retrieves a collection of all embed objects in the document.\r\n */\r\n embeds: HTMLCollectionOf;\r\n /**\r\n * Sets or gets the foreground (text) color of the document.\r\n */\r\n fgColor: string;\r\n /**\r\n * Retrieves a collection, in source order, of all form objects in the document.\r\n */\r\n forms: HTMLCollectionOf;\r\n readonly fullscreenElement: Element | null;\r\n readonly fullscreenEnabled: boolean;\r\n readonly head: HTMLHeadElement;\r\n readonly hidden: boolean;\r\n /**\r\n * Retrieves a collection, in source order, of img objects in the document.\r\n */\r\n images: HTMLCollectionOf;\r\n /**\r\n * Gets the implementation object of the current document. \r\n */\r\n readonly implementation: DOMImplementation;\r\n /**\r\n * Returns the character encoding used to create the webpage that is loaded into the document object.\r\n */\r\n readonly inputEncoding: string | null;\r\n /**\r\n * Gets the date that the page was last modified, if the page supplies one. \r\n */\r\n readonly lastModified: string;\r\n /**\r\n * Sets or gets the color of the document links. \r\n */\r\n linkColor: string;\r\n /**\r\n * Retrieves a collection of all a objects that specify the href property and all area objects in the document.\r\n */\r\n links: HTMLCollectionOf;\r\n /**\r\n * Contains information about the current URL. \r\n */\r\n readonly location: Location;\r\n msCSSOMElementFloatMetrics: boolean;\r\n msCapsLockWarningOff: boolean;\r\n /**\r\n * Fires when the user aborts the download.\r\n * @param ev The event.\r\n */\r\n onabort: (this: this, ev: UIEvent) => any;\r\n /**\r\n * Fires when the object is set as the active element.\r\n * @param ev The event.\r\n */\r\n onactivate: (this: this, ev: UIEvent) => any;\r\n /**\r\n * Fires immediately before the object is set as the active element.\r\n * @param ev The event.\r\n */\r\n onbeforeactivate: (this: this, ev: UIEvent) => any;\r\n /**\r\n * Fires immediately before the activeElement is changed from the current object to another object in the parent document.\r\n * @param ev The event.\r\n */\r\n onbeforedeactivate: (this: this, ev: UIEvent) => any;\r\n /** \r\n * Fires when the object loses the input focus. \r\n * @param ev The focus event.\r\n */\r\n onblur: (this: this, ev: FocusEvent) => any;\r\n /**\r\n * Occurs when playback is possible, but would require further buffering. \r\n * @param ev The event.\r\n */\r\n oncanplay: (this: this, ev: Event) => any;\r\n oncanplaythrough: (this: this, ev: Event) => any;\r\n /**\r\n * Fires when the contents of the object or selection have changed. \r\n * @param ev The event.\r\n */\r\n onchange: (this: this, ev: Event) => any;\r\n /**\r\n * Fires when the user clicks the left mouse button on the object\r\n * @param ev The mouse event.\r\n */\r\n onclick: (this: this, ev: MouseEvent) => any;\r\n /**\r\n * Fires when the user clicks the right mouse button in the client area, opening the context menu. \r\n * @param ev The mouse event.\r\n */\r\n oncontextmenu: (this: this, ev: PointerEvent) => any;\r\n /**\r\n * Fires when the user double-clicks the object.\r\n * @param ev The mouse event.\r\n */\r\n ondblclick: (this: this, ev: MouseEvent) => any;\r\n /**\r\n * Fires when the activeElement is changed from the current object to another object in the parent document.\r\n * @param ev The UI Event\r\n */\r\n ondeactivate: (this: this, ev: UIEvent) => any;\r\n /**\r\n * Fires on the source object continuously during a drag operation.\r\n * @param ev The event.\r\n */\r\n ondrag: (this: this, ev: DragEvent) => any;\r\n /**\r\n * Fires on the source object when the user releases the mouse at the close of a drag operation.\r\n * @param ev The event.\r\n */\r\n ondragend: (this: this, ev: DragEvent) => any;\r\n /** \r\n * Fires on the target element when the user drags the object to a valid drop target.\r\n * @param ev The drag event.\r\n */\r\n ondragenter: (this: this, ev: DragEvent) => any;\r\n /** \r\n * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation.\r\n * @param ev The drag event.\r\n */\r\n ondragleave: (this: this, ev: DragEvent) => any;\r\n /**\r\n * Fires on the target element continuously while the user drags the object over a valid drop target.\r\n * @param ev The event.\r\n */\r\n ondragover: (this: this, ev: DragEvent) => any;\r\n /**\r\n * Fires on the source object when the user starts to drag a text selection or selected object. \r\n * @param ev The event.\r\n */\r\n ondragstart: (this: this, ev: DragEvent) => any;\r\n ondrop: (this: this, ev: DragEvent) => any;\r\n /**\r\n * Occurs when the duration attribute is updated. \r\n * @param ev The event.\r\n */\r\n ondurationchange: (this: this, ev: Event) => any;\r\n /**\r\n * Occurs when the media element is reset to its initial state. \r\n * @param ev The event.\r\n */\r\n onemptied: (this: this, ev: Event) => any;\r\n /**\r\n * Occurs when the end of playback is reached. \r\n * @param ev The event\r\n */\r\n onended: (this: this, ev: MediaStreamErrorEvent) => any;\r\n /**\r\n * Fires when an error occurs during object loading.\r\n * @param ev The event.\r\n */\r\n onerror: (this: this, ev: ErrorEvent) => any;\r\n /**\r\n * Fires when the object receives focus. \r\n * @param ev The event.\r\n */\r\n onfocus: (this: this, ev: FocusEvent) => any;\r\n onfullscreenchange: (this: this, ev: Event) => any;\r\n onfullscreenerror: (this: this, ev: Event) => any;\r\n oninput: (this: this, ev: Event) => any;\r\n oninvalid: (this: this, ev: Event) => any;\r\n /**\r\n * Fires when the user presses a key.\r\n * @param ev The keyboard event\r\n */\r\n onkeydown: (this: this, ev: KeyboardEvent) => any;\r\n /**\r\n * Fires when the user presses an alphanumeric key.\r\n * @param ev The event.\r\n */\r\n onkeypress: (this: this, ev: KeyboardEvent) => any;\r\n /**\r\n * Fires when the user releases a key.\r\n * @param ev The keyboard event\r\n */\r\n onkeyup: (this: this, ev: KeyboardEvent) => any;\r\n /**\r\n * Fires immediately after the browser loads the object. \r\n * @param ev The event.\r\n */\r\n onload: (this: this, ev: Event) => any;\r\n /**\r\n * Occurs when media data is loaded at the current playback position. \r\n * @param ev The event.\r\n */\r\n onloadeddata: (this: this, ev: Event) => any;\r\n /**\r\n * Occurs when the duration and dimensions of the media have been determined.\r\n * @param ev The event.\r\n */\r\n onloadedmetadata: (this: this, ev: Event) => any;\r\n /**\r\n * Occurs when Internet Explorer begins looking for media data. \r\n * @param ev The event.\r\n */\r\n onloadstart: (this: this, ev: Event) => any;\r\n /**\r\n * Fires when the user clicks the object with either mouse button. \r\n * @param ev The mouse event.\r\n */\r\n onmousedown: (this: this, ev: MouseEvent) => any;\r\n /**\r\n * Fires when the user moves the mouse over the object. \r\n * @param ev The mouse event.\r\n */\r\n onmousemove: (this: this, ev: MouseEvent) => any;\r\n /**\r\n * Fires when the user moves the mouse pointer outside the boundaries of the object. \r\n * @param ev The mouse event.\r\n */\r\n onmouseout: (this: this, ev: MouseEvent) => any;\r\n /**\r\n * Fires when the user moves the mouse pointer into the object.\r\n * @param ev The mouse event.\r\n */\r\n onmouseover: (this: this, ev: MouseEvent) => any;\r\n /**\r\n * Fires when the user releases a mouse button while the mouse is over the object. \r\n * @param ev The mouse event.\r\n */\r\n onmouseup: (this: this, ev: MouseEvent) => any;\r\n /**\r\n * Fires when the wheel button is rotated. \r\n * @param ev The mouse event\r\n */\r\n onmousewheel: (this: this, ev: WheelEvent) => any;\r\n onmscontentzoom: (this: this, ev: UIEvent) => any;\r\n onmsgesturechange: (this: this, ev: MSGestureEvent) => any;\r\n onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any;\r\n onmsgestureend: (this: this, ev: MSGestureEvent) => any;\r\n onmsgesturehold: (this: this, ev: MSGestureEvent) => any;\r\n onmsgesturestart: (this: this, ev: MSGestureEvent) => any;\r\n onmsgesturetap: (this: this, ev: MSGestureEvent) => any;\r\n onmsinertiastart: (this: this, ev: MSGestureEvent) => any;\r\n onmsmanipulationstatechanged: (this: this, ev: MSManipulationEvent) => any;\r\n onmspointercancel: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerdown: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerenter: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerleave: (this: this, ev: MSPointerEvent) => any;\r\n onmspointermove: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerout: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerover: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerup: (this: this, ev: MSPointerEvent) => any;\r\n /**\r\n * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. \r\n * @param ev The event.\r\n */\r\n onmssitemodejumplistitemremoved: (this: this, ev: MSSiteModeEvent) => any;\r\n /**\r\n * Occurs when a user clicks a button in a Thumbnail Toolbar of a webpage running in Site Mode.\r\n * @param ev The event.\r\n */\r\n onmsthumbnailclick: (this: this, ev: MSSiteModeEvent) => any;\r\n /**\r\n * Occurs when playback is paused.\r\n * @param ev The event.\r\n */\r\n onpause: (this: this, ev: Event) => any;\r\n /**\r\n * Occurs when the play method is requested. \r\n * @param ev The event.\r\n */\r\n onplay: (this: this, ev: Event) => any;\r\n /**\r\n * Occurs when the audio or video has started playing. \r\n * @param ev The event.\r\n */\r\n onplaying: (this: this, ev: Event) => any;\r\n onpointerlockchange: (this: this, ev: Event) => any;\r\n onpointerlockerror: (this: this, ev: Event) => any;\r\n /**\r\n * Occurs to indicate progress while downloading media data. \r\n * @param ev The event.\r\n */\r\n onprogress: (this: this, ev: ProgressEvent) => any;\r\n /**\r\n * Occurs when the playback rate is increased or decreased. \r\n * @param ev The event.\r\n */\r\n onratechange: (this: this, ev: Event) => any;\r\n /**\r\n * Fires when the state of the object has changed.\r\n * @param ev The event\r\n */\r\n onreadystatechange: (this: this, ev: ProgressEvent) => any;\r\n /**\r\n * Fires when the user resets a form. \r\n * @param ev The event.\r\n */\r\n onreset: (this: this, ev: Event) => any;\r\n /**\r\n * Fires when the user repositions the scroll box in the scroll bar on the object. \r\n * @param ev The event.\r\n */\r\n onscroll: (this: this, ev: UIEvent) => any;\r\n /**\r\n * Occurs when the seek operation ends. \r\n * @param ev The event.\r\n */\r\n onseeked: (this: this, ev: Event) => any;\r\n /**\r\n * Occurs when the current playback position is moved. \r\n * @param ev The event.\r\n */\r\n onseeking: (this: this, ev: Event) => any;\r\n /**\r\n * Fires when the current selection changes.\r\n * @param ev The event.\r\n */\r\n onselect: (this: this, ev: UIEvent) => any;\r\n /**\r\n * Fires when the selection state of a document changes.\r\n * @param ev The event.\r\n */\r\n onselectionchange: (this: this, ev: Event) => any;\r\n onselectstart: (this: this, ev: Event) => any;\r\n /**\r\n * Occurs when the download has stopped. \r\n * @param ev The event.\r\n */\r\n onstalled: (this: this, ev: Event) => any;\r\n /**\r\n * Fires when the user clicks the Stop button or leaves the Web page.\r\n * @param ev The event.\r\n */\r\n onstop: (this: this, ev: Event) => any;\r\n onsubmit: (this: this, ev: Event) => any;\r\n /**\r\n * Occurs if the load operation has been intentionally halted. \r\n * @param ev The event.\r\n */\r\n onsuspend: (this: this, ev: Event) => any;\r\n /**\r\n * Occurs to indicate the current playback position.\r\n * @param ev The event.\r\n */\r\n ontimeupdate: (this: this, ev: Event) => any;\r\n ontouchcancel: (ev: TouchEvent) => any;\r\n ontouchend: (ev: TouchEvent) => any;\r\n ontouchmove: (ev: TouchEvent) => any;\r\n ontouchstart: (ev: TouchEvent) => any;\r\n /**\r\n * Occurs when the volume is changed, or playback is muted or unmuted.\r\n * @param ev The event.\r\n */\r\n onvolumechange: (this: this, ev: Event) => any;\r\n /**\r\n * Occurs when playback stops because the next frame of a video resource is not available. \r\n * @param ev The event.\r\n */\r\n onwaiting: (this: this, ev: Event) => any;\r\n onwebkitfullscreenchange: (this: this, ev: Event) => any;\r\n onwebkitfullscreenerror: (this: this, ev: Event) => any;\r\n plugins: HTMLCollectionOf;\r\n readonly pointerLockElement: Element;\r\n /**\r\n * Retrieves a value that indicates the current state of the object.\r\n */\r\n readonly readyState: string;\r\n /**\r\n * Gets the URL of the location that referred the user to the current page.\r\n */\r\n readonly referrer: string;\r\n /**\r\n * Gets the root svg element in the document hierarchy.\r\n */\r\n readonly rootElement: SVGSVGElement;\r\n /**\r\n * Retrieves a collection of all script objects in the document.\r\n */\r\n scripts: HTMLCollectionOf;\r\n readonly scrollingElement: Element | null;\r\n /**\r\n * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document.\r\n */\r\n readonly styleSheets: StyleSheetList;\r\n /**\r\n * Contains the title of the document.\r\n */\r\n title: string;\r\n readonly visibilityState: string;\r\n /** \r\n * Sets or gets the color of the links that the user has visited.\r\n */\r\n vlinkColor: string;\r\n readonly webkitCurrentFullScreenElement: Element | null;\r\n readonly webkitFullscreenElement: Element | null;\r\n readonly webkitFullscreenEnabled: boolean;\r\n readonly webkitIsFullScreen: boolean;\r\n readonly xmlEncoding: string | null;\r\n xmlStandalone: boolean;\r\n /**\r\n * Gets or sets the version attribute specified in the declaration of an XML document.\r\n */\r\n xmlVersion: string | null;\r\n adoptNode(source: Node): Node;\r\n captureEvents(): void;\r\n caretRangeFromPoint(x: number, y: number): Range;\r\n clear(): void;\r\n /**\r\n * Closes an output stream and forces the sent data to display.\r\n */\r\n close(): void;\r\n /**\r\n * Creates an attribute object with a specified name.\r\n * @param name String that sets the attribute object's name.\r\n */\r\n createAttribute(name: string): Attr;\r\n createAttributeNS(namespaceURI: string | null, qualifiedName: string): Attr;\r\n createCDATASection(data: string): CDATASection;\r\n /**\r\n * Creates a comment object with the specified data.\r\n * @param data Sets the comment object's data.\r\n */\r\n createComment(data: string): Comment;\r\n /**\r\n * Creates a new document.\r\n */\r\n createDocumentFragment(): DocumentFragment;\r\n /**\r\n * Creates an instance of the element for the specified tag.\r\n * @param tagName The name of an element.\r\n */\r\n createElement(tagName: \"a\"): HTMLAnchorElement;\r\n createElement(tagName: \"applet\"): HTMLAppletElement;\r\n createElement(tagName: \"area\"): HTMLAreaElement;\r\n createElement(tagName: \"audio\"): HTMLAudioElement;\r\n createElement(tagName: \"base\"): HTMLBaseElement;\r\n createElement(tagName: \"basefont\"): HTMLBaseFontElement;\r\n createElement(tagName: \"blockquote\"): HTMLQuoteElement;\r\n createElement(tagName: \"body\"): HTMLBodyElement;\r\n createElement(tagName: \"br\"): HTMLBRElement;\r\n createElement(tagName: \"button\"): HTMLButtonElement;\r\n createElement(tagName: \"canvas\"): HTMLCanvasElement;\r\n createElement(tagName: \"caption\"): HTMLTableCaptionElement;\r\n createElement(tagName: \"col\"): HTMLTableColElement;\r\n createElement(tagName: \"colgroup\"): HTMLTableColElement;\r\n createElement(tagName: \"datalist\"): HTMLDataListElement;\r\n createElement(tagName: \"del\"): HTMLModElement;\r\n createElement(tagName: \"dir\"): HTMLDirectoryElement;\r\n createElement(tagName: \"div\"): HTMLDivElement;\r\n createElement(tagName: \"dl\"): HTMLDListElement;\r\n createElement(tagName: \"embed\"): HTMLEmbedElement;\r\n createElement(tagName: \"fieldset\"): HTMLFieldSetElement;\r\n createElement(tagName: \"font\"): HTMLFontElement;\r\n createElement(tagName: \"form\"): HTMLFormElement;\r\n createElement(tagName: \"frame\"): HTMLFrameElement;\r\n createElement(tagName: \"frameset\"): HTMLFrameSetElement;\r\n createElement(tagName: \"h1\"): HTMLHeadingElement;\r\n createElement(tagName: \"h2\"): HTMLHeadingElement;\r\n createElement(tagName: \"h3\"): HTMLHeadingElement;\r\n createElement(tagName: \"h4\"): HTMLHeadingElement;\r\n createElement(tagName: \"h5\"): HTMLHeadingElement;\r\n createElement(tagName: \"h6\"): HTMLHeadingElement;\r\n createElement(tagName: \"head\"): HTMLHeadElement;\r\n createElement(tagName: \"hr\"): HTMLHRElement;\r\n createElement(tagName: \"html\"): HTMLHtmlElement;\r\n createElement(tagName: \"iframe\"): HTMLIFrameElement;\r\n createElement(tagName: \"img\"): HTMLImageElement;\r\n createElement(tagName: \"input\"): HTMLInputElement;\r\n createElement(tagName: \"ins\"): HTMLModElement;\r\n createElement(tagName: \"isindex\"): HTMLUnknownElement;\r\n createElement(tagName: \"label\"): HTMLLabelElement;\r\n createElement(tagName: \"legend\"): HTMLLegendElement;\r\n createElement(tagName: \"li\"): HTMLLIElement;\r\n createElement(tagName: \"link\"): HTMLLinkElement;\r\n createElement(tagName: \"listing\"): HTMLPreElement;\r\n createElement(tagName: \"map\"): HTMLMapElement;\r\n createElement(tagName: \"marquee\"): HTMLMarqueeElement;\r\n createElement(tagName: \"menu\"): HTMLMenuElement;\r\n createElement(tagName: \"meta\"): HTMLMetaElement;\r\n createElement(tagName: \"meter\"): HTMLMeterElement;\r\n createElement(tagName: \"nextid\"): HTMLUnknownElement;\r\n createElement(tagName: \"object\"): HTMLObjectElement;\r\n createElement(tagName: \"ol\"): HTMLOListElement;\r\n createElement(tagName: \"optgroup\"): HTMLOptGroupElement;\r\n createElement(tagName: \"option\"): HTMLOptionElement;\r\n createElement(tagName: \"p\"): HTMLParagraphElement;\r\n createElement(tagName: \"param\"): HTMLParamElement;\r\n createElement(tagName: \"picture\"): HTMLPictureElement;\r\n createElement(tagName: \"pre\"): HTMLPreElement;\r\n createElement(tagName: \"progress\"): HTMLProgressElement;\r\n createElement(tagName: \"q\"): HTMLQuoteElement;\r\n createElement(tagName: \"script\"): HTMLScriptElement;\r\n createElement(tagName: \"select\"): HTMLSelectElement;\r\n createElement(tagName: \"source\"): HTMLSourceElement;\r\n createElement(tagName: \"span\"): HTMLSpanElement;\r\n createElement(tagName: \"style\"): HTMLStyleElement;\r\n createElement(tagName: \"table\"): HTMLTableElement;\r\n createElement(tagName: \"tbody\"): HTMLTableSectionElement;\r\n createElement(tagName: \"td\"): HTMLTableDataCellElement;\r\n createElement(tagName: \"template\"): HTMLTemplateElement;\r\n createElement(tagName: \"textarea\"): HTMLTextAreaElement;\r\n createElement(tagName: \"tfoot\"): HTMLTableSectionElement;\r\n createElement(tagName: \"th\"): HTMLTableHeaderCellElement;\r\n createElement(tagName: \"thead\"): HTMLTableSectionElement;\r\n createElement(tagName: \"title\"): HTMLTitleElement;\r\n createElement(tagName: \"tr\"): HTMLTableRowElement;\r\n createElement(tagName: \"track\"): HTMLTrackElement;\r\n createElement(tagName: \"ul\"): HTMLUListElement;\r\n createElement(tagName: \"video\"): HTMLVideoElement;\r\n createElement(tagName: \"x-ms-webview\"): MSHTMLWebViewElement;\r\n createElement(tagName: \"xmp\"): HTMLPreElement;\r\n createElement(tagName: string): HTMLElement;\r\n createElementNS(namespaceURI: \"http://www.w3.org/1999/xhtml\", qualifiedName: string): HTMLElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"a\"): SVGAElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"circle\"): SVGCircleElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"clipPath\"): SVGClipPathElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"componentTransferFunction\"): SVGComponentTransferFunctionElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"defs\"): SVGDefsElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"desc\"): SVGDescElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"ellipse\"): SVGEllipseElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feBlend\"): SVGFEBlendElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feColorMatrix\"): SVGFEColorMatrixElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feComponentTransfer\"): SVGFEComponentTransferElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feComposite\"): SVGFECompositeElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feConvolveMatrix\"): SVGFEConvolveMatrixElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feDiffuseLighting\"): SVGFEDiffuseLightingElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feDisplacementMap\"): SVGFEDisplacementMapElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feDistantLight\"): SVGFEDistantLightElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feFlood\"): SVGFEFloodElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feFuncA\"): SVGFEFuncAElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feFuncB\"): SVGFEFuncBElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feFuncG\"): SVGFEFuncGElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feFuncR\"): SVGFEFuncRElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feGaussianBlur\"): SVGFEGaussianBlurElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feImage\"): SVGFEImageElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feMerge\"): SVGFEMergeElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feMergeNode\"): SVGFEMergeNodeElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feMorphology\"): SVGFEMorphologyElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feOffset\"): SVGFEOffsetElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"fePointLight\"): SVGFEPointLightElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feSpecularLighting\"): SVGFESpecularLightingElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feSpotLight\"): SVGFESpotLightElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feTile\"): SVGFETileElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feTurbulence\"): SVGFETurbulenceElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"filter\"): SVGFilterElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"foreignObject\"): SVGForeignObjectElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"g\"): SVGGElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"image\"): SVGImageElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"gradient\"): SVGGradientElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"line\"): SVGLineElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"linearGradient\"): SVGLinearGradientElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"marker\"): SVGMarkerElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"mask\"): SVGMaskElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"path\"): SVGPathElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"metadata\"): SVGMetadataElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"pattern\"): SVGPatternElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"polygon\"): SVGPolygonElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"polyline\"): SVGPolylineElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"radialGradient\"): SVGRadialGradientElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"rect\"): SVGRectElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"svg\"): SVGSVGElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"script\"): SVGScriptElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"stop\"): SVGStopElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"style\"): SVGStyleElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"switch\"): SVGSwitchElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"symbol\"): SVGSymbolElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"tspan\"): SVGTSpanElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"textContent\"): SVGTextContentElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"text\"): SVGTextElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"textPath\"): SVGTextPathElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"textPositioning\"): SVGTextPositioningElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"title\"): SVGTitleElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"use\"): SVGUseElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"view\"): SVGViewElement\r\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: string): SVGElement\r\n createElementNS(namespaceURI: string | null, qualifiedName: string): Element;\r\n createExpression(expression: string, resolver: XPathNSResolver): XPathExpression;\r\n createNSResolver(nodeResolver: Node): XPathNSResolver;\r\n /**\r\n * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. \r\n * @param root The root element or node to start traversing on.\r\n * @param whatToShow The type of nodes or elements to appear in the node list\r\n * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter.\r\n * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded.\r\n */\r\n createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): NodeIterator;\r\n createProcessingInstruction(target: string, data: string): ProcessingInstruction;\r\n /**\r\n * Returns an empty range object that has both of its boundary points positioned at the beginning of the document. \r\n */\r\n createRange(): Range;\r\n /**\r\n * Creates a text string from the specified value. \r\n * @param data String that specifies the nodeValue property of the text node.\r\n */\r\n createTextNode(data: string): Text;\r\n createTouch(view: Window, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch;\r\n createTouchList(...touches: Touch[]): TouchList;\r\n /**\r\n * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document.\r\n * @param root The root element or node to start traversing on.\r\n * @param whatToShow The type of nodes or elements to appear in the node list. For more information, see whatToShow.\r\n * @param filter A custom NodeFilter function to use.\r\n * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded.\r\n */\r\n createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): TreeWalker;\r\n /**\r\n * Returns the element for the specified x coordinate and the specified y coordinate. \r\n * @param x The x-offset\r\n * @param y The y-offset\r\n */\r\n elementFromPoint(x: number, y: number): Element;\r\n evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult;\r\n /**\r\n * Executes a command on the current document, current selection, or the given range.\r\n * @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script.\r\n * @param showUI Display the user interface, defaults to false.\r\n * @param value Value to assign.\r\n */\r\n execCommand(commandId: string, showUI?: boolean, value?: any): boolean;\r\n /**\r\n * Displays help information for the given command identifier.\r\n * @param commandId Displays help information for the given command identifier.\r\n */\r\n execCommandShowHelp(commandId: string): boolean;\r\n exitFullscreen(): void;\r\n exitPointerLock(): void;\r\n /**\r\n * Causes the element to receive the focus and executes the code specified by the onfocus event.\r\n */\r\n focus(): void;\r\n /**\r\n * Returns a reference to the first object with the specified value of the ID or NAME attribute.\r\n * @param elementId String that specifies the ID value. Case-insensitive.\r\n */\r\n getElementById(elementId: string): HTMLElement | null;\r\n getElementsByClassName(classNames: string): HTMLCollectionOf;\r\n /**\r\n * Gets a collection of objects based on the value of the NAME or ID attribute.\r\n * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute.\r\n */\r\n getElementsByName(elementName: string): NodeListOf;\r\n /**\r\n * Retrieves a collection of objects based on the specified element name.\r\n * @param name Specifies the name of an element.\r\n */\r\n getElementsByTagName(tagname: \"a\"): NodeListOf;\r\n getElementsByTagName(tagname: \"abbr\"): NodeListOf;\r\n getElementsByTagName(tagname: \"acronym\"): NodeListOf;\r\n getElementsByTagName(tagname: \"address\"): NodeListOf;\r\n getElementsByTagName(tagname: \"applet\"): NodeListOf;\r\n getElementsByTagName(tagname: \"area\"): NodeListOf;\r\n getElementsByTagName(tagname: \"article\"): NodeListOf;\r\n getElementsByTagName(tagname: \"aside\"): NodeListOf;\r\n getElementsByTagName(tagname: \"audio\"): NodeListOf;\r\n getElementsByTagName(tagname: \"b\"): NodeListOf;\r\n getElementsByTagName(tagname: \"base\"): NodeListOf;\r\n getElementsByTagName(tagname: \"basefont\"): NodeListOf;\r\n getElementsByTagName(tagname: \"bdo\"): NodeListOf;\r\n getElementsByTagName(tagname: \"big\"): NodeListOf;\r\n getElementsByTagName(tagname: \"blockquote\"): NodeListOf;\r\n getElementsByTagName(tagname: \"body\"): NodeListOf;\r\n getElementsByTagName(tagname: \"br\"): NodeListOf;\r\n getElementsByTagName(tagname: \"button\"): NodeListOf;\r\n getElementsByTagName(tagname: \"canvas\"): NodeListOf;\r\n getElementsByTagName(tagname: \"caption\"): NodeListOf;\r\n getElementsByTagName(tagname: \"center\"): NodeListOf;\r\n getElementsByTagName(tagname: \"circle\"): NodeListOf;\r\n getElementsByTagName(tagname: \"cite\"): NodeListOf;\r\n getElementsByTagName(tagname: \"clippath\"): NodeListOf;\r\n getElementsByTagName(tagname: \"code\"): NodeListOf;\r\n getElementsByTagName(tagname: \"col\"): NodeListOf;\r\n getElementsByTagName(tagname: \"colgroup\"): NodeListOf;\r\n getElementsByTagName(tagname: \"datalist\"): NodeListOf;\r\n getElementsByTagName(tagname: \"dd\"): NodeListOf;\r\n getElementsByTagName(tagname: \"defs\"): NodeListOf;\r\n getElementsByTagName(tagname: \"del\"): NodeListOf;\r\n getElementsByTagName(tagname: \"desc\"): NodeListOf;\r\n getElementsByTagName(tagname: \"dfn\"): NodeListOf;\r\n getElementsByTagName(tagname: \"dir\"): NodeListOf;\r\n getElementsByTagName(tagname: \"div\"): NodeListOf;\r\n getElementsByTagName(tagname: \"dl\"): NodeListOf;\r\n getElementsByTagName(tagname: \"dt\"): NodeListOf;\r\n getElementsByTagName(tagname: \"ellipse\"): NodeListOf;\r\n getElementsByTagName(tagname: \"em\"): NodeListOf;\r\n getElementsByTagName(tagname: \"embed\"): NodeListOf;\r\n getElementsByTagName(tagname: \"feblend\"): NodeListOf;\r\n getElementsByTagName(tagname: \"fecolormatrix\"): NodeListOf;\r\n getElementsByTagName(tagname: \"fecomponenttransfer\"): NodeListOf;\r\n getElementsByTagName(tagname: \"fecomposite\"): NodeListOf;\r\n getElementsByTagName(tagname: \"feconvolvematrix\"): NodeListOf;\r\n getElementsByTagName(tagname: \"fediffuselighting\"): NodeListOf;\r\n getElementsByTagName(tagname: \"fedisplacementmap\"): NodeListOf;\r\n getElementsByTagName(tagname: \"fedistantlight\"): NodeListOf;\r\n getElementsByTagName(tagname: \"feflood\"): NodeListOf;\r\n getElementsByTagName(tagname: \"fefunca\"): NodeListOf;\r\n getElementsByTagName(tagname: \"fefuncb\"): NodeListOf;\r\n getElementsByTagName(tagname: \"fefuncg\"): NodeListOf;\r\n getElementsByTagName(tagname: \"fefuncr\"): NodeListOf;\r\n getElementsByTagName(tagname: \"fegaussianblur\"): NodeListOf;\r\n getElementsByTagName(tagname: \"feimage\"): NodeListOf;\r\n getElementsByTagName(tagname: \"femerge\"): NodeListOf;\r\n getElementsByTagName(tagname: \"femergenode\"): NodeListOf;\r\n getElementsByTagName(tagname: \"femorphology\"): NodeListOf;\r\n getElementsByTagName(tagname: \"feoffset\"): NodeListOf;\r\n getElementsByTagName(tagname: \"fepointlight\"): NodeListOf;\r\n getElementsByTagName(tagname: \"fespecularlighting\"): NodeListOf;\r\n getElementsByTagName(tagname: \"fespotlight\"): NodeListOf;\r\n getElementsByTagName(tagname: \"fetile\"): NodeListOf;\r\n getElementsByTagName(tagname: \"feturbulence\"): NodeListOf;\r\n getElementsByTagName(tagname: \"fieldset\"): NodeListOf;\r\n getElementsByTagName(tagname: \"figcaption\"): NodeListOf;\r\n getElementsByTagName(tagname: \"figure\"): NodeListOf;\r\n getElementsByTagName(tagname: \"filter\"): NodeListOf;\r\n getElementsByTagName(tagname: \"font\"): NodeListOf;\r\n getElementsByTagName(tagname: \"footer\"): NodeListOf;\r\n getElementsByTagName(tagname: \"foreignobject\"): NodeListOf;\r\n getElementsByTagName(tagname: \"form\"): NodeListOf;\r\n getElementsByTagName(tagname: \"frame\"): NodeListOf;\r\n getElementsByTagName(tagname: \"frameset\"): NodeListOf;\r\n getElementsByTagName(tagname: \"g\"): NodeListOf;\r\n getElementsByTagName(tagname: \"h1\"): NodeListOf;\r\n getElementsByTagName(tagname: \"h2\"): NodeListOf;\r\n getElementsByTagName(tagname: \"h3\"): NodeListOf;\r\n getElementsByTagName(tagname: \"h4\"): NodeListOf;\r\n getElementsByTagName(tagname: \"h5\"): NodeListOf;\r\n getElementsByTagName(tagname: \"h6\"): NodeListOf;\r\n getElementsByTagName(tagname: \"head\"): NodeListOf;\r\n getElementsByTagName(tagname: \"header\"): NodeListOf;\r\n getElementsByTagName(tagname: \"hgroup\"): NodeListOf;\r\n getElementsByTagName(tagname: \"hr\"): NodeListOf;\r\n getElementsByTagName(tagname: \"html\"): NodeListOf;\r\n getElementsByTagName(tagname: \"i\"): NodeListOf;\r\n getElementsByTagName(tagname: \"iframe\"): NodeListOf;\r\n getElementsByTagName(tagname: \"image\"): NodeListOf;\r\n getElementsByTagName(tagname: \"img\"): NodeListOf;\r\n getElementsByTagName(tagname: \"input\"): NodeListOf;\r\n getElementsByTagName(tagname: \"ins\"): NodeListOf;\r\n getElementsByTagName(tagname: \"isindex\"): NodeListOf;\r\n getElementsByTagName(tagname: \"kbd\"): NodeListOf;\r\n getElementsByTagName(tagname: \"keygen\"): NodeListOf;\r\n getElementsByTagName(tagname: \"label\"): NodeListOf;\r\n getElementsByTagName(tagname: \"legend\"): NodeListOf;\r\n getElementsByTagName(tagname: \"li\"): NodeListOf;\r\n getElementsByTagName(tagname: \"line\"): NodeListOf;\r\n getElementsByTagName(tagname: \"lineargradient\"): NodeListOf;\r\n getElementsByTagName(tagname: \"link\"): NodeListOf;\r\n getElementsByTagName(tagname: \"listing\"): NodeListOf;\r\n getElementsByTagName(tagname: \"map\"): NodeListOf;\r\n getElementsByTagName(tagname: \"mark\"): NodeListOf;\r\n getElementsByTagName(tagname: \"marker\"): NodeListOf;\r\n getElementsByTagName(tagname: \"marquee\"): NodeListOf;\r\n getElementsByTagName(tagname: \"mask\"): NodeListOf;\r\n getElementsByTagName(tagname: \"menu\"): NodeListOf;\r\n getElementsByTagName(tagname: \"meta\"): NodeListOf;\r\n getElementsByTagName(tagname: \"metadata\"): NodeListOf;\r\n getElementsByTagName(tagname: \"meter\"): NodeListOf;\r\n getElementsByTagName(tagname: \"nav\"): NodeListOf;\r\n getElementsByTagName(tagname: \"nextid\"): NodeListOf;\r\n getElementsByTagName(tagname: \"nobr\"): NodeListOf;\r\n getElementsByTagName(tagname: \"noframes\"): NodeListOf;\r\n getElementsByTagName(tagname: \"noscript\"): NodeListOf;\r\n getElementsByTagName(tagname: \"object\"): NodeListOf;\r\n getElementsByTagName(tagname: \"ol\"): NodeListOf;\r\n getElementsByTagName(tagname: \"optgroup\"): NodeListOf;\r\n getElementsByTagName(tagname: \"option\"): NodeListOf;\r\n getElementsByTagName(tagname: \"p\"): NodeListOf;\r\n getElementsByTagName(tagname: \"param\"): NodeListOf;\r\n getElementsByTagName(tagname: \"path\"): NodeListOf;\r\n getElementsByTagName(tagname: \"pattern\"): NodeListOf;\r\n getElementsByTagName(tagname: \"picture\"): NodeListOf;\r\n getElementsByTagName(tagname: \"plaintext\"): NodeListOf;\r\n getElementsByTagName(tagname: \"polygon\"): NodeListOf;\r\n getElementsByTagName(tagname: \"polyline\"): NodeListOf;\r\n getElementsByTagName(tagname: \"pre\"): NodeListOf;\r\n getElementsByTagName(tagname: \"progress\"): NodeListOf;\r\n getElementsByTagName(tagname: \"q\"): NodeListOf;\r\n getElementsByTagName(tagname: \"radialgradient\"): NodeListOf;\r\n getElementsByTagName(tagname: \"rect\"): NodeListOf;\r\n getElementsByTagName(tagname: \"rt\"): NodeListOf;\r\n getElementsByTagName(tagname: \"ruby\"): NodeListOf;\r\n getElementsByTagName(tagname: \"s\"): NodeListOf;\r\n getElementsByTagName(tagname: \"samp\"): NodeListOf;\r\n getElementsByTagName(tagname: \"script\"): NodeListOf;\r\n getElementsByTagName(tagname: \"section\"): NodeListOf;\r\n getElementsByTagName(tagname: \"select\"): NodeListOf;\r\n getElementsByTagName(tagname: \"small\"): NodeListOf;\r\n getElementsByTagName(tagname: \"source\"): NodeListOf;\r\n getElementsByTagName(tagname: \"span\"): NodeListOf;\r\n getElementsByTagName(tagname: \"stop\"): NodeListOf;\r\n getElementsByTagName(tagname: \"strike\"): NodeListOf;\r\n getElementsByTagName(tagname: \"strong\"): NodeListOf;\r\n getElementsByTagName(tagname: \"style\"): NodeListOf;\r\n getElementsByTagName(tagname: \"sub\"): NodeListOf;\r\n getElementsByTagName(tagname: \"sup\"): NodeListOf;\r\n getElementsByTagName(tagname: \"svg\"): NodeListOf;\r\n getElementsByTagName(tagname: \"switch\"): NodeListOf;\r\n getElementsByTagName(tagname: \"symbol\"): NodeListOf;\r\n getElementsByTagName(tagname: \"table\"): NodeListOf;\r\n getElementsByTagName(tagname: \"tbody\"): NodeListOf;\r\n getElementsByTagName(tagname: \"td\"): NodeListOf;\r\n getElementsByTagName(tagname: \"template\"): NodeListOf;\r\n getElementsByTagName(tagname: \"text\"): NodeListOf;\r\n getElementsByTagName(tagname: \"textpath\"): NodeListOf;\r\n getElementsByTagName(tagname: \"textarea\"): NodeListOf;\r\n getElementsByTagName(tagname: \"tfoot\"): NodeListOf;\r\n getElementsByTagName(tagname: \"th\"): NodeListOf;\r\n getElementsByTagName(tagname: \"thead\"): NodeListOf;\r\n getElementsByTagName(tagname: \"title\"): NodeListOf;\r\n getElementsByTagName(tagname: \"tr\"): NodeListOf;\r\n getElementsByTagName(tagname: \"track\"): NodeListOf;\r\n getElementsByTagName(tagname: \"tspan\"): NodeListOf;\r\n getElementsByTagName(tagname: \"tt\"): NodeListOf;\r\n getElementsByTagName(tagname: \"u\"): NodeListOf;\r\n getElementsByTagName(tagname: \"ul\"): NodeListOf;\r\n getElementsByTagName(tagname: \"use\"): NodeListOf;\r\n getElementsByTagName(tagname: \"var\"): NodeListOf;\r\n getElementsByTagName(tagname: \"video\"): NodeListOf;\r\n getElementsByTagName(tagname: \"view\"): NodeListOf;\r\n getElementsByTagName(tagname: \"wbr\"): NodeListOf;\r\n getElementsByTagName(tagname: \"x-ms-webview\"): NodeListOf;\r\n getElementsByTagName(tagname: \"xmp\"): NodeListOf;\r\n getElementsByTagName(tagname: string): NodeListOf;\r\n getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/1999/xhtml\", localName: string): HTMLCollectionOf;\r\n getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/2000/svg\", localName: string): HTMLCollectionOf;\r\n getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf;\r\n /**\r\n * Returns an object representing the current selection of the document that is loaded into the object displaying a webpage.\r\n */\r\n getSelection(): Selection;\r\n /**\r\n * Gets a value indicating whether the object currently has focus.\r\n */\r\n hasFocus(): boolean;\r\n importNode(importedNode: Node, deep: boolean): Node;\r\n msElementsFromPoint(x: number, y: number): NodeListOf;\r\n msElementsFromRect(left: number, top: number, width: number, height: number): NodeListOf;\r\n /**\r\n * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method.\r\n * @param url Specifies a MIME type for the document.\r\n * @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element.\r\n * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, \"fullscreen=yes, toolbar=yes\"). The following values are supported.\r\n * @param replace Specifies whether the existing entry for the document is replaced in the history list.\r\n */\r\n open(url?: string, name?: string, features?: string, replace?: boolean): Document;\r\n /** \r\n * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document.\r\n * @param commandId Specifies a command identifier.\r\n */\r\n queryCommandEnabled(commandId: string): boolean;\r\n /**\r\n * Returns a Boolean value that indicates whether the specified command is in the indeterminate state.\r\n * @param commandId String that specifies a command identifier.\r\n */\r\n queryCommandIndeterm(commandId: string): boolean;\r\n /**\r\n * Returns a Boolean value that indicates the current state of the command.\r\n * @param commandId String that specifies a command identifier.\r\n */\r\n queryCommandState(commandId: string): boolean;\r\n /**\r\n * Returns a Boolean value that indicates whether the current command is supported on the current range.\r\n * @param commandId Specifies a command identifier.\r\n */\r\n queryCommandSupported(commandId: string): boolean;\r\n /**\r\n * Retrieves the string associated with a command.\r\n * @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers. \r\n */\r\n queryCommandText(commandId: string): string;\r\n /**\r\n * Returns the current value of the document, range, or current selection for the given command.\r\n * @param commandId String that specifies a command identifier.\r\n */\r\n queryCommandValue(commandId: string): string;\r\n releaseEvents(): void;\r\n /**\r\n * Allows updating the print settings for the page.\r\n */\r\n updateSettings(): void;\r\n webkitCancelFullScreen(): void;\r\n webkitExitFullscreen(): void;\r\n /**\r\n * Writes one or more HTML expressions to a document in the specified window. \r\n * @param content Specifies the text and HTML tags to write.\r\n */\r\n write(...content: string[]): void;\r\n /**\r\n * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. \r\n * @param content The text and HTML tags to write.\r\n */\r\n writeln(...content: string[]): void;\r\n addEventListener(type: \"MSContentZoom\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureChange\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureDoubleTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureEnd\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureHold\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSInertiaStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSManipulationStateChanged\", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerCancel\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerDown\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerEnter\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerLeave\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerMove\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOut\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOver\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerUp\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"abort\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"activate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforedeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"blur\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplay\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplaythrough\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"change\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"click\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"contextmenu\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dblclick\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"deactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drag\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragend\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragenter\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragleave\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragover\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragstart\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drop\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"durationchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"emptied\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ended\", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"focus\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"fullscreenchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"fullscreenerror\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"input\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"invalid\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keydown\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keypress\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keyup\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadeddata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadedmetadata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousedown\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousemove\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseout\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseover\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseup\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousewheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mssitemodejumplistitemremoved\", listener: (this: this, ev: MSSiteModeEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"msthumbnailclick\", listener: (this: this, ev: MSSiteModeEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pause\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"play\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"playing\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointercancel\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerdown\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerenter\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerleave\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerlockchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerlockerror\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointermove\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerout\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerover\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerup\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"progress\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ratechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"readystatechange\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"reset\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"scroll\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeked\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeking\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"select\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"selectionchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"selectstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"stalled\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"stop\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"submit\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"suspend\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"timeupdate\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchcancel\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchend\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchmove\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchstart\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"volumechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"waiting\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenerror\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"wheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var Document: {\r\n prototype: Document;\r\n new(): Document;\r\n}\r\n\r\ninterface DocumentFragment extends Node, NodeSelector, ParentNode {\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var DocumentFragment: {\r\n prototype: DocumentFragment;\r\n new(): DocumentFragment;\r\n}\r\n\r\ninterface DocumentType extends Node, ChildNode {\r\n readonly entities: NamedNodeMap;\r\n readonly internalSubset: string | null;\r\n readonly name: string;\r\n readonly notations: NamedNodeMap;\r\n readonly publicId: string | null;\r\n readonly systemId: string | null;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var DocumentType: {\r\n prototype: DocumentType;\r\n new(): DocumentType;\r\n}\r\n\r\ninterface DragEvent extends MouseEvent {\r\n readonly dataTransfer: DataTransfer;\r\n initDragEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, dataTransferArg: DataTransfer): void;\r\n msConvertURL(file: File, targetType: string, targetURL?: string): void;\r\n}\r\n\r\ndeclare var DragEvent: {\r\n prototype: DragEvent;\r\n new(): DragEvent;\r\n}\r\n\r\ninterface DynamicsCompressorNode extends AudioNode {\r\n readonly attack: AudioParam;\r\n readonly knee: AudioParam;\r\n readonly ratio: AudioParam;\r\n readonly reduction: AudioParam;\r\n readonly release: AudioParam;\r\n readonly threshold: AudioParam;\r\n}\r\n\r\ndeclare var DynamicsCompressorNode: {\r\n prototype: DynamicsCompressorNode;\r\n new(): DynamicsCompressorNode;\r\n}\r\n\r\ninterface EXT_frag_depth {\r\n}\r\n\r\ndeclare var EXT_frag_depth: {\r\n prototype: EXT_frag_depth;\r\n new(): EXT_frag_depth;\r\n}\r\n\r\ninterface EXT_texture_filter_anisotropic {\r\n readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number;\r\n readonly TEXTURE_MAX_ANISOTROPY_EXT: number;\r\n}\r\n\r\ndeclare var EXT_texture_filter_anisotropic: {\r\n prototype: EXT_texture_filter_anisotropic;\r\n new(): EXT_texture_filter_anisotropic;\r\n readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number;\r\n readonly TEXTURE_MAX_ANISOTROPY_EXT: number;\r\n}\r\n\r\ninterface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode, ParentNode {\r\n readonly classList: DOMTokenList;\r\n className: string;\r\n readonly clientHeight: number;\r\n readonly clientLeft: number;\r\n readonly clientTop: number;\r\n readonly clientWidth: number;\r\n id: string;\r\n msContentZoomFactor: number;\r\n readonly msRegionOverflow: string;\r\n onariarequest: (this: this, ev: AriaRequestEvent) => any;\r\n oncommand: (this: this, ev: CommandEvent) => any;\r\n ongotpointercapture: (this: this, ev: PointerEvent) => any;\r\n onlostpointercapture: (this: this, ev: PointerEvent) => any;\r\n onmsgesturechange: (this: this, ev: MSGestureEvent) => any;\r\n onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any;\r\n onmsgestureend: (this: this, ev: MSGestureEvent) => any;\r\n onmsgesturehold: (this: this, ev: MSGestureEvent) => any;\r\n onmsgesturestart: (this: this, ev: MSGestureEvent) => any;\r\n onmsgesturetap: (this: this, ev: MSGestureEvent) => any;\r\n onmsgotpointercapture: (this: this, ev: MSPointerEvent) => any;\r\n onmsinertiastart: (this: this, ev: MSGestureEvent) => any;\r\n onmslostpointercapture: (this: this, ev: MSPointerEvent) => any;\r\n onmspointercancel: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerdown: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerenter: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerleave: (this: this, ev: MSPointerEvent) => any;\r\n onmspointermove: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerout: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerover: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerup: (this: this, ev: MSPointerEvent) => any;\r\n ontouchcancel: (ev: TouchEvent) => any;\r\n ontouchend: (ev: TouchEvent) => any;\r\n ontouchmove: (ev: TouchEvent) => any;\r\n ontouchstart: (ev: TouchEvent) => any;\r\n onwebkitfullscreenchange: (this: this, ev: Event) => any;\r\n onwebkitfullscreenerror: (this: this, ev: Event) => any;\r\n readonly prefix: string | null;\r\n readonly scrollHeight: number;\r\n scrollLeft: number;\r\n scrollTop: number;\r\n readonly scrollWidth: number;\r\n readonly tagName: string;\r\n innerHTML: string;\r\n getAttribute(name: string): string | null;\r\n getAttributeNS(namespaceURI: string, localName: string): string;\r\n getAttributeNode(name: string): Attr;\r\n getAttributeNodeNS(namespaceURI: string, localName: string): Attr;\r\n getBoundingClientRect(): ClientRect;\r\n getClientRects(): ClientRectList;\r\n getElementsByTagName(name: \"a\"): NodeListOf;\r\n getElementsByTagName(name: \"abbr\"): NodeListOf;\r\n getElementsByTagName(name: \"acronym\"): NodeListOf;\r\n getElementsByTagName(name: \"address\"): NodeListOf;\r\n getElementsByTagName(name: \"applet\"): NodeListOf;\r\n getElementsByTagName(name: \"area\"): NodeListOf;\r\n getElementsByTagName(name: \"article\"): NodeListOf;\r\n getElementsByTagName(name: \"aside\"): NodeListOf;\r\n getElementsByTagName(name: \"audio\"): NodeListOf;\r\n getElementsByTagName(name: \"b\"): NodeListOf;\r\n getElementsByTagName(name: \"base\"): NodeListOf;\r\n getElementsByTagName(name: \"basefont\"): NodeListOf;\r\n getElementsByTagName(name: \"bdo\"): NodeListOf;\r\n getElementsByTagName(name: \"big\"): NodeListOf;\r\n getElementsByTagName(name: \"blockquote\"): NodeListOf;\r\n getElementsByTagName(name: \"body\"): NodeListOf;\r\n getElementsByTagName(name: \"br\"): NodeListOf;\r\n getElementsByTagName(name: \"button\"): NodeListOf;\r\n getElementsByTagName(name: \"canvas\"): NodeListOf;\r\n getElementsByTagName(name: \"caption\"): NodeListOf;\r\n getElementsByTagName(name: \"center\"): NodeListOf;\r\n getElementsByTagName(name: \"circle\"): NodeListOf;\r\n getElementsByTagName(name: \"cite\"): NodeListOf;\r\n getElementsByTagName(name: \"clippath\"): NodeListOf;\r\n getElementsByTagName(name: \"code\"): NodeListOf;\r\n getElementsByTagName(name: \"col\"): NodeListOf;\r\n getElementsByTagName(name: \"colgroup\"): NodeListOf;\r\n getElementsByTagName(name: \"datalist\"): NodeListOf;\r\n getElementsByTagName(name: \"dd\"): NodeListOf;\r\n getElementsByTagName(name: \"defs\"): NodeListOf;\r\n getElementsByTagName(name: \"del\"): NodeListOf;\r\n getElementsByTagName(name: \"desc\"): NodeListOf;\r\n getElementsByTagName(name: \"dfn\"): NodeListOf;\r\n getElementsByTagName(name: \"dir\"): NodeListOf;\r\n getElementsByTagName(name: \"div\"): NodeListOf;\r\n getElementsByTagName(name: \"dl\"): NodeListOf;\r\n getElementsByTagName(name: \"dt\"): NodeListOf;\r\n getElementsByTagName(name: \"ellipse\"): NodeListOf;\r\n getElementsByTagName(name: \"em\"): NodeListOf;\r\n getElementsByTagName(name: \"embed\"): NodeListOf;\r\n getElementsByTagName(name: \"feblend\"): NodeListOf;\r\n getElementsByTagName(name: \"fecolormatrix\"): NodeListOf;\r\n getElementsByTagName(name: \"fecomponenttransfer\"): NodeListOf;\r\n getElementsByTagName(name: \"fecomposite\"): NodeListOf;\r\n getElementsByTagName(name: \"feconvolvematrix\"): NodeListOf;\r\n getElementsByTagName(name: \"fediffuselighting\"): NodeListOf;\r\n getElementsByTagName(name: \"fedisplacementmap\"): NodeListOf;\r\n getElementsByTagName(name: \"fedistantlight\"): NodeListOf;\r\n getElementsByTagName(name: \"feflood\"): NodeListOf;\r\n getElementsByTagName(name: \"fefunca\"): NodeListOf;\r\n getElementsByTagName(name: \"fefuncb\"): NodeListOf;\r\n getElementsByTagName(name: \"fefuncg\"): NodeListOf;\r\n getElementsByTagName(name: \"fefuncr\"): NodeListOf;\r\n getElementsByTagName(name: \"fegaussianblur\"): NodeListOf;\r\n getElementsByTagName(name: \"feimage\"): NodeListOf;\r\n getElementsByTagName(name: \"femerge\"): NodeListOf;\r\n getElementsByTagName(name: \"femergenode\"): NodeListOf;\r\n getElementsByTagName(name: \"femorphology\"): NodeListOf;\r\n getElementsByTagName(name: \"feoffset\"): NodeListOf;\r\n getElementsByTagName(name: \"fepointlight\"): NodeListOf;\r\n getElementsByTagName(name: \"fespecularlighting\"): NodeListOf;\r\n getElementsByTagName(name: \"fespotlight\"): NodeListOf;\r\n getElementsByTagName(name: \"fetile\"): NodeListOf;\r\n getElementsByTagName(name: \"feturbulence\"): NodeListOf;\r\n getElementsByTagName(name: \"fieldset\"): NodeListOf;\r\n getElementsByTagName(name: \"figcaption\"): NodeListOf;\r\n getElementsByTagName(name: \"figure\"): NodeListOf;\r\n getElementsByTagName(name: \"filter\"): NodeListOf;\r\n getElementsByTagName(name: \"font\"): NodeListOf;\r\n getElementsByTagName(name: \"footer\"): NodeListOf;\r\n getElementsByTagName(name: \"foreignobject\"): NodeListOf;\r\n getElementsByTagName(name: \"form\"): NodeListOf;\r\n getElementsByTagName(name: \"frame\"): NodeListOf;\r\n getElementsByTagName(name: \"frameset\"): NodeListOf;\r\n getElementsByTagName(name: \"g\"): NodeListOf;\r\n getElementsByTagName(name: \"h1\"): NodeListOf;\r\n getElementsByTagName(name: \"h2\"): NodeListOf;\r\n getElementsByTagName(name: \"h3\"): NodeListOf;\r\n getElementsByTagName(name: \"h4\"): NodeListOf;\r\n getElementsByTagName(name: \"h5\"): NodeListOf;\r\n getElementsByTagName(name: \"h6\"): NodeListOf;\r\n getElementsByTagName(name: \"head\"): NodeListOf;\r\n getElementsByTagName(name: \"header\"): NodeListOf;\r\n getElementsByTagName(name: \"hgroup\"): NodeListOf;\r\n getElementsByTagName(name: \"hr\"): NodeListOf;\r\n getElementsByTagName(name: \"html\"): NodeListOf;\r\n getElementsByTagName(name: \"i\"): NodeListOf;\r\n getElementsByTagName(name: \"iframe\"): NodeListOf;\r\n getElementsByTagName(name: \"image\"): NodeListOf;\r\n getElementsByTagName(name: \"img\"): NodeListOf;\r\n getElementsByTagName(name: \"input\"): NodeListOf;\r\n getElementsByTagName(name: \"ins\"): NodeListOf;\r\n getElementsByTagName(name: \"isindex\"): NodeListOf;\r\n getElementsByTagName(name: \"kbd\"): NodeListOf;\r\n getElementsByTagName(name: \"keygen\"): NodeListOf;\r\n getElementsByTagName(name: \"label\"): NodeListOf;\r\n getElementsByTagName(name: \"legend\"): NodeListOf;\r\n getElementsByTagName(name: \"li\"): NodeListOf;\r\n getElementsByTagName(name: \"line\"): NodeListOf;\r\n getElementsByTagName(name: \"lineargradient\"): NodeListOf;\r\n getElementsByTagName(name: \"link\"): NodeListOf;\r\n getElementsByTagName(name: \"listing\"): NodeListOf;\r\n getElementsByTagName(name: \"map\"): NodeListOf;\r\n getElementsByTagName(name: \"mark\"): NodeListOf;\r\n getElementsByTagName(name: \"marker\"): NodeListOf;\r\n getElementsByTagName(name: \"marquee\"): NodeListOf;\r\n getElementsByTagName(name: \"mask\"): NodeListOf;\r\n getElementsByTagName(name: \"menu\"): NodeListOf;\r\n getElementsByTagName(name: \"meta\"): NodeListOf;\r\n getElementsByTagName(name: \"metadata\"): NodeListOf;\r\n getElementsByTagName(name: \"meter\"): NodeListOf;\r\n getElementsByTagName(name: \"nav\"): NodeListOf;\r\n getElementsByTagName(name: \"nextid\"): NodeListOf;\r\n getElementsByTagName(name: \"nobr\"): NodeListOf;\r\n getElementsByTagName(name: \"noframes\"): NodeListOf;\r\n getElementsByTagName(name: \"noscript\"): NodeListOf;\r\n getElementsByTagName(name: \"object\"): NodeListOf;\r\n getElementsByTagName(name: \"ol\"): NodeListOf;\r\n getElementsByTagName(name: \"optgroup\"): NodeListOf;\r\n getElementsByTagName(name: \"option\"): NodeListOf;\r\n getElementsByTagName(name: \"p\"): NodeListOf;\r\n getElementsByTagName(name: \"param\"): NodeListOf;\r\n getElementsByTagName(name: \"path\"): NodeListOf;\r\n getElementsByTagName(name: \"pattern\"): NodeListOf;\r\n getElementsByTagName(name: \"picture\"): NodeListOf;\r\n getElementsByTagName(name: \"plaintext\"): NodeListOf;\r\n getElementsByTagName(name: \"polygon\"): NodeListOf;\r\n getElementsByTagName(name: \"polyline\"): NodeListOf;\r\n getElementsByTagName(name: \"pre\"): NodeListOf;\r\n getElementsByTagName(name: \"progress\"): NodeListOf;\r\n getElementsByTagName(name: \"q\"): NodeListOf;\r\n getElementsByTagName(name: \"radialgradient\"): NodeListOf;\r\n getElementsByTagName(name: \"rect\"): NodeListOf;\r\n getElementsByTagName(name: \"rt\"): NodeListOf;\r\n getElementsByTagName(name: \"ruby\"): NodeListOf;\r\n getElementsByTagName(name: \"s\"): NodeListOf;\r\n getElementsByTagName(name: \"samp\"): NodeListOf;\r\n getElementsByTagName(name: \"script\"): NodeListOf;\r\n getElementsByTagName(name: \"section\"): NodeListOf;\r\n getElementsByTagName(name: \"select\"): NodeListOf;\r\n getElementsByTagName(name: \"small\"): NodeListOf;\r\n getElementsByTagName(name: \"source\"): NodeListOf;\r\n getElementsByTagName(name: \"span\"): NodeListOf;\r\n getElementsByTagName(name: \"stop\"): NodeListOf;\r\n getElementsByTagName(name: \"strike\"): NodeListOf;\r\n getElementsByTagName(name: \"strong\"): NodeListOf;\r\n getElementsByTagName(name: \"style\"): NodeListOf;\r\n getElementsByTagName(name: \"sub\"): NodeListOf;\r\n getElementsByTagName(name: \"sup\"): NodeListOf;\r\n getElementsByTagName(name: \"svg\"): NodeListOf;\r\n getElementsByTagName(name: \"switch\"): NodeListOf;\r\n getElementsByTagName(name: \"symbol\"): NodeListOf;\r\n getElementsByTagName(name: \"table\"): NodeListOf;\r\n getElementsByTagName(name: \"tbody\"): NodeListOf;\r\n getElementsByTagName(name: \"td\"): NodeListOf;\r\n getElementsByTagName(name: \"template\"): NodeListOf;\r\n getElementsByTagName(name: \"text\"): NodeListOf;\r\n getElementsByTagName(name: \"textpath\"): NodeListOf;\r\n getElementsByTagName(name: \"textarea\"): NodeListOf;\r\n getElementsByTagName(name: \"tfoot\"): NodeListOf;\r\n getElementsByTagName(name: \"th\"): NodeListOf;\r\n getElementsByTagName(name: \"thead\"): NodeListOf;\r\n getElementsByTagName(name: \"title\"): NodeListOf;\r\n getElementsByTagName(name: \"tr\"): NodeListOf;\r\n getElementsByTagName(name: \"track\"): NodeListOf;\r\n getElementsByTagName(name: \"tspan\"): NodeListOf;\r\n getElementsByTagName(name: \"tt\"): NodeListOf;\r\n getElementsByTagName(name: \"u\"): NodeListOf;\r\n getElementsByTagName(name: \"ul\"): NodeListOf;\r\n getElementsByTagName(name: \"use\"): NodeListOf;\r\n getElementsByTagName(name: \"var\"): NodeListOf;\r\n getElementsByTagName(name: \"video\"): NodeListOf;\r\n getElementsByTagName(name: \"view\"): NodeListOf;\r\n getElementsByTagName(name: \"wbr\"): NodeListOf;\r\n getElementsByTagName(name: \"x-ms-webview\"): NodeListOf;\r\n getElementsByTagName(name: \"xmp\"): NodeListOf;\r\n getElementsByTagName(name: string): NodeListOf;\r\n getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/1999/xhtml\", localName: string): HTMLCollectionOf;\r\n getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/2000/svg\", localName: string): HTMLCollectionOf;\r\n getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf;\r\n hasAttribute(name: string): boolean;\r\n hasAttributeNS(namespaceURI: string, localName: string): boolean;\r\n msGetRegionContent(): MSRangeCollection;\r\n msGetUntransformedBounds(): ClientRect;\r\n msMatchesSelector(selectors: string): boolean;\r\n msReleasePointerCapture(pointerId: number): void;\r\n msSetPointerCapture(pointerId: number): void;\r\n msZoomTo(args: MsZoomToOptions): void;\r\n releasePointerCapture(pointerId: number): void;\r\n removeAttribute(name?: string): void;\r\n removeAttributeNS(namespaceURI: string, localName: string): void;\r\n removeAttributeNode(oldAttr: Attr): Attr;\r\n requestFullscreen(): void;\r\n requestPointerLock(): void;\r\n setAttribute(name: string, value: string): void;\r\n setAttributeNS(namespaceURI: string, qualifiedName: string, value: string): void;\r\n setAttributeNode(newAttr: Attr): Attr;\r\n setAttributeNodeNS(newAttr: Attr): Attr;\r\n setPointerCapture(pointerId: number): void;\r\n webkitMatchesSelector(selectors: string): boolean;\r\n webkitRequestFullScreen(): void;\r\n webkitRequestFullscreen(): void;\r\n getElementsByClassName(classNames: string): NodeListOf;\r\n matches(selector: string): boolean;\r\n closest(selector: string): Element | null;\r\n scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;\r\n scroll(options?: ScrollToOptions): void;\r\n scroll(x: number, y: number): void;\r\n scrollTo(options?: ScrollToOptions): void;\r\n scrollTo(x: number, y: number): void;\r\n scrollBy(options?: ScrollToOptions): void;\r\n scrollBy(x: number, y: number): void;\r\n insertAdjacentElement(position: string, insertedElement: Element): Element | null;\r\n insertAdjacentHTML(where: string, html: string): void;\r\n insertAdjacentText(where: string, text: string): void;\r\n addEventListener(type: \"MSGestureChange\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureDoubleTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureEnd\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureHold\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGotPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSInertiaStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSLostPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerCancel\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerDown\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerEnter\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerLeave\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerMove\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOut\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOver\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerUp\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ariarequest\", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"command\", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"gotpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"lostpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointercancel\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerdown\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerenter\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerleave\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointermove\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerout\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerover\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerup\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchcancel\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchend\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchmove\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchstart\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenerror\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"wheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var Element: {\r\n prototype: Element;\r\n new(): Element;\r\n}\r\n\r\ninterface ErrorEvent extends Event {\r\n readonly colno: number;\r\n readonly error: any;\r\n readonly filename: string;\r\n readonly lineno: number;\r\n readonly message: string;\r\n initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void;\r\n}\r\n\r\ndeclare var ErrorEvent: {\r\n prototype: ErrorEvent;\r\n new(): ErrorEvent;\r\n}\r\n\r\ninterface Event {\r\n readonly bubbles: boolean;\r\n cancelBubble: boolean;\r\n readonly cancelable: boolean;\r\n readonly currentTarget: EventTarget;\r\n readonly defaultPrevented: boolean;\r\n readonly eventPhase: number;\r\n readonly isTrusted: boolean;\r\n returnValue: boolean;\r\n readonly srcElement: Element | null;\r\n readonly target: EventTarget;\r\n readonly timeStamp: number;\r\n readonly type: string;\r\n initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void;\r\n preventDefault(): void;\r\n stopImmediatePropagation(): void;\r\n stopPropagation(): void;\r\n readonly AT_TARGET: number;\r\n readonly BUBBLING_PHASE: number;\r\n readonly CAPTURING_PHASE: number;\r\n}\r\n\r\ndeclare var Event: {\r\n prototype: Event;\r\n new(type: string, eventInitDict?: EventInit): Event;\r\n readonly AT_TARGET: number;\r\n readonly BUBBLING_PHASE: number;\r\n readonly CAPTURING_PHASE: number;\r\n}\r\n\r\ninterface EventTarget {\r\n addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n dispatchEvent(evt: Event): boolean;\r\n removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var EventTarget: {\r\n prototype: EventTarget;\r\n new(): EventTarget;\r\n}\r\n\r\ninterface External {\r\n}\r\n\r\ndeclare var External: {\r\n prototype: External;\r\n new(): External;\r\n}\r\n\r\ninterface File extends Blob {\r\n readonly lastModifiedDate: any;\r\n readonly name: string;\r\n readonly webkitRelativePath: string;\r\n}\r\n\r\ndeclare var File: {\r\n prototype: File;\r\n new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File;\r\n}\r\n\r\ninterface FileList {\r\n readonly length: number;\r\n item(index: number): File;\r\n [index: number]: File;\r\n}\r\n\r\ndeclare var FileList: {\r\n prototype: FileList;\r\n new(): FileList;\r\n}\r\n\r\ninterface FileReader extends EventTarget, MSBaseReader {\r\n readonly error: DOMError;\r\n readAsArrayBuffer(blob: Blob): void;\r\n readAsBinaryString(blob: Blob): void;\r\n readAsDataURL(blob: Blob): void;\r\n readAsText(blob: Blob, encoding?: string): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var FileReader: {\r\n prototype: FileReader;\r\n new(): FileReader;\r\n}\r\n\r\ninterface FocusEvent extends UIEvent {\r\n readonly relatedTarget: EventTarget;\r\n initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void;\r\n}\r\n\r\ndeclare var FocusEvent: {\r\n prototype: FocusEvent;\r\n new(typeArg: string, eventInitDict?: FocusEventInit): FocusEvent;\r\n}\r\n\r\ninterface FormData {\r\n append(name: any, value: any, blobName?: string): void;\r\n}\r\n\r\ndeclare var FormData: {\r\n prototype: FormData;\r\n new (form?: HTMLFormElement): FormData;\r\n}\r\n\r\ninterface GainNode extends AudioNode {\r\n readonly gain: AudioParam;\r\n}\r\n\r\ndeclare var GainNode: {\r\n prototype: GainNode;\r\n new(): GainNode;\r\n}\r\n\r\ninterface Gamepad {\r\n readonly axes: number[];\r\n readonly buttons: GamepadButton[];\r\n readonly connected: boolean;\r\n readonly id: string;\r\n readonly index: number;\r\n readonly mapping: string;\r\n readonly timestamp: number;\r\n}\r\n\r\ndeclare var Gamepad: {\r\n prototype: Gamepad;\r\n new(): Gamepad;\r\n}\r\n\r\ninterface GamepadButton {\r\n readonly pressed: boolean;\r\n readonly value: number;\r\n}\r\n\r\ndeclare var GamepadButton: {\r\n prototype: GamepadButton;\r\n new(): GamepadButton;\r\n}\r\n\r\ninterface GamepadEvent extends Event {\r\n readonly gamepad: Gamepad;\r\n}\r\n\r\ndeclare var GamepadEvent: {\r\n prototype: GamepadEvent;\r\n new(): GamepadEvent;\r\n}\r\n\r\ninterface Geolocation {\r\n clearWatch(watchId: number): void;\r\n getCurrentPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): void;\r\n watchPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): number;\r\n}\r\n\r\ndeclare var Geolocation: {\r\n prototype: Geolocation;\r\n new(): Geolocation;\r\n}\r\n\r\ninterface HTMLAllCollection extends HTMLCollection {\r\n namedItem(name: string): Element;\r\n}\r\n\r\ndeclare var HTMLAllCollection: {\r\n prototype: HTMLAllCollection;\r\n new(): HTMLAllCollection;\r\n}\r\n\r\ninterface HTMLAnchorElement extends HTMLElement {\r\n Methods: string;\r\n /**\r\n * Sets or retrieves the character set used to encode the object.\r\n */\r\n charset: string;\r\n /**\r\n * Sets or retrieves the coordinates of the object.\r\n */\r\n coords: string;\r\n download: string;\r\n /**\r\n * Contains the anchor portion of the URL including the hash sign (#).\r\n */\r\n hash: string;\r\n /**\r\n * Contains the hostname and port values of the URL.\r\n */\r\n host: string;\r\n /**\r\n * Contains the hostname of a URL.\r\n */\r\n hostname: string;\r\n /**\r\n * Sets or retrieves a destination URL or an anchor point.\r\n */\r\n href: string;\r\n /**\r\n * Sets or retrieves the language code of the object.\r\n */\r\n hreflang: string;\r\n readonly mimeType: string;\r\n /**\r\n * Sets or retrieves the shape of the object.\r\n */\r\n name: string;\r\n readonly nameProp: string;\r\n /**\r\n * Contains the pathname of the URL.\r\n */\r\n pathname: string;\r\n /**\r\n * Sets or retrieves the port number associated with a URL.\r\n */\r\n port: string;\r\n /**\r\n * Contains the protocol of the URL.\r\n */\r\n protocol: string;\r\n readonly protocolLong: string;\r\n /**\r\n * Sets or retrieves the relationship between the object and the destination of the link.\r\n */\r\n rel: string;\r\n /**\r\n * Sets or retrieves the relationship between the object and the destination of the link.\r\n */\r\n rev: string;\r\n /**\r\n * Sets or retrieves the substring of the href property that follows the question mark.\r\n */\r\n search: string;\r\n /**\r\n * Sets or retrieves the shape of the object.\r\n */\r\n shape: string;\r\n /**\r\n * Sets or retrieves the window or frame at which to target content.\r\n */\r\n target: string;\r\n /**\r\n * Retrieves or sets the text of the object as a string. \r\n */\r\n text: string;\r\n type: string;\r\n urn: string;\r\n /** \r\n * Returns a string representation of an object.\r\n */\r\n toString(): string;\r\n}\r\n\r\ndeclare var HTMLAnchorElement: {\r\n prototype: HTMLAnchorElement;\r\n new(): HTMLAnchorElement;\r\n}\r\n\r\ninterface HTMLAppletElement extends HTMLElement {\r\n /**\r\n * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element.\r\n */\r\n readonly BaseHref: string;\r\n align: string;\r\n /**\r\n * Sets or retrieves a text alternative to the graphic.\r\n */\r\n alt: string;\r\n /**\r\n * Gets or sets the optional alternative HTML script to execute if the object fails to load.\r\n */\r\n altHtml: string;\r\n /**\r\n * Sets or retrieves a character string that can be used to implement your own archive functionality for the object.\r\n */\r\n archive: string;\r\n border: string;\r\n code: string;\r\n /**\r\n * Sets or retrieves the URL of the component.\r\n */\r\n codeBase: string;\r\n /**\r\n * Sets or retrieves the Internet media type for the code associated with the object.\r\n */\r\n codeType: string;\r\n /**\r\n * Address of a pointer to the document this page or frame contains. If there is no document, then null will be returned.\r\n */\r\n readonly contentDocument: Document;\r\n /**\r\n * Sets or retrieves the URL that references the data of the object.\r\n */\r\n data: string;\r\n /**\r\n * Sets or retrieves a character string that can be used to implement your own declare functionality for the object.\r\n */\r\n declare: boolean;\r\n readonly form: HTMLFormElement;\r\n /**\r\n * Sets or retrieves the height of the object.\r\n */\r\n height: string;\r\n hspace: number;\r\n /**\r\n * Sets or retrieves the shape of the object.\r\n */\r\n name: string;\r\n object: string | null;\r\n /**\r\n * Sets or retrieves a message to be displayed while an object is loading.\r\n */\r\n standby: string;\r\n /**\r\n * Returns the content type of the object.\r\n */\r\n type: string;\r\n /**\r\n * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map.\r\n */\r\n useMap: string;\r\n vspace: number;\r\n width: number;\r\n}\r\n\r\ndeclare var HTMLAppletElement: {\r\n prototype: HTMLAppletElement;\r\n new(): HTMLAppletElement;\r\n}\r\n\r\ninterface HTMLAreaElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves a text alternative to the graphic.\r\n */\r\n alt: string;\r\n /**\r\n * Sets or retrieves the coordinates of the object.\r\n */\r\n coords: string;\r\n download: string;\r\n /**\r\n * Sets or retrieves the subsection of the href property that follows the number sign (#).\r\n */\r\n hash: string;\r\n /**\r\n * Sets or retrieves the hostname and port number of the location or URL.\r\n */\r\n host: string;\r\n /**\r\n * Sets or retrieves the host name part of the location or URL. \r\n */\r\n hostname: string;\r\n /**\r\n * Sets or retrieves a destination URL or an anchor point.\r\n */\r\n href: string;\r\n /**\r\n * Sets or gets whether clicks in this region cause action.\r\n */\r\n noHref: boolean;\r\n /**\r\n * Sets or retrieves the file name or path specified by the object.\r\n */\r\n pathname: string;\r\n /**\r\n * Sets or retrieves the port number associated with a URL.\r\n */\r\n port: string;\r\n /**\r\n * Sets or retrieves the protocol portion of a URL.\r\n */\r\n protocol: string;\r\n rel: string;\r\n /**\r\n * Sets or retrieves the substring of the href property that follows the question mark.\r\n */\r\n search: string;\r\n /**\r\n * Sets or retrieves the shape of the object.\r\n */\r\n shape: string;\r\n /**\r\n * Sets or retrieves the window or frame at which to target content.\r\n */\r\n target: string;\r\n /** \r\n * Returns a string representation of an object.\r\n */\r\n toString(): string;\r\n}\r\n\r\ndeclare var HTMLAreaElement: {\r\n prototype: HTMLAreaElement;\r\n new(): HTMLAreaElement;\r\n}\r\n\r\ninterface HTMLAreasCollection extends HTMLCollection {\r\n /**\r\n * Adds an element to the areas, controlRange, or options collection.\r\n */\r\n add(element: HTMLElement, before?: HTMLElement | number): void;\r\n /**\r\n * Removes an element from the collection.\r\n */\r\n remove(index?: number): void;\r\n}\r\n\r\ndeclare var HTMLAreasCollection: {\r\n prototype: HTMLAreasCollection;\r\n new(): HTMLAreasCollection;\r\n}\r\n\r\ninterface HTMLAudioElement extends HTMLMediaElement {\r\n}\r\n\r\ndeclare var HTMLAudioElement: {\r\n prototype: HTMLAudioElement;\r\n new(): HTMLAudioElement;\r\n}\r\n\r\ninterface HTMLBRElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document.\r\n */\r\n clear: string;\r\n}\r\n\r\ndeclare var HTMLBRElement: {\r\n prototype: HTMLBRElement;\r\n new(): HTMLBRElement;\r\n}\r\n\r\ninterface HTMLBaseElement extends HTMLElement {\r\n /**\r\n * Gets or sets the baseline URL on which relative links are based.\r\n */\r\n href: string;\r\n /**\r\n * Sets or retrieves the window or frame at which to target content.\r\n */\r\n target: string;\r\n}\r\n\r\ndeclare var HTMLBaseElement: {\r\n prototype: HTMLBaseElement;\r\n new(): HTMLBaseElement;\r\n}\r\n\r\ninterface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedColorProperty {\r\n /**\r\n * Sets or retrieves the current typeface family.\r\n */\r\n face: string;\r\n /**\r\n * Sets or retrieves the font size of the object.\r\n */\r\n size: number;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLBaseFontElement: {\r\n prototype: HTMLBaseFontElement;\r\n new(): HTMLBaseFontElement;\r\n}\r\n\r\ninterface HTMLBodyElement extends HTMLElement {\r\n aLink: any;\r\n background: string;\r\n bgColor: any;\r\n bgProperties: string;\r\n link: any;\r\n noWrap: boolean;\r\n onafterprint: (this: this, ev: Event) => any;\r\n onbeforeprint: (this: this, ev: Event) => any;\r\n onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any;\r\n onblur: (this: this, ev: FocusEvent) => any;\r\n onerror: (this: this, ev: ErrorEvent) => any;\r\n onfocus: (this: this, ev: FocusEvent) => any;\r\n onhashchange: (this: this, ev: HashChangeEvent) => any;\r\n onload: (this: this, ev: Event) => any;\r\n onmessage: (this: this, ev: MessageEvent) => any;\r\n onoffline: (this: this, ev: Event) => any;\r\n ononline: (this: this, ev: Event) => any;\r\n onorientationchange: (this: this, ev: Event) => any;\r\n onpagehide: (this: this, ev: PageTransitionEvent) => any;\r\n onpageshow: (this: this, ev: PageTransitionEvent) => any;\r\n onpopstate: (this: this, ev: PopStateEvent) => any;\r\n onresize: (this: this, ev: UIEvent) => any;\r\n onstorage: (this: this, ev: StorageEvent) => any;\r\n onunload: (this: this, ev: Event) => any;\r\n text: any;\r\n vLink: any;\r\n addEventListener(type: \"MSContentZoom\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureChange\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureDoubleTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureEnd\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureHold\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGotPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSInertiaStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSLostPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSManipulationStateChanged\", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerCancel\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerDown\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerEnter\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerLeave\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerMove\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOut\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOver\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerUp\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"abort\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"activate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"afterprint\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ariarequest\", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforecopy\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforecut\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforedeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforepaste\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforeprint\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforeunload\", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"blur\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"blur\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplay\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplaythrough\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"change\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"click\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"command\", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"contextmenu\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"copy\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"cuechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"cut\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dblclick\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"deactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drag\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragend\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragenter\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragleave\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragover\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragstart\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drop\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"durationchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"emptied\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ended\", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"focus\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"focus\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"gotpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"hashchange\", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"input\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"invalid\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keydown\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keypress\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keyup\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadeddata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadedmetadata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"lostpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"message\", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousedown\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseenter\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseleave\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousemove\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseout\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseover\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseup\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousewheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"offline\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"online\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"orientationchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pagehide\", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pageshow\", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"paste\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pause\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"play\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"playing\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointercancel\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerdown\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerenter\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerleave\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointermove\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerout\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerover\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerup\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"popstate\", listener: (this: this, ev: PopStateEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"progress\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ratechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"reset\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"resize\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"scroll\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeked\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeking\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"select\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"selectstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"stalled\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"storage\", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"submit\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"suspend\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"timeupdate\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchcancel\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchend\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchmove\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchstart\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"unload\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"volumechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"waiting\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenerror\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"wheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLBodyElement: {\r\n prototype: HTMLBodyElement;\r\n new(): HTMLBodyElement;\r\n}\r\n\r\ninterface HTMLButtonElement extends HTMLElement {\r\n /**\r\n * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing.\r\n */\r\n autofocus: boolean;\r\n disabled: boolean;\r\n /**\r\n * Retrieves a reference to the form that the object is embedded in.\r\n */\r\n readonly form: HTMLFormElement;\r\n /**\r\n * Overrides the action attribute (where the data on a form is sent) on the parent form element.\r\n */\r\n formAction: string;\r\n /**\r\n * Used to override the encoding (formEnctype attribute) specified on the form element.\r\n */\r\n formEnctype: string;\r\n /**\r\n * Overrides the submit method attribute previously specified on a form element.\r\n */\r\n formMethod: string;\r\n /**\r\n * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a \"save draft\"-type submit option.\r\n */\r\n formNoValidate: string;\r\n /**\r\n * Overrides the target attribute on a form element.\r\n */\r\n formTarget: string;\r\n /** \r\n * Sets or retrieves the name of the object.\r\n */\r\n name: string;\r\n status: any;\r\n /**\r\n * Gets the classification and default behavior of the button.\r\n */\r\n type: string;\r\n /**\r\n * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\r\n */\r\n readonly validationMessage: string;\r\n /**\r\n * Returns a ValidityState object that represents the validity states of an element.\r\n */\r\n readonly validity: ValidityState;\r\n /** \r\n * Sets or retrieves the default or selected value of the control.\r\n */\r\n value: string;\r\n /**\r\n * Returns whether an element will successfully validate based on forms validation rules and constraints.\r\n */\r\n readonly willValidate: boolean;\r\n /**\r\n * Returns whether a form will validate when it is submitted, without having to submit it.\r\n */\r\n checkValidity(): boolean;\r\n /**\r\n * Sets a custom error message that is displayed when a form is submitted.\r\n * @param error Sets a custom error message that is displayed when a form is submitted.\r\n */\r\n setCustomValidity(error: string): void;\r\n}\r\n\r\ndeclare var HTMLButtonElement: {\r\n prototype: HTMLButtonElement;\r\n new(): HTMLButtonElement;\r\n}\r\n\r\ninterface HTMLCanvasElement extends HTMLElement {\r\n /**\r\n * Gets or sets the height of a canvas element on a document.\r\n */\r\n height: number;\r\n /**\r\n * Gets or sets the width of a canvas element on a document.\r\n */\r\n width: number;\r\n /**\r\n * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas.\r\n * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext(\"2d\"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext(\"experimental-webgl\");\r\n */\r\n getContext(contextId: \"2d\", contextAttributes?: Canvas2DContextAttributes): CanvasRenderingContext2D | null;\r\n getContext(contextId: \"webgl\" | \"experimental-webgl\", contextAttributes?: WebGLContextAttributes): WebGLRenderingContext | null;\r\n getContext(contextId: string, contextAttributes?: {}): CanvasRenderingContext2D | WebGLRenderingContext | null;\r\n /**\r\n * Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing.\r\n */\r\n msToBlob(): Blob;\r\n /**\r\n * Returns the content of the current canvas as an image that you can use as a source for another canvas or an HTML element.\r\n * @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image.\r\n */\r\n toDataURL(type?: string, ...args: any[]): string;\r\n toBlob(callback: (result: Blob | null) => void, type?: string, ...arguments: any[]): void;\r\n}\r\n\r\ndeclare var HTMLCanvasElement: {\r\n prototype: HTMLCanvasElement;\r\n new(): HTMLCanvasElement;\r\n}\r\n\r\ninterface HTMLCollection {\r\n /**\r\n * Sets or retrieves the number of objects in a collection.\r\n */\r\n readonly length: number;\r\n /**\r\n * Retrieves an object from various collections.\r\n */\r\n item(index: number): Element;\r\n /**\r\n * Retrieves a select object or an object from an options collection.\r\n */\r\n namedItem(name: string): Element;\r\n [index: number]: Element;\r\n}\r\n\r\ndeclare var HTMLCollection: {\r\n prototype: HTMLCollection;\r\n new(): HTMLCollection;\r\n}\r\n\r\ninterface HTMLDListElement extends HTMLElement {\r\n compact: boolean;\r\n}\r\n\r\ndeclare var HTMLDListElement: {\r\n prototype: HTMLDListElement;\r\n new(): HTMLDListElement;\r\n}\r\n\r\ninterface HTMLDataListElement extends HTMLElement {\r\n options: HTMLCollectionOf;\r\n}\r\n\r\ndeclare var HTMLDataListElement: {\r\n prototype: HTMLDataListElement;\r\n new(): HTMLDataListElement;\r\n}\r\n\r\ninterface HTMLDirectoryElement extends HTMLElement {\r\n compact: boolean;\r\n}\r\n\r\ndeclare var HTMLDirectoryElement: {\r\n prototype: HTMLDirectoryElement;\r\n new(): HTMLDirectoryElement;\r\n}\r\n\r\ninterface HTMLDivElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves how the object is aligned with adjacent text. \r\n */\r\n align: string;\r\n /**\r\n * Sets or retrieves whether the browser automatically performs wordwrap.\r\n */\r\n noWrap: boolean;\r\n}\r\n\r\ndeclare var HTMLDivElement: {\r\n prototype: HTMLDivElement;\r\n new(): HTMLDivElement;\r\n}\r\n\r\ninterface HTMLDocument extends Document {\r\n}\r\n\r\ndeclare var HTMLDocument: {\r\n prototype: HTMLDocument;\r\n new(): HTMLDocument;\r\n}\r\n\r\ninterface HTMLElement extends Element {\r\n accessKey: string;\r\n readonly children: HTMLCollection;\r\n contentEditable: string;\r\n readonly dataset: DOMStringMap;\r\n dir: string;\r\n draggable: boolean;\r\n hidden: boolean;\r\n hideFocus: boolean;\r\n innerHTML: string;\r\n innerText: string;\r\n readonly isContentEditable: boolean;\r\n lang: string;\r\n readonly offsetHeight: number;\r\n readonly offsetLeft: number;\r\n readonly offsetParent: Element;\r\n readonly offsetTop: number;\r\n readonly offsetWidth: number;\r\n onabort: (this: this, ev: UIEvent) => any;\r\n onactivate: (this: this, ev: UIEvent) => any;\r\n onbeforeactivate: (this: this, ev: UIEvent) => any;\r\n onbeforecopy: (this: this, ev: ClipboardEvent) => any;\r\n onbeforecut: (this: this, ev: ClipboardEvent) => any;\r\n onbeforedeactivate: (this: this, ev: UIEvent) => any;\r\n onbeforepaste: (this: this, ev: ClipboardEvent) => any;\r\n onblur: (this: this, ev: FocusEvent) => any;\r\n oncanplay: (this: this, ev: Event) => any;\r\n oncanplaythrough: (this: this, ev: Event) => any;\r\n onchange: (this: this, ev: Event) => any;\r\n onclick: (this: this, ev: MouseEvent) => any;\r\n oncontextmenu: (this: this, ev: PointerEvent) => any;\r\n oncopy: (this: this, ev: ClipboardEvent) => any;\r\n oncuechange: (this: this, ev: Event) => any;\r\n oncut: (this: this, ev: ClipboardEvent) => any;\r\n ondblclick: (this: this, ev: MouseEvent) => any;\r\n ondeactivate: (this: this, ev: UIEvent) => any;\r\n ondrag: (this: this, ev: DragEvent) => any;\r\n ondragend: (this: this, ev: DragEvent) => any;\r\n ondragenter: (this: this, ev: DragEvent) => any;\r\n ondragleave: (this: this, ev: DragEvent) => any;\r\n ondragover: (this: this, ev: DragEvent) => any;\r\n ondragstart: (this: this, ev: DragEvent) => any;\r\n ondrop: (this: this, ev: DragEvent) => any;\r\n ondurationchange: (this: this, ev: Event) => any;\r\n onemptied: (this: this, ev: Event) => any;\r\n onended: (this: this, ev: MediaStreamErrorEvent) => any;\r\n onerror: (this: this, ev: ErrorEvent) => any;\r\n onfocus: (this: this, ev: FocusEvent) => any;\r\n oninput: (this: this, ev: Event) => any;\r\n oninvalid: (this: this, ev: Event) => any;\r\n onkeydown: (this: this, ev: KeyboardEvent) => any;\r\n onkeypress: (this: this, ev: KeyboardEvent) => any;\r\n onkeyup: (this: this, ev: KeyboardEvent) => any;\r\n onload: (this: this, ev: Event) => any;\r\n onloadeddata: (this: this, ev: Event) => any;\r\n onloadedmetadata: (this: this, ev: Event) => any;\r\n onloadstart: (this: this, ev: Event) => any;\r\n onmousedown: (this: this, ev: MouseEvent) => any;\r\n onmouseenter: (this: this, ev: MouseEvent) => any;\r\n onmouseleave: (this: this, ev: MouseEvent) => any;\r\n onmousemove: (this: this, ev: MouseEvent) => any;\r\n onmouseout: (this: this, ev: MouseEvent) => any;\r\n onmouseover: (this: this, ev: MouseEvent) => any;\r\n onmouseup: (this: this, ev: MouseEvent) => any;\r\n onmousewheel: (this: this, ev: WheelEvent) => any;\r\n onmscontentzoom: (this: this, ev: UIEvent) => any;\r\n onmsmanipulationstatechanged: (this: this, ev: MSManipulationEvent) => any;\r\n onpaste: (this: this, ev: ClipboardEvent) => any;\r\n onpause: (this: this, ev: Event) => any;\r\n onplay: (this: this, ev: Event) => any;\r\n onplaying: (this: this, ev: Event) => any;\r\n onprogress: (this: this, ev: ProgressEvent) => any;\r\n onratechange: (this: this, ev: Event) => any;\r\n onreset: (this: this, ev: Event) => any;\r\n onscroll: (this: this, ev: UIEvent) => any;\r\n onseeked: (this: this, ev: Event) => any;\r\n onseeking: (this: this, ev: Event) => any;\r\n onselect: (this: this, ev: UIEvent) => any;\r\n onselectstart: (this: this, ev: Event) => any;\r\n onstalled: (this: this, ev: Event) => any;\r\n onsubmit: (this: this, ev: Event) => any;\r\n onsuspend: (this: this, ev: Event) => any;\r\n ontimeupdate: (this: this, ev: Event) => any;\r\n onvolumechange: (this: this, ev: Event) => any;\r\n onwaiting: (this: this, ev: Event) => any;\r\n outerHTML: string;\r\n outerText: string;\r\n spellcheck: boolean;\r\n readonly style: CSSStyleDeclaration;\r\n tabIndex: number;\r\n title: string;\r\n blur(): void;\r\n click(): void;\r\n dragDrop(): boolean;\r\n focus(): void;\r\n msGetInputContext(): MSInputMethodContext;\r\n setActive(): void;\r\n addEventListener(type: \"MSContentZoom\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureChange\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureDoubleTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureEnd\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureHold\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGotPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSInertiaStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSLostPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSManipulationStateChanged\", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerCancel\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerDown\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerEnter\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerLeave\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerMove\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOut\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOver\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerUp\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"abort\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"activate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ariarequest\", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforecopy\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforecut\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforedeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforepaste\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"blur\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplay\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplaythrough\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"change\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"click\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"command\", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"contextmenu\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"copy\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"cuechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"cut\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dblclick\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"deactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drag\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragend\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragenter\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragleave\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragover\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragstart\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drop\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"durationchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"emptied\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ended\", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"focus\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"gotpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"input\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"invalid\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keydown\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keypress\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keyup\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadeddata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadedmetadata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"lostpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousedown\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseenter\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseleave\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousemove\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseout\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseover\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseup\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousewheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"paste\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pause\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"play\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"playing\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointercancel\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerdown\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerenter\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerleave\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointermove\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerout\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerover\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerup\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"progress\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ratechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"reset\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"scroll\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeked\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeking\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"select\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"selectstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"stalled\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"submit\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"suspend\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"timeupdate\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchcancel\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchend\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchmove\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchstart\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"volumechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"waiting\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenerror\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"wheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLElement: {\r\n prototype: HTMLElement;\r\n new(): HTMLElement;\r\n}\r\n\r\ninterface HTMLEmbedElement extends HTMLElement, GetSVGDocument {\r\n /**\r\n * Sets or retrieves the height of the object.\r\n */\r\n height: string;\r\n hidden: any;\r\n /**\r\n * Gets or sets whether the DLNA PlayTo device is available.\r\n */\r\n msPlayToDisabled: boolean;\r\n /**\r\n * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server.\r\n */\r\n msPlayToPreferredSourceUri: string;\r\n /**\r\n * Gets or sets the primary DLNA PlayTo device.\r\n */\r\n msPlayToPrimary: boolean;\r\n /**\r\n * Gets the source associated with the media element for use by the PlayToManager.\r\n */\r\n readonly msPlayToSource: any;\r\n /**\r\n * Sets or retrieves the name of the object.\r\n */\r\n name: string;\r\n /**\r\n * Retrieves the palette used for the embedded document.\r\n */\r\n readonly palette: string;\r\n /**\r\n * Retrieves the URL of the plug-in used to view an embedded document.\r\n */\r\n readonly pluginspage: string;\r\n readonly readyState: string;\r\n /**\r\n * Sets or retrieves a URL to be loaded by the object.\r\n */\r\n src: string;\r\n /**\r\n * Sets or retrieves the height and width units of the embed object.\r\n */\r\n units: string;\r\n /**\r\n * Sets or retrieves the width of the object.\r\n */\r\n width: string;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLEmbedElement: {\r\n prototype: HTMLEmbedElement;\r\n new(): HTMLEmbedElement;\r\n}\r\n\r\ninterface HTMLFieldSetElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves how the object is aligned with adjacent text.\r\n */\r\n align: string;\r\n disabled: boolean;\r\n /**\r\n * Retrieves a reference to the form that the object is embedded in.\r\n */\r\n readonly form: HTMLFormElement;\r\n /**\r\n * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\r\n */\r\n readonly validationMessage: string;\r\n /**\r\n * Returns a ValidityState object that represents the validity states of an element.\r\n */\r\n readonly validity: ValidityState;\r\n /**\r\n * Returns whether an element will successfully validate based on forms validation rules and constraints.\r\n */\r\n readonly willValidate: boolean;\r\n /**\r\n * Returns whether a form will validate when it is submitted, without having to submit it.\r\n */\r\n checkValidity(): boolean;\r\n /**\r\n * Sets a custom error message that is displayed when a form is submitted.\r\n * @param error Sets a custom error message that is displayed when a form is submitted.\r\n */\r\n setCustomValidity(error: string): void;\r\n}\r\n\r\ndeclare var HTMLFieldSetElement: {\r\n prototype: HTMLFieldSetElement;\r\n new(): HTMLFieldSetElement;\r\n}\r\n\r\ninterface HTMLFontElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty {\r\n /**\r\n * Sets or retrieves the current typeface family.\r\n */\r\n face: string;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLFontElement: {\r\n prototype: HTMLFontElement;\r\n new(): HTMLFontElement;\r\n}\r\n\r\ninterface HTMLFormElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves a list of character encodings for input data that must be accepted by the server processing the form.\r\n */\r\n acceptCharset: string;\r\n /**\r\n * Sets or retrieves the URL to which the form content is sent for processing.\r\n */\r\n action: string;\r\n /**\r\n * Specifies whether autocomplete is applied to an editable text field.\r\n */\r\n autocomplete: string;\r\n /**\r\n * Retrieves a collection, in source order, of all controls in a given form.\r\n */\r\n readonly elements: HTMLCollection;\r\n /**\r\n * Sets or retrieves the MIME encoding for the form.\r\n */\r\n encoding: string;\r\n /**\r\n * Sets or retrieves the encoding type for the form.\r\n */\r\n enctype: string;\r\n /**\r\n * Sets or retrieves the number of objects in a collection.\r\n */\r\n readonly length: number;\r\n /**\r\n * Sets or retrieves how to send the form data to the server.\r\n */\r\n method: string;\r\n /**\r\n * Sets or retrieves the name of the object.\r\n */\r\n name: string;\r\n /**\r\n * Designates a form that is not validated when submitted.\r\n */\r\n noValidate: boolean;\r\n /**\r\n * Sets or retrieves the window or frame at which to target content.\r\n */\r\n target: string;\r\n /**\r\n * Returns whether a form will validate when it is submitted, without having to submit it.\r\n */\r\n checkValidity(): boolean;\r\n /**\r\n * Retrieves a form object or an object from an elements collection.\r\n * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is a Number, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made.\r\n * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned.\r\n */\r\n item(name?: any, index?: any): any;\r\n /**\r\n * Retrieves a form object or an object from an elements collection.\r\n */\r\n namedItem(name: string): any;\r\n /**\r\n * Fires when the user resets a form.\r\n */\r\n reset(): void;\r\n /**\r\n * Fires when a FORM is about to be submitted.\r\n */\r\n submit(): void;\r\n [name: string]: any;\r\n}\r\n\r\ndeclare var HTMLFormElement: {\r\n prototype: HTMLFormElement;\r\n new(): HTMLFormElement;\r\n}\r\n\r\ninterface HTMLFrameElement extends HTMLElement, GetSVGDocument {\r\n /**\r\n * Specifies the properties of a border drawn around an object.\r\n */\r\n border: string;\r\n /**\r\n * Sets or retrieves the border color of the object.\r\n */\r\n borderColor: any;\r\n /**\r\n * Retrieves the document object of the page or frame.\r\n */\r\n readonly contentDocument: Document;\r\n /**\r\n * Retrieves the object of the specified.\r\n */\r\n readonly contentWindow: Window;\r\n /**\r\n * Sets or retrieves whether to display a border for the frame.\r\n */\r\n frameBorder: string;\r\n /**\r\n * Sets or retrieves the amount of additional space between the frames.\r\n */\r\n frameSpacing: any;\r\n /**\r\n * Sets or retrieves the height of the object.\r\n */\r\n height: string | number;\r\n /**\r\n * Sets or retrieves a URI to a long description of the object.\r\n */\r\n longDesc: string;\r\n /**\r\n * Sets or retrieves the top and bottom margin heights before displaying the text in a frame.\r\n */\r\n marginHeight: string;\r\n /**\r\n * Sets or retrieves the left and right margin widths before displaying the text in a frame.\r\n */\r\n marginWidth: string;\r\n /**\r\n * Sets or retrieves the frame name.\r\n */\r\n name: string;\r\n /**\r\n * Sets or retrieves whether the user can resize the frame.\r\n */\r\n noResize: boolean;\r\n /**\r\n * Raised when the object has been completely received from the server.\r\n */\r\n onload: (this: this, ev: Event) => any;\r\n /**\r\n * Sets or retrieves whether the frame can be scrolled.\r\n */\r\n scrolling: string;\r\n /**\r\n * Sets or retrieves a URL to be loaded by the object.\r\n */\r\n src: string;\r\n /**\r\n * Sets or retrieves the width of the object.\r\n */\r\n width: string | number;\r\n addEventListener(type: \"MSContentZoom\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureChange\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureDoubleTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureEnd\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureHold\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGotPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSInertiaStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSLostPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSManipulationStateChanged\", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerCancel\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerDown\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerEnter\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerLeave\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerMove\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOut\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOver\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerUp\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"abort\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"activate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ariarequest\", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforecopy\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforecut\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforedeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforepaste\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"blur\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplay\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplaythrough\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"change\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"click\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"command\", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"contextmenu\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"copy\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"cuechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"cut\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dblclick\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"deactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drag\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragend\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragenter\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragleave\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragover\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragstart\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drop\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"durationchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"emptied\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ended\", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"focus\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"gotpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"input\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"invalid\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keydown\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keypress\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keyup\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadeddata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadedmetadata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"lostpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousedown\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseenter\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseleave\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousemove\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseout\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseover\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseup\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousewheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"paste\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pause\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"play\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"playing\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointercancel\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerdown\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerenter\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerleave\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointermove\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerout\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerover\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerup\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"progress\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ratechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"reset\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"scroll\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeked\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeking\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"select\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"selectstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"stalled\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"submit\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"suspend\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"timeupdate\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchcancel\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchend\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchmove\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchstart\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"volumechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"waiting\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenerror\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"wheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLFrameElement: {\r\n prototype: HTMLFrameElement;\r\n new(): HTMLFrameElement;\r\n}\r\n\r\ninterface HTMLFrameSetElement extends HTMLElement {\r\n border: string;\r\n /**\r\n * Sets or retrieves the border color of the object.\r\n */\r\n borderColor: any;\r\n /**\r\n * Sets or retrieves the frame widths of the object.\r\n */\r\n cols: string;\r\n /**\r\n * Sets or retrieves whether to display a border for the frame.\r\n */\r\n frameBorder: string;\r\n /**\r\n * Sets or retrieves the amount of additional space between the frames.\r\n */\r\n frameSpacing: any;\r\n name: string;\r\n onafterprint: (this: this, ev: Event) => any;\r\n onbeforeprint: (this: this, ev: Event) => any;\r\n onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any;\r\n /**\r\n * Fires when the object loses the input focus.\r\n */\r\n onblur: (this: this, ev: FocusEvent) => any;\r\n onerror: (this: this, ev: ErrorEvent) => any;\r\n /**\r\n * Fires when the object receives focus.\r\n */\r\n onfocus: (this: this, ev: FocusEvent) => any;\r\n onhashchange: (this: this, ev: HashChangeEvent) => any;\r\n onload: (this: this, ev: Event) => any;\r\n onmessage: (this: this, ev: MessageEvent) => any;\r\n onoffline: (this: this, ev: Event) => any;\r\n ononline: (this: this, ev: Event) => any;\r\n onorientationchange: (this: this, ev: Event) => any;\r\n onpagehide: (this: this, ev: PageTransitionEvent) => any;\r\n onpageshow: (this: this, ev: PageTransitionEvent) => any;\r\n onresize: (this: this, ev: UIEvent) => any;\r\n onstorage: (this: this, ev: StorageEvent) => any;\r\n onunload: (this: this, ev: Event) => any;\r\n /**\r\n * Sets or retrieves the frame heights of the object.\r\n */\r\n rows: string;\r\n addEventListener(type: \"MSContentZoom\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureChange\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureDoubleTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureEnd\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureHold\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGotPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSInertiaStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSLostPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSManipulationStateChanged\", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerCancel\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerDown\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerEnter\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerLeave\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerMove\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOut\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOver\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerUp\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"abort\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"activate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ariarequest\", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforecopy\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforecut\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforedeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforepaste\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforeprint\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforeunload\", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"blur\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"blur\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplay\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplaythrough\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"change\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"click\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"command\", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"contextmenu\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"copy\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"cuechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"cut\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dblclick\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"deactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drag\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragend\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragenter\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragleave\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragover\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragstart\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drop\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"durationchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"emptied\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ended\", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"focus\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"focus\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"gotpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"hashchange\", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"input\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"invalid\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keydown\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keypress\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keyup\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadeddata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadedmetadata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"lostpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"message\", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousedown\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseenter\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseleave\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousemove\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseout\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseover\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseup\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousewheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"offline\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"online\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"orientationchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pagehide\", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pageshow\", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"paste\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pause\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"play\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"playing\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointercancel\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerdown\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerenter\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerleave\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointermove\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerout\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerover\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerup\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"progress\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ratechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"reset\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"resize\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"scroll\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeked\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeking\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"select\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"selectstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"stalled\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"storage\", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"submit\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"suspend\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"timeupdate\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchcancel\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchend\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchmove\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchstart\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"unload\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"volumechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"waiting\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenerror\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"wheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLFrameSetElement: {\r\n prototype: HTMLFrameSetElement;\r\n new(): HTMLFrameSetElement;\r\n}\r\n\r\ninterface HTMLHRElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty {\r\n /**\r\n * Sets or retrieves how the object is aligned with adjacent text.\r\n */\r\n align: string;\r\n /**\r\n * Sets or retrieves whether the horizontal rule is drawn with 3-D shading.\r\n */\r\n noShade: boolean;\r\n /**\r\n * Sets or retrieves the width of the object.\r\n */\r\n width: number;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLHRElement: {\r\n prototype: HTMLHRElement;\r\n new(): HTMLHRElement;\r\n}\r\n\r\ninterface HTMLHeadElement extends HTMLElement {\r\n profile: string;\r\n}\r\n\r\ndeclare var HTMLHeadElement: {\r\n prototype: HTMLHeadElement;\r\n new(): HTMLHeadElement;\r\n}\r\n\r\ninterface HTMLHeadingElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves a value that indicates the table alignment.\r\n */\r\n align: string;\r\n}\r\n\r\ndeclare var HTMLHeadingElement: {\r\n prototype: HTMLHeadingElement;\r\n new(): HTMLHeadingElement;\r\n}\r\n\r\ninterface HTMLHtmlElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves the DTD version that governs the current document.\r\n */\r\n version: string;\r\n}\r\n\r\ndeclare var HTMLHtmlElement: {\r\n prototype: HTMLHtmlElement;\r\n new(): HTMLHtmlElement;\r\n}\r\n\r\ninterface HTMLIFrameElement extends HTMLElement, GetSVGDocument {\r\n /**\r\n * Sets or retrieves how the object is aligned with adjacent text.\r\n */\r\n align: string;\r\n allowFullscreen: boolean;\r\n /**\r\n * Specifies the properties of a border drawn around an object.\r\n */\r\n border: string;\r\n /**\r\n * Retrieves the document object of the page or frame.\r\n */\r\n readonly contentDocument: Document;\r\n /**\r\n * Retrieves the object of the specified.\r\n */\r\n readonly contentWindow: Window;\r\n /**\r\n * Sets or retrieves whether to display a border for the frame.\r\n */\r\n frameBorder: string;\r\n /**\r\n * Sets or retrieves the amount of additional space between the frames.\r\n */\r\n frameSpacing: any;\r\n /**\r\n * Sets or retrieves the height of the object.\r\n */\r\n height: string;\r\n /**\r\n * Sets or retrieves the horizontal margin for the object.\r\n */\r\n hspace: number;\r\n /**\r\n * Sets or retrieves a URI to a long description of the object.\r\n */\r\n longDesc: string;\r\n /**\r\n * Sets or retrieves the top and bottom margin heights before displaying the text in a frame.\r\n */\r\n marginHeight: string;\r\n /**\r\n * Sets or retrieves the left and right margin widths before displaying the text in a frame.\r\n */\r\n marginWidth: string;\r\n /**\r\n * Sets or retrieves the frame name.\r\n */\r\n name: string;\r\n /**\r\n * Sets or retrieves whether the user can resize the frame.\r\n */\r\n noResize: boolean;\r\n /**\r\n * Raised when the object has been completely received from the server.\r\n */\r\n onload: (this: this, ev: Event) => any;\r\n readonly sandbox: DOMSettableTokenList;\r\n /**\r\n * Sets or retrieves whether the frame can be scrolled.\r\n */\r\n scrolling: string;\r\n /**\r\n * Sets or retrieves a URL to be loaded by the object.\r\n */\r\n src: string;\r\n /**\r\n * Sets or retrieves the vertical margin for the object.\r\n */\r\n vspace: number;\r\n /**\r\n * Sets or retrieves the width of the object.\r\n */\r\n width: string;\r\n addEventListener(type: \"MSContentZoom\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureChange\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureDoubleTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureEnd\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureHold\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGotPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSInertiaStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSLostPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSManipulationStateChanged\", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerCancel\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerDown\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerEnter\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerLeave\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerMove\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOut\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOver\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerUp\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"abort\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"activate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ariarequest\", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforecopy\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforecut\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforedeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforepaste\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"blur\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplay\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplaythrough\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"change\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"click\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"command\", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"contextmenu\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"copy\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"cuechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"cut\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dblclick\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"deactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drag\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragend\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragenter\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragleave\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragover\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragstart\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drop\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"durationchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"emptied\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ended\", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"focus\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"gotpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"input\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"invalid\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keydown\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keypress\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keyup\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadeddata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadedmetadata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"lostpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousedown\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseenter\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseleave\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousemove\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseout\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseover\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseup\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousewheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"paste\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pause\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"play\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"playing\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointercancel\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerdown\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerenter\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerleave\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointermove\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerout\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerover\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerup\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"progress\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ratechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"reset\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"scroll\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeked\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeking\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"select\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"selectstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"stalled\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"submit\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"suspend\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"timeupdate\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchcancel\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchend\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchmove\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchstart\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"volumechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"waiting\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenerror\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"wheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLIFrameElement: {\r\n prototype: HTMLIFrameElement;\r\n new(): HTMLIFrameElement;\r\n}\r\n\r\ninterface HTMLImageElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves how the object is aligned with adjacent text.\r\n */\r\n align: string;\r\n /**\r\n * Sets or retrieves a text alternative to the graphic.\r\n */\r\n alt: string;\r\n /**\r\n * Specifies the properties of a border drawn around an object.\r\n */\r\n border: string;\r\n /**\r\n * Retrieves whether the object is fully loaded.\r\n */\r\n readonly complete: boolean;\r\n crossOrigin: string;\r\n readonly currentSrc: string;\r\n /**\r\n * Sets or retrieves the height of the object.\r\n */\r\n height: number;\r\n /**\r\n * Sets or retrieves the width of the border to draw around the object.\r\n */\r\n hspace: number;\r\n /**\r\n * Sets or retrieves whether the image is a server-side image map.\r\n */\r\n isMap: boolean;\r\n /**\r\n * Sets or retrieves a Uniform Resource Identifier (URI) to a long description of the object.\r\n */\r\n longDesc: string;\r\n lowsrc: string;\r\n /**\r\n * Gets or sets whether the DLNA PlayTo device is available.\r\n */\r\n msPlayToDisabled: boolean;\r\n msPlayToPreferredSourceUri: string;\r\n /**\r\n * Gets or sets the primary DLNA PlayTo device.\r\n */\r\n msPlayToPrimary: boolean;\r\n /**\r\n * Gets the source associated with the media element for use by the PlayToManager.\r\n */\r\n readonly msPlayToSource: any;\r\n /**\r\n * Sets or retrieves the name of the object.\r\n */\r\n name: string;\r\n /**\r\n * The original height of the image resource before sizing.\r\n */\r\n readonly naturalHeight: number;\r\n /**\r\n * The original width of the image resource before sizing.\r\n */\r\n readonly naturalWidth: number;\r\n sizes: string;\r\n /**\r\n * The address or URL of the a media resource that is to be considered.\r\n */\r\n src: string;\r\n srcset: string;\r\n /**\r\n * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map.\r\n */\r\n useMap: string;\r\n /**\r\n * Sets or retrieves the vertical margin for the object.\r\n */\r\n vspace: number;\r\n /**\r\n * Sets or retrieves the width of the object.\r\n */\r\n width: number;\r\n readonly x: number;\r\n readonly y: number;\r\n msGetAsCastingSource(): any;\r\n}\r\n\r\ndeclare var HTMLImageElement: {\r\n prototype: HTMLImageElement;\r\n new(): HTMLImageElement;\r\n create(): HTMLImageElement;\r\n}\r\n\r\ninterface HTMLInputElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves a comma-separated list of content types.\r\n */\r\n accept: string;\r\n /**\r\n * Sets or retrieves how the object is aligned with adjacent text.\r\n */\r\n align: string;\r\n /**\r\n * Sets or retrieves a text alternative to the graphic.\r\n */\r\n alt: string;\r\n /**\r\n * Specifies whether autocomplete is applied to an editable text field.\r\n */\r\n autocomplete: string;\r\n /**\r\n * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing.\r\n */\r\n autofocus: boolean;\r\n /**\r\n * Sets or retrieves the width of the border to draw around the object.\r\n */\r\n border: string;\r\n /**\r\n * Sets or retrieves the state of the check box or radio button.\r\n */\r\n checked: boolean;\r\n /**\r\n * Retrieves whether the object is fully loaded.\r\n */\r\n readonly complete: boolean;\r\n /**\r\n * Sets or retrieves the state of the check box or radio button.\r\n */\r\n defaultChecked: boolean;\r\n /**\r\n * Sets or retrieves the initial contents of the object.\r\n */\r\n defaultValue: string;\r\n disabled: boolean;\r\n /**\r\n * Returns a FileList object on a file type input object.\r\n */\r\n readonly files: FileList | null;\r\n /**\r\n * Retrieves a reference to the form that the object is embedded in. \r\n */\r\n readonly form: HTMLFormElement;\r\n /**\r\n * Overrides the action attribute (where the data on a form is sent) on the parent form element.\r\n */\r\n formAction: string;\r\n /**\r\n * Used to override the encoding (formEnctype attribute) specified on the form element.\r\n */\r\n formEnctype: string;\r\n /**\r\n * Overrides the submit method attribute previously specified on a form element.\r\n */\r\n formMethod: string;\r\n /**\r\n * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a \"save draft\"-type submit option.\r\n */\r\n formNoValidate: string;\r\n /**\r\n * Overrides the target attribute on a form element.\r\n */\r\n formTarget: string;\r\n /**\r\n * Sets or retrieves the height of the object.\r\n */\r\n height: string;\r\n /**\r\n * Sets or retrieves the width of the border to draw around the object.\r\n */\r\n hspace: number;\r\n indeterminate: boolean;\r\n /**\r\n * Specifies the ID of a pre-defined datalist of options for an input element.\r\n */\r\n readonly list: HTMLElement;\r\n /**\r\n * Defines the maximum acceptable value for an input element with type=\"number\".When used with the min and step attributes, lets you control the range and increment (such as only even numbers) that the user can enter into an input field.\r\n */\r\n max: string;\r\n /**\r\n * Sets or retrieves the maximum number of characters that the user can enter in a text control.\r\n */\r\n maxLength: number;\r\n /**\r\n * Defines the minimum acceptable value for an input element with type=\"number\". When used with the max and step attributes, lets you control the range and increment (such as even numbers only) that the user can enter into an input field.\r\n */\r\n min: string;\r\n /**\r\n * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list.\r\n */\r\n multiple: boolean;\r\n /**\r\n * Sets or retrieves the name of the object.\r\n */\r\n name: string;\r\n /**\r\n * Gets or sets a string containing a regular expression that the user's input must match.\r\n */\r\n pattern: string;\r\n /**\r\n * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field.\r\n */\r\n placeholder: string;\r\n readOnly: boolean;\r\n /**\r\n * When present, marks an element that can't be submitted without a value.\r\n */\r\n required: boolean;\r\n selectionDirection: string;\r\n /**\r\n * Gets or sets the end position or offset of a text selection.\r\n */\r\n selectionEnd: number;\r\n /**\r\n * Gets or sets the starting position or offset of a text selection.\r\n */\r\n selectionStart: number;\r\n size: number;\r\n /**\r\n * The address or URL of the a media resource that is to be considered.\r\n */\r\n src: string;\r\n status: boolean;\r\n /**\r\n * Defines an increment or jump between values that you want to allow the user to enter. When used with the max and min attributes, lets you control the range and increment (for example, allow only even numbers) that the user can enter into an input field.\r\n */\r\n step: string;\r\n /**\r\n * Returns the content type of the object.\r\n */\r\n type: string;\r\n /**\r\n * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map.\r\n */\r\n useMap: string;\r\n /**\r\n * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\r\n */\r\n readonly validationMessage: string;\r\n /**\r\n * Returns a ValidityState object that represents the validity states of an element.\r\n */\r\n readonly validity: ValidityState;\r\n /**\r\n * Returns the value of the data at the cursor's current position.\r\n */\r\n value: string;\r\n valueAsDate: Date;\r\n /**\r\n * Returns the input field value as a number.\r\n */\r\n valueAsNumber: number;\r\n /**\r\n * Sets or retrieves the vertical margin for the object.\r\n */\r\n vspace: number;\r\n webkitdirectory: boolean;\r\n /**\r\n * Sets or retrieves the width of the object.\r\n */\r\n width: string;\r\n /**\r\n * Returns whether an element will successfully validate based on forms validation rules and constraints.\r\n */\r\n readonly willValidate: boolean;\r\n minLength: number;\r\n /**\r\n * Returns whether a form will validate when it is submitted, without having to submit it.\r\n */\r\n checkValidity(): boolean;\r\n /**\r\n * Makes the selection equal to the current object.\r\n */\r\n select(): void;\r\n /**\r\n * Sets a custom error message that is displayed when a form is submitted.\r\n * @param error Sets a custom error message that is displayed when a form is submitted.\r\n */\r\n setCustomValidity(error: string): void;\r\n /**\r\n * Sets the start and end positions of a selection in a text field.\r\n * @param start The offset into the text field for the start of the selection.\r\n * @param end The offset into the text field for the end of the selection.\r\n */\r\n setSelectionRange(start?: number, end?: number, direction?: string): void;\r\n /**\r\n * Decrements a range input control's value by the value given by the Step attribute. If the optional parameter is used, it will decrement the input control's step value multiplied by the parameter's value.\r\n * @param n Value to decrement the value by.\r\n */\r\n stepDown(n?: number): void;\r\n /**\r\n * Increments a range input control's value by the value given by the Step attribute. If the optional parameter is used, will increment the input control's value by that value.\r\n * @param n Value to increment the value by.\r\n */\r\n stepUp(n?: number): void;\r\n}\r\n\r\ndeclare var HTMLInputElement: {\r\n prototype: HTMLInputElement;\r\n new(): HTMLInputElement;\r\n}\r\n\r\ninterface HTMLLIElement extends HTMLElement {\r\n type: string;\r\n /**\r\n * Sets or retrieves the value of a list item.\r\n */\r\n value: number;\r\n}\r\n\r\ndeclare var HTMLLIElement: {\r\n prototype: HTMLLIElement;\r\n new(): HTMLLIElement;\r\n}\r\n\r\ninterface HTMLLabelElement extends HTMLElement {\r\n /**\r\n * Retrieves a reference to the form that the object is embedded in.\r\n */\r\n readonly form: HTMLFormElement;\r\n /**\r\n * Sets or retrieves the object to which the given label object is assigned.\r\n */\r\n htmlFor: string;\r\n}\r\n\r\ndeclare var HTMLLabelElement: {\r\n prototype: HTMLLabelElement;\r\n new(): HTMLLabelElement;\r\n}\r\n\r\ninterface HTMLLegendElement extends HTMLElement {\r\n /**\r\n * Retrieves a reference to the form that the object is embedded in.\r\n */\r\n align: string;\r\n /**\r\n * Retrieves a reference to the form that the object is embedded in.\r\n */\r\n readonly form: HTMLFormElement;\r\n}\r\n\r\ndeclare var HTMLLegendElement: {\r\n prototype: HTMLLegendElement;\r\n new(): HTMLLegendElement;\r\n}\r\n\r\ninterface HTMLLinkElement extends HTMLElement, LinkStyle {\r\n /**\r\n * Sets or retrieves the character set used to encode the object.\r\n */\r\n charset: string;\r\n disabled: boolean;\r\n /**\r\n * Sets or retrieves a destination URL or an anchor point.\r\n */\r\n href: string;\r\n /**\r\n * Sets or retrieves the language code of the object.\r\n */\r\n hreflang: string;\r\n /**\r\n * Sets or retrieves the media type.\r\n */\r\n media: string;\r\n /**\r\n * Sets or retrieves the relationship between the object and the destination of the link.\r\n */\r\n rel: string;\r\n /**\r\n * Sets or retrieves the relationship between the object and the destination of the link.\r\n */\r\n rev: string;\r\n /**\r\n * Sets or retrieves the window or frame at which to target content.\r\n */\r\n target: string;\r\n /**\r\n * Sets or retrieves the MIME type of the object.\r\n */\r\n type: string;\r\n import?: Document;\r\n integrity: string;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLLinkElement: {\r\n prototype: HTMLLinkElement;\r\n new(): HTMLLinkElement;\r\n}\r\n\r\ninterface HTMLMapElement extends HTMLElement {\r\n /**\r\n * Retrieves a collection of the area objects defined for the given map object.\r\n */\r\n readonly areas: HTMLAreasCollection;\r\n /**\r\n * Sets or retrieves the name of the object.\r\n */\r\n name: string;\r\n}\r\n\r\ndeclare var HTMLMapElement: {\r\n prototype: HTMLMapElement;\r\n new(): HTMLMapElement;\r\n}\r\n\r\ninterface HTMLMarqueeElement extends HTMLElement {\r\n behavior: string;\r\n bgColor: any;\r\n direction: string;\r\n height: string;\r\n hspace: number;\r\n loop: number;\r\n onbounce: (this: this, ev: Event) => any;\r\n onfinish: (this: this, ev: Event) => any;\r\n onstart: (this: this, ev: Event) => any;\r\n scrollAmount: number;\r\n scrollDelay: number;\r\n trueSpeed: boolean;\r\n vspace: number;\r\n width: string;\r\n start(): void;\r\n stop(): void;\r\n addEventListener(type: \"MSContentZoom\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureChange\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureDoubleTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureEnd\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureHold\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGotPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSInertiaStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSLostPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSManipulationStateChanged\", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerCancel\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerDown\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerEnter\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerLeave\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerMove\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOut\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOver\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerUp\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"abort\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"activate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ariarequest\", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforecopy\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforecut\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforedeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforepaste\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"blur\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"bounce\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplay\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplaythrough\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"change\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"click\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"command\", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"contextmenu\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"copy\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"cuechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"cut\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dblclick\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"deactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drag\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragend\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragenter\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragleave\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragover\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragstart\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drop\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"durationchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"emptied\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ended\", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"finish\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"focus\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"gotpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"input\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"invalid\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keydown\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keypress\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keyup\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadeddata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadedmetadata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"lostpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousedown\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseenter\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseleave\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousemove\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseout\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseover\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseup\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousewheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"paste\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pause\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"play\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"playing\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointercancel\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerdown\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerenter\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerleave\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointermove\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerout\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerover\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerup\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"progress\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ratechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"reset\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"scroll\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeked\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeking\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"select\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"selectstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"stalled\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"start\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"submit\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"suspend\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"timeupdate\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchcancel\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchend\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchmove\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchstart\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"volumechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"waiting\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenerror\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"wheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLMarqueeElement: {\r\n prototype: HTMLMarqueeElement;\r\n new(): HTMLMarqueeElement;\r\n}\r\n\r\ninterface HTMLMediaElement extends HTMLElement {\r\n /**\r\n * Returns an AudioTrackList object with the audio tracks for a given video element.\r\n */\r\n readonly audioTracks: AudioTrackList;\r\n /**\r\n * Gets or sets a value that indicates whether to start playing the media automatically.\r\n */\r\n autoplay: boolean;\r\n /**\r\n * Gets a collection of buffered time ranges.\r\n */\r\n readonly buffered: TimeRanges;\r\n /**\r\n * Gets or sets a flag that indicates whether the client provides a set of controls for the media (in case the developer does not include controls for the player).\r\n */\r\n controls: boolean;\r\n crossOrigin: string;\r\n /**\r\n * Gets the address or URL of the current media resource that is selected by IHTMLMediaElement.\r\n */\r\n readonly currentSrc: string;\r\n /**\r\n * Gets or sets the current playback position, in seconds.\r\n */\r\n currentTime: number;\r\n defaultMuted: boolean;\r\n /**\r\n * Gets or sets the default playback rate when the user is not using fast forward or reverse for a video or audio resource.\r\n */\r\n defaultPlaybackRate: number;\r\n /**\r\n * Returns the duration in seconds of the current media resource. A NaN value is returned if duration is not available, or Infinity if the media resource is streaming.\r\n */\r\n readonly duration: number;\r\n /**\r\n * Gets information about whether the playback has ended or not.\r\n */\r\n readonly ended: boolean;\r\n /**\r\n * Returns an object representing the current error state of the audio or video element.\r\n */\r\n readonly error: MediaError;\r\n /**\r\n * Gets or sets a flag to specify whether playback should restart after it completes.\r\n */\r\n loop: boolean;\r\n readonly mediaKeys: MediaKeys | null;\r\n /**\r\n * Specifies the purpose of the audio or video media, such as background audio or alerts.\r\n */\r\n msAudioCategory: string;\r\n /**\r\n * Specifies the output device id that the audio will be sent to.\r\n */\r\n msAudioDeviceType: string;\r\n readonly msGraphicsTrustStatus: MSGraphicsTrust;\r\n /**\r\n * Gets the MSMediaKeys object, which is used for decrypting media data, that is associated with this media element.\r\n */\r\n readonly msKeys: MSMediaKeys;\r\n /**\r\n * Gets or sets whether the DLNA PlayTo device is available.\r\n */\r\n msPlayToDisabled: boolean;\r\n /**\r\n * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server.\r\n */\r\n msPlayToPreferredSourceUri: string;\r\n /**\r\n * Gets or sets the primary DLNA PlayTo device.\r\n */\r\n msPlayToPrimary: boolean;\r\n /**\r\n * Gets the source associated with the media element for use by the PlayToManager.\r\n */\r\n readonly msPlayToSource: any;\r\n /**\r\n * Specifies whether or not to enable low-latency playback on the media element.\r\n */\r\n msRealTime: boolean;\r\n /**\r\n * Gets or sets a flag that indicates whether the audio (either audio or the audio track on video media) is muted.\r\n */\r\n muted: boolean;\r\n /**\r\n * Gets the current network activity for the element.\r\n */\r\n readonly networkState: number;\r\n onencrypted: (this: this, ev: MediaEncryptedEvent) => any;\r\n onmsneedkey: (this: this, ev: MSMediaKeyNeededEvent) => any;\r\n /**\r\n * Gets a flag that specifies whether playback is paused.\r\n */\r\n readonly paused: boolean;\r\n /**\r\n * Gets or sets the current rate of speed for the media resource to play. This speed is expressed as a multiple of the normal speed of the media resource.\r\n */\r\n playbackRate: number;\r\n /**\r\n * Gets TimeRanges for the current media resource that has been played.\r\n */\r\n readonly played: TimeRanges;\r\n /**\r\n * Gets or sets the current playback position, in seconds.\r\n */\r\n preload: string;\r\n readyState: number;\r\n /**\r\n * Returns a TimeRanges object that represents the ranges of the current media resource that can be seeked.\r\n */\r\n readonly seekable: TimeRanges;\r\n /**\r\n * Gets a flag that indicates whether the the client is currently moving to a new playback position in the media resource.\r\n */\r\n readonly seeking: boolean;\r\n /**\r\n * The address or URL of the a media resource that is to be considered.\r\n */\r\n src: string;\r\n srcObject: MediaStream | null;\r\n readonly textTracks: TextTrackList;\r\n readonly videoTracks: VideoTrackList;\r\n /**\r\n * Gets or sets the volume level for audio portions of the media element.\r\n */\r\n volume: number;\r\n addTextTrack(kind: string, label?: string, language?: string): TextTrack;\r\n /**\r\n * Returns a string that specifies whether the client can play a given media resource type.\r\n */\r\n canPlayType(type: string): string;\r\n /**\r\n * Resets the audio or video object and loads a new media resource.\r\n */\r\n load(): void;\r\n /**\r\n * Clears all effects from the media pipeline.\r\n */\r\n msClearEffects(): void;\r\n msGetAsCastingSource(): any;\r\n /**\r\n * Inserts the specified audio effect into media pipeline.\r\n */\r\n msInsertAudioEffect(activatableClassId: string, effectRequired: boolean, config?: any): void;\r\n msSetMediaKeys(mediaKeys: MSMediaKeys): void;\r\n /**\r\n * Specifies the media protection manager for a given media pipeline.\r\n */\r\n msSetMediaProtectionManager(mediaProtectionManager?: any): void;\r\n /**\r\n * Pauses the current playback and sets paused to TRUE. This can be used to test whether the media is playing or paused. You can also use the pause or play events to tell whether the media is playing or not.\r\n */\r\n pause(): void;\r\n /**\r\n * Loads and starts playback of a media resource.\r\n */\r\n play(): void;\r\n setMediaKeys(mediaKeys: MediaKeys | null): PromiseLike;\r\n readonly HAVE_CURRENT_DATA: number;\r\n readonly HAVE_ENOUGH_DATA: number;\r\n readonly HAVE_FUTURE_DATA: number;\r\n readonly HAVE_METADATA: number;\r\n readonly HAVE_NOTHING: number;\r\n readonly NETWORK_EMPTY: number;\r\n readonly NETWORK_IDLE: number;\r\n readonly NETWORK_LOADING: number;\r\n readonly NETWORK_NO_SOURCE: number;\r\n addEventListener(type: \"MSContentZoom\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureChange\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureDoubleTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureEnd\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureHold\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGotPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSInertiaStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSLostPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSManipulationStateChanged\", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerCancel\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerDown\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerEnter\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerLeave\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerMove\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOut\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOver\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerUp\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"abort\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"activate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ariarequest\", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforecopy\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforecut\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforedeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforepaste\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"blur\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplay\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplaythrough\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"change\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"click\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"command\", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"contextmenu\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"copy\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"cuechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"cut\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dblclick\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"deactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drag\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragend\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragenter\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragleave\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragover\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragstart\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drop\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"durationchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"emptied\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"encrypted\", listener: (this: this, ev: MediaEncryptedEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ended\", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"focus\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"gotpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"input\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"invalid\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keydown\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keypress\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keyup\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadeddata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadedmetadata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"lostpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousedown\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseenter\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseleave\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousemove\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseout\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseover\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseup\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousewheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"msneedkey\", listener: (this: this, ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"paste\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pause\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"play\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"playing\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointercancel\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerdown\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerenter\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerleave\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointermove\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerout\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerover\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerup\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"progress\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ratechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"reset\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"scroll\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeked\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeking\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"select\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"selectstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"stalled\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"submit\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"suspend\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"timeupdate\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchcancel\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchend\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchmove\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchstart\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"volumechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"waiting\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenerror\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"wheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLMediaElement: {\r\n prototype: HTMLMediaElement;\r\n new(): HTMLMediaElement;\r\n readonly HAVE_CURRENT_DATA: number;\r\n readonly HAVE_ENOUGH_DATA: number;\r\n readonly HAVE_FUTURE_DATA: number;\r\n readonly HAVE_METADATA: number;\r\n readonly HAVE_NOTHING: number;\r\n readonly NETWORK_EMPTY: number;\r\n readonly NETWORK_IDLE: number;\r\n readonly NETWORK_LOADING: number;\r\n readonly NETWORK_NO_SOURCE: number;\r\n}\r\n\r\ninterface HTMLMenuElement extends HTMLElement {\r\n compact: boolean;\r\n type: string;\r\n}\r\n\r\ndeclare var HTMLMenuElement: {\r\n prototype: HTMLMenuElement;\r\n new(): HTMLMenuElement;\r\n}\r\n\r\ninterface HTMLMetaElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves the character set used to encode the object.\r\n */\r\n charset: string;\r\n /**\r\n * Gets or sets meta-information to associate with httpEquiv or name.\r\n */\r\n content: string;\r\n /**\r\n * Gets or sets information used to bind the value of a content attribute of a meta element to an HTTP response header.\r\n */\r\n httpEquiv: string;\r\n /**\r\n * Sets or retrieves the value specified in the content attribute of the meta object.\r\n */\r\n name: string;\r\n /**\r\n * Sets or retrieves a scheme to be used in interpreting the value of a property specified for the object.\r\n */\r\n scheme: string;\r\n /**\r\n * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. \r\n */\r\n url: string;\r\n}\r\n\r\ndeclare var HTMLMetaElement: {\r\n prototype: HTMLMetaElement;\r\n new(): HTMLMetaElement;\r\n}\r\n\r\ninterface HTMLMeterElement extends HTMLElement {\r\n high: number;\r\n low: number;\r\n max: number;\r\n min: number;\r\n optimum: number;\r\n value: number;\r\n}\r\n\r\ndeclare var HTMLMeterElement: {\r\n prototype: HTMLMeterElement;\r\n new(): HTMLMeterElement;\r\n}\r\n\r\ninterface HTMLModElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves reference information about the object.\r\n */\r\n cite: string;\r\n /**\r\n * Sets or retrieves the date and time of a modification to the object.\r\n */\r\n dateTime: string;\r\n}\r\n\r\ndeclare var HTMLModElement: {\r\n prototype: HTMLModElement;\r\n new(): HTMLModElement;\r\n}\r\n\r\ninterface HTMLOListElement extends HTMLElement {\r\n compact: boolean;\r\n /**\r\n * The starting number.\r\n */\r\n start: number;\r\n type: string;\r\n}\r\n\r\ndeclare var HTMLOListElement: {\r\n prototype: HTMLOListElement;\r\n new(): HTMLOListElement;\r\n}\r\n\r\ninterface HTMLObjectElement extends HTMLElement, GetSVGDocument {\r\n /**\r\n * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element.\r\n */\r\n readonly BaseHref: string;\r\n align: string;\r\n /**\r\n * Sets or retrieves a text alternative to the graphic.\r\n */\r\n alt: string;\r\n /**\r\n * Gets or sets the optional alternative HTML script to execute if the object fails to load.\r\n */\r\n altHtml: string;\r\n /**\r\n * Sets or retrieves a character string that can be used to implement your own archive functionality for the object.\r\n */\r\n archive: string;\r\n border: string;\r\n /**\r\n * Sets or retrieves the URL of the file containing the compiled Java class.\r\n */\r\n code: string;\r\n /**\r\n * Sets or retrieves the URL of the component.\r\n */\r\n codeBase: string;\r\n /**\r\n * Sets or retrieves the Internet media type for the code associated with the object.\r\n */\r\n codeType: string;\r\n /**\r\n * Retrieves the document object of the page or frame.\r\n */\r\n readonly contentDocument: Document;\r\n /**\r\n * Sets or retrieves the URL that references the data of the object.\r\n */\r\n data: string;\r\n declare: boolean;\r\n /**\r\n * Retrieves a reference to the form that the object is embedded in.\r\n */\r\n readonly form: HTMLFormElement;\r\n /**\r\n * Sets or retrieves the height of the object.\r\n */\r\n height: string;\r\n hspace: number;\r\n /**\r\n * Gets or sets whether the DLNA PlayTo device is available.\r\n */\r\n msPlayToDisabled: boolean;\r\n /**\r\n * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server.\r\n */\r\n msPlayToPreferredSourceUri: string;\r\n /**\r\n * Gets or sets the primary DLNA PlayTo device.\r\n */\r\n msPlayToPrimary: boolean;\r\n /**\r\n * Gets the source associated with the media element for use by the PlayToManager.\r\n */\r\n readonly msPlayToSource: any;\r\n /**\r\n * Sets or retrieves the name of the object.\r\n */\r\n name: string;\r\n /**\r\n * Retrieves the contained object.\r\n */\r\n readonly object: any;\r\n readonly readyState: number;\r\n /**\r\n * Sets or retrieves a message to be displayed while an object is loading.\r\n */\r\n standby: string;\r\n /**\r\n * Sets or retrieves the MIME type of the object.\r\n */\r\n type: string;\r\n /**\r\n * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map.\r\n */\r\n useMap: string;\r\n /**\r\n * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\r\n */\r\n readonly validationMessage: string;\r\n /**\r\n * Returns a ValidityState object that represents the validity states of an element.\r\n */\r\n readonly validity: ValidityState;\r\n vspace: number;\r\n /**\r\n * Sets or retrieves the width of the object.\r\n */\r\n width: string;\r\n /**\r\n * Returns whether an element will successfully validate based on forms validation rules and constraints.\r\n */\r\n readonly willValidate: boolean;\r\n /**\r\n * Returns whether a form will validate when it is submitted, without having to submit it.\r\n */\r\n checkValidity(): boolean;\r\n /**\r\n * Sets a custom error message that is displayed when a form is submitted.\r\n * @param error Sets a custom error message that is displayed when a form is submitted.\r\n */\r\n setCustomValidity(error: string): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLObjectElement: {\r\n prototype: HTMLObjectElement;\r\n new(): HTMLObjectElement;\r\n}\r\n\r\ninterface HTMLOptGroupElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves the status of an option.\r\n */\r\n defaultSelected: boolean;\r\n disabled: boolean;\r\n /**\r\n * Retrieves a reference to the form that the object is embedded in.\r\n */\r\n readonly form: HTMLFormElement;\r\n /**\r\n * Sets or retrieves the ordinal position of an option in a list box.\r\n */\r\n readonly index: number;\r\n /**\r\n * Sets or retrieves a value that you can use to implement your own label functionality for the object.\r\n */\r\n label: string;\r\n /**\r\n * Sets or retrieves whether the option in the list box is the default item.\r\n */\r\n selected: boolean;\r\n /**\r\n * Sets or retrieves the text string specified by the option tag.\r\n */\r\n readonly text: string;\r\n /**\r\n * Sets or retrieves the value which is returned to the server when the form control is submitted.\r\n */\r\n value: string;\r\n}\r\n\r\ndeclare var HTMLOptGroupElement: {\r\n prototype: HTMLOptGroupElement;\r\n new(): HTMLOptGroupElement;\r\n}\r\n\r\ninterface HTMLOptionElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves the status of an option.\r\n */\r\n defaultSelected: boolean;\r\n disabled: boolean;\r\n /**\r\n * Retrieves a reference to the form that the object is embedded in.\r\n */\r\n readonly form: HTMLFormElement;\r\n /**\r\n * Sets or retrieves the ordinal position of an option in a list box.\r\n */\r\n readonly index: number;\r\n /**\r\n * Sets or retrieves a value that you can use to implement your own label functionality for the object.\r\n */\r\n label: string;\r\n /**\r\n * Sets or retrieves whether the option in the list box is the default item.\r\n */\r\n selected: boolean;\r\n /**\r\n * Sets or retrieves the text string specified by the option tag.\r\n */\r\n text: string;\r\n /**\r\n * Sets or retrieves the value which is returned to the server when the form control is submitted.\r\n */\r\n value: string;\r\n}\r\n\r\ndeclare var HTMLOptionElement: {\r\n prototype: HTMLOptionElement;\r\n new(): HTMLOptionElement;\r\n create(): HTMLOptionElement;\r\n}\r\n\r\ninterface HTMLOptionsCollection extends HTMLCollectionOf {\r\n length: number;\r\n selectedIndex: number;\r\n add(element: HTMLOptionElement | HTMLOptGroupElement, before?: HTMLElement | number): void;\r\n remove(index: number): void;\r\n}\r\n\r\ndeclare var HTMLOptionsCollection: {\r\n prototype: HTMLOptionsCollection;\r\n new(): HTMLOptionsCollection;\r\n}\r\n\r\ninterface HTMLParagraphElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves how the object is aligned with adjacent text. \r\n */\r\n align: string;\r\n clear: string;\r\n}\r\n\r\ndeclare var HTMLParagraphElement: {\r\n prototype: HTMLParagraphElement;\r\n new(): HTMLParagraphElement;\r\n}\r\n\r\ninterface HTMLParamElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves the name of an input parameter for an element.\r\n */\r\n name: string;\r\n /**\r\n * Sets or retrieves the content type of the resource designated by the value attribute.\r\n */\r\n type: string;\r\n /**\r\n * Sets or retrieves the value of an input parameter for an element.\r\n */\r\n value: string;\r\n /**\r\n * Sets or retrieves the data type of the value attribute.\r\n */\r\n valueType: string;\r\n}\r\n\r\ndeclare var HTMLParamElement: {\r\n prototype: HTMLParamElement;\r\n new(): HTMLParamElement;\r\n}\r\n\r\ninterface HTMLPictureElement extends HTMLElement {\r\n}\r\n\r\ndeclare var HTMLPictureElement: {\r\n prototype: HTMLPictureElement;\r\n new(): HTMLPictureElement;\r\n}\r\n\r\ninterface HTMLPreElement extends HTMLElement {\r\n /**\r\n * Sets or gets a value that you can use to implement your own width functionality for the object.\r\n */\r\n width: number;\r\n}\r\n\r\ndeclare var HTMLPreElement: {\r\n prototype: HTMLPreElement;\r\n new(): HTMLPreElement;\r\n}\r\n\r\ninterface HTMLProgressElement extends HTMLElement {\r\n /**\r\n * Retrieves a reference to the form that the object is embedded in.\r\n */\r\n readonly form: HTMLFormElement;\r\n /**\r\n * Defines the maximum, or \"done\" value for a progress element.\r\n */\r\n max: number;\r\n /**\r\n * Returns the quotient of value/max when the value attribute is set (determinate progress bar), or -1 when the value attribute is missing (indeterminate progress bar).\r\n */\r\n readonly position: number;\r\n /**\r\n * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value.\r\n */\r\n value: number;\r\n}\r\n\r\ndeclare var HTMLProgressElement: {\r\n prototype: HTMLProgressElement;\r\n new(): HTMLProgressElement;\r\n}\r\n\r\ninterface HTMLQuoteElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves reference information about the object.\r\n */\r\n cite: string;\r\n}\r\n\r\ndeclare var HTMLQuoteElement: {\r\n prototype: HTMLQuoteElement;\r\n new(): HTMLQuoteElement;\r\n}\r\n\r\ninterface HTMLScriptElement extends HTMLElement {\r\n async: boolean;\r\n /**\r\n * Sets or retrieves the character set used to encode the object.\r\n */\r\n charset: string;\r\n /**\r\n * Sets or retrieves the status of the script.\r\n */\r\n defer: boolean;\r\n /**\r\n * Sets or retrieves the event for which the script is written. \r\n */\r\n event: string;\r\n /** \r\n * Sets or retrieves the object that is bound to the event script.\r\n */\r\n htmlFor: string;\r\n /**\r\n * Retrieves the URL to an external file that contains the source code or data.\r\n */\r\n src: string;\r\n /**\r\n * Retrieves or sets the text of the object as a string. \r\n */\r\n text: string;\r\n /**\r\n * Sets or retrieves the MIME type for the associated scripting engine.\r\n */\r\n type: string;\r\n integrity: string;\r\n}\r\n\r\ndeclare var HTMLScriptElement: {\r\n prototype: HTMLScriptElement;\r\n new(): HTMLScriptElement;\r\n}\r\n\r\ninterface HTMLSelectElement extends HTMLElement {\r\n /**\r\n * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing.\r\n */\r\n autofocus: boolean;\r\n disabled: boolean;\r\n /**\r\n * Retrieves a reference to the form that the object is embedded in. \r\n */\r\n readonly form: HTMLFormElement;\r\n /**\r\n * Sets or retrieves the number of objects in a collection.\r\n */\r\n length: number;\r\n /**\r\n * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list.\r\n */\r\n multiple: boolean;\r\n /**\r\n * Sets or retrieves the name of the object.\r\n */\r\n name: string;\r\n readonly options: HTMLOptionsCollection;\r\n /**\r\n * When present, marks an element that can't be submitted without a value.\r\n */\r\n required: boolean;\r\n /**\r\n * Sets or retrieves the index of the selected option in a select object.\r\n */\r\n selectedIndex: number;\r\n selectedOptions: HTMLCollectionOf;\r\n /**\r\n * Sets or retrieves the number of rows in the list box. \r\n */\r\n size: number;\r\n /**\r\n * Retrieves the type of select control based on the value of the MULTIPLE attribute.\r\n */\r\n readonly type: string;\r\n /**\r\n * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\r\n */\r\n readonly validationMessage: string;\r\n /**\r\n * Returns a ValidityState object that represents the validity states of an element.\r\n */\r\n readonly validity: ValidityState;\r\n /**\r\n * Sets or retrieves the value which is returned to the server when the form control is submitted.\r\n */\r\n value: string;\r\n /**\r\n * Returns whether an element will successfully validate based on forms validation rules and constraints.\r\n */\r\n readonly willValidate: boolean;\r\n /**\r\n * Adds an element to the areas, controlRange, or options collection.\r\n * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection.\r\n * @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection. \r\n */\r\n add(element: HTMLElement, before?: HTMLElement | number): void;\r\n /**\r\n * Returns whether a form will validate when it is submitted, without having to submit it.\r\n */\r\n checkValidity(): boolean;\r\n /**\r\n * Retrieves a select object or an object from an options collection.\r\n * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is an integer, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made.\r\n * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned.\r\n */\r\n item(name?: any, index?: any): any;\r\n /**\r\n * Retrieves a select object or an object from an options collection.\r\n * @param namedItem A String that specifies the name or id property of the object to retrieve. A collection is returned if more than one match is made.\r\n */\r\n namedItem(name: string): any;\r\n /**\r\n * Removes an element from the collection.\r\n * @param index Number that specifies the zero-based index of the element to remove from the collection.\r\n */\r\n remove(index?: number): void;\r\n /**\r\n * Sets a custom error message that is displayed when a form is submitted.\r\n * @param error Sets a custom error message that is displayed when a form is submitted.\r\n */\r\n setCustomValidity(error: string): void;\r\n [name: string]: any;\r\n}\r\n\r\ndeclare var HTMLSelectElement: {\r\n prototype: HTMLSelectElement;\r\n new(): HTMLSelectElement;\r\n}\r\n\r\ninterface HTMLSourceElement extends HTMLElement {\r\n /**\r\n * Gets or sets the intended media type of the media source.\r\n */\r\n media: string;\r\n msKeySystem: string;\r\n sizes: string;\r\n /**\r\n * The address or URL of the a media resource that is to be considered.\r\n */\r\n src: string;\r\n srcset: string;\r\n /**\r\n * Gets or sets the MIME type of a media resource.\r\n */\r\n type: string;\r\n}\r\n\r\ndeclare var HTMLSourceElement: {\r\n prototype: HTMLSourceElement;\r\n new(): HTMLSourceElement;\r\n}\r\n\r\ninterface HTMLSpanElement extends HTMLElement {\r\n}\r\n\r\ndeclare var HTMLSpanElement: {\r\n prototype: HTMLSpanElement;\r\n new(): HTMLSpanElement;\r\n}\r\n\r\ninterface HTMLStyleElement extends HTMLElement, LinkStyle {\r\n disabled: boolean;\r\n /**\r\n * Sets or retrieves the media type.\r\n */\r\n media: string;\r\n /**\r\n * Retrieves the CSS language in which the style sheet is written.\r\n */\r\n type: string;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLStyleElement: {\r\n prototype: HTMLStyleElement;\r\n new(): HTMLStyleElement;\r\n}\r\n\r\ninterface HTMLTableCaptionElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves the alignment of the caption or legend.\r\n */\r\n align: string;\r\n /**\r\n * Sets or retrieves whether the caption appears at the top or bottom of the table.\r\n */\r\n vAlign: string;\r\n}\r\n\r\ndeclare var HTMLTableCaptionElement: {\r\n prototype: HTMLTableCaptionElement;\r\n new(): HTMLTableCaptionElement;\r\n}\r\n\r\ninterface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment {\r\n /**\r\n * Sets or retrieves abbreviated text for the object.\r\n */\r\n abbr: string;\r\n /**\r\n * Sets or retrieves how the object is aligned with adjacent text.\r\n */\r\n align: string;\r\n /**\r\n * Sets or retrieves a comma-delimited list of conceptual categories associated with the object.\r\n */\r\n axis: string;\r\n bgColor: any;\r\n /**\r\n * Retrieves the position of the object in the cells collection of a row.\r\n */\r\n readonly cellIndex: number;\r\n /**\r\n * Sets or retrieves the number columns in the table that the object should span.\r\n */\r\n colSpan: number;\r\n /**\r\n * Sets or retrieves a list of header cells that provide information for the object.\r\n */\r\n headers: string;\r\n /**\r\n * Sets or retrieves the height of the object.\r\n */\r\n height: any;\r\n /**\r\n * Sets or retrieves whether the browser automatically performs wordwrap.\r\n */\r\n noWrap: boolean;\r\n /**\r\n * Sets or retrieves how many rows in a table the cell should span.\r\n */\r\n rowSpan: number;\r\n /**\r\n * Sets or retrieves the group of cells in a table to which the object's information applies.\r\n */\r\n scope: string;\r\n /**\r\n * Sets or retrieves the width of the object.\r\n */\r\n width: string;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLTableCellElement: {\r\n prototype: HTMLTableCellElement;\r\n new(): HTMLTableCellElement;\r\n}\r\n\r\ninterface HTMLTableColElement extends HTMLElement, HTMLTableAlignment {\r\n /**\r\n * Sets or retrieves the alignment of the object relative to the display or table.\r\n */\r\n align: string;\r\n /**\r\n * Sets or retrieves the number of columns in the group.\r\n */\r\n span: number;\r\n /**\r\n * Sets or retrieves the width of the object.\r\n */\r\n width: any;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLTableColElement: {\r\n prototype: HTMLTableColElement;\r\n new(): HTMLTableColElement;\r\n}\r\n\r\ninterface HTMLTableDataCellElement extends HTMLTableCellElement {\r\n}\r\n\r\ndeclare var HTMLTableDataCellElement: {\r\n prototype: HTMLTableDataCellElement;\r\n new(): HTMLTableDataCellElement;\r\n}\r\n\r\ninterface HTMLTableElement extends HTMLElement {\r\n /**\r\n * Sets or retrieves a value that indicates the table alignment.\r\n */\r\n align: string;\r\n bgColor: any;\r\n /**\r\n * Sets or retrieves the width of the border to draw around the object.\r\n */\r\n border: string;\r\n /**\r\n * Sets or retrieves the border color of the object. \r\n */\r\n borderColor: any;\r\n /**\r\n * Retrieves the caption object of a table.\r\n */\r\n caption: HTMLTableCaptionElement;\r\n /**\r\n * Sets or retrieves the amount of space between the border of the cell and the content of the cell.\r\n */\r\n cellPadding: string;\r\n /**\r\n * Sets or retrieves the amount of space between cells in a table.\r\n */\r\n cellSpacing: string;\r\n /**\r\n * Sets or retrieves the number of columns in the table.\r\n */\r\n cols: number;\r\n /**\r\n * Sets or retrieves the way the border frame around the table is displayed.\r\n */\r\n frame: string;\r\n /**\r\n * Sets or retrieves the height of the object.\r\n */\r\n height: any;\r\n /**\r\n * Sets or retrieves the number of horizontal rows contained in the object.\r\n */\r\n rows: HTMLCollectionOf;\r\n /**\r\n * Sets or retrieves which dividing lines (inner borders) are displayed.\r\n */\r\n rules: string;\r\n /**\r\n * Sets or retrieves a description and/or structure of the object.\r\n */\r\n summary: string;\r\n /**\r\n * Retrieves a collection of all tBody objects in the table. Objects in this collection are in source order.\r\n */\r\n tBodies: HTMLCollectionOf;\r\n /**\r\n * Retrieves the tFoot object of the table.\r\n */\r\n tFoot: HTMLTableSectionElement;\r\n /**\r\n * Retrieves the tHead object of the table.\r\n */\r\n tHead: HTMLTableSectionElement;\r\n /**\r\n * Sets or retrieves the width of the object.\r\n */\r\n width: string;\r\n /**\r\n * Creates an empty caption element in the table.\r\n */\r\n createCaption(): HTMLTableCaptionElement;\r\n /**\r\n * Creates an empty tBody element in the table.\r\n */\r\n createTBody(): HTMLTableSectionElement;\r\n /**\r\n * Creates an empty tFoot element in the table.\r\n */\r\n createTFoot(): HTMLTableSectionElement;\r\n /**\r\n * Returns the tHead element object if successful, or null otherwise.\r\n */\r\n createTHead(): HTMLTableSectionElement;\r\n /**\r\n * Deletes the caption element and its contents from the table.\r\n */\r\n deleteCaption(): void;\r\n /**\r\n * Removes the specified row (tr) from the element and from the rows collection.\r\n * @param index Number that specifies the zero-based position in the rows collection of the row to remove.\r\n */\r\n deleteRow(index?: number): void;\r\n /**\r\n * Deletes the tFoot element and its contents from the table.\r\n */\r\n deleteTFoot(): void;\r\n /**\r\n * Deletes the tHead element and its contents from the table.\r\n */\r\n deleteTHead(): void;\r\n /**\r\n * Creates a new row (tr) in the table, and adds the row to the rows collection.\r\n * @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.\r\n */\r\n insertRow(index?: number): HTMLTableRowElement;\r\n}\r\n\r\ndeclare var HTMLTableElement: {\r\n prototype: HTMLTableElement;\r\n new(): HTMLTableElement;\r\n}\r\n\r\ninterface HTMLTableHeaderCellElement extends HTMLTableCellElement {\r\n /**\r\n * Sets or retrieves the group of cells in a table to which the object's information applies.\r\n */\r\n scope: string;\r\n}\r\n\r\ndeclare var HTMLTableHeaderCellElement: {\r\n prototype: HTMLTableHeaderCellElement;\r\n new(): HTMLTableHeaderCellElement;\r\n}\r\n\r\ninterface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment {\r\n /**\r\n * Sets or retrieves how the object is aligned with adjacent text.\r\n */\r\n align: string;\r\n bgColor: any;\r\n /**\r\n * Retrieves a collection of all cells in the table row.\r\n */\r\n cells: HTMLCollectionOf;\r\n /**\r\n * Sets or retrieves the height of the object.\r\n */\r\n height: any;\r\n /**\r\n * Retrieves the position of the object in the rows collection for the table.\r\n */\r\n readonly rowIndex: number;\r\n /**\r\n * Retrieves the position of the object in the collection.\r\n */\r\n readonly sectionRowIndex: number;\r\n /**\r\n * Removes the specified cell from the table row, as well as from the cells collection.\r\n * @param index Number that specifies the zero-based position of the cell to remove from the table row. If no value is provided, the last cell in the cells collection is deleted.\r\n */\r\n deleteCell(index?: number): void;\r\n /**\r\n * Creates a new cell in the table row, and adds the cell to the cells collection.\r\n * @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.\r\n */\r\n insertCell(index?: number): HTMLTableDataCellElement;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLTableRowElement: {\r\n prototype: HTMLTableRowElement;\r\n new(): HTMLTableRowElement;\r\n}\r\n\r\ninterface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment {\r\n /**\r\n * Sets or retrieves a value that indicates the table alignment.\r\n */\r\n align: string;\r\n /**\r\n * Sets or retrieves the number of horizontal rows contained in the object.\r\n */\r\n rows: HTMLCollectionOf;\r\n /**\r\n * Removes the specified row (tr) from the element and from the rows collection.\r\n * @param index Number that specifies the zero-based position in the rows collection of the row to remove.\r\n */\r\n deleteRow(index?: number): void;\r\n /**\r\n * Creates a new row (tr) in the table, and adds the row to the rows collection.\r\n * @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.\r\n */\r\n insertRow(index?: number): HTMLTableRowElement;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLTableSectionElement: {\r\n prototype: HTMLTableSectionElement;\r\n new(): HTMLTableSectionElement;\r\n}\r\n\r\ninterface HTMLTemplateElement extends HTMLElement {\r\n readonly content: DocumentFragment;\r\n}\r\n\r\ndeclare var HTMLTemplateElement: {\r\n prototype: HTMLTemplateElement;\r\n new(): HTMLTemplateElement;\r\n}\r\n\r\ninterface HTMLTextAreaElement extends HTMLElement {\r\n /**\r\n * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing.\r\n */\r\n autofocus: boolean;\r\n /**\r\n * Sets or retrieves the width of the object.\r\n */\r\n cols: number;\r\n /**\r\n * Sets or retrieves the initial contents of the object.\r\n */\r\n defaultValue: string;\r\n disabled: boolean;\r\n /**\r\n * Retrieves a reference to the form that the object is embedded in.\r\n */\r\n readonly form: HTMLFormElement;\r\n /**\r\n * Sets or retrieves the maximum number of characters that the user can enter in a text control.\r\n */\r\n maxLength: number;\r\n /**\r\n * Sets or retrieves the name of the object.\r\n */\r\n name: string;\r\n /**\r\n * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field.\r\n */\r\n placeholder: string;\r\n /**\r\n * Sets or retrieves the value indicated whether the content of the object is read-only.\r\n */\r\n readOnly: boolean;\r\n /**\r\n * When present, marks an element that can't be submitted without a value.\r\n */\r\n required: boolean;\r\n /**\r\n * Sets or retrieves the number of horizontal rows contained in the object.\r\n */\r\n rows: number;\r\n /**\r\n * Gets or sets the end position or offset of a text selection.\r\n */\r\n selectionEnd: number;\r\n /**\r\n * Gets or sets the starting position or offset of a text selection.\r\n */\r\n selectionStart: number;\r\n /**\r\n * Sets or retrieves the value indicating whether the control is selected.\r\n */\r\n status: any;\r\n /**\r\n * Retrieves the type of control.\r\n */\r\n readonly type: string;\r\n /**\r\n * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\r\n */\r\n readonly validationMessage: string;\r\n /**\r\n * Returns a ValidityState object that represents the validity states of an element.\r\n */\r\n readonly validity: ValidityState;\r\n /**\r\n * Retrieves or sets the text in the entry field of the textArea element.\r\n */\r\n value: string;\r\n /**\r\n * Returns whether an element will successfully validate based on forms validation rules and constraints.\r\n */\r\n readonly willValidate: boolean;\r\n /**\r\n * Sets or retrieves how to handle wordwrapping in the object.\r\n */\r\n wrap: string;\r\n minLength: number;\r\n /**\r\n * Returns whether a form will validate when it is submitted, without having to submit it.\r\n */\r\n checkValidity(): boolean;\r\n /**\r\n * Highlights the input area of a form element.\r\n */\r\n select(): void;\r\n /**\r\n * Sets a custom error message that is displayed when a form is submitted.\r\n * @param error Sets a custom error message that is displayed when a form is submitted.\r\n */\r\n setCustomValidity(error: string): void;\r\n /**\r\n * Sets the start and end positions of a selection in a text field.\r\n * @param start The offset into the text field for the start of the selection.\r\n * @param end The offset into the text field for the end of the selection.\r\n */\r\n setSelectionRange(start: number, end: number): void;\r\n}\r\n\r\ndeclare var HTMLTextAreaElement: {\r\n prototype: HTMLTextAreaElement;\r\n new(): HTMLTextAreaElement;\r\n}\r\n\r\ninterface HTMLTitleElement extends HTMLElement {\r\n /**\r\n * Retrieves or sets the text of the object as a string. \r\n */\r\n text: string;\r\n}\r\n\r\ndeclare var HTMLTitleElement: {\r\n prototype: HTMLTitleElement;\r\n new(): HTMLTitleElement;\r\n}\r\n\r\ninterface HTMLTrackElement extends HTMLElement {\r\n default: boolean;\r\n kind: string;\r\n label: string;\r\n readonly readyState: number;\r\n src: string;\r\n srclang: string;\r\n readonly track: TextTrack;\r\n readonly ERROR: number;\r\n readonly LOADED: number;\r\n readonly LOADING: number;\r\n readonly NONE: number;\r\n}\r\n\r\ndeclare var HTMLTrackElement: {\r\n prototype: HTMLTrackElement;\r\n new(): HTMLTrackElement;\r\n readonly ERROR: number;\r\n readonly LOADED: number;\r\n readonly LOADING: number;\r\n readonly NONE: number;\r\n}\r\n\r\ninterface HTMLUListElement extends HTMLElement {\r\n compact: boolean;\r\n type: string;\r\n}\r\n\r\ndeclare var HTMLUListElement: {\r\n prototype: HTMLUListElement;\r\n new(): HTMLUListElement;\r\n}\r\n\r\ninterface HTMLUnknownElement extends HTMLElement {\r\n}\r\n\r\ndeclare var HTMLUnknownElement: {\r\n prototype: HTMLUnknownElement;\r\n new(): HTMLUnknownElement;\r\n}\r\n\r\ninterface HTMLVideoElement extends HTMLMediaElement {\r\n /**\r\n * Gets or sets the height of the video element.\r\n */\r\n height: number;\r\n msHorizontalMirror: boolean;\r\n readonly msIsLayoutOptimalForPlayback: boolean;\r\n readonly msIsStereo3D: boolean;\r\n msStereo3DPackingMode: string;\r\n msStereo3DRenderMode: string;\r\n msZoom: boolean;\r\n onMSVideoFormatChanged: (this: this, ev: Event) => any;\r\n onMSVideoFrameStepCompleted: (this: this, ev: Event) => any;\r\n onMSVideoOptimalLayoutChanged: (this: this, ev: Event) => any;\r\n /**\r\n * 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.\r\n */\r\n poster: string;\r\n /**\r\n * Gets the intrinsic height of a video in CSS pixels, or zero if the dimensions are not known.\r\n */\r\n readonly videoHeight: number;\r\n /**\r\n * Gets the intrinsic width of a video in CSS pixels, or zero if the dimensions are not known.\r\n */\r\n readonly videoWidth: number;\r\n readonly webkitDisplayingFullscreen: boolean;\r\n readonly webkitSupportsFullscreen: boolean;\r\n /**\r\n * Gets or sets the width of the video element.\r\n */\r\n width: number;\r\n getVideoPlaybackQuality(): VideoPlaybackQuality;\r\n msFrameStep(forward: boolean): void;\r\n msInsertVideoEffect(activatableClassId: string, effectRequired: boolean, config?: any): void;\r\n msSetVideoRectangle(left: number, top: number, right: number, bottom: number): void;\r\n webkitEnterFullScreen(): void;\r\n webkitEnterFullscreen(): void;\r\n webkitExitFullScreen(): void;\r\n webkitExitFullscreen(): void;\r\n addEventListener(type: \"MSContentZoom\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureChange\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureDoubleTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureEnd\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureHold\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGotPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSInertiaStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSLostPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSManipulationStateChanged\", listener: (this: this, ev: MSManipulationEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerCancel\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerDown\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerEnter\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerLeave\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerMove\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOut\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOver\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerUp\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSVideoFormatChanged\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSVideoFrameStepCompleted\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSVideoOptimalLayoutChanged\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"abort\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"activate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ariarequest\", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforecopy\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforecut\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforedeactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforepaste\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"blur\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplay\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplaythrough\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"change\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"click\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"command\", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"contextmenu\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"copy\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"cuechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"cut\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dblclick\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"deactivate\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drag\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragend\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragenter\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragleave\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragover\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragstart\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drop\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"durationchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"emptied\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"encrypted\", listener: (this: this, ev: MediaEncryptedEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ended\", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"focus\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"gotpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"input\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"invalid\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keydown\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keypress\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keyup\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadeddata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadedmetadata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"lostpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousedown\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseenter\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseleave\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousemove\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseout\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseover\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseup\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousewheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"msneedkey\", listener: (this: this, ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"paste\", listener: (this: this, ev: ClipboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pause\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"play\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"playing\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointercancel\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerdown\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerenter\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerleave\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointermove\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerout\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerover\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerup\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"progress\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ratechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"reset\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"scroll\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeked\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeking\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"select\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"selectstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"stalled\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"submit\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"suspend\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"timeupdate\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchcancel\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchend\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchmove\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchstart\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"volumechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"waiting\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenerror\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"wheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var HTMLVideoElement: {\r\n prototype: HTMLVideoElement;\r\n new(): HTMLVideoElement;\r\n}\r\n\r\ninterface HashChangeEvent extends Event {\r\n readonly newURL: string | null;\r\n readonly oldURL: string | null;\r\n}\r\n\r\ndeclare var HashChangeEvent: {\r\n prototype: HashChangeEvent;\r\n new(type: string, eventInitDict?: HashChangeEventInit): HashChangeEvent;\r\n}\r\n\r\ninterface History {\r\n readonly length: number;\r\n readonly state: any;\r\n back(distance?: any): void;\r\n forward(distance?: any): void;\r\n go(delta?: any): void;\r\n pushState(statedata: any, title?: string, url?: string): void;\r\n replaceState(statedata: any, title?: string, url?: string): void;\r\n}\r\n\r\ndeclare var History: {\r\n prototype: History;\r\n new(): History;\r\n}\r\n\r\ninterface IDBCursor {\r\n readonly direction: string;\r\n key: IDBKeyRange | IDBValidKey;\r\n readonly primaryKey: any;\r\n source: IDBObjectStore | IDBIndex;\r\n advance(count: number): void;\r\n continue(key?: IDBKeyRange | IDBValidKey): void;\r\n delete(): IDBRequest;\r\n update(value: any): IDBRequest;\r\n readonly NEXT: string;\r\n readonly NEXT_NO_DUPLICATE: string;\r\n readonly PREV: string;\r\n readonly PREV_NO_DUPLICATE: string;\r\n}\r\n\r\ndeclare var IDBCursor: {\r\n prototype: IDBCursor;\r\n new(): IDBCursor;\r\n readonly NEXT: string;\r\n readonly NEXT_NO_DUPLICATE: string;\r\n readonly PREV: string;\r\n readonly PREV_NO_DUPLICATE: string;\r\n}\r\n\r\ninterface IDBCursorWithValue extends IDBCursor {\r\n readonly value: any;\r\n}\r\n\r\ndeclare var IDBCursorWithValue: {\r\n prototype: IDBCursorWithValue;\r\n new(): IDBCursorWithValue;\r\n}\r\n\r\ninterface IDBDatabase extends EventTarget {\r\n readonly name: string;\r\n readonly objectStoreNames: DOMStringList;\r\n onabort: (this: this, ev: Event) => any;\r\n onerror: (this: this, ev: ErrorEvent) => any;\r\n version: number;\r\n onversionchange: (ev: IDBVersionChangeEvent) => any;\r\n close(): void;\r\n createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore;\r\n deleteObjectStore(name: string): void;\r\n transaction(storeNames: string | string[], mode?: string): IDBTransaction;\r\n addEventListener(type: \"versionchange\", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"abort\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var IDBDatabase: {\r\n prototype: IDBDatabase;\r\n new(): IDBDatabase;\r\n}\r\n\r\ninterface IDBFactory {\r\n cmp(first: any, second: any): number;\r\n deleteDatabase(name: string): IDBOpenDBRequest;\r\n open(name: string, version?: number): IDBOpenDBRequest;\r\n}\r\n\r\ndeclare var IDBFactory: {\r\n prototype: IDBFactory;\r\n new(): IDBFactory;\r\n}\r\n\r\ninterface IDBIndex {\r\n keyPath: string | string[];\r\n readonly name: string;\r\n readonly objectStore: IDBObjectStore;\r\n readonly unique: boolean;\r\n multiEntry: boolean;\r\n count(key?: IDBKeyRange | IDBValidKey): IDBRequest;\r\n get(key: IDBKeyRange | IDBValidKey): IDBRequest;\r\n getKey(key: IDBKeyRange | IDBValidKey): IDBRequest;\r\n openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest;\r\n openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest;\r\n}\r\n\r\ndeclare var IDBIndex: {\r\n prototype: IDBIndex;\r\n new(): IDBIndex;\r\n}\r\n\r\ninterface IDBKeyRange {\r\n readonly lower: any;\r\n readonly lowerOpen: boolean;\r\n readonly upper: any;\r\n readonly upperOpen: boolean;\r\n}\r\n\r\ndeclare var IDBKeyRange: {\r\n prototype: IDBKeyRange;\r\n new(): IDBKeyRange;\r\n bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange;\r\n lowerBound(lower: any, open?: boolean): IDBKeyRange;\r\n only(value: any): IDBKeyRange;\r\n upperBound(upper: any, open?: boolean): IDBKeyRange;\r\n}\r\n\r\ninterface IDBObjectStore {\r\n readonly indexNames: DOMStringList;\r\n keyPath: string | string[];\r\n readonly name: string;\r\n readonly transaction: IDBTransaction;\r\n autoIncrement: boolean;\r\n add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest;\r\n clear(): IDBRequest;\r\n count(key?: IDBKeyRange | IDBValidKey): IDBRequest;\r\n createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex;\r\n delete(key: IDBKeyRange | IDBValidKey): IDBRequest;\r\n deleteIndex(indexName: string): void;\r\n get(key: any): IDBRequest;\r\n index(name: string): IDBIndex;\r\n openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest;\r\n put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest;\r\n}\r\n\r\ndeclare var IDBObjectStore: {\r\n prototype: IDBObjectStore;\r\n new(): IDBObjectStore;\r\n}\r\n\r\ninterface IDBOpenDBRequest extends IDBRequest {\r\n onblocked: (this: this, ev: Event) => any;\r\n onupgradeneeded: (this: this, ev: IDBVersionChangeEvent) => any;\r\n addEventListener(type: \"blocked\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"success\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"upgradeneeded\", listener: (this: this, ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var IDBOpenDBRequest: {\r\n prototype: IDBOpenDBRequest;\r\n new(): IDBOpenDBRequest;\r\n}\r\n\r\ninterface IDBRequest extends EventTarget {\r\n readonly error: DOMError;\r\n onerror: (this: this, ev: ErrorEvent) => any;\r\n onsuccess: (this: this, ev: Event) => any;\r\n readonly readyState: string;\r\n readonly result: any;\r\n source: IDBObjectStore | IDBIndex | IDBCursor;\r\n readonly transaction: IDBTransaction;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"success\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var IDBRequest: {\r\n prototype: IDBRequest;\r\n new(): IDBRequest;\r\n}\r\n\r\ninterface IDBTransaction extends EventTarget {\r\n readonly db: IDBDatabase;\r\n readonly error: DOMError;\r\n readonly mode: string;\r\n onabort: (this: this, ev: Event) => any;\r\n oncomplete: (this: this, ev: Event) => any;\r\n onerror: (this: this, ev: ErrorEvent) => any;\r\n abort(): void;\r\n objectStore(name: string): IDBObjectStore;\r\n readonly READ_ONLY: string;\r\n readonly READ_WRITE: string;\r\n readonly VERSION_CHANGE: string;\r\n addEventListener(type: \"abort\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"complete\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var IDBTransaction: {\r\n prototype: IDBTransaction;\r\n new(): IDBTransaction;\r\n readonly READ_ONLY: string;\r\n readonly READ_WRITE: string;\r\n readonly VERSION_CHANGE: string;\r\n}\r\n\r\ninterface IDBVersionChangeEvent extends Event {\r\n readonly newVersion: number | null;\r\n readonly oldVersion: number;\r\n}\r\n\r\ndeclare var IDBVersionChangeEvent: {\r\n prototype: IDBVersionChangeEvent;\r\n new(): IDBVersionChangeEvent;\r\n}\r\n\r\ninterface ImageData {\r\n data: Uint8ClampedArray;\r\n readonly height: number;\r\n readonly width: number;\r\n}\r\n\r\ndeclare var ImageData: {\r\n prototype: ImageData;\r\n new(width: number, height: number): ImageData;\r\n new(array: Uint8ClampedArray, width: number, height: number): ImageData;\r\n}\r\n\r\ninterface KeyboardEvent extends UIEvent {\r\n readonly altKey: boolean;\r\n readonly char: string | null;\r\n readonly charCode: number;\r\n readonly ctrlKey: boolean;\r\n readonly key: string;\r\n readonly keyCode: number;\r\n readonly locale: string;\r\n readonly location: number;\r\n readonly metaKey: boolean;\r\n readonly repeat: boolean;\r\n readonly shiftKey: boolean;\r\n readonly which: number;\r\n readonly code: string;\r\n getModifierState(keyArg: string): boolean;\r\n initKeyboardEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, keyArg: string, locationArg: number, modifiersListArg: string, repeat: boolean, locale: string): void;\r\n readonly DOM_KEY_LOCATION_JOYSTICK: number;\r\n readonly DOM_KEY_LOCATION_LEFT: number;\r\n readonly DOM_KEY_LOCATION_MOBILE: number;\r\n readonly DOM_KEY_LOCATION_NUMPAD: number;\r\n readonly DOM_KEY_LOCATION_RIGHT: number;\r\n readonly DOM_KEY_LOCATION_STANDARD: number;\r\n}\r\n\r\ndeclare var KeyboardEvent: {\r\n prototype: KeyboardEvent;\r\n new(typeArg: string, eventInitDict?: KeyboardEventInit): KeyboardEvent;\r\n readonly DOM_KEY_LOCATION_JOYSTICK: number;\r\n readonly DOM_KEY_LOCATION_LEFT: number;\r\n readonly DOM_KEY_LOCATION_MOBILE: number;\r\n readonly DOM_KEY_LOCATION_NUMPAD: number;\r\n readonly DOM_KEY_LOCATION_RIGHT: number;\r\n readonly DOM_KEY_LOCATION_STANDARD: number;\r\n}\r\n\r\ninterface ListeningStateChangedEvent extends Event {\r\n readonly label: string;\r\n readonly state: string;\r\n}\r\n\r\ndeclare var ListeningStateChangedEvent: {\r\n prototype: ListeningStateChangedEvent;\r\n new(): ListeningStateChangedEvent;\r\n}\r\n\r\ninterface Location {\r\n hash: string;\r\n host: string;\r\n hostname: string;\r\n href: string;\r\n readonly origin: string;\r\n pathname: string;\r\n port: string;\r\n protocol: string;\r\n search: string;\r\n assign(url: string): void;\r\n reload(forcedReload?: boolean): void;\r\n replace(url: string): void;\r\n toString(): string;\r\n}\r\n\r\ndeclare var Location: {\r\n prototype: Location;\r\n new(): Location;\r\n}\r\n\r\ninterface LongRunningScriptDetectedEvent extends Event {\r\n readonly executionTime: number;\r\n stopPageScriptExecution: boolean;\r\n}\r\n\r\ndeclare var LongRunningScriptDetectedEvent: {\r\n prototype: LongRunningScriptDetectedEvent;\r\n new(): LongRunningScriptDetectedEvent;\r\n}\r\n\r\ninterface MSApp {\r\n clearTemporaryWebDataAsync(): MSAppAsyncOperation;\r\n createBlobFromRandomAccessStream(type: string, seeker: any): Blob;\r\n createDataPackage(object: any): any;\r\n createDataPackageFromSelection(): any;\r\n createFileFromStorageFile(storageFile: any): File;\r\n createStreamFromInputStream(type: string, inputStream: any): MSStream;\r\n execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void;\r\n execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any;\r\n getCurrentPriority(): string;\r\n getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike;\r\n getViewId(view: any): any;\r\n isTaskScheduledAtPriorityOrHigher(priority: string): boolean;\r\n pageHandlesAllApplicationActivations(enabled: boolean): void;\r\n suppressSubdownloadCredentialPrompts(suppress: boolean): void;\r\n terminateApp(exceptionObject: any): void;\r\n readonly CURRENT: string;\r\n readonly HIGH: string;\r\n readonly IDLE: string;\r\n readonly NORMAL: string;\r\n}\r\ndeclare var MSApp: MSApp;\r\n\r\ninterface MSAppAsyncOperation extends EventTarget {\r\n readonly error: DOMError;\r\n oncomplete: (this: this, ev: Event) => any;\r\n onerror: (this: this, ev: ErrorEvent) => any;\r\n readonly readyState: number;\r\n readonly result: any;\r\n start(): void;\r\n readonly COMPLETED: number;\r\n readonly ERROR: number;\r\n readonly STARTED: number;\r\n addEventListener(type: \"complete\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var MSAppAsyncOperation: {\r\n prototype: MSAppAsyncOperation;\r\n new(): MSAppAsyncOperation;\r\n readonly COMPLETED: number;\r\n readonly ERROR: number;\r\n readonly STARTED: number;\r\n}\r\n\r\ninterface MSAssertion {\r\n readonly id: string;\r\n readonly type: string;\r\n}\r\n\r\ndeclare var MSAssertion: {\r\n prototype: MSAssertion;\r\n new(): MSAssertion;\r\n}\r\n\r\ninterface MSBlobBuilder {\r\n append(data: any, endings?: string): void;\r\n getBlob(contentType?: string): Blob;\r\n}\r\n\r\ndeclare var MSBlobBuilder: {\r\n prototype: MSBlobBuilder;\r\n new(): MSBlobBuilder;\r\n}\r\n\r\ninterface MSCredentials {\r\n getAssertion(challenge: string, filter?: MSCredentialFilter, params?: MSSignatureParameters): PromiseLike;\r\n makeCredential(accountInfo: MSAccountInfo, params: MSCredentialParameters[], challenge?: string): PromiseLike;\r\n}\r\n\r\ndeclare var MSCredentials: {\r\n prototype: MSCredentials;\r\n new(): MSCredentials;\r\n}\r\n\r\ninterface MSFIDOCredentialAssertion extends MSAssertion {\r\n readonly algorithm: string | Algorithm;\r\n readonly attestation: any;\r\n readonly publicKey: string;\r\n readonly transportHints: string[];\r\n}\r\n\r\ndeclare var MSFIDOCredentialAssertion: {\r\n prototype: MSFIDOCredentialAssertion;\r\n new(): MSFIDOCredentialAssertion;\r\n}\r\n\r\ninterface MSFIDOSignature {\r\n readonly authnrData: string;\r\n readonly clientData: string;\r\n readonly signature: string;\r\n}\r\n\r\ndeclare var MSFIDOSignature: {\r\n prototype: MSFIDOSignature;\r\n new(): MSFIDOSignature;\r\n}\r\n\r\ninterface MSFIDOSignatureAssertion extends MSAssertion {\r\n readonly signature: MSFIDOSignature;\r\n}\r\n\r\ndeclare var MSFIDOSignatureAssertion: {\r\n prototype: MSFIDOSignatureAssertion;\r\n new(): MSFIDOSignatureAssertion;\r\n}\r\n\r\ninterface MSGesture {\r\n target: Element;\r\n addPointer(pointerId: number): void;\r\n stop(): void;\r\n}\r\n\r\ndeclare var MSGesture: {\r\n prototype: MSGesture;\r\n new(): MSGesture;\r\n}\r\n\r\ninterface MSGestureEvent extends UIEvent {\r\n readonly clientX: number;\r\n readonly clientY: number;\r\n readonly expansion: number;\r\n readonly gestureObject: any;\r\n readonly hwTimestamp: number;\r\n readonly offsetX: number;\r\n readonly offsetY: number;\r\n readonly rotation: number;\r\n readonly scale: number;\r\n readonly screenX: number;\r\n readonly screenY: number;\r\n readonly translationX: number;\r\n readonly translationY: number;\r\n readonly velocityAngular: number;\r\n readonly velocityExpansion: number;\r\n readonly velocityX: number;\r\n readonly velocityY: number;\r\n initGestureEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, offsetXArg: number, offsetYArg: number, translationXArg: number, translationYArg: number, scaleArg: number, expansionArg: number, rotationArg: number, velocityXArg: number, velocityYArg: number, velocityExpansionArg: number, velocityAngularArg: number, hwTimestampArg: number): void;\r\n readonly MSGESTURE_FLAG_BEGIN: number;\r\n readonly MSGESTURE_FLAG_CANCEL: number;\r\n readonly MSGESTURE_FLAG_END: number;\r\n readonly MSGESTURE_FLAG_INERTIA: number;\r\n readonly MSGESTURE_FLAG_NONE: number;\r\n}\r\n\r\ndeclare var MSGestureEvent: {\r\n prototype: MSGestureEvent;\r\n new(): MSGestureEvent;\r\n readonly MSGESTURE_FLAG_BEGIN: number;\r\n readonly MSGESTURE_FLAG_CANCEL: number;\r\n readonly MSGESTURE_FLAG_END: number;\r\n readonly MSGESTURE_FLAG_INERTIA: number;\r\n readonly MSGESTURE_FLAG_NONE: number;\r\n}\r\n\r\ninterface MSGraphicsTrust {\r\n readonly constrictionActive: boolean;\r\n readonly status: string;\r\n}\r\n\r\ndeclare var MSGraphicsTrust: {\r\n prototype: MSGraphicsTrust;\r\n new(): MSGraphicsTrust;\r\n}\r\n\r\ninterface MSHTMLWebViewElement extends HTMLElement {\r\n readonly canGoBack: boolean;\r\n readonly canGoForward: boolean;\r\n readonly containsFullScreenElement: boolean;\r\n readonly documentTitle: string;\r\n height: number;\r\n readonly settings: MSWebViewSettings;\r\n src: string;\r\n width: number;\r\n addWebAllowedObject(name: string, applicationObject: any): void;\r\n buildLocalStreamUri(contentIdentifier: string, relativePath: string): string;\r\n capturePreviewToBlobAsync(): MSWebViewAsyncOperation;\r\n captureSelectedContentToDataPackageAsync(): MSWebViewAsyncOperation;\r\n getDeferredPermissionRequestById(id: number): DeferredPermissionRequest;\r\n getDeferredPermissionRequests(): DeferredPermissionRequest[];\r\n goBack(): void;\r\n goForward(): void;\r\n invokeScriptAsync(scriptName: string, ...args: any[]): MSWebViewAsyncOperation;\r\n navigate(uri: string): void;\r\n navigateToLocalStreamUri(source: string, streamResolver: any): void;\r\n navigateToString(contents: string): void;\r\n navigateWithHttpRequestMessage(requestMessage: any): void;\r\n refresh(): void;\r\n stop(): void;\r\n}\r\n\r\ndeclare var MSHTMLWebViewElement: {\r\n prototype: MSHTMLWebViewElement;\r\n new(): MSHTMLWebViewElement;\r\n}\r\n\r\ninterface MSInputMethodContext extends EventTarget {\r\n readonly compositionEndOffset: number;\r\n readonly compositionStartOffset: number;\r\n oncandidatewindowhide: (this: this, ev: Event) => any;\r\n oncandidatewindowshow: (this: this, ev: Event) => any;\r\n oncandidatewindowupdate: (this: this, ev: Event) => any;\r\n readonly target: HTMLElement;\r\n getCandidateWindowClientRect(): ClientRect;\r\n getCompositionAlternatives(): string[];\r\n hasComposition(): boolean;\r\n isCandidateWindowVisible(): boolean;\r\n addEventListener(type: \"MSCandidateWindowHide\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSCandidateWindowShow\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSCandidateWindowUpdate\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var MSInputMethodContext: {\r\n prototype: MSInputMethodContext;\r\n new(): MSInputMethodContext;\r\n}\r\n\r\ninterface MSManipulationEvent extends UIEvent {\r\n readonly currentState: number;\r\n readonly inertiaDestinationX: number;\r\n readonly inertiaDestinationY: number;\r\n readonly lastState: number;\r\n initMSManipulationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, lastState: number, currentState: number): void;\r\n readonly MS_MANIPULATION_STATE_ACTIVE: number;\r\n readonly MS_MANIPULATION_STATE_CANCELLED: number;\r\n readonly MS_MANIPULATION_STATE_COMMITTED: number;\r\n readonly MS_MANIPULATION_STATE_DRAGGING: number;\r\n readonly MS_MANIPULATION_STATE_INERTIA: number;\r\n readonly MS_MANIPULATION_STATE_PRESELECT: number;\r\n readonly MS_MANIPULATION_STATE_SELECTING: number;\r\n readonly MS_MANIPULATION_STATE_STOPPED: number;\r\n}\r\n\r\ndeclare var MSManipulationEvent: {\r\n prototype: MSManipulationEvent;\r\n new(): MSManipulationEvent;\r\n readonly MS_MANIPULATION_STATE_ACTIVE: number;\r\n readonly MS_MANIPULATION_STATE_CANCELLED: number;\r\n readonly MS_MANIPULATION_STATE_COMMITTED: number;\r\n readonly MS_MANIPULATION_STATE_DRAGGING: number;\r\n readonly MS_MANIPULATION_STATE_INERTIA: number;\r\n readonly MS_MANIPULATION_STATE_PRESELECT: number;\r\n readonly MS_MANIPULATION_STATE_SELECTING: number;\r\n readonly MS_MANIPULATION_STATE_STOPPED: number;\r\n}\r\n\r\ninterface MSMediaKeyError {\r\n readonly code: number;\r\n readonly systemCode: number;\r\n readonly MS_MEDIA_KEYERR_CLIENT: number;\r\n readonly MS_MEDIA_KEYERR_DOMAIN: number;\r\n readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number;\r\n readonly MS_MEDIA_KEYERR_OUTPUT: number;\r\n readonly MS_MEDIA_KEYERR_SERVICE: number;\r\n readonly MS_MEDIA_KEYERR_UNKNOWN: number;\r\n}\r\n\r\ndeclare var MSMediaKeyError: {\r\n prototype: MSMediaKeyError;\r\n new(): MSMediaKeyError;\r\n readonly MS_MEDIA_KEYERR_CLIENT: number;\r\n readonly MS_MEDIA_KEYERR_DOMAIN: number;\r\n readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number;\r\n readonly MS_MEDIA_KEYERR_OUTPUT: number;\r\n readonly MS_MEDIA_KEYERR_SERVICE: number;\r\n readonly MS_MEDIA_KEYERR_UNKNOWN: number;\r\n}\r\n\r\ninterface MSMediaKeyMessageEvent extends Event {\r\n readonly destinationURL: string | null;\r\n readonly message: Uint8Array;\r\n}\r\n\r\ndeclare var MSMediaKeyMessageEvent: {\r\n prototype: MSMediaKeyMessageEvent;\r\n new(): MSMediaKeyMessageEvent;\r\n}\r\n\r\ninterface MSMediaKeyNeededEvent extends Event {\r\n readonly initData: Uint8Array | null;\r\n}\r\n\r\ndeclare var MSMediaKeyNeededEvent: {\r\n prototype: MSMediaKeyNeededEvent;\r\n new(): MSMediaKeyNeededEvent;\r\n}\r\n\r\ninterface MSMediaKeySession extends EventTarget {\r\n readonly error: MSMediaKeyError | null;\r\n readonly keySystem: string;\r\n readonly sessionId: string;\r\n close(): void;\r\n update(key: Uint8Array): void;\r\n}\r\n\r\ndeclare var MSMediaKeySession: {\r\n prototype: MSMediaKeySession;\r\n new(): MSMediaKeySession;\r\n}\r\n\r\ninterface MSMediaKeys {\r\n readonly keySystem: string;\r\n createSession(type: string, initData: Uint8Array, cdmData?: Uint8Array): MSMediaKeySession;\r\n}\r\n\r\ndeclare var MSMediaKeys: {\r\n prototype: MSMediaKeys;\r\n new(keySystem: string): MSMediaKeys;\r\n isTypeSupported(keySystem: string, type?: string): boolean;\r\n isTypeSupportedWithFeatures(keySystem: string, type?: string): string;\r\n}\r\n\r\ninterface MSPointerEvent extends MouseEvent {\r\n readonly currentPoint: any;\r\n readonly height: number;\r\n readonly hwTimestamp: number;\r\n readonly intermediatePoints: any;\r\n readonly isPrimary: boolean;\r\n readonly pointerId: number;\r\n readonly pointerType: any;\r\n readonly pressure: number;\r\n readonly rotation: number;\r\n readonly tiltX: number;\r\n readonly tiltY: number;\r\n readonly width: number;\r\n getCurrentPoint(element: Element): void;\r\n getIntermediatePoints(element: Element): void;\r\n initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void;\r\n}\r\n\r\ndeclare var MSPointerEvent: {\r\n prototype: MSPointerEvent;\r\n new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent;\r\n}\r\n\r\ninterface MSRangeCollection {\r\n readonly length: number;\r\n item(index: number): Range;\r\n [index: number]: Range;\r\n}\r\n\r\ndeclare var MSRangeCollection: {\r\n prototype: MSRangeCollection;\r\n new(): MSRangeCollection;\r\n}\r\n\r\ninterface MSSiteModeEvent extends Event {\r\n readonly actionURL: string;\r\n readonly buttonID: number;\r\n}\r\n\r\ndeclare var MSSiteModeEvent: {\r\n prototype: MSSiteModeEvent;\r\n new(): MSSiteModeEvent;\r\n}\r\n\r\ninterface MSStream {\r\n readonly type: string;\r\n msClose(): void;\r\n msDetachStream(): any;\r\n}\r\n\r\ndeclare var MSStream: {\r\n prototype: MSStream;\r\n new(): MSStream;\r\n}\r\n\r\ninterface MSStreamReader extends EventTarget, MSBaseReader {\r\n readonly error: DOMError;\r\n readAsArrayBuffer(stream: MSStream, size?: number): void;\r\n readAsBinaryString(stream: MSStream, size?: number): void;\r\n readAsBlob(stream: MSStream, size?: number): void;\r\n readAsDataURL(stream: MSStream, size?: number): void;\r\n readAsText(stream: MSStream, encoding?: string, size?: number): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var MSStreamReader: {\r\n prototype: MSStreamReader;\r\n new(): MSStreamReader;\r\n}\r\n\r\ninterface MSWebViewAsyncOperation extends EventTarget {\r\n readonly error: DOMError;\r\n oncomplete: (this: this, ev: Event) => any;\r\n onerror: (this: this, ev: ErrorEvent) => any;\r\n readonly readyState: number;\r\n readonly result: any;\r\n readonly target: MSHTMLWebViewElement;\r\n readonly type: number;\r\n start(): void;\r\n readonly COMPLETED: number;\r\n readonly ERROR: number;\r\n readonly STARTED: number;\r\n readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number;\r\n readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number;\r\n readonly TYPE_INVOKE_SCRIPT: number;\r\n addEventListener(type: \"complete\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var MSWebViewAsyncOperation: {\r\n prototype: MSWebViewAsyncOperation;\r\n new(): MSWebViewAsyncOperation;\r\n readonly COMPLETED: number;\r\n readonly ERROR: number;\r\n readonly STARTED: number;\r\n readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number;\r\n readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number;\r\n readonly TYPE_INVOKE_SCRIPT: number;\r\n}\r\n\r\ninterface MSWebViewSettings {\r\n isIndexedDBEnabled: boolean;\r\n isJavaScriptEnabled: boolean;\r\n}\r\n\r\ndeclare var MSWebViewSettings: {\r\n prototype: MSWebViewSettings;\r\n new(): MSWebViewSettings;\r\n}\r\n\r\ninterface MediaDeviceInfo {\r\n readonly deviceId: string;\r\n readonly groupId: string;\r\n readonly kind: string;\r\n readonly label: string;\r\n}\r\n\r\ndeclare var MediaDeviceInfo: {\r\n prototype: MediaDeviceInfo;\r\n new(): MediaDeviceInfo;\r\n}\r\n\r\ninterface MediaDevices extends EventTarget {\r\n ondevicechange: (this: this, ev: Event) => any;\r\n enumerateDevices(): any;\r\n getSupportedConstraints(): MediaTrackSupportedConstraints;\r\n getUserMedia(constraints: MediaStreamConstraints): PromiseLike;\r\n addEventListener(type: \"devicechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var MediaDevices: {\r\n prototype: MediaDevices;\r\n new(): MediaDevices;\r\n}\r\n\r\ninterface MediaElementAudioSourceNode extends AudioNode {\r\n}\r\n\r\ndeclare var MediaElementAudioSourceNode: {\r\n prototype: MediaElementAudioSourceNode;\r\n new(): MediaElementAudioSourceNode;\r\n}\r\n\r\ninterface MediaEncryptedEvent extends Event {\r\n readonly initData: ArrayBuffer | null;\r\n readonly initDataType: string;\r\n}\r\n\r\ndeclare var MediaEncryptedEvent: {\r\n prototype: MediaEncryptedEvent;\r\n new(type: string, eventInitDict?: MediaEncryptedEventInit): MediaEncryptedEvent;\r\n}\r\n\r\ninterface MediaError {\r\n readonly code: number;\r\n readonly msExtendedCode: number;\r\n readonly MEDIA_ERR_ABORTED: number;\r\n readonly MEDIA_ERR_DECODE: number;\r\n readonly MEDIA_ERR_NETWORK: number;\r\n readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number;\r\n readonly MS_MEDIA_ERR_ENCRYPTED: number;\r\n}\r\n\r\ndeclare var MediaError: {\r\n prototype: MediaError;\r\n new(): MediaError;\r\n readonly MEDIA_ERR_ABORTED: number;\r\n readonly MEDIA_ERR_DECODE: number;\r\n readonly MEDIA_ERR_NETWORK: number;\r\n readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number;\r\n readonly MS_MEDIA_ERR_ENCRYPTED: number;\r\n}\r\n\r\ninterface MediaKeyMessageEvent extends Event {\r\n readonly message: ArrayBuffer;\r\n readonly messageType: string;\r\n}\r\n\r\ndeclare var MediaKeyMessageEvent: {\r\n prototype: MediaKeyMessageEvent;\r\n new(type: string, eventInitDict?: MediaKeyMessageEventInit): MediaKeyMessageEvent;\r\n}\r\n\r\ninterface MediaKeySession extends EventTarget {\r\n readonly closed: PromiseLike;\r\n readonly expiration: number;\r\n readonly keyStatuses: MediaKeyStatusMap;\r\n readonly sessionId: string;\r\n close(): PromiseLike;\r\n generateRequest(initDataType: string, initData: any): PromiseLike;\r\n load(sessionId: string): PromiseLike;\r\n remove(): PromiseLike;\r\n update(response: any): PromiseLike;\r\n}\r\n\r\ndeclare var MediaKeySession: {\r\n prototype: MediaKeySession;\r\n new(): MediaKeySession;\r\n}\r\n\r\ninterface MediaKeyStatusMap {\r\n readonly size: number;\r\n forEach(callback: ForEachCallback): void;\r\n get(keyId: any): string;\r\n has(keyId: any): boolean;\r\n}\r\n\r\ndeclare var MediaKeyStatusMap: {\r\n prototype: MediaKeyStatusMap;\r\n new(): MediaKeyStatusMap;\r\n}\r\n\r\ninterface MediaKeySystemAccess {\r\n readonly keySystem: string;\r\n createMediaKeys(): PromiseLike;\r\n getConfiguration(): MediaKeySystemConfiguration;\r\n}\r\n\r\ndeclare var MediaKeySystemAccess: {\r\n prototype: MediaKeySystemAccess;\r\n new(): MediaKeySystemAccess;\r\n}\r\n\r\ninterface MediaKeys {\r\n createSession(sessionType?: string): MediaKeySession;\r\n setServerCertificate(serverCertificate: any): PromiseLike;\r\n}\r\n\r\ndeclare var MediaKeys: {\r\n prototype: MediaKeys;\r\n new(): MediaKeys;\r\n}\r\n\r\ninterface MediaList {\r\n readonly length: number;\r\n mediaText: string;\r\n appendMedium(newMedium: string): void;\r\n deleteMedium(oldMedium: string): void;\r\n item(index: number): string;\r\n toString(): string;\r\n [index: number]: string;\r\n}\r\n\r\ndeclare var MediaList: {\r\n prototype: MediaList;\r\n new(): MediaList;\r\n}\r\n\r\ninterface MediaQueryList {\r\n readonly matches: boolean;\r\n readonly media: string;\r\n addListener(listener: MediaQueryListListener): void;\r\n removeListener(listener: MediaQueryListListener): void;\r\n}\r\n\r\ndeclare var MediaQueryList: {\r\n prototype: MediaQueryList;\r\n new(): MediaQueryList;\r\n}\r\n\r\ninterface MediaSource extends EventTarget {\r\n readonly activeSourceBuffers: SourceBufferList;\r\n duration: number;\r\n readonly readyState: string;\r\n readonly sourceBuffers: SourceBufferList;\r\n addSourceBuffer(type: string): SourceBuffer;\r\n endOfStream(error?: number): void;\r\n removeSourceBuffer(sourceBuffer: SourceBuffer): void;\r\n}\r\n\r\ndeclare var MediaSource: {\r\n prototype: MediaSource;\r\n new(): MediaSource;\r\n isTypeSupported(type: string): boolean;\r\n}\r\n\r\ninterface MediaStream extends EventTarget {\r\n readonly active: boolean;\r\n readonly id: string;\r\n onactive: (this: this, ev: Event) => any;\r\n onaddtrack: (this: this, ev: TrackEvent) => any;\r\n oninactive: (this: this, ev: Event) => any;\r\n onremovetrack: (this: this, ev: TrackEvent) => any;\r\n addTrack(track: MediaStreamTrack): void;\r\n clone(): MediaStream;\r\n getAudioTracks(): MediaStreamTrack[];\r\n getTrackById(trackId: string): MediaStreamTrack | null;\r\n getTracks(): MediaStreamTrack[];\r\n getVideoTracks(): MediaStreamTrack[];\r\n removeTrack(track: MediaStreamTrack): void;\r\n stop(): void;\r\n addEventListener(type: \"active\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"addtrack\", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"inactive\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"removetrack\", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var MediaStream: {\r\n prototype: MediaStream;\r\n new(streamOrTracks?: MediaStream | MediaStreamTrack[]): MediaStream;\r\n}\r\n\r\ninterface MediaStreamAudioSourceNode extends AudioNode {\r\n}\r\n\r\ndeclare var MediaStreamAudioSourceNode: {\r\n prototype: MediaStreamAudioSourceNode;\r\n new(): MediaStreamAudioSourceNode;\r\n}\r\n\r\ninterface MediaStreamError {\r\n readonly constraintName: string | null;\r\n readonly message: string | null;\r\n readonly name: string;\r\n}\r\n\r\ndeclare var MediaStreamError: {\r\n prototype: MediaStreamError;\r\n new(): MediaStreamError;\r\n}\r\n\r\ninterface MediaStreamErrorEvent extends Event {\r\n readonly error: MediaStreamError | null;\r\n}\r\n\r\ndeclare var MediaStreamErrorEvent: {\r\n prototype: MediaStreamErrorEvent;\r\n new(type: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent;\r\n}\r\n\r\ninterface MediaStreamTrack extends EventTarget {\r\n enabled: boolean;\r\n readonly id: string;\r\n readonly kind: string;\r\n readonly label: string;\r\n readonly muted: boolean;\r\n onended: (this: this, ev: MediaStreamErrorEvent) => any;\r\n onmute: (this: this, ev: Event) => any;\r\n onoverconstrained: (this: this, ev: MediaStreamErrorEvent) => any;\r\n onunmute: (this: this, ev: Event) => any;\r\n readonly readonly: boolean;\r\n readonly readyState: string;\r\n readonly remote: boolean;\r\n applyConstraints(constraints: MediaTrackConstraints): PromiseLike;\r\n clone(): MediaStreamTrack;\r\n getCapabilities(): MediaTrackCapabilities;\r\n getConstraints(): MediaTrackConstraints;\r\n getSettings(): MediaTrackSettings;\r\n stop(): void;\r\n addEventListener(type: \"ended\", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mute\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"overconstrained\", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"unmute\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var MediaStreamTrack: {\r\n prototype: MediaStreamTrack;\r\n new(): MediaStreamTrack;\r\n}\r\n\r\ninterface MediaStreamTrackEvent extends Event {\r\n readonly track: MediaStreamTrack;\r\n}\r\n\r\ndeclare var MediaStreamTrackEvent: {\r\n prototype: MediaStreamTrackEvent;\r\n new(type: string, eventInitDict?: MediaStreamTrackEventInit): MediaStreamTrackEvent;\r\n}\r\n\r\ninterface MessageChannel {\r\n readonly port1: MessagePort;\r\n readonly port2: MessagePort;\r\n}\r\n\r\ndeclare var MessageChannel: {\r\n prototype: MessageChannel;\r\n new(): MessageChannel;\r\n}\r\n\r\ninterface MessageEvent extends Event {\r\n readonly data: any;\r\n readonly origin: string;\r\n readonly ports: any;\r\n readonly source: Window;\r\n initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: Window): void;\r\n}\r\n\r\ndeclare var MessageEvent: {\r\n prototype: MessageEvent;\r\n new(type: string, eventInitDict?: MessageEventInit): MessageEvent;\r\n}\r\n\r\ninterface MessagePort extends EventTarget {\r\n onmessage: (this: this, ev: MessageEvent) => any;\r\n close(): void;\r\n postMessage(message?: any, ports?: any): void;\r\n start(): void;\r\n addEventListener(type: \"message\", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var MessagePort: {\r\n prototype: MessagePort;\r\n new(): MessagePort;\r\n}\r\n\r\ninterface MimeType {\r\n readonly description: string;\r\n readonly enabledPlugin: Plugin;\r\n readonly suffixes: string;\r\n readonly type: string;\r\n}\r\n\r\ndeclare var MimeType: {\r\n prototype: MimeType;\r\n new(): MimeType;\r\n}\r\n\r\ninterface MimeTypeArray {\r\n readonly length: number;\r\n item(index: number): Plugin;\r\n namedItem(type: string): Plugin;\r\n [index: number]: Plugin;\r\n}\r\n\r\ndeclare var MimeTypeArray: {\r\n prototype: MimeTypeArray;\r\n new(): MimeTypeArray;\r\n}\r\n\r\ninterface MouseEvent extends UIEvent {\r\n readonly altKey: boolean;\r\n readonly button: number;\r\n readonly buttons: number;\r\n readonly clientX: number;\r\n readonly clientY: number;\r\n readonly ctrlKey: boolean;\r\n readonly fromElement: Element;\r\n readonly layerX: number;\r\n readonly layerY: number;\r\n readonly metaKey: boolean;\r\n readonly movementX: number;\r\n readonly movementY: number;\r\n readonly offsetX: number;\r\n readonly offsetY: number;\r\n readonly pageX: number;\r\n readonly pageY: number;\r\n readonly relatedTarget: EventTarget;\r\n readonly screenX: number;\r\n readonly screenY: number;\r\n readonly shiftKey: boolean;\r\n readonly toElement: Element;\r\n readonly which: number;\r\n readonly x: number;\r\n readonly y: number;\r\n getModifierState(keyArg: string): boolean;\r\n initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget): void;\r\n}\r\n\r\ndeclare var MouseEvent: {\r\n prototype: MouseEvent;\r\n new(typeArg: string, eventInitDict?: MouseEventInit): MouseEvent;\r\n}\r\n\r\ninterface MutationEvent extends Event {\r\n readonly attrChange: number;\r\n readonly attrName: string;\r\n readonly newValue: string;\r\n readonly prevValue: string;\r\n readonly relatedNode: Node;\r\n initMutationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, relatedNodeArg: Node, prevValueArg: string, newValueArg: string, attrNameArg: string, attrChangeArg: number): void;\r\n readonly ADDITION: number;\r\n readonly MODIFICATION: number;\r\n readonly REMOVAL: number;\r\n}\r\n\r\ndeclare var MutationEvent: {\r\n prototype: MutationEvent;\r\n new(): MutationEvent;\r\n readonly ADDITION: number;\r\n readonly MODIFICATION: number;\r\n readonly REMOVAL: number;\r\n}\r\n\r\ninterface MutationObserver {\r\n disconnect(): void;\r\n observe(target: Node, options: MutationObserverInit): void;\r\n takeRecords(): MutationRecord[];\r\n}\r\n\r\ndeclare var MutationObserver: {\r\n prototype: MutationObserver;\r\n new(callback: MutationCallback): MutationObserver;\r\n}\r\n\r\ninterface MutationRecord {\r\n readonly addedNodes: NodeList;\r\n readonly attributeName: string | null;\r\n readonly attributeNamespace: string | null;\r\n readonly nextSibling: Node | null;\r\n readonly oldValue: string | null;\r\n readonly previousSibling: Node | null;\r\n readonly removedNodes: NodeList;\r\n readonly target: Node;\r\n readonly type: string;\r\n}\r\n\r\ndeclare var MutationRecord: {\r\n prototype: MutationRecord;\r\n new(): MutationRecord;\r\n}\r\n\r\ninterface NamedNodeMap {\r\n readonly length: number;\r\n getNamedItem(name: string): Attr;\r\n getNamedItemNS(namespaceURI: string | null, localName: string | null): Attr;\r\n item(index: number): Attr;\r\n removeNamedItem(name: string): Attr;\r\n removeNamedItemNS(namespaceURI: string | null, localName: string | null): Attr;\r\n setNamedItem(arg: Attr): Attr;\r\n setNamedItemNS(arg: Attr): Attr;\r\n [index: number]: Attr;\r\n}\r\n\r\ndeclare var NamedNodeMap: {\r\n prototype: NamedNodeMap;\r\n new(): NamedNodeMap;\r\n}\r\n\r\ninterface NavigationCompletedEvent extends NavigationEvent {\r\n readonly isSuccess: boolean;\r\n readonly webErrorStatus: number;\r\n}\r\n\r\ndeclare var NavigationCompletedEvent: {\r\n prototype: NavigationCompletedEvent;\r\n new(): NavigationCompletedEvent;\r\n}\r\n\r\ninterface NavigationEvent extends Event {\r\n readonly uri: string;\r\n}\r\n\r\ndeclare var NavigationEvent: {\r\n prototype: NavigationEvent;\r\n new(): NavigationEvent;\r\n}\r\n\r\ninterface NavigationEventWithReferrer extends NavigationEvent {\r\n readonly referer: string;\r\n}\r\n\r\ndeclare var NavigationEventWithReferrer: {\r\n prototype: NavigationEventWithReferrer;\r\n new(): NavigationEventWithReferrer;\r\n}\r\n\r\ninterface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver, NavigatorUserMedia {\r\n readonly appCodeName: string;\r\n readonly cookieEnabled: boolean;\r\n readonly language: string;\r\n readonly maxTouchPoints: number;\r\n readonly mimeTypes: MimeTypeArray;\r\n readonly msManipulationViewsEnabled: boolean;\r\n readonly msMaxTouchPoints: number;\r\n readonly msPointerEnabled: boolean;\r\n readonly plugins: PluginArray;\r\n readonly pointerEnabled: boolean;\r\n readonly webdriver: boolean;\r\n getGamepads(): Gamepad[];\r\n javaEnabled(): boolean;\r\n msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void;\r\n requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): PromiseLike;\r\n vibrate(pattern: number | number[]): boolean;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var Navigator: {\r\n prototype: Navigator;\r\n new(): Navigator;\r\n}\r\n\r\ninterface Node extends EventTarget {\r\n readonly attributes: NamedNodeMap;\r\n readonly baseURI: string | null;\r\n readonly childNodes: NodeList;\r\n readonly firstChild: Node;\r\n readonly lastChild: Node;\r\n readonly localName: string | null;\r\n readonly namespaceURI: string | null;\r\n readonly nextSibling: Node;\r\n readonly nodeName: string;\r\n readonly nodeType: number;\r\n nodeValue: string | null;\r\n readonly ownerDocument: Document;\r\n readonly parentElement: HTMLElement;\r\n readonly parentNode: Node;\r\n readonly previousSibling: Node;\r\n textContent: string | null;\r\n appendChild(newChild: Node): Node;\r\n cloneNode(deep?: boolean): Node;\r\n compareDocumentPosition(other: Node): number;\r\n contains(child: Node): boolean;\r\n hasAttributes(): boolean;\r\n hasChildNodes(): boolean;\r\n insertBefore(newChild: Node, refChild: Node | null): Node;\r\n isDefaultNamespace(namespaceURI: string | null): boolean;\r\n isEqualNode(arg: Node): boolean;\r\n isSameNode(other: Node): boolean;\r\n lookupNamespaceURI(prefix: string | null): string | null;\r\n lookupPrefix(namespaceURI: string | null): string | null;\r\n normalize(): void;\r\n removeChild(oldChild: Node): Node;\r\n replaceChild(newChild: Node, oldChild: Node): Node;\r\n readonly ATTRIBUTE_NODE: number;\r\n readonly CDATA_SECTION_NODE: number;\r\n readonly COMMENT_NODE: number;\r\n readonly DOCUMENT_FRAGMENT_NODE: number;\r\n readonly DOCUMENT_NODE: number;\r\n readonly DOCUMENT_POSITION_CONTAINED_BY: number;\r\n readonly DOCUMENT_POSITION_CONTAINS: number;\r\n readonly DOCUMENT_POSITION_DISCONNECTED: number;\r\n readonly DOCUMENT_POSITION_FOLLOWING: number;\r\n readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number;\r\n readonly DOCUMENT_POSITION_PRECEDING: number;\r\n readonly DOCUMENT_TYPE_NODE: number;\r\n readonly ELEMENT_NODE: number;\r\n readonly ENTITY_NODE: number;\r\n readonly ENTITY_REFERENCE_NODE: number;\r\n readonly NOTATION_NODE: number;\r\n readonly PROCESSING_INSTRUCTION_NODE: number;\r\n readonly TEXT_NODE: number;\r\n}\r\n\r\ndeclare var Node: {\r\n prototype: Node;\r\n new(): Node;\r\n readonly ATTRIBUTE_NODE: number;\r\n readonly CDATA_SECTION_NODE: number;\r\n readonly COMMENT_NODE: number;\r\n readonly DOCUMENT_FRAGMENT_NODE: number;\r\n readonly DOCUMENT_NODE: number;\r\n readonly DOCUMENT_POSITION_CONTAINED_BY: number;\r\n readonly DOCUMENT_POSITION_CONTAINS: number;\r\n readonly DOCUMENT_POSITION_DISCONNECTED: number;\r\n readonly DOCUMENT_POSITION_FOLLOWING: number;\r\n readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number;\r\n readonly DOCUMENT_POSITION_PRECEDING: number;\r\n readonly DOCUMENT_TYPE_NODE: number;\r\n readonly ELEMENT_NODE: number;\r\n readonly ENTITY_NODE: number;\r\n readonly ENTITY_REFERENCE_NODE: number;\r\n readonly NOTATION_NODE: number;\r\n readonly PROCESSING_INSTRUCTION_NODE: number;\r\n readonly TEXT_NODE: number;\r\n}\r\n\r\ninterface NodeFilter {\r\n acceptNode(n: Node): number;\r\n}\r\n\r\ndeclare var NodeFilter: {\r\n readonly FILTER_ACCEPT: number;\r\n readonly FILTER_REJECT: number;\r\n readonly FILTER_SKIP: number;\r\n readonly SHOW_ALL: number;\r\n readonly SHOW_ATTRIBUTE: number;\r\n readonly SHOW_CDATA_SECTION: number;\r\n readonly SHOW_COMMENT: number;\r\n readonly SHOW_DOCUMENT: number;\r\n readonly SHOW_DOCUMENT_FRAGMENT: number;\r\n readonly SHOW_DOCUMENT_TYPE: number;\r\n readonly SHOW_ELEMENT: number;\r\n readonly SHOW_ENTITY: number;\r\n readonly SHOW_ENTITY_REFERENCE: number;\r\n readonly SHOW_NOTATION: number;\r\n readonly SHOW_PROCESSING_INSTRUCTION: number;\r\n readonly SHOW_TEXT: number;\r\n}\r\n\r\ninterface NodeIterator {\r\n readonly expandEntityReferences: boolean;\r\n readonly filter: NodeFilter;\r\n readonly root: Node;\r\n readonly whatToShow: number;\r\n detach(): void;\r\n nextNode(): Node;\r\n previousNode(): Node;\r\n}\r\n\r\ndeclare var NodeIterator: {\r\n prototype: NodeIterator;\r\n new(): NodeIterator;\r\n}\r\n\r\ninterface NodeList {\r\n readonly length: number;\r\n item(index: number): Node;\r\n [index: number]: Node;\r\n}\r\n\r\ndeclare var NodeList: {\r\n prototype: NodeList;\r\n new(): NodeList;\r\n}\r\n\r\ninterface OES_element_index_uint {\r\n}\r\n\r\ndeclare var OES_element_index_uint: {\r\n prototype: OES_element_index_uint;\r\n new(): OES_element_index_uint;\r\n}\r\n\r\ninterface OES_standard_derivatives {\r\n readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number;\r\n}\r\n\r\ndeclare var OES_standard_derivatives: {\r\n prototype: OES_standard_derivatives;\r\n new(): OES_standard_derivatives;\r\n readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number;\r\n}\r\n\r\ninterface OES_texture_float {\r\n}\r\n\r\ndeclare var OES_texture_float: {\r\n prototype: OES_texture_float;\r\n new(): OES_texture_float;\r\n}\r\n\r\ninterface OES_texture_float_linear {\r\n}\r\n\r\ndeclare var OES_texture_float_linear: {\r\n prototype: OES_texture_float_linear;\r\n new(): OES_texture_float_linear;\r\n}\r\n\r\ninterface OfflineAudioCompletionEvent extends Event {\r\n readonly renderedBuffer: AudioBuffer;\r\n}\r\n\r\ndeclare var OfflineAudioCompletionEvent: {\r\n prototype: OfflineAudioCompletionEvent;\r\n new(): OfflineAudioCompletionEvent;\r\n}\r\n\r\ninterface OfflineAudioContext extends AudioContext {\r\n oncomplete: (this: this, ev: Event) => any;\r\n startRendering(): PromiseLike;\r\n addEventListener(type: \"complete\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var OfflineAudioContext: {\r\n prototype: OfflineAudioContext;\r\n new(numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext;\r\n}\r\n\r\ninterface OscillatorNode extends AudioNode {\r\n readonly detune: AudioParam;\r\n readonly frequency: AudioParam;\r\n onended: (this: this, ev: MediaStreamErrorEvent) => any;\r\n type: string;\r\n setPeriodicWave(periodicWave: PeriodicWave): void;\r\n start(when?: number): void;\r\n stop(when?: number): void;\r\n addEventListener(type: \"ended\", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var OscillatorNode: {\r\n prototype: OscillatorNode;\r\n new(): OscillatorNode;\r\n}\r\n\r\ninterface OverflowEvent extends UIEvent {\r\n readonly horizontalOverflow: boolean;\r\n readonly orient: number;\r\n readonly verticalOverflow: boolean;\r\n readonly BOTH: number;\r\n readonly HORIZONTAL: number;\r\n readonly VERTICAL: number;\r\n}\r\n\r\ndeclare var OverflowEvent: {\r\n prototype: OverflowEvent;\r\n new(): OverflowEvent;\r\n readonly BOTH: number;\r\n readonly HORIZONTAL: number;\r\n readonly VERTICAL: number;\r\n}\r\n\r\ninterface PageTransitionEvent extends Event {\r\n readonly persisted: boolean;\r\n}\r\n\r\ndeclare var PageTransitionEvent: {\r\n prototype: PageTransitionEvent;\r\n new(): PageTransitionEvent;\r\n}\r\n\r\ninterface PannerNode extends AudioNode {\r\n coneInnerAngle: number;\r\n coneOuterAngle: number;\r\n coneOuterGain: number;\r\n distanceModel: string;\r\n maxDistance: number;\r\n panningModel: string;\r\n refDistance: number;\r\n rolloffFactor: number;\r\n setOrientation(x: number, y: number, z: number): void;\r\n setPosition(x: number, y: number, z: number): void;\r\n setVelocity(x: number, y: number, z: number): void;\r\n}\r\n\r\ndeclare var PannerNode: {\r\n prototype: PannerNode;\r\n new(): PannerNode;\r\n}\r\n\r\ninterface PerfWidgetExternal {\r\n readonly activeNetworkRequestCount: number;\r\n readonly averageFrameTime: number;\r\n readonly averagePaintTime: number;\r\n readonly extraInformationEnabled: boolean;\r\n readonly independentRenderingEnabled: boolean;\r\n readonly irDisablingContentString: string;\r\n readonly irStatusAvailable: boolean;\r\n readonly maxCpuSpeed: number;\r\n readonly paintRequestsPerSecond: number;\r\n readonly performanceCounter: number;\r\n readonly performanceCounterFrequency: number;\r\n addEventListener(eventType: string, callback: Function): void;\r\n getMemoryUsage(): number;\r\n getProcessCpuUsage(): number;\r\n getRecentCpuUsage(last: number | null): any;\r\n getRecentFrames(last: number | null): any;\r\n getRecentMemoryUsage(last: number | null): any;\r\n getRecentPaintRequests(last: number | null): any;\r\n removeEventListener(eventType: string, callback: Function): void;\r\n repositionWindow(x: number, y: number): void;\r\n resizeWindow(width: number, height: number): void;\r\n}\r\n\r\ndeclare var PerfWidgetExternal: {\r\n prototype: PerfWidgetExternal;\r\n new(): PerfWidgetExternal;\r\n}\r\n\r\ninterface Performance {\r\n readonly navigation: PerformanceNavigation;\r\n readonly timing: PerformanceTiming;\r\n clearMarks(markName?: string): void;\r\n clearMeasures(measureName?: string): void;\r\n clearResourceTimings(): void;\r\n getEntries(): any;\r\n getEntriesByName(name: string, entryType?: string): any;\r\n getEntriesByType(entryType: string): any;\r\n getMarks(markName?: string): any;\r\n getMeasures(measureName?: string): any;\r\n mark(markName: string): void;\r\n measure(measureName: string, startMarkName?: string, endMarkName?: string): void;\r\n now(): number;\r\n setResourceTimingBufferSize(maxSize: number): void;\r\n toJSON(): any;\r\n}\r\n\r\ndeclare var Performance: {\r\n prototype: Performance;\r\n new(): Performance;\r\n}\r\n\r\ninterface PerformanceEntry {\r\n readonly duration: number;\r\n readonly entryType: string;\r\n readonly name: string;\r\n readonly startTime: number;\r\n}\r\n\r\ndeclare var PerformanceEntry: {\r\n prototype: PerformanceEntry;\r\n new(): PerformanceEntry;\r\n}\r\n\r\ninterface PerformanceMark extends PerformanceEntry {\r\n}\r\n\r\ndeclare var PerformanceMark: {\r\n prototype: PerformanceMark;\r\n new(): PerformanceMark;\r\n}\r\n\r\ninterface PerformanceMeasure extends PerformanceEntry {\r\n}\r\n\r\ndeclare var PerformanceMeasure: {\r\n prototype: PerformanceMeasure;\r\n new(): PerformanceMeasure;\r\n}\r\n\r\ninterface PerformanceNavigation {\r\n readonly redirectCount: number;\r\n readonly type: number;\r\n toJSON(): any;\r\n readonly TYPE_BACK_FORWARD: number;\r\n readonly TYPE_NAVIGATE: number;\r\n readonly TYPE_RELOAD: number;\r\n readonly TYPE_RESERVED: number;\r\n}\r\n\r\ndeclare var PerformanceNavigation: {\r\n prototype: PerformanceNavigation;\r\n new(): PerformanceNavigation;\r\n readonly TYPE_BACK_FORWARD: number;\r\n readonly TYPE_NAVIGATE: number;\r\n readonly TYPE_RELOAD: number;\r\n readonly TYPE_RESERVED: number;\r\n}\r\n\r\ninterface PerformanceNavigationTiming extends PerformanceEntry {\r\n readonly connectEnd: number;\r\n readonly connectStart: number;\r\n readonly domComplete: number;\r\n readonly domContentLoadedEventEnd: number;\r\n readonly domContentLoadedEventStart: number;\r\n readonly domInteractive: number;\r\n readonly domLoading: number;\r\n readonly domainLookupEnd: number;\r\n readonly domainLookupStart: number;\r\n readonly fetchStart: number;\r\n readonly loadEventEnd: number;\r\n readonly loadEventStart: number;\r\n readonly navigationStart: number;\r\n readonly redirectCount: number;\r\n readonly redirectEnd: number;\r\n readonly redirectStart: number;\r\n readonly requestStart: number;\r\n readonly responseEnd: number;\r\n readonly responseStart: number;\r\n readonly type: string;\r\n readonly unloadEventEnd: number;\r\n readonly unloadEventStart: number;\r\n}\r\n\r\ndeclare var PerformanceNavigationTiming: {\r\n prototype: PerformanceNavigationTiming;\r\n new(): PerformanceNavigationTiming;\r\n}\r\n\r\ninterface PerformanceResourceTiming extends PerformanceEntry {\r\n readonly connectEnd: number;\r\n readonly connectStart: number;\r\n readonly domainLookupEnd: number;\r\n readonly domainLookupStart: number;\r\n readonly fetchStart: number;\r\n readonly initiatorType: string;\r\n readonly redirectEnd: number;\r\n readonly redirectStart: number;\r\n readonly requestStart: number;\r\n readonly responseEnd: number;\r\n readonly responseStart: number;\r\n}\r\n\r\ndeclare var PerformanceResourceTiming: {\r\n prototype: PerformanceResourceTiming;\r\n new(): PerformanceResourceTiming;\r\n}\r\n\r\ninterface PerformanceTiming {\r\n readonly connectEnd: number;\r\n readonly connectStart: number;\r\n readonly domComplete: number;\r\n readonly domContentLoadedEventEnd: number;\r\n readonly domContentLoadedEventStart: number;\r\n readonly domInteractive: number;\r\n readonly domLoading: number;\r\n readonly domainLookupEnd: number;\r\n readonly domainLookupStart: number;\r\n readonly fetchStart: number;\r\n readonly loadEventEnd: number;\r\n readonly loadEventStart: number;\r\n readonly msFirstPaint: number;\r\n readonly navigationStart: number;\r\n readonly redirectEnd: number;\r\n readonly redirectStart: number;\r\n readonly requestStart: number;\r\n readonly responseEnd: number;\r\n readonly responseStart: number;\r\n readonly unloadEventEnd: number;\r\n readonly unloadEventStart: number;\r\n readonly secureConnectionStart: number;\r\n toJSON(): any;\r\n}\r\n\r\ndeclare var PerformanceTiming: {\r\n prototype: PerformanceTiming;\r\n new(): PerformanceTiming;\r\n}\r\n\r\ninterface PeriodicWave {\r\n}\r\n\r\ndeclare var PeriodicWave: {\r\n prototype: PeriodicWave;\r\n new(): PeriodicWave;\r\n}\r\n\r\ninterface PermissionRequest extends DeferredPermissionRequest {\r\n readonly state: string;\r\n defer(): void;\r\n}\r\n\r\ndeclare var PermissionRequest: {\r\n prototype: PermissionRequest;\r\n new(): PermissionRequest;\r\n}\r\n\r\ninterface PermissionRequestedEvent extends Event {\r\n readonly permissionRequest: PermissionRequest;\r\n}\r\n\r\ndeclare var PermissionRequestedEvent: {\r\n prototype: PermissionRequestedEvent;\r\n new(): PermissionRequestedEvent;\r\n}\r\n\r\ninterface Plugin {\r\n readonly description: string;\r\n readonly filename: string;\r\n readonly length: number;\r\n readonly name: string;\r\n readonly version: string;\r\n item(index: number): MimeType;\r\n namedItem(type: string): MimeType;\r\n [index: number]: MimeType;\r\n}\r\n\r\ndeclare var Plugin: {\r\n prototype: Plugin;\r\n new(): Plugin;\r\n}\r\n\r\ninterface PluginArray {\r\n readonly length: number;\r\n item(index: number): Plugin;\r\n namedItem(name: string): Plugin;\r\n refresh(reload?: boolean): void;\r\n [index: number]: Plugin;\r\n}\r\n\r\ndeclare var PluginArray: {\r\n prototype: PluginArray;\r\n new(): PluginArray;\r\n}\r\n\r\ninterface PointerEvent extends MouseEvent {\r\n readonly currentPoint: any;\r\n readonly height: number;\r\n readonly hwTimestamp: number;\r\n readonly intermediatePoints: any;\r\n readonly isPrimary: boolean;\r\n readonly pointerId: number;\r\n readonly pointerType: any;\r\n readonly pressure: number;\r\n readonly rotation: number;\r\n readonly tiltX: number;\r\n readonly tiltY: number;\r\n readonly width: number;\r\n getCurrentPoint(element: Element): void;\r\n getIntermediatePoints(element: Element): void;\r\n initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void;\r\n}\r\n\r\ndeclare var PointerEvent: {\r\n prototype: PointerEvent;\r\n new(typeArg: string, eventInitDict?: PointerEventInit): PointerEvent;\r\n}\r\n\r\ninterface PopStateEvent extends Event {\r\n readonly state: any;\r\n initPopStateEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, stateArg: any): void;\r\n}\r\n\r\ndeclare var PopStateEvent: {\r\n prototype: PopStateEvent;\r\n new(): PopStateEvent;\r\n}\r\n\r\ninterface Position {\r\n readonly coords: Coordinates;\r\n readonly timestamp: number;\r\n}\r\n\r\ndeclare var Position: {\r\n prototype: Position;\r\n new(): Position;\r\n}\r\n\r\ninterface PositionError {\r\n readonly code: number;\r\n readonly message: string;\r\n toString(): string;\r\n readonly PERMISSION_DENIED: number;\r\n readonly POSITION_UNAVAILABLE: number;\r\n readonly TIMEOUT: number;\r\n}\r\n\r\ndeclare var PositionError: {\r\n prototype: PositionError;\r\n new(): PositionError;\r\n readonly PERMISSION_DENIED: number;\r\n readonly POSITION_UNAVAILABLE: number;\r\n readonly TIMEOUT: number;\r\n}\r\n\r\ninterface ProcessingInstruction extends CharacterData {\r\n readonly target: string;\r\n}\r\n\r\ndeclare var ProcessingInstruction: {\r\n prototype: ProcessingInstruction;\r\n new(): ProcessingInstruction;\r\n}\r\n\r\ninterface ProgressEvent extends Event {\r\n readonly lengthComputable: boolean;\r\n readonly loaded: number;\r\n readonly total: number;\r\n initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void;\r\n}\r\n\r\ndeclare var ProgressEvent: {\r\n prototype: ProgressEvent;\r\n new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent;\r\n}\r\n\r\ninterface RTCDTMFToneChangeEvent extends Event {\r\n readonly tone: string;\r\n}\r\n\r\ndeclare var RTCDTMFToneChangeEvent: {\r\n prototype: RTCDTMFToneChangeEvent;\r\n new(type: string, eventInitDict: RTCDTMFToneChangeEventInit): RTCDTMFToneChangeEvent;\r\n}\r\n\r\ninterface RTCDtlsTransport extends RTCStatsProvider {\r\n ondtlsstatechange: ((this: this, ev: RTCDtlsTransportStateChangedEvent) => any) | null;\r\n onerror: ((this: this, ev: ErrorEvent) => any) | null;\r\n readonly state: string;\r\n readonly transport: RTCIceTransport;\r\n getLocalParameters(): RTCDtlsParameters;\r\n getRemoteCertificates(): ArrayBuffer[];\r\n getRemoteParameters(): RTCDtlsParameters | null;\r\n start(remoteParameters: RTCDtlsParameters): void;\r\n stop(): void;\r\n addEventListener(type: \"dtlsstatechange\", listener: (this: this, ev: RTCDtlsTransportStateChangedEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var RTCDtlsTransport: {\r\n prototype: RTCDtlsTransport;\r\n new(transport: RTCIceTransport): RTCDtlsTransport;\r\n}\r\n\r\ninterface RTCDtlsTransportStateChangedEvent extends Event {\r\n readonly state: string;\r\n}\r\n\r\ndeclare var RTCDtlsTransportStateChangedEvent: {\r\n prototype: RTCDtlsTransportStateChangedEvent;\r\n new(): RTCDtlsTransportStateChangedEvent;\r\n}\r\n\r\ninterface RTCDtmfSender extends EventTarget {\r\n readonly canInsertDTMF: boolean;\r\n readonly duration: number;\r\n readonly interToneGap: number;\r\n ontonechange: (this: this, ev: RTCDTMFToneChangeEvent) => any;\r\n readonly sender: RTCRtpSender;\r\n readonly toneBuffer: string;\r\n insertDTMF(tones: string, duration?: number, interToneGap?: number): void;\r\n addEventListener(type: \"tonechange\", listener: (this: this, ev: RTCDTMFToneChangeEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var RTCDtmfSender: {\r\n prototype: RTCDtmfSender;\r\n new(sender: RTCRtpSender): RTCDtmfSender;\r\n}\r\n\r\ninterface RTCIceCandidatePairChangedEvent extends Event {\r\n readonly pair: RTCIceCandidatePair;\r\n}\r\n\r\ndeclare var RTCIceCandidatePairChangedEvent: {\r\n prototype: RTCIceCandidatePairChangedEvent;\r\n new(): RTCIceCandidatePairChangedEvent;\r\n}\r\n\r\ninterface RTCIceGatherer extends RTCStatsProvider {\r\n readonly component: string;\r\n onerror: ((this: this, ev: ErrorEvent) => any) | null;\r\n onlocalcandidate: ((this: this, ev: RTCIceGathererEvent) => any) | null;\r\n createAssociatedGatherer(): RTCIceGatherer;\r\n getLocalCandidates(): RTCIceCandidate[];\r\n getLocalParameters(): RTCIceParameters;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"localcandidate\", listener: (this: this, ev: RTCIceGathererEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var RTCIceGatherer: {\r\n prototype: RTCIceGatherer;\r\n new(options: RTCIceGatherOptions): RTCIceGatherer;\r\n}\r\n\r\ninterface RTCIceGathererEvent extends Event {\r\n readonly candidate: RTCIceCandidate | RTCIceCandidateComplete;\r\n}\r\n\r\ndeclare var RTCIceGathererEvent: {\r\n prototype: RTCIceGathererEvent;\r\n new(): RTCIceGathererEvent;\r\n}\r\n\r\ninterface RTCIceTransport extends RTCStatsProvider {\r\n readonly component: string;\r\n readonly iceGatherer: RTCIceGatherer | null;\r\n oncandidatepairchange: ((this: this, ev: RTCIceCandidatePairChangedEvent) => any) | null;\r\n onicestatechange: ((this: this, ev: RTCIceTransportStateChangedEvent) => any) | null;\r\n readonly role: string;\r\n readonly state: string;\r\n addRemoteCandidate(remoteCandidate: RTCIceCandidate | RTCIceCandidateComplete): void;\r\n createAssociatedTransport(): RTCIceTransport;\r\n getNominatedCandidatePair(): RTCIceCandidatePair | null;\r\n getRemoteCandidates(): RTCIceCandidate[];\r\n getRemoteParameters(): RTCIceParameters | null;\r\n setRemoteCandidates(remoteCandidates: RTCIceCandidate[]): void;\r\n start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: string): void;\r\n stop(): void;\r\n addEventListener(type: \"candidatepairchange\", listener: (this: this, ev: RTCIceCandidatePairChangedEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"icestatechange\", listener: (this: this, ev: RTCIceTransportStateChangedEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var RTCIceTransport: {\r\n prototype: RTCIceTransport;\r\n new(): RTCIceTransport;\r\n}\r\n\r\ninterface RTCIceTransportStateChangedEvent extends Event {\r\n readonly state: string;\r\n}\r\n\r\ndeclare var RTCIceTransportStateChangedEvent: {\r\n prototype: RTCIceTransportStateChangedEvent;\r\n new(): RTCIceTransportStateChangedEvent;\r\n}\r\n\r\ninterface RTCRtpReceiver extends RTCStatsProvider {\r\n onerror: ((this: this, ev: ErrorEvent) => any) | null;\r\n readonly rtcpTransport: RTCDtlsTransport;\r\n readonly track: MediaStreamTrack | null;\r\n readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport;\r\n getContributingSources(): RTCRtpContributingSource[];\r\n receive(parameters: RTCRtpParameters): void;\r\n requestSendCSRC(csrc: number): void;\r\n setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void;\r\n stop(): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var RTCRtpReceiver: {\r\n prototype: RTCRtpReceiver;\r\n new(transport: RTCDtlsTransport | RTCSrtpSdesTransport, kind: string, rtcpTransport?: RTCDtlsTransport): RTCRtpReceiver;\r\n getCapabilities(kind?: string): RTCRtpCapabilities;\r\n}\r\n\r\ninterface RTCRtpSender extends RTCStatsProvider {\r\n onerror: ((this: this, ev: ErrorEvent) => any) | null;\r\n onssrcconflict: ((this: this, ev: RTCSsrcConflictEvent) => any) | null;\r\n readonly rtcpTransport: RTCDtlsTransport;\r\n readonly track: MediaStreamTrack;\r\n readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport;\r\n send(parameters: RTCRtpParameters): void;\r\n setTrack(track: MediaStreamTrack): void;\r\n setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void;\r\n stop(): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ssrcconflict\", listener: (this: this, ev: RTCSsrcConflictEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var RTCRtpSender: {\r\n prototype: RTCRtpSender;\r\n new(track: MediaStreamTrack, transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): RTCRtpSender;\r\n getCapabilities(kind?: string): RTCRtpCapabilities;\r\n}\r\n\r\ninterface RTCSrtpSdesTransport extends EventTarget {\r\n onerror: ((this: this, ev: ErrorEvent) => any) | null;\r\n readonly transport: RTCIceTransport;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var RTCSrtpSdesTransport: {\r\n prototype: RTCSrtpSdesTransport;\r\n new(transport: RTCIceTransport, encryptParameters: RTCSrtpSdesParameters, decryptParameters: RTCSrtpSdesParameters): RTCSrtpSdesTransport;\r\n getLocalParameters(): RTCSrtpSdesParameters[];\r\n}\r\n\r\ninterface RTCSsrcConflictEvent extends Event {\r\n readonly ssrc: number;\r\n}\r\n\r\ndeclare var RTCSsrcConflictEvent: {\r\n prototype: RTCSsrcConflictEvent;\r\n new(): RTCSsrcConflictEvent;\r\n}\r\n\r\ninterface RTCStatsProvider extends EventTarget {\r\n getStats(): PromiseLike;\r\n msGetStats(): PromiseLike;\r\n}\r\n\r\ndeclare var RTCStatsProvider: {\r\n prototype: RTCStatsProvider;\r\n new(): RTCStatsProvider;\r\n}\r\n\r\ninterface Range {\r\n readonly collapsed: boolean;\r\n readonly commonAncestorContainer: Node;\r\n readonly endContainer: Node;\r\n readonly endOffset: number;\r\n readonly startContainer: Node;\r\n readonly startOffset: number;\r\n cloneContents(): DocumentFragment;\r\n cloneRange(): Range;\r\n collapse(toStart: boolean): void;\r\n compareBoundaryPoints(how: number, sourceRange: Range): number;\r\n createContextualFragment(fragment: string): DocumentFragment;\r\n deleteContents(): void;\r\n detach(): void;\r\n expand(Unit: string): boolean;\r\n extractContents(): DocumentFragment;\r\n getBoundingClientRect(): ClientRect;\r\n getClientRects(): ClientRectList;\r\n insertNode(newNode: Node): void;\r\n selectNode(refNode: Node): void;\r\n selectNodeContents(refNode: Node): void;\r\n setEnd(refNode: Node, offset: number): void;\r\n setEndAfter(refNode: Node): void;\r\n setEndBefore(refNode: Node): void;\r\n setStart(refNode: Node, offset: number): void;\r\n setStartAfter(refNode: Node): void;\r\n setStartBefore(refNode: Node): void;\r\n surroundContents(newParent: Node): void;\r\n toString(): string;\r\n readonly END_TO_END: number;\r\n readonly END_TO_START: number;\r\n readonly START_TO_END: number;\r\n readonly START_TO_START: number;\r\n}\r\n\r\ndeclare var Range: {\r\n prototype: Range;\r\n new(): Range;\r\n readonly END_TO_END: number;\r\n readonly END_TO_START: number;\r\n readonly START_TO_END: number;\r\n readonly START_TO_START: number;\r\n}\r\n\r\ninterface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference {\r\n readonly target: SVGAnimatedString;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGAElement: {\r\n prototype: SVGAElement;\r\n new(): SVGAElement;\r\n}\r\n\r\ninterface SVGAngle {\r\n readonly unitType: number;\r\n value: number;\r\n valueAsString: string;\r\n valueInSpecifiedUnits: number;\r\n convertToSpecifiedUnits(unitType: number): void;\r\n newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void;\r\n readonly SVG_ANGLETYPE_DEG: number;\r\n readonly SVG_ANGLETYPE_GRAD: number;\r\n readonly SVG_ANGLETYPE_RAD: number;\r\n readonly SVG_ANGLETYPE_UNKNOWN: number;\r\n readonly SVG_ANGLETYPE_UNSPECIFIED: number;\r\n}\r\n\r\ndeclare var SVGAngle: {\r\n prototype: SVGAngle;\r\n new(): SVGAngle;\r\n readonly SVG_ANGLETYPE_DEG: number;\r\n readonly SVG_ANGLETYPE_GRAD: number;\r\n readonly SVG_ANGLETYPE_RAD: number;\r\n readonly SVG_ANGLETYPE_UNKNOWN: number;\r\n readonly SVG_ANGLETYPE_UNSPECIFIED: number;\r\n}\r\n\r\ninterface SVGAnimatedAngle {\r\n readonly animVal: SVGAngle;\r\n readonly baseVal: SVGAngle;\r\n}\r\n\r\ndeclare var SVGAnimatedAngle: {\r\n prototype: SVGAnimatedAngle;\r\n new(): SVGAnimatedAngle;\r\n}\r\n\r\ninterface SVGAnimatedBoolean {\r\n readonly animVal: boolean;\r\n baseVal: boolean;\r\n}\r\n\r\ndeclare var SVGAnimatedBoolean: {\r\n prototype: SVGAnimatedBoolean;\r\n new(): SVGAnimatedBoolean;\r\n}\r\n\r\ninterface SVGAnimatedEnumeration {\r\n readonly animVal: number;\r\n baseVal: number;\r\n}\r\n\r\ndeclare var SVGAnimatedEnumeration: {\r\n prototype: SVGAnimatedEnumeration;\r\n new(): SVGAnimatedEnumeration;\r\n}\r\n\r\ninterface SVGAnimatedInteger {\r\n readonly animVal: number;\r\n baseVal: number;\r\n}\r\n\r\ndeclare var SVGAnimatedInteger: {\r\n prototype: SVGAnimatedInteger;\r\n new(): SVGAnimatedInteger;\r\n}\r\n\r\ninterface SVGAnimatedLength {\r\n readonly animVal: SVGLength;\r\n readonly baseVal: SVGLength;\r\n}\r\n\r\ndeclare var SVGAnimatedLength: {\r\n prototype: SVGAnimatedLength;\r\n new(): SVGAnimatedLength;\r\n}\r\n\r\ninterface SVGAnimatedLengthList {\r\n readonly animVal: SVGLengthList;\r\n readonly baseVal: SVGLengthList;\r\n}\r\n\r\ndeclare var SVGAnimatedLengthList: {\r\n prototype: SVGAnimatedLengthList;\r\n new(): SVGAnimatedLengthList;\r\n}\r\n\r\ninterface SVGAnimatedNumber {\r\n readonly animVal: number;\r\n baseVal: number;\r\n}\r\n\r\ndeclare var SVGAnimatedNumber: {\r\n prototype: SVGAnimatedNumber;\r\n new(): SVGAnimatedNumber;\r\n}\r\n\r\ninterface SVGAnimatedNumberList {\r\n readonly animVal: SVGNumberList;\r\n readonly baseVal: SVGNumberList;\r\n}\r\n\r\ndeclare var SVGAnimatedNumberList: {\r\n prototype: SVGAnimatedNumberList;\r\n new(): SVGAnimatedNumberList;\r\n}\r\n\r\ninterface SVGAnimatedPreserveAspectRatio {\r\n readonly animVal: SVGPreserveAspectRatio;\r\n readonly baseVal: SVGPreserveAspectRatio;\r\n}\r\n\r\ndeclare var SVGAnimatedPreserveAspectRatio: {\r\n prototype: SVGAnimatedPreserveAspectRatio;\r\n new(): SVGAnimatedPreserveAspectRatio;\r\n}\r\n\r\ninterface SVGAnimatedRect {\r\n readonly animVal: SVGRect;\r\n readonly baseVal: SVGRect;\r\n}\r\n\r\ndeclare var SVGAnimatedRect: {\r\n prototype: SVGAnimatedRect;\r\n new(): SVGAnimatedRect;\r\n}\r\n\r\ninterface SVGAnimatedString {\r\n readonly animVal: string;\r\n baseVal: string;\r\n}\r\n\r\ndeclare var SVGAnimatedString: {\r\n prototype: SVGAnimatedString;\r\n new(): SVGAnimatedString;\r\n}\r\n\r\ninterface SVGAnimatedTransformList {\r\n readonly animVal: SVGTransformList;\r\n readonly baseVal: SVGTransformList;\r\n}\r\n\r\ndeclare var SVGAnimatedTransformList: {\r\n prototype: SVGAnimatedTransformList;\r\n new(): SVGAnimatedTransformList;\r\n}\r\n\r\ninterface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\r\n readonly cx: SVGAnimatedLength;\r\n readonly cy: SVGAnimatedLength;\r\n readonly r: SVGAnimatedLength;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGCircleElement: {\r\n prototype: SVGCircleElement;\r\n new(): SVGCircleElement;\r\n}\r\n\r\ninterface SVGClipPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes {\r\n readonly clipPathUnits: SVGAnimatedEnumeration;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGClipPathElement: {\r\n prototype: SVGClipPathElement;\r\n new(): SVGClipPathElement;\r\n}\r\n\r\ninterface SVGComponentTransferFunctionElement extends SVGElement {\r\n readonly amplitude: SVGAnimatedNumber;\r\n readonly exponent: SVGAnimatedNumber;\r\n readonly intercept: SVGAnimatedNumber;\r\n readonly offset: SVGAnimatedNumber;\r\n readonly slope: SVGAnimatedNumber;\r\n readonly tableValues: SVGAnimatedNumberList;\r\n readonly type: SVGAnimatedEnumeration;\r\n readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number;\r\n readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number;\r\n readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number;\r\n readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number;\r\n readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number;\r\n readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number;\r\n}\r\n\r\ndeclare var SVGComponentTransferFunctionElement: {\r\n prototype: SVGComponentTransferFunctionElement;\r\n new(): SVGComponentTransferFunctionElement;\r\n readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number;\r\n readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number;\r\n readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number;\r\n readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number;\r\n readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number;\r\n readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number;\r\n}\r\n\r\ninterface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGDefsElement: {\r\n prototype: SVGDefsElement;\r\n new(): SVGDefsElement;\r\n}\r\n\r\ninterface SVGDescElement extends SVGElement, SVGStylable, SVGLangSpace {\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGDescElement: {\r\n prototype: SVGDescElement;\r\n new(): SVGDescElement;\r\n}\r\n\r\ninterface SVGElement extends Element {\r\n onclick: (this: this, ev: MouseEvent) => any;\r\n ondblclick: (this: this, ev: MouseEvent) => any;\r\n onfocusin: (this: this, ev: FocusEvent) => any;\r\n onfocusout: (this: this, ev: FocusEvent) => any;\r\n onload: (this: this, ev: Event) => any;\r\n onmousedown: (this: this, ev: MouseEvent) => any;\r\n onmousemove: (this: this, ev: MouseEvent) => any;\r\n onmouseout: (this: this, ev: MouseEvent) => any;\r\n onmouseover: (this: this, ev: MouseEvent) => any;\r\n onmouseup: (this: this, ev: MouseEvent) => any;\r\n readonly ownerSVGElement: SVGSVGElement;\r\n readonly viewportElement: SVGElement;\r\n xmlbase: string;\r\n className: any;\r\n addEventListener(type: \"MSGestureChange\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureDoubleTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureEnd\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureHold\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGotPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSInertiaStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSLostPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerCancel\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerDown\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerEnter\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerLeave\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerMove\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOut\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOver\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerUp\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ariarequest\", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"click\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"command\", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dblclick\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"focusin\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"focusout\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"gotpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"lostpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousedown\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousemove\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseout\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseover\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseup\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointercancel\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerdown\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerenter\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerleave\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointermove\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerout\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerover\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerup\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchcancel\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchend\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchmove\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchstart\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenerror\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"wheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGElement: {\r\n prototype: SVGElement;\r\n new(): SVGElement;\r\n}\r\n\r\ninterface SVGElementInstance extends EventTarget {\r\n readonly childNodes: SVGElementInstanceList;\r\n readonly correspondingElement: SVGElement;\r\n readonly correspondingUseElement: SVGUseElement;\r\n readonly firstChild: SVGElementInstance;\r\n readonly lastChild: SVGElementInstance;\r\n readonly nextSibling: SVGElementInstance;\r\n readonly parentNode: SVGElementInstance;\r\n readonly previousSibling: SVGElementInstance;\r\n}\r\n\r\ndeclare var SVGElementInstance: {\r\n prototype: SVGElementInstance;\r\n new(): SVGElementInstance;\r\n}\r\n\r\ninterface SVGElementInstanceList {\r\n readonly length: number;\r\n item(index: number): SVGElementInstance;\r\n}\r\n\r\ndeclare var SVGElementInstanceList: {\r\n prototype: SVGElementInstanceList;\r\n new(): SVGElementInstanceList;\r\n}\r\n\r\ninterface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\r\n readonly cx: SVGAnimatedLength;\r\n readonly cy: SVGAnimatedLength;\r\n readonly rx: SVGAnimatedLength;\r\n readonly ry: SVGAnimatedLength;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGEllipseElement: {\r\n prototype: SVGEllipseElement;\r\n new(): SVGEllipseElement;\r\n}\r\n\r\ninterface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\r\n readonly in1: SVGAnimatedString;\r\n readonly in2: SVGAnimatedString;\r\n readonly mode: SVGAnimatedEnumeration;\r\n readonly SVG_FEBLEND_MODE_COLOR: number;\r\n readonly SVG_FEBLEND_MODE_COLOR_BURN: number;\r\n readonly SVG_FEBLEND_MODE_COLOR_DODGE: number;\r\n readonly SVG_FEBLEND_MODE_DARKEN: number;\r\n readonly SVG_FEBLEND_MODE_DIFFERENCE: number;\r\n readonly SVG_FEBLEND_MODE_EXCLUSION: number;\r\n readonly SVG_FEBLEND_MODE_HARD_LIGHT: number;\r\n readonly SVG_FEBLEND_MODE_HUE: number;\r\n readonly SVG_FEBLEND_MODE_LIGHTEN: number;\r\n readonly SVG_FEBLEND_MODE_LUMINOSITY: number;\r\n readonly SVG_FEBLEND_MODE_MULTIPLY: number;\r\n readonly SVG_FEBLEND_MODE_NORMAL: number;\r\n readonly SVG_FEBLEND_MODE_OVERLAY: number;\r\n readonly SVG_FEBLEND_MODE_SATURATION: number;\r\n readonly SVG_FEBLEND_MODE_SCREEN: number;\r\n readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number;\r\n readonly SVG_FEBLEND_MODE_UNKNOWN: number;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFEBlendElement: {\r\n prototype: SVGFEBlendElement;\r\n new(): SVGFEBlendElement;\r\n readonly SVG_FEBLEND_MODE_COLOR: number;\r\n readonly SVG_FEBLEND_MODE_COLOR_BURN: number;\r\n readonly SVG_FEBLEND_MODE_COLOR_DODGE: number;\r\n readonly SVG_FEBLEND_MODE_DARKEN: number;\r\n readonly SVG_FEBLEND_MODE_DIFFERENCE: number;\r\n readonly SVG_FEBLEND_MODE_EXCLUSION: number;\r\n readonly SVG_FEBLEND_MODE_HARD_LIGHT: number;\r\n readonly SVG_FEBLEND_MODE_HUE: number;\r\n readonly SVG_FEBLEND_MODE_LIGHTEN: number;\r\n readonly SVG_FEBLEND_MODE_LUMINOSITY: number;\r\n readonly SVG_FEBLEND_MODE_MULTIPLY: number;\r\n readonly SVG_FEBLEND_MODE_NORMAL: number;\r\n readonly SVG_FEBLEND_MODE_OVERLAY: number;\r\n readonly SVG_FEBLEND_MODE_SATURATION: number;\r\n readonly SVG_FEBLEND_MODE_SCREEN: number;\r\n readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number;\r\n readonly SVG_FEBLEND_MODE_UNKNOWN: number;\r\n}\r\n\r\ninterface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\r\n readonly in1: SVGAnimatedString;\r\n readonly type: SVGAnimatedEnumeration;\r\n readonly values: SVGAnimatedNumberList;\r\n readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number;\r\n readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number;\r\n readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number;\r\n readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number;\r\n readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFEColorMatrixElement: {\r\n prototype: SVGFEColorMatrixElement;\r\n new(): SVGFEColorMatrixElement;\r\n readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number;\r\n readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number;\r\n readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number;\r\n readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number;\r\n readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number;\r\n}\r\n\r\ninterface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\r\n readonly in1: SVGAnimatedString;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFEComponentTransferElement: {\r\n prototype: SVGFEComponentTransferElement;\r\n new(): SVGFEComponentTransferElement;\r\n}\r\n\r\ninterface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\r\n readonly in1: SVGAnimatedString;\r\n readonly in2: SVGAnimatedString;\r\n readonly k1: SVGAnimatedNumber;\r\n readonly k2: SVGAnimatedNumber;\r\n readonly k3: SVGAnimatedNumber;\r\n readonly k4: SVGAnimatedNumber;\r\n readonly operator: SVGAnimatedEnumeration;\r\n readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number;\r\n readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number;\r\n readonly SVG_FECOMPOSITE_OPERATOR_IN: number;\r\n readonly SVG_FECOMPOSITE_OPERATOR_OUT: number;\r\n readonly SVG_FECOMPOSITE_OPERATOR_OVER: number;\r\n readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number;\r\n readonly SVG_FECOMPOSITE_OPERATOR_XOR: number;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFECompositeElement: {\r\n prototype: SVGFECompositeElement;\r\n new(): SVGFECompositeElement;\r\n readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number;\r\n readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number;\r\n readonly SVG_FECOMPOSITE_OPERATOR_IN: number;\r\n readonly SVG_FECOMPOSITE_OPERATOR_OUT: number;\r\n readonly SVG_FECOMPOSITE_OPERATOR_OVER: number;\r\n readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number;\r\n readonly SVG_FECOMPOSITE_OPERATOR_XOR: number;\r\n}\r\n\r\ninterface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\r\n readonly bias: SVGAnimatedNumber;\r\n readonly divisor: SVGAnimatedNumber;\r\n readonly edgeMode: SVGAnimatedEnumeration;\r\n readonly in1: SVGAnimatedString;\r\n readonly kernelMatrix: SVGAnimatedNumberList;\r\n readonly kernelUnitLengthX: SVGAnimatedNumber;\r\n readonly kernelUnitLengthY: SVGAnimatedNumber;\r\n readonly orderX: SVGAnimatedInteger;\r\n readonly orderY: SVGAnimatedInteger;\r\n readonly preserveAlpha: SVGAnimatedBoolean;\r\n readonly targetX: SVGAnimatedInteger;\r\n readonly targetY: SVGAnimatedInteger;\r\n readonly SVG_EDGEMODE_DUPLICATE: number;\r\n readonly SVG_EDGEMODE_NONE: number;\r\n readonly SVG_EDGEMODE_UNKNOWN: number;\r\n readonly SVG_EDGEMODE_WRAP: number;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFEConvolveMatrixElement: {\r\n prototype: SVGFEConvolveMatrixElement;\r\n new(): SVGFEConvolveMatrixElement;\r\n readonly SVG_EDGEMODE_DUPLICATE: number;\r\n readonly SVG_EDGEMODE_NONE: number;\r\n readonly SVG_EDGEMODE_UNKNOWN: number;\r\n readonly SVG_EDGEMODE_WRAP: number;\r\n}\r\n\r\ninterface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\r\n readonly diffuseConstant: SVGAnimatedNumber;\r\n readonly in1: SVGAnimatedString;\r\n readonly kernelUnitLengthX: SVGAnimatedNumber;\r\n readonly kernelUnitLengthY: SVGAnimatedNumber;\r\n readonly surfaceScale: SVGAnimatedNumber;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFEDiffuseLightingElement: {\r\n prototype: SVGFEDiffuseLightingElement;\r\n new(): SVGFEDiffuseLightingElement;\r\n}\r\n\r\ninterface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\r\n readonly in1: SVGAnimatedString;\r\n readonly in2: SVGAnimatedString;\r\n readonly scale: SVGAnimatedNumber;\r\n readonly xChannelSelector: SVGAnimatedEnumeration;\r\n readonly yChannelSelector: SVGAnimatedEnumeration;\r\n readonly SVG_CHANNEL_A: number;\r\n readonly SVG_CHANNEL_B: number;\r\n readonly SVG_CHANNEL_G: number;\r\n readonly SVG_CHANNEL_R: number;\r\n readonly SVG_CHANNEL_UNKNOWN: number;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFEDisplacementMapElement: {\r\n prototype: SVGFEDisplacementMapElement;\r\n new(): SVGFEDisplacementMapElement;\r\n readonly SVG_CHANNEL_A: number;\r\n readonly SVG_CHANNEL_B: number;\r\n readonly SVG_CHANNEL_G: number;\r\n readonly SVG_CHANNEL_R: number;\r\n readonly SVG_CHANNEL_UNKNOWN: number;\r\n}\r\n\r\ninterface SVGFEDistantLightElement extends SVGElement {\r\n readonly azimuth: SVGAnimatedNumber;\r\n readonly elevation: SVGAnimatedNumber;\r\n}\r\n\r\ndeclare var SVGFEDistantLightElement: {\r\n prototype: SVGFEDistantLightElement;\r\n new(): SVGFEDistantLightElement;\r\n}\r\n\r\ninterface SVGFEFloodElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFEFloodElement: {\r\n prototype: SVGFEFloodElement;\r\n new(): SVGFEFloodElement;\r\n}\r\n\r\ninterface SVGFEFuncAElement extends SVGComponentTransferFunctionElement {\r\n}\r\n\r\ndeclare var SVGFEFuncAElement: {\r\n prototype: SVGFEFuncAElement;\r\n new(): SVGFEFuncAElement;\r\n}\r\n\r\ninterface SVGFEFuncBElement extends SVGComponentTransferFunctionElement {\r\n}\r\n\r\ndeclare var SVGFEFuncBElement: {\r\n prototype: SVGFEFuncBElement;\r\n new(): SVGFEFuncBElement;\r\n}\r\n\r\ninterface SVGFEFuncGElement extends SVGComponentTransferFunctionElement {\r\n}\r\n\r\ndeclare var SVGFEFuncGElement: {\r\n prototype: SVGFEFuncGElement;\r\n new(): SVGFEFuncGElement;\r\n}\r\n\r\ninterface SVGFEFuncRElement extends SVGComponentTransferFunctionElement {\r\n}\r\n\r\ndeclare var SVGFEFuncRElement: {\r\n prototype: SVGFEFuncRElement;\r\n new(): SVGFEFuncRElement;\r\n}\r\n\r\ninterface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\r\n readonly in1: SVGAnimatedString;\r\n readonly stdDeviationX: SVGAnimatedNumber;\r\n readonly stdDeviationY: SVGAnimatedNumber;\r\n setStdDeviation(stdDeviationX: number, stdDeviationY: number): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFEGaussianBlurElement: {\r\n prototype: SVGFEGaussianBlurElement;\r\n new(): SVGFEGaussianBlurElement;\r\n}\r\n\r\ninterface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired {\r\n readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFEImageElement: {\r\n prototype: SVGFEImageElement;\r\n new(): SVGFEImageElement;\r\n}\r\n\r\ninterface SVGFEMergeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFEMergeElement: {\r\n prototype: SVGFEMergeElement;\r\n new(): SVGFEMergeElement;\r\n}\r\n\r\ninterface SVGFEMergeNodeElement extends SVGElement {\r\n readonly in1: SVGAnimatedString;\r\n}\r\n\r\ndeclare var SVGFEMergeNodeElement: {\r\n prototype: SVGFEMergeNodeElement;\r\n new(): SVGFEMergeNodeElement;\r\n}\r\n\r\ninterface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\r\n readonly in1: SVGAnimatedString;\r\n readonly operator: SVGAnimatedEnumeration;\r\n readonly radiusX: SVGAnimatedNumber;\r\n readonly radiusY: SVGAnimatedNumber;\r\n readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number;\r\n readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number;\r\n readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFEMorphologyElement: {\r\n prototype: SVGFEMorphologyElement;\r\n new(): SVGFEMorphologyElement;\r\n readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number;\r\n readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number;\r\n readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number;\r\n}\r\n\r\ninterface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\r\n readonly dx: SVGAnimatedNumber;\r\n readonly dy: SVGAnimatedNumber;\r\n readonly in1: SVGAnimatedString;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFEOffsetElement: {\r\n prototype: SVGFEOffsetElement;\r\n new(): SVGFEOffsetElement;\r\n}\r\n\r\ninterface SVGFEPointLightElement extends SVGElement {\r\n readonly x: SVGAnimatedNumber;\r\n readonly y: SVGAnimatedNumber;\r\n readonly z: SVGAnimatedNumber;\r\n}\r\n\r\ndeclare var SVGFEPointLightElement: {\r\n prototype: SVGFEPointLightElement;\r\n new(): SVGFEPointLightElement;\r\n}\r\n\r\ninterface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\r\n readonly in1: SVGAnimatedString;\r\n readonly kernelUnitLengthX: SVGAnimatedNumber;\r\n readonly kernelUnitLengthY: SVGAnimatedNumber;\r\n readonly specularConstant: SVGAnimatedNumber;\r\n readonly specularExponent: SVGAnimatedNumber;\r\n readonly surfaceScale: SVGAnimatedNumber;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFESpecularLightingElement: {\r\n prototype: SVGFESpecularLightingElement;\r\n new(): SVGFESpecularLightingElement;\r\n}\r\n\r\ninterface SVGFESpotLightElement extends SVGElement {\r\n readonly limitingConeAngle: SVGAnimatedNumber;\r\n readonly pointsAtX: SVGAnimatedNumber;\r\n readonly pointsAtY: SVGAnimatedNumber;\r\n readonly pointsAtZ: SVGAnimatedNumber;\r\n readonly specularExponent: SVGAnimatedNumber;\r\n readonly x: SVGAnimatedNumber;\r\n readonly y: SVGAnimatedNumber;\r\n readonly z: SVGAnimatedNumber;\r\n}\r\n\r\ndeclare var SVGFESpotLightElement: {\r\n prototype: SVGFESpotLightElement;\r\n new(): SVGFESpotLightElement;\r\n}\r\n\r\ninterface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\r\n readonly in1: SVGAnimatedString;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFETileElement: {\r\n prototype: SVGFETileElement;\r\n new(): SVGFETileElement;\r\n}\r\n\r\ninterface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\r\n readonly baseFrequencyX: SVGAnimatedNumber;\r\n readonly baseFrequencyY: SVGAnimatedNumber;\r\n readonly numOctaves: SVGAnimatedInteger;\r\n readonly seed: SVGAnimatedNumber;\r\n readonly stitchTiles: SVGAnimatedEnumeration;\r\n readonly type: SVGAnimatedEnumeration;\r\n readonly SVG_STITCHTYPE_NOSTITCH: number;\r\n readonly SVG_STITCHTYPE_STITCH: number;\r\n readonly SVG_STITCHTYPE_UNKNOWN: number;\r\n readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number;\r\n readonly SVG_TURBULENCE_TYPE_TURBULENCE: number;\r\n readonly SVG_TURBULENCE_TYPE_UNKNOWN: number;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFETurbulenceElement: {\r\n prototype: SVGFETurbulenceElement;\r\n new(): SVGFETurbulenceElement;\r\n readonly SVG_STITCHTYPE_NOSTITCH: number;\r\n readonly SVG_STITCHTYPE_STITCH: number;\r\n readonly SVG_STITCHTYPE_UNKNOWN: number;\r\n readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number;\r\n readonly SVG_TURBULENCE_TYPE_TURBULENCE: number;\r\n readonly SVG_TURBULENCE_TYPE_UNKNOWN: number;\r\n}\r\n\r\ninterface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired {\r\n readonly filterResX: SVGAnimatedInteger;\r\n readonly filterResY: SVGAnimatedInteger;\r\n readonly filterUnits: SVGAnimatedEnumeration;\r\n readonly height: SVGAnimatedLength;\r\n readonly primitiveUnits: SVGAnimatedEnumeration;\r\n readonly width: SVGAnimatedLength;\r\n readonly x: SVGAnimatedLength;\r\n readonly y: SVGAnimatedLength;\r\n setFilterRes(filterResX: number, filterResY: number): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGFilterElement: {\r\n prototype: SVGFilterElement;\r\n new(): SVGFilterElement;\r\n}\r\n\r\ninterface SVGForeignObjectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\r\n readonly height: SVGAnimatedLength;\r\n readonly width: SVGAnimatedLength;\r\n readonly x: SVGAnimatedLength;\r\n readonly y: SVGAnimatedLength;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGForeignObjectElement: {\r\n prototype: SVGForeignObjectElement;\r\n new(): SVGForeignObjectElement;\r\n}\r\n\r\ninterface SVGGElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGGElement: {\r\n prototype: SVGGElement;\r\n new(): SVGGElement;\r\n}\r\n\r\ninterface SVGGradientElement extends SVGElement, SVGStylable, SVGExternalResourcesRequired, SVGURIReference, SVGUnitTypes {\r\n readonly gradientTransform: SVGAnimatedTransformList;\r\n readonly gradientUnits: SVGAnimatedEnumeration;\r\n readonly spreadMethod: SVGAnimatedEnumeration;\r\n readonly SVG_SPREADMETHOD_PAD: number;\r\n readonly SVG_SPREADMETHOD_REFLECT: number;\r\n readonly SVG_SPREADMETHOD_REPEAT: number;\r\n readonly SVG_SPREADMETHOD_UNKNOWN: number;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGGradientElement: {\r\n prototype: SVGGradientElement;\r\n new(): SVGGradientElement;\r\n readonly SVG_SPREADMETHOD_PAD: number;\r\n readonly SVG_SPREADMETHOD_REFLECT: number;\r\n readonly SVG_SPREADMETHOD_REPEAT: number;\r\n readonly SVG_SPREADMETHOD_UNKNOWN: number;\r\n}\r\n\r\ninterface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference {\r\n readonly height: SVGAnimatedLength;\r\n readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio;\r\n readonly width: SVGAnimatedLength;\r\n readonly x: SVGAnimatedLength;\r\n readonly y: SVGAnimatedLength;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGImageElement: {\r\n prototype: SVGImageElement;\r\n new(): SVGImageElement;\r\n}\r\n\r\ninterface SVGLength {\r\n readonly unitType: number;\r\n value: number;\r\n valueAsString: string;\r\n valueInSpecifiedUnits: number;\r\n convertToSpecifiedUnits(unitType: number): void;\r\n newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void;\r\n readonly SVG_LENGTHTYPE_CM: number;\r\n readonly SVG_LENGTHTYPE_EMS: number;\r\n readonly SVG_LENGTHTYPE_EXS: number;\r\n readonly SVG_LENGTHTYPE_IN: number;\r\n readonly SVG_LENGTHTYPE_MM: number;\r\n readonly SVG_LENGTHTYPE_NUMBER: number;\r\n readonly SVG_LENGTHTYPE_PC: number;\r\n readonly SVG_LENGTHTYPE_PERCENTAGE: number;\r\n readonly SVG_LENGTHTYPE_PT: number;\r\n readonly SVG_LENGTHTYPE_PX: number;\r\n readonly SVG_LENGTHTYPE_UNKNOWN: number;\r\n}\r\n\r\ndeclare var SVGLength: {\r\n prototype: SVGLength;\r\n new(): SVGLength;\r\n readonly SVG_LENGTHTYPE_CM: number;\r\n readonly SVG_LENGTHTYPE_EMS: number;\r\n readonly SVG_LENGTHTYPE_EXS: number;\r\n readonly SVG_LENGTHTYPE_IN: number;\r\n readonly SVG_LENGTHTYPE_MM: number;\r\n readonly SVG_LENGTHTYPE_NUMBER: number;\r\n readonly SVG_LENGTHTYPE_PC: number;\r\n readonly SVG_LENGTHTYPE_PERCENTAGE: number;\r\n readonly SVG_LENGTHTYPE_PT: number;\r\n readonly SVG_LENGTHTYPE_PX: number;\r\n readonly SVG_LENGTHTYPE_UNKNOWN: number;\r\n}\r\n\r\ninterface SVGLengthList {\r\n readonly numberOfItems: number;\r\n appendItem(newItem: SVGLength): SVGLength;\r\n clear(): void;\r\n getItem(index: number): SVGLength;\r\n initialize(newItem: SVGLength): SVGLength;\r\n insertItemBefore(newItem: SVGLength, index: number): SVGLength;\r\n removeItem(index: number): SVGLength;\r\n replaceItem(newItem: SVGLength, index: number): SVGLength;\r\n}\r\n\r\ndeclare var SVGLengthList: {\r\n prototype: SVGLengthList;\r\n new(): SVGLengthList;\r\n}\r\n\r\ninterface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\r\n readonly x1: SVGAnimatedLength;\r\n readonly x2: SVGAnimatedLength;\r\n readonly y1: SVGAnimatedLength;\r\n readonly y2: SVGAnimatedLength;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGLineElement: {\r\n prototype: SVGLineElement;\r\n new(): SVGLineElement;\r\n}\r\n\r\ninterface SVGLinearGradientElement extends SVGGradientElement {\r\n readonly x1: SVGAnimatedLength;\r\n readonly x2: SVGAnimatedLength;\r\n readonly y1: SVGAnimatedLength;\r\n readonly y2: SVGAnimatedLength;\r\n}\r\n\r\ndeclare var SVGLinearGradientElement: {\r\n prototype: SVGLinearGradientElement;\r\n new(): SVGLinearGradientElement;\r\n}\r\n\r\ninterface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox {\r\n readonly markerHeight: SVGAnimatedLength;\r\n readonly markerUnits: SVGAnimatedEnumeration;\r\n readonly markerWidth: SVGAnimatedLength;\r\n readonly orientAngle: SVGAnimatedAngle;\r\n readonly orientType: SVGAnimatedEnumeration;\r\n readonly refX: SVGAnimatedLength;\r\n readonly refY: SVGAnimatedLength;\r\n setOrientToAngle(angle: SVGAngle): void;\r\n setOrientToAuto(): void;\r\n readonly SVG_MARKERUNITS_STROKEWIDTH: number;\r\n readonly SVG_MARKERUNITS_UNKNOWN: number;\r\n readonly SVG_MARKERUNITS_USERSPACEONUSE: number;\r\n readonly SVG_MARKER_ORIENT_ANGLE: number;\r\n readonly SVG_MARKER_ORIENT_AUTO: number;\r\n readonly SVG_MARKER_ORIENT_UNKNOWN: number;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGMarkerElement: {\r\n prototype: SVGMarkerElement;\r\n new(): SVGMarkerElement;\r\n readonly SVG_MARKERUNITS_STROKEWIDTH: number;\r\n readonly SVG_MARKERUNITS_UNKNOWN: number;\r\n readonly SVG_MARKERUNITS_USERSPACEONUSE: number;\r\n readonly SVG_MARKER_ORIENT_ANGLE: number;\r\n readonly SVG_MARKER_ORIENT_AUTO: number;\r\n readonly SVG_MARKER_ORIENT_UNKNOWN: number;\r\n}\r\n\r\ninterface SVGMaskElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes {\r\n readonly height: SVGAnimatedLength;\r\n readonly maskContentUnits: SVGAnimatedEnumeration;\r\n readonly maskUnits: SVGAnimatedEnumeration;\r\n readonly width: SVGAnimatedLength;\r\n readonly x: SVGAnimatedLength;\r\n readonly y: SVGAnimatedLength;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGMaskElement: {\r\n prototype: SVGMaskElement;\r\n new(): SVGMaskElement;\r\n}\r\n\r\ninterface SVGMatrix {\r\n a: number;\r\n b: number;\r\n c: number;\r\n d: number;\r\n e: number;\r\n f: number;\r\n flipX(): SVGMatrix;\r\n flipY(): SVGMatrix;\r\n inverse(): SVGMatrix;\r\n multiply(secondMatrix: SVGMatrix): SVGMatrix;\r\n rotate(angle: number): SVGMatrix;\r\n rotateFromVector(x: number, y: number): SVGMatrix;\r\n scale(scaleFactor: number): SVGMatrix;\r\n scaleNonUniform(scaleFactorX: number, scaleFactorY: number): SVGMatrix;\r\n skewX(angle: number): SVGMatrix;\r\n skewY(angle: number): SVGMatrix;\r\n translate(x: number, y: number): SVGMatrix;\r\n}\r\n\r\ndeclare var SVGMatrix: {\r\n prototype: SVGMatrix;\r\n new(): SVGMatrix;\r\n}\r\n\r\ninterface SVGMetadataElement extends SVGElement {\r\n}\r\n\r\ndeclare var SVGMetadataElement: {\r\n prototype: SVGMetadataElement;\r\n new(): SVGMetadataElement;\r\n}\r\n\r\ninterface SVGNumber {\r\n value: number;\r\n}\r\n\r\ndeclare var SVGNumber: {\r\n prototype: SVGNumber;\r\n new(): SVGNumber;\r\n}\r\n\r\ninterface SVGNumberList {\r\n readonly numberOfItems: number;\r\n appendItem(newItem: SVGNumber): SVGNumber;\r\n clear(): void;\r\n getItem(index: number): SVGNumber;\r\n initialize(newItem: SVGNumber): SVGNumber;\r\n insertItemBefore(newItem: SVGNumber, index: number): SVGNumber;\r\n removeItem(index: number): SVGNumber;\r\n replaceItem(newItem: SVGNumber, index: number): SVGNumber;\r\n}\r\n\r\ndeclare var SVGNumberList: {\r\n prototype: SVGNumberList;\r\n new(): SVGNumberList;\r\n}\r\n\r\ninterface SVGPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPathData {\r\n createSVGPathSegArcAbs(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcAbs;\r\n createSVGPathSegArcRel(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcRel;\r\n createSVGPathSegClosePath(): SVGPathSegClosePath;\r\n createSVGPathSegCurvetoCubicAbs(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicAbs;\r\n createSVGPathSegCurvetoCubicRel(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicRel;\r\n createSVGPathSegCurvetoCubicSmoothAbs(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothAbs;\r\n createSVGPathSegCurvetoCubicSmoothRel(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothRel;\r\n createSVGPathSegCurvetoQuadraticAbs(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticAbs;\r\n createSVGPathSegCurvetoQuadraticRel(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticRel;\r\n createSVGPathSegCurvetoQuadraticSmoothAbs(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothAbs;\r\n createSVGPathSegCurvetoQuadraticSmoothRel(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothRel;\r\n createSVGPathSegLinetoAbs(x: number, y: number): SVGPathSegLinetoAbs;\r\n createSVGPathSegLinetoHorizontalAbs(x: number): SVGPathSegLinetoHorizontalAbs;\r\n createSVGPathSegLinetoHorizontalRel(x: number): SVGPathSegLinetoHorizontalRel;\r\n createSVGPathSegLinetoRel(x: number, y: number): SVGPathSegLinetoRel;\r\n createSVGPathSegLinetoVerticalAbs(y: number): SVGPathSegLinetoVerticalAbs;\r\n createSVGPathSegLinetoVerticalRel(y: number): SVGPathSegLinetoVerticalRel;\r\n createSVGPathSegMovetoAbs(x: number, y: number): SVGPathSegMovetoAbs;\r\n createSVGPathSegMovetoRel(x: number, y: number): SVGPathSegMovetoRel;\r\n getPathSegAtLength(distance: number): number;\r\n getPointAtLength(distance: number): SVGPoint;\r\n getTotalLength(): number;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGPathElement: {\r\n prototype: SVGPathElement;\r\n new(): SVGPathElement;\r\n}\r\n\r\ninterface SVGPathSeg {\r\n readonly pathSegType: number;\r\n readonly pathSegTypeAsLetter: string;\r\n readonly PATHSEG_ARC_ABS: number;\r\n readonly PATHSEG_ARC_REL: number;\r\n readonly PATHSEG_CLOSEPATH: number;\r\n readonly PATHSEG_CURVETO_CUBIC_ABS: number;\r\n readonly PATHSEG_CURVETO_CUBIC_REL: number;\r\n readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number;\r\n readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number;\r\n readonly PATHSEG_CURVETO_QUADRATIC_ABS: number;\r\n readonly PATHSEG_CURVETO_QUADRATIC_REL: number;\r\n readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number;\r\n readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number;\r\n readonly PATHSEG_LINETO_ABS: number;\r\n readonly PATHSEG_LINETO_HORIZONTAL_ABS: number;\r\n readonly PATHSEG_LINETO_HORIZONTAL_REL: number;\r\n readonly PATHSEG_LINETO_REL: number;\r\n readonly PATHSEG_LINETO_VERTICAL_ABS: number;\r\n readonly PATHSEG_LINETO_VERTICAL_REL: number;\r\n readonly PATHSEG_MOVETO_ABS: number;\r\n readonly PATHSEG_MOVETO_REL: number;\r\n readonly PATHSEG_UNKNOWN: number;\r\n}\r\n\r\ndeclare var SVGPathSeg: {\r\n prototype: SVGPathSeg;\r\n new(): SVGPathSeg;\r\n readonly PATHSEG_ARC_ABS: number;\r\n readonly PATHSEG_ARC_REL: number;\r\n readonly PATHSEG_CLOSEPATH: number;\r\n readonly PATHSEG_CURVETO_CUBIC_ABS: number;\r\n readonly PATHSEG_CURVETO_CUBIC_REL: number;\r\n readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number;\r\n readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number;\r\n readonly PATHSEG_CURVETO_QUADRATIC_ABS: number;\r\n readonly PATHSEG_CURVETO_QUADRATIC_REL: number;\r\n readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number;\r\n readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number;\r\n readonly PATHSEG_LINETO_ABS: number;\r\n readonly PATHSEG_LINETO_HORIZONTAL_ABS: number;\r\n readonly PATHSEG_LINETO_HORIZONTAL_REL: number;\r\n readonly PATHSEG_LINETO_REL: number;\r\n readonly PATHSEG_LINETO_VERTICAL_ABS: number;\r\n readonly PATHSEG_LINETO_VERTICAL_REL: number;\r\n readonly PATHSEG_MOVETO_ABS: number;\r\n readonly PATHSEG_MOVETO_REL: number;\r\n readonly PATHSEG_UNKNOWN: number;\r\n}\r\n\r\ninterface SVGPathSegArcAbs extends SVGPathSeg {\r\n angle: number;\r\n largeArcFlag: boolean;\r\n r1: number;\r\n r2: number;\r\n sweepFlag: boolean;\r\n x: number;\r\n y: number;\r\n}\r\n\r\ndeclare var SVGPathSegArcAbs: {\r\n prototype: SVGPathSegArcAbs;\r\n new(): SVGPathSegArcAbs;\r\n}\r\n\r\ninterface SVGPathSegArcRel extends SVGPathSeg {\r\n angle: number;\r\n largeArcFlag: boolean;\r\n r1: number;\r\n r2: number;\r\n sweepFlag: boolean;\r\n x: number;\r\n y: number;\r\n}\r\n\r\ndeclare var SVGPathSegArcRel: {\r\n prototype: SVGPathSegArcRel;\r\n new(): SVGPathSegArcRel;\r\n}\r\n\r\ninterface SVGPathSegClosePath extends SVGPathSeg {\r\n}\r\n\r\ndeclare var SVGPathSegClosePath: {\r\n prototype: SVGPathSegClosePath;\r\n new(): SVGPathSegClosePath;\r\n}\r\n\r\ninterface SVGPathSegCurvetoCubicAbs extends SVGPathSeg {\r\n x: number;\r\n x1: number;\r\n x2: number;\r\n y: number;\r\n y1: number;\r\n y2: number;\r\n}\r\n\r\ndeclare var SVGPathSegCurvetoCubicAbs: {\r\n prototype: SVGPathSegCurvetoCubicAbs;\r\n new(): SVGPathSegCurvetoCubicAbs;\r\n}\r\n\r\ninterface SVGPathSegCurvetoCubicRel extends SVGPathSeg {\r\n x: number;\r\n x1: number;\r\n x2: number;\r\n y: number;\r\n y1: number;\r\n y2: number;\r\n}\r\n\r\ndeclare var SVGPathSegCurvetoCubicRel: {\r\n prototype: SVGPathSegCurvetoCubicRel;\r\n new(): SVGPathSegCurvetoCubicRel;\r\n}\r\n\r\ninterface SVGPathSegCurvetoCubicSmoothAbs extends SVGPathSeg {\r\n x: number;\r\n x2: number;\r\n y: number;\r\n y2: number;\r\n}\r\n\r\ndeclare var SVGPathSegCurvetoCubicSmoothAbs: {\r\n prototype: SVGPathSegCurvetoCubicSmoothAbs;\r\n new(): SVGPathSegCurvetoCubicSmoothAbs;\r\n}\r\n\r\ninterface SVGPathSegCurvetoCubicSmoothRel extends SVGPathSeg {\r\n x: number;\r\n x2: number;\r\n y: number;\r\n y2: number;\r\n}\r\n\r\ndeclare var SVGPathSegCurvetoCubicSmoothRel: {\r\n prototype: SVGPathSegCurvetoCubicSmoothRel;\r\n new(): SVGPathSegCurvetoCubicSmoothRel;\r\n}\r\n\r\ninterface SVGPathSegCurvetoQuadraticAbs extends SVGPathSeg {\r\n x: number;\r\n x1: number;\r\n y: number;\r\n y1: number;\r\n}\r\n\r\ndeclare var SVGPathSegCurvetoQuadraticAbs: {\r\n prototype: SVGPathSegCurvetoQuadraticAbs;\r\n new(): SVGPathSegCurvetoQuadraticAbs;\r\n}\r\n\r\ninterface SVGPathSegCurvetoQuadraticRel extends SVGPathSeg {\r\n x: number;\r\n x1: number;\r\n y: number;\r\n y1: number;\r\n}\r\n\r\ndeclare var SVGPathSegCurvetoQuadraticRel: {\r\n prototype: SVGPathSegCurvetoQuadraticRel;\r\n new(): SVGPathSegCurvetoQuadraticRel;\r\n}\r\n\r\ninterface SVGPathSegCurvetoQuadraticSmoothAbs extends SVGPathSeg {\r\n x: number;\r\n y: number;\r\n}\r\n\r\ndeclare var SVGPathSegCurvetoQuadraticSmoothAbs: {\r\n prototype: SVGPathSegCurvetoQuadraticSmoothAbs;\r\n new(): SVGPathSegCurvetoQuadraticSmoothAbs;\r\n}\r\n\r\ninterface SVGPathSegCurvetoQuadraticSmoothRel extends SVGPathSeg {\r\n x: number;\r\n y: number;\r\n}\r\n\r\ndeclare var SVGPathSegCurvetoQuadraticSmoothRel: {\r\n prototype: SVGPathSegCurvetoQuadraticSmoothRel;\r\n new(): SVGPathSegCurvetoQuadraticSmoothRel;\r\n}\r\n\r\ninterface SVGPathSegLinetoAbs extends SVGPathSeg {\r\n x: number;\r\n y: number;\r\n}\r\n\r\ndeclare var SVGPathSegLinetoAbs: {\r\n prototype: SVGPathSegLinetoAbs;\r\n new(): SVGPathSegLinetoAbs;\r\n}\r\n\r\ninterface SVGPathSegLinetoHorizontalAbs extends SVGPathSeg {\r\n x: number;\r\n}\r\n\r\ndeclare var SVGPathSegLinetoHorizontalAbs: {\r\n prototype: SVGPathSegLinetoHorizontalAbs;\r\n new(): SVGPathSegLinetoHorizontalAbs;\r\n}\r\n\r\ninterface SVGPathSegLinetoHorizontalRel extends SVGPathSeg {\r\n x: number;\r\n}\r\n\r\ndeclare var SVGPathSegLinetoHorizontalRel: {\r\n prototype: SVGPathSegLinetoHorizontalRel;\r\n new(): SVGPathSegLinetoHorizontalRel;\r\n}\r\n\r\ninterface SVGPathSegLinetoRel extends SVGPathSeg {\r\n x: number;\r\n y: number;\r\n}\r\n\r\ndeclare var SVGPathSegLinetoRel: {\r\n prototype: SVGPathSegLinetoRel;\r\n new(): SVGPathSegLinetoRel;\r\n}\r\n\r\ninterface SVGPathSegLinetoVerticalAbs extends SVGPathSeg {\r\n y: number;\r\n}\r\n\r\ndeclare var SVGPathSegLinetoVerticalAbs: {\r\n prototype: SVGPathSegLinetoVerticalAbs;\r\n new(): SVGPathSegLinetoVerticalAbs;\r\n}\r\n\r\ninterface SVGPathSegLinetoVerticalRel extends SVGPathSeg {\r\n y: number;\r\n}\r\n\r\ndeclare var SVGPathSegLinetoVerticalRel: {\r\n prototype: SVGPathSegLinetoVerticalRel;\r\n new(): SVGPathSegLinetoVerticalRel;\r\n}\r\n\r\ninterface SVGPathSegList {\r\n readonly numberOfItems: number;\r\n appendItem(newItem: SVGPathSeg): SVGPathSeg;\r\n clear(): void;\r\n getItem(index: number): SVGPathSeg;\r\n initialize(newItem: SVGPathSeg): SVGPathSeg;\r\n insertItemBefore(newItem: SVGPathSeg, index: number): SVGPathSeg;\r\n removeItem(index: number): SVGPathSeg;\r\n replaceItem(newItem: SVGPathSeg, index: number): SVGPathSeg;\r\n}\r\n\r\ndeclare var SVGPathSegList: {\r\n prototype: SVGPathSegList;\r\n new(): SVGPathSegList;\r\n}\r\n\r\ninterface SVGPathSegMovetoAbs extends SVGPathSeg {\r\n x: number;\r\n y: number;\r\n}\r\n\r\ndeclare var SVGPathSegMovetoAbs: {\r\n prototype: SVGPathSegMovetoAbs;\r\n new(): SVGPathSegMovetoAbs;\r\n}\r\n\r\ninterface SVGPathSegMovetoRel extends SVGPathSeg {\r\n x: number;\r\n y: number;\r\n}\r\n\r\ndeclare var SVGPathSegMovetoRel: {\r\n prototype: SVGPathSegMovetoRel;\r\n new(): SVGPathSegMovetoRel;\r\n}\r\n\r\ninterface SVGPatternElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGURIReference, SVGUnitTypes {\r\n readonly height: SVGAnimatedLength;\r\n readonly patternContentUnits: SVGAnimatedEnumeration;\r\n readonly patternTransform: SVGAnimatedTransformList;\r\n readonly patternUnits: SVGAnimatedEnumeration;\r\n readonly width: SVGAnimatedLength;\r\n readonly x: SVGAnimatedLength;\r\n readonly y: SVGAnimatedLength;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGPatternElement: {\r\n prototype: SVGPatternElement;\r\n new(): SVGPatternElement;\r\n}\r\n\r\ninterface SVGPoint {\r\n x: number;\r\n y: number;\r\n matrixTransform(matrix: SVGMatrix): SVGPoint;\r\n}\r\n\r\ndeclare var SVGPoint: {\r\n prototype: SVGPoint;\r\n new(): SVGPoint;\r\n}\r\n\r\ninterface SVGPointList {\r\n readonly numberOfItems: number;\r\n appendItem(newItem: SVGPoint): SVGPoint;\r\n clear(): void;\r\n getItem(index: number): SVGPoint;\r\n initialize(newItem: SVGPoint): SVGPoint;\r\n insertItemBefore(newItem: SVGPoint, index: number): SVGPoint;\r\n removeItem(index: number): SVGPoint;\r\n replaceItem(newItem: SVGPoint, index: number): SVGPoint;\r\n}\r\n\r\ndeclare var SVGPointList: {\r\n prototype: SVGPointList;\r\n new(): SVGPointList;\r\n}\r\n\r\ninterface SVGPolygonElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints {\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGPolygonElement: {\r\n prototype: SVGPolygonElement;\r\n new(): SVGPolygonElement;\r\n}\r\n\r\ninterface SVGPolylineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints {\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGPolylineElement: {\r\n prototype: SVGPolylineElement;\r\n new(): SVGPolylineElement;\r\n}\r\n\r\ninterface SVGPreserveAspectRatio {\r\n align: number;\r\n meetOrSlice: number;\r\n readonly SVG_MEETORSLICE_MEET: number;\r\n readonly SVG_MEETORSLICE_SLICE: number;\r\n readonly SVG_MEETORSLICE_UNKNOWN: number;\r\n readonly SVG_PRESERVEASPECTRATIO_NONE: number;\r\n readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number;\r\n}\r\n\r\ndeclare var SVGPreserveAspectRatio: {\r\n prototype: SVGPreserveAspectRatio;\r\n new(): SVGPreserveAspectRatio;\r\n readonly SVG_MEETORSLICE_MEET: number;\r\n readonly SVG_MEETORSLICE_SLICE: number;\r\n readonly SVG_MEETORSLICE_UNKNOWN: number;\r\n readonly SVG_PRESERVEASPECTRATIO_NONE: number;\r\n readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number;\r\n readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number;\r\n}\r\n\r\ninterface SVGRadialGradientElement extends SVGGradientElement {\r\n readonly cx: SVGAnimatedLength;\r\n readonly cy: SVGAnimatedLength;\r\n readonly fx: SVGAnimatedLength;\r\n readonly fy: SVGAnimatedLength;\r\n readonly r: SVGAnimatedLength;\r\n}\r\n\r\ndeclare var SVGRadialGradientElement: {\r\n prototype: SVGRadialGradientElement;\r\n new(): SVGRadialGradientElement;\r\n}\r\n\r\ninterface SVGRect {\r\n height: number;\r\n width: number;\r\n x: number;\r\n y: number;\r\n}\r\n\r\ndeclare var SVGRect: {\r\n prototype: SVGRect;\r\n new(): SVGRect;\r\n}\r\n\r\ninterface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\r\n readonly height: SVGAnimatedLength;\r\n readonly rx: SVGAnimatedLength;\r\n readonly ry: SVGAnimatedLength;\r\n readonly width: SVGAnimatedLength;\r\n readonly x: SVGAnimatedLength;\r\n readonly y: SVGAnimatedLength;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGRectElement: {\r\n prototype: SVGRectElement;\r\n new(): SVGRectElement;\r\n}\r\n\r\ninterface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTests, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan {\r\n contentScriptType: string;\r\n contentStyleType: string;\r\n currentScale: number;\r\n readonly currentTranslate: SVGPoint;\r\n readonly height: SVGAnimatedLength;\r\n onabort: (this: this, ev: Event) => any;\r\n onerror: (this: this, ev: Event) => any;\r\n onresize: (this: this, ev: UIEvent) => any;\r\n onscroll: (this: this, ev: UIEvent) => any;\r\n onunload: (this: this, ev: Event) => any;\r\n onzoom: (this: this, ev: SVGZoomEvent) => any;\r\n readonly pixelUnitToMillimeterX: number;\r\n readonly pixelUnitToMillimeterY: number;\r\n readonly screenPixelToMillimeterX: number;\r\n readonly screenPixelToMillimeterY: number;\r\n readonly viewport: SVGRect;\r\n readonly width: SVGAnimatedLength;\r\n readonly x: SVGAnimatedLength;\r\n readonly y: SVGAnimatedLength;\r\n checkEnclosure(element: SVGElement, rect: SVGRect): boolean;\r\n checkIntersection(element: SVGElement, rect: SVGRect): boolean;\r\n createSVGAngle(): SVGAngle;\r\n createSVGLength(): SVGLength;\r\n createSVGMatrix(): SVGMatrix;\r\n createSVGNumber(): SVGNumber;\r\n createSVGPoint(): SVGPoint;\r\n createSVGRect(): SVGRect;\r\n createSVGTransform(): SVGTransform;\r\n createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform;\r\n deselectAll(): void;\r\n forceRedraw(): void;\r\n getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration;\r\n getCurrentTime(): number;\r\n getElementById(elementId: string): Element;\r\n getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeListOf;\r\n getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeListOf;\r\n pauseAnimations(): void;\r\n setCurrentTime(seconds: number): void;\r\n suspendRedraw(maxWaitMilliseconds: number): number;\r\n unpauseAnimations(): void;\r\n unsuspendRedraw(suspendHandleID: number): void;\r\n unsuspendRedrawAll(): void;\r\n addEventListener(type: \"MSGestureChange\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureDoubleTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureEnd\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureHold\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGotPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSInertiaStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSLostPointerCapture\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerCancel\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerDown\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerEnter\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerLeave\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerMove\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOut\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOver\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerUp\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"SVGAbort\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"SVGError\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"SVGUnload\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"SVGZoom\", listener: (this: this, ev: SVGZoomEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ariarequest\", listener: (this: this, ev: AriaRequestEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"click\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"command\", listener: (this: this, ev: CommandEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dblclick\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"focusin\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"focusout\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"gotpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"lostpointercapture\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousedown\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousemove\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseout\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseover\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseup\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointercancel\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerdown\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerenter\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerleave\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointermove\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerout\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerover\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerup\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"resize\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"scroll\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchcancel\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchend\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchmove\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"touchstart\", listener: (this: this, ev: TouchEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"webkitfullscreenerror\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"wheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGSVGElement: {\r\n prototype: SVGSVGElement;\r\n new(): SVGSVGElement;\r\n}\r\n\r\ninterface SVGScriptElement extends SVGElement, SVGExternalResourcesRequired, SVGURIReference {\r\n type: string;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGScriptElement: {\r\n prototype: SVGScriptElement;\r\n new(): SVGScriptElement;\r\n}\r\n\r\ninterface SVGStopElement extends SVGElement, SVGStylable {\r\n readonly offset: SVGAnimatedNumber;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGStopElement: {\r\n prototype: SVGStopElement;\r\n new(): SVGStopElement;\r\n}\r\n\r\ninterface SVGStringList {\r\n readonly numberOfItems: number;\r\n appendItem(newItem: string): string;\r\n clear(): void;\r\n getItem(index: number): string;\r\n initialize(newItem: string): string;\r\n insertItemBefore(newItem: string, index: number): string;\r\n removeItem(index: number): string;\r\n replaceItem(newItem: string, index: number): string;\r\n}\r\n\r\ndeclare var SVGStringList: {\r\n prototype: SVGStringList;\r\n new(): SVGStringList;\r\n}\r\n\r\ninterface SVGStyleElement extends SVGElement, SVGLangSpace {\r\n disabled: boolean;\r\n media: string;\r\n title: string;\r\n type: string;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGStyleElement: {\r\n prototype: SVGStyleElement;\r\n new(): SVGStyleElement;\r\n}\r\n\r\ninterface SVGSwitchElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGSwitchElement: {\r\n prototype: SVGSwitchElement;\r\n new(): SVGSwitchElement;\r\n}\r\n\r\ninterface SVGSymbolElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox {\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGSymbolElement: {\r\n prototype: SVGSymbolElement;\r\n new(): SVGSymbolElement;\r\n}\r\n\r\ninterface SVGTSpanElement extends SVGTextPositioningElement {\r\n}\r\n\r\ndeclare var SVGTSpanElement: {\r\n prototype: SVGTSpanElement;\r\n new(): SVGTSpanElement;\r\n}\r\n\r\ninterface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\r\n readonly lengthAdjust: SVGAnimatedEnumeration;\r\n readonly textLength: SVGAnimatedLength;\r\n getCharNumAtPosition(point: SVGPoint): number;\r\n getComputedTextLength(): number;\r\n getEndPositionOfChar(charnum: number): SVGPoint;\r\n getExtentOfChar(charnum: number): SVGRect;\r\n getNumberOfChars(): number;\r\n getRotationOfChar(charnum: number): number;\r\n getStartPositionOfChar(charnum: number): SVGPoint;\r\n getSubStringLength(charnum: number, nchars: number): number;\r\n selectSubString(charnum: number, nchars: number): void;\r\n readonly LENGTHADJUST_SPACING: number;\r\n readonly LENGTHADJUST_SPACINGANDGLYPHS: number;\r\n readonly LENGTHADJUST_UNKNOWN: number;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGTextContentElement: {\r\n prototype: SVGTextContentElement;\r\n new(): SVGTextContentElement;\r\n readonly LENGTHADJUST_SPACING: number;\r\n readonly LENGTHADJUST_SPACINGANDGLYPHS: number;\r\n readonly LENGTHADJUST_UNKNOWN: number;\r\n}\r\n\r\ninterface SVGTextElement extends SVGTextPositioningElement, SVGTransformable {\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGTextElement: {\r\n prototype: SVGTextElement;\r\n new(): SVGTextElement;\r\n}\r\n\r\ninterface SVGTextPathElement extends SVGTextContentElement, SVGURIReference {\r\n readonly method: SVGAnimatedEnumeration;\r\n readonly spacing: SVGAnimatedEnumeration;\r\n readonly startOffset: SVGAnimatedLength;\r\n readonly TEXTPATH_METHODTYPE_ALIGN: number;\r\n readonly TEXTPATH_METHODTYPE_STRETCH: number;\r\n readonly TEXTPATH_METHODTYPE_UNKNOWN: number;\r\n readonly TEXTPATH_SPACINGTYPE_AUTO: number;\r\n readonly TEXTPATH_SPACINGTYPE_EXACT: number;\r\n readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGTextPathElement: {\r\n prototype: SVGTextPathElement;\r\n new(): SVGTextPathElement;\r\n readonly TEXTPATH_METHODTYPE_ALIGN: number;\r\n readonly TEXTPATH_METHODTYPE_STRETCH: number;\r\n readonly TEXTPATH_METHODTYPE_UNKNOWN: number;\r\n readonly TEXTPATH_SPACINGTYPE_AUTO: number;\r\n readonly TEXTPATH_SPACINGTYPE_EXACT: number;\r\n readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number;\r\n}\r\n\r\ninterface SVGTextPositioningElement extends SVGTextContentElement {\r\n readonly dx: SVGAnimatedLengthList;\r\n readonly dy: SVGAnimatedLengthList;\r\n readonly rotate: SVGAnimatedNumberList;\r\n readonly x: SVGAnimatedLengthList;\r\n readonly y: SVGAnimatedLengthList;\r\n}\r\n\r\ndeclare var SVGTextPositioningElement: {\r\n prototype: SVGTextPositioningElement;\r\n new(): SVGTextPositioningElement;\r\n}\r\n\r\ninterface SVGTitleElement extends SVGElement, SVGStylable, SVGLangSpace {\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGTitleElement: {\r\n prototype: SVGTitleElement;\r\n new(): SVGTitleElement;\r\n}\r\n\r\ninterface SVGTransform {\r\n readonly angle: number;\r\n readonly matrix: SVGMatrix;\r\n readonly type: number;\r\n setMatrix(matrix: SVGMatrix): void;\r\n setRotate(angle: number, cx: number, cy: number): void;\r\n setScale(sx: number, sy: number): void;\r\n setSkewX(angle: number): void;\r\n setSkewY(angle: number): void;\r\n setTranslate(tx: number, ty: number): void;\r\n readonly SVG_TRANSFORM_MATRIX: number;\r\n readonly SVG_TRANSFORM_ROTATE: number;\r\n readonly SVG_TRANSFORM_SCALE: number;\r\n readonly SVG_TRANSFORM_SKEWX: number;\r\n readonly SVG_TRANSFORM_SKEWY: number;\r\n readonly SVG_TRANSFORM_TRANSLATE: number;\r\n readonly SVG_TRANSFORM_UNKNOWN: number;\r\n}\r\n\r\ndeclare var SVGTransform: {\r\n prototype: SVGTransform;\r\n new(): SVGTransform;\r\n readonly SVG_TRANSFORM_MATRIX: number;\r\n readonly SVG_TRANSFORM_ROTATE: number;\r\n readonly SVG_TRANSFORM_SCALE: number;\r\n readonly SVG_TRANSFORM_SKEWX: number;\r\n readonly SVG_TRANSFORM_SKEWY: number;\r\n readonly SVG_TRANSFORM_TRANSLATE: number;\r\n readonly SVG_TRANSFORM_UNKNOWN: number;\r\n}\r\n\r\ninterface SVGTransformList {\r\n readonly numberOfItems: number;\r\n appendItem(newItem: SVGTransform): SVGTransform;\r\n clear(): void;\r\n consolidate(): SVGTransform;\r\n createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform;\r\n getItem(index: number): SVGTransform;\r\n initialize(newItem: SVGTransform): SVGTransform;\r\n insertItemBefore(newItem: SVGTransform, index: number): SVGTransform;\r\n removeItem(index: number): SVGTransform;\r\n replaceItem(newItem: SVGTransform, index: number): SVGTransform;\r\n}\r\n\r\ndeclare var SVGTransformList: {\r\n prototype: SVGTransformList;\r\n new(): SVGTransformList;\r\n}\r\n\r\ninterface SVGUnitTypes {\r\n readonly SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number;\r\n readonly SVG_UNIT_TYPE_UNKNOWN: number;\r\n readonly SVG_UNIT_TYPE_USERSPACEONUSE: number;\r\n}\r\ndeclare var SVGUnitTypes: SVGUnitTypes;\r\n\r\ninterface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference {\r\n readonly animatedInstanceRoot: SVGElementInstance;\r\n readonly height: SVGAnimatedLength;\r\n readonly instanceRoot: SVGElementInstance;\r\n readonly width: SVGAnimatedLength;\r\n readonly x: SVGAnimatedLength;\r\n readonly y: SVGAnimatedLength;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGUseElement: {\r\n prototype: SVGUseElement;\r\n new(): SVGUseElement;\r\n}\r\n\r\ninterface SVGViewElement extends SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan {\r\n readonly viewTarget: SVGStringList;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var SVGViewElement: {\r\n prototype: SVGViewElement;\r\n new(): SVGViewElement;\r\n}\r\n\r\ninterface SVGZoomAndPan {\r\n readonly zoomAndPan: number;\r\n}\r\n\r\ndeclare var SVGZoomAndPan: {\r\n readonly SVG_ZOOMANDPAN_DISABLE: number;\r\n readonly SVG_ZOOMANDPAN_MAGNIFY: number;\r\n readonly SVG_ZOOMANDPAN_UNKNOWN: number;\r\n}\r\n\r\ninterface SVGZoomEvent extends UIEvent {\r\n readonly newScale: number;\r\n readonly newTranslate: SVGPoint;\r\n readonly previousScale: number;\r\n readonly previousTranslate: SVGPoint;\r\n readonly zoomRectScreen: SVGRect;\r\n}\r\n\r\ndeclare var SVGZoomEvent: {\r\n prototype: SVGZoomEvent;\r\n new(): SVGZoomEvent;\r\n}\r\n\r\ninterface Screen extends EventTarget {\r\n readonly availHeight: number;\r\n readonly availWidth: number;\r\n bufferDepth: number;\r\n readonly colorDepth: number;\r\n readonly deviceXDPI: number;\r\n readonly deviceYDPI: number;\r\n readonly fontSmoothingEnabled: boolean;\r\n readonly height: number;\r\n readonly logicalXDPI: number;\r\n readonly logicalYDPI: number;\r\n readonly msOrientation: string;\r\n onmsorientationchange: (this: this, ev: Event) => any;\r\n readonly pixelDepth: number;\r\n readonly systemXDPI: number;\r\n readonly systemYDPI: number;\r\n readonly width: number;\r\n msLockOrientation(orientations: string | string[]): boolean;\r\n msUnlockOrientation(): void;\r\n addEventListener(type: \"MSOrientationChange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var Screen: {\r\n prototype: Screen;\r\n new(): Screen;\r\n}\r\n\r\ninterface ScriptNotifyEvent extends Event {\r\n readonly callingUri: string;\r\n readonly value: string;\r\n}\r\n\r\ndeclare var ScriptNotifyEvent: {\r\n prototype: ScriptNotifyEvent;\r\n new(): ScriptNotifyEvent;\r\n}\r\n\r\ninterface ScriptProcessorNode extends AudioNode {\r\n readonly bufferSize: number;\r\n onaudioprocess: (this: this, ev: AudioProcessingEvent) => any;\r\n addEventListener(type: \"audioprocess\", listener: (this: this, ev: AudioProcessingEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var ScriptProcessorNode: {\r\n prototype: ScriptProcessorNode;\r\n new(): ScriptProcessorNode;\r\n}\r\n\r\ninterface Selection {\r\n readonly anchorNode: Node;\r\n readonly anchorOffset: number;\r\n readonly focusNode: Node;\r\n readonly focusOffset: number;\r\n readonly isCollapsed: boolean;\r\n readonly rangeCount: number;\r\n readonly type: string;\r\n addRange(range: Range): void;\r\n collapse(parentNode: Node, offset: number): void;\r\n collapseToEnd(): void;\r\n collapseToStart(): void;\r\n containsNode(node: Node, partlyContained: boolean): boolean;\r\n deleteFromDocument(): void;\r\n empty(): void;\r\n extend(newNode: Node, offset: number): void;\r\n getRangeAt(index: number): Range;\r\n removeAllRanges(): void;\r\n removeRange(range: Range): void;\r\n selectAllChildren(parentNode: Node): void;\r\n setBaseAndExtent(baseNode: Node, baseOffset: number, extentNode: Node, extentOffset: number): void;\r\n toString(): string;\r\n}\r\n\r\ndeclare var Selection: {\r\n prototype: Selection;\r\n new(): Selection;\r\n}\r\n\r\ninterface SourceBuffer extends EventTarget {\r\n appendWindowEnd: number;\r\n appendWindowStart: number;\r\n readonly audioTracks: AudioTrackList;\r\n readonly buffered: TimeRanges;\r\n mode: string;\r\n timestampOffset: number;\r\n readonly updating: boolean;\r\n readonly videoTracks: VideoTrackList;\r\n abort(): void;\r\n appendBuffer(data: ArrayBuffer | ArrayBufferView): void;\r\n appendStream(stream: MSStream, maxSize?: number): void;\r\n remove(start: number, end: number): void;\r\n}\r\n\r\ndeclare var SourceBuffer: {\r\n prototype: SourceBuffer;\r\n new(): SourceBuffer;\r\n}\r\n\r\ninterface SourceBufferList extends EventTarget {\r\n readonly length: number;\r\n item(index: number): SourceBuffer;\r\n [index: number]: SourceBuffer;\r\n}\r\n\r\ndeclare var SourceBufferList: {\r\n prototype: SourceBufferList;\r\n new(): SourceBufferList;\r\n}\r\n\r\ninterface StereoPannerNode extends AudioNode {\r\n readonly pan: AudioParam;\r\n}\r\n\r\ndeclare var StereoPannerNode: {\r\n prototype: StereoPannerNode;\r\n new(): StereoPannerNode;\r\n}\r\n\r\ninterface Storage {\r\n readonly length: number;\r\n clear(): void;\r\n getItem(key: string): string | null;\r\n key(index: number): string | null;\r\n removeItem(key: string): void;\r\n setItem(key: string, data: string): void;\r\n [key: string]: any;\r\n [index: number]: string;\r\n}\r\n\r\ndeclare var Storage: {\r\n prototype: Storage;\r\n new(): Storage;\r\n}\r\n\r\ninterface StorageEvent extends Event {\r\n readonly url: string;\r\n key?: string;\r\n oldValue?: string;\r\n newValue?: string;\r\n storageArea?: Storage;\r\n}\r\n\r\ndeclare var StorageEvent: {\r\n prototype: StorageEvent;\r\n new (type: string, eventInitDict?: StorageEventInit): StorageEvent;\r\n}\r\n\r\ninterface StyleMedia {\r\n readonly type: string;\r\n matchMedium(mediaquery: string): boolean;\r\n}\r\n\r\ndeclare var StyleMedia: {\r\n prototype: StyleMedia;\r\n new(): StyleMedia;\r\n}\r\n\r\ninterface StyleSheet {\r\n disabled: boolean;\r\n readonly href: string;\r\n readonly media: MediaList;\r\n readonly ownerNode: Node;\r\n readonly parentStyleSheet: StyleSheet;\r\n readonly title: string;\r\n readonly type: string;\r\n}\r\n\r\ndeclare var StyleSheet: {\r\n prototype: StyleSheet;\r\n new(): StyleSheet;\r\n}\r\n\r\ninterface StyleSheetList {\r\n readonly length: number;\r\n item(index?: number): StyleSheet;\r\n [index: number]: StyleSheet;\r\n}\r\n\r\ndeclare var StyleSheetList: {\r\n prototype: StyleSheetList;\r\n new(): StyleSheetList;\r\n}\r\n\r\ninterface StyleSheetPageList {\r\n readonly length: number;\r\n item(index: number): CSSPageRule;\r\n [index: number]: CSSPageRule;\r\n}\r\n\r\ndeclare var StyleSheetPageList: {\r\n prototype: StyleSheetPageList;\r\n new(): StyleSheetPageList;\r\n}\r\n\r\ninterface SubtleCrypto {\r\n decrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike;\r\n deriveBits(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, length: number): PromiseLike;\r\n deriveKey(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: string | AesDerivedKeyParams | HmacImportParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike;\r\n digest(algorithm: AlgorithmIdentifier, data: BufferSource): PromiseLike;\r\n encrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike;\r\n exportKey(format: \"jwk\", key: CryptoKey): PromiseLike;\r\n exportKey(format: \"raw\" | \"pkcs8\" | \"spki\", key: CryptoKey): PromiseLike;\r\n exportKey(format: string, key: CryptoKey): PromiseLike;\r\n generateKey(algorithm: string, extractable: boolean, keyUsages: string[]): PromiseLike;\r\n generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams | DhKeyGenParams, extractable: boolean, keyUsages: string[]): PromiseLike;\r\n generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike;\r\n importKey(format: \"jwk\", keyData: JsonWebKey, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike;\r\n importKey(format: \"raw\" | \"pkcs8\" | \"spki\", keyData: BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike;\r\n importKey(format: string, keyData: JsonWebKey | BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike;\r\n sign(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, data: BufferSource): PromiseLike;\r\n unwrapKey(format: string, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier, unwrappedKeyAlgorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: string[]): PromiseLike;\r\n verify(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, signature: BufferSource, data: BufferSource): PromiseLike;\r\n wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier): PromiseLike;\r\n}\r\n\r\ndeclare var SubtleCrypto: {\r\n prototype: SubtleCrypto;\r\n new(): SubtleCrypto;\r\n}\r\n\r\ninterface Text extends CharacterData {\r\n readonly wholeText: string;\r\n splitText(offset: number): Text;\r\n}\r\n\r\ndeclare var Text: {\r\n prototype: Text;\r\n new(): Text;\r\n}\r\n\r\ninterface TextEvent extends UIEvent {\r\n readonly data: string;\r\n readonly inputMethod: number;\r\n readonly locale: string;\r\n initTextEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, inputMethod: number, locale: string): void;\r\n readonly DOM_INPUT_METHOD_DROP: number;\r\n readonly DOM_INPUT_METHOD_HANDWRITING: number;\r\n readonly DOM_INPUT_METHOD_IME: number;\r\n readonly DOM_INPUT_METHOD_KEYBOARD: number;\r\n readonly DOM_INPUT_METHOD_MULTIMODAL: number;\r\n readonly DOM_INPUT_METHOD_OPTION: number;\r\n readonly DOM_INPUT_METHOD_PASTE: number;\r\n readonly DOM_INPUT_METHOD_SCRIPT: number;\r\n readonly DOM_INPUT_METHOD_UNKNOWN: number;\r\n readonly DOM_INPUT_METHOD_VOICE: number;\r\n}\r\n\r\ndeclare var TextEvent: {\r\n prototype: TextEvent;\r\n new(): TextEvent;\r\n readonly DOM_INPUT_METHOD_DROP: number;\r\n readonly DOM_INPUT_METHOD_HANDWRITING: number;\r\n readonly DOM_INPUT_METHOD_IME: number;\r\n readonly DOM_INPUT_METHOD_KEYBOARD: number;\r\n readonly DOM_INPUT_METHOD_MULTIMODAL: number;\r\n readonly DOM_INPUT_METHOD_OPTION: number;\r\n readonly DOM_INPUT_METHOD_PASTE: number;\r\n readonly DOM_INPUT_METHOD_SCRIPT: number;\r\n readonly DOM_INPUT_METHOD_UNKNOWN: number;\r\n readonly DOM_INPUT_METHOD_VOICE: number;\r\n}\r\n\r\ninterface TextMetrics {\r\n readonly width: number;\r\n}\r\n\r\ndeclare var TextMetrics: {\r\n prototype: TextMetrics;\r\n new(): TextMetrics;\r\n}\r\n\r\ninterface TextTrack extends EventTarget {\r\n readonly activeCues: TextTrackCueList;\r\n readonly cues: TextTrackCueList;\r\n readonly inBandMetadataTrackDispatchType: string;\r\n readonly kind: string;\r\n readonly label: string;\r\n readonly language: string;\r\n mode: any;\r\n oncuechange: (this: this, ev: Event) => any;\r\n onerror: (this: this, ev: ErrorEvent) => any;\r\n onload: (this: this, ev: Event) => any;\r\n readonly readyState: number;\r\n addCue(cue: TextTrackCue): void;\r\n removeCue(cue: TextTrackCue): void;\r\n readonly DISABLED: number;\r\n readonly ERROR: number;\r\n readonly HIDDEN: number;\r\n readonly LOADED: number;\r\n readonly LOADING: number;\r\n readonly NONE: number;\r\n readonly SHOWING: number;\r\n addEventListener(type: \"cuechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var TextTrack: {\r\n prototype: TextTrack;\r\n new(): TextTrack;\r\n readonly DISABLED: number;\r\n readonly ERROR: number;\r\n readonly HIDDEN: number;\r\n readonly LOADED: number;\r\n readonly LOADING: number;\r\n readonly NONE: number;\r\n readonly SHOWING: number;\r\n}\r\n\r\ninterface TextTrackCue extends EventTarget {\r\n endTime: number;\r\n id: string;\r\n onenter: (this: this, ev: Event) => any;\r\n onexit: (this: this, ev: Event) => any;\r\n pauseOnExit: boolean;\r\n startTime: number;\r\n text: string;\r\n readonly track: TextTrack;\r\n getCueAsHTML(): DocumentFragment;\r\n addEventListener(type: \"enter\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"exit\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var TextTrackCue: {\r\n prototype: TextTrackCue;\r\n new(startTime: number, endTime: number, text: string): TextTrackCue;\r\n}\r\n\r\ninterface TextTrackCueList {\r\n readonly length: number;\r\n getCueById(id: string): TextTrackCue;\r\n item(index: number): TextTrackCue;\r\n [index: number]: TextTrackCue;\r\n}\r\n\r\ndeclare var TextTrackCueList: {\r\n prototype: TextTrackCueList;\r\n new(): TextTrackCueList;\r\n}\r\n\r\ninterface TextTrackList extends EventTarget {\r\n readonly length: number;\r\n onaddtrack: ((this: this, ev: TrackEvent) => any) | null;\r\n item(index: number): TextTrack;\r\n addEventListener(type: \"addtrack\", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n [index: number]: TextTrack;\r\n}\r\n\r\ndeclare var TextTrackList: {\r\n prototype: TextTrackList;\r\n new(): TextTrackList;\r\n}\r\n\r\ninterface TimeRanges {\r\n readonly length: number;\r\n end(index: number): number;\r\n start(index: number): number;\r\n}\r\n\r\ndeclare var TimeRanges: {\r\n prototype: TimeRanges;\r\n new(): TimeRanges;\r\n}\r\n\r\ninterface Touch {\r\n readonly clientX: number;\r\n readonly clientY: number;\r\n readonly identifier: number;\r\n readonly pageX: number;\r\n readonly pageY: number;\r\n readonly screenX: number;\r\n readonly screenY: number;\r\n readonly target: EventTarget;\r\n}\r\n\r\ndeclare var Touch: {\r\n prototype: Touch;\r\n new(): Touch;\r\n}\r\n\r\ninterface TouchEvent extends UIEvent {\r\n readonly altKey: boolean;\r\n readonly changedTouches: TouchList;\r\n readonly ctrlKey: boolean;\r\n readonly metaKey: boolean;\r\n readonly shiftKey: boolean;\r\n readonly targetTouches: TouchList;\r\n readonly touches: TouchList;\r\n}\r\n\r\ndeclare var TouchEvent: {\r\n prototype: TouchEvent;\r\n new(): TouchEvent;\r\n}\r\n\r\ninterface TouchList {\r\n readonly length: number;\r\n item(index: number): Touch | null;\r\n [index: number]: Touch;\r\n}\r\n\r\ndeclare var TouchList: {\r\n prototype: TouchList;\r\n new(): TouchList;\r\n}\r\n\r\ninterface TrackEvent extends Event {\r\n readonly track: any;\r\n}\r\n\r\ndeclare var TrackEvent: {\r\n prototype: TrackEvent;\r\n new(): TrackEvent;\r\n}\r\n\r\ninterface TransitionEvent extends Event {\r\n readonly elapsedTime: number;\r\n readonly propertyName: string;\r\n initTransitionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, propertyNameArg: string, elapsedTimeArg: number): void;\r\n}\r\n\r\ndeclare var TransitionEvent: {\r\n prototype: TransitionEvent;\r\n new(): TransitionEvent;\r\n}\r\n\r\ninterface TreeWalker {\r\n currentNode: Node;\r\n readonly expandEntityReferences: boolean;\r\n readonly filter: NodeFilter;\r\n readonly root: Node;\r\n readonly whatToShow: number;\r\n firstChild(): Node;\r\n lastChild(): Node;\r\n nextNode(): Node;\r\n nextSibling(): Node;\r\n parentNode(): Node;\r\n previousNode(): Node;\r\n previousSibling(): Node;\r\n}\r\n\r\ndeclare var TreeWalker: {\r\n prototype: TreeWalker;\r\n new(): TreeWalker;\r\n}\r\n\r\ninterface UIEvent extends Event {\r\n readonly detail: number;\r\n readonly view: Window;\r\n initUIEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number): void;\r\n}\r\n\r\ndeclare var UIEvent: {\r\n prototype: UIEvent;\r\n new(type: string, eventInitDict?: UIEventInit): UIEvent;\r\n}\r\n\r\ninterface URL {\r\n hash: string;\r\n host: string;\r\n hostname: string;\r\n href: string;\r\n readonly origin: string;\r\n password: string;\r\n pathname: string;\r\n port: string;\r\n protocol: string;\r\n search: string;\r\n username: string;\r\n toString(): string;\r\n}\r\n\r\ndeclare var URL: {\r\n prototype: URL;\r\n new(url: string, base?: string): URL;\r\n createObjectURL(object: any, options?: ObjectURLOptions): string;\r\n revokeObjectURL(url: string): void;\r\n}\r\n\r\ninterface UnviewableContentIdentifiedEvent extends NavigationEventWithReferrer {\r\n readonly mediaType: string;\r\n}\r\n\r\ndeclare var UnviewableContentIdentifiedEvent: {\r\n prototype: UnviewableContentIdentifiedEvent;\r\n new(): UnviewableContentIdentifiedEvent;\r\n}\r\n\r\ninterface ValidityState {\r\n readonly badInput: boolean;\r\n readonly customError: boolean;\r\n readonly patternMismatch: boolean;\r\n readonly rangeOverflow: boolean;\r\n readonly rangeUnderflow: boolean;\r\n readonly stepMismatch: boolean;\r\n readonly tooLong: boolean;\r\n readonly typeMismatch: boolean;\r\n readonly valid: boolean;\r\n readonly valueMissing: boolean;\r\n}\r\n\r\ndeclare var ValidityState: {\r\n prototype: ValidityState;\r\n new(): ValidityState;\r\n}\r\n\r\ninterface VideoPlaybackQuality {\r\n readonly corruptedVideoFrames: number;\r\n readonly creationTime: number;\r\n readonly droppedVideoFrames: number;\r\n readonly totalFrameDelay: number;\r\n readonly totalVideoFrames: number;\r\n}\r\n\r\ndeclare var VideoPlaybackQuality: {\r\n prototype: VideoPlaybackQuality;\r\n new(): VideoPlaybackQuality;\r\n}\r\n\r\ninterface VideoTrack {\r\n readonly id: string;\r\n kind: string;\r\n readonly label: string;\r\n language: string;\r\n selected: boolean;\r\n readonly sourceBuffer: SourceBuffer;\r\n}\r\n\r\ndeclare var VideoTrack: {\r\n prototype: VideoTrack;\r\n new(): VideoTrack;\r\n}\r\n\r\ninterface VideoTrackList extends EventTarget {\r\n readonly length: number;\r\n onaddtrack: (this: this, ev: TrackEvent) => any;\r\n onchange: (this: this, ev: Event) => any;\r\n onremovetrack: (this: this, ev: TrackEvent) => any;\r\n readonly selectedIndex: number;\r\n getTrackById(id: string): VideoTrack | null;\r\n item(index: number): VideoTrack;\r\n addEventListener(type: \"addtrack\", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"change\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"removetrack\", listener: (this: this, ev: TrackEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n [index: number]: VideoTrack;\r\n}\r\n\r\ndeclare var VideoTrackList: {\r\n prototype: VideoTrackList;\r\n new(): VideoTrackList;\r\n}\r\n\r\ninterface WEBGL_compressed_texture_s3tc {\r\n readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number;\r\n readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number;\r\n readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number;\r\n readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number;\r\n}\r\n\r\ndeclare var WEBGL_compressed_texture_s3tc: {\r\n prototype: WEBGL_compressed_texture_s3tc;\r\n new(): WEBGL_compressed_texture_s3tc;\r\n readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number;\r\n readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number;\r\n readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number;\r\n readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number;\r\n}\r\n\r\ninterface WEBGL_debug_renderer_info {\r\n readonly UNMASKED_RENDERER_WEBGL: number;\r\n readonly UNMASKED_VENDOR_WEBGL: number;\r\n}\r\n\r\ndeclare var WEBGL_debug_renderer_info: {\r\n prototype: WEBGL_debug_renderer_info;\r\n new(): WEBGL_debug_renderer_info;\r\n readonly UNMASKED_RENDERER_WEBGL: number;\r\n readonly UNMASKED_VENDOR_WEBGL: number;\r\n}\r\n\r\ninterface WEBGL_depth_texture {\r\n readonly UNSIGNED_INT_24_8_WEBGL: number;\r\n}\r\n\r\ndeclare var WEBGL_depth_texture: {\r\n prototype: WEBGL_depth_texture;\r\n new(): WEBGL_depth_texture;\r\n readonly UNSIGNED_INT_24_8_WEBGL: number;\r\n}\r\n\r\ninterface WaveShaperNode extends AudioNode {\r\n curve: Float32Array | null;\r\n oversample: string;\r\n}\r\n\r\ndeclare var WaveShaperNode: {\r\n prototype: WaveShaperNode;\r\n new(): WaveShaperNode;\r\n}\r\n\r\ninterface WebGLActiveInfo {\r\n readonly name: string;\r\n readonly size: number;\r\n readonly type: number;\r\n}\r\n\r\ndeclare var WebGLActiveInfo: {\r\n prototype: WebGLActiveInfo;\r\n new(): WebGLActiveInfo;\r\n}\r\n\r\ninterface WebGLBuffer extends WebGLObject {\r\n}\r\n\r\ndeclare var WebGLBuffer: {\r\n prototype: WebGLBuffer;\r\n new(): WebGLBuffer;\r\n}\r\n\r\ninterface WebGLContextEvent extends Event {\r\n readonly statusMessage: string;\r\n}\r\n\r\ndeclare var WebGLContextEvent: {\r\n prototype: WebGLContextEvent;\r\n new(type: string, eventInitDict?: WebGLContextEventInit): WebGLContextEvent;\r\n}\r\n\r\ninterface WebGLFramebuffer extends WebGLObject {\r\n}\r\n\r\ndeclare var WebGLFramebuffer: {\r\n prototype: WebGLFramebuffer;\r\n new(): WebGLFramebuffer;\r\n}\r\n\r\ninterface WebGLObject {\r\n}\r\n\r\ndeclare var WebGLObject: {\r\n prototype: WebGLObject;\r\n new(): WebGLObject;\r\n}\r\n\r\ninterface WebGLProgram extends WebGLObject {\r\n}\r\n\r\ndeclare var WebGLProgram: {\r\n prototype: WebGLProgram;\r\n new(): WebGLProgram;\r\n}\r\n\r\ninterface WebGLRenderbuffer extends WebGLObject {\r\n}\r\n\r\ndeclare var WebGLRenderbuffer: {\r\n prototype: WebGLRenderbuffer;\r\n new(): WebGLRenderbuffer;\r\n}\r\n\r\ninterface WebGLRenderingContext {\r\n readonly canvas: HTMLCanvasElement;\r\n readonly drawingBufferHeight: number;\r\n readonly drawingBufferWidth: number;\r\n activeTexture(texture: number): void;\r\n attachShader(program: WebGLProgram | null, shader: WebGLShader | null): void;\r\n bindAttribLocation(program: WebGLProgram | null, index: number, name: string): void;\r\n bindBuffer(target: number, buffer: WebGLBuffer | null): void;\r\n bindFramebuffer(target: number, framebuffer: WebGLFramebuffer | null): void;\r\n bindRenderbuffer(target: number, renderbuffer: WebGLRenderbuffer | null): void;\r\n bindTexture(target: number, texture: WebGLTexture | null): void;\r\n blendColor(red: number, green: number, blue: number, alpha: number): void;\r\n blendEquation(mode: number): void;\r\n blendEquationSeparate(modeRGB: number, modeAlpha: number): void;\r\n blendFunc(sfactor: number, dfactor: number): void;\r\n blendFuncSeparate(srcRGB: number, dstRGB: number, srcAlpha: number, dstAlpha: number): void;\r\n bufferData(target: number, size: number | ArrayBufferView | ArrayBuffer, usage: number): void;\r\n bufferSubData(target: number, offset: number, data: ArrayBufferView | ArrayBuffer): void;\r\n checkFramebufferStatus(target: number): number;\r\n clear(mask: number): void;\r\n clearColor(red: number, green: number, blue: number, alpha: number): void;\r\n clearDepth(depth: number): void;\r\n clearStencil(s: number): void;\r\n colorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void;\r\n compileShader(shader: WebGLShader | null): void;\r\n compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: ArrayBufferView): void;\r\n compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: ArrayBufferView): void;\r\n copyTexImage2D(target: number, level: number, internalformat: number, x: number, y: number, width: number, height: number, border: number): void;\r\n copyTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, x: number, y: number, width: number, height: number): void;\r\n createBuffer(): WebGLBuffer | null;\r\n createFramebuffer(): WebGLFramebuffer | null;\r\n createProgram(): WebGLProgram | null;\r\n createRenderbuffer(): WebGLRenderbuffer | null;\r\n createShader(type: number): WebGLShader | null;\r\n createTexture(): WebGLTexture | null;\r\n cullFace(mode: number): void;\r\n deleteBuffer(buffer: WebGLBuffer | null): void;\r\n deleteFramebuffer(framebuffer: WebGLFramebuffer | null): void;\r\n deleteProgram(program: WebGLProgram | null): void;\r\n deleteRenderbuffer(renderbuffer: WebGLRenderbuffer | null): void;\r\n deleteShader(shader: WebGLShader | null): void;\r\n deleteTexture(texture: WebGLTexture | null): void;\r\n depthFunc(func: number): void;\r\n depthMask(flag: boolean): void;\r\n depthRange(zNear: number, zFar: number): void;\r\n detachShader(program: WebGLProgram | null, shader: WebGLShader | null): void;\r\n disable(cap: number): void;\r\n disableVertexAttribArray(index: number): void;\r\n drawArrays(mode: number, first: number, count: number): void;\r\n drawElements(mode: number, count: number, type: number, offset: number): void;\r\n enable(cap: number): void;\r\n enableVertexAttribArray(index: number): void;\r\n finish(): void;\r\n flush(): void;\r\n framebufferRenderbuffer(target: number, attachment: number, renderbuffertarget: number, renderbuffer: WebGLRenderbuffer | null): void;\r\n framebufferTexture2D(target: number, attachment: number, textarget: number, texture: WebGLTexture | null, level: number): void;\r\n frontFace(mode: number): void;\r\n generateMipmap(target: number): void;\r\n getActiveAttrib(program: WebGLProgram | null, index: number): WebGLActiveInfo | null;\r\n getActiveUniform(program: WebGLProgram | null, index: number): WebGLActiveInfo | null;\r\n getAttachedShaders(program: WebGLProgram | null): WebGLShader[] | null;\r\n getAttribLocation(program: WebGLProgram | null, name: string): number;\r\n getBufferParameter(target: number, pname: number): any;\r\n getContextAttributes(): WebGLContextAttributes;\r\n getError(): number;\r\n getExtension(name: string): any;\r\n getFramebufferAttachmentParameter(target: number, attachment: number, pname: number): any;\r\n getParameter(pname: number): any;\r\n getProgramInfoLog(program: WebGLProgram | null): string | null;\r\n getProgramParameter(program: WebGLProgram | null, pname: number): any;\r\n getRenderbufferParameter(target: number, pname: number): any;\r\n getShaderInfoLog(shader: WebGLShader | null): string | null;\r\n getShaderParameter(shader: WebGLShader | null, pname: number): any;\r\n getShaderPrecisionFormat(shadertype: number, precisiontype: number): WebGLShaderPrecisionFormat | null;\r\n getShaderSource(shader: WebGLShader | null): string | null;\r\n getSupportedExtensions(): string[] | null;\r\n getTexParameter(target: number, pname: number): any;\r\n getUniform(program: WebGLProgram | null, location: WebGLUniformLocation | null): any;\r\n getUniformLocation(program: WebGLProgram | null, name: string): WebGLUniformLocation | null;\r\n getVertexAttrib(index: number, pname: number): any;\r\n getVertexAttribOffset(index: number, pname: number): number;\r\n hint(target: number, mode: number): void;\r\n isBuffer(buffer: WebGLBuffer | null): boolean;\r\n isContextLost(): boolean;\r\n isEnabled(cap: number): boolean;\r\n isFramebuffer(framebuffer: WebGLFramebuffer | null): boolean;\r\n isProgram(program: WebGLProgram | null): boolean;\r\n isRenderbuffer(renderbuffer: WebGLRenderbuffer | null): boolean;\r\n isShader(shader: WebGLShader | null): boolean;\r\n isTexture(texture: WebGLTexture | null): boolean;\r\n lineWidth(width: number): void;\r\n linkProgram(program: WebGLProgram | null): void;\r\n pixelStorei(pname: number, param: number): void;\r\n polygonOffset(factor: number, units: number): void;\r\n readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void;\r\n renderbufferStorage(target: number, internalformat: number, width: number, height: number): void;\r\n sampleCoverage(value: number, invert: boolean): void;\r\n scissor(x: number, y: number, width: number, height: number): void;\r\n shaderSource(shader: WebGLShader | null, source: string): void;\r\n stencilFunc(func: number, ref: number, mask: number): void;\r\n stencilFuncSeparate(face: number, func: number, ref: number, mask: number): void;\r\n stencilMask(mask: number): void;\r\n stencilMaskSeparate(face: number, mask: number): void;\r\n stencilOp(fail: number, zfail: number, zpass: number): void;\r\n stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void;\r\n texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels?: ArrayBufferView): void;\r\n texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void;\r\n texParameterf(target: number, pname: number, param: number): void;\r\n texParameteri(target: number, pname: number, param: number): void;\r\n texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels?: ArrayBufferView): void;\r\n texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void;\r\n uniform1f(location: WebGLUniformLocation | null, x: number): void;\r\n uniform1fv(location: WebGLUniformLocation, v: Float32Array | number[]): void;\r\n uniform1i(location: WebGLUniformLocation | null, x: number): void;\r\n uniform1iv(location: WebGLUniformLocation, v: Int32Array | number[]): void;\r\n uniform2f(location: WebGLUniformLocation | null, x: number, y: number): void;\r\n uniform2fv(location: WebGLUniformLocation, v: Float32Array | number[]): void;\r\n uniform2i(location: WebGLUniformLocation | null, x: number, y: number): void;\r\n uniform2iv(location: WebGLUniformLocation, v: Int32Array | number[]): void;\r\n uniform3f(location: WebGLUniformLocation | null, x: number, y: number, z: number): void;\r\n uniform3fv(location: WebGLUniformLocation, v: Float32Array | number[]): void;\r\n uniform3i(location: WebGLUniformLocation | null, x: number, y: number, z: number): void;\r\n uniform3iv(location: WebGLUniformLocation, v: Int32Array | number[]): void;\r\n uniform4f(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void;\r\n uniform4fv(location: WebGLUniformLocation, v: Float32Array | number[]): void;\r\n uniform4i(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void;\r\n uniform4iv(location: WebGLUniformLocation, v: Int32Array | number[]): void;\r\n uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void;\r\n uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void;\r\n uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void;\r\n useProgram(program: WebGLProgram | null): void;\r\n validateProgram(program: WebGLProgram | null): void;\r\n vertexAttrib1f(indx: number, x: number): void;\r\n vertexAttrib1fv(indx: number, values: Float32Array | number[]): void;\r\n vertexAttrib2f(indx: number, x: number, y: number): void;\r\n vertexAttrib2fv(indx: number, values: Float32Array | number[]): void;\r\n vertexAttrib3f(indx: number, x: number, y: number, z: number): void;\r\n vertexAttrib3fv(indx: number, values: Float32Array | number[]): void;\r\n vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void;\r\n vertexAttrib4fv(indx: number, values: Float32Array | number[]): void;\r\n vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void;\r\n viewport(x: number, y: number, width: number, height: number): void;\r\n readonly ACTIVE_ATTRIBUTES: number;\r\n readonly ACTIVE_TEXTURE: number;\r\n readonly ACTIVE_UNIFORMS: number;\r\n readonly ALIASED_LINE_WIDTH_RANGE: number;\r\n readonly ALIASED_POINT_SIZE_RANGE: number;\r\n readonly ALPHA: number;\r\n readonly ALPHA_BITS: number;\r\n readonly ALWAYS: number;\r\n readonly ARRAY_BUFFER: number;\r\n readonly ARRAY_BUFFER_BINDING: number;\r\n readonly ATTACHED_SHADERS: number;\r\n readonly BACK: number;\r\n readonly BLEND: number;\r\n readonly BLEND_COLOR: number;\r\n readonly BLEND_DST_ALPHA: number;\r\n readonly BLEND_DST_RGB: number;\r\n readonly BLEND_EQUATION: number;\r\n readonly BLEND_EQUATION_ALPHA: number;\r\n readonly BLEND_EQUATION_RGB: number;\r\n readonly BLEND_SRC_ALPHA: number;\r\n readonly BLEND_SRC_RGB: number;\r\n readonly BLUE_BITS: number;\r\n readonly BOOL: number;\r\n readonly BOOL_VEC2: number;\r\n readonly BOOL_VEC3: number;\r\n readonly BOOL_VEC4: number;\r\n readonly BROWSER_DEFAULT_WEBGL: number;\r\n readonly BUFFER_SIZE: number;\r\n readonly BUFFER_USAGE: number;\r\n readonly BYTE: number;\r\n readonly CCW: number;\r\n readonly CLAMP_TO_EDGE: number;\r\n readonly COLOR_ATTACHMENT0: number;\r\n readonly COLOR_BUFFER_BIT: number;\r\n readonly COLOR_CLEAR_VALUE: number;\r\n readonly COLOR_WRITEMASK: number;\r\n readonly COMPILE_STATUS: number;\r\n readonly COMPRESSED_TEXTURE_FORMATS: number;\r\n readonly CONSTANT_ALPHA: number;\r\n readonly CONSTANT_COLOR: number;\r\n readonly CONTEXT_LOST_WEBGL: number;\r\n readonly CULL_FACE: number;\r\n readonly CULL_FACE_MODE: number;\r\n readonly CURRENT_PROGRAM: number;\r\n readonly CURRENT_VERTEX_ATTRIB: number;\r\n readonly CW: number;\r\n readonly DECR: number;\r\n readonly DECR_WRAP: number;\r\n readonly DELETE_STATUS: number;\r\n readonly DEPTH_ATTACHMENT: number;\r\n readonly DEPTH_BITS: number;\r\n readonly DEPTH_BUFFER_BIT: number;\r\n readonly DEPTH_CLEAR_VALUE: number;\r\n readonly DEPTH_COMPONENT: number;\r\n readonly DEPTH_COMPONENT16: number;\r\n readonly DEPTH_FUNC: number;\r\n readonly DEPTH_RANGE: number;\r\n readonly DEPTH_STENCIL: number;\r\n readonly DEPTH_STENCIL_ATTACHMENT: number;\r\n readonly DEPTH_TEST: number;\r\n readonly DEPTH_WRITEMASK: number;\r\n readonly DITHER: number;\r\n readonly DONT_CARE: number;\r\n readonly DST_ALPHA: number;\r\n readonly DST_COLOR: number;\r\n readonly DYNAMIC_DRAW: number;\r\n readonly ELEMENT_ARRAY_BUFFER: number;\r\n readonly ELEMENT_ARRAY_BUFFER_BINDING: number;\r\n readonly EQUAL: number;\r\n readonly FASTEST: number;\r\n readonly FLOAT: number;\r\n readonly FLOAT_MAT2: number;\r\n readonly FLOAT_MAT3: number;\r\n readonly FLOAT_MAT4: number;\r\n readonly FLOAT_VEC2: number;\r\n readonly FLOAT_VEC3: number;\r\n readonly FLOAT_VEC4: number;\r\n readonly FRAGMENT_SHADER: number;\r\n readonly FRAMEBUFFER: number;\r\n readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number;\r\n readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number;\r\n readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number;\r\n readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number;\r\n readonly FRAMEBUFFER_BINDING: number;\r\n readonly FRAMEBUFFER_COMPLETE: number;\r\n readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number;\r\n readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number;\r\n readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number;\r\n readonly FRAMEBUFFER_UNSUPPORTED: number;\r\n readonly FRONT: number;\r\n readonly FRONT_AND_BACK: number;\r\n readonly FRONT_FACE: number;\r\n readonly FUNC_ADD: number;\r\n readonly FUNC_REVERSE_SUBTRACT: number;\r\n readonly FUNC_SUBTRACT: number;\r\n readonly GENERATE_MIPMAP_HINT: number;\r\n readonly GEQUAL: number;\r\n readonly GREATER: number;\r\n readonly GREEN_BITS: number;\r\n readonly HIGH_FLOAT: number;\r\n readonly HIGH_INT: number;\r\n readonly IMPLEMENTATION_COLOR_READ_FORMAT: number;\r\n readonly IMPLEMENTATION_COLOR_READ_TYPE: number;\r\n readonly INCR: number;\r\n readonly INCR_WRAP: number;\r\n readonly INT: number;\r\n readonly INT_VEC2: number;\r\n readonly INT_VEC3: number;\r\n readonly INT_VEC4: number;\r\n readonly INVALID_ENUM: number;\r\n readonly INVALID_FRAMEBUFFER_OPERATION: number;\r\n readonly INVALID_OPERATION: number;\r\n readonly INVALID_VALUE: number;\r\n readonly INVERT: number;\r\n readonly KEEP: number;\r\n readonly LEQUAL: number;\r\n readonly LESS: number;\r\n readonly LINEAR: number;\r\n readonly LINEAR_MIPMAP_LINEAR: number;\r\n readonly LINEAR_MIPMAP_NEAREST: number;\r\n readonly LINES: number;\r\n readonly LINE_LOOP: number;\r\n readonly LINE_STRIP: number;\r\n readonly LINE_WIDTH: number;\r\n readonly LINK_STATUS: number;\r\n readonly LOW_FLOAT: number;\r\n readonly LOW_INT: number;\r\n readonly LUMINANCE: number;\r\n readonly LUMINANCE_ALPHA: number;\r\n readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number;\r\n readonly MAX_CUBE_MAP_TEXTURE_SIZE: number;\r\n readonly MAX_FRAGMENT_UNIFORM_VECTORS: number;\r\n readonly MAX_RENDERBUFFER_SIZE: number;\r\n readonly MAX_TEXTURE_IMAGE_UNITS: number;\r\n readonly MAX_TEXTURE_SIZE: number;\r\n readonly MAX_VARYING_VECTORS: number;\r\n readonly MAX_VERTEX_ATTRIBS: number;\r\n readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number;\r\n readonly MAX_VERTEX_UNIFORM_VECTORS: number;\r\n readonly MAX_VIEWPORT_DIMS: number;\r\n readonly MEDIUM_FLOAT: number;\r\n readonly MEDIUM_INT: number;\r\n readonly MIRRORED_REPEAT: number;\r\n readonly NEAREST: number;\r\n readonly NEAREST_MIPMAP_LINEAR: number;\r\n readonly NEAREST_MIPMAP_NEAREST: number;\r\n readonly NEVER: number;\r\n readonly NICEST: number;\r\n readonly NONE: number;\r\n readonly NOTEQUAL: number;\r\n readonly NO_ERROR: number;\r\n readonly ONE: number;\r\n readonly ONE_MINUS_CONSTANT_ALPHA: number;\r\n readonly ONE_MINUS_CONSTANT_COLOR: number;\r\n readonly ONE_MINUS_DST_ALPHA: number;\r\n readonly ONE_MINUS_DST_COLOR: number;\r\n readonly ONE_MINUS_SRC_ALPHA: number;\r\n readonly ONE_MINUS_SRC_COLOR: number;\r\n readonly OUT_OF_MEMORY: number;\r\n readonly PACK_ALIGNMENT: number;\r\n readonly POINTS: number;\r\n readonly POLYGON_OFFSET_FACTOR: number;\r\n readonly POLYGON_OFFSET_FILL: number;\r\n readonly POLYGON_OFFSET_UNITS: number;\r\n readonly RED_BITS: number;\r\n readonly RENDERBUFFER: number;\r\n readonly RENDERBUFFER_ALPHA_SIZE: number;\r\n readonly RENDERBUFFER_BINDING: number;\r\n readonly RENDERBUFFER_BLUE_SIZE: number;\r\n readonly RENDERBUFFER_DEPTH_SIZE: number;\r\n readonly RENDERBUFFER_GREEN_SIZE: number;\r\n readonly RENDERBUFFER_HEIGHT: number;\r\n readonly RENDERBUFFER_INTERNAL_FORMAT: number;\r\n readonly RENDERBUFFER_RED_SIZE: number;\r\n readonly RENDERBUFFER_STENCIL_SIZE: number;\r\n readonly RENDERBUFFER_WIDTH: number;\r\n readonly RENDERER: number;\r\n readonly REPEAT: number;\r\n readonly REPLACE: number;\r\n readonly RGB: number;\r\n readonly RGB565: number;\r\n readonly RGB5_A1: number;\r\n readonly RGBA: number;\r\n readonly RGBA4: number;\r\n readonly SAMPLER_2D: number;\r\n readonly SAMPLER_CUBE: number;\r\n readonly SAMPLES: number;\r\n readonly SAMPLE_ALPHA_TO_COVERAGE: number;\r\n readonly SAMPLE_BUFFERS: number;\r\n readonly SAMPLE_COVERAGE: number;\r\n readonly SAMPLE_COVERAGE_INVERT: number;\r\n readonly SAMPLE_COVERAGE_VALUE: number;\r\n readonly SCISSOR_BOX: number;\r\n readonly SCISSOR_TEST: number;\r\n readonly SHADER_TYPE: number;\r\n readonly SHADING_LANGUAGE_VERSION: number;\r\n readonly SHORT: number;\r\n readonly SRC_ALPHA: number;\r\n readonly SRC_ALPHA_SATURATE: number;\r\n readonly SRC_COLOR: number;\r\n readonly STATIC_DRAW: number;\r\n readonly STENCIL_ATTACHMENT: number;\r\n readonly STENCIL_BACK_FAIL: number;\r\n readonly STENCIL_BACK_FUNC: number;\r\n readonly STENCIL_BACK_PASS_DEPTH_FAIL: number;\r\n readonly STENCIL_BACK_PASS_DEPTH_PASS: number;\r\n readonly STENCIL_BACK_REF: number;\r\n readonly STENCIL_BACK_VALUE_MASK: number;\r\n readonly STENCIL_BACK_WRITEMASK: number;\r\n readonly STENCIL_BITS: number;\r\n readonly STENCIL_BUFFER_BIT: number;\r\n readonly STENCIL_CLEAR_VALUE: number;\r\n readonly STENCIL_FAIL: number;\r\n readonly STENCIL_FUNC: number;\r\n readonly STENCIL_INDEX: number;\r\n readonly STENCIL_INDEX8: number;\r\n readonly STENCIL_PASS_DEPTH_FAIL: number;\r\n readonly STENCIL_PASS_DEPTH_PASS: number;\r\n readonly STENCIL_REF: number;\r\n readonly STENCIL_TEST: number;\r\n readonly STENCIL_VALUE_MASK: number;\r\n readonly STENCIL_WRITEMASK: number;\r\n readonly STREAM_DRAW: number;\r\n readonly SUBPIXEL_BITS: number;\r\n readonly TEXTURE: number;\r\n readonly TEXTURE0: number;\r\n readonly TEXTURE1: number;\r\n readonly TEXTURE10: number;\r\n readonly TEXTURE11: number;\r\n readonly TEXTURE12: number;\r\n readonly TEXTURE13: number;\r\n readonly TEXTURE14: number;\r\n readonly TEXTURE15: number;\r\n readonly TEXTURE16: number;\r\n readonly TEXTURE17: number;\r\n readonly TEXTURE18: number;\r\n readonly TEXTURE19: number;\r\n readonly TEXTURE2: number;\r\n readonly TEXTURE20: number;\r\n readonly TEXTURE21: number;\r\n readonly TEXTURE22: number;\r\n readonly TEXTURE23: number;\r\n readonly TEXTURE24: number;\r\n readonly TEXTURE25: number;\r\n readonly TEXTURE26: number;\r\n readonly TEXTURE27: number;\r\n readonly TEXTURE28: number;\r\n readonly TEXTURE29: number;\r\n readonly TEXTURE3: number;\r\n readonly TEXTURE30: number;\r\n readonly TEXTURE31: number;\r\n readonly TEXTURE4: number;\r\n readonly TEXTURE5: number;\r\n readonly TEXTURE6: number;\r\n readonly TEXTURE7: number;\r\n readonly TEXTURE8: number;\r\n readonly TEXTURE9: number;\r\n readonly TEXTURE_2D: number;\r\n readonly TEXTURE_BINDING_2D: number;\r\n readonly TEXTURE_BINDING_CUBE_MAP: number;\r\n readonly TEXTURE_CUBE_MAP: number;\r\n readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number;\r\n readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number;\r\n readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number;\r\n readonly TEXTURE_CUBE_MAP_POSITIVE_X: number;\r\n readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number;\r\n readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number;\r\n readonly TEXTURE_MAG_FILTER: number;\r\n readonly TEXTURE_MIN_FILTER: number;\r\n readonly TEXTURE_WRAP_S: number;\r\n readonly TEXTURE_WRAP_T: number;\r\n readonly TRIANGLES: number;\r\n readonly TRIANGLE_FAN: number;\r\n readonly TRIANGLE_STRIP: number;\r\n readonly UNPACK_ALIGNMENT: number;\r\n readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number;\r\n readonly UNPACK_FLIP_Y_WEBGL: number;\r\n readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number;\r\n readonly UNSIGNED_BYTE: number;\r\n readonly UNSIGNED_INT: number;\r\n readonly UNSIGNED_SHORT: number;\r\n readonly UNSIGNED_SHORT_4_4_4_4: number;\r\n readonly UNSIGNED_SHORT_5_5_5_1: number;\r\n readonly UNSIGNED_SHORT_5_6_5: number;\r\n readonly VALIDATE_STATUS: number;\r\n readonly VENDOR: number;\r\n readonly VERSION: number;\r\n readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number;\r\n readonly VERTEX_ATTRIB_ARRAY_ENABLED: number;\r\n readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number;\r\n readonly VERTEX_ATTRIB_ARRAY_POINTER: number;\r\n readonly VERTEX_ATTRIB_ARRAY_SIZE: number;\r\n readonly VERTEX_ATTRIB_ARRAY_STRIDE: number;\r\n readonly VERTEX_ATTRIB_ARRAY_TYPE: number;\r\n readonly VERTEX_SHADER: number;\r\n readonly VIEWPORT: number;\r\n readonly ZERO: number;\r\n}\r\n\r\ndeclare var WebGLRenderingContext: {\r\n prototype: WebGLRenderingContext;\r\n new(): WebGLRenderingContext;\r\n readonly ACTIVE_ATTRIBUTES: number;\r\n readonly ACTIVE_TEXTURE: number;\r\n readonly ACTIVE_UNIFORMS: number;\r\n readonly ALIASED_LINE_WIDTH_RANGE: number;\r\n readonly ALIASED_POINT_SIZE_RANGE: number;\r\n readonly ALPHA: number;\r\n readonly ALPHA_BITS: number;\r\n readonly ALWAYS: number;\r\n readonly ARRAY_BUFFER: number;\r\n readonly ARRAY_BUFFER_BINDING: number;\r\n readonly ATTACHED_SHADERS: number;\r\n readonly BACK: number;\r\n readonly BLEND: number;\r\n readonly BLEND_COLOR: number;\r\n readonly BLEND_DST_ALPHA: number;\r\n readonly BLEND_DST_RGB: number;\r\n readonly BLEND_EQUATION: number;\r\n readonly BLEND_EQUATION_ALPHA: number;\r\n readonly BLEND_EQUATION_RGB: number;\r\n readonly BLEND_SRC_ALPHA: number;\r\n readonly BLEND_SRC_RGB: number;\r\n readonly BLUE_BITS: number;\r\n readonly BOOL: number;\r\n readonly BOOL_VEC2: number;\r\n readonly BOOL_VEC3: number;\r\n readonly BOOL_VEC4: number;\r\n readonly BROWSER_DEFAULT_WEBGL: number;\r\n readonly BUFFER_SIZE: number;\r\n readonly BUFFER_USAGE: number;\r\n readonly BYTE: number;\r\n readonly CCW: number;\r\n readonly CLAMP_TO_EDGE: number;\r\n readonly COLOR_ATTACHMENT0: number;\r\n readonly COLOR_BUFFER_BIT: number;\r\n readonly COLOR_CLEAR_VALUE: number;\r\n readonly COLOR_WRITEMASK: number;\r\n readonly COMPILE_STATUS: number;\r\n readonly COMPRESSED_TEXTURE_FORMATS: number;\r\n readonly CONSTANT_ALPHA: number;\r\n readonly CONSTANT_COLOR: number;\r\n readonly CONTEXT_LOST_WEBGL: number;\r\n readonly CULL_FACE: number;\r\n readonly CULL_FACE_MODE: number;\r\n readonly CURRENT_PROGRAM: number;\r\n readonly CURRENT_VERTEX_ATTRIB: number;\r\n readonly CW: number;\r\n readonly DECR: number;\r\n readonly DECR_WRAP: number;\r\n readonly DELETE_STATUS: number;\r\n readonly DEPTH_ATTACHMENT: number;\r\n readonly DEPTH_BITS: number;\r\n readonly DEPTH_BUFFER_BIT: number;\r\n readonly DEPTH_CLEAR_VALUE: number;\r\n readonly DEPTH_COMPONENT: number;\r\n readonly DEPTH_COMPONENT16: number;\r\n readonly DEPTH_FUNC: number;\r\n readonly DEPTH_RANGE: number;\r\n readonly DEPTH_STENCIL: number;\r\n readonly DEPTH_STENCIL_ATTACHMENT: number;\r\n readonly DEPTH_TEST: number;\r\n readonly DEPTH_WRITEMASK: number;\r\n readonly DITHER: number;\r\n readonly DONT_CARE: number;\r\n readonly DST_ALPHA: number;\r\n readonly DST_COLOR: number;\r\n readonly DYNAMIC_DRAW: number;\r\n readonly ELEMENT_ARRAY_BUFFER: number;\r\n readonly ELEMENT_ARRAY_BUFFER_BINDING: number;\r\n readonly EQUAL: number;\r\n readonly FASTEST: number;\r\n readonly FLOAT: number;\r\n readonly FLOAT_MAT2: number;\r\n readonly FLOAT_MAT3: number;\r\n readonly FLOAT_MAT4: number;\r\n readonly FLOAT_VEC2: number;\r\n readonly FLOAT_VEC3: number;\r\n readonly FLOAT_VEC4: number;\r\n readonly FRAGMENT_SHADER: number;\r\n readonly FRAMEBUFFER: number;\r\n readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number;\r\n readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number;\r\n readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number;\r\n readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number;\r\n readonly FRAMEBUFFER_BINDING: number;\r\n readonly FRAMEBUFFER_COMPLETE: number;\r\n readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number;\r\n readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number;\r\n readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number;\r\n readonly FRAMEBUFFER_UNSUPPORTED: number;\r\n readonly FRONT: number;\r\n readonly FRONT_AND_BACK: number;\r\n readonly FRONT_FACE: number;\r\n readonly FUNC_ADD: number;\r\n readonly FUNC_REVERSE_SUBTRACT: number;\r\n readonly FUNC_SUBTRACT: number;\r\n readonly GENERATE_MIPMAP_HINT: number;\r\n readonly GEQUAL: number;\r\n readonly GREATER: number;\r\n readonly GREEN_BITS: number;\r\n readonly HIGH_FLOAT: number;\r\n readonly HIGH_INT: number;\r\n readonly IMPLEMENTATION_COLOR_READ_FORMAT: number;\r\n readonly IMPLEMENTATION_COLOR_READ_TYPE: number;\r\n readonly INCR: number;\r\n readonly INCR_WRAP: number;\r\n readonly INT: number;\r\n readonly INT_VEC2: number;\r\n readonly INT_VEC3: number;\r\n readonly INT_VEC4: number;\r\n readonly INVALID_ENUM: number;\r\n readonly INVALID_FRAMEBUFFER_OPERATION: number;\r\n readonly INVALID_OPERATION: number;\r\n readonly INVALID_VALUE: number;\r\n readonly INVERT: number;\r\n readonly KEEP: number;\r\n readonly LEQUAL: number;\r\n readonly LESS: number;\r\n readonly LINEAR: number;\r\n readonly LINEAR_MIPMAP_LINEAR: number;\r\n readonly LINEAR_MIPMAP_NEAREST: number;\r\n readonly LINES: number;\r\n readonly LINE_LOOP: number;\r\n readonly LINE_STRIP: number;\r\n readonly LINE_WIDTH: number;\r\n readonly LINK_STATUS: number;\r\n readonly LOW_FLOAT: number;\r\n readonly LOW_INT: number;\r\n readonly LUMINANCE: number;\r\n readonly LUMINANCE_ALPHA: number;\r\n readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number;\r\n readonly MAX_CUBE_MAP_TEXTURE_SIZE: number;\r\n readonly MAX_FRAGMENT_UNIFORM_VECTORS: number;\r\n readonly MAX_RENDERBUFFER_SIZE: number;\r\n readonly MAX_TEXTURE_IMAGE_UNITS: number;\r\n readonly MAX_TEXTURE_SIZE: number;\r\n readonly MAX_VARYING_VECTORS: number;\r\n readonly MAX_VERTEX_ATTRIBS: number;\r\n readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number;\r\n readonly MAX_VERTEX_UNIFORM_VECTORS: number;\r\n readonly MAX_VIEWPORT_DIMS: number;\r\n readonly MEDIUM_FLOAT: number;\r\n readonly MEDIUM_INT: number;\r\n readonly MIRRORED_REPEAT: number;\r\n readonly NEAREST: number;\r\n readonly NEAREST_MIPMAP_LINEAR: number;\r\n readonly NEAREST_MIPMAP_NEAREST: number;\r\n readonly NEVER: number;\r\n readonly NICEST: number;\r\n readonly NONE: number;\r\n readonly NOTEQUAL: number;\r\n readonly NO_ERROR: number;\r\n readonly ONE: number;\r\n readonly ONE_MINUS_CONSTANT_ALPHA: number;\r\n readonly ONE_MINUS_CONSTANT_COLOR: number;\r\n readonly ONE_MINUS_DST_ALPHA: number;\r\n readonly ONE_MINUS_DST_COLOR: number;\r\n readonly ONE_MINUS_SRC_ALPHA: number;\r\n readonly ONE_MINUS_SRC_COLOR: number;\r\n readonly OUT_OF_MEMORY: number;\r\n readonly PACK_ALIGNMENT: number;\r\n readonly POINTS: number;\r\n readonly POLYGON_OFFSET_FACTOR: number;\r\n readonly POLYGON_OFFSET_FILL: number;\r\n readonly POLYGON_OFFSET_UNITS: number;\r\n readonly RED_BITS: number;\r\n readonly RENDERBUFFER: number;\r\n readonly RENDERBUFFER_ALPHA_SIZE: number;\r\n readonly RENDERBUFFER_BINDING: number;\r\n readonly RENDERBUFFER_BLUE_SIZE: number;\r\n readonly RENDERBUFFER_DEPTH_SIZE: number;\r\n readonly RENDERBUFFER_GREEN_SIZE: number;\r\n readonly RENDERBUFFER_HEIGHT: number;\r\n readonly RENDERBUFFER_INTERNAL_FORMAT: number;\r\n readonly RENDERBUFFER_RED_SIZE: number;\r\n readonly RENDERBUFFER_STENCIL_SIZE: number;\r\n readonly RENDERBUFFER_WIDTH: number;\r\n readonly RENDERER: number;\r\n readonly REPEAT: number;\r\n readonly REPLACE: number;\r\n readonly RGB: number;\r\n readonly RGB565: number;\r\n readonly RGB5_A1: number;\r\n readonly RGBA: number;\r\n readonly RGBA4: number;\r\n readonly SAMPLER_2D: number;\r\n readonly SAMPLER_CUBE: number;\r\n readonly SAMPLES: number;\r\n readonly SAMPLE_ALPHA_TO_COVERAGE: number;\r\n readonly SAMPLE_BUFFERS: number;\r\n readonly SAMPLE_COVERAGE: number;\r\n readonly SAMPLE_COVERAGE_INVERT: number;\r\n readonly SAMPLE_COVERAGE_VALUE: number;\r\n readonly SCISSOR_BOX: number;\r\n readonly SCISSOR_TEST: number;\r\n readonly SHADER_TYPE: number;\r\n readonly SHADING_LANGUAGE_VERSION: number;\r\n readonly SHORT: number;\r\n readonly SRC_ALPHA: number;\r\n readonly SRC_ALPHA_SATURATE: number;\r\n readonly SRC_COLOR: number;\r\n readonly STATIC_DRAW: number;\r\n readonly STENCIL_ATTACHMENT: number;\r\n readonly STENCIL_BACK_FAIL: number;\r\n readonly STENCIL_BACK_FUNC: number;\r\n readonly STENCIL_BACK_PASS_DEPTH_FAIL: number;\r\n readonly STENCIL_BACK_PASS_DEPTH_PASS: number;\r\n readonly STENCIL_BACK_REF: number;\r\n readonly STENCIL_BACK_VALUE_MASK: number;\r\n readonly STENCIL_BACK_WRITEMASK: number;\r\n readonly STENCIL_BITS: number;\r\n readonly STENCIL_BUFFER_BIT: number;\r\n readonly STENCIL_CLEAR_VALUE: number;\r\n readonly STENCIL_FAIL: number;\r\n readonly STENCIL_FUNC: number;\r\n readonly STENCIL_INDEX: number;\r\n readonly STENCIL_INDEX8: number;\r\n readonly STENCIL_PASS_DEPTH_FAIL: number;\r\n readonly STENCIL_PASS_DEPTH_PASS: number;\r\n readonly STENCIL_REF: number;\r\n readonly STENCIL_TEST: number;\r\n readonly STENCIL_VALUE_MASK: number;\r\n readonly STENCIL_WRITEMASK: number;\r\n readonly STREAM_DRAW: number;\r\n readonly SUBPIXEL_BITS: number;\r\n readonly TEXTURE: number;\r\n readonly TEXTURE0: number;\r\n readonly TEXTURE1: number;\r\n readonly TEXTURE10: number;\r\n readonly TEXTURE11: number;\r\n readonly TEXTURE12: number;\r\n readonly TEXTURE13: number;\r\n readonly TEXTURE14: number;\r\n readonly TEXTURE15: number;\r\n readonly TEXTURE16: number;\r\n readonly TEXTURE17: number;\r\n readonly TEXTURE18: number;\r\n readonly TEXTURE19: number;\r\n readonly TEXTURE2: number;\r\n readonly TEXTURE20: number;\r\n readonly TEXTURE21: number;\r\n readonly TEXTURE22: number;\r\n readonly TEXTURE23: number;\r\n readonly TEXTURE24: number;\r\n readonly TEXTURE25: number;\r\n readonly TEXTURE26: number;\r\n readonly TEXTURE27: number;\r\n readonly TEXTURE28: number;\r\n readonly TEXTURE29: number;\r\n readonly TEXTURE3: number;\r\n readonly TEXTURE30: number;\r\n readonly TEXTURE31: number;\r\n readonly TEXTURE4: number;\r\n readonly TEXTURE5: number;\r\n readonly TEXTURE6: number;\r\n readonly TEXTURE7: number;\r\n readonly TEXTURE8: number;\r\n readonly TEXTURE9: number;\r\n readonly TEXTURE_2D: number;\r\n readonly TEXTURE_BINDING_2D: number;\r\n readonly TEXTURE_BINDING_CUBE_MAP: number;\r\n readonly TEXTURE_CUBE_MAP: number;\r\n readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number;\r\n readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number;\r\n readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number;\r\n readonly TEXTURE_CUBE_MAP_POSITIVE_X: number;\r\n readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number;\r\n readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number;\r\n readonly TEXTURE_MAG_FILTER: number;\r\n readonly TEXTURE_MIN_FILTER: number;\r\n readonly TEXTURE_WRAP_S: number;\r\n readonly TEXTURE_WRAP_T: number;\r\n readonly TRIANGLES: number;\r\n readonly TRIANGLE_FAN: number;\r\n readonly TRIANGLE_STRIP: number;\r\n readonly UNPACK_ALIGNMENT: number;\r\n readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number;\r\n readonly UNPACK_FLIP_Y_WEBGL: number;\r\n readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number;\r\n readonly UNSIGNED_BYTE: number;\r\n readonly UNSIGNED_INT: number;\r\n readonly UNSIGNED_SHORT: number;\r\n readonly UNSIGNED_SHORT_4_4_4_4: number;\r\n readonly UNSIGNED_SHORT_5_5_5_1: number;\r\n readonly UNSIGNED_SHORT_5_6_5: number;\r\n readonly VALIDATE_STATUS: number;\r\n readonly VENDOR: number;\r\n readonly VERSION: number;\r\n readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number;\r\n readonly VERTEX_ATTRIB_ARRAY_ENABLED: number;\r\n readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number;\r\n readonly VERTEX_ATTRIB_ARRAY_POINTER: number;\r\n readonly VERTEX_ATTRIB_ARRAY_SIZE: number;\r\n readonly VERTEX_ATTRIB_ARRAY_STRIDE: number;\r\n readonly VERTEX_ATTRIB_ARRAY_TYPE: number;\r\n readonly VERTEX_SHADER: number;\r\n readonly VIEWPORT: number;\r\n readonly ZERO: number;\r\n}\r\n\r\ninterface WebGLShader extends WebGLObject {\r\n}\r\n\r\ndeclare var WebGLShader: {\r\n prototype: WebGLShader;\r\n new(): WebGLShader;\r\n}\r\n\r\ninterface WebGLShaderPrecisionFormat {\r\n readonly precision: number;\r\n readonly rangeMax: number;\r\n readonly rangeMin: number;\r\n}\r\n\r\ndeclare var WebGLShaderPrecisionFormat: {\r\n prototype: WebGLShaderPrecisionFormat;\r\n new(): WebGLShaderPrecisionFormat;\r\n}\r\n\r\ninterface WebGLTexture extends WebGLObject {\r\n}\r\n\r\ndeclare var WebGLTexture: {\r\n prototype: WebGLTexture;\r\n new(): WebGLTexture;\r\n}\r\n\r\ninterface WebGLUniformLocation {\r\n}\r\n\r\ndeclare var WebGLUniformLocation: {\r\n prototype: WebGLUniformLocation;\r\n new(): WebGLUniformLocation;\r\n}\r\n\r\ninterface WebKitCSSMatrix {\r\n a: number;\r\n b: number;\r\n c: number;\r\n d: number;\r\n e: number;\r\n f: number;\r\n m11: number;\r\n m12: number;\r\n m13: number;\r\n m14: number;\r\n m21: number;\r\n m22: number;\r\n m23: number;\r\n m24: number;\r\n m31: number;\r\n m32: number;\r\n m33: number;\r\n m34: number;\r\n m41: number;\r\n m42: number;\r\n m43: number;\r\n m44: number;\r\n inverse(): WebKitCSSMatrix;\r\n multiply(secondMatrix: WebKitCSSMatrix): WebKitCSSMatrix;\r\n rotate(angleX: number, angleY?: number, angleZ?: number): WebKitCSSMatrix;\r\n rotateAxisAngle(x: number, y: number, z: number, angle: number): WebKitCSSMatrix;\r\n scale(scaleX: number, scaleY?: number, scaleZ?: number): WebKitCSSMatrix;\r\n setMatrixValue(value: string): void;\r\n skewX(angle: number): WebKitCSSMatrix;\r\n skewY(angle: number): WebKitCSSMatrix;\r\n toString(): string;\r\n translate(x: number, y: number, z?: number): WebKitCSSMatrix;\r\n}\r\n\r\ndeclare var WebKitCSSMatrix: {\r\n prototype: WebKitCSSMatrix;\r\n new(text?: string): WebKitCSSMatrix;\r\n}\r\n\r\ninterface WebKitPoint {\r\n x: number;\r\n y: number;\r\n}\r\n\r\ndeclare var WebKitPoint: {\r\n prototype: WebKitPoint;\r\n new(x?: number, y?: number): WebKitPoint;\r\n}\r\n\r\ninterface WebSocket extends EventTarget {\r\n binaryType: string;\r\n readonly bufferedAmount: number;\r\n readonly extensions: string;\r\n onclose: (this: this, ev: CloseEvent) => any;\r\n onerror: (this: this, ev: ErrorEvent) => any;\r\n onmessage: (this: this, ev: MessageEvent) => any;\r\n onopen: (this: this, ev: Event) => any;\r\n readonly protocol: string;\r\n readonly readyState: number;\r\n readonly url: string;\r\n close(code?: number, reason?: string): void;\r\n send(data: any): void;\r\n readonly CLOSED: number;\r\n readonly CLOSING: number;\r\n readonly CONNECTING: number;\r\n readonly OPEN: number;\r\n addEventListener(type: \"close\", listener: (this: this, ev: CloseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"message\", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"open\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var WebSocket: {\r\n prototype: WebSocket;\r\n new(url: string, protocols?: string | string[]): WebSocket;\r\n readonly CLOSED: number;\r\n readonly CLOSING: number;\r\n readonly CONNECTING: number;\r\n readonly OPEN: number;\r\n}\r\n\r\ninterface WheelEvent extends MouseEvent {\r\n readonly deltaMode: number;\r\n readonly deltaX: number;\r\n readonly deltaY: number;\r\n readonly deltaZ: number;\r\n readonly wheelDelta: number;\r\n readonly wheelDeltaX: number;\r\n readonly wheelDeltaY: number;\r\n getCurrentPoint(element: Element): void;\r\n initWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, deltaXArg: number, deltaYArg: number, deltaZArg: number, deltaMode: number): void;\r\n readonly DOM_DELTA_LINE: number;\r\n readonly DOM_DELTA_PAGE: number;\r\n readonly DOM_DELTA_PIXEL: number;\r\n}\r\n\r\ndeclare var WheelEvent: {\r\n prototype: WheelEvent;\r\n new(typeArg: string, eventInitDict?: WheelEventInit): WheelEvent;\r\n readonly DOM_DELTA_LINE: number;\r\n readonly DOM_DELTA_PAGE: number;\r\n readonly DOM_DELTA_PIXEL: number;\r\n}\r\n\r\ninterface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64 {\r\n readonly applicationCache: ApplicationCache;\r\n readonly clientInformation: Navigator;\r\n readonly closed: boolean;\r\n readonly crypto: Crypto;\r\n defaultStatus: string;\r\n readonly devicePixelRatio: number;\r\n readonly doNotTrack: string;\r\n readonly document: Document;\r\n event: Event;\r\n readonly external: External;\r\n readonly frameElement: Element;\r\n readonly frames: Window;\r\n readonly history: History;\r\n readonly innerHeight: number;\r\n readonly innerWidth: number;\r\n readonly length: number;\r\n readonly location: Location;\r\n readonly locationbar: BarProp;\r\n readonly menubar: BarProp;\r\n readonly msCredentials: MSCredentials;\r\n name: string;\r\n readonly navigator: Navigator;\r\n offscreenBuffering: string | boolean;\r\n onabort: (this: this, ev: UIEvent) => any;\r\n onafterprint: (this: this, ev: Event) => any;\r\n onbeforeprint: (this: this, ev: Event) => any;\r\n onbeforeunload: (this: this, ev: BeforeUnloadEvent) => any;\r\n onblur: (this: this, ev: FocusEvent) => any;\r\n oncanplay: (this: this, ev: Event) => any;\r\n oncanplaythrough: (this: this, ev: Event) => any;\r\n onchange: (this: this, ev: Event) => any;\r\n onclick: (this: this, ev: MouseEvent) => any;\r\n oncompassneedscalibration: (this: this, ev: Event) => any;\r\n oncontextmenu: (this: this, ev: PointerEvent) => any;\r\n ondblclick: (this: this, ev: MouseEvent) => any;\r\n ondevicelight: (this: this, ev: DeviceLightEvent) => any;\r\n ondevicemotion: (this: this, ev: DeviceMotionEvent) => any;\r\n ondeviceorientation: (this: this, ev: DeviceOrientationEvent) => any;\r\n ondrag: (this: this, ev: DragEvent) => any;\r\n ondragend: (this: this, ev: DragEvent) => any;\r\n ondragenter: (this: this, ev: DragEvent) => any;\r\n ondragleave: (this: this, ev: DragEvent) => any;\r\n ondragover: (this: this, ev: DragEvent) => any;\r\n ondragstart: (this: this, ev: DragEvent) => any;\r\n ondrop: (this: this, ev: DragEvent) => any;\r\n ondurationchange: (this: this, ev: Event) => any;\r\n onemptied: (this: this, ev: Event) => any;\r\n onended: (this: this, ev: MediaStreamErrorEvent) => any;\r\n onerror: ErrorEventHandler;\r\n onfocus: (this: this, ev: FocusEvent) => any;\r\n onhashchange: (this: this, ev: HashChangeEvent) => any;\r\n oninput: (this: this, ev: Event) => any;\r\n oninvalid: (this: this, ev: Event) => any;\r\n onkeydown: (this: this, ev: KeyboardEvent) => any;\r\n onkeypress: (this: this, ev: KeyboardEvent) => any;\r\n onkeyup: (this: this, ev: KeyboardEvent) => any;\r\n onload: (this: this, ev: Event) => any;\r\n onloadeddata: (this: this, ev: Event) => any;\r\n onloadedmetadata: (this: this, ev: Event) => any;\r\n onloadstart: (this: this, ev: Event) => any;\r\n onmessage: (this: this, ev: MessageEvent) => any;\r\n onmousedown: (this: this, ev: MouseEvent) => any;\r\n onmouseenter: (this: this, ev: MouseEvent) => any;\r\n onmouseleave: (this: this, ev: MouseEvent) => any;\r\n onmousemove: (this: this, ev: MouseEvent) => any;\r\n onmouseout: (this: this, ev: MouseEvent) => any;\r\n onmouseover: (this: this, ev: MouseEvent) => any;\r\n onmouseup: (this: this, ev: MouseEvent) => any;\r\n onmousewheel: (this: this, ev: WheelEvent) => any;\r\n onmsgesturechange: (this: this, ev: MSGestureEvent) => any;\r\n onmsgesturedoubletap: (this: this, ev: MSGestureEvent) => any;\r\n onmsgestureend: (this: this, ev: MSGestureEvent) => any;\r\n onmsgesturehold: (this: this, ev: MSGestureEvent) => any;\r\n onmsgesturestart: (this: this, ev: MSGestureEvent) => any;\r\n onmsgesturetap: (this: this, ev: MSGestureEvent) => any;\r\n onmsinertiastart: (this: this, ev: MSGestureEvent) => any;\r\n onmspointercancel: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerdown: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerenter: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerleave: (this: this, ev: MSPointerEvent) => any;\r\n onmspointermove: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerout: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerover: (this: this, ev: MSPointerEvent) => any;\r\n onmspointerup: (this: this, ev: MSPointerEvent) => any;\r\n onoffline: (this: this, ev: Event) => any;\r\n ononline: (this: this, ev: Event) => any;\r\n onorientationchange: (this: this, ev: Event) => any;\r\n onpagehide: (this: this, ev: PageTransitionEvent) => any;\r\n onpageshow: (this: this, ev: PageTransitionEvent) => any;\r\n onpause: (this: this, ev: Event) => any;\r\n onplay: (this: this, ev: Event) => any;\r\n onplaying: (this: this, ev: Event) => any;\r\n onpopstate: (this: this, ev: PopStateEvent) => any;\r\n onprogress: (this: this, ev: ProgressEvent) => any;\r\n onratechange: (this: this, ev: Event) => any;\r\n onreadystatechange: (this: this, ev: ProgressEvent) => any;\r\n onreset: (this: this, ev: Event) => any;\r\n onresize: (this: this, ev: UIEvent) => any;\r\n onscroll: (this: this, ev: UIEvent) => any;\r\n onseeked: (this: this, ev: Event) => any;\r\n onseeking: (this: this, ev: Event) => any;\r\n onselect: (this: this, ev: UIEvent) => any;\r\n onstalled: (this: this, ev: Event) => any;\r\n onstorage: (this: this, ev: StorageEvent) => any;\r\n onsubmit: (this: this, ev: Event) => any;\r\n onsuspend: (this: this, ev: Event) => any;\r\n ontimeupdate: (this: this, ev: Event) => any;\r\n ontouchcancel: (ev: TouchEvent) => any;\r\n ontouchend: (ev: TouchEvent) => any;\r\n ontouchmove: (ev: TouchEvent) => any;\r\n ontouchstart: (ev: TouchEvent) => any;\r\n onunload: (this: this, ev: Event) => any;\r\n onvolumechange: (this: this, ev: Event) => any;\r\n onwaiting: (this: this, ev: Event) => any;\r\n opener: any;\r\n orientation: string | number;\r\n readonly outerHeight: number;\r\n readonly outerWidth: number;\r\n readonly pageXOffset: number;\r\n readonly pageYOffset: number;\r\n readonly parent: Window;\r\n readonly performance: Performance;\r\n readonly personalbar: BarProp;\r\n readonly screen: Screen;\r\n readonly screenLeft: number;\r\n readonly screenTop: number;\r\n readonly screenX: number;\r\n readonly screenY: number;\r\n readonly scrollX: number;\r\n readonly scrollY: number;\r\n readonly scrollbars: BarProp;\r\n readonly self: Window;\r\n status: string;\r\n readonly statusbar: BarProp;\r\n readonly styleMedia: StyleMedia;\r\n readonly toolbar: BarProp;\r\n readonly top: Window;\r\n readonly window: Window;\r\n URL: typeof URL;\r\n Blob: typeof Blob;\r\n alert(message?: any): void;\r\n blur(): void;\r\n cancelAnimationFrame(handle: number): void;\r\n captureEvents(): void;\r\n close(): void;\r\n confirm(message?: string): boolean;\r\n focus(): void;\r\n getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration;\r\n getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList;\r\n getSelection(): Selection;\r\n matchMedia(mediaQuery: string): MediaQueryList;\r\n moveBy(x?: number, y?: number): void;\r\n moveTo(x?: number, y?: number): void;\r\n msWriteProfilerMark(profilerMarkName: string): void;\r\n open(url?: string, target?: string, features?: string, replace?: boolean): Window;\r\n postMessage(message: any, targetOrigin: string, transfer?: any[]): void;\r\n print(): void;\r\n prompt(message?: string, _default?: string): string | null;\r\n releaseEvents(): void;\r\n requestAnimationFrame(callback: FrameRequestCallback): number;\r\n resizeBy(x?: number, y?: number): void;\r\n resizeTo(x?: number, y?: number): void;\r\n scroll(x?: number, y?: number): void;\r\n scrollBy(x?: number, y?: number): void;\r\n scrollTo(x?: number, y?: number): void;\r\n webkitCancelAnimationFrame(handle: number): void;\r\n webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint;\r\n webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint;\r\n webkitRequestAnimationFrame(callback: FrameRequestCallback): number;\r\n scroll(options?: ScrollToOptions): void;\r\n scrollTo(options?: ScrollToOptions): void;\r\n scrollBy(options?: ScrollToOptions): void;\r\n addEventListener(type: \"MSGestureChange\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureDoubleTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureEnd\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureHold\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSGestureTap\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSInertiaStart\", listener: (this: this, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerCancel\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerDown\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerEnter\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerLeave\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerMove\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOut\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerOver\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"MSPointerUp\", listener: (this: this, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"abort\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"afterprint\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforeprint\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"beforeunload\", listener: (this: this, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"blur\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplay\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"canplaythrough\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"change\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"click\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"compassneedscalibration\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"contextmenu\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dblclick\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"devicelight\", listener: (this: this, ev: DeviceLightEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"devicemotion\", listener: (this: this, ev: DeviceMotionEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"deviceorientation\", listener: (this: this, ev: DeviceOrientationEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drag\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragend\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragenter\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragleave\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragover\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"dragstart\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"drop\", listener: (this: this, ev: DragEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"durationchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"emptied\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ended\", listener: (this: this, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"focus\", listener: (this: this, ev: FocusEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"hashchange\", listener: (this: this, ev: HashChangeEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"input\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"invalid\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keydown\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keypress\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"keyup\", listener: (this: this, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadeddata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadedmetadata\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"message\", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousedown\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseenter\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseleave\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousemove\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseout\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseover\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mouseup\", listener: (this: this, ev: MouseEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"mousewheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"offline\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"online\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"orientationchange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pagehide\", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pageshow\", listener: (this: this, ev: PageTransitionEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pause\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"play\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"playing\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointercancel\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerdown\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerenter\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerleave\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointermove\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerout\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerover\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerup\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"popstate\", listener: (this: this, ev: PopStateEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"progress\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"ratechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"readystatechange\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"reset\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"resize\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"scroll\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeked\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"seeking\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"select\", listener: (this: this, ev: UIEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"stalled\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"storage\", listener: (this: this, ev: StorageEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"submit\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"suspend\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"timeupdate\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"unload\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"volumechange\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"waiting\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"wheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n [index: number]: Window;\r\n}\r\n\r\ndeclare var Window: {\r\n prototype: Window;\r\n new(): Window;\r\n}\r\n\r\ninterface Worker extends EventTarget, AbstractWorker {\r\n onmessage: (this: this, ev: MessageEvent) => any;\r\n postMessage(message: any, ports?: any): void;\r\n terminate(): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"message\", listener: (this: this, ev: MessageEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var Worker: {\r\n prototype: Worker;\r\n new(stringUrl: string): Worker;\r\n}\r\n\r\ninterface XMLDocument extends Document {\r\n}\r\n\r\ndeclare var XMLDocument: {\r\n prototype: XMLDocument;\r\n new(): XMLDocument;\r\n}\r\n\r\ninterface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {\r\n onreadystatechange: (this: this, ev: ProgressEvent) => any;\r\n readonly readyState: number;\r\n readonly response: any;\r\n readonly responseText: string;\r\n responseType: string;\r\n readonly responseXML: any;\r\n readonly status: number;\r\n readonly statusText: string;\r\n timeout: number;\r\n readonly upload: XMLHttpRequestUpload;\r\n withCredentials: boolean;\r\n msCaching?: string;\r\n abort(): void;\r\n getAllResponseHeaders(): string;\r\n getResponseHeader(header: string): string | null;\r\n msCachingEnabled(): boolean;\r\n open(method: string, url: string, async?: boolean, user?: string, password?: string): void;\r\n overrideMimeType(mime: string): void;\r\n send(data?: Document): void;\r\n send(data?: string): void;\r\n send(data?: any): void;\r\n setRequestHeader(header: string, value: string): void;\r\n readonly DONE: number;\r\n readonly HEADERS_RECEIVED: number;\r\n readonly LOADING: number;\r\n readonly OPENED: number;\r\n readonly UNSENT: number;\r\n addEventListener(type: \"abort\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadend\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"progress\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"readystatechange\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"timeout\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var XMLHttpRequest: {\r\n prototype: XMLHttpRequest;\r\n new(): XMLHttpRequest;\r\n readonly DONE: number;\r\n readonly HEADERS_RECEIVED: number;\r\n readonly LOADING: number;\r\n readonly OPENED: number;\r\n readonly UNSENT: number;\r\n create(): XMLHttpRequest;\r\n}\r\n\r\ninterface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget {\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ndeclare var XMLHttpRequestUpload: {\r\n prototype: XMLHttpRequestUpload;\r\n new(): XMLHttpRequestUpload;\r\n}\r\n\r\ninterface XMLSerializer {\r\n serializeToString(target: Node): string;\r\n}\r\n\r\ndeclare var XMLSerializer: {\r\n prototype: XMLSerializer;\r\n new(): XMLSerializer;\r\n}\r\n\r\ninterface XPathEvaluator {\r\n createExpression(expression: string, resolver: XPathNSResolver): XPathExpression;\r\n createNSResolver(nodeResolver?: Node): XPathNSResolver;\r\n evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult;\r\n}\r\n\r\ndeclare var XPathEvaluator: {\r\n prototype: XPathEvaluator;\r\n new(): XPathEvaluator;\r\n}\r\n\r\ninterface XPathExpression {\r\n evaluate(contextNode: Node, type: number, result: XPathResult): XPathExpression;\r\n}\r\n\r\ndeclare var XPathExpression: {\r\n prototype: XPathExpression;\r\n new(): XPathExpression;\r\n}\r\n\r\ninterface XPathNSResolver {\r\n lookupNamespaceURI(prefix: string): string;\r\n}\r\n\r\ndeclare var XPathNSResolver: {\r\n prototype: XPathNSResolver;\r\n new(): XPathNSResolver;\r\n}\r\n\r\ninterface XPathResult {\r\n readonly booleanValue: boolean;\r\n readonly invalidIteratorState: boolean;\r\n readonly numberValue: number;\r\n readonly resultType: number;\r\n readonly singleNodeValue: Node;\r\n readonly snapshotLength: number;\r\n readonly stringValue: string;\r\n iterateNext(): Node;\r\n snapshotItem(index: number): Node;\r\n readonly ANY_TYPE: number;\r\n readonly ANY_UNORDERED_NODE_TYPE: number;\r\n readonly BOOLEAN_TYPE: number;\r\n readonly FIRST_ORDERED_NODE_TYPE: number;\r\n readonly NUMBER_TYPE: number;\r\n readonly ORDERED_NODE_ITERATOR_TYPE: number;\r\n readonly ORDERED_NODE_SNAPSHOT_TYPE: number;\r\n readonly STRING_TYPE: number;\r\n readonly UNORDERED_NODE_ITERATOR_TYPE: number;\r\n readonly UNORDERED_NODE_SNAPSHOT_TYPE: number;\r\n}\r\n\r\ndeclare var XPathResult: {\r\n prototype: XPathResult;\r\n new(): XPathResult;\r\n readonly ANY_TYPE: number;\r\n readonly ANY_UNORDERED_NODE_TYPE: number;\r\n readonly BOOLEAN_TYPE: number;\r\n readonly FIRST_ORDERED_NODE_TYPE: number;\r\n readonly NUMBER_TYPE: number;\r\n readonly ORDERED_NODE_ITERATOR_TYPE: number;\r\n readonly ORDERED_NODE_SNAPSHOT_TYPE: number;\r\n readonly STRING_TYPE: number;\r\n readonly UNORDERED_NODE_ITERATOR_TYPE: number;\r\n readonly UNORDERED_NODE_SNAPSHOT_TYPE: number;\r\n}\r\n\r\ninterface XSLTProcessor {\r\n clearParameters(): void;\r\n getParameter(namespaceURI: string, localName: string): any;\r\n importStylesheet(style: Node): void;\r\n removeParameter(namespaceURI: string, localName: string): void;\r\n reset(): void;\r\n setParameter(namespaceURI: string, localName: string, value: any): void;\r\n transformToDocument(source: Node): Document;\r\n transformToFragment(source: Node, document: Document): DocumentFragment;\r\n}\r\n\r\ndeclare var XSLTProcessor: {\r\n prototype: XSLTProcessor;\r\n new(): XSLTProcessor;\r\n}\r\n\r\ninterface AbstractWorker {\r\n onerror: (this: this, ev: ErrorEvent) => any;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ninterface CanvasPathMethods {\r\n arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;\r\n arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void;\r\n bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void;\r\n closePath(): void;\r\n ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;\r\n lineTo(x: number, y: number): void;\r\n moveTo(x: number, y: number): void;\r\n quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;\r\n rect(x: number, y: number, w: number, h: number): void;\r\n}\r\n\r\ninterface ChildNode {\r\n remove(): void;\r\n}\r\n\r\ninterface DOML2DeprecatedColorProperty {\r\n color: string;\r\n}\r\n\r\ninterface DOML2DeprecatedSizeProperty {\r\n size: number;\r\n}\r\n\r\ninterface DocumentEvent {\r\n createEvent(eventInterface:\"AnimationEvent\"): AnimationEvent;\r\n createEvent(eventInterface:\"AriaRequestEvent\"): AriaRequestEvent;\r\n createEvent(eventInterface:\"AudioProcessingEvent\"): AudioProcessingEvent;\r\n createEvent(eventInterface:\"BeforeUnloadEvent\"): BeforeUnloadEvent;\r\n createEvent(eventInterface:\"ClipboardEvent\"): ClipboardEvent;\r\n createEvent(eventInterface:\"CloseEvent\"): CloseEvent;\r\n createEvent(eventInterface:\"CommandEvent\"): CommandEvent;\r\n createEvent(eventInterface:\"CompositionEvent\"): CompositionEvent;\r\n createEvent(eventInterface:\"CustomEvent\"): CustomEvent;\r\n createEvent(eventInterface:\"DeviceLightEvent\"): DeviceLightEvent;\r\n createEvent(eventInterface:\"DeviceMotionEvent\"): DeviceMotionEvent;\r\n createEvent(eventInterface:\"DeviceOrientationEvent\"): DeviceOrientationEvent;\r\n createEvent(eventInterface:\"DragEvent\"): DragEvent;\r\n createEvent(eventInterface:\"ErrorEvent\"): ErrorEvent;\r\n createEvent(eventInterface:\"Event\"): Event;\r\n createEvent(eventInterface:\"Events\"): Event;\r\n createEvent(eventInterface:\"FocusEvent\"): FocusEvent;\r\n createEvent(eventInterface:\"GamepadEvent\"): GamepadEvent;\r\n createEvent(eventInterface:\"HashChangeEvent\"): HashChangeEvent;\r\n createEvent(eventInterface:\"IDBVersionChangeEvent\"): IDBVersionChangeEvent;\r\n createEvent(eventInterface:\"KeyboardEvent\"): KeyboardEvent;\r\n createEvent(eventInterface:\"ListeningStateChangedEvent\"): ListeningStateChangedEvent;\r\n createEvent(eventInterface:\"LongRunningScriptDetectedEvent\"): LongRunningScriptDetectedEvent;\r\n createEvent(eventInterface:\"MSGestureEvent\"): MSGestureEvent;\r\n createEvent(eventInterface:\"MSManipulationEvent\"): MSManipulationEvent;\r\n createEvent(eventInterface:\"MSMediaKeyMessageEvent\"): MSMediaKeyMessageEvent;\r\n createEvent(eventInterface:\"MSMediaKeyNeededEvent\"): MSMediaKeyNeededEvent;\r\n createEvent(eventInterface:\"MSPointerEvent\"): MSPointerEvent;\r\n createEvent(eventInterface:\"MSSiteModeEvent\"): MSSiteModeEvent;\r\n createEvent(eventInterface:\"MediaEncryptedEvent\"): MediaEncryptedEvent;\r\n createEvent(eventInterface:\"MediaKeyMessageEvent\"): MediaKeyMessageEvent;\r\n createEvent(eventInterface:\"MediaStreamErrorEvent\"): MediaStreamErrorEvent;\r\n createEvent(eventInterface:\"MediaStreamTrackEvent\"): MediaStreamTrackEvent;\r\n createEvent(eventInterface:\"MessageEvent\"): MessageEvent;\r\n createEvent(eventInterface:\"MouseEvent\"): MouseEvent;\r\n createEvent(eventInterface:\"MouseEvents\"): MouseEvent;\r\n createEvent(eventInterface:\"MutationEvent\"): MutationEvent;\r\n createEvent(eventInterface:\"MutationEvents\"): MutationEvent;\r\n createEvent(eventInterface:\"NavigationCompletedEvent\"): NavigationCompletedEvent;\r\n createEvent(eventInterface:\"NavigationEvent\"): NavigationEvent;\r\n createEvent(eventInterface:\"NavigationEventWithReferrer\"): NavigationEventWithReferrer;\r\n createEvent(eventInterface:\"OfflineAudioCompletionEvent\"): OfflineAudioCompletionEvent;\r\n createEvent(eventInterface:\"OverflowEvent\"): OverflowEvent;\r\n createEvent(eventInterface:\"PageTransitionEvent\"): PageTransitionEvent;\r\n createEvent(eventInterface:\"PermissionRequestedEvent\"): PermissionRequestedEvent;\r\n createEvent(eventInterface:\"PointerEvent\"): PointerEvent;\r\n createEvent(eventInterface:\"PopStateEvent\"): PopStateEvent;\r\n createEvent(eventInterface:\"ProgressEvent\"): ProgressEvent;\r\n createEvent(eventInterface:\"RTCDTMFToneChangeEvent\"): RTCDTMFToneChangeEvent;\r\n createEvent(eventInterface:\"RTCDtlsTransportStateChangedEvent\"): RTCDtlsTransportStateChangedEvent;\r\n createEvent(eventInterface:\"RTCIceCandidatePairChangedEvent\"): RTCIceCandidatePairChangedEvent;\r\n createEvent(eventInterface:\"RTCIceGathererEvent\"): RTCIceGathererEvent;\r\n createEvent(eventInterface:\"RTCIceTransportStateChangedEvent\"): RTCIceTransportStateChangedEvent;\r\n createEvent(eventInterface:\"RTCSsrcConflictEvent\"): RTCSsrcConflictEvent;\r\n createEvent(eventInterface:\"SVGZoomEvent\"): SVGZoomEvent;\r\n createEvent(eventInterface:\"SVGZoomEvents\"): SVGZoomEvent;\r\n createEvent(eventInterface:\"ScriptNotifyEvent\"): ScriptNotifyEvent;\r\n createEvent(eventInterface:\"StorageEvent\"): StorageEvent;\r\n createEvent(eventInterface:\"TextEvent\"): TextEvent;\r\n createEvent(eventInterface:\"TouchEvent\"): TouchEvent;\r\n createEvent(eventInterface:\"TrackEvent\"): TrackEvent;\r\n createEvent(eventInterface:\"TransitionEvent\"): TransitionEvent;\r\n createEvent(eventInterface:\"UIEvent\"): UIEvent;\r\n createEvent(eventInterface:\"UIEvents\"): UIEvent;\r\n createEvent(eventInterface:\"UnviewableContentIdentifiedEvent\"): UnviewableContentIdentifiedEvent;\r\n createEvent(eventInterface:\"WebGLContextEvent\"): WebGLContextEvent;\r\n createEvent(eventInterface:\"WheelEvent\"): WheelEvent;\r\n createEvent(eventInterface: string): Event;\r\n}\r\n\r\ninterface ElementTraversal {\r\n readonly childElementCount: number;\r\n readonly firstElementChild: Element;\r\n readonly lastElementChild: Element;\r\n readonly nextElementSibling: Element;\r\n readonly previousElementSibling: Element;\r\n}\r\n\r\ninterface GetSVGDocument {\r\n getSVGDocument(): Document;\r\n}\r\n\r\ninterface GlobalEventHandlers {\r\n onpointercancel: (this: this, ev: PointerEvent) => any;\r\n onpointerdown: (this: this, ev: PointerEvent) => any;\r\n onpointerenter: (this: this, ev: PointerEvent) => any;\r\n onpointerleave: (this: this, ev: PointerEvent) => any;\r\n onpointermove: (this: this, ev: PointerEvent) => any;\r\n onpointerout: (this: this, ev: PointerEvent) => any;\r\n onpointerover: (this: this, ev: PointerEvent) => any;\r\n onpointerup: (this: this, ev: PointerEvent) => any;\r\n onwheel: (this: this, ev: WheelEvent) => any;\r\n addEventListener(type: \"pointercancel\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerdown\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerenter\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerleave\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointermove\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerout\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerover\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"pointerup\", listener: (this: this, ev: PointerEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"wheel\", listener: (this: this, ev: WheelEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ninterface HTMLTableAlignment {\r\n /**\r\n * Sets or retrieves a value that you can use to implement your own ch functionality for the object.\r\n */\r\n ch: string;\r\n /**\r\n * Sets or retrieves a value that you can use to implement your own chOff functionality for the object.\r\n */\r\n chOff: string;\r\n /**\r\n * Sets or retrieves how text and other content are vertically aligned within the object that contains them.\r\n */\r\n vAlign: string;\r\n}\r\n\r\ninterface IDBEnvironment {\r\n readonly indexedDB: IDBFactory;\r\n}\r\n\r\ninterface LinkStyle {\r\n readonly sheet: StyleSheet;\r\n}\r\n\r\ninterface MSBaseReader {\r\n onabort: (this: this, ev: Event) => any;\r\n onerror: (this: this, ev: ErrorEvent) => any;\r\n onload: (this: this, ev: Event) => any;\r\n onloadend: (this: this, ev: ProgressEvent) => any;\r\n onloadstart: (this: this, ev: Event) => any;\r\n onprogress: (this: this, ev: ProgressEvent) => any;\r\n readonly readyState: number;\r\n readonly result: any;\r\n abort(): void;\r\n readonly DONE: number;\r\n readonly EMPTY: number;\r\n readonly LOADING: number;\r\n addEventListener(type: \"abort\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadend\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"progress\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ninterface MSFileSaver {\r\n msSaveBlob(blob: any, defaultName?: string): boolean;\r\n msSaveOrOpenBlob(blob: any, defaultName?: string): boolean;\r\n}\r\n\r\ninterface MSNavigatorDoNotTrack {\r\n confirmSiteSpecificTrackingException(args: ConfirmSiteSpecificExceptionsInformation): boolean;\r\n confirmWebWideTrackingException(args: ExceptionInformation): boolean;\r\n removeSiteSpecificTrackingException(args: ExceptionInformation): void;\r\n removeWebWideTrackingException(args: ExceptionInformation): void;\r\n storeSiteSpecificTrackingException(args: StoreSiteSpecificExceptionsInformation): void;\r\n storeWebWideTrackingException(args: StoreExceptionsInformation): void;\r\n}\r\n\r\ninterface NavigatorContentUtils {\r\n}\r\n\r\ninterface NavigatorGeolocation {\r\n readonly geolocation: Geolocation;\r\n}\r\n\r\ninterface NavigatorID {\r\n readonly appName: string;\r\n readonly appVersion: string;\r\n readonly platform: string;\r\n readonly product: string;\r\n readonly productSub: string;\r\n readonly userAgent: string;\r\n readonly vendor: string;\r\n readonly vendorSub: string;\r\n}\r\n\r\ninterface NavigatorOnLine {\r\n readonly onLine: boolean;\r\n}\r\n\r\ninterface NavigatorStorageUtils {\r\n}\r\n\r\ninterface NavigatorUserMedia {\r\n readonly mediaDevices: MediaDevices;\r\n getUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void;\r\n}\r\n\r\ninterface NodeSelector {\r\n querySelector(selectors: \"a\"): HTMLAnchorElement;\r\n querySelector(selectors: \"abbr\"): HTMLElement;\r\n querySelector(selectors: \"acronym\"): HTMLElement;\r\n querySelector(selectors: \"address\"): HTMLElement;\r\n querySelector(selectors: \"applet\"): HTMLAppletElement;\r\n querySelector(selectors: \"area\"): HTMLAreaElement;\r\n querySelector(selectors: \"article\"): HTMLElement;\r\n querySelector(selectors: \"aside\"): HTMLElement;\r\n querySelector(selectors: \"audio\"): HTMLAudioElement;\r\n querySelector(selectors: \"b\"): HTMLElement;\r\n querySelector(selectors: \"base\"): HTMLBaseElement;\r\n querySelector(selectors: \"basefont\"): HTMLBaseFontElement;\r\n querySelector(selectors: \"bdo\"): HTMLElement;\r\n querySelector(selectors: \"big\"): HTMLElement;\r\n querySelector(selectors: \"blockquote\"): HTMLQuoteElement;\r\n querySelector(selectors: \"body\"): HTMLBodyElement;\r\n querySelector(selectors: \"br\"): HTMLBRElement;\r\n querySelector(selectors: \"button\"): HTMLButtonElement;\r\n querySelector(selectors: \"canvas\"): HTMLCanvasElement;\r\n querySelector(selectors: \"caption\"): HTMLTableCaptionElement;\r\n querySelector(selectors: \"center\"): HTMLElement;\r\n querySelector(selectors: \"circle\"): SVGCircleElement;\r\n querySelector(selectors: \"cite\"): HTMLElement;\r\n querySelector(selectors: \"clippath\"): SVGClipPathElement;\r\n querySelector(selectors: \"code\"): HTMLElement;\r\n querySelector(selectors: \"col\"): HTMLTableColElement;\r\n querySelector(selectors: \"colgroup\"): HTMLTableColElement;\r\n querySelector(selectors: \"datalist\"): HTMLDataListElement;\r\n querySelector(selectors: \"dd\"): HTMLElement;\r\n querySelector(selectors: \"defs\"): SVGDefsElement;\r\n querySelector(selectors: \"del\"): HTMLModElement;\r\n querySelector(selectors: \"desc\"): SVGDescElement;\r\n querySelector(selectors: \"dfn\"): HTMLElement;\r\n querySelector(selectors: \"dir\"): HTMLDirectoryElement;\r\n querySelector(selectors: \"div\"): HTMLDivElement;\r\n querySelector(selectors: \"dl\"): HTMLDListElement;\r\n querySelector(selectors: \"dt\"): HTMLElement;\r\n querySelector(selectors: \"ellipse\"): SVGEllipseElement;\r\n querySelector(selectors: \"em\"): HTMLElement;\r\n querySelector(selectors: \"embed\"): HTMLEmbedElement;\r\n querySelector(selectors: \"feblend\"): SVGFEBlendElement;\r\n querySelector(selectors: \"fecolormatrix\"): SVGFEColorMatrixElement;\r\n querySelector(selectors: \"fecomponenttransfer\"): SVGFEComponentTransferElement;\r\n querySelector(selectors: \"fecomposite\"): SVGFECompositeElement;\r\n querySelector(selectors: \"feconvolvematrix\"): SVGFEConvolveMatrixElement;\r\n querySelector(selectors: \"fediffuselighting\"): SVGFEDiffuseLightingElement;\r\n querySelector(selectors: \"fedisplacementmap\"): SVGFEDisplacementMapElement;\r\n querySelector(selectors: \"fedistantlight\"): SVGFEDistantLightElement;\r\n querySelector(selectors: \"feflood\"): SVGFEFloodElement;\r\n querySelector(selectors: \"fefunca\"): SVGFEFuncAElement;\r\n querySelector(selectors: \"fefuncb\"): SVGFEFuncBElement;\r\n querySelector(selectors: \"fefuncg\"): SVGFEFuncGElement;\r\n querySelector(selectors: \"fefuncr\"): SVGFEFuncRElement;\r\n querySelector(selectors: \"fegaussianblur\"): SVGFEGaussianBlurElement;\r\n querySelector(selectors: \"feimage\"): SVGFEImageElement;\r\n querySelector(selectors: \"femerge\"): SVGFEMergeElement;\r\n querySelector(selectors: \"femergenode\"): SVGFEMergeNodeElement;\r\n querySelector(selectors: \"femorphology\"): SVGFEMorphologyElement;\r\n querySelector(selectors: \"feoffset\"): SVGFEOffsetElement;\r\n querySelector(selectors: \"fepointlight\"): SVGFEPointLightElement;\r\n querySelector(selectors: \"fespecularlighting\"): SVGFESpecularLightingElement;\r\n querySelector(selectors: \"fespotlight\"): SVGFESpotLightElement;\r\n querySelector(selectors: \"fetile\"): SVGFETileElement;\r\n querySelector(selectors: \"feturbulence\"): SVGFETurbulenceElement;\r\n querySelector(selectors: \"fieldset\"): HTMLFieldSetElement;\r\n querySelector(selectors: \"figcaption\"): HTMLElement;\r\n querySelector(selectors: \"figure\"): HTMLElement;\r\n querySelector(selectors: \"filter\"): SVGFilterElement;\r\n querySelector(selectors: \"font\"): HTMLFontElement;\r\n querySelector(selectors: \"footer\"): HTMLElement;\r\n querySelector(selectors: \"foreignobject\"): SVGForeignObjectElement;\r\n querySelector(selectors: \"form\"): HTMLFormElement;\r\n querySelector(selectors: \"frame\"): HTMLFrameElement;\r\n querySelector(selectors: \"frameset\"): HTMLFrameSetElement;\r\n querySelector(selectors: \"g\"): SVGGElement;\r\n querySelector(selectors: \"h1\"): HTMLHeadingElement;\r\n querySelector(selectors: \"h2\"): HTMLHeadingElement;\r\n querySelector(selectors: \"h3\"): HTMLHeadingElement;\r\n querySelector(selectors: \"h4\"): HTMLHeadingElement;\r\n querySelector(selectors: \"h5\"): HTMLHeadingElement;\r\n querySelector(selectors: \"h6\"): HTMLHeadingElement;\r\n querySelector(selectors: \"head\"): HTMLHeadElement;\r\n querySelector(selectors: \"header\"): HTMLElement;\r\n querySelector(selectors: \"hgroup\"): HTMLElement;\r\n querySelector(selectors: \"hr\"): HTMLHRElement;\r\n querySelector(selectors: \"html\"): HTMLHtmlElement;\r\n querySelector(selectors: \"i\"): HTMLElement;\r\n querySelector(selectors: \"iframe\"): HTMLIFrameElement;\r\n querySelector(selectors: \"image\"): SVGImageElement;\r\n querySelector(selectors: \"img\"): HTMLImageElement;\r\n querySelector(selectors: \"input\"): HTMLInputElement;\r\n querySelector(selectors: \"ins\"): HTMLModElement;\r\n querySelector(selectors: \"isindex\"): HTMLUnknownElement;\r\n querySelector(selectors: \"kbd\"): HTMLElement;\r\n querySelector(selectors: \"keygen\"): HTMLElement;\r\n querySelector(selectors: \"label\"): HTMLLabelElement;\r\n querySelector(selectors: \"legend\"): HTMLLegendElement;\r\n querySelector(selectors: \"li\"): HTMLLIElement;\r\n querySelector(selectors: \"line\"): SVGLineElement;\r\n querySelector(selectors: \"lineargradient\"): SVGLinearGradientElement;\r\n querySelector(selectors: \"link\"): HTMLLinkElement;\r\n querySelector(selectors: \"listing\"): HTMLPreElement;\r\n querySelector(selectors: \"map\"): HTMLMapElement;\r\n querySelector(selectors: \"mark\"): HTMLElement;\r\n querySelector(selectors: \"marker\"): SVGMarkerElement;\r\n querySelector(selectors: \"marquee\"): HTMLMarqueeElement;\r\n querySelector(selectors: \"mask\"): SVGMaskElement;\r\n querySelector(selectors: \"menu\"): HTMLMenuElement;\r\n querySelector(selectors: \"meta\"): HTMLMetaElement;\r\n querySelector(selectors: \"metadata\"): SVGMetadataElement;\r\n querySelector(selectors: \"meter\"): HTMLMeterElement;\r\n querySelector(selectors: \"nav\"): HTMLElement;\r\n querySelector(selectors: \"nextid\"): HTMLUnknownElement;\r\n querySelector(selectors: \"nobr\"): HTMLElement;\r\n querySelector(selectors: \"noframes\"): HTMLElement;\r\n querySelector(selectors: \"noscript\"): HTMLElement;\r\n querySelector(selectors: \"object\"): HTMLObjectElement;\r\n querySelector(selectors: \"ol\"): HTMLOListElement;\r\n querySelector(selectors: \"optgroup\"): HTMLOptGroupElement;\r\n querySelector(selectors: \"option\"): HTMLOptionElement;\r\n querySelector(selectors: \"p\"): HTMLParagraphElement;\r\n querySelector(selectors: \"param\"): HTMLParamElement;\r\n querySelector(selectors: \"path\"): SVGPathElement;\r\n querySelector(selectors: \"pattern\"): SVGPatternElement;\r\n querySelector(selectors: \"picture\"): HTMLPictureElement;\r\n querySelector(selectors: \"plaintext\"): HTMLElement;\r\n querySelector(selectors: \"polygon\"): SVGPolygonElement;\r\n querySelector(selectors: \"polyline\"): SVGPolylineElement;\r\n querySelector(selectors: \"pre\"): HTMLPreElement;\r\n querySelector(selectors: \"progress\"): HTMLProgressElement;\r\n querySelector(selectors: \"q\"): HTMLQuoteElement;\r\n querySelector(selectors: \"radialgradient\"): SVGRadialGradientElement;\r\n querySelector(selectors: \"rect\"): SVGRectElement;\r\n querySelector(selectors: \"rt\"): HTMLElement;\r\n querySelector(selectors: \"ruby\"): HTMLElement;\r\n querySelector(selectors: \"s\"): HTMLElement;\r\n querySelector(selectors: \"samp\"): HTMLElement;\r\n querySelector(selectors: \"script\"): HTMLScriptElement;\r\n querySelector(selectors: \"section\"): HTMLElement;\r\n querySelector(selectors: \"select\"): HTMLSelectElement;\r\n querySelector(selectors: \"small\"): HTMLElement;\r\n querySelector(selectors: \"source\"): HTMLSourceElement;\r\n querySelector(selectors: \"span\"): HTMLSpanElement;\r\n querySelector(selectors: \"stop\"): SVGStopElement;\r\n querySelector(selectors: \"strike\"): HTMLElement;\r\n querySelector(selectors: \"strong\"): HTMLElement;\r\n querySelector(selectors: \"style\"): HTMLStyleElement;\r\n querySelector(selectors: \"sub\"): HTMLElement;\r\n querySelector(selectors: \"sup\"): HTMLElement;\r\n querySelector(selectors: \"svg\"): SVGSVGElement;\r\n querySelector(selectors: \"switch\"): SVGSwitchElement;\r\n querySelector(selectors: \"symbol\"): SVGSymbolElement;\r\n querySelector(selectors: \"table\"): HTMLTableElement;\r\n querySelector(selectors: \"tbody\"): HTMLTableSectionElement;\r\n querySelector(selectors: \"td\"): HTMLTableDataCellElement;\r\n querySelector(selectors: \"template\"): HTMLTemplateElement;\r\n querySelector(selectors: \"text\"): SVGTextElement;\r\n querySelector(selectors: \"textpath\"): SVGTextPathElement;\r\n querySelector(selectors: \"textarea\"): HTMLTextAreaElement;\r\n querySelector(selectors: \"tfoot\"): HTMLTableSectionElement;\r\n querySelector(selectors: \"th\"): HTMLTableHeaderCellElement;\r\n querySelector(selectors: \"thead\"): HTMLTableSectionElement;\r\n querySelector(selectors: \"title\"): HTMLTitleElement;\r\n querySelector(selectors: \"tr\"): HTMLTableRowElement;\r\n querySelector(selectors: \"track\"): HTMLTrackElement;\r\n querySelector(selectors: \"tspan\"): SVGTSpanElement;\r\n querySelector(selectors: \"tt\"): HTMLElement;\r\n querySelector(selectors: \"u\"): HTMLElement;\r\n querySelector(selectors: \"ul\"): HTMLUListElement;\r\n querySelector(selectors: \"use\"): SVGUseElement;\r\n querySelector(selectors: \"var\"): HTMLElement;\r\n querySelector(selectors: \"video\"): HTMLVideoElement;\r\n querySelector(selectors: \"view\"): SVGViewElement;\r\n querySelector(selectors: \"wbr\"): HTMLElement;\r\n querySelector(selectors: \"x-ms-webview\"): MSHTMLWebViewElement;\r\n querySelector(selectors: \"xmp\"): HTMLPreElement;\r\n querySelector(selectors: string): Element;\r\n querySelectorAll(selectors: \"a\"): NodeListOf;\r\n querySelectorAll(selectors: \"abbr\"): NodeListOf;\r\n querySelectorAll(selectors: \"acronym\"): NodeListOf;\r\n querySelectorAll(selectors: \"address\"): NodeListOf;\r\n querySelectorAll(selectors: \"applet\"): NodeListOf;\r\n querySelectorAll(selectors: \"area\"): NodeListOf;\r\n querySelectorAll(selectors: \"article\"): NodeListOf;\r\n querySelectorAll(selectors: \"aside\"): NodeListOf;\r\n querySelectorAll(selectors: \"audio\"): NodeListOf;\r\n querySelectorAll(selectors: \"b\"): NodeListOf;\r\n querySelectorAll(selectors: \"base\"): NodeListOf;\r\n querySelectorAll(selectors: \"basefont\"): NodeListOf;\r\n querySelectorAll(selectors: \"bdo\"): NodeListOf;\r\n querySelectorAll(selectors: \"big\"): NodeListOf;\r\n querySelectorAll(selectors: \"blockquote\"): NodeListOf;\r\n querySelectorAll(selectors: \"body\"): NodeListOf;\r\n querySelectorAll(selectors: \"br\"): NodeListOf;\r\n querySelectorAll(selectors: \"button\"): NodeListOf;\r\n querySelectorAll(selectors: \"canvas\"): NodeListOf;\r\n querySelectorAll(selectors: \"caption\"): NodeListOf;\r\n querySelectorAll(selectors: \"center\"): NodeListOf;\r\n querySelectorAll(selectors: \"circle\"): NodeListOf;\r\n querySelectorAll(selectors: \"cite\"): NodeListOf;\r\n querySelectorAll(selectors: \"clippath\"): NodeListOf;\r\n querySelectorAll(selectors: \"code\"): NodeListOf;\r\n querySelectorAll(selectors: \"col\"): NodeListOf;\r\n querySelectorAll(selectors: \"colgroup\"): NodeListOf;\r\n querySelectorAll(selectors: \"datalist\"): NodeListOf;\r\n querySelectorAll(selectors: \"dd\"): NodeListOf;\r\n querySelectorAll(selectors: \"defs\"): NodeListOf;\r\n querySelectorAll(selectors: \"del\"): NodeListOf;\r\n querySelectorAll(selectors: \"desc\"): NodeListOf;\r\n querySelectorAll(selectors: \"dfn\"): NodeListOf;\r\n querySelectorAll(selectors: \"dir\"): NodeListOf;\r\n querySelectorAll(selectors: \"div\"): NodeListOf;\r\n querySelectorAll(selectors: \"dl\"): NodeListOf;\r\n querySelectorAll(selectors: \"dt\"): NodeListOf;\r\n querySelectorAll(selectors: \"ellipse\"): NodeListOf;\r\n querySelectorAll(selectors: \"em\"): NodeListOf;\r\n querySelectorAll(selectors: \"embed\"): NodeListOf;\r\n querySelectorAll(selectors: \"feblend\"): NodeListOf;\r\n querySelectorAll(selectors: \"fecolormatrix\"): NodeListOf;\r\n querySelectorAll(selectors: \"fecomponenttransfer\"): NodeListOf;\r\n querySelectorAll(selectors: \"fecomposite\"): NodeListOf;\r\n querySelectorAll(selectors: \"feconvolvematrix\"): NodeListOf;\r\n querySelectorAll(selectors: \"fediffuselighting\"): NodeListOf;\r\n querySelectorAll(selectors: \"fedisplacementmap\"): NodeListOf;\r\n querySelectorAll(selectors: \"fedistantlight\"): NodeListOf;\r\n querySelectorAll(selectors: \"feflood\"): NodeListOf;\r\n querySelectorAll(selectors: \"fefunca\"): NodeListOf;\r\n querySelectorAll(selectors: \"fefuncb\"): NodeListOf;\r\n querySelectorAll(selectors: \"fefuncg\"): NodeListOf;\r\n querySelectorAll(selectors: \"fefuncr\"): NodeListOf;\r\n querySelectorAll(selectors: \"fegaussianblur\"): NodeListOf;\r\n querySelectorAll(selectors: \"feimage\"): NodeListOf;\r\n querySelectorAll(selectors: \"femerge\"): NodeListOf;\r\n querySelectorAll(selectors: \"femergenode\"): NodeListOf;\r\n querySelectorAll(selectors: \"femorphology\"): NodeListOf;\r\n querySelectorAll(selectors: \"feoffset\"): NodeListOf;\r\n querySelectorAll(selectors: \"fepointlight\"): NodeListOf;\r\n querySelectorAll(selectors: \"fespecularlighting\"): NodeListOf;\r\n querySelectorAll(selectors: \"fespotlight\"): NodeListOf;\r\n querySelectorAll(selectors: \"fetile\"): NodeListOf;\r\n querySelectorAll(selectors: \"feturbulence\"): NodeListOf;\r\n querySelectorAll(selectors: \"fieldset\"): NodeListOf;\r\n querySelectorAll(selectors: \"figcaption\"): NodeListOf;\r\n querySelectorAll(selectors: \"figure\"): NodeListOf;\r\n querySelectorAll(selectors: \"filter\"): NodeListOf;\r\n querySelectorAll(selectors: \"font\"): NodeListOf;\r\n querySelectorAll(selectors: \"footer\"): NodeListOf;\r\n querySelectorAll(selectors: \"foreignobject\"): NodeListOf;\r\n querySelectorAll(selectors: \"form\"): NodeListOf;\r\n querySelectorAll(selectors: \"frame\"): NodeListOf;\r\n querySelectorAll(selectors: \"frameset\"): NodeListOf;\r\n querySelectorAll(selectors: \"g\"): NodeListOf;\r\n querySelectorAll(selectors: \"h1\"): NodeListOf;\r\n querySelectorAll(selectors: \"h2\"): NodeListOf;\r\n querySelectorAll(selectors: \"h3\"): NodeListOf;\r\n querySelectorAll(selectors: \"h4\"): NodeListOf;\r\n querySelectorAll(selectors: \"h5\"): NodeListOf;\r\n querySelectorAll(selectors: \"h6\"): NodeListOf;\r\n querySelectorAll(selectors: \"head\"): NodeListOf;\r\n querySelectorAll(selectors: \"header\"): NodeListOf;\r\n querySelectorAll(selectors: \"hgroup\"): NodeListOf;\r\n querySelectorAll(selectors: \"hr\"): NodeListOf;\r\n querySelectorAll(selectors: \"html\"): NodeListOf;\r\n querySelectorAll(selectors: \"i\"): NodeListOf;\r\n querySelectorAll(selectors: \"iframe\"): NodeListOf;\r\n querySelectorAll(selectors: \"image\"): NodeListOf;\r\n querySelectorAll(selectors: \"img\"): NodeListOf;\r\n querySelectorAll(selectors: \"input\"): NodeListOf;\r\n querySelectorAll(selectors: \"ins\"): NodeListOf;\r\n querySelectorAll(selectors: \"isindex\"): NodeListOf;\r\n querySelectorAll(selectors: \"kbd\"): NodeListOf;\r\n querySelectorAll(selectors: \"keygen\"): NodeListOf;\r\n querySelectorAll(selectors: \"label\"): NodeListOf;\r\n querySelectorAll(selectors: \"legend\"): NodeListOf;\r\n querySelectorAll(selectors: \"li\"): NodeListOf;\r\n querySelectorAll(selectors: \"line\"): NodeListOf;\r\n querySelectorAll(selectors: \"lineargradient\"): NodeListOf;\r\n querySelectorAll(selectors: \"link\"): NodeListOf;\r\n querySelectorAll(selectors: \"listing\"): NodeListOf;\r\n querySelectorAll(selectors: \"map\"): NodeListOf;\r\n querySelectorAll(selectors: \"mark\"): NodeListOf;\r\n querySelectorAll(selectors: \"marker\"): NodeListOf;\r\n querySelectorAll(selectors: \"marquee\"): NodeListOf;\r\n querySelectorAll(selectors: \"mask\"): NodeListOf;\r\n querySelectorAll(selectors: \"menu\"): NodeListOf;\r\n querySelectorAll(selectors: \"meta\"): NodeListOf;\r\n querySelectorAll(selectors: \"metadata\"): NodeListOf;\r\n querySelectorAll(selectors: \"meter\"): NodeListOf;\r\n querySelectorAll(selectors: \"nav\"): NodeListOf;\r\n querySelectorAll(selectors: \"nextid\"): NodeListOf;\r\n querySelectorAll(selectors: \"nobr\"): NodeListOf;\r\n querySelectorAll(selectors: \"noframes\"): NodeListOf;\r\n querySelectorAll(selectors: \"noscript\"): NodeListOf;\r\n querySelectorAll(selectors: \"object\"): NodeListOf;\r\n querySelectorAll(selectors: \"ol\"): NodeListOf;\r\n querySelectorAll(selectors: \"optgroup\"): NodeListOf;\r\n querySelectorAll(selectors: \"option\"): NodeListOf;\r\n querySelectorAll(selectors: \"p\"): NodeListOf;\r\n querySelectorAll(selectors: \"param\"): NodeListOf;\r\n querySelectorAll(selectors: \"path\"): NodeListOf;\r\n querySelectorAll(selectors: \"pattern\"): NodeListOf;\r\n querySelectorAll(selectors: \"picture\"): NodeListOf;\r\n querySelectorAll(selectors: \"plaintext\"): NodeListOf;\r\n querySelectorAll(selectors: \"polygon\"): NodeListOf;\r\n querySelectorAll(selectors: \"polyline\"): NodeListOf;\r\n querySelectorAll(selectors: \"pre\"): NodeListOf;\r\n querySelectorAll(selectors: \"progress\"): NodeListOf;\r\n querySelectorAll(selectors: \"q\"): NodeListOf;\r\n querySelectorAll(selectors: \"radialgradient\"): NodeListOf;\r\n querySelectorAll(selectors: \"rect\"): NodeListOf;\r\n querySelectorAll(selectors: \"rt\"): NodeListOf;\r\n querySelectorAll(selectors: \"ruby\"): NodeListOf;\r\n querySelectorAll(selectors: \"s\"): NodeListOf;\r\n querySelectorAll(selectors: \"samp\"): NodeListOf;\r\n querySelectorAll(selectors: \"script\"): NodeListOf;\r\n querySelectorAll(selectors: \"section\"): NodeListOf;\r\n querySelectorAll(selectors: \"select\"): NodeListOf;\r\n querySelectorAll(selectors: \"small\"): NodeListOf;\r\n querySelectorAll(selectors: \"source\"): NodeListOf;\r\n querySelectorAll(selectors: \"span\"): NodeListOf;\r\n querySelectorAll(selectors: \"stop\"): NodeListOf;\r\n querySelectorAll(selectors: \"strike\"): NodeListOf;\r\n querySelectorAll(selectors: \"strong\"): NodeListOf;\r\n querySelectorAll(selectors: \"style\"): NodeListOf;\r\n querySelectorAll(selectors: \"sub\"): NodeListOf;\r\n querySelectorAll(selectors: \"sup\"): NodeListOf;\r\n querySelectorAll(selectors: \"svg\"): NodeListOf;\r\n querySelectorAll(selectors: \"switch\"): NodeListOf;\r\n querySelectorAll(selectors: \"symbol\"): NodeListOf;\r\n querySelectorAll(selectors: \"table\"): NodeListOf;\r\n querySelectorAll(selectors: \"tbody\"): NodeListOf;\r\n querySelectorAll(selectors: \"td\"): NodeListOf;\r\n querySelectorAll(selectors: \"template\"): NodeListOf;\r\n querySelectorAll(selectors: \"text\"): NodeListOf;\r\n querySelectorAll(selectors: \"textpath\"): NodeListOf;\r\n querySelectorAll(selectors: \"textarea\"): NodeListOf;\r\n querySelectorAll(selectors: \"tfoot\"): NodeListOf;\r\n querySelectorAll(selectors: \"th\"): NodeListOf;\r\n querySelectorAll(selectors: \"thead\"): NodeListOf;\r\n querySelectorAll(selectors: \"title\"): NodeListOf;\r\n querySelectorAll(selectors: \"tr\"): NodeListOf;\r\n querySelectorAll(selectors: \"track\"): NodeListOf;\r\n querySelectorAll(selectors: \"tspan\"): NodeListOf;\r\n querySelectorAll(selectors: \"tt\"): NodeListOf;\r\n querySelectorAll(selectors: \"u\"): NodeListOf;\r\n querySelectorAll(selectors: \"ul\"): NodeListOf;\r\n querySelectorAll(selectors: \"use\"): NodeListOf;\r\n querySelectorAll(selectors: \"var\"): NodeListOf;\r\n querySelectorAll(selectors: \"video\"): NodeListOf;\r\n querySelectorAll(selectors: \"view\"): NodeListOf;\r\n querySelectorAll(selectors: \"wbr\"): NodeListOf;\r\n querySelectorAll(selectors: \"x-ms-webview\"): NodeListOf;\r\n querySelectorAll(selectors: \"xmp\"): NodeListOf;\r\n querySelectorAll(selectors: string): NodeListOf;\r\n}\r\n\r\ninterface RandomSource {\r\n getRandomValues(array: ArrayBufferView): ArrayBufferView;\r\n}\r\n\r\ninterface SVGAnimatedPathData {\r\n readonly pathSegList: SVGPathSegList;\r\n}\r\n\r\ninterface SVGAnimatedPoints {\r\n readonly animatedPoints: SVGPointList;\r\n readonly points: SVGPointList;\r\n}\r\n\r\ninterface SVGExternalResourcesRequired {\r\n readonly externalResourcesRequired: SVGAnimatedBoolean;\r\n}\r\n\r\ninterface SVGFilterPrimitiveStandardAttributes extends SVGStylable {\r\n readonly height: SVGAnimatedLength;\r\n readonly result: SVGAnimatedString;\r\n readonly width: SVGAnimatedLength;\r\n readonly x: SVGAnimatedLength;\r\n readonly y: SVGAnimatedLength;\r\n}\r\n\r\ninterface SVGFitToViewBox {\r\n readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio;\r\n readonly viewBox: SVGAnimatedRect;\r\n}\r\n\r\ninterface SVGLangSpace {\r\n xmllang: string;\r\n xmlspace: string;\r\n}\r\n\r\ninterface SVGLocatable {\r\n readonly farthestViewportElement: SVGElement;\r\n readonly nearestViewportElement: SVGElement;\r\n getBBox(): SVGRect;\r\n getCTM(): SVGMatrix;\r\n getScreenCTM(): SVGMatrix;\r\n getTransformToElement(element: SVGElement): SVGMatrix;\r\n}\r\n\r\ninterface SVGStylable {\r\n className: any;\r\n readonly style: CSSStyleDeclaration;\r\n}\r\n\r\ninterface SVGTests {\r\n readonly requiredExtensions: SVGStringList;\r\n readonly requiredFeatures: SVGStringList;\r\n readonly systemLanguage: SVGStringList;\r\n hasExtension(extension: string): boolean;\r\n}\r\n\r\ninterface SVGTransformable extends SVGLocatable {\r\n readonly transform: SVGAnimatedTransformList;\r\n}\r\n\r\ninterface SVGURIReference {\r\n readonly href: SVGAnimatedString;\r\n}\r\n\r\ninterface WindowBase64 {\r\n atob(encodedString: string): string;\r\n btoa(rawString: string): string;\r\n}\r\n\r\ninterface WindowConsole {\r\n readonly console: Console;\r\n}\r\n\r\ninterface WindowLocalStorage {\r\n readonly localStorage: Storage;\r\n}\r\n\r\ninterface WindowSessionStorage {\r\n readonly sessionStorage: Storage;\r\n}\r\n\r\ninterface WindowTimers extends Object, WindowTimersExtension {\r\n clearInterval(handle: number): void;\r\n clearTimeout(handle: number): void;\r\n setInterval(handler: (...args: any[]) => void, timeout: number): number;\r\n setInterval(handler: any, timeout?: any, ...args: any[]): number;\r\n setTimeout(handler: (...args: any[]) => void, timeout: number): number;\r\n setTimeout(handler: any, timeout?: any, ...args: any[]): number;\r\n}\r\n\r\ninterface WindowTimersExtension {\r\n clearImmediate(handle: number): void;\r\n setImmediate(handler: (...args: any[]) => void): number;\r\n setImmediate(handler: any, ...args: any[]): number;\r\n}\r\n\r\ninterface XMLHttpRequestEventTarget {\r\n onabort: (this: this, ev: Event) => any;\r\n onerror: (this: this, ev: ErrorEvent) => any;\r\n onload: (this: this, ev: Event) => any;\r\n onloadend: (this: this, ev: ProgressEvent) => any;\r\n onloadstart: (this: this, ev: Event) => any;\r\n onprogress: (this: this, ev: ProgressEvent) => any;\r\n ontimeout: (this: this, ev: ProgressEvent) => any;\r\n addEventListener(type: \"abort\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"error\", listener: (this: this, ev: ErrorEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"load\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadend\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"loadstart\", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"progress\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: \"timeout\", listener: (this: this, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\n}\r\n\r\ninterface StorageEventInit extends EventInit {\r\n key?: string;\r\n oldValue?: string;\r\n newValue?: string;\r\n url: string;\r\n storageArea?: Storage;\r\n}\r\n\r\ninterface Canvas2DContextAttributes {\r\n alpha?: boolean;\r\n willReadFrequently?: boolean;\r\n storage?: boolean;\r\n [attribute: string]: boolean | string | undefined;\r\n}\r\n\r\ninterface NodeListOf extends NodeList {\r\n length: number;\r\n item(index: number): TNode;\r\n [index: number]: TNode;\r\n}\r\n\r\ninterface HTMLCollectionOf extends HTMLCollection {\r\n item(index: number): T;\r\n namedItem(name: string): T;\r\n [index: number]: T;\r\n}\r\n\r\ninterface BlobPropertyBag {\r\n type?: string;\r\n endings?: string;\r\n}\r\n\r\ninterface FilePropertyBag {\r\n type?: string;\r\n lastModified?: number;\r\n}\r\n\r\ninterface EventListenerObject {\r\n handleEvent(evt: Event): void;\r\n}\r\n\r\ninterface MessageEventInit extends EventInit {\r\n data?: any;\r\n origin?: string;\r\n lastEventId?: string;\r\n channel?: string;\r\n source?: any;\r\n ports?: MessagePort[];\r\n}\r\n\r\ninterface ProgressEventInit extends EventInit {\r\n lengthComputable?: boolean;\r\n loaded?: number;\r\n total?: number;\r\n}\r\n\r\ninterface ScrollOptions {\r\n behavior?: ScrollBehavior;\r\n}\r\n\r\ninterface ScrollToOptions extends ScrollOptions {\r\n left?: number;\r\n top?: number;\r\n}\r\n\r\ninterface ScrollIntoViewOptions extends ScrollOptions {\r\n block?: ScrollLogicalPosition;\r\n inline?: ScrollLogicalPosition;\r\n}\r\n\r\ninterface ClipboardEventInit extends EventInit {\r\n data?: string;\r\n dataType?: string;\r\n}\r\n\r\ninterface IDBArrayKey extends Array {\r\n}\r\n\r\ninterface RsaKeyGenParams extends Algorithm {\r\n modulusLength: number;\r\n publicExponent: Uint8Array;\r\n}\r\n\r\ninterface RsaHashedKeyGenParams extends RsaKeyGenParams {\r\n hash: AlgorithmIdentifier;\r\n}\r\n\r\ninterface RsaKeyAlgorithm extends KeyAlgorithm {\r\n modulusLength: number;\r\n publicExponent: Uint8Array;\r\n}\r\n\r\ninterface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm {\r\n hash: AlgorithmIdentifier;\r\n}\r\n\r\ninterface RsaHashedImportParams {\r\n hash: AlgorithmIdentifier;\r\n}\r\n\r\ninterface RsaPssParams {\r\n saltLength: number;\r\n}\r\n\r\ninterface RsaOaepParams extends Algorithm {\r\n label?: BufferSource;\r\n}\r\n\r\ninterface EcdsaParams extends Algorithm {\r\n hash: AlgorithmIdentifier;\r\n}\r\n\r\ninterface EcKeyGenParams extends Algorithm {\r\n namedCurve: string;\r\n}\r\n\r\ninterface EcKeyAlgorithm extends KeyAlgorithm {\r\n typedCurve: string;\r\n}\r\n\r\ninterface EcKeyImportParams {\r\n namedCurve: string;\r\n}\r\n\r\ninterface EcdhKeyDeriveParams extends Algorithm {\r\n public: CryptoKey;\r\n}\r\n\r\ninterface AesCtrParams extends Algorithm {\r\n counter: BufferSource;\r\n length: number;\r\n}\r\n\r\ninterface AesKeyAlgorithm extends KeyAlgorithm {\r\n length: number;\r\n}\r\n\r\ninterface AesKeyGenParams extends Algorithm {\r\n length: number;\r\n}\r\n\r\ninterface AesDerivedKeyParams extends Algorithm {\r\n length: number;\r\n}\r\n\r\ninterface AesCbcParams extends Algorithm {\r\n iv: BufferSource;\r\n}\r\n\r\ninterface AesCmacParams extends Algorithm {\r\n length: number;\r\n}\r\n\r\ninterface AesGcmParams extends Algorithm {\r\n iv: BufferSource;\r\n additionalData?: BufferSource;\r\n tagLength?: number;\r\n}\r\n\r\ninterface AesCfbParams extends Algorithm {\r\n iv: BufferSource;\r\n}\r\n\r\ninterface HmacImportParams extends Algorithm {\r\n hash?: AlgorithmIdentifier;\r\n length?: number;\r\n}\r\n\r\ninterface HmacKeyAlgorithm extends KeyAlgorithm {\r\n hash: AlgorithmIdentifier;\r\n length: number;\r\n}\r\n\r\ninterface HmacKeyGenParams extends Algorithm {\r\n hash: AlgorithmIdentifier;\r\n length?: number;\r\n}\r\n\r\ninterface DhKeyGenParams extends Algorithm {\r\n prime: Uint8Array;\r\n generator: Uint8Array;\r\n}\r\n\r\ninterface DhKeyAlgorithm extends KeyAlgorithm {\r\n prime: Uint8Array;\r\n generator: Uint8Array;\r\n}\r\n\r\ninterface DhKeyDeriveParams extends Algorithm {\r\n public: CryptoKey;\r\n}\r\n\r\ninterface DhImportKeyParams extends Algorithm {\r\n prime: Uint8Array;\r\n generator: Uint8Array;\r\n}\r\n\r\ninterface ConcatParams extends Algorithm {\r\n hash?: AlgorithmIdentifier;\r\n algorithmId: Uint8Array;\r\n partyUInfo: Uint8Array;\r\n partyVInfo: Uint8Array;\r\n publicInfo?: Uint8Array;\r\n privateInfo?: Uint8Array;\r\n}\r\n\r\ninterface HkdfCtrParams extends Algorithm {\r\n hash: AlgorithmIdentifier;\r\n label: BufferSource;\r\n context: BufferSource;\r\n}\r\n\r\ninterface Pbkdf2Params extends Algorithm {\r\n salt: BufferSource;\r\n iterations: number;\r\n hash: AlgorithmIdentifier;\r\n}\r\n\r\ninterface RsaOtherPrimesInfo {\r\n r: string;\r\n d: string;\r\n t: string;\r\n}\r\n\r\ninterface JsonWebKey {\r\n kty: string;\r\n use?: string;\r\n key_ops?: string[];\r\n alg?: string;\r\n kid?: string;\r\n x5u?: string;\r\n x5c?: string;\r\n x5t?: string;\r\n ext?: boolean;\r\n crv?: string;\r\n x?: string;\r\n y?: string;\r\n d?: string;\r\n n?: string;\r\n e?: string;\r\n p?: string;\r\n q?: string;\r\n dp?: string;\r\n dq?: string;\r\n qi?: string;\r\n oth?: RsaOtherPrimesInfo[];\r\n k?: string;\r\n}\r\n\r\ninterface ParentNode {\r\n readonly children: HTMLCollection;\r\n readonly firstElementChild: Element;\r\n readonly lastElementChild: Element;\r\n readonly childElementCount: number;\r\n}\r\n\r\ndeclare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;\r\n\r\ninterface ErrorEventHandler {\r\n (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void;\r\n}\r\ninterface PositionCallback {\r\n (position: Position): void;\r\n}\r\ninterface PositionErrorCallback {\r\n (error: PositionError): void;\r\n}\r\ninterface MediaQueryListListener {\r\n (mql: MediaQueryList): void;\r\n}\r\ninterface MSLaunchUriCallback {\r\n (): void;\r\n}\r\ninterface FrameRequestCallback {\r\n (time: number): void;\r\n}\r\ninterface MSUnsafeFunctionCallback {\r\n (): any;\r\n}\r\ninterface MSExecAtPriorityFunctionCallback {\r\n (...args: any[]): any;\r\n}\r\ninterface MutationCallback {\r\n (mutations: MutationRecord[], observer: MutationObserver): void;\r\n}\r\ninterface DecodeSuccessCallback {\r\n (decodedData: AudioBuffer): void;\r\n}\r\ninterface DecodeErrorCallback {\r\n (error: DOMException): void;\r\n}\r\ninterface FunctionStringCallback {\r\n (data: string): void;\r\n}\r\ninterface NavigatorUserMediaSuccessCallback {\r\n (stream: MediaStream): void;\r\n}\r\ninterface NavigatorUserMediaErrorCallback {\r\n (error: MediaStreamError): void;\r\n}\r\ninterface ForEachCallback {\r\n (keyId: any, status: string): void;\r\n}\r\ndeclare var Audio: {new(src?: string): HTMLAudioElement; };\r\ndeclare var Image: {new(width?: number, height?: number): HTMLImageElement; };\r\ndeclare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; };\r\ndeclare var applicationCache: ApplicationCache;\r\ndeclare var clientInformation: Navigator;\r\ndeclare var closed: boolean;\r\ndeclare var crypto: Crypto;\r\ndeclare var defaultStatus: string;\r\ndeclare var devicePixelRatio: number;\r\ndeclare var doNotTrack: string;\r\ndeclare var document: Document;\r\ndeclare var event: Event;\r\ndeclare var external: External;\r\ndeclare var frameElement: Element;\r\ndeclare var frames: Window;\r\ndeclare var history: History;\r\ndeclare var innerHeight: number;\r\ndeclare var innerWidth: number;\r\ndeclare var length: number;\r\ndeclare var location: Location;\r\ndeclare var locationbar: BarProp;\r\ndeclare var menubar: BarProp;\r\ndeclare var msCredentials: MSCredentials;\r\ndeclare const name: never;\r\ndeclare var navigator: Navigator;\r\ndeclare var offscreenBuffering: string | boolean;\r\ndeclare var onabort: (this: Window, ev: UIEvent) => any;\r\ndeclare var onafterprint: (this: Window, ev: Event) => any;\r\ndeclare var onbeforeprint: (this: Window, ev: Event) => any;\r\ndeclare var onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any;\r\ndeclare var onblur: (this: Window, ev: FocusEvent) => any;\r\ndeclare var oncanplay: (this: Window, ev: Event) => any;\r\ndeclare var oncanplaythrough: (this: Window, ev: Event) => any;\r\ndeclare var onchange: (this: Window, ev: Event) => any;\r\ndeclare var onclick: (this: Window, ev: MouseEvent) => any;\r\ndeclare var oncompassneedscalibration: (this: Window, ev: Event) => any;\r\ndeclare var oncontextmenu: (this: Window, ev: PointerEvent) => any;\r\ndeclare var ondblclick: (this: Window, ev: MouseEvent) => any;\r\ndeclare var ondevicelight: (this: Window, ev: DeviceLightEvent) => any;\r\ndeclare var ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any;\r\ndeclare var ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any;\r\ndeclare var ondrag: (this: Window, ev: DragEvent) => any;\r\ndeclare var ondragend: (this: Window, ev: DragEvent) => any;\r\ndeclare var ondragenter: (this: Window, ev: DragEvent) => any;\r\ndeclare var ondragleave: (this: Window, ev: DragEvent) => any;\r\ndeclare var ondragover: (this: Window, ev: DragEvent) => any;\r\ndeclare var ondragstart: (this: Window, ev: DragEvent) => any;\r\ndeclare var ondrop: (this: Window, ev: DragEvent) => any;\r\ndeclare var ondurationchange: (this: Window, ev: Event) => any;\r\ndeclare var onemptied: (this: Window, ev: Event) => any;\r\ndeclare var onended: (this: Window, ev: MediaStreamErrorEvent) => any;\r\ndeclare var onerror: ErrorEventHandler;\r\ndeclare var onfocus: (this: Window, ev: FocusEvent) => any;\r\ndeclare var onhashchange: (this: Window, ev: HashChangeEvent) => any;\r\ndeclare var oninput: (this: Window, ev: Event) => any;\r\ndeclare var oninvalid: (this: Window, ev: Event) => any;\r\ndeclare var onkeydown: (this: Window, ev: KeyboardEvent) => any;\r\ndeclare var onkeypress: (this: Window, ev: KeyboardEvent) => any;\r\ndeclare var onkeyup: (this: Window, ev: KeyboardEvent) => any;\r\ndeclare var onload: (this: Window, ev: Event) => any;\r\ndeclare var onloadeddata: (this: Window, ev: Event) => any;\r\ndeclare var onloadedmetadata: (this: Window, ev: Event) => any;\r\ndeclare var onloadstart: (this: Window, ev: Event) => any;\r\ndeclare var onmessage: (this: Window, ev: MessageEvent) => any;\r\ndeclare var onmousedown: (this: Window, ev: MouseEvent) => any;\r\ndeclare var onmouseenter: (this: Window, ev: MouseEvent) => any;\r\ndeclare var onmouseleave: (this: Window, ev: MouseEvent) => any;\r\ndeclare var onmousemove: (this: Window, ev: MouseEvent) => any;\r\ndeclare var onmouseout: (this: Window, ev: MouseEvent) => any;\r\ndeclare var onmouseover: (this: Window, ev: MouseEvent) => any;\r\ndeclare var onmouseup: (this: Window, ev: MouseEvent) => any;\r\ndeclare var onmousewheel: (this: Window, ev: WheelEvent) => any;\r\ndeclare var onmsgesturechange: (this: Window, ev: MSGestureEvent) => any;\r\ndeclare var onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any;\r\ndeclare var onmsgestureend: (this: Window, ev: MSGestureEvent) => any;\r\ndeclare var onmsgesturehold: (this: Window, ev: MSGestureEvent) => any;\r\ndeclare var onmsgesturestart: (this: Window, ev: MSGestureEvent) => any;\r\ndeclare var onmsgesturetap: (this: Window, ev: MSGestureEvent) => any;\r\ndeclare var onmsinertiastart: (this: Window, ev: MSGestureEvent) => any;\r\ndeclare var onmspointercancel: (this: Window, ev: MSPointerEvent) => any;\r\ndeclare var onmspointerdown: (this: Window, ev: MSPointerEvent) => any;\r\ndeclare var onmspointerenter: (this: Window, ev: MSPointerEvent) => any;\r\ndeclare var onmspointerleave: (this: Window, ev: MSPointerEvent) => any;\r\ndeclare var onmspointermove: (this: Window, ev: MSPointerEvent) => any;\r\ndeclare var onmspointerout: (this: Window, ev: MSPointerEvent) => any;\r\ndeclare var onmspointerover: (this: Window, ev: MSPointerEvent) => any;\r\ndeclare var onmspointerup: (this: Window, ev: MSPointerEvent) => any;\r\ndeclare var onoffline: (this: Window, ev: Event) => any;\r\ndeclare var ononline: (this: Window, ev: Event) => any;\r\ndeclare var onorientationchange: (this: Window, ev: Event) => any;\r\ndeclare var onpagehide: (this: Window, ev: PageTransitionEvent) => any;\r\ndeclare var onpageshow: (this: Window, ev: PageTransitionEvent) => any;\r\ndeclare var onpause: (this: Window, ev: Event) => any;\r\ndeclare var onplay: (this: Window, ev: Event) => any;\r\ndeclare var onplaying: (this: Window, ev: Event) => any;\r\ndeclare var onpopstate: (this: Window, ev: PopStateEvent) => any;\r\ndeclare var onprogress: (this: Window, ev: ProgressEvent) => any;\r\ndeclare var onratechange: (this: Window, ev: Event) => any;\r\ndeclare var onreadystatechange: (this: Window, ev: ProgressEvent) => any;\r\ndeclare var onreset: (this: Window, ev: Event) => any;\r\ndeclare var onresize: (this: Window, ev: UIEvent) => any;\r\ndeclare var onscroll: (this: Window, ev: UIEvent) => any;\r\ndeclare var onseeked: (this: Window, ev: Event) => any;\r\ndeclare var onseeking: (this: Window, ev: Event) => any;\r\ndeclare var onselect: (this: Window, ev: UIEvent) => any;\r\ndeclare var onstalled: (this: Window, ev: Event) => any;\r\ndeclare var onstorage: (this: Window, ev: StorageEvent) => any;\r\ndeclare var onsubmit: (this: Window, ev: Event) => any;\r\ndeclare var onsuspend: (this: Window, ev: Event) => any;\r\ndeclare var ontimeupdate: (this: Window, ev: Event) => any;\r\ndeclare var ontouchcancel: (ev: TouchEvent) => any;\r\ndeclare var ontouchend: (ev: TouchEvent) => any;\r\ndeclare var ontouchmove: (ev: TouchEvent) => any;\r\ndeclare var ontouchstart: (ev: TouchEvent) => any;\r\ndeclare var onunload: (this: Window, ev: Event) => any;\r\ndeclare var onvolumechange: (this: Window, ev: Event) => any;\r\ndeclare var onwaiting: (this: Window, ev: Event) => any;\r\ndeclare var opener: any;\r\ndeclare var orientation: string | number;\r\ndeclare var outerHeight: number;\r\ndeclare var outerWidth: number;\r\ndeclare var pageXOffset: number;\r\ndeclare var pageYOffset: number;\r\ndeclare var parent: Window;\r\ndeclare var performance: Performance;\r\ndeclare var personalbar: BarProp;\r\ndeclare var screen: Screen;\r\ndeclare var screenLeft: number;\r\ndeclare var screenTop: number;\r\ndeclare var screenX: number;\r\ndeclare var screenY: number;\r\ndeclare var scrollX: number;\r\ndeclare var scrollY: number;\r\ndeclare var scrollbars: BarProp;\r\ndeclare var self: Window;\r\ndeclare var status: string;\r\ndeclare var statusbar: BarProp;\r\ndeclare var styleMedia: StyleMedia;\r\ndeclare var toolbar: BarProp;\r\ndeclare var top: Window;\r\ndeclare var window: Window;\r\ndeclare function alert(message?: any): void;\r\ndeclare function blur(): void;\r\ndeclare function cancelAnimationFrame(handle: number): void;\r\ndeclare function captureEvents(): void;\r\ndeclare function close(): void;\r\ndeclare function confirm(message?: string): boolean;\r\ndeclare function focus(): void;\r\ndeclare function getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration;\r\ndeclare function getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList;\r\ndeclare function getSelection(): Selection;\r\ndeclare function matchMedia(mediaQuery: string): MediaQueryList;\r\ndeclare function moveBy(x?: number, y?: number): void;\r\ndeclare function moveTo(x?: number, y?: number): void;\r\ndeclare function msWriteProfilerMark(profilerMarkName: string): void;\r\ndeclare function open(url?: string, target?: string, features?: string, replace?: boolean): Window;\r\ndeclare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void;\r\ndeclare function print(): void;\r\ndeclare function prompt(message?: string, _default?: string): string | null;\r\ndeclare function releaseEvents(): void;\r\ndeclare function requestAnimationFrame(callback: FrameRequestCallback): number;\r\ndeclare function resizeBy(x?: number, y?: number): void;\r\ndeclare function resizeTo(x?: number, y?: number): void;\r\ndeclare function scroll(x?: number, y?: number): void;\r\ndeclare function scrollBy(x?: number, y?: number): void;\r\ndeclare function scrollTo(x?: number, y?: number): void;\r\ndeclare function webkitCancelAnimationFrame(handle: number): void;\r\ndeclare function webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint;\r\ndeclare function webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint;\r\ndeclare function webkitRequestAnimationFrame(callback: FrameRequestCallback): number;\r\ndeclare function scroll(options?: ScrollToOptions): void;\r\ndeclare function scrollTo(options?: ScrollToOptions): void;\r\ndeclare function scrollBy(options?: ScrollToOptions): void;\r\ndeclare function toString(): string;\r\ndeclare function addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\ndeclare function dispatchEvent(evt: Event): boolean;\r\ndeclare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\ndeclare function clearInterval(handle: number): void;\r\ndeclare function clearTimeout(handle: number): void;\r\ndeclare function setInterval(handler: (...args: any[]) => void, timeout: number): number;\r\ndeclare function setInterval(handler: any, timeout?: any, ...args: any[]): number;\r\ndeclare function setTimeout(handler: (...args: any[]) => void, timeout: number): number;\r\ndeclare function setTimeout(handler: any, timeout?: any, ...args: any[]): number;\r\ndeclare function clearImmediate(handle: number): void;\r\ndeclare function setImmediate(handler: (...args: any[]) => void): number;\r\ndeclare function setImmediate(handler: any, ...args: any[]): number;\r\ndeclare var sessionStorage: Storage;\r\ndeclare var localStorage: Storage;\r\ndeclare var console: Console;\r\ndeclare var onpointercancel: (this: Window, ev: PointerEvent) => any;\r\ndeclare var onpointerdown: (this: Window, ev: PointerEvent) => any;\r\ndeclare var onpointerenter: (this: Window, ev: PointerEvent) => any;\r\ndeclare var onpointerleave: (this: Window, ev: PointerEvent) => any;\r\ndeclare var onpointermove: (this: Window, ev: PointerEvent) => any;\r\ndeclare var onpointerout: (this: Window, ev: PointerEvent) => any;\r\ndeclare var onpointerover: (this: Window, ev: PointerEvent) => any;\r\ndeclare var onpointerup: (this: Window, ev: PointerEvent) => any;\r\ndeclare var onwheel: (this: Window, ev: WheelEvent) => any;\r\ndeclare var indexedDB: IDBFactory;\r\ndeclare function atob(encodedString: string): string;\r\ndeclare function btoa(rawString: string): string;\r\ndeclare function addEventListener(type: \"MSGestureChange\", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"MSGestureDoubleTap\", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"MSGestureEnd\", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"MSGestureHold\", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"MSGestureStart\", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"MSGestureTap\", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"MSInertiaStart\", listener: (this: Window, ev: MSGestureEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"MSPointerCancel\", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"MSPointerDown\", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"MSPointerEnter\", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"MSPointerLeave\", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"MSPointerMove\", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"MSPointerOut\", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"MSPointerOver\", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"MSPointerUp\", listener: (this: Window, ev: MSPointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"abort\", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"afterprint\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"beforeprint\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"beforeunload\", listener: (this: Window, ev: BeforeUnloadEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"blur\", listener: (this: Window, ev: FocusEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"canplay\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"canplaythrough\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"change\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"click\", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"compassneedscalibration\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"contextmenu\", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"dblclick\", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"devicelight\", listener: (this: Window, ev: DeviceLightEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"devicemotion\", listener: (this: Window, ev: DeviceMotionEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"deviceorientation\", listener: (this: Window, ev: DeviceOrientationEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"drag\", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"dragend\", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"dragenter\", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"dragleave\", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"dragover\", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"dragstart\", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"drop\", listener: (this: Window, ev: DragEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"durationchange\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"emptied\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"ended\", listener: (this: Window, ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"focus\", listener: (this: Window, ev: FocusEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"hashchange\", listener: (this: Window, ev: HashChangeEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"input\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"invalid\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"keydown\", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"keypress\", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"keyup\", listener: (this: Window, ev: KeyboardEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"load\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"loadeddata\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"loadedmetadata\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"loadstart\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"message\", listener: (this: Window, ev: MessageEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"mousedown\", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"mouseenter\", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"mouseleave\", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"mousemove\", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"mouseout\", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"mouseover\", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"mouseup\", listener: (this: Window, ev: MouseEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"mousewheel\", listener: (this: Window, ev: WheelEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"offline\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"online\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"orientationchange\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"pagehide\", listener: (this: Window, ev: PageTransitionEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"pageshow\", listener: (this: Window, ev: PageTransitionEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"pause\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"play\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"playing\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"pointercancel\", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"pointerdown\", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"pointerenter\", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"pointerleave\", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"pointermove\", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"pointerout\", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"pointerover\", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"pointerup\", listener: (this: Window, ev: PointerEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"popstate\", listener: (this: Window, ev: PopStateEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"progress\", listener: (this: Window, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"ratechange\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"readystatechange\", listener: (this: Window, ev: ProgressEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"reset\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"resize\", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"scroll\", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"seeked\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"seeking\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"select\", listener: (this: Window, ev: UIEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"stalled\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"storage\", listener: (this: Window, ev: StorageEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"submit\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"suspend\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"timeupdate\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"unload\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"volumechange\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"waiting\", listener: (this: Window, ev: Event) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: \"wheel\", listener: (this: Window, ev: WheelEvent) => any, useCapture?: boolean): void;\r\ndeclare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\r\ntype AAGUID = string;\r\ntype AlgorithmIdentifier = string | Algorithm;\r\ntype ConstrainBoolean = boolean | ConstrainBooleanParameters;\r\ntype ConstrainDOMString = string | string[] | ConstrainDOMStringParameters;\r\ntype ConstrainDouble = number | ConstrainDoubleRange;\r\ntype ConstrainLong = number | ConstrainLongRange;\r\ntype CryptoOperationData = ArrayBufferView;\r\ntype GLbitfield = number;\r\ntype GLboolean = boolean;\r\ntype GLbyte = number;\r\ntype GLclampf = number;\r\ntype GLenum = number;\r\ntype GLfloat = number;\r\ntype GLint = number;\r\ntype GLintptr = number;\r\ntype GLshort = number;\r\ntype GLsizei = number;\r\ntype GLsizeiptr = number;\r\ntype GLubyte = number;\r\ntype GLuint = number;\r\ntype GLushort = number;\r\ntype IDBKeyPath = string;\r\ntype KeyFormat = string;\r\ntype KeyType = string;\r\ntype KeyUsage = string;\r\ntype MSInboundPayload = MSVideoRecvPayload | MSAudioRecvPayload;\r\ntype MSLocalClientEvent = MSLocalClientEventBase | MSAudioLocalClientEvent;\r\ntype MSOutboundPayload = MSVideoSendPayload | MSAudioSendPayload;\r\ntype RTCIceGatherCandidate = RTCIceCandidate | RTCIceCandidateComplete;\r\ntype RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport;\r\ntype payloadtype = number;\r\ntype ScrollBehavior = \"auto\" | \"instant\" | \"smooth\";\r\ntype ScrollLogicalPosition = \"start\" | \"center\" | \"end\" | \"nearest\";\r\ntype IDBValidKey = number | string | Date | IDBArrayKey;\r\ntype BufferSource = ArrayBuffer | ArrayBufferView;\r\ntype MouseWheelEvent = WheelEvent;\r\n/////////////////////////////\r\n/// WorkerGlobalScope APIs \r\n/////////////////////////////\r\n// These are only available in a Web Worker \r\ndeclare function importScripts(...urls: string[]): void;\r\n\r\n\r\n/////////////////////////////\r\n/// Windows Script Host APIS\r\n/////////////////////////////\r\n\r\n\r\ninterface ActiveXObject {\r\n new (s: string): any;\r\n}\r\ndeclare var ActiveXObject: ActiveXObject;\r\n\r\ninterface ITextWriter {\r\n Write(s: string): void;\r\n WriteLine(s: string): void;\r\n Close(): void;\r\n}\r\n\r\ninterface TextStreamBase {\r\n /**\r\n * The column number of the current character position in an input stream.\r\n */\r\n Column: number;\r\n\r\n /**\r\n * The current line number in an input stream.\r\n */\r\n Line: number;\r\n\r\n /**\r\n * Closes a text stream.\r\n * It is not necessary to close standard streams; they close automatically when the process ends. If \r\n * you close a standard stream, be aware that any other pointers to that standard stream become invalid.\r\n */\r\n Close(): void;\r\n}\r\n\r\ninterface TextStreamWriter extends TextStreamBase {\r\n /**\r\n * Sends a string to an output stream.\r\n */\r\n Write(s: string): void;\r\n\r\n /**\r\n * Sends a specified number of blank lines (newline characters) to an output stream.\r\n */\r\n WriteBlankLines(intLines: number): void;\r\n\r\n /**\r\n * Sends a string followed by a newline character to an output stream.\r\n */\r\n WriteLine(s: string): void;\r\n}\r\n\r\ninterface TextStreamReader extends TextStreamBase {\r\n /**\r\n * Returns a specified number of characters from an input stream, starting at the current pointer position.\r\n * Does not return until the ENTER key is pressed.\r\n * Can only be used on a stream in reading mode; causes an error in writing or appending mode.\r\n */\r\n Read(characters: number): string;\r\n\r\n /**\r\n * Returns all characters from an input stream.\r\n * Can only be used on a stream in reading mode; causes an error in writing or appending mode.\r\n */\r\n ReadAll(): string;\r\n\r\n /**\r\n * Returns an entire line from an input stream.\r\n * Although this method extracts the newline character, it does not add it to the returned string.\r\n * Can only be used on a stream in reading mode; causes an error in writing or appending mode.\r\n */\r\n ReadLine(): string;\r\n\r\n /**\r\n * Skips a specified number of characters when reading from an input text stream.\r\n * Can only be used on a stream in reading mode; causes an error in writing or appending mode.\r\n * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.)\r\n */\r\n Skip(characters: number): void;\r\n\r\n /**\r\n * Skips the next line when reading from an input text stream.\r\n * Can only be used on a stream in reading mode, not writing or appending mode.\r\n */\r\n SkipLine(): void;\r\n\r\n /**\r\n * Indicates whether the stream pointer position is at the end of a line.\r\n */\r\n AtEndOfLine: boolean;\r\n\r\n /**\r\n * Indicates whether the stream pointer position is at the end of a stream.\r\n */\r\n AtEndOfStream: boolean;\r\n}\r\n\r\ndeclare var WScript: {\r\n /**\r\n * Outputs text to either a message box (under WScript.exe) or the command console window followed by\r\n * a newline (under CScript.exe).\r\n */\r\n Echo(s: any): void;\r\n\r\n /**\r\n * Exposes the write-only error output stream for the current script.\r\n * Can be accessed only while using CScript.exe.\r\n */\r\n StdErr: TextStreamWriter;\r\n\r\n /**\r\n * Exposes the write-only output stream for the current script.\r\n * Can be accessed only while using CScript.exe.\r\n */\r\n StdOut: TextStreamWriter;\r\n Arguments: { length: number; Item(n: number): string; };\r\n\r\n /**\r\n * The full path of the currently running script.\r\n */\r\n ScriptFullName: string;\r\n\r\n /**\r\n * Forces the script to stop immediately, with an optional exit code.\r\n */\r\n Quit(exitCode?: number): number;\r\n\r\n /**\r\n * The Windows Script Host build version number.\r\n */\r\n BuildVersion: number;\r\n\r\n /**\r\n * Fully qualified path of the host executable.\r\n */\r\n FullName: string;\r\n\r\n /**\r\n * Gets/sets the script mode - interactive(true) or batch(false).\r\n */\r\n Interactive: boolean;\r\n\r\n /**\r\n * The name of the host executable (WScript.exe or CScript.exe).\r\n */\r\n Name: string;\r\n\r\n /**\r\n * Path of the directory containing the host executable.\r\n */\r\n Path: string;\r\n\r\n /**\r\n * The filename of the currently running script.\r\n */\r\n ScriptName: string;\r\n\r\n /**\r\n * Exposes the read-only input stream for the current script.\r\n * Can be accessed only while using CScript.exe.\r\n */\r\n StdIn: TextStreamReader;\r\n\r\n /**\r\n * Windows Script Host version\r\n */\r\n Version: string;\r\n\r\n /**\r\n * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event.\r\n */\r\n ConnectObject(objEventSource: any, strPrefix: string): void;\r\n\r\n /**\r\n * Creates a COM object.\r\n * @param strProgiID\r\n * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.\r\n */\r\n CreateObject(strProgID: string, strPrefix?: string): any;\r\n\r\n /**\r\n * Disconnects a COM object from its event sources.\r\n */\r\n DisconnectObject(obj: any): void;\r\n\r\n /**\r\n * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file.\r\n * @param strPathname Fully qualified path to the file containing the object persisted to disk.\r\n * For objects in memory, pass a zero-length string.\r\n * @param strProgID\r\n * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.\r\n */\r\n GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any;\r\n\r\n /**\r\n * Suspends script execution for a specified length of time, then continues execution.\r\n * @param intTime Interval (in milliseconds) to suspend script execution.\r\n */\r\n Sleep(intTime: number): void;\r\n};\r\n\r\n/**\r\n * Allows enumerating over a COM collection, which may not have indexed item access.\r\n */\r\ninterface Enumerator {\r\n /**\r\n * Returns true if the current item is the last one in the collection, or the collection is empty,\r\n * or the current item is undefined.\r\n */\r\n atEnd(): boolean;\r\n\r\n /**\r\n * Returns the current item in the collection\r\n */\r\n item(): T;\r\n\r\n /**\r\n * Resets the current item in the collection to the first item. If there are no items in the collection,\r\n * the current item is set to undefined.\r\n */\r\n moveFirst(): void;\r\n\r\n /**\r\n * Moves the current item to the next item in the collection. If the enumerator is at the end of\r\n * the collection or the collection is empty, the current item is set to undefined.\r\n */\r\n moveNext(): void;\r\n}\r\n\r\ninterface EnumeratorConstructor {\r\n new (collection: any): Enumerator;\r\n new (collection: any): Enumerator;\r\n}\r\n\r\ndeclare var Enumerator: EnumeratorConstructor;\r\n\r\n/**\r\n * Enables reading from a COM safe array, which might have an alternate lower bound, or multiple dimensions.\r\n */\r\ninterface VBArray {\r\n /**\r\n * Returns the number of dimensions (1-based).\r\n */\r\n dimensions(): number;\r\n\r\n /**\r\n * Takes an index for each dimension in the array, and returns the item at the corresponding location.\r\n */\r\n getItem(dimension1Index: number, ...dimensionNIndexes: number[]): T;\r\n\r\n /**\r\n * Returns the smallest available index for a given dimension.\r\n * @param dimension 1-based dimension (defaults to 1)\r\n */\r\n lbound(dimension?: number): number;\r\n\r\n /**\r\n * Returns the largest available index for a given dimension.\r\n * @param dimension 1-based dimension (defaults to 1)\r\n */\r\n ubound(dimension?: number): number;\r\n\r\n /**\r\n * Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions,\r\n * each successive dimension is appended to the end of the array.\r\n * Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6]\r\n */\r\n toArray(): T[];\r\n}\r\n\r\ninterface VBArrayConstructor {\r\n new (safeArray: any): VBArray;\r\n new (safeArray: any): VBArray;\r\n}\r\n\r\ndeclare var VBArray: VBArrayConstructor;\r\n\r\n/**\r\n * Automation date (VT_DATE)\r\n */\r\ninterface VarDate { }\r\n\r\ninterface DateConstructor {\r\n new (vd: VarDate): Date;\r\n}\r\n\r\ninterface Date {\r\n getVarDate: () => VarDate;\r\n}\r\n"}; }); +define([], function() { return { contents: "/*! *****************************************************************************\nCopyright (c) Microsoft Corporation. All rights reserved. \nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\nthis file except in compliance with the License. You may obtain a copy of the\nLicense at http://www.apache.org/licenses/LICENSE-2.0 \n \nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, \nMERCHANTABLITY OR NON-INFRINGEMENT. \n \nSee the Apache Version 2.0 License for specific language governing permissions\nand limitations under the License.\n***************************************************************************** */\n\n\n\n/// \n\n\n/////////////////////////////\n/// ECMAScript APIs\n/////////////////////////////\n\ndeclare const NaN: number;\ndeclare const Infinity: number;\n\n/**\n * Evaluates JavaScript code and executes it.\n * @param x A String value that contains valid JavaScript code.\n */\ndeclare function eval(x: string): any;\n\n/**\n * Converts A string to an integer.\n * @param s A string to convert into a number.\n * @param radix A value between 2 and 36 that specifies the base of the number in numString.\n * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.\n * All other strings are considered decimal.\n */\ndeclare function parseInt(s: string, radix?: number): number;\n\n/**\n * Converts a string to a floating-point number.\n * @param string A string that contains a floating-point number.\n */\ndeclare function parseFloat(string: string): number;\n\n/**\n * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number).\n * @param number A numeric value.\n */\ndeclare function isNaN(number: number): boolean;\n\n/**\n * Determines whether a supplied number is finite.\n * @param number Any numeric value.\n */\ndeclare function isFinite(number: number): boolean;\n\n/**\n * Gets the unencoded version of an encoded Uniform Resource Identifier (URI).\n * @param encodedURI A value representing an encoded URI.\n */\ndeclare function decodeURI(encodedURI: string): string;\n\n/**\n * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI).\n * @param encodedURIComponent A value representing an encoded URI component.\n */\ndeclare function decodeURIComponent(encodedURIComponent: string): string;\n\n/**\n * Encodes a text string as a valid Uniform Resource Identifier (URI)\n * @param uri A value representing an encoded URI.\n */\ndeclare function encodeURI(uri: string): string;\n\n/**\n * Encodes a text string as a valid component of a Uniform Resource Identifier (URI).\n * @param uriComponent A value representing an encoded URI component.\n */\ndeclare function encodeURIComponent(uriComponent: string): string;\n\ninterface PropertyDescriptor {\n configurable?: boolean;\n enumerable?: boolean;\n value?: any;\n writable?: boolean;\n get? (): any;\n set? (v: any): void;\n}\n\ninterface PropertyDescriptorMap {\n [s: string]: PropertyDescriptor;\n}\n\ninterface Object {\n /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */\n constructor: Function;\n\n /** Returns a string representation of an object. */\n toString(): string;\n\n /** Returns a date converted to a string using the current locale. */\n toLocaleString(): string;\n\n /** Returns the primitive value of the specified object. */\n valueOf(): Object;\n\n /**\n * Determines whether an object has a property with the specified name.\n * @param v A property name.\n */\n hasOwnProperty(v: string): boolean;\n\n /**\n * Determines whether an object exists in another object's prototype chain.\n * @param v Another object whose prototype chain is to be checked.\n */\n isPrototypeOf(v: Object): boolean;\n\n /**\n * Determines whether a specified property is enumerable.\n * @param v A property name.\n */\n propertyIsEnumerable(v: string): boolean;\n}\n\ninterface ObjectConstructor {\n new (value?: any): Object;\n (): any;\n (value: any): any;\n\n /** A reference to the prototype for a class of objects. */\n readonly prototype: Object;\n\n /**\n * Returns the prototype of an object.\n * @param o The object that references the prototype.\n */\n getPrototypeOf(o: any): any;\n\n /**\n * Gets the own property descriptor of the specified object.\n * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype.\n * @param o Object that contains the property.\n * @param p Name of the property.\n */\n getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor;\n\n /**\n * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly\n * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions.\n * @param o Object that contains the own properties.\n */\n getOwnPropertyNames(o: any): string[];\n\n /**\n * Creates an object that has null prototype.\n * @param o Object to use as a prototype. May be null\n */\n create(o: null): any;\n\n /**\n * Creates an object that has the specified prototype, and that optionally contains specified properties.\n * @param o Object to use as a prototype. May be null\n */\n create(o: T): T;\n\n /**\n * Creates an object that has the specified prototype, and that optionally contains specified properties.\n * @param o Object to use as a prototype. May be null\n * @param properties JavaScript object that contains one or more property descriptors.\n */\n create(o: any, properties: PropertyDescriptorMap): any;\n\n /**\n * Adds a property to an object, or modifies attributes of an existing property.\n * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object.\n * @param p The property name.\n * @param attributes Descriptor for the property. It can be for a data property or an accessor property.\n */\n defineProperty(o: any, p: string, attributes: PropertyDescriptor): any;\n\n /**\n * Adds one or more properties to an object, and/or modifies attributes of existing properties.\n * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object.\n * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property.\n */\n defineProperties(o: any, properties: PropertyDescriptorMap): any;\n\n /**\n * Prevents the modification of attributes of existing properties, and prevents the addition of new properties.\n * @param o Object on which to lock the attributes.\n */\n seal(o: T): T;\n\n /**\n * Prevents the modification of existing property attributes and values, and prevents the addition of new properties.\n * @param o Object on which to lock the attributes.\n */\n freeze(a: T[]): ReadonlyArray;\n\n /**\n * Prevents the modification of existing property attributes and values, and prevents the addition of new properties.\n * @param o Object on which to lock the attributes.\n */\n freeze(f: T): T;\n\n /**\n * Prevents the modification of existing property attributes and values, and prevents the addition of new properties.\n * @param o Object on which to lock the attributes.\n */\n freeze(o: T): Readonly;\n\n /**\n * Prevents the addition of new properties to an object.\n * @param o Object to make non-extensible.\n */\n preventExtensions(o: T): T;\n\n /**\n * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object.\n * @param o Object to test.\n */\n isSealed(o: any): boolean;\n\n /**\n * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object.\n * @param o Object to test.\n */\n isFrozen(o: any): boolean;\n\n /**\n * Returns a value that indicates whether new properties can be added to an object.\n * @param o Object to test.\n */\n isExtensible(o: any): boolean;\n\n /**\n * Returns the names of the enumerable properties and methods of an object.\n * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.\n */\n keys(o: any): string[];\n}\n\n/**\n * Provides functionality common to all JavaScript objects.\n */\ndeclare const Object: ObjectConstructor;\n\n/**\n * Creates a new function.\n */\ninterface Function {\n /**\n * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function.\n * @param thisArg The object to be used as the this object.\n * @param argArray A set of arguments to be passed to the function.\n */\n apply(this: Function, thisArg: any, argArray?: any): any;\n\n /**\n * Calls a method of an object, substituting another object for the current object.\n * @param thisArg The object to be used as the current object.\n * @param argArray A list of arguments to be passed to the method.\n */\n call(this: Function, thisArg: any, ...argArray: any[]): any;\n\n /**\n * For a given function, creates a bound function that has the same body as the original function.\n * The this object of the bound function is associated with the specified object, and has the specified initial parameters.\n * @param thisArg An object to which the this keyword can refer inside the new function.\n * @param argArray A list of arguments to be passed to the new function.\n */\n bind(this: Function, thisArg: any, ...argArray: any[]): any;\n\n /** Returns a string representation of a function. */\n toString(): string;\n\n prototype: any;\n readonly length: number;\n\n // Non-standard extensions\n arguments: any;\n caller: Function;\n}\n\ninterface FunctionConstructor {\n /**\n * Creates a new function.\n * @param args A list of arguments the function accepts.\n */\n new (...args: string[]): Function;\n (...args: string[]): Function;\n readonly prototype: Function;\n}\n\ndeclare const Function: FunctionConstructor;\n\ninterface IArguments {\n [index: number]: any;\n length: number;\n callee: Function;\n}\n\ninterface String {\n /** Returns a string representation of a string. */\n toString(): string;\n\n /**\n * Returns the character at the specified index.\n * @param pos The zero-based index of the desired character.\n */\n charAt(pos: number): string;\n\n /**\n * Returns the Unicode value of the character at the specified location.\n * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned.\n */\n charCodeAt(index: number): number;\n\n /**\n * Returns a string that contains the concatenation of two or more strings.\n * @param strings The strings to append to the end of the string.\n */\n concat(...strings: string[]): string;\n\n /**\n * Returns the position of the first occurrence of a substring.\n * @param searchString The substring to search for in the string\n * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string.\n */\n indexOf(searchString: string, position?: number): number;\n\n /**\n * Returns the last occurrence of a substring in the string.\n * @param searchString The substring to search for.\n * @param position The index at which to begin searching. If omitted, the search begins at the end of the string.\n */\n lastIndexOf(searchString: string, position?: number): number;\n\n /**\n * Determines whether two strings are equivalent in the current locale.\n * @param that String to compare to target string\n */\n localeCompare(that: string): number;\n\n /**\n * Matches a string with a regular expression, and returns an array containing the results of that search.\n * @param regexp A variable name or string literal containing the regular expression pattern and flags.\n */\n match(regexp: string): RegExpMatchArray | null;\n\n /**\n * Matches a string with a regular expression, and returns an array containing the results of that search.\n * @param regexp A regular expression object that contains the regular expression pattern and applicable flags.\n */\n match(regexp: RegExp): RegExpMatchArray | null;\n\n /**\n * Replaces text in a string, using a regular expression or search string.\n * @param searchValue A string that represents the regular expression.\n * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string.\n */\n replace(searchValue: string, replaceValue: string): string;\n\n /**\n * Replaces text in a string, using a regular expression or search string.\n * @param searchValue A string that represents the regular expression.\n * @param replacer A function that returns the replacement text.\n */\n replace(searchValue: string, replacer: (substring: string, ...args: any[]) => string): string;\n\n /**\n * Replaces text in a string, using a regular expression or search string.\n * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags.\n * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string.\n */\n replace(searchValue: RegExp, replaceValue: string): string;\n\n /**\n * Replaces text in a string, using a regular expression or search string.\n * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags\n * @param replacer A function that returns the replacement text.\n */\n replace(searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string;\n\n /**\n * Finds the first substring match in a regular expression search.\n * @param regexp The regular expression pattern and applicable flags.\n */\n search(regexp: string): number;\n\n /**\n * Finds the first substring match in a regular expression search.\n * @param regexp The regular expression pattern and applicable flags.\n */\n search(regexp: RegExp): number;\n\n /**\n * Returns a section of a string.\n * @param start The index to the beginning of the specified portion of stringObj.\n * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end.\n * If this value is not specified, the substring continues to the end of stringObj.\n */\n slice(start?: number, end?: number): string;\n\n /**\n * Split a string into substrings using the specified separator and return them as an array.\n * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned.\n * @param limit A value used to limit the number of elements returned in the array.\n */\n split(separator: string, limit?: number): string[];\n\n /**\n * Split a string into substrings using the specified separator and return them as an array.\n * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned.\n * @param limit A value used to limit the number of elements returned in the array.\n */\n split(separator: RegExp, limit?: number): string[];\n\n /**\n * Returns the substring at the specified location within a String object.\n * @param start The zero-based index number indicating the beginning of the substring.\n * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end.\n * If end is omitted, the characters from start through the end of the original string are returned.\n */\n substring(start: number, end?: number): string;\n\n /** Converts all the alphabetic characters in a string to lowercase. */\n toLowerCase(): string;\n\n /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */\n toLocaleLowerCase(): string;\n\n /** Converts all the alphabetic characters in a string to uppercase. */\n toUpperCase(): string;\n\n /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */\n toLocaleUpperCase(): string;\n\n /** Removes the leading and trailing white space and line terminator characters from a string. */\n trim(): string;\n\n /** Returns the length of a String object. */\n readonly length: number;\n\n // IE extensions\n /**\n * Gets a substring beginning at the specified location and having the specified length.\n * @param from The starting position of the desired substring. The index of the first character in the string is zero.\n * @param length The number of characters to include in the returned substring.\n */\n substr(from: number, length?: number): string;\n\n /** Returns the primitive value of the specified object. */\n valueOf(): string;\n\n readonly [index: number]: string;\n}\n\ninterface StringConstructor {\n new (value?: any): String;\n (value?: any): string;\n readonly prototype: String;\n fromCharCode(...codes: number[]): string;\n}\n\n/**\n * Allows manipulation and formatting of text strings and determination and location of substrings within strings.\n */\ndeclare const String: StringConstructor;\n\ninterface Boolean {\n /** Returns the primitive value of the specified object. */\n valueOf(): boolean;\n}\n\ninterface BooleanConstructor {\n new (value?: any): Boolean;\n (value?: any): boolean;\n readonly prototype: Boolean;\n}\n\ndeclare const Boolean: BooleanConstructor;\n\ninterface Number {\n /**\n * Returns a string representation of an object.\n * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers.\n */\n toString(radix?: number): string;\n\n /**\n * Returns a string representing a number in fixed-point notation.\n * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive.\n */\n toFixed(fractionDigits?: number): string;\n\n /**\n * Returns a string containing a number represented in exponential notation.\n * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive.\n */\n toExponential(fractionDigits?: number): string;\n\n /**\n * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits.\n * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive.\n */\n toPrecision(precision?: number): string;\n\n /** Returns the primitive value of the specified object. */\n valueOf(): number;\n}\n\ninterface NumberConstructor {\n new (value?: any): Number;\n (value?: any): number;\n readonly prototype: Number;\n\n /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */\n readonly MAX_VALUE: number;\n\n /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */\n readonly MIN_VALUE: number;\n\n /**\n * A value that is not a number.\n * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function.\n */\n readonly NaN: number;\n\n /**\n * A value that is less than the largest negative number that can be represented in JavaScript.\n * JavaScript displays NEGATIVE_INFINITY values as -infinity.\n */\n readonly NEGATIVE_INFINITY: number;\n\n /**\n * A value greater than the largest number that can be represented in JavaScript.\n * JavaScript displays POSITIVE_INFINITY values as infinity.\n */\n readonly POSITIVE_INFINITY: number;\n}\n\n/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */\ndeclare const Number: NumberConstructor;\n\ninterface TemplateStringsArray extends ReadonlyArray {\n readonly raw: ReadonlyArray\n}\n\ninterface Math {\n /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */\n readonly E: number;\n /** The natural logarithm of 10. */\n readonly LN10: number;\n /** The natural logarithm of 2. */\n readonly LN2: number;\n /** The base-2 logarithm of e. */\n readonly LOG2E: number;\n /** The base-10 logarithm of e. */\n readonly LOG10E: number;\n /** Pi. This is the ratio of the circumference of a circle to its diameter. */\n readonly PI: number;\n /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */\n readonly SQRT1_2: number;\n /** The square root of 2. */\n readonly SQRT2: number;\n /**\n * Returns the absolute value of a number (the value without regard to whether it is positive or negative).\n * For example, the absolute value of -5 is the same as the absolute value of 5.\n * @param x A numeric expression for which the absolute value is needed.\n */\n abs(x: number): number;\n /**\n * Returns the arc cosine (or inverse cosine) of a number.\n * @param x A numeric expression.\n */\n acos(x: number): number;\n /**\n * Returns the arcsine of a number.\n * @param x A numeric expression.\n */\n asin(x: number): number;\n /**\n * Returns the arctangent of a number.\n * @param x A numeric expression for which the arctangent is needed.\n */\n atan(x: number): number;\n /**\n * Returns the angle (in radians) from the X axis to a point.\n * @param y A numeric expression representing the cartesian y-coordinate.\n * @param x A numeric expression representing the cartesian x-coordinate.\n */\n atan2(y: number, x: number): number;\n /**\n * Returns the smallest number greater than or equal to its numeric argument.\n * @param x A numeric expression.\n */\n ceil(x: number): number;\n /**\n * Returns the cosine of a number.\n * @param x A numeric expression that contains an angle measured in radians.\n */\n cos(x: number): number;\n /**\n * Returns e (the base of natural logarithms) raised to a power.\n * @param x A numeric expression representing the power of e.\n */\n exp(x: number): number;\n /**\n * Returns the greatest number less than or equal to its numeric argument.\n * @param x A numeric expression.\n */\n floor(x: number): number;\n /**\n * Returns the natural logarithm (base e) of a number.\n * @param x A numeric expression.\n */\n log(x: number): number;\n /**\n * Returns the larger of a set of supplied numeric expressions.\n * @param values Numeric expressions to be evaluated.\n */\n max(...values: number[]): number;\n /**\n * Returns the smaller of a set of supplied numeric expressions.\n * @param values Numeric expressions to be evaluated.\n */\n min(...values: number[]): number;\n /**\n * Returns the value of a base expression taken to a specified power.\n * @param x The base value of the expression.\n * @param y The exponent value of the expression.\n */\n pow(x: number, y: number): number;\n /** Returns a pseudorandom number between 0 and 1. */\n random(): number;\n /**\n * Returns a supplied numeric expression rounded to the nearest number.\n * @param x The value to be rounded to the nearest number.\n */\n round(x: number): number;\n /**\n * Returns the sine of a number.\n * @param x A numeric expression that contains an angle measured in radians.\n */\n sin(x: number): number;\n /**\n * Returns the square root of a number.\n * @param x A numeric expression.\n */\n sqrt(x: number): number;\n /**\n * Returns the tangent of a number.\n * @param x A numeric expression that contains an angle measured in radians.\n */\n tan(x: number): number;\n}\n/** An intrinsic object that provides basic mathematics functionality and constants. */\ndeclare const Math: Math;\n\n/** Enables basic storage and retrieval of dates and times. */\ninterface Date {\n /** Returns a string representation of a date. The format of the string depends on the locale. */\n toString(): string;\n /** Returns a date as a string value. */\n toDateString(): string;\n /** Returns a time as a string value. */\n toTimeString(): string;\n /** Returns a value as a string value appropriate to the host environment's current locale. */\n toLocaleString(): string;\n /** Returns a date as a string value appropriate to the host environment's current locale. */\n toLocaleDateString(): string;\n /** Returns a time as a string value appropriate to the host environment's current locale. */\n toLocaleTimeString(): string;\n /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */\n valueOf(): number;\n /** Gets the time value in milliseconds. */\n getTime(): number;\n /** Gets the year, using local time. */\n getFullYear(): number;\n /** Gets the year using Universal Coordinated Time (UTC). */\n getUTCFullYear(): number;\n /** Gets the month, using local time. */\n getMonth(): number;\n /** Gets the month of a Date object using Universal Coordinated Time (UTC). */\n getUTCMonth(): number;\n /** Gets the day-of-the-month, using local time. */\n getDate(): number;\n /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */\n getUTCDate(): number;\n /** Gets the day of the week, using local time. */\n getDay(): number;\n /** Gets the day of the week using Universal Coordinated Time (UTC). */\n getUTCDay(): number;\n /** Gets the hours in a date, using local time. */\n getHours(): number;\n /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */\n getUTCHours(): number;\n /** Gets the minutes of a Date object, using local time. */\n getMinutes(): number;\n /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */\n getUTCMinutes(): number;\n /** Gets the seconds of a Date object, using local time. */\n getSeconds(): number;\n /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */\n getUTCSeconds(): number;\n /** Gets the milliseconds of a Date, using local time. */\n getMilliseconds(): number;\n /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */\n getUTCMilliseconds(): number;\n /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */\n getTimezoneOffset(): number;\n /**\n * Sets the date and time value in the Date object.\n * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT.\n */\n setTime(time: number): number;\n /**\n * Sets the milliseconds value in the Date object using local time.\n * @param ms A numeric value equal to the millisecond value.\n */\n setMilliseconds(ms: number): number;\n /**\n * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC).\n * @param ms A numeric value equal to the millisecond value.\n */\n setUTCMilliseconds(ms: number): number;\n\n /**\n * Sets the seconds value in the Date object using local time.\n * @param sec A numeric value equal to the seconds value.\n * @param ms A numeric value equal to the milliseconds value.\n */\n setSeconds(sec: number, ms?: number): number;\n /**\n * Sets the seconds value in the Date object using Universal Coordinated Time (UTC).\n * @param sec A numeric value equal to the seconds value.\n * @param ms A numeric value equal to the milliseconds value.\n */\n setUTCSeconds(sec: number, ms?: number): number;\n /**\n * Sets the minutes value in the Date object using local time.\n * @param min A numeric value equal to the minutes value.\n * @param sec A numeric value equal to the seconds value.\n * @param ms A numeric value equal to the milliseconds value.\n */\n setMinutes(min: number, sec?: number, ms?: number): number;\n /**\n * Sets the minutes value in the Date object using Universal Coordinated Time (UTC).\n * @param min A numeric value equal to the minutes value.\n * @param sec A numeric value equal to the seconds value.\n * @param ms A numeric value equal to the milliseconds value.\n */\n setUTCMinutes(min: number, sec?: number, ms?: number): number;\n /**\n * Sets the hour value in the Date object using local time.\n * @param hours A numeric value equal to the hours value.\n * @param min A numeric value equal to the minutes value.\n * @param sec A numeric value equal to the seconds value.\n * @param ms A numeric value equal to the milliseconds value.\n */\n setHours(hours: number, min?: number, sec?: number, ms?: number): number;\n /**\n * Sets the hours value in the Date object using Universal Coordinated Time (UTC).\n * @param hours A numeric value equal to the hours value.\n * @param min A numeric value equal to the minutes value.\n * @param sec A numeric value equal to the seconds value.\n * @param ms A numeric value equal to the milliseconds value.\n */\n setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number;\n /**\n * Sets the numeric day-of-the-month value of the Date object using local time.\n * @param date A numeric value equal to the day of the month.\n */\n setDate(date: number): number;\n /**\n * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC).\n * @param date A numeric value equal to the day of the month.\n */\n setUTCDate(date: number): number;\n /**\n * Sets the month value in the Date object using local time.\n * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively.\n * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used.\n */\n setMonth(month: number, date?: number): number;\n /**\n * Sets the month value in the Date object using Universal Coordinated Time (UTC).\n * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively.\n * @param date A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used.\n */\n setUTCMonth(month: number, date?: number): number;\n /**\n * Sets the year of the Date object using local time.\n * @param year A numeric value for the year.\n * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified.\n * @param date A numeric value equal for the day of the month.\n */\n setFullYear(year: number, month?: number, date?: number): number;\n /**\n * Sets the year value in the Date object using Universal Coordinated Time (UTC).\n * @param year A numeric value equal to the year.\n * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied.\n * @param date A numeric value equal to the day of the month.\n */\n setUTCFullYear(year: number, month?: number, date?: number): number;\n /** Returns a date converted to a string using Universal Coordinated Time (UTC). */\n toUTCString(): string;\n /** Returns a date as a string value in ISO format. */\n toISOString(): string;\n /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */\n toJSON(key?: any): string;\n}\n\ninterface DateConstructor {\n new (): Date;\n new (value: number): Date;\n new (value: string): Date;\n new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;\n (): string;\n readonly prototype: Date;\n /**\n * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970.\n * @param s A date string\n */\n parse(s: string): number;\n /**\n * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date.\n * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year.\n * @param month The month as an number between 0 and 11 (January to December).\n * @param date The date as an number between 1 and 31.\n * @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour.\n * @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes.\n * @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds.\n * @param ms An number from 0 to 999 that specifies the milliseconds.\n */\n UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number;\n now(): number;\n}\n\ndeclare const Date: DateConstructor;\n\ninterface RegExpMatchArray extends Array {\n index?: number;\n input?: string;\n}\n\ninterface RegExpExecArray extends Array {\n index: number;\n input: string;\n}\n\ninterface RegExp {\n /**\n * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search.\n * @param string The String object or string literal on which to perform the search.\n */\n exec(string: string): RegExpExecArray | null;\n\n /**\n * Returns a Boolean value that indicates whether or not a pattern exists in a searched string.\n * @param string String on which to perform the search.\n */\n test(string: string): boolean;\n\n /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */\n readonly source: string;\n\n /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */\n readonly global: boolean;\n\n /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */\n readonly ignoreCase: boolean;\n\n /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */\n readonly multiline: boolean;\n\n lastIndex: number;\n\n // Non-standard extensions\n compile(): this;\n}\n\ninterface RegExpConstructor {\n new (pattern: RegExp): RegExp;\n new (pattern: string, flags?: string): RegExp;\n (pattern: RegExp): RegExp;\n (pattern: string, flags?: string): RegExp;\n readonly prototype: RegExp;\n\n // Non-standard extensions\n $1: string;\n $2: string;\n $3: string;\n $4: string;\n $5: string;\n $6: string;\n $7: string;\n $8: string;\n $9: string;\n lastMatch: string;\n}\n\ndeclare const RegExp: RegExpConstructor;\n\ninterface Error {\n name: string;\n message: string;\n stack?: string;\n}\n\ninterface ErrorConstructor {\n new (message?: string): Error;\n (message?: string): Error;\n readonly prototype: Error;\n}\n\ndeclare const Error: ErrorConstructor;\n\ninterface EvalError extends Error {\n}\n\ninterface EvalErrorConstructor {\n new (message?: string): EvalError;\n (message?: string): EvalError;\n readonly prototype: EvalError;\n}\n\ndeclare const EvalError: EvalErrorConstructor;\n\ninterface RangeError extends Error {\n}\n\ninterface RangeErrorConstructor {\n new (message?: string): RangeError;\n (message?: string): RangeError;\n readonly prototype: RangeError;\n}\n\ndeclare const RangeError: RangeErrorConstructor;\n\ninterface ReferenceError extends Error {\n}\n\ninterface ReferenceErrorConstructor {\n new (message?: string): ReferenceError;\n (message?: string): ReferenceError;\n readonly prototype: ReferenceError;\n}\n\ndeclare const ReferenceError: ReferenceErrorConstructor;\n\ninterface SyntaxError extends Error {\n}\n\ninterface SyntaxErrorConstructor {\n new (message?: string): SyntaxError;\n (message?: string): SyntaxError;\n readonly prototype: SyntaxError;\n}\n\ndeclare const SyntaxError: SyntaxErrorConstructor;\n\ninterface TypeError extends Error {\n}\n\ninterface TypeErrorConstructor {\n new (message?: string): TypeError;\n (message?: string): TypeError;\n readonly prototype: TypeError;\n}\n\ndeclare const TypeError: TypeErrorConstructor;\n\ninterface URIError extends Error {\n}\n\ninterface URIErrorConstructor {\n new (message?: string): URIError;\n (message?: string): URIError;\n readonly prototype: URIError;\n}\n\ndeclare const URIError: URIErrorConstructor;\n\ninterface JSON {\n /**\n * Converts a JavaScript Object Notation (JSON) string into an object.\n * @param text A valid JSON string.\n * @param reviver A function that transforms the results. This function is called for each member of the object.\n * If a member contains nested objects, the nested objects are transformed before the parent object is.\n */\n parse(text: string, reviver?: (key: any, value: any) => any): any;\n /**\n * Converts a JavaScript value to a JavaScript Object Notation (JSON) string.\n * @param value A JavaScript value, usually an object or array, to be converted.\n * @param replacer A function that transforms the results.\n * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.\n */\n stringify(value: any, replacer?: (key: string, value: any) => any, space?: string | number): string;\n /**\n * Converts a JavaScript value to a JavaScript Object Notation (JSON) string.\n * @param value A JavaScript value, usually an object or array, to be converted.\n * @param replacer An array of strings and numbers that acts as a approved list for selecting the object properties that will be stringified.\n * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.\n */\n stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string;\n}\n\n/**\n * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.\n */\ndeclare const JSON: JSON;\n\n\n/////////////////////////////\n/// ECMAScript Array API (specially handled by compiler)\n/////////////////////////////\n\ninterface ReadonlyArray {\n /**\n * Gets the length of the array. This is a number one higher than the highest element defined in an array.\n */\n readonly length: number;\n /**\n * Returns a string representation of an array.\n */\n toString(): string;\n toLocaleString(): string;\n /**\n * Combines two or more arrays.\n * @param items Additional items to add to the end of array1.\n */\n concat>(...items: U[]): T[];\n /**\n * Combines two or more arrays.\n * @param items Additional items to add to the end of array1.\n */\n concat(...items: T[][]): T[];\n /**\n * Combines two or more arrays.\n * @param items Additional items to add to the end of array1.\n */\n concat(...items: (T | T[])[]): T[];\n /**\n * Adds all the elements of an array separated by the specified separator string.\n * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.\n */\n join(separator?: string): string;\n /**\n * Returns a section of an array.\n * @param start The beginning of the specified portion of the array.\n * @param end The end of the specified portion of the array.\n */\n slice(start?: number, end?: number): T[];\n /**\n * Returns the index of the first occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.\n */\n indexOf(searchElement: T, fromIndex?: number): number;\n\n /**\n * Returns the index of the last occurrence of a specified value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array.\n */\n lastIndexOf(searchElement: T, fromIndex?: number): number;\n /**\n * Determines whether all the members of an array satisfy the specified test.\n * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\n every(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean;\n /**\n * Determines whether the specified callback function returns true for any element of an array.\n * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\n some(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean;\n /**\n * Performs the specified action for each element in an array.\n * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\n forEach(callbackfn: (value: T, index: number, array: ReadonlyArray) => void, thisArg?: any): void;\n /**\n * Calls a defined callback function on each element of an array, and returns an array that contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\n map(callbackfn: (value: T, index: number, array: ReadonlyArray) => U, thisArg?: any): U[];\n /**\n * Returns the elements of an array that meet the condition specified in a callback function.\n * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\n filter(callbackfn: (value: T, index: number, array: ReadonlyArray) => value is S, thisArg?: any): S[];\n /**\n * Returns the elements of an array that meet the condition specified in a callback function.\n * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\n filter(callbackfn: (value: T, index: number, array: ReadonlyArray) => any, thisArg?: any): T[];\n /**\n * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n */\n reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T;\n /**\n * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n */\n reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U;\n /**\n * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T;\n /**\n * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U;\n\n readonly [n: number]: T;\n}\n\ninterface Array {\n /**\n * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array.\n */\n length: number;\n /**\n * Returns a string representation of an array.\n */\n toString(): string;\n toLocaleString(): string;\n /**\n * Appends new elements to an array, and returns the new length of the array.\n * @param items New elements of the Array.\n */\n push(...items: T[]): number;\n /**\n * Removes the last element from an array and returns it.\n */\n pop(): T | undefined;\n /**\n * Combines two or more arrays.\n * @param items Additional items to add to the end of array1.\n */\n concat(...items: T[][]): T[];\n /**\n * Combines two or more arrays.\n * @param items Additional items to add to the end of array1.\n */\n concat(...items: (T | T[])[]): T[];\n /**\n * Adds all the elements of an array separated by the specified separator string.\n * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.\n */\n join(separator?: string): string;\n /**\n * Reverses the elements in an Array.\n */\n reverse(): T[];\n /**\n * Removes the first element from an array and returns it.\n */\n shift(): T | undefined;\n /**\n * Returns a section of an array.\n * @param start The beginning of the specified portion of the array.\n * @param end The end of the specified portion of the array.\n */\n slice(start?: number, end?: number): T[];\n /**\n * Sorts an array.\n * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order.\n */\n sort(compareFn?: (a: T, b: T) => number): this;\n /**\n * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.\n * @param start The zero-based location in the array from which to start removing elements.\n */\n splice(start: number): T[];\n /**\n * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.\n * @param start The zero-based location in the array from which to start removing elements.\n * @param deleteCount The number of elements to remove.\n * @param items Elements to insert into the array in place of the deleted elements.\n */\n splice(start: number, deleteCount: number, ...items: T[]): T[];\n /**\n * Inserts new elements at the start of an array.\n * @param items Elements to insert at the start of the Array.\n */\n unshift(...items: T[]): number;\n /**\n * Returns the index of the first occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.\n */\n indexOf(searchElement: T, fromIndex?: number): number;\n /**\n * Returns the index of the last occurrence of a specified value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array.\n */\n lastIndexOf(searchElement: T, fromIndex?: number): number;\n /**\n * Determines whether all the members of an array satisfy the specified test.\n * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\n every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;\n /**\n * Determines whether the specified callback function returns true for any element of an array.\n * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\n some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;\n /**\n * Performs the specified action for each element in an array.\n * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\n forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void;\n /**\n * Calls a defined callback function on each element of an array, and returns an array that contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\n map(this: [T, T, T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U, U, U];\n /**\n * Calls a defined callback function on each element of an array, and returns an array that contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\n map(this: [T, T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U, U];\n /**\n * Calls a defined callback function on each element of an array, and returns an array that contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\n map(this: [T, T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U, U];\n /**\n * Calls a defined callback function on each element of an array, and returns an array that contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\n map(this: [T, T], callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): [U, U];\n /**\n * Calls a defined callback function on each element of an array, and returns an array that contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\n map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[];\n /**\n * Returns the elements of an array that meet the condition specified in a callback function.\n * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\n filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[];\n /**\n * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n */\n reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;\n /**\n * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n */\n reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;\n /**\n * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;\n /**\n * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;\n\n [n: number]: T;\n}\n\ninterface ArrayConstructor {\n new (arrayLength?: number): any[];\n new (arrayLength: number): T[];\n new (...items: T[]): T[];\n (arrayLength?: number): any[];\n (arrayLength: number): T[];\n (...items: T[]): T[];\n isArray(arg: any): arg is Array;\n readonly prototype: Array;\n}\n\ndeclare const Array: ArrayConstructor;\n\ninterface TypedPropertyDescriptor {\n enumerable?: boolean;\n configurable?: boolean;\n writable?: boolean;\n value?: T;\n get?: () => T;\n set?: (value: T) => void;\n}\n\ndeclare type ClassDecorator = (target: TFunction) => TFunction | void;\ndeclare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;\ndeclare type MethodDecorator = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void;\ndeclare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;\n\ndeclare type PromiseConstructorLike = new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike;\n\ninterface PromiseLike {\n /**\n * Attaches callbacks for the resolution and/or rejection of the Promise.\n * @param onfulfilled The callback to execute when the Promise is resolved.\n * @param onrejected The callback to execute when the Promise is rejected.\n * @returns A Promise for the completion of which ever callback is executed.\n */\n then(\n onfulfilled?: ((value: T) => T | PromiseLike) | undefined | null,\n onrejected?: ((reason: any) => T | PromiseLike) | undefined | null): PromiseLike;\n\n /**\n * Attaches callbacks for the resolution and/or rejection of the Promise.\n * @param onfulfilled The callback to execute when the Promise is resolved.\n * @param onrejected The callback to execute when the Promise is rejected.\n * @returns A Promise for the completion of which ever callback is executed.\n */\n then(\n onfulfilled: ((value: T) => T | PromiseLike) | undefined | null,\n onrejected: (reason: any) => TResult | PromiseLike): PromiseLike;\n\n /**\n * Attaches callbacks for the resolution and/or rejection of the Promise.\n * @param onfulfilled The callback to execute when the Promise is resolved.\n * @param onrejected The callback to execute when the Promise is rejected.\n * @returns A Promise for the completion of which ever callback is executed.\n */\n then(\n onfulfilled: (value: T) => TResult | PromiseLike,\n onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): PromiseLike;\n\n /**\n * Attaches callbacks for the resolution and/or rejection of the Promise.\n * @param onfulfilled The callback to execute when the Promise is resolved.\n * @param onrejected The callback to execute when the Promise is rejected.\n * @returns A Promise for the completion of which ever callback is executed.\n */\n then(\n onfulfilled: (value: T) => TResult1 | PromiseLike,\n onrejected: (reason: any) => TResult2 | PromiseLike): PromiseLike;\n}\n\ninterface ArrayLike {\n readonly length: number;\n readonly [n: number]: T;\n}\n\n/**\n * Make all properties in T optional\n */\ntype Partial = {\n [P in keyof T]?: T[P];\n};\n\n/**\n * Make all properties in T readonly\n */\ntype Readonly = {\n readonly [P in keyof T]: T[P];\n};\n\n/**\n * From T pick a set of properties K\n */\ntype Pick = {\n [P in K]: T[P];\n}\n\n/**\n * Construct a type with a set of properties K of type T\n */\ntype Record = {\n [P in K]: T;\n}\n\n/**\n * Represents a raw buffer of binary data, which is used to store data for the\n * different typed arrays. ArrayBuffers cannot be read from or written to directly,\n * but can be passed to a typed array or DataView Object to interpret the raw\n * buffer as needed.\n */\ninterface ArrayBuffer {\n /**\n * Read-only. The length of the ArrayBuffer (in bytes).\n */\n readonly byteLength: number;\n\n /**\n * Returns a section of an ArrayBuffer.\n */\n slice(begin:number, end?:number): ArrayBuffer;\n}\n\ninterface ArrayBufferConstructor {\n readonly prototype: ArrayBuffer;\n new (byteLength: number): ArrayBuffer;\n isView(arg: any): arg is ArrayBufferView;\n}\ndeclare const ArrayBuffer: ArrayBufferConstructor;\n\ninterface ArrayBufferView {\n /**\n * The ArrayBuffer instance referenced by the array.\n */\n buffer: ArrayBuffer;\n\n /**\n * The length in bytes of the array.\n */\n byteLength: number;\n\n /**\n * The offset in bytes of the array.\n */\n byteOffset: number;\n}\n\ninterface DataView {\n readonly buffer: ArrayBuffer;\n readonly byteLength: number;\n readonly byteOffset: number;\n /**\n * Gets the Float32 value at the specified byte offset from the start of the view. There is\n * no alignment constraint; multi-byte values may be fetched from any offset.\n * @param byteOffset The place in the buffer at which the value should be retrieved.\n */\n getFloat32(byteOffset: number, littleEndian?: boolean): number;\n\n /**\n * Gets the Float64 value at the specified byte offset from the start of the view. There is\n * no alignment constraint; multi-byte values may be fetched from any offset.\n * @param byteOffset The place in the buffer at which the value should be retrieved.\n */\n getFloat64(byteOffset: number, littleEndian?: boolean): number;\n\n /**\n * Gets the Int8 value at the specified byte offset from the start of the view. There is\n * no alignment constraint; multi-byte values may be fetched from any offset.\n * @param byteOffset The place in the buffer at which the value should be retrieved.\n */\n getInt8(byteOffset: number): number;\n\n /**\n * Gets the Int16 value at the specified byte offset from the start of the view. There is\n * no alignment constraint; multi-byte values may be fetched from any offset.\n * @param byteOffset The place in the buffer at which the value should be retrieved.\n */\n getInt16(byteOffset: number, littleEndian?: boolean): number;\n /**\n * Gets the Int32 value at the specified byte offset from the start of the view. There is\n * no alignment constraint; multi-byte values may be fetched from any offset.\n * @param byteOffset The place in the buffer at which the value should be retrieved.\n */\n getInt32(byteOffset: number, littleEndian?: boolean): number;\n\n /**\n * Gets the Uint8 value at the specified byte offset from the start of the view. There is\n * no alignment constraint; multi-byte values may be fetched from any offset.\n * @param byteOffset The place in the buffer at which the value should be retrieved.\n */\n getUint8(byteOffset: number): number;\n\n /**\n * Gets the Uint16 value at the specified byte offset from the start of the view. There is\n * no alignment constraint; multi-byte values may be fetched from any offset.\n * @param byteOffset The place in the buffer at which the value should be retrieved.\n */\n getUint16(byteOffset: number, littleEndian?: boolean): number;\n\n /**\n * Gets the Uint32 value at the specified byte offset from the start of the view. There is\n * no alignment constraint; multi-byte values may be fetched from any offset.\n * @param byteOffset The place in the buffer at which the value should be retrieved.\n */\n getUint32(byteOffset: number, littleEndian?: boolean): number;\n\n /**\n * Stores an Float32 value at the specified byte offset from the start of the view.\n * @param byteOffset The place in the buffer at which the value should be set.\n * @param value The value to set.\n * @param littleEndian If false or undefined, a big-endian value should be written,\n * otherwise a little-endian value should be written.\n */\n setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void;\n\n /**\n * Stores an Float64 value at the specified byte offset from the start of the view.\n * @param byteOffset The place in the buffer at which the value should be set.\n * @param value The value to set.\n * @param littleEndian If false or undefined, a big-endian value should be written,\n * otherwise a little-endian value should be written.\n */\n setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void;\n\n /**\n * Stores an Int8 value at the specified byte offset from the start of the view.\n * @param byteOffset The place in the buffer at which the value should be set.\n * @param value The value to set.\n */\n setInt8(byteOffset: number, value: number): void;\n\n /**\n * Stores an Int16 value at the specified byte offset from the start of the view.\n * @param byteOffset The place in the buffer at which the value should be set.\n * @param value The value to set.\n * @param littleEndian If false or undefined, a big-endian value should be written,\n * otherwise a little-endian value should be written.\n */\n setInt16(byteOffset: number, value: number, littleEndian?: boolean): void;\n\n /**\n * Stores an Int32 value at the specified byte offset from the start of the view.\n * @param byteOffset The place in the buffer at which the value should be set.\n * @param value The value to set.\n * @param littleEndian If false or undefined, a big-endian value should be written,\n * otherwise a little-endian value should be written.\n */\n setInt32(byteOffset: number, value: number, littleEndian?: boolean): void;\n\n /**\n * Stores an Uint8 value at the specified byte offset from the start of the view.\n * @param byteOffset The place in the buffer at which the value should be set.\n * @param value The value to set.\n */\n setUint8(byteOffset: number, value: number): void;\n\n /**\n * Stores an Uint16 value at the specified byte offset from the start of the view.\n * @param byteOffset The place in the buffer at which the value should be set.\n * @param value The value to set.\n * @param littleEndian If false or undefined, a big-endian value should be written,\n * otherwise a little-endian value should be written.\n */\n setUint16(byteOffset: number, value: number, littleEndian?: boolean): void;\n\n /**\n * Stores an Uint32 value at the specified byte offset from the start of the view.\n * @param byteOffset The place in the buffer at which the value should be set.\n * @param value The value to set.\n * @param littleEndian If false or undefined, a big-endian value should be written,\n * otherwise a little-endian value should be written.\n */\n setUint32(byteOffset: number, value: number, littleEndian?: boolean): void;\n}\n\ninterface DataViewConstructor {\n new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView;\n}\ndeclare const DataView: DataViewConstructor;\n\n/**\n * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested\n * number of bytes could not be allocated an exception is raised.\n */\ninterface Int8Array {\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * The ArrayBuffer instance referenced by the array.\n */\n readonly buffer: ArrayBuffer;\n\n /**\n * The length in bytes of the array.\n */\n readonly byteLength: number;\n\n /**\n * The offset in bytes of the array.\n */\n readonly byteOffset: number;\n\n /**\n * Returns the this object after copying a section of the array identified by start and end\n * to the same array starting at position target\n * @param target If target is negative, it is treated as length+target where length is the\n * length of the array.\n * @param start If start is negative, it is treated as length+start. If end is negative, it\n * is treated as length+end.\n * @param end If not specified, length of the this object is used as its default value.\n */\n copyWithin(target: number, start: number, end?: number): this;\n\n /**\n * Determines whether all the members of an array satisfy the specified test.\n * @param callbackfn A function that accepts up to three arguments. The every method calls\n * the callbackfn function for each element in array1 until the callbackfn returns false,\n * or until the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean;\n\n /**\n * Returns the this object after filling the section identified by start and end with value\n * @param value value to fill array section with\n * @param start index to start filling the array at. If start is negative, it is treated as\n * length+start where length is the length of the array.\n * @param end index to stop filling the array at. If end is negative, it is treated as\n * length+end.\n */\n fill(value: number, start?: number, end?: number): this;\n\n /**\n * Returns the elements of an array that meet the condition specified in a callback function.\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\n * the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n filter(callbackfn: (value: number, index: number, array: Int8Array) => any, thisArg?: any): Int8Array;\n\n /**\n * Returns the value of the first element in the array where predicate is true, and undefined\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found, find\n * immediately returns that element value. Otherwise, find returns undefined.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\n\n /**\n * Returns the index of the first element in the array where predicate is true, and -1\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found,\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number;\n\n /**\n * Performs the specified action for each element in an array.\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void;\n\n /**\n * Returns the index of the first occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n indexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * Adds all the elements of an array separated by the specified separator string.\n * @param separator A string used to separate one element of an array from the next in the\n * resulting String. If omitted, the array elements are separated with a comma.\n */\n join(separator?: string): string;\n\n /**\n * Returns the index of the last occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * The length of the array.\n */\n readonly length: number;\n\n /**\n * Calls a defined callback function on each element of an array, and returns an array that\n * contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an\n * argument instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U;\n\n /**\n * Reverses the elements in an Array.\n */\n reverse(): Int8Array;\n\n /**\n * Sets a value or an array of values.\n * @param index The index of the location to set.\n * @param value The value to set.\n */\n set(index: number, value: number): void;\n\n /**\n * Sets a value or an array of values.\n * @param array A typed or untyped array of values to set.\n * @param offset The index in the current array at which the values are to be written.\n */\n set(array: ArrayLike, offset?: number): void;\n\n /**\n * Returns a section of an array.\n * @param start The beginning of the specified portion of the array.\n * @param end The end of the specified portion of the array.\n */\n slice(start?: number, end?: number): Int8Array;\n\n /**\n * Determines whether the specified callback function returns true for any element of an array.\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\n * the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean;\n\n /**\n * Sorts an array.\n * @param compareFn The name of the function used to determine the order of the elements. If\n * omitted, the elements are sorted in ascending, ASCII character order.\n */\n sort(compareFn?: (a: number, b: number) => number): this;\n\n /**\n * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements\n * at begin, inclusive, up to end, exclusive.\n * @param begin The index of the beginning of the array.\n * @param end The index of the end of the array.\n */\n subarray(begin: number, end?: number): Int8Array;\n\n /**\n * Converts a number to a string by using the current locale.\n */\n toLocaleString(): string;\n\n /**\n * Returns a string representation of an array.\n */\n toString(): string;\n\n [index: number]: number;\n}\ninterface Int8ArrayConstructor {\n readonly prototype: Int8Array;\n new (length: number): Int8Array;\n new (array: ArrayLike): Int8Array;\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array;\n\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * Returns a new array from a set of elements.\n * @param items A set of elements to include in the new array object.\n */\n of(...items: number[]): Int8Array;\n\n /**\n * Creates an array from an array-like or iterable object.\n * @param arrayLike An array-like or iterable object to convert to an array.\n * @param mapfn A mapping function to call on every element of the array.\n * @param thisArg Value of 'this' used to invoke the mapfn.\n */\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array;\n\n}\ndeclare const Int8Array: Int8ArrayConstructor;\n\n/**\n * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the\n * requested number of bytes could not be allocated an exception is raised.\n */\ninterface Uint8Array {\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * The ArrayBuffer instance referenced by the array.\n */\n readonly buffer: ArrayBuffer;\n\n /**\n * The length in bytes of the array.\n */\n readonly byteLength: number;\n\n /**\n * The offset in bytes of the array.\n */\n readonly byteOffset: number;\n\n /**\n * Returns the this object after copying a section of the array identified by start and end\n * to the same array starting at position target\n * @param target If target is negative, it is treated as length+target where length is the\n * length of the array.\n * @param start If start is negative, it is treated as length+start. If end is negative, it\n * is treated as length+end.\n * @param end If not specified, length of the this object is used as its default value.\n */\n copyWithin(target: number, start: number, end?: number): this;\n\n /**\n * Determines whether all the members of an array satisfy the specified test.\n * @param callbackfn A function that accepts up to three arguments. The every method calls\n * the callbackfn function for each element in array1 until the callbackfn returns false,\n * or until the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean;\n\n /**\n * Returns the this object after filling the section identified by start and end with value\n * @param value value to fill array section with\n * @param start index to start filling the array at. If start is negative, it is treated as\n * length+start where length is the length of the array.\n * @param end index to stop filling the array at. If end is negative, it is treated as\n * length+end.\n */\n fill(value: number, start?: number, end?: number): this;\n\n /**\n * Returns the elements of an array that meet the condition specified in a callback function.\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\n * the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n filter(callbackfn: (value: number, index: number, array: Uint8Array) => any, thisArg?: any): Uint8Array;\n\n /**\n * Returns the value of the first element in the array where predicate is true, and undefined\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found, find\n * immediately returns that element value. Otherwise, find returns undefined.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\n\n /**\n * Returns the index of the first element in the array where predicate is true, and -1\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found,\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number;\n\n /**\n * Performs the specified action for each element in an array.\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void;\n\n /**\n * Returns the index of the first occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n indexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * Adds all the elements of an array separated by the specified separator string.\n * @param separator A string used to separate one element of an array from the next in the\n * resulting String. If omitted, the array elements are separated with a comma.\n */\n join(separator?: string): string;\n\n /**\n * Returns the index of the last occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * The length of the array.\n */\n readonly length: number;\n\n /**\n * Calls a defined callback function on each element of an array, and returns an array that\n * contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an\n * argument instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U;\n\n /**\n * Reverses the elements in an Array.\n */\n reverse(): Uint8Array;\n\n /**\n * Sets a value or an array of values.\n * @param index The index of the location to set.\n * @param value The value to set.\n */\n set(index: number, value: number): void;\n\n /**\n * Sets a value or an array of values.\n * @param array A typed or untyped array of values to set.\n * @param offset The index in the current array at which the values are to be written.\n */\n set(array: ArrayLike, offset?: number): void;\n\n /**\n * Returns a section of an array.\n * @param start The beginning of the specified portion of the array.\n * @param end The end of the specified portion of the array.\n */\n slice(start?: number, end?: number): Uint8Array;\n\n /**\n * Determines whether the specified callback function returns true for any element of an array.\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\n * the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean;\n\n /**\n * Sorts an array.\n * @param compareFn The name of the function used to determine the order of the elements. If\n * omitted, the elements are sorted in ascending, ASCII character order.\n */\n sort(compareFn?: (a: number, b: number) => number): this;\n\n /**\n * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements\n * at begin, inclusive, up to end, exclusive.\n * @param begin The index of the beginning of the array.\n * @param end The index of the end of the array.\n */\n subarray(begin: number, end?: number): Uint8Array;\n\n /**\n * Converts a number to a string by using the current locale.\n */\n toLocaleString(): string;\n\n /**\n * Returns a string representation of an array.\n */\n toString(): string;\n\n [index: number]: number;\n}\n\ninterface Uint8ArrayConstructor {\n readonly prototype: Uint8Array;\n new (length: number): Uint8Array;\n new (array: ArrayLike): Uint8Array;\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array;\n\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * Returns a new array from a set of elements.\n * @param items A set of elements to include in the new array object.\n */\n of(...items: number[]): Uint8Array;\n\n /**\n * Creates an array from an array-like or iterable object.\n * @param arrayLike An array-like or iterable object to convert to an array.\n * @param mapfn A mapping function to call on every element of the array.\n * @param thisArg Value of 'this' used to invoke the mapfn.\n */\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array;\n\n}\ndeclare const Uint8Array: Uint8ArrayConstructor;\n\n/**\n * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0.\n * If the requested number of bytes could not be allocated an exception is raised.\n */\ninterface Uint8ClampedArray {\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * The ArrayBuffer instance referenced by the array.\n */\n readonly buffer: ArrayBuffer;\n\n /**\n * The length in bytes of the array.\n */\n readonly byteLength: number;\n\n /**\n * The offset in bytes of the array.\n */\n readonly byteOffset: number;\n\n /**\n * Returns the this object after copying a section of the array identified by start and end\n * to the same array starting at position target\n * @param target If target is negative, it is treated as length+target where length is the\n * length of the array.\n * @param start If start is negative, it is treated as length+start. If end is negative, it\n * is treated as length+end.\n * @param end If not specified, length of the this object is used as its default value.\n */\n copyWithin(target: number, start: number, end?: number): this;\n\n /**\n * Determines whether all the members of an array satisfy the specified test.\n * @param callbackfn A function that accepts up to three arguments. The every method calls\n * the callbackfn function for each element in array1 until the callbackfn returns false,\n * or until the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean;\n\n /**\n * Returns the this object after filling the section identified by start and end with value\n * @param value value to fill array section with\n * @param start index to start filling the array at. If start is negative, it is treated as\n * length+start where length is the length of the array.\n * @param end index to stop filling the array at. If end is negative, it is treated as\n * length+end.\n */\n fill(value: number, start?: number, end?: number): this;\n\n /**\n * Returns the elements of an array that meet the condition specified in a callback function.\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\n * the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => any, thisArg?: any): Uint8ClampedArray;\n\n /**\n * Returns the value of the first element in the array where predicate is true, and undefined\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found, find\n * immediately returns that element value. Otherwise, find returns undefined.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\n\n /**\n * Returns the index of the first element in the array where predicate is true, and -1\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found,\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number;\n\n /**\n * Performs the specified action for each element in an array.\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void;\n\n /**\n * Returns the index of the first occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n indexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * Adds all the elements of an array separated by the specified separator string.\n * @param separator A string used to separate one element of an array from the next in the\n * resulting String. If omitted, the array elements are separated with a comma.\n */\n join(separator?: string): string;\n\n /**\n * Returns the index of the last occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * The length of the array.\n */\n readonly length: number;\n\n /**\n * Calls a defined callback function on each element of an array, and returns an array that\n * contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an\n * argument instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U;\n\n /**\n * Reverses the elements in an Array.\n */\n reverse(): Uint8ClampedArray;\n\n /**\n * Sets a value or an array of values.\n * @param index The index of the location to set.\n * @param value The value to set.\n */\n set(index: number, value: number): void;\n\n /**\n * Sets a value or an array of values.\n * @param array A typed or untyped array of values to set.\n * @param offset The index in the current array at which the values are to be written.\n */\n set(array: Uint8ClampedArray, offset?: number): void;\n\n /**\n * Returns a section of an array.\n * @param start The beginning of the specified portion of the array.\n * @param end The end of the specified portion of the array.\n */\n slice(start?: number, end?: number): Uint8ClampedArray;\n\n /**\n * Determines whether the specified callback function returns true for any element of an array.\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\n * the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean;\n\n /**\n * Sorts an array.\n * @param compareFn The name of the function used to determine the order of the elements. If\n * omitted, the elements are sorted in ascending, ASCII character order.\n */\n sort(compareFn?: (a: number, b: number) => number): this;\n\n /**\n * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements\n * at begin, inclusive, up to end, exclusive.\n * @param begin The index of the beginning of the array.\n * @param end The index of the end of the array.\n */\n subarray(begin: number, end?: number): Uint8ClampedArray;\n\n /**\n * Converts a number to a string by using the current locale.\n */\n toLocaleString(): string;\n\n /**\n * Returns a string representation of an array.\n */\n toString(): string;\n\n [index: number]: number;\n}\n\ninterface Uint8ClampedArrayConstructor {\n readonly prototype: Uint8ClampedArray;\n new (length: number): Uint8ClampedArray;\n new (array: ArrayLike): Uint8ClampedArray;\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray;\n\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * Returns a new array from a set of elements.\n * @param items A set of elements to include in the new array object.\n */\n of(...items: number[]): Uint8ClampedArray;\n\n /**\n * Creates an array from an array-like or iterable object.\n * @param arrayLike An array-like or iterable object to convert to an array.\n * @param mapfn A mapping function to call on every element of the array.\n * @param thisArg Value of 'this' used to invoke the mapfn.\n */\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray;\n}\ndeclare const Uint8ClampedArray: Uint8ClampedArrayConstructor;\n\n/**\n * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the\n * requested number of bytes could not be allocated an exception is raised.\n */\ninterface Int16Array {\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * The ArrayBuffer instance referenced by the array.\n */\n readonly buffer: ArrayBuffer;\n\n /**\n * The length in bytes of the array.\n */\n readonly byteLength: number;\n\n /**\n * The offset in bytes of the array.\n */\n readonly byteOffset: number;\n\n /**\n * Returns the this object after copying a section of the array identified by start and end\n * to the same array starting at position target\n * @param target If target is negative, it is treated as length+target where length is the\n * length of the array.\n * @param start If start is negative, it is treated as length+start. If end is negative, it\n * is treated as length+end.\n * @param end If not specified, length of the this object is used as its default value.\n */\n copyWithin(target: number, start: number, end?: number): this;\n\n /**\n * Determines whether all the members of an array satisfy the specified test.\n * @param callbackfn A function that accepts up to three arguments. The every method calls\n * the callbackfn function for each element in array1 until the callbackfn returns false,\n * or until the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean;\n\n /**\n * Returns the this object after filling the section identified by start and end with value\n * @param value value to fill array section with\n * @param start index to start filling the array at. If start is negative, it is treated as\n * length+start where length is the length of the array.\n * @param end index to stop filling the array at. If end is negative, it is treated as\n * length+end.\n */\n fill(value: number, start?: number, end?: number): this;\n\n /**\n * Returns the elements of an array that meet the condition specified in a callback function.\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\n * the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n filter(callbackfn: (value: number, index: number, array: Int16Array) => any, thisArg?: any): Int16Array;\n\n /**\n * Returns the value of the first element in the array where predicate is true, and undefined\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found, find\n * immediately returns that element value. Otherwise, find returns undefined.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\n\n /**\n * Returns the index of the first element in the array where predicate is true, and -1\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found,\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number;\n\n /**\n * Performs the specified action for each element in an array.\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void;\n\n /**\n * Returns the index of the first occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n indexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * Adds all the elements of an array separated by the specified separator string.\n * @param separator A string used to separate one element of an array from the next in the\n * resulting String. If omitted, the array elements are separated with a comma.\n */\n join(separator?: string): string;\n\n /**\n * Returns the index of the last occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * The length of the array.\n */\n readonly length: number;\n\n /**\n * Calls a defined callback function on each element of an array, and returns an array that\n * contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an\n * argument instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U;\n\n /**\n * Reverses the elements in an Array.\n */\n reverse(): Int16Array;\n\n /**\n * Sets a value or an array of values.\n * @param index The index of the location to set.\n * @param value The value to set.\n */\n set(index: number, value: number): void;\n\n /**\n * Sets a value or an array of values.\n * @param array A typed or untyped array of values to set.\n * @param offset The index in the current array at which the values are to be written.\n */\n set(array: ArrayLike, offset?: number): void;\n\n /**\n * Returns a section of an array.\n * @param start The beginning of the specified portion of the array.\n * @param end The end of the specified portion of the array.\n */\n slice(start?: number, end?: number): Int16Array;\n\n /**\n * Determines whether the specified callback function returns true for any element of an array.\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\n * the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean;\n\n /**\n * Sorts an array.\n * @param compareFn The name of the function used to determine the order of the elements. If\n * omitted, the elements are sorted in ascending, ASCII character order.\n */\n sort(compareFn?: (a: number, b: number) => number): this;\n\n /**\n * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements\n * at begin, inclusive, up to end, exclusive.\n * @param begin The index of the beginning of the array.\n * @param end The index of the end of the array.\n */\n subarray(begin: number, end?: number): Int16Array;\n\n /**\n * Converts a number to a string by using the current locale.\n */\n toLocaleString(): string;\n\n /**\n * Returns a string representation of an array.\n */\n toString(): string;\n\n [index: number]: number;\n}\n\ninterface Int16ArrayConstructor {\n readonly prototype: Int16Array;\n new (length: number): Int16Array;\n new (array: ArrayLike): Int16Array;\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array;\n\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * Returns a new array from a set of elements.\n * @param items A set of elements to include in the new array object.\n */\n of(...items: number[]): Int16Array;\n\n /**\n * Creates an array from an array-like or iterable object.\n * @param arrayLike An array-like or iterable object to convert to an array.\n * @param mapfn A mapping function to call on every element of the array.\n * @param thisArg Value of 'this' used to invoke the mapfn.\n */\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array;\n\n}\ndeclare const Int16Array: Int16ArrayConstructor;\n\n/**\n * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the\n * requested number of bytes could not be allocated an exception is raised.\n */\ninterface Uint16Array {\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * The ArrayBuffer instance referenced by the array.\n */\n readonly buffer: ArrayBuffer;\n\n /**\n * The length in bytes of the array.\n */\n readonly byteLength: number;\n\n /**\n * The offset in bytes of the array.\n */\n readonly byteOffset: number;\n\n /**\n * Returns the this object after copying a section of the array identified by start and end\n * to the same array starting at position target\n * @param target If target is negative, it is treated as length+target where length is the\n * length of the array.\n * @param start If start is negative, it is treated as length+start. If end is negative, it\n * is treated as length+end.\n * @param end If not specified, length of the this object is used as its default value.\n */\n copyWithin(target: number, start: number, end?: number): this;\n\n /**\n * Determines whether all the members of an array satisfy the specified test.\n * @param callbackfn A function that accepts up to three arguments. The every method calls\n * the callbackfn function for each element in array1 until the callbackfn returns false,\n * or until the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean;\n\n /**\n * Returns the this object after filling the section identified by start and end with value\n * @param value value to fill array section with\n * @param start index to start filling the array at. If start is negative, it is treated as\n * length+start where length is the length of the array.\n * @param end index to stop filling the array at. If end is negative, it is treated as\n * length+end.\n */\n fill(value: number, start?: number, end?: number): this;\n\n /**\n * Returns the elements of an array that meet the condition specified in a callback function.\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\n * the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n filter(callbackfn: (value: number, index: number, array: Uint16Array) => any, thisArg?: any): Uint16Array;\n\n /**\n * Returns the value of the first element in the array where predicate is true, and undefined\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found, find\n * immediately returns that element value. Otherwise, find returns undefined.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\n\n /**\n * Returns the index of the first element in the array where predicate is true, and -1\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found,\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number;\n\n /**\n * Performs the specified action for each element in an array.\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void;\n\n /**\n * Returns the index of the first occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n indexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * Adds all the elements of an array separated by the specified separator string.\n * @param separator A string used to separate one element of an array from the next in the\n * resulting String. If omitted, the array elements are separated with a comma.\n */\n join(separator?: string): string;\n\n /**\n * Returns the index of the last occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * The length of the array.\n */\n readonly length: number;\n\n /**\n * Calls a defined callback function on each element of an array, and returns an array that\n * contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an\n * argument instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U;\n\n /**\n * Reverses the elements in an Array.\n */\n reverse(): Uint16Array;\n\n /**\n * Sets a value or an array of values.\n * @param index The index of the location to set.\n * @param value The value to set.\n */\n set(index: number, value: number): void;\n\n /**\n * Sets a value or an array of values.\n * @param array A typed or untyped array of values to set.\n * @param offset The index in the current array at which the values are to be written.\n */\n set(array: ArrayLike, offset?: number): void;\n\n /**\n * Returns a section of an array.\n * @param start The beginning of the specified portion of the array.\n * @param end The end of the specified portion of the array.\n */\n slice(start?: number, end?: number): Uint16Array;\n\n /**\n * Determines whether the specified callback function returns true for any element of an array.\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\n * the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean;\n\n /**\n * Sorts an array.\n * @param compareFn The name of the function used to determine the order of the elements. If\n * omitted, the elements are sorted in ascending, ASCII character order.\n */\n sort(compareFn?: (a: number, b: number) => number): this;\n\n /**\n * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements\n * at begin, inclusive, up to end, exclusive.\n * @param begin The index of the beginning of the array.\n * @param end The index of the end of the array.\n */\n subarray(begin: number, end?: number): Uint16Array;\n\n /**\n * Converts a number to a string by using the current locale.\n */\n toLocaleString(): string;\n\n /**\n * Returns a string representation of an array.\n */\n toString(): string;\n\n [index: number]: number;\n}\n\ninterface Uint16ArrayConstructor {\n readonly prototype: Uint16Array;\n new (length: number): Uint16Array;\n new (array: ArrayLike): Uint16Array;\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array;\n\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * Returns a new array from a set of elements.\n * @param items A set of elements to include in the new array object.\n */\n of(...items: number[]): Uint16Array;\n\n /**\n * Creates an array from an array-like or iterable object.\n * @param arrayLike An array-like or iterable object to convert to an array.\n * @param mapfn A mapping function to call on every element of the array.\n * @param thisArg Value of 'this' used to invoke the mapfn.\n */\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array;\n\n}\ndeclare const Uint16Array: Uint16ArrayConstructor;\n/**\n * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the\n * requested number of bytes could not be allocated an exception is raised.\n */\ninterface Int32Array {\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * The ArrayBuffer instance referenced by the array.\n */\n readonly buffer: ArrayBuffer;\n\n /**\n * The length in bytes of the array.\n */\n readonly byteLength: number;\n\n /**\n * The offset in bytes of the array.\n */\n readonly byteOffset: number;\n\n /**\n * Returns the this object after copying a section of the array identified by start and end\n * to the same array starting at position target\n * @param target If target is negative, it is treated as length+target where length is the\n * length of the array.\n * @param start If start is negative, it is treated as length+start. If end is negative, it\n * is treated as length+end.\n * @param end If not specified, length of the this object is used as its default value.\n */\n copyWithin(target: number, start: number, end?: number): this;\n\n /**\n * Determines whether all the members of an array satisfy the specified test.\n * @param callbackfn A function that accepts up to three arguments. The every method calls\n * the callbackfn function for each element in array1 until the callbackfn returns false,\n * or until the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean;\n\n /**\n * Returns the this object after filling the section identified by start and end with value\n * @param value value to fill array section with\n * @param start index to start filling the array at. If start is negative, it is treated as\n * length+start where length is the length of the array.\n * @param end index to stop filling the array at. If end is negative, it is treated as\n * length+end.\n */\n fill(value: number, start?: number, end?: number): this;\n\n /**\n * Returns the elements of an array that meet the condition specified in a callback function.\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\n * the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n filter(callbackfn: (value: number, index: number, array: Int32Array) => any, thisArg?: any): Int32Array;\n\n /**\n * Returns the value of the first element in the array where predicate is true, and undefined\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found, find\n * immediately returns that element value. Otherwise, find returns undefined.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\n\n /**\n * Returns the index of the first element in the array where predicate is true, and -1\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found,\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number;\n\n /**\n * Performs the specified action for each element in an array.\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void;\n\n /**\n * Returns the index of the first occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n indexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * Adds all the elements of an array separated by the specified separator string.\n * @param separator A string used to separate one element of an array from the next in the\n * resulting String. If omitted, the array elements are separated with a comma.\n */\n join(separator?: string): string;\n\n /**\n * Returns the index of the last occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * The length of the array.\n */\n readonly length: number;\n\n /**\n * Calls a defined callback function on each element of an array, and returns an array that\n * contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an\n * argument instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U;\n\n /**\n * Reverses the elements in an Array.\n */\n reverse(): Int32Array;\n\n /**\n * Sets a value or an array of values.\n * @param index The index of the location to set.\n * @param value The value to set.\n */\n set(index: number, value: number): void;\n\n /**\n * Sets a value or an array of values.\n * @param array A typed or untyped array of values to set.\n * @param offset The index in the current array at which the values are to be written.\n */\n set(array: ArrayLike, offset?: number): void;\n\n /**\n * Returns a section of an array.\n * @param start The beginning of the specified portion of the array.\n * @param end The end of the specified portion of the array.\n */\n slice(start?: number, end?: number): Int32Array;\n\n /**\n * Determines whether the specified callback function returns true for any element of an array.\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\n * the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean;\n\n /**\n * Sorts an array.\n * @param compareFn The name of the function used to determine the order of the elements. If\n * omitted, the elements are sorted in ascending, ASCII character order.\n */\n sort(compareFn?: (a: number, b: number) => number): this;\n\n /**\n * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements\n * at begin, inclusive, up to end, exclusive.\n * @param begin The index of the beginning of the array.\n * @param end The index of the end of the array.\n */\n subarray(begin: number, end?: number): Int32Array;\n\n /**\n * Converts a number to a string by using the current locale.\n */\n toLocaleString(): string;\n\n /**\n * Returns a string representation of an array.\n */\n toString(): string;\n\n [index: number]: number;\n}\n\ninterface Int32ArrayConstructor {\n readonly prototype: Int32Array;\n new (length: number): Int32Array;\n new (array: ArrayLike): Int32Array;\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array;\n\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * Returns a new array from a set of elements.\n * @param items A set of elements to include in the new array object.\n */\n of(...items: number[]): Int32Array;\n\n /**\n * Creates an array from an array-like or iterable object.\n * @param arrayLike An array-like or iterable object to convert to an array.\n * @param mapfn A mapping function to call on every element of the array.\n * @param thisArg Value of 'this' used to invoke the mapfn.\n */\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array;\n}\ndeclare const Int32Array: Int32ArrayConstructor;\n\n/**\n * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the\n * requested number of bytes could not be allocated an exception is raised.\n */\ninterface Uint32Array {\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * The ArrayBuffer instance referenced by the array.\n */\n readonly buffer: ArrayBuffer;\n\n /**\n * The length in bytes of the array.\n */\n readonly byteLength: number;\n\n /**\n * The offset in bytes of the array.\n */\n readonly byteOffset: number;\n\n /**\n * Returns the this object after copying a section of the array identified by start and end\n * to the same array starting at position target\n * @param target If target is negative, it is treated as length+target where length is the\n * length of the array.\n * @param start If start is negative, it is treated as length+start. If end is negative, it\n * is treated as length+end.\n * @param end If not specified, length of the this object is used as its default value.\n */\n copyWithin(target: number, start: number, end?: number): this;\n\n /**\n * Determines whether all the members of an array satisfy the specified test.\n * @param callbackfn A function that accepts up to three arguments. The every method calls\n * the callbackfn function for each element in array1 until the callbackfn returns false,\n * or until the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean;\n\n /**\n * Returns the this object after filling the section identified by start and end with value\n * @param value value to fill array section with\n * @param start index to start filling the array at. If start is negative, it is treated as\n * length+start where length is the length of the array.\n * @param end index to stop filling the array at. If end is negative, it is treated as\n * length+end.\n */\n fill(value: number, start?: number, end?: number): this;\n\n /**\n * Returns the elements of an array that meet the condition specified in a callback function.\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\n * the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n filter(callbackfn: (value: number, index: number, array: Uint32Array) => any, thisArg?: any): Uint32Array;\n\n /**\n * Returns the value of the first element in the array where predicate is true, and undefined\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found, find\n * immediately returns that element value. Otherwise, find returns undefined.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\n\n /**\n * Returns the index of the first element in the array where predicate is true, and -1\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found,\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number;\n\n /**\n * Performs the specified action for each element in an array.\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void;\n\n /**\n * Returns the index of the first occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n indexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * Adds all the elements of an array separated by the specified separator string.\n * @param separator A string used to separate one element of an array from the next in the\n * resulting String. If omitted, the array elements are separated with a comma.\n */\n join(separator?: string): string;\n\n /**\n * Returns the index of the last occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * The length of the array.\n */\n readonly length: number;\n\n /**\n * Calls a defined callback function on each element of an array, and returns an array that\n * contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an\n * argument instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U;\n\n /**\n * Reverses the elements in an Array.\n */\n reverse(): Uint32Array;\n\n /**\n * Sets a value or an array of values.\n * @param index The index of the location to set.\n * @param value The value to set.\n */\n set(index: number, value: number): void;\n\n /**\n * Sets a value or an array of values.\n * @param array A typed or untyped array of values to set.\n * @param offset The index in the current array at which the values are to be written.\n */\n set(array: ArrayLike, offset?: number): void;\n\n /**\n * Returns a section of an array.\n * @param start The beginning of the specified portion of the array.\n * @param end The end of the specified portion of the array.\n */\n slice(start?: number, end?: number): Uint32Array;\n\n /**\n * Determines whether the specified callback function returns true for any element of an array.\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\n * the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean;\n\n /**\n * Sorts an array.\n * @param compareFn The name of the function used to determine the order of the elements. If\n * omitted, the elements are sorted in ascending, ASCII character order.\n */\n sort(compareFn?: (a: number, b: number) => number): this;\n\n /**\n * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements\n * at begin, inclusive, up to end, exclusive.\n * @param begin The index of the beginning of the array.\n * @param end The index of the end of the array.\n */\n subarray(begin: number, end?: number): Uint32Array;\n\n /**\n * Converts a number to a string by using the current locale.\n */\n toLocaleString(): string;\n\n /**\n * Returns a string representation of an array.\n */\n toString(): string;\n\n [index: number]: number;\n}\n\ninterface Uint32ArrayConstructor {\n readonly prototype: Uint32Array;\n new (length: number): Uint32Array;\n new (array: ArrayLike): Uint32Array;\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array;\n\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * Returns a new array from a set of elements.\n * @param items A set of elements to include in the new array object.\n */\n of(...items: number[]): Uint32Array;\n\n /**\n * Creates an array from an array-like or iterable object.\n * @param arrayLike An array-like or iterable object to convert to an array.\n * @param mapfn A mapping function to call on every element of the array.\n * @param thisArg Value of 'this' used to invoke the mapfn.\n */\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array;\n}\ndeclare const Uint32Array: Uint32ArrayConstructor;\n\n/**\n * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number\n * of bytes could not be allocated an exception is raised.\n */\ninterface Float32Array {\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * The ArrayBuffer instance referenced by the array.\n */\n readonly buffer: ArrayBuffer;\n\n /**\n * The length in bytes of the array.\n */\n readonly byteLength: number;\n\n /**\n * The offset in bytes of the array.\n */\n readonly byteOffset: number;\n\n /**\n * Returns the this object after copying a section of the array identified by start and end\n * to the same array starting at position target\n * @param target If target is negative, it is treated as length+target where length is the\n * length of the array.\n * @param start If start is negative, it is treated as length+start. If end is negative, it\n * is treated as length+end.\n * @param end If not specified, length of the this object is used as its default value.\n */\n copyWithin(target: number, start: number, end?: number): this;\n\n /**\n * Determines whether all the members of an array satisfy the specified test.\n * @param callbackfn A function that accepts up to three arguments. The every method calls\n * the callbackfn function for each element in array1 until the callbackfn returns false,\n * or until the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean;\n\n /**\n * Returns the this object after filling the section identified by start and end with value\n * @param value value to fill array section with\n * @param start index to start filling the array at. If start is negative, it is treated as\n * length+start where length is the length of the array.\n * @param end index to stop filling the array at. If end is negative, it is treated as\n * length+end.\n */\n fill(value: number, start?: number, end?: number): this;\n\n /**\n * Returns the elements of an array that meet the condition specified in a callback function.\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\n * the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n filter(callbackfn: (value: number, index: number, array: Float32Array) => any, thisArg?: any): Float32Array;\n\n /**\n * Returns the value of the first element in the array where predicate is true, and undefined\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found, find\n * immediately returns that element value. Otherwise, find returns undefined.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\n\n /**\n * Returns the index of the first element in the array where predicate is true, and -1\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found,\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number;\n\n /**\n * Performs the specified action for each element in an array.\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void;\n\n /**\n * Returns the index of the first occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n indexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * Adds all the elements of an array separated by the specified separator string.\n * @param separator A string used to separate one element of an array from the next in the\n * resulting String. If omitted, the array elements are separated with a comma.\n */\n join(separator?: string): string;\n\n /**\n * Returns the index of the last occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * The length of the array.\n */\n readonly length: number;\n\n /**\n * Calls a defined callback function on each element of an array, and returns an array that\n * contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an\n * argument instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U;\n\n /**\n * Reverses the elements in an Array.\n */\n reverse(): Float32Array;\n\n /**\n * Sets a value or an array of values.\n * @param index The index of the location to set.\n * @param value The value to set.\n */\n set(index: number, value: number): void;\n\n /**\n * Sets a value or an array of values.\n * @param array A typed or untyped array of values to set.\n * @param offset The index in the current array at which the values are to be written.\n */\n set(array: ArrayLike, offset?: number): void;\n\n /**\n * Returns a section of an array.\n * @param start The beginning of the specified portion of the array.\n * @param end The end of the specified portion of the array.\n */\n slice(start?: number, end?: number): Float32Array;\n\n /**\n * Determines whether the specified callback function returns true for any element of an array.\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\n * the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean;\n\n /**\n * Sorts an array.\n * @param compareFn The name of the function used to determine the order of the elements. If\n * omitted, the elements are sorted in ascending, ASCII character order.\n */\n sort(compareFn?: (a: number, b: number) => number): this;\n\n /**\n * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements\n * at begin, inclusive, up to end, exclusive.\n * @param begin The index of the beginning of the array.\n * @param end The index of the end of the array.\n */\n subarray(begin: number, end?: number): Float32Array;\n\n /**\n * Converts a number to a string by using the current locale.\n */\n toLocaleString(): string;\n\n /**\n * Returns a string representation of an array.\n */\n toString(): string;\n\n [index: number]: number;\n}\n\ninterface Float32ArrayConstructor {\n readonly prototype: Float32Array;\n new (length: number): Float32Array;\n new (array: ArrayLike): Float32Array;\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array;\n\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * Returns a new array from a set of elements.\n * @param items A set of elements to include in the new array object.\n */\n of(...items: number[]): Float32Array;\n\n /**\n * Creates an array from an array-like or iterable object.\n * @param arrayLike An array-like or iterable object to convert to an array.\n * @param mapfn A mapping function to call on every element of the array.\n * @param thisArg Value of 'this' used to invoke the mapfn.\n */\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array;\n\n}\ndeclare const Float32Array: Float32ArrayConstructor;\n\n/**\n * A typed array of 64-bit float values. The contents are initialized to 0. If the requested\n * number of bytes could not be allocated an exception is raised.\n */\ninterface Float64Array {\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * The ArrayBuffer instance referenced by the array.\n */\n readonly buffer: ArrayBuffer;\n\n /**\n * The length in bytes of the array.\n */\n readonly byteLength: number;\n\n /**\n * The offset in bytes of the array.\n */\n readonly byteOffset: number;\n\n /**\n * Returns the this object after copying a section of the array identified by start and end\n * to the same array starting at position target\n * @param target If target is negative, it is treated as length+target where length is the\n * length of the array.\n * @param start If start is negative, it is treated as length+start. If end is negative, it\n * is treated as length+end.\n * @param end If not specified, length of the this object is used as its default value.\n */\n copyWithin(target: number, start: number, end?: number): this;\n\n /**\n * Determines whether all the members of an array satisfy the specified test.\n * @param callbackfn A function that accepts up to three arguments. The every method calls\n * the callbackfn function for each element in array1 until the callbackfn returns false,\n * or until the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean;\n\n /**\n * Returns the this object after filling the section identified by start and end with value\n * @param value value to fill array section with\n * @param start index to start filling the array at. If start is negative, it is treated as\n * length+start where length is the length of the array.\n * @param end index to stop filling the array at. If end is negative, it is treated as\n * length+end.\n */\n fill(value: number, start?: number, end?: number): this;\n\n /**\n * Returns the elements of an array that meet the condition specified in a callback function.\n * @param callbackfn A function that accepts up to three arguments. The filter method calls\n * the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n filter(callbackfn: (value: number, index: number, array: Float64Array) => any, thisArg?: any): Float64Array;\n\n /**\n * Returns the value of the first element in the array where predicate is true, and undefined\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found, find\n * immediately returns that element value. Otherwise, find returns undefined.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined;\n\n /**\n * Returns the index of the first element in the array where predicate is true, and -1\n * otherwise.\n * @param predicate find calls predicate once for each element of the array, in ascending\n * order, until it finds one where predicate returns true. If such an element is found,\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\n findIndex(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number;\n\n /**\n * Performs the specified action for each element in an array.\n * @param callbackfn A function that accepts up to three arguments. forEach calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void;\n\n /**\n * Returns the index of the first occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n indexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * Adds all the elements of an array separated by the specified separator string.\n * @param separator A string used to separate one element of an array from the next in the\n * resulting String. If omitted, the array elements are separated with a comma.\n */\n join(separator?: string): string;\n\n /**\n * Returns the index of the last occurrence of a value in an array.\n * @param searchElement The value to locate in the array.\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the\n * search starts at index 0.\n */\n lastIndexOf(searchElement: number, fromIndex?: number): number;\n\n /**\n * The length of the array.\n */\n readonly length: number;\n\n /**\n * Calls a defined callback function on each element of an array, and returns an array that\n * contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the\n * callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array. The return value of\n * the callback function is the accumulated result, and is provided as an argument in the next\n * call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the\n * callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an\n * argument instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number;\n\n /**\n * Calls the specified callback function for all the elements in an array, in descending order.\n * The return value of the callback function is the accumulated result, and is provided as an\n * argument in the next call to the callback function.\n * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls\n * the callbackfn function one time for each element in the array.\n * @param initialValue If initialValue is specified, it is used as the initial value to start\n * the accumulation. The first call to the callbackfn function provides this value as an argument\n * instead of an array value.\n */\n reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U;\n\n /**\n * Reverses the elements in an Array.\n */\n reverse(): Float64Array;\n\n /**\n * Sets a value or an array of values.\n * @param index The index of the location to set.\n * @param value The value to set.\n */\n set(index: number, value: number): void;\n\n /**\n * Sets a value or an array of values.\n * @param array A typed or untyped array of values to set.\n * @param offset The index in the current array at which the values are to be written.\n */\n set(array: ArrayLike, offset?: number): void;\n\n /**\n * Returns a section of an array.\n * @param start The beginning of the specified portion of the array.\n * @param end The end of the specified portion of the array.\n */\n slice(start?: number, end?: number): Float64Array;\n\n /**\n * Determines whether the specified callback function returns true for any element of an array.\n * @param callbackfn A function that accepts up to three arguments. The some method calls the\n * callbackfn function for each element in array1 until the callbackfn returns true, or until\n * the end of the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function.\n * If thisArg is omitted, undefined is used as the this value.\n */\n some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean;\n\n /**\n * Sorts an array.\n * @param compareFn The name of the function used to determine the order of the elements. If\n * omitted, the elements are sorted in ascending, ASCII character order.\n */\n sort(compareFn?: (a: number, b: number) => number): this;\n\n /**\n * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements\n * at begin, inclusive, up to end, exclusive.\n * @param begin The index of the beginning of the array.\n * @param end The index of the end of the array.\n */\n subarray(begin: number, end?: number): Float64Array;\n\n /**\n * Converts a number to a string by using the current locale.\n */\n toLocaleString(): string;\n\n /**\n * Returns a string representation of an array.\n */\n toString(): string;\n\n [index: number]: number;\n}\n\ninterface Float64ArrayConstructor {\n readonly prototype: Float64Array;\n new (length: number): Float64Array;\n new (array: ArrayLike): Float64Array;\n new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array;\n\n /**\n * The size in bytes of each element in the array.\n */\n readonly BYTES_PER_ELEMENT: number;\n\n /**\n * Returns a new array from a set of elements.\n * @param items A set of elements to include in the new array object.\n */\n of(...items: number[]): Float64Array;\n\n /**\n * Creates an array from an array-like or iterable object.\n * @param arrayLike An array-like or iterable object to convert to an array.\n * @param mapfn A mapping function to call on every element of the array.\n * @param thisArg Value of 'this' used to invoke the mapfn.\n */\n from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array;\n}\ndeclare const Float64Array: Float64ArrayConstructor;\n\n/////////////////////////////\n/// ECMAScript Internationalization API\n/////////////////////////////\n\ndeclare module Intl {\n interface CollatorOptions {\n usage?: string;\n localeMatcher?: string;\n numeric?: boolean;\n caseFirst?: string;\n sensitivity?: string;\n ignorePunctuation?: boolean;\n }\n\n interface ResolvedCollatorOptions {\n locale: string;\n usage: string;\n sensitivity: string;\n ignorePunctuation: boolean;\n collation: string;\n caseFirst: string;\n numeric: boolean;\n }\n\n interface Collator {\n compare(x: string, y: string): number;\n resolvedOptions(): ResolvedCollatorOptions;\n }\n var Collator: {\n new (locales?: string | string[], options?: CollatorOptions): Collator;\n (locales?: string | string[], options?: CollatorOptions): Collator;\n supportedLocalesOf(locales: string | string[], options?: CollatorOptions): string[];\n }\n\n interface NumberFormatOptions {\n localeMatcher?: string;\n style?: string;\n currency?: string;\n currencyDisplay?: string;\n useGrouping?: boolean;\n minimumIntegerDigits?: number;\n minimumFractionDigits?: number;\n maximumFractionDigits?: number;\n minimumSignificantDigits?: number;\n maximumSignificantDigits?: number;\n }\n\n interface ResolvedNumberFormatOptions {\n locale: string;\n numberingSystem: string;\n style: string;\n currency?: string;\n currencyDisplay?: string;\n minimumIntegerDigits: number;\n minimumFractionDigits: number;\n maximumFractionDigits: number;\n minimumSignificantDigits?: number;\n maximumSignificantDigits?: number;\n useGrouping: boolean;\n }\n\n interface NumberFormat {\n format(value: number): string;\n resolvedOptions(): ResolvedNumberFormatOptions;\n }\n var NumberFormat: {\n new (locales?: string | string[], options?: NumberFormatOptions): NumberFormat;\n (locales?: string | string[], options?: NumberFormatOptions): NumberFormat;\n supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[];\n }\n\n interface DateTimeFormatOptions {\n localeMatcher?: string;\n weekday?: string;\n era?: string;\n year?: string;\n month?: string;\n day?: string;\n hour?: string;\n minute?: string;\n second?: string;\n timeZoneName?: string;\n formatMatcher?: string;\n hour12?: boolean;\n timeZone?: string;\n }\n\n interface ResolvedDateTimeFormatOptions {\n locale: string;\n calendar: string;\n numberingSystem: string;\n timeZone: string;\n hour12?: boolean;\n weekday?: string;\n era?: string;\n year?: string;\n month?: string;\n day?: string;\n hour?: string;\n minute?: string;\n second?: string;\n timeZoneName?: string;\n }\n\n interface DateTimeFormat {\n format(date?: Date | number): string;\n resolvedOptions(): ResolvedDateTimeFormatOptions;\n }\n var DateTimeFormat: {\n new (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat;\n (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat;\n supportedLocalesOf(locales: string | string[], options?: DateTimeFormatOptions): string[];\n }\n}\n\ninterface String {\n /**\n * Determines whether two strings are equivalent in the current or specified locale.\n * @param that String to compare to target string\n * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.\n * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details.\n */\n localeCompare(that: string, locales?: string | string[], options?: Intl.CollatorOptions): number;\n}\n\ninterface Number {\n /**\n * Converts a number to a string by using the current or specified locale.\n * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.\n * @param options An object that contains one or more properties that specify comparison options.\n */\n toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string;\n}\n\ninterface Date {\n /**\n * Converts a date and time to a string by using the current or specified locale.\n * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.\n * @param options An object that contains one or more properties that specify comparison options.\n */\n toLocaleString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string;\n /**\n * Converts a date to a string by using the current or specified locale.\n * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.\n * @param options An object that contains one or more properties that specify comparison options.\n */\n toLocaleDateString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string;\n\n /**\n * Converts a time to a string by using the current or specified locale.\n * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.\n * @param options An object that contains one or more properties that specify comparison options.\n */\n toLocaleTimeString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string;\n}\n\n\n\n/////////////////////////////\n/// IE DOM APIs\n/////////////////////////////\n\ninterface Algorithm {\n name: string;\n}\n\ninterface AriaRequestEventInit extends EventInit {\n attributeName?: string;\n attributeValue?: string;\n}\n\ninterface CommandEventInit extends EventInit {\n commandName?: string;\n detail?: string;\n}\n\ninterface CompositionEventInit extends UIEventInit {\n data?: string;\n}\n\ninterface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation {\n arrayOfDomainStrings?: string[];\n}\n\ninterface ConstrainBooleanParameters {\n exact?: boolean;\n ideal?: boolean;\n}\n\ninterface ConstrainDOMStringParameters {\n exact?: string | string[];\n ideal?: string | string[];\n}\n\ninterface ConstrainDoubleRange extends DoubleRange {\n exact?: number;\n ideal?: number;\n}\n\ninterface ConstrainLongRange extends LongRange {\n exact?: number;\n ideal?: number;\n}\n\ninterface ConstrainVideoFacingModeParameters {\n exact?: string | string[];\n ideal?: string | string[];\n}\n\ninterface CustomEventInit extends EventInit {\n detail?: any;\n}\n\ninterface DeviceAccelerationDict {\n x?: number;\n y?: number;\n z?: number;\n}\n\ninterface DeviceLightEventInit extends EventInit {\n value?: number;\n}\n\ninterface DeviceRotationRateDict {\n alpha?: number;\n beta?: number;\n gamma?: number;\n}\n\ninterface DoubleRange {\n max?: number;\n min?: number;\n}\n\ninterface EventInit {\n scoped?: boolean;\n bubbles?: boolean;\n cancelable?: boolean;\n}\n\ninterface EventModifierInit extends UIEventInit {\n ctrlKey?: boolean;\n shiftKey?: boolean;\n altKey?: boolean;\n metaKey?: boolean;\n modifierAltGraph?: boolean;\n modifierCapsLock?: boolean;\n modifierFn?: boolean;\n modifierFnLock?: boolean;\n modifierHyper?: boolean;\n modifierNumLock?: boolean;\n modifierOS?: boolean;\n modifierScrollLock?: boolean;\n modifierSuper?: boolean;\n modifierSymbol?: boolean;\n modifierSymbolLock?: boolean;\n}\n\ninterface ExceptionInformation {\n domain?: string;\n}\n\ninterface FocusEventInit extends UIEventInit {\n relatedTarget?: EventTarget;\n}\n\ninterface HashChangeEventInit extends EventInit {\n newURL?: string;\n oldURL?: string;\n}\n\ninterface IDBIndexParameters {\n multiEntry?: boolean;\n unique?: boolean;\n}\n\ninterface IDBObjectStoreParameters {\n autoIncrement?: boolean;\n keyPath?: IDBKeyPath;\n}\n\ninterface KeyAlgorithm {\n name?: string;\n}\n\ninterface KeyboardEventInit extends EventModifierInit {\n code?: string;\n key?: string;\n location?: number;\n repeat?: boolean;\n}\n\ninterface LongRange {\n max?: number;\n min?: number;\n}\n\ninterface MSAccountInfo {\n rpDisplayName?: string;\n userDisplayName?: string;\n accountName?: string;\n userId?: string;\n accountImageUri?: string;\n}\n\ninterface MSAudioLocalClientEvent extends MSLocalClientEventBase {\n networkSendQualityEventRatio?: number;\n networkDelayEventRatio?: number;\n cpuInsufficientEventRatio?: number;\n deviceHalfDuplexAECEventRatio?: number;\n deviceRenderNotFunctioningEventRatio?: number;\n deviceCaptureNotFunctioningEventRatio?: number;\n deviceGlitchesEventRatio?: number;\n deviceLowSNREventRatio?: number;\n deviceLowSpeechLevelEventRatio?: number;\n deviceClippingEventRatio?: number;\n deviceEchoEventRatio?: number;\n deviceNearEndToEchoRatioEventRatio?: number;\n deviceRenderZeroVolumeEventRatio?: number;\n deviceRenderMuteEventRatio?: number;\n deviceMultipleEndpointsEventCount?: number;\n deviceHowlingEventCount?: number;\n}\n\ninterface MSAudioRecvPayload extends MSPayloadBase {\n samplingRate?: number;\n signal?: MSAudioRecvSignal;\n packetReorderRatio?: number;\n packetReorderDepthAvg?: number;\n packetReorderDepthMax?: number;\n burstLossLength1?: number;\n burstLossLength2?: number;\n burstLossLength3?: number;\n burstLossLength4?: number;\n burstLossLength5?: number;\n burstLossLength6?: number;\n burstLossLength7?: number;\n burstLossLength8OrHigher?: number;\n fecRecvDistance1?: number;\n fecRecvDistance2?: number;\n fecRecvDistance3?: number;\n ratioConcealedSamplesAvg?: number;\n ratioStretchedSamplesAvg?: number;\n ratioCompressedSamplesAvg?: number;\n}\n\ninterface MSAudioRecvSignal {\n initialSignalLevelRMS?: number;\n recvSignalLevelCh1?: number;\n recvNoiseLevelCh1?: number;\n renderSignalLevel?: number;\n renderNoiseLevel?: number;\n renderLoopbackSignalLevel?: number;\n}\n\ninterface MSAudioSendPayload extends MSPayloadBase {\n samplingRate?: number;\n signal?: MSAudioSendSignal;\n audioFECUsed?: boolean;\n sendMutePercent?: number;\n}\n\ninterface MSAudioSendSignal {\n noiseLevel?: number;\n sendSignalLevelCh1?: number;\n sendNoiseLevelCh1?: number;\n}\n\ninterface MSConnectivity {\n iceType?: string;\n iceWarningFlags?: MSIceWarningFlags;\n relayAddress?: MSRelayAddress;\n}\n\ninterface MSCredentialFilter {\n accept?: MSCredentialSpec[];\n}\n\ninterface MSCredentialParameters {\n type?: string;\n}\n\ninterface MSCredentialSpec {\n type?: string;\n id?: string;\n}\n\ninterface MSDelay {\n roundTrip?: number;\n roundTripMax?: number;\n}\n\ninterface MSDescription extends RTCStats {\n connectivity?: MSConnectivity;\n transport?: string;\n networkconnectivity?: MSNetworkConnectivityInfo;\n localAddr?: MSIPAddressInfo;\n remoteAddr?: MSIPAddressInfo;\n deviceDevName?: string;\n reflexiveLocalIPAddr?: MSIPAddressInfo;\n}\n\ninterface MSFIDOCredentialParameters extends MSCredentialParameters {\n algorithm?: string | Algorithm;\n authenticators?: AAGUID[];\n}\n\ninterface MSIPAddressInfo {\n ipAddr?: string;\n port?: number;\n manufacturerMacAddrMask?: string;\n}\n\ninterface MSIceWarningFlags {\n turnTcpTimedOut?: boolean;\n turnUdpAllocateFailed?: boolean;\n turnUdpSendFailed?: boolean;\n turnTcpAllocateFailed?: boolean;\n turnTcpSendFailed?: boolean;\n udpLocalConnectivityFailed?: boolean;\n udpNatConnectivityFailed?: boolean;\n udpRelayConnectivityFailed?: boolean;\n tcpNatConnectivityFailed?: boolean;\n tcpRelayConnectivityFailed?: boolean;\n connCheckMessageIntegrityFailed?: boolean;\n allocationMessageIntegrityFailed?: boolean;\n connCheckOtherError?: boolean;\n turnAuthUnknownUsernameError?: boolean;\n noRelayServersConfigured?: boolean;\n multipleRelayServersAttempted?: boolean;\n portRangeExhausted?: boolean;\n alternateServerReceived?: boolean;\n pseudoTLSFailure?: boolean;\n turnTurnTcpConnectivityFailed?: boolean;\n useCandidateChecksFailed?: boolean;\n fipsAllocationFailure?: boolean;\n}\n\ninterface MSJitter {\n interArrival?: number;\n interArrivalMax?: number;\n interArrivalSD?: number;\n}\n\ninterface MSLocalClientEventBase extends RTCStats {\n networkReceiveQualityEventRatio?: number;\n networkBandwidthLowEventRatio?: number;\n}\n\ninterface MSNetwork extends RTCStats {\n jitter?: MSJitter;\n delay?: MSDelay;\n packetLoss?: MSPacketLoss;\n utilization?: MSUtilization;\n}\n\ninterface MSNetworkConnectivityInfo {\n vpn?: boolean;\n linkspeed?: number;\n networkConnectionDetails?: string;\n}\n\ninterface MSNetworkInterfaceType {\n interfaceTypeEthernet?: boolean;\n interfaceTypeWireless?: boolean;\n interfaceTypePPP?: boolean;\n interfaceTypeTunnel?: boolean;\n interfaceTypeWWAN?: boolean;\n}\n\ninterface MSOutboundNetwork extends MSNetwork {\n appliedBandwidthLimit?: number;\n}\n\ninterface MSPacketLoss {\n lossRate?: number;\n lossRateMax?: number;\n}\n\ninterface MSPayloadBase extends RTCStats {\n payloadDescription?: string;\n}\n\ninterface MSRelayAddress {\n relayAddress?: string;\n port?: number;\n}\n\ninterface MSSignatureParameters {\n userPrompt?: string;\n}\n\ninterface MSTransportDiagnosticsStats extends RTCStats {\n baseAddress?: string;\n localAddress?: string;\n localSite?: string;\n networkName?: string;\n remoteAddress?: string;\n remoteSite?: string;\n localMR?: string;\n remoteMR?: string;\n iceWarningFlags?: MSIceWarningFlags;\n portRangeMin?: number;\n portRangeMax?: number;\n localMRTCPPort?: number;\n remoteMRTCPPort?: number;\n stunVer?: number;\n numConsentReqSent?: number;\n numConsentReqReceived?: number;\n numConsentRespSent?: number;\n numConsentRespReceived?: number;\n interfaces?: MSNetworkInterfaceType;\n baseInterface?: MSNetworkInterfaceType;\n protocol?: string;\n localInterface?: MSNetworkInterfaceType;\n localAddrType?: string;\n remoteAddrType?: string;\n iceRole?: string;\n rtpRtcpMux?: boolean;\n allocationTimeInMs?: number;\n msRtcEngineVersion?: string;\n}\n\ninterface MSUtilization {\n packets?: number;\n bandwidthEstimation?: number;\n bandwidthEstimationMin?: number;\n bandwidthEstimationMax?: number;\n bandwidthEstimationStdDev?: number;\n bandwidthEstimationAvg?: number;\n}\n\ninterface MSVideoPayload extends MSPayloadBase {\n resoluton?: string;\n videoBitRateAvg?: number;\n videoBitRateMax?: number;\n videoFrameRateAvg?: number;\n videoPacketLossRate?: number;\n durationSeconds?: number;\n}\n\ninterface MSVideoRecvPayload extends MSVideoPayload {\n videoFrameLossRate?: number;\n recvCodecType?: string;\n recvResolutionWidth?: number;\n recvResolutionHeight?: number;\n videoResolutions?: MSVideoResolutionDistribution;\n recvFrameRateAverage?: number;\n recvBitRateMaximum?: number;\n recvBitRateAverage?: number;\n recvVideoStreamsMax?: number;\n recvVideoStreamsMin?: number;\n recvVideoStreamsMode?: number;\n videoPostFECPLR?: number;\n lowBitRateCallPercent?: number;\n lowFrameRateCallPercent?: number;\n reorderBufferTotalPackets?: number;\n recvReorderBufferReorderedPackets?: number;\n recvReorderBufferPacketsDroppedDueToBufferExhaustion?: number;\n recvReorderBufferMaxSuccessfullyOrderedExtent?: number;\n recvReorderBufferMaxSuccessfullyOrderedLateTime?: number;\n recvReorderBufferPacketsDroppedDueToTimeout?: number;\n recvFpsHarmonicAverage?: number;\n recvNumResSwitches?: number;\n}\n\ninterface MSVideoResolutionDistribution {\n cifQuality?: number;\n vgaQuality?: number;\n h720Quality?: number;\n h1080Quality?: number;\n h1440Quality?: number;\n h2160Quality?: number;\n}\n\ninterface MSVideoSendPayload extends MSVideoPayload {\n sendFrameRateAverage?: number;\n sendBitRateMaximum?: number;\n sendBitRateAverage?: number;\n sendVideoStreamsMax?: number;\n sendResolutionWidth?: number;\n sendResolutionHeight?: number;\n}\n\ninterface MediaEncryptedEventInit extends EventInit {\n initDataType?: string;\n initData?: ArrayBuffer;\n}\n\ninterface MediaKeyMessageEventInit extends EventInit {\n messageType?: string;\n message?: ArrayBuffer;\n}\n\ninterface MediaKeySystemConfiguration {\n initDataTypes?: string[];\n audioCapabilities?: MediaKeySystemMediaCapability[];\n videoCapabilities?: MediaKeySystemMediaCapability[];\n distinctiveIdentifier?: string;\n persistentState?: string;\n}\n\ninterface MediaKeySystemMediaCapability {\n contentType?: string;\n robustness?: string;\n}\n\ninterface MediaStreamConstraints {\n video?: boolean | MediaTrackConstraints;\n audio?: boolean | MediaTrackConstraints;\n}\n\ninterface MediaStreamErrorEventInit extends EventInit {\n error?: MediaStreamError;\n}\n\ninterface MediaStreamTrackEventInit extends EventInit {\n track?: MediaStreamTrack;\n}\n\ninterface MediaTrackCapabilities {\n width?: number | LongRange;\n height?: number | LongRange;\n aspectRatio?: number | DoubleRange;\n frameRate?: number | DoubleRange;\n facingMode?: string;\n volume?: number | DoubleRange;\n sampleRate?: number | LongRange;\n sampleSize?: number | LongRange;\n echoCancellation?: boolean[];\n deviceId?: string;\n groupId?: string;\n}\n\ninterface MediaTrackConstraintSet {\n width?: number | ConstrainLongRange;\n height?: number | ConstrainLongRange;\n aspectRatio?: number | ConstrainDoubleRange;\n frameRate?: number | ConstrainDoubleRange;\n facingMode?: string | string[] | ConstrainDOMStringParameters;\n volume?: number | ConstrainDoubleRange;\n sampleRate?: number | ConstrainLongRange;\n sampleSize?: number | ConstrainLongRange;\n echoCancelation?: boolean | ConstrainBooleanParameters;\n deviceId?: string | string[] | ConstrainDOMStringParameters;\n groupId?: string | string[] | ConstrainDOMStringParameters;\n}\n\ninterface MediaTrackConstraints extends MediaTrackConstraintSet {\n advanced?: MediaTrackConstraintSet[];\n}\n\ninterface MediaTrackSettings {\n width?: number;\n height?: number;\n aspectRatio?: number;\n frameRate?: number;\n facingMode?: string;\n volume?: number;\n sampleRate?: number;\n sampleSize?: number;\n echoCancellation?: boolean;\n deviceId?: string;\n groupId?: string;\n}\n\ninterface MediaTrackSupportedConstraints {\n width?: boolean;\n height?: boolean;\n aspectRatio?: boolean;\n frameRate?: boolean;\n facingMode?: boolean;\n volume?: boolean;\n sampleRate?: boolean;\n sampleSize?: boolean;\n echoCancellation?: boolean;\n deviceId?: boolean;\n groupId?: boolean;\n}\n\ninterface MouseEventInit extends EventModifierInit {\n screenX?: number;\n screenY?: number;\n clientX?: number;\n clientY?: number;\n button?: number;\n buttons?: number;\n relatedTarget?: EventTarget;\n}\n\ninterface MsZoomToOptions {\n contentX?: number;\n contentY?: number;\n viewportX?: string;\n viewportY?: string;\n scaleFactor?: number;\n animate?: string;\n}\n\ninterface MutationObserverInit {\n childList?: boolean;\n attributes?: boolean;\n characterData?: boolean;\n subtree?: boolean;\n attributeOldValue?: boolean;\n characterDataOldValue?: boolean;\n attributeFilter?: string[];\n}\n\ninterface ObjectURLOptions {\n oneTimeOnly?: boolean;\n}\n\ninterface PeriodicWaveConstraints {\n disableNormalization?: boolean;\n}\n\ninterface PointerEventInit extends MouseEventInit {\n pointerId?: number;\n width?: number;\n height?: number;\n pressure?: number;\n tiltX?: number;\n tiltY?: number;\n pointerType?: string;\n isPrimary?: boolean;\n}\n\ninterface PositionOptions {\n enableHighAccuracy?: boolean;\n timeout?: number;\n maximumAge?: number;\n}\n\ninterface RTCDTMFToneChangeEventInit extends EventInit {\n tone?: string;\n}\n\ninterface RTCDtlsFingerprint {\n algorithm?: string;\n value?: string;\n}\n\ninterface RTCDtlsParameters {\n role?: string;\n fingerprints?: RTCDtlsFingerprint[];\n}\n\ninterface RTCIceCandidate {\n foundation?: string;\n priority?: number;\n ip?: string;\n protocol?: string;\n port?: number;\n type?: string;\n tcpType?: string;\n relatedAddress?: string;\n relatedPort?: number;\n}\n\ninterface RTCIceCandidateAttributes extends RTCStats {\n ipAddress?: string;\n portNumber?: number;\n transport?: string;\n candidateType?: string;\n priority?: number;\n addressSourceUrl?: string;\n}\n\ninterface RTCIceCandidateComplete {\n}\n\ninterface RTCIceCandidatePair {\n local?: RTCIceCandidate;\n remote?: RTCIceCandidate;\n}\n\ninterface RTCIceCandidatePairStats extends RTCStats {\n transportId?: string;\n localCandidateId?: string;\n remoteCandidateId?: string;\n state?: string;\n priority?: number;\n nominated?: boolean;\n writable?: boolean;\n readable?: boolean;\n bytesSent?: number;\n bytesReceived?: number;\n roundTripTime?: number;\n availableOutgoingBitrate?: number;\n availableIncomingBitrate?: number;\n}\n\ninterface RTCIceGatherOptions {\n gatherPolicy?: string;\n iceservers?: RTCIceServer[];\n}\n\ninterface RTCIceParameters {\n usernameFragment?: string;\n password?: string;\n}\n\ninterface RTCIceServer {\n urls?: any;\n username?: string;\n credential?: string;\n}\n\ninterface RTCInboundRTPStreamStats extends RTCRTPStreamStats {\n packetsReceived?: number;\n bytesReceived?: number;\n packetsLost?: number;\n jitter?: number;\n fractionLost?: number;\n}\n\ninterface RTCMediaStreamTrackStats extends RTCStats {\n trackIdentifier?: string;\n remoteSource?: boolean;\n ssrcIds?: string[];\n frameWidth?: number;\n frameHeight?: number;\n framesPerSecond?: number;\n framesSent?: number;\n framesReceived?: number;\n framesDecoded?: number;\n framesDropped?: number;\n framesCorrupted?: number;\n audioLevel?: number;\n echoReturnLoss?: number;\n echoReturnLossEnhancement?: number;\n}\n\ninterface RTCOutboundRTPStreamStats extends RTCRTPStreamStats {\n packetsSent?: number;\n bytesSent?: number;\n targetBitrate?: number;\n roundTripTime?: number;\n}\n\ninterface RTCRTPStreamStats extends RTCStats {\n ssrc?: string;\n associateStatsId?: string;\n isRemote?: boolean;\n mediaTrackId?: string;\n transportId?: string;\n codecId?: string;\n firCount?: number;\n pliCount?: number;\n nackCount?: number;\n sliCount?: number;\n}\n\ninterface RTCRtcpFeedback {\n type?: string;\n parameter?: string;\n}\n\ninterface RTCRtcpParameters {\n ssrc?: number;\n cname?: string;\n reducedSize?: boolean;\n mux?: boolean;\n}\n\ninterface RTCRtpCapabilities {\n codecs?: RTCRtpCodecCapability[];\n headerExtensions?: RTCRtpHeaderExtension[];\n fecMechanisms?: string[];\n}\n\ninterface RTCRtpCodecCapability {\n name?: string;\n kind?: string;\n clockRate?: number;\n preferredPayloadType?: number;\n maxptime?: number;\n numChannels?: number;\n rtcpFeedback?: RTCRtcpFeedback[];\n parameters?: any;\n options?: any;\n maxTemporalLayers?: number;\n maxSpatialLayers?: number;\n svcMultiStreamSupport?: boolean;\n}\n\ninterface RTCRtpCodecParameters {\n name?: string;\n payloadType?: any;\n clockRate?: number;\n maxptime?: number;\n numChannels?: number;\n rtcpFeedback?: RTCRtcpFeedback[];\n parameters?: any;\n}\n\ninterface RTCRtpContributingSource {\n timestamp?: number;\n csrc?: number;\n audioLevel?: number;\n}\n\ninterface RTCRtpEncodingParameters {\n ssrc?: number;\n codecPayloadType?: number;\n fec?: RTCRtpFecParameters;\n rtx?: RTCRtpRtxParameters;\n priority?: number;\n maxBitrate?: number;\n minQuality?: number;\n framerateBias?: number;\n resolutionScale?: number;\n framerateScale?: number;\n active?: boolean;\n encodingId?: string;\n dependencyEncodingIds?: string[];\n ssrcRange?: RTCSsrcRange;\n}\n\ninterface RTCRtpFecParameters {\n ssrc?: number;\n mechanism?: string;\n}\n\ninterface RTCRtpHeaderExtension {\n kind?: string;\n uri?: string;\n preferredId?: number;\n preferredEncrypt?: boolean;\n}\n\ninterface RTCRtpHeaderExtensionParameters {\n uri?: string;\n id?: number;\n encrypt?: boolean;\n}\n\ninterface RTCRtpParameters {\n muxId?: string;\n codecs?: RTCRtpCodecParameters[];\n headerExtensions?: RTCRtpHeaderExtensionParameters[];\n encodings?: RTCRtpEncodingParameters[];\n rtcp?: RTCRtcpParameters;\n}\n\ninterface RTCRtpRtxParameters {\n ssrc?: number;\n}\n\ninterface RTCRtpUnhandled {\n ssrc?: number;\n payloadType?: number;\n muxId?: string;\n}\n\ninterface RTCSrtpKeyParam {\n keyMethod?: string;\n keySalt?: string;\n lifetime?: string;\n mkiValue?: number;\n mkiLength?: number;\n}\n\ninterface RTCSrtpSdesParameters {\n tag?: number;\n cryptoSuite?: string;\n keyParams?: RTCSrtpKeyParam[];\n sessionParams?: string[];\n}\n\ninterface RTCSsrcRange {\n min?: number;\n max?: number;\n}\n\ninterface RTCStats {\n timestamp?: number;\n type?: string;\n id?: string;\n msType?: string;\n}\n\ninterface RTCStatsReport {\n}\n\ninterface RTCTransportStats extends RTCStats {\n bytesSent?: number;\n bytesReceived?: number;\n rtcpTransportStatsId?: string;\n activeConnection?: boolean;\n selectedCandidatePairId?: string;\n localCertificateId?: string;\n remoteCertificateId?: string;\n}\n\ninterface StoreExceptionsInformation extends ExceptionInformation {\n siteName?: string;\n explanationString?: string;\n detailURI?: string;\n}\n\ninterface StoreSiteSpecificExceptionsInformation extends StoreExceptionsInformation {\n arrayOfDomainStrings?: string[];\n}\n\ninterface UIEventInit extends EventInit {\n view?: Window;\n detail?: number;\n}\n\ninterface WebGLContextAttributes {\n failIfMajorPerformanceCaveat?: boolean;\n alpha?: boolean;\n depth?: boolean;\n stencil?: boolean;\n antialias?: boolean;\n premultipliedAlpha?: boolean;\n preserveDrawingBuffer?: boolean;\n}\n\ninterface WebGLContextEventInit extends EventInit {\n statusMessage?: string;\n}\n\ninterface WheelEventInit extends MouseEventInit {\n deltaX?: number;\n deltaY?: number;\n deltaZ?: number;\n deltaMode?: number;\n}\n\ninterface EventListener {\n (evt: Event): void;\n}\n\ninterface ANGLE_instanced_arrays {\n drawArraysInstancedANGLE(mode: number, first: number, count: number, primcount: number): void;\n drawElementsInstancedANGLE(mode: number, count: number, type: number, offset: number, primcount: number): void;\n vertexAttribDivisorANGLE(index: number, divisor: number): void;\n readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number;\n}\n\ndeclare var ANGLE_instanced_arrays: {\n prototype: ANGLE_instanced_arrays;\n new(): ANGLE_instanced_arrays;\n readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number;\n}\n\ninterface AnalyserNode extends AudioNode {\n fftSize: number;\n readonly frequencyBinCount: number;\n maxDecibels: number;\n minDecibels: number;\n smoothingTimeConstant: number;\n getByteFrequencyData(array: Uint8Array): void;\n getByteTimeDomainData(array: Uint8Array): void;\n getFloatFrequencyData(array: Float32Array): void;\n getFloatTimeDomainData(array: Float32Array): void;\n}\n\ndeclare var AnalyserNode: {\n prototype: AnalyserNode;\n new(): AnalyserNode;\n}\n\ninterface AnimationEvent extends Event {\n readonly animationName: string;\n readonly elapsedTime: number;\n initAnimationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, animationNameArg: string, elapsedTimeArg: number): void;\n}\n\ndeclare var AnimationEvent: {\n prototype: AnimationEvent;\n new(): AnimationEvent;\n}\n\ninterface ApplicationCacheEventMap {\n \"cached\": Event;\n \"checking\": Event;\n \"downloading\": Event;\n \"error\": ErrorEvent;\n \"noupdate\": Event;\n \"obsolete\": Event;\n \"progress\": ProgressEvent;\n \"updateready\": Event;\n}\n\ninterface ApplicationCache extends EventTarget {\n oncached: (this: ApplicationCache, ev: Event) => any;\n onchecking: (this: ApplicationCache, ev: Event) => any;\n ondownloading: (this: ApplicationCache, ev: Event) => any;\n onerror: (this: ApplicationCache, ev: ErrorEvent) => any;\n onnoupdate: (this: ApplicationCache, ev: Event) => any;\n onobsolete: (this: ApplicationCache, ev: Event) => any;\n onprogress: (this: ApplicationCache, ev: ProgressEvent) => any;\n onupdateready: (this: ApplicationCache, ev: Event) => any;\n readonly status: number;\n abort(): void;\n swapCache(): void;\n update(): void;\n readonly CHECKING: number;\n readonly DOWNLOADING: number;\n readonly IDLE: number;\n readonly OBSOLETE: number;\n readonly UNCACHED: number;\n readonly UPDATEREADY: number;\n addEventListener(type: K, listener: (this: ApplicationCache, ev: ApplicationCacheEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var ApplicationCache: {\n prototype: ApplicationCache;\n new(): ApplicationCache;\n readonly CHECKING: number;\n readonly DOWNLOADING: number;\n readonly IDLE: number;\n readonly OBSOLETE: number;\n readonly UNCACHED: number;\n readonly UPDATEREADY: number;\n}\n\ninterface AriaRequestEvent extends Event {\n readonly attributeName: string;\n attributeValue: string | null;\n}\n\ndeclare var AriaRequestEvent: {\n prototype: AriaRequestEvent;\n new(type: string, eventInitDict?: AriaRequestEventInit): AriaRequestEvent;\n}\n\ninterface Attr extends Node {\n readonly name: string;\n readonly ownerElement: Element;\n readonly prefix: string | null;\n readonly specified: boolean;\n value: string;\n}\n\ndeclare var Attr: {\n prototype: Attr;\n new(): Attr;\n}\n\ninterface AudioBuffer {\n readonly duration: number;\n readonly length: number;\n readonly numberOfChannels: number;\n readonly sampleRate: number;\n copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void;\n copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void;\n getChannelData(channel: number): Float32Array;\n}\n\ndeclare var AudioBuffer: {\n prototype: AudioBuffer;\n new(): AudioBuffer;\n}\n\ninterface AudioBufferSourceNodeEventMap {\n \"ended\": MediaStreamErrorEvent;\n}\n\ninterface AudioBufferSourceNode extends AudioNode {\n buffer: AudioBuffer | null;\n readonly detune: AudioParam;\n loop: boolean;\n loopEnd: number;\n loopStart: number;\n onended: (this: AudioBufferSourceNode, ev: MediaStreamErrorEvent) => any;\n readonly playbackRate: AudioParam;\n start(when?: number, offset?: number, duration?: number): void;\n stop(when?: number): void;\n addEventListener(type: K, listener: (this: AudioBufferSourceNode, ev: AudioBufferSourceNodeEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var AudioBufferSourceNode: {\n prototype: AudioBufferSourceNode;\n new(): AudioBufferSourceNode;\n}\n\ninterface AudioContext extends EventTarget {\n readonly currentTime: number;\n readonly destination: AudioDestinationNode;\n readonly listener: AudioListener;\n readonly sampleRate: number;\n state: string;\n createAnalyser(): AnalyserNode;\n createBiquadFilter(): BiquadFilterNode;\n createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer;\n createBufferSource(): AudioBufferSourceNode;\n createChannelMerger(numberOfInputs?: number): ChannelMergerNode;\n createChannelSplitter(numberOfOutputs?: number): ChannelSplitterNode;\n createConvolver(): ConvolverNode;\n createDelay(maxDelayTime?: number): DelayNode;\n createDynamicsCompressor(): DynamicsCompressorNode;\n createGain(): GainNode;\n createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode;\n createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode;\n createOscillator(): OscillatorNode;\n createPanner(): PannerNode;\n createPeriodicWave(real: Float32Array, imag: Float32Array, constraints?: PeriodicWaveConstraints): PeriodicWave;\n createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode;\n createStereoPanner(): StereoPannerNode;\n createWaveShaper(): WaveShaperNode;\n decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): PromiseLike;\n}\n\ndeclare var AudioContext: {\n prototype: AudioContext;\n new(): AudioContext;\n}\n\ninterface AudioDestinationNode extends AudioNode {\n readonly maxChannelCount: number;\n}\n\ndeclare var AudioDestinationNode: {\n prototype: AudioDestinationNode;\n new(): AudioDestinationNode;\n}\n\ninterface AudioListener {\n dopplerFactor: number;\n speedOfSound: number;\n setOrientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): void;\n setPosition(x: number, y: number, z: number): void;\n setVelocity(x: number, y: number, z: number): void;\n}\n\ndeclare var AudioListener: {\n prototype: AudioListener;\n new(): AudioListener;\n}\n\ninterface AudioNode extends EventTarget {\n channelCount: number;\n channelCountMode: string;\n channelInterpretation: string;\n readonly context: AudioContext;\n readonly numberOfInputs: number;\n readonly numberOfOutputs: number;\n connect(destination: AudioNode, output?: number, input?: number): void;\n disconnect(output?: number): void;\n disconnect(destination: AudioNode, output?: number, input?: number): void;\n disconnect(destination: AudioParam, output?: number): void;\n}\n\ndeclare var AudioNode: {\n prototype: AudioNode;\n new(): AudioNode;\n}\n\ninterface AudioParam {\n readonly defaultValue: number;\n value: number;\n cancelScheduledValues(startTime: number): void;\n exponentialRampToValueAtTime(value: number, endTime: number): void;\n linearRampToValueAtTime(value: number, endTime: number): void;\n setTargetAtTime(target: number, startTime: number, timeConstant: number): void;\n setValueAtTime(value: number, startTime: number): void;\n setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void;\n}\n\ndeclare var AudioParam: {\n prototype: AudioParam;\n new(): AudioParam;\n}\n\ninterface AudioProcessingEvent extends Event {\n readonly inputBuffer: AudioBuffer;\n readonly outputBuffer: AudioBuffer;\n readonly playbackTime: number;\n}\n\ndeclare var AudioProcessingEvent: {\n prototype: AudioProcessingEvent;\n new(): AudioProcessingEvent;\n}\n\ninterface AudioTrack {\n enabled: boolean;\n readonly id: string;\n kind: string;\n readonly label: string;\n language: string;\n readonly sourceBuffer: SourceBuffer;\n}\n\ndeclare var AudioTrack: {\n prototype: AudioTrack;\n new(): AudioTrack;\n}\n\ninterface AudioTrackListEventMap {\n \"addtrack\": TrackEvent;\n \"change\": Event;\n \"removetrack\": TrackEvent;\n}\n\ninterface AudioTrackList extends EventTarget {\n readonly length: number;\n onaddtrack: (this: AudioTrackList, ev: TrackEvent) => any;\n onchange: (this: AudioTrackList, ev: Event) => any;\n onremovetrack: (this: AudioTrackList, ev: TrackEvent) => any;\n getTrackById(id: string): AudioTrack | null;\n item(index: number): AudioTrack;\n addEventListener(type: K, listener: (this: AudioTrackList, ev: AudioTrackListEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n [index: number]: AudioTrack;\n}\n\ndeclare var AudioTrackList: {\n prototype: AudioTrackList;\n new(): AudioTrackList;\n}\n\ninterface BarProp {\n readonly visible: boolean;\n}\n\ndeclare var BarProp: {\n prototype: BarProp;\n new(): BarProp;\n}\n\ninterface BeforeUnloadEvent extends Event {\n returnValue: any;\n}\n\ndeclare var BeforeUnloadEvent: {\n prototype: BeforeUnloadEvent;\n new(): BeforeUnloadEvent;\n}\n\ninterface BiquadFilterNode extends AudioNode {\n readonly Q: AudioParam;\n readonly detune: AudioParam;\n readonly frequency: AudioParam;\n readonly gain: AudioParam;\n type: string;\n getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void;\n}\n\ndeclare var BiquadFilterNode: {\n prototype: BiquadFilterNode;\n new(): BiquadFilterNode;\n}\n\ninterface Blob {\n readonly size: number;\n readonly type: string;\n msClose(): void;\n msDetachStream(): any;\n slice(start?: number, end?: number, contentType?: string): Blob;\n}\n\ndeclare var Blob: {\n prototype: Blob;\n new (blobParts?: any[], options?: BlobPropertyBag): Blob;\n}\n\ninterface CDATASection extends Text {\n}\n\ndeclare var CDATASection: {\n prototype: CDATASection;\n new(): CDATASection;\n}\n\ninterface CSS {\n supports(property: string, value?: string): boolean;\n}\ndeclare var CSS: CSS;\n\ninterface CSSConditionRule extends CSSGroupingRule {\n conditionText: string;\n}\n\ndeclare var CSSConditionRule: {\n prototype: CSSConditionRule;\n new(): CSSConditionRule;\n}\n\ninterface CSSFontFaceRule extends CSSRule {\n readonly style: CSSStyleDeclaration;\n}\n\ndeclare var CSSFontFaceRule: {\n prototype: CSSFontFaceRule;\n new(): CSSFontFaceRule;\n}\n\ninterface CSSGroupingRule extends CSSRule {\n readonly cssRules: CSSRuleList;\n deleteRule(index: number): void;\n insertRule(rule: string, index: number): number;\n}\n\ndeclare var CSSGroupingRule: {\n prototype: CSSGroupingRule;\n new(): CSSGroupingRule;\n}\n\ninterface CSSImportRule extends CSSRule {\n readonly href: string;\n readonly media: MediaList;\n readonly styleSheet: CSSStyleSheet;\n}\n\ndeclare var CSSImportRule: {\n prototype: CSSImportRule;\n new(): CSSImportRule;\n}\n\ninterface CSSKeyframeRule extends CSSRule {\n keyText: string;\n readonly style: CSSStyleDeclaration;\n}\n\ndeclare var CSSKeyframeRule: {\n prototype: CSSKeyframeRule;\n new(): CSSKeyframeRule;\n}\n\ninterface CSSKeyframesRule extends CSSRule {\n readonly cssRules: CSSRuleList;\n name: string;\n appendRule(rule: string): void;\n deleteRule(rule: string): void;\n findRule(rule: string): CSSKeyframeRule;\n}\n\ndeclare var CSSKeyframesRule: {\n prototype: CSSKeyframesRule;\n new(): CSSKeyframesRule;\n}\n\ninterface CSSMediaRule extends CSSConditionRule {\n readonly media: MediaList;\n}\n\ndeclare var CSSMediaRule: {\n prototype: CSSMediaRule;\n new(): CSSMediaRule;\n}\n\ninterface CSSNamespaceRule extends CSSRule {\n readonly namespaceURI: string;\n readonly prefix: string;\n}\n\ndeclare var CSSNamespaceRule: {\n prototype: CSSNamespaceRule;\n new(): CSSNamespaceRule;\n}\n\ninterface CSSPageRule extends CSSRule {\n readonly pseudoClass: string;\n readonly selector: string;\n selectorText: string;\n readonly style: CSSStyleDeclaration;\n}\n\ndeclare var CSSPageRule: {\n prototype: CSSPageRule;\n new(): CSSPageRule;\n}\n\ninterface CSSRule {\n cssText: string;\n readonly parentRule: CSSRule;\n readonly parentStyleSheet: CSSStyleSheet;\n readonly type: number;\n readonly CHARSET_RULE: number;\n readonly FONT_FACE_RULE: number;\n readonly IMPORT_RULE: number;\n readonly KEYFRAMES_RULE: number;\n readonly KEYFRAME_RULE: number;\n readonly MEDIA_RULE: number;\n readonly NAMESPACE_RULE: number;\n readonly PAGE_RULE: number;\n readonly STYLE_RULE: number;\n readonly SUPPORTS_RULE: number;\n readonly UNKNOWN_RULE: number;\n readonly VIEWPORT_RULE: number;\n}\n\ndeclare var CSSRule: {\n prototype: CSSRule;\n new(): CSSRule;\n readonly CHARSET_RULE: number;\n readonly FONT_FACE_RULE: number;\n readonly IMPORT_RULE: number;\n readonly KEYFRAMES_RULE: number;\n readonly KEYFRAME_RULE: number;\n readonly MEDIA_RULE: number;\n readonly NAMESPACE_RULE: number;\n readonly PAGE_RULE: number;\n readonly STYLE_RULE: number;\n readonly SUPPORTS_RULE: number;\n readonly UNKNOWN_RULE: number;\n readonly VIEWPORT_RULE: number;\n}\n\ninterface CSSRuleList {\n readonly length: number;\n item(index: number): CSSRule;\n [index: number]: CSSRule;\n}\n\ndeclare var CSSRuleList: {\n prototype: CSSRuleList;\n new(): CSSRuleList;\n}\n\ninterface CSSStyleDeclaration {\n alignContent: string | null;\n alignItems: string | null;\n alignSelf: string | null;\n alignmentBaseline: string | null;\n animation: string | null;\n animationDelay: string | null;\n animationDirection: string | null;\n animationDuration: string | null;\n animationFillMode: string | null;\n animationIterationCount: string | null;\n animationName: string | null;\n animationPlayState: string | null;\n animationTimingFunction: string | null;\n backfaceVisibility: string | null;\n background: string | null;\n backgroundAttachment: string | null;\n backgroundClip: string | null;\n backgroundColor: string | null;\n backgroundImage: string | null;\n backgroundOrigin: string | null;\n backgroundPosition: string | null;\n backgroundPositionX: string | null;\n backgroundPositionY: string | null;\n backgroundRepeat: string | null;\n backgroundSize: string | null;\n baselineShift: string | null;\n border: string | null;\n borderBottom: string | null;\n borderBottomColor: string | null;\n borderBottomLeftRadius: string | null;\n borderBottomRightRadius: string | null;\n borderBottomStyle: string | null;\n borderBottomWidth: string | null;\n borderCollapse: string | null;\n borderColor: string | null;\n borderImage: string | null;\n borderImageOutset: string | null;\n borderImageRepeat: string | null;\n borderImageSlice: string | null;\n borderImageSource: string | null;\n borderImageWidth: string | null;\n borderLeft: string | null;\n borderLeftColor: string | null;\n borderLeftStyle: string | null;\n borderLeftWidth: string | null;\n borderRadius: string | null;\n borderRight: string | null;\n borderRightColor: string | null;\n borderRightStyle: string | null;\n borderRightWidth: string | null;\n borderSpacing: string | null;\n borderStyle: string | null;\n borderTop: string | null;\n borderTopColor: string | null;\n borderTopLeftRadius: string | null;\n borderTopRightRadius: string | null;\n borderTopStyle: string | null;\n borderTopWidth: string | null;\n borderWidth: string | null;\n bottom: string | null;\n boxShadow: string | null;\n boxSizing: string | null;\n breakAfter: string | null;\n breakBefore: string | null;\n breakInside: string | null;\n captionSide: string | null;\n clear: string | null;\n clip: string | null;\n clipPath: string | null;\n clipRule: string | null;\n color: string | null;\n colorInterpolationFilters: string | null;\n columnCount: any;\n columnFill: string | null;\n columnGap: any;\n columnRule: string | null;\n columnRuleColor: any;\n columnRuleStyle: string | null;\n columnRuleWidth: any;\n columnSpan: string | null;\n columnWidth: any;\n columns: string | null;\n content: string | null;\n counterIncrement: string | null;\n counterReset: string | null;\n cssFloat: string | null;\n cssText: string;\n cursor: string | null;\n direction: string | null;\n display: string | null;\n dominantBaseline: string | null;\n emptyCells: string | null;\n enableBackground: string | null;\n fill: string | null;\n fillOpacity: string | null;\n fillRule: string | null;\n filter: string | null;\n flex: string | null;\n flexBasis: string | null;\n flexDirection: string | null;\n flexFlow: string | null;\n flexGrow: string | null;\n flexShrink: string | null;\n flexWrap: string | null;\n floodColor: string | null;\n floodOpacity: string | null;\n font: string | null;\n fontFamily: string | null;\n fontFeatureSettings: string | null;\n fontSize: string | null;\n fontSizeAdjust: string | null;\n fontStretch: string | null;\n fontStyle: string | null;\n fontVariant: string | null;\n fontWeight: string | null;\n glyphOrientationHorizontal: string | null;\n glyphOrientationVertical: string | null;\n height: string | null;\n imeMode: string | null;\n justifyContent: string | null;\n kerning: string | null;\n left: string | null;\n readonly length: number;\n letterSpacing: string | null;\n lightingColor: string | null;\n lineHeight: string | null;\n listStyle: string | null;\n listStyleImage: string | null;\n listStylePosition: string | null;\n listStyleType: string | null;\n margin: string | null;\n marginBottom: string | null;\n marginLeft: string | null;\n marginRight: string | null;\n marginTop: string | null;\n marker: string | null;\n markerEnd: string | null;\n markerMid: string | null;\n markerStart: string | null;\n mask: string | null;\n maxHeight: string | null;\n maxWidth: string | null;\n minHeight: string | null;\n minWidth: string | null;\n msContentZoomChaining: string | null;\n msContentZoomLimit: string | null;\n msContentZoomLimitMax: any;\n msContentZoomLimitMin: any;\n msContentZoomSnap: string | null;\n msContentZoomSnapPoints: string | null;\n msContentZoomSnapType: string | null;\n msContentZooming: string | null;\n msFlowFrom: string | null;\n msFlowInto: string | null;\n msFontFeatureSettings: string | null;\n msGridColumn: any;\n msGridColumnAlign: string | null;\n msGridColumnSpan: any;\n msGridColumns: string | null;\n msGridRow: any;\n msGridRowAlign: string | null;\n msGridRowSpan: any;\n msGridRows: string | null;\n msHighContrastAdjust: string | null;\n msHyphenateLimitChars: string | null;\n msHyphenateLimitLines: any;\n msHyphenateLimitZone: any;\n msHyphens: string | null;\n msImeAlign: string | null;\n msOverflowStyle: string | null;\n msScrollChaining: string | null;\n msScrollLimit: string | null;\n msScrollLimitXMax: any;\n msScrollLimitXMin: any;\n msScrollLimitYMax: any;\n msScrollLimitYMin: any;\n msScrollRails: string | null;\n msScrollSnapPointsX: string | null;\n msScrollSnapPointsY: string | null;\n msScrollSnapType: string | null;\n msScrollSnapX: string | null;\n msScrollSnapY: string | null;\n msScrollTranslation: string | null;\n msTextCombineHorizontal: string | null;\n msTextSizeAdjust: any;\n msTouchAction: string | null;\n msTouchSelect: string | null;\n msUserSelect: string | null;\n msWrapFlow: string;\n msWrapMargin: any;\n msWrapThrough: string;\n opacity: string | null;\n order: string | null;\n orphans: string | null;\n outline: string | null;\n outlineColor: string | null;\n outlineStyle: string | null;\n outlineWidth: string | null;\n overflow: string | null;\n overflowX: string | null;\n overflowY: string | null;\n padding: string | null;\n paddingBottom: string | null;\n paddingLeft: string | null;\n paddingRight: string | null;\n paddingTop: string | null;\n pageBreakAfter: string | null;\n pageBreakBefore: string | null;\n pageBreakInside: string | null;\n readonly parentRule: CSSRule;\n perspective: string | null;\n perspectiveOrigin: string | null;\n pointerEvents: string | null;\n position: string | null;\n quotes: string | null;\n right: string | null;\n rubyAlign: string | null;\n rubyOverhang: string | null;\n rubyPosition: string | null;\n stopColor: string | null;\n stopOpacity: string | null;\n stroke: string | null;\n strokeDasharray: string | null;\n strokeDashoffset: string | null;\n strokeLinecap: string | null;\n strokeLinejoin: string | null;\n strokeMiterlimit: string | null;\n strokeOpacity: string | null;\n strokeWidth: string | null;\n tableLayout: string | null;\n textAlign: string | null;\n textAlignLast: string | null;\n textAnchor: string | null;\n textDecoration: string | null;\n textIndent: string | null;\n textJustify: string | null;\n textKashida: string | null;\n textKashidaSpace: string | null;\n textOverflow: string | null;\n textShadow: string | null;\n textTransform: string | null;\n textUnderlinePosition: string | null;\n top: string | null;\n touchAction: string | null;\n transform: string | null;\n transformOrigin: string | null;\n transformStyle: string | null;\n transition: string | null;\n transitionDelay: string | null;\n transitionDuration: string | null;\n transitionProperty: string | null;\n transitionTimingFunction: string | null;\n unicodeBidi: string | null;\n verticalAlign: string | null;\n visibility: string | null;\n webkitAlignContent: string | null;\n webkitAlignItems: string | null;\n webkitAlignSelf: string | null;\n webkitAnimation: string | null;\n webkitAnimationDelay: string | null;\n webkitAnimationDirection: string | null;\n webkitAnimationDuration: string | null;\n webkitAnimationFillMode: string | null;\n webkitAnimationIterationCount: string | null;\n webkitAnimationName: string | null;\n webkitAnimationPlayState: string | null;\n webkitAnimationTimingFunction: string | null;\n webkitAppearance: string | null;\n webkitBackfaceVisibility: string | null;\n webkitBackgroundClip: string | null;\n webkitBackgroundOrigin: string | null;\n webkitBackgroundSize: string | null;\n webkitBorderBottomLeftRadius: string | null;\n webkitBorderBottomRightRadius: string | null;\n webkitBorderImage: string | null;\n webkitBorderRadius: string | null;\n webkitBorderTopLeftRadius: string | null;\n webkitBorderTopRightRadius: string | null;\n webkitBoxAlign: string | null;\n webkitBoxDirection: string | null;\n webkitBoxFlex: string | null;\n webkitBoxOrdinalGroup: string | null;\n webkitBoxOrient: string | null;\n webkitBoxPack: string | null;\n webkitBoxSizing: string | null;\n webkitColumnBreakAfter: string | null;\n webkitColumnBreakBefore: string | null;\n webkitColumnBreakInside: string | null;\n webkitColumnCount: any;\n webkitColumnGap: any;\n webkitColumnRule: string | null;\n webkitColumnRuleColor: any;\n webkitColumnRuleStyle: string | null;\n webkitColumnRuleWidth: any;\n webkitColumnSpan: string | null;\n webkitColumnWidth: any;\n webkitColumns: string | null;\n webkitFilter: string | null;\n webkitFlex: string | null;\n webkitFlexBasis: string | null;\n webkitFlexDirection: string | null;\n webkitFlexFlow: string | null;\n webkitFlexGrow: string | null;\n webkitFlexShrink: string | null;\n webkitFlexWrap: string | null;\n webkitJustifyContent: string | null;\n webkitOrder: string | null;\n webkitPerspective: string | null;\n webkitPerspectiveOrigin: string | null;\n webkitTapHighlightColor: string | null;\n webkitTextFillColor: string | null;\n webkitTextSizeAdjust: any;\n webkitTransform: string | null;\n webkitTransformOrigin: string | null;\n webkitTransformStyle: string | null;\n webkitTransition: string | null;\n webkitTransitionDelay: string | null;\n webkitTransitionDuration: string | null;\n webkitTransitionProperty: string | null;\n webkitTransitionTimingFunction: string | null;\n webkitUserModify: string | null;\n webkitUserSelect: string | null;\n webkitWritingMode: string | null;\n whiteSpace: string | null;\n widows: string | null;\n width: string | null;\n wordBreak: string | null;\n wordSpacing: string | null;\n wordWrap: string | null;\n writingMode: string | null;\n zIndex: string | null;\n zoom: string | null;\n resize: string | null;\n getPropertyPriority(propertyName: string): string;\n getPropertyValue(propertyName: string): string;\n item(index: number): string;\n removeProperty(propertyName: string): string;\n setProperty(propertyName: string, value: string | null, priority?: string): void;\n [index: number]: string;\n}\n\ndeclare var CSSStyleDeclaration: {\n prototype: CSSStyleDeclaration;\n new(): CSSStyleDeclaration;\n}\n\ninterface CSSStyleRule extends CSSRule {\n readonly readOnly: boolean;\n selectorText: string;\n readonly style: CSSStyleDeclaration;\n}\n\ndeclare var CSSStyleRule: {\n prototype: CSSStyleRule;\n new(): CSSStyleRule;\n}\n\ninterface CSSStyleSheet extends StyleSheet {\n readonly cssRules: CSSRuleList;\n cssText: string;\n readonly href: string;\n readonly id: string;\n readonly imports: StyleSheetList;\n readonly isAlternate: boolean;\n readonly isPrefAlternate: boolean;\n readonly ownerRule: CSSRule;\n readonly owningElement: Element;\n readonly pages: StyleSheetPageList;\n readonly readOnly: boolean;\n readonly rules: CSSRuleList;\n addImport(bstrURL: string, lIndex?: number): number;\n addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number;\n addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number;\n deleteRule(index?: number): void;\n insertRule(rule: string, index?: number): number;\n removeImport(lIndex: number): void;\n removeRule(lIndex: number): void;\n}\n\ndeclare var CSSStyleSheet: {\n prototype: CSSStyleSheet;\n new(): CSSStyleSheet;\n}\n\ninterface CSSSupportsRule extends CSSConditionRule {\n}\n\ndeclare var CSSSupportsRule: {\n prototype: CSSSupportsRule;\n new(): CSSSupportsRule;\n}\n\ninterface CanvasGradient {\n addColorStop(offset: number, color: string): void;\n}\n\ndeclare var CanvasGradient: {\n prototype: CanvasGradient;\n new(): CanvasGradient;\n}\n\ninterface CanvasPattern {\n setTransform(matrix: SVGMatrix): void;\n}\n\ndeclare var CanvasPattern: {\n prototype: CanvasPattern;\n new(): CanvasPattern;\n}\n\ninterface CanvasRenderingContext2D extends Object, CanvasPathMethods {\n readonly canvas: HTMLCanvasElement;\n fillStyle: string | CanvasGradient | CanvasPattern;\n font: string;\n globalAlpha: number;\n globalCompositeOperation: string;\n lineCap: string;\n lineDashOffset: number;\n lineJoin: string;\n lineWidth: number;\n miterLimit: number;\n msFillRule: string;\n msImageSmoothingEnabled: boolean;\n shadowBlur: number;\n shadowColor: string;\n shadowOffsetX: number;\n shadowOffsetY: number;\n strokeStyle: string | CanvasGradient | CanvasPattern;\n textAlign: string;\n textBaseline: string;\n mozImageSmoothingEnabled: boolean;\n webkitImageSmoothingEnabled: boolean;\n oImageSmoothingEnabled: boolean;\n beginPath(): void;\n clearRect(x: number, y: number, w: number, h: number): void;\n clip(fillRule?: string): void;\n createImageData(imageDataOrSw: number | ImageData, sh?: number): ImageData;\n createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient;\n createPattern(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, repetition: string): CanvasPattern;\n createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient;\n drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, offsetX: number, offsetY: number, width?: number, height?: number, canvasOffsetX?: number, canvasOffsetY?: number, canvasImageWidth?: number, canvasImageHeight?: number): void;\n fill(fillRule?: string): void;\n fillRect(x: number, y: number, w: number, h: number): void;\n fillText(text: string, x: number, y: number, maxWidth?: number): void;\n getImageData(sx: number, sy: number, sw: number, sh: number): ImageData;\n getLineDash(): number[];\n isPointInPath(x: number, y: number, fillRule?: string): boolean;\n measureText(text: string): TextMetrics;\n putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void;\n restore(): void;\n rotate(angle: number): void;\n save(): void;\n scale(x: number, y: number): void;\n setLineDash(segments: number[]): void;\n setTransform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void;\n stroke(): void;\n strokeRect(x: number, y: number, w: number, h: number): void;\n strokeText(text: string, x: number, y: number, maxWidth?: number): void;\n transform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void;\n translate(x: number, y: number): void;\n}\n\ndeclare var CanvasRenderingContext2D: {\n prototype: CanvasRenderingContext2D;\n new(): CanvasRenderingContext2D;\n}\n\ninterface ChannelMergerNode extends AudioNode {\n}\n\ndeclare var ChannelMergerNode: {\n prototype: ChannelMergerNode;\n new(): ChannelMergerNode;\n}\n\ninterface ChannelSplitterNode extends AudioNode {\n}\n\ndeclare var ChannelSplitterNode: {\n prototype: ChannelSplitterNode;\n new(): ChannelSplitterNode;\n}\n\ninterface CharacterData extends Node, ChildNode {\n data: string;\n readonly length: number;\n appendData(arg: string): void;\n deleteData(offset: number, count: number): void;\n insertData(offset: number, arg: string): void;\n replaceData(offset: number, count: number, arg: string): void;\n substringData(offset: number, count: number): string;\n}\n\ndeclare var CharacterData: {\n prototype: CharacterData;\n new(): CharacterData;\n}\n\ninterface ClientRect {\n bottom: number;\n readonly height: number;\n left: number;\n right: number;\n top: number;\n readonly width: number;\n}\n\ndeclare var ClientRect: {\n prototype: ClientRect;\n new(): ClientRect;\n}\n\ninterface ClientRectList {\n readonly length: number;\n item(index: number): ClientRect;\n [index: number]: ClientRect;\n}\n\ndeclare var ClientRectList: {\n prototype: ClientRectList;\n new(): ClientRectList;\n}\n\ninterface ClipboardEvent extends Event {\n readonly clipboardData: DataTransfer;\n}\n\ndeclare var ClipboardEvent: {\n prototype: ClipboardEvent;\n new(type: string, eventInitDict?: ClipboardEventInit): ClipboardEvent;\n}\n\ninterface CloseEvent extends Event {\n readonly code: number;\n readonly reason: string;\n readonly wasClean: boolean;\n initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void;\n}\n\ndeclare var CloseEvent: {\n prototype: CloseEvent;\n new(): CloseEvent;\n}\n\ninterface CommandEvent extends Event {\n readonly commandName: string;\n readonly detail: string | null;\n}\n\ndeclare var CommandEvent: {\n prototype: CommandEvent;\n new(type: string, eventInitDict?: CommandEventInit): CommandEvent;\n}\n\ninterface Comment extends CharacterData {\n text: string;\n}\n\ndeclare var Comment: {\n prototype: Comment;\n new(): Comment;\n}\n\ninterface CompositionEvent extends UIEvent {\n readonly data: string;\n readonly locale: string;\n initCompositionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, locale: string): void;\n}\n\ndeclare var CompositionEvent: {\n prototype: CompositionEvent;\n new(typeArg: string, eventInitDict?: CompositionEventInit): CompositionEvent;\n}\n\ninterface Console {\n assert(test?: boolean, message?: string, ...optionalParams: any[]): void;\n clear(): void;\n count(countTitle?: string): void;\n debug(message?: string, ...optionalParams: any[]): void;\n dir(value?: any, ...optionalParams: any[]): void;\n dirxml(value: any): void;\n error(message?: any, ...optionalParams: any[]): void;\n exception(message?: string, ...optionalParams: any[]): void;\n group(groupTitle?: string): void;\n groupCollapsed(groupTitle?: string): void;\n groupEnd(): void;\n info(message?: any, ...optionalParams: any[]): void;\n log(message?: any, ...optionalParams: any[]): void;\n msIsIndependentlyComposed(element: Element): boolean;\n profile(reportName?: string): void;\n profileEnd(): void;\n select(element: Element): void;\n table(...data: any[]): void;\n time(timerName?: string): void;\n timeEnd(timerName?: string): void;\n trace(message?: any, ...optionalParams: any[]): void;\n warn(message?: any, ...optionalParams: any[]): void;\n}\n\ndeclare var Console: {\n prototype: Console;\n new(): Console;\n}\n\ninterface ConvolverNode extends AudioNode {\n buffer: AudioBuffer | null;\n normalize: boolean;\n}\n\ndeclare var ConvolverNode: {\n prototype: ConvolverNode;\n new(): ConvolverNode;\n}\n\ninterface Coordinates {\n readonly accuracy: number;\n readonly altitude: number | null;\n readonly altitudeAccuracy: number | null;\n readonly heading: number | null;\n readonly latitude: number;\n readonly longitude: number;\n readonly speed: number | null;\n}\n\ndeclare var Coordinates: {\n prototype: Coordinates;\n new(): Coordinates;\n}\n\ninterface Crypto extends Object, RandomSource {\n readonly subtle: SubtleCrypto;\n}\n\ndeclare var Crypto: {\n prototype: Crypto;\n new(): Crypto;\n}\n\ninterface CryptoKey {\n readonly algorithm: KeyAlgorithm;\n readonly extractable: boolean;\n readonly type: string;\n readonly usages: string[];\n}\n\ndeclare var CryptoKey: {\n prototype: CryptoKey;\n new(): CryptoKey;\n}\n\ninterface CryptoKeyPair {\n privateKey: CryptoKey;\n publicKey: CryptoKey;\n}\n\ndeclare var CryptoKeyPair: {\n prototype: CryptoKeyPair;\n new(): CryptoKeyPair;\n}\n\ninterface CustomEvent extends Event {\n readonly detail: any;\n initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void;\n}\n\ndeclare var CustomEvent: {\n prototype: CustomEvent;\n new(typeArg: string, eventInitDict?: CustomEventInit): CustomEvent;\n}\n\ninterface DOMError {\n readonly name: string;\n toString(): string;\n}\n\ndeclare var DOMError: {\n prototype: DOMError;\n new(): DOMError;\n}\n\ninterface DOMException {\n readonly code: number;\n readonly message: string;\n readonly name: string;\n toString(): string;\n readonly ABORT_ERR: number;\n readonly DATA_CLONE_ERR: number;\n readonly DOMSTRING_SIZE_ERR: number;\n readonly HIERARCHY_REQUEST_ERR: number;\n readonly INDEX_SIZE_ERR: number;\n readonly INUSE_ATTRIBUTE_ERR: number;\n readonly INVALID_ACCESS_ERR: number;\n readonly INVALID_CHARACTER_ERR: number;\n readonly INVALID_MODIFICATION_ERR: number;\n readonly INVALID_NODE_TYPE_ERR: number;\n readonly INVALID_STATE_ERR: number;\n readonly NAMESPACE_ERR: number;\n readonly NETWORK_ERR: number;\n readonly NOT_FOUND_ERR: number;\n readonly NOT_SUPPORTED_ERR: number;\n readonly NO_DATA_ALLOWED_ERR: number;\n readonly NO_MODIFICATION_ALLOWED_ERR: number;\n readonly PARSE_ERR: number;\n readonly QUOTA_EXCEEDED_ERR: number;\n readonly SECURITY_ERR: number;\n readonly SERIALIZE_ERR: number;\n readonly SYNTAX_ERR: number;\n readonly TIMEOUT_ERR: number;\n readonly TYPE_MISMATCH_ERR: number;\n readonly URL_MISMATCH_ERR: number;\n readonly VALIDATION_ERR: number;\n readonly WRONG_DOCUMENT_ERR: number;\n}\n\ndeclare var DOMException: {\n prototype: DOMException;\n new(): DOMException;\n readonly ABORT_ERR: number;\n readonly DATA_CLONE_ERR: number;\n readonly DOMSTRING_SIZE_ERR: number;\n readonly HIERARCHY_REQUEST_ERR: number;\n readonly INDEX_SIZE_ERR: number;\n readonly INUSE_ATTRIBUTE_ERR: number;\n readonly INVALID_ACCESS_ERR: number;\n readonly INVALID_CHARACTER_ERR: number;\n readonly INVALID_MODIFICATION_ERR: number;\n readonly INVALID_NODE_TYPE_ERR: number;\n readonly INVALID_STATE_ERR: number;\n readonly NAMESPACE_ERR: number;\n readonly NETWORK_ERR: number;\n readonly NOT_FOUND_ERR: number;\n readonly NOT_SUPPORTED_ERR: number;\n readonly NO_DATA_ALLOWED_ERR: number;\n readonly NO_MODIFICATION_ALLOWED_ERR: number;\n readonly PARSE_ERR: number;\n readonly QUOTA_EXCEEDED_ERR: number;\n readonly SECURITY_ERR: number;\n readonly SERIALIZE_ERR: number;\n readonly SYNTAX_ERR: number;\n readonly TIMEOUT_ERR: number;\n readonly TYPE_MISMATCH_ERR: number;\n readonly URL_MISMATCH_ERR: number;\n readonly VALIDATION_ERR: number;\n readonly WRONG_DOCUMENT_ERR: number;\n}\n\ninterface DOMImplementation {\n createDocument(namespaceURI: string | null, qualifiedName: string | null, doctype: DocumentType): Document;\n createDocumentType(qualifiedName: string, publicId: string | null, systemId: string | null): DocumentType;\n createHTMLDocument(title: string): Document;\n hasFeature(feature: string | null, version: string | null): boolean;\n}\n\ndeclare var DOMImplementation: {\n prototype: DOMImplementation;\n new(): DOMImplementation;\n}\n\ninterface DOMParser {\n parseFromString(source: string, mimeType: string): Document;\n}\n\ndeclare var DOMParser: {\n prototype: DOMParser;\n new(): DOMParser;\n}\n\ninterface DOMSettableTokenList extends DOMTokenList {\n value: string;\n}\n\ndeclare var DOMSettableTokenList: {\n prototype: DOMSettableTokenList;\n new(): DOMSettableTokenList;\n}\n\ninterface DOMStringList {\n readonly length: number;\n contains(str: string): boolean;\n item(index: number): string | null;\n [index: number]: string;\n}\n\ndeclare var DOMStringList: {\n prototype: DOMStringList;\n new(): DOMStringList;\n}\n\ninterface DOMStringMap {\n [name: string]: string;\n}\n\ndeclare var DOMStringMap: {\n prototype: DOMStringMap;\n new(): DOMStringMap;\n}\n\ninterface DOMTokenList {\n readonly length: number;\n add(...token: string[]): void;\n contains(token: string): boolean;\n item(index: number): string;\n remove(...token: string[]): void;\n toString(): string;\n toggle(token: string, force?: boolean): boolean;\n [index: number]: string;\n}\n\ndeclare var DOMTokenList: {\n prototype: DOMTokenList;\n new(): DOMTokenList;\n}\n\ninterface DataCue extends TextTrackCue {\n data: ArrayBuffer;\n addEventListener(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var DataCue: {\n prototype: DataCue;\n new(): DataCue;\n}\n\ninterface DataTransfer {\n dropEffect: string;\n effectAllowed: string;\n readonly files: FileList;\n readonly items: DataTransferItemList;\n readonly types: string[];\n clearData(format?: string): boolean;\n getData(format: string): string;\n setData(format: string, data: string): boolean;\n}\n\ndeclare var DataTransfer: {\n prototype: DataTransfer;\n new(): DataTransfer;\n}\n\ninterface DataTransferItem {\n readonly kind: string;\n readonly type: string;\n getAsFile(): File | null;\n getAsString(_callback: FunctionStringCallback | null): void;\n}\n\ndeclare var DataTransferItem: {\n prototype: DataTransferItem;\n new(): DataTransferItem;\n}\n\ninterface DataTransferItemList {\n readonly length: number;\n add(data: File): DataTransferItem | null;\n clear(): void;\n item(index: number): DataTransferItem;\n remove(index: number): void;\n [index: number]: DataTransferItem;\n}\n\ndeclare var DataTransferItemList: {\n prototype: DataTransferItemList;\n new(): DataTransferItemList;\n}\n\ninterface DeferredPermissionRequest {\n readonly id: number;\n readonly type: string;\n readonly uri: string;\n allow(): void;\n deny(): void;\n}\n\ndeclare var DeferredPermissionRequest: {\n prototype: DeferredPermissionRequest;\n new(): DeferredPermissionRequest;\n}\n\ninterface DelayNode extends AudioNode {\n readonly delayTime: AudioParam;\n}\n\ndeclare var DelayNode: {\n prototype: DelayNode;\n new(): DelayNode;\n}\n\ninterface DeviceAcceleration {\n readonly x: number | null;\n readonly y: number | null;\n readonly z: number | null;\n}\n\ndeclare var DeviceAcceleration: {\n prototype: DeviceAcceleration;\n new(): DeviceAcceleration;\n}\n\ninterface DeviceLightEvent extends Event {\n readonly value: number;\n}\n\ndeclare var DeviceLightEvent: {\n prototype: DeviceLightEvent;\n new(type: string, eventInitDict?: DeviceLightEventInit): DeviceLightEvent;\n}\n\ninterface DeviceMotionEvent extends Event {\n readonly acceleration: DeviceAcceleration | null;\n readonly accelerationIncludingGravity: DeviceAcceleration | null;\n readonly interval: number | null;\n readonly rotationRate: DeviceRotationRate | null;\n initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict | null, accelerationIncludingGravity: DeviceAccelerationDict | null, rotationRate: DeviceRotationRateDict | null, interval: number | null): void;\n}\n\ndeclare var DeviceMotionEvent: {\n prototype: DeviceMotionEvent;\n new(): DeviceMotionEvent;\n}\n\ninterface DeviceOrientationEvent extends Event {\n readonly absolute: boolean;\n readonly alpha: number | null;\n readonly beta: number | null;\n readonly gamma: number | null;\n initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number | null, beta: number | null, gamma: number | null, absolute: boolean): void;\n}\n\ndeclare var DeviceOrientationEvent: {\n prototype: DeviceOrientationEvent;\n new(): DeviceOrientationEvent;\n}\n\ninterface DeviceRotationRate {\n readonly alpha: number | null;\n readonly beta: number | null;\n readonly gamma: number | null;\n}\n\ndeclare var DeviceRotationRate: {\n prototype: DeviceRotationRate;\n new(): DeviceRotationRate;\n}\n\ninterface DocumentEventMap extends GlobalEventHandlersEventMap {\n \"abort\": UIEvent;\n \"activate\": UIEvent;\n \"beforeactivate\": UIEvent;\n \"beforedeactivate\": UIEvent;\n \"blur\": FocusEvent;\n \"canplay\": Event;\n \"canplaythrough\": Event;\n \"change\": Event;\n \"click\": MouseEvent;\n \"contextmenu\": PointerEvent;\n \"dblclick\": MouseEvent;\n \"deactivate\": UIEvent;\n \"drag\": DragEvent;\n \"dragend\": DragEvent;\n \"dragenter\": DragEvent;\n \"dragleave\": DragEvent;\n \"dragover\": DragEvent;\n \"dragstart\": DragEvent;\n \"drop\": DragEvent;\n \"durationchange\": Event;\n \"emptied\": Event;\n \"ended\": MediaStreamErrorEvent;\n \"error\": ErrorEvent;\n \"focus\": FocusEvent;\n \"fullscreenchange\": Event;\n \"fullscreenerror\": Event;\n \"input\": Event;\n \"invalid\": Event;\n \"keydown\": KeyboardEvent;\n \"keypress\": KeyboardEvent;\n \"keyup\": KeyboardEvent;\n \"load\": Event;\n \"loadeddata\": Event;\n \"loadedmetadata\": Event;\n \"loadstart\": Event;\n \"mousedown\": MouseEvent;\n \"mousemove\": MouseEvent;\n \"mouseout\": MouseEvent;\n \"mouseover\": MouseEvent;\n \"mouseup\": MouseEvent;\n \"mousewheel\": WheelEvent;\n \"MSContentZoom\": UIEvent;\n \"MSGestureChange\": MSGestureEvent;\n \"MSGestureDoubleTap\": MSGestureEvent;\n \"MSGestureEnd\": MSGestureEvent;\n \"MSGestureHold\": MSGestureEvent;\n \"MSGestureStart\": MSGestureEvent;\n \"MSGestureTap\": MSGestureEvent;\n \"MSInertiaStart\": MSGestureEvent;\n \"MSManipulationStateChanged\": MSManipulationEvent;\n \"MSPointerCancel\": MSPointerEvent;\n \"MSPointerDown\": MSPointerEvent;\n \"MSPointerEnter\": MSPointerEvent;\n \"MSPointerLeave\": MSPointerEvent;\n \"MSPointerMove\": MSPointerEvent;\n \"MSPointerOut\": MSPointerEvent;\n \"MSPointerOver\": MSPointerEvent;\n \"MSPointerUp\": MSPointerEvent;\n \"mssitemodejumplistitemremoved\": MSSiteModeEvent;\n \"msthumbnailclick\": MSSiteModeEvent;\n \"pause\": Event;\n \"play\": Event;\n \"playing\": Event;\n \"pointerlockchange\": Event;\n \"pointerlockerror\": Event;\n \"progress\": ProgressEvent;\n \"ratechange\": Event;\n \"readystatechange\": ProgressEvent;\n \"reset\": Event;\n \"scroll\": UIEvent;\n \"seeked\": Event;\n \"seeking\": Event;\n \"select\": UIEvent;\n \"selectionchange\": Event;\n \"selectstart\": Event;\n \"stalled\": Event;\n \"stop\": Event;\n \"submit\": Event;\n \"suspend\": Event;\n \"timeupdate\": Event;\n \"touchcancel\": TouchEvent;\n \"touchend\": TouchEvent;\n \"touchmove\": TouchEvent;\n \"touchstart\": TouchEvent;\n \"volumechange\": Event;\n \"waiting\": Event;\n \"webkitfullscreenchange\": Event;\n \"webkitfullscreenerror\": Event;\n}\n\ninterface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent, ParentNode, DocumentOrShadowRoot {\n /**\n * Sets or gets the URL for the current document. \n */\n readonly URL: string;\n /**\n * Gets the URL for the document, stripped of any character encoding.\n */\n readonly URLUnencoded: string;\n /**\n * Gets the object that has the focus when the parent document has focus.\n */\n readonly activeElement: Element;\n /**\n * Sets or gets the color of all active links in the document.\n */\n alinkColor: string;\n /**\n * Returns a reference to the collection of elements contained by the object.\n */\n readonly all: HTMLAllCollection;\n /**\n * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order.\n */\n anchors: HTMLCollectionOf;\n /**\n * Retrieves a collection of all applet objects in the document.\n */\n applets: HTMLCollectionOf;\n /**\n * Deprecated. Sets or retrieves a value that indicates the background color behind the object. \n */\n bgColor: string;\n /**\n * Specifies the beginning and end of the document body.\n */\n body: HTMLElement;\n readonly characterSet: string;\n /**\n * Gets or sets the character set used to encode the object.\n */\n charset: string;\n /**\n * Gets a value that indicates whether standards-compliant mode is switched on for the object.\n */\n readonly compatMode: string;\n cookie: string;\n readonly currentScript: HTMLScriptElement | SVGScriptElement;\n /**\n * Gets the default character set from the current regional language settings.\n */\n readonly defaultCharset: string;\n readonly defaultView: Window;\n /**\n * Sets or gets a value that indicates whether the document can be edited.\n */\n designMode: string;\n /**\n * Sets or retrieves a value that indicates the reading order of the object. \n */\n dir: string;\n /**\n * Gets an object representing the document type declaration associated with the current document. \n */\n readonly doctype: DocumentType;\n /**\n * Gets a reference to the root node of the document. \n */\n documentElement: HTMLElement;\n /**\n * Sets or gets the security domain of the document. \n */\n domain: string;\n /**\n * Retrieves a collection of all embed objects in the document.\n */\n embeds: HTMLCollectionOf;\n /**\n * Sets or gets the foreground (text) color of the document.\n */\n fgColor: string;\n /**\n * Retrieves a collection, in source order, of all form objects in the document.\n */\n forms: HTMLCollectionOf;\n readonly fullscreenElement: Element | null;\n readonly fullscreenEnabled: boolean;\n readonly head: HTMLHeadElement;\n readonly hidden: boolean;\n /**\n * Retrieves a collection, in source order, of img objects in the document.\n */\n images: HTMLCollectionOf;\n /**\n * Gets the implementation object of the current document. \n */\n readonly implementation: DOMImplementation;\n /**\n * Returns the character encoding used to create the webpage that is loaded into the document object.\n */\n readonly inputEncoding: string | null;\n /**\n * Gets the date that the page was last modified, if the page supplies one. \n */\n readonly lastModified: string;\n /**\n * Sets or gets the color of the document links. \n */\n linkColor: string;\n /**\n * Retrieves a collection of all a objects that specify the href property and all area objects in the document.\n */\n links: HTMLCollectionOf;\n /**\n * Contains information about the current URL. \n */\n readonly location: Location;\n msCSSOMElementFloatMetrics: boolean;\n msCapsLockWarningOff: boolean;\n /**\n * Fires when the user aborts the download.\n * @param ev The event.\n */\n onabort: (this: Document, ev: UIEvent) => any;\n /**\n * Fires when the object is set as the active element.\n * @param ev The event.\n */\n onactivate: (this: Document, ev: UIEvent) => any;\n /**\n * Fires immediately before the object is set as the active element.\n * @param ev The event.\n */\n onbeforeactivate: (this: Document, ev: UIEvent) => any;\n /**\n * Fires immediately before the activeElement is changed from the current object to another object in the parent document.\n * @param ev The event.\n */\n onbeforedeactivate: (this: Document, ev: UIEvent) => any;\n /** \n * Fires when the object loses the input focus. \n * @param ev The focus event.\n */\n onblur: (this: Document, ev: FocusEvent) => any;\n /**\n * Occurs when playback is possible, but would require further buffering. \n * @param ev The event.\n */\n oncanplay: (this: Document, ev: Event) => any;\n oncanplaythrough: (this: Document, ev: Event) => any;\n /**\n * Fires when the contents of the object or selection have changed. \n * @param ev The event.\n */\n onchange: (this: Document, ev: Event) => any;\n /**\n * Fires when the user clicks the left mouse button on the object\n * @param ev The mouse event.\n */\n onclick: (this: Document, ev: MouseEvent) => any;\n /**\n * Fires when the user clicks the right mouse button in the client area, opening the context menu. \n * @param ev The mouse event.\n */\n oncontextmenu: (this: Document, ev: PointerEvent) => any;\n /**\n * Fires when the user double-clicks the object.\n * @param ev The mouse event.\n */\n ondblclick: (this: Document, ev: MouseEvent) => any;\n /**\n * Fires when the activeElement is changed from the current object to another object in the parent document.\n * @param ev The UI Event\n */\n ondeactivate: (this: Document, ev: UIEvent) => any;\n /**\n * Fires on the source object continuously during a drag operation.\n * @param ev The event.\n */\n ondrag: (this: Document, ev: DragEvent) => any;\n /**\n * Fires on the source object when the user releases the mouse at the close of a drag operation.\n * @param ev The event.\n */\n ondragend: (this: Document, ev: DragEvent) => any;\n /** \n * Fires on the target element when the user drags the object to a valid drop target.\n * @param ev The drag event.\n */\n ondragenter: (this: Document, ev: DragEvent) => any;\n /** \n * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation.\n * @param ev The drag event.\n */\n ondragleave: (this: Document, ev: DragEvent) => any;\n /**\n * Fires on the target element continuously while the user drags the object over a valid drop target.\n * @param ev The event.\n */\n ondragover: (this: Document, ev: DragEvent) => any;\n /**\n * Fires on the source object when the user starts to drag a text selection or selected object. \n * @param ev The event.\n */\n ondragstart: (this: Document, ev: DragEvent) => any;\n ondrop: (this: Document, ev: DragEvent) => any;\n /**\n * Occurs when the duration attribute is updated. \n * @param ev The event.\n */\n ondurationchange: (this: Document, ev: Event) => any;\n /**\n * Occurs when the media element is reset to its initial state. \n * @param ev The event.\n */\n onemptied: (this: Document, ev: Event) => any;\n /**\n * Occurs when the end of playback is reached. \n * @param ev The event\n */\n onended: (this: Document, ev: MediaStreamErrorEvent) => any;\n /**\n * Fires when an error occurs during object loading.\n * @param ev The event.\n */\n onerror: (this: Document, ev: ErrorEvent) => any;\n /**\n * Fires when the object receives focus. \n * @param ev The event.\n */\n onfocus: (this: Document, ev: FocusEvent) => any;\n onfullscreenchange: (this: Document, ev: Event) => any;\n onfullscreenerror: (this: Document, ev: Event) => any;\n oninput: (this: Document, ev: Event) => any;\n oninvalid: (this: Document, ev: Event) => any;\n /**\n * Fires when the user presses a key.\n * @param ev The keyboard event\n */\n onkeydown: (this: Document, ev: KeyboardEvent) => any;\n /**\n * Fires when the user presses an alphanumeric key.\n * @param ev The event.\n */\n onkeypress: (this: Document, ev: KeyboardEvent) => any;\n /**\n * Fires when the user releases a key.\n * @param ev The keyboard event\n */\n onkeyup: (this: Document, ev: KeyboardEvent) => any;\n /**\n * Fires immediately after the browser loads the object. \n * @param ev The event.\n */\n onload: (this: Document, ev: Event) => any;\n /**\n * Occurs when media data is loaded at the current playback position. \n * @param ev The event.\n */\n onloadeddata: (this: Document, ev: Event) => any;\n /**\n * Occurs when the duration and dimensions of the media have been determined.\n * @param ev The event.\n */\n onloadedmetadata: (this: Document, ev: Event) => any;\n /**\n * Occurs when Internet Explorer begins looking for media data. \n * @param ev The event.\n */\n onloadstart: (this: Document, ev: Event) => any;\n /**\n * Fires when the user clicks the object with either mouse button. \n * @param ev The mouse event.\n */\n onmousedown: (this: Document, ev: MouseEvent) => any;\n /**\n * Fires when the user moves the mouse over the object. \n * @param ev The mouse event.\n */\n onmousemove: (this: Document, ev: MouseEvent) => any;\n /**\n * Fires when the user moves the mouse pointer outside the boundaries of the object. \n * @param ev The mouse event.\n */\n onmouseout: (this: Document, ev: MouseEvent) => any;\n /**\n * Fires when the user moves the mouse pointer into the object.\n * @param ev The mouse event.\n */\n onmouseover: (this: Document, ev: MouseEvent) => any;\n /**\n * Fires when the user releases a mouse button while the mouse is over the object. \n * @param ev The mouse event.\n */\n onmouseup: (this: Document, ev: MouseEvent) => any;\n /**\n * Fires when the wheel button is rotated. \n * @param ev The mouse event\n */\n onmousewheel: (this: Document, ev: WheelEvent) => any;\n onmscontentzoom: (this: Document, ev: UIEvent) => any;\n onmsgesturechange: (this: Document, ev: MSGestureEvent) => any;\n onmsgesturedoubletap: (this: Document, ev: MSGestureEvent) => any;\n onmsgestureend: (this: Document, ev: MSGestureEvent) => any;\n onmsgesturehold: (this: Document, ev: MSGestureEvent) => any;\n onmsgesturestart: (this: Document, ev: MSGestureEvent) => any;\n onmsgesturetap: (this: Document, ev: MSGestureEvent) => any;\n onmsinertiastart: (this: Document, ev: MSGestureEvent) => any;\n onmsmanipulationstatechanged: (this: Document, ev: MSManipulationEvent) => any;\n onmspointercancel: (this: Document, ev: MSPointerEvent) => any;\n onmspointerdown: (this: Document, ev: MSPointerEvent) => any;\n onmspointerenter: (this: Document, ev: MSPointerEvent) => any;\n onmspointerleave: (this: Document, ev: MSPointerEvent) => any;\n onmspointermove: (this: Document, ev: MSPointerEvent) => any;\n onmspointerout: (this: Document, ev: MSPointerEvent) => any;\n onmspointerover: (this: Document, ev: MSPointerEvent) => any;\n onmspointerup: (this: Document, ev: MSPointerEvent) => any;\n /**\n * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. \n * @param ev The event.\n */\n onmssitemodejumplistitemremoved: (this: Document, ev: MSSiteModeEvent) => any;\n /**\n * Occurs when a user clicks a button in a Thumbnail Toolbar of a webpage running in Site Mode.\n * @param ev The event.\n */\n onmsthumbnailclick: (this: Document, ev: MSSiteModeEvent) => any;\n /**\n * Occurs when playback is paused.\n * @param ev The event.\n */\n onpause: (this: Document, ev: Event) => any;\n /**\n * Occurs when the play method is requested. \n * @param ev The event.\n */\n onplay: (this: Document, ev: Event) => any;\n /**\n * Occurs when the audio or video has started playing. \n * @param ev The event.\n */\n onplaying: (this: Document, ev: Event) => any;\n onpointerlockchange: (this: Document, ev: Event) => any;\n onpointerlockerror: (this: Document, ev: Event) => any;\n /**\n * Occurs to indicate progress while downloading media data. \n * @param ev The event.\n */\n onprogress: (this: Document, ev: ProgressEvent) => any;\n /**\n * Occurs when the playback rate is increased or decreased. \n * @param ev The event.\n */\n onratechange: (this: Document, ev: Event) => any;\n /**\n * Fires when the state of the object has changed.\n * @param ev The event\n */\n onreadystatechange: (this: Document, ev: ProgressEvent) => any;\n /**\n * Fires when the user resets a form. \n * @param ev The event.\n */\n onreset: (this: Document, ev: Event) => any;\n /**\n * Fires when the user repositions the scroll box in the scroll bar on the object. \n * @param ev The event.\n */\n onscroll: (this: Document, ev: UIEvent) => any;\n /**\n * Occurs when the seek operation ends. \n * @param ev The event.\n */\n onseeked: (this: Document, ev: Event) => any;\n /**\n * Occurs when the current playback position is moved. \n * @param ev The event.\n */\n onseeking: (this: Document, ev: Event) => any;\n /**\n * Fires when the current selection changes.\n * @param ev The event.\n */\n onselect: (this: Document, ev: UIEvent) => any;\n /**\n * Fires when the selection state of a document changes.\n * @param ev The event.\n */\n onselectionchange: (this: Document, ev: Event) => any;\n onselectstart: (this: Document, ev: Event) => any;\n /**\n * Occurs when the download has stopped. \n * @param ev The event.\n */\n onstalled: (this: Document, ev: Event) => any;\n /**\n * Fires when the user clicks the Stop button or leaves the Web page.\n * @param ev The event.\n */\n onstop: (this: Document, ev: Event) => any;\n onsubmit: (this: Document, ev: Event) => any;\n /**\n * Occurs if the load operation has been intentionally halted. \n * @param ev The event.\n */\n onsuspend: (this: Document, ev: Event) => any;\n /**\n * Occurs to indicate the current playback position.\n * @param ev The event.\n */\n ontimeupdate: (this: Document, ev: Event) => any;\n ontouchcancel: (ev: TouchEvent) => any;\n ontouchend: (ev: TouchEvent) => any;\n ontouchmove: (ev: TouchEvent) => any;\n ontouchstart: (ev: TouchEvent) => any;\n /**\n * Occurs when the volume is changed, or playback is muted or unmuted.\n * @param ev The event.\n */\n onvolumechange: (this: Document, ev: Event) => any;\n /**\n * Occurs when playback stops because the next frame of a video resource is not available. \n * @param ev The event.\n */\n onwaiting: (this: Document, ev: Event) => any;\n onwebkitfullscreenchange: (this: Document, ev: Event) => any;\n onwebkitfullscreenerror: (this: Document, ev: Event) => any;\n plugins: HTMLCollectionOf;\n readonly pointerLockElement: Element;\n /**\n * Retrieves a value that indicates the current state of the object.\n */\n readonly readyState: string;\n /**\n * Gets the URL of the location that referred the user to the current page.\n */\n readonly referrer: string;\n /**\n * Gets the root svg element in the document hierarchy.\n */\n readonly rootElement: SVGSVGElement;\n /**\n * Retrieves a collection of all script objects in the document.\n */\n scripts: HTMLCollectionOf;\n readonly scrollingElement: Element | null;\n /**\n * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document.\n */\n readonly styleSheets: StyleSheetList;\n /**\n * Contains the title of the document.\n */\n title: string;\n readonly visibilityState: string;\n /** \n * Sets or gets the color of the links that the user has visited.\n */\n vlinkColor: string;\n readonly webkitCurrentFullScreenElement: Element | null;\n readonly webkitFullscreenElement: Element | null;\n readonly webkitFullscreenEnabled: boolean;\n readonly webkitIsFullScreen: boolean;\n readonly xmlEncoding: string | null;\n xmlStandalone: boolean;\n /**\n * Gets or sets the version attribute specified in the declaration of an XML document.\n */\n xmlVersion: string | null;\n adoptNode(source: Node): Node;\n captureEvents(): void;\n caretRangeFromPoint(x: number, y: number): Range;\n clear(): void;\n /**\n * Closes an output stream and forces the sent data to display.\n */\n close(): void;\n /**\n * Creates an attribute object with a specified name.\n * @param name String that sets the attribute object's name.\n */\n createAttribute(name: string): Attr;\n createAttributeNS(namespaceURI: string | null, qualifiedName: string): Attr;\n createCDATASection(data: string): CDATASection;\n /**\n * Creates a comment object with the specified data.\n * @param data Sets the comment object's data.\n */\n createComment(data: string): Comment;\n /**\n * Creates a new document.\n */\n createDocumentFragment(): DocumentFragment;\n /**\n * Creates an instance of the element for the specified tag.\n * @param tagName The name of an element.\n */\n createElement(tagName: K): HTMLElementTagNameMap[K];\n createElement(tagName: string): HTMLElement;\n createElementNS(namespaceURI: \"http://www.w3.org/1999/xhtml\", qualifiedName: string): HTMLElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"a\"): SVGAElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"circle\"): SVGCircleElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"clipPath\"): SVGClipPathElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"componentTransferFunction\"): SVGComponentTransferFunctionElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"defs\"): SVGDefsElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"desc\"): SVGDescElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"ellipse\"): SVGEllipseElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feBlend\"): SVGFEBlendElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feColorMatrix\"): SVGFEColorMatrixElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feComponentTransfer\"): SVGFEComponentTransferElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feComposite\"): SVGFECompositeElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feConvolveMatrix\"): SVGFEConvolveMatrixElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feDiffuseLighting\"): SVGFEDiffuseLightingElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feDisplacementMap\"): SVGFEDisplacementMapElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feDistantLight\"): SVGFEDistantLightElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feFlood\"): SVGFEFloodElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feFuncA\"): SVGFEFuncAElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feFuncB\"): SVGFEFuncBElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feFuncG\"): SVGFEFuncGElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feFuncR\"): SVGFEFuncRElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feGaussianBlur\"): SVGFEGaussianBlurElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feImage\"): SVGFEImageElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feMerge\"): SVGFEMergeElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feMergeNode\"): SVGFEMergeNodeElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feMorphology\"): SVGFEMorphologyElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feOffset\"): SVGFEOffsetElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"fePointLight\"): SVGFEPointLightElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feSpecularLighting\"): SVGFESpecularLightingElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feSpotLight\"): SVGFESpotLightElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feTile\"): SVGFETileElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"feTurbulence\"): SVGFETurbulenceElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"filter\"): SVGFilterElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"foreignObject\"): SVGForeignObjectElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"g\"): SVGGElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"image\"): SVGImageElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"gradient\"): SVGGradientElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"line\"): SVGLineElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"linearGradient\"): SVGLinearGradientElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"marker\"): SVGMarkerElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"mask\"): SVGMaskElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"path\"): SVGPathElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"metadata\"): SVGMetadataElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"pattern\"): SVGPatternElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"polygon\"): SVGPolygonElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"polyline\"): SVGPolylineElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"radialGradient\"): SVGRadialGradientElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"rect\"): SVGRectElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"svg\"): SVGSVGElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"script\"): SVGScriptElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"stop\"): SVGStopElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"style\"): SVGStyleElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"switch\"): SVGSwitchElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"symbol\"): SVGSymbolElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"tspan\"): SVGTSpanElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"textContent\"): SVGTextContentElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"text\"): SVGTextElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"textPath\"): SVGTextPathElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"textPositioning\"): SVGTextPositioningElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"title\"): SVGTitleElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"use\"): SVGUseElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: \"view\"): SVGViewElement\n createElementNS(namespaceURI: \"http://www.w3.org/2000/svg\", qualifiedName: string): SVGElement\n createElementNS(namespaceURI: string | null, qualifiedName: string): Element;\n createExpression(expression: string, resolver: XPathNSResolver): XPathExpression;\n createNSResolver(nodeResolver: Node): XPathNSResolver;\n /**\n * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. \n * @param root The root element or node to start traversing on.\n * @param whatToShow The type of nodes or elements to appear in the node list\n * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter.\n * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded.\n */\n createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): NodeIterator;\n createProcessingInstruction(target: string, data: string): ProcessingInstruction;\n /**\n * Returns an empty range object that has both of its boundary points positioned at the beginning of the document. \n */\n createRange(): Range;\n /**\n * Creates a text string from the specified value. \n * @param data String that specifies the nodeValue property of the text node.\n */\n createTextNode(data: string): Text;\n createTouch(view: Window, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch;\n createTouchList(...touches: Touch[]): TouchList;\n /**\n * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document.\n * @param root The root element or node to start traversing on.\n * @param whatToShow The type of nodes or elements to appear in the node list. For more information, see whatToShow.\n * @param filter A custom NodeFilter function to use.\n * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded.\n */\n createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): TreeWalker;\n /**\n * Returns the element for the specified x coordinate and the specified y coordinate. \n * @param x The x-offset\n * @param y The y-offset\n */\n elementFromPoint(x: number, y: number): Element;\n evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult;\n /**\n * Executes a command on the current document, current selection, or the given range.\n * @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script.\n * @param showUI Display the user interface, defaults to false.\n * @param value Value to assign.\n */\n execCommand(commandId: string, showUI?: boolean, value?: any): boolean;\n /**\n * Displays help information for the given command identifier.\n * @param commandId Displays help information for the given command identifier.\n */\n execCommandShowHelp(commandId: string): boolean;\n exitFullscreen(): void;\n exitPointerLock(): void;\n /**\n * Causes the element to receive the focus and executes the code specified by the onfocus event.\n */\n focus(): void;\n /**\n * Returns a reference to the first object with the specified value of the ID or NAME attribute.\n * @param elementId String that specifies the ID value. Case-insensitive.\n */\n getElementById(elementId: string): HTMLElement | null;\n getElementsByClassName(classNames: string): HTMLCollectionOf;\n /**\n * Gets a collection of objects based on the value of the NAME or ID attribute.\n * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute.\n */\n getElementsByName(elementName: string): NodeListOf;\n /**\n * Retrieves a collection of objects based on the specified element name.\n * @param name Specifies the name of an element.\n */\n getElementsByTagName(tagname: K): ElementListTagNameMap[K];\n getElementsByTagName(tagname: string): NodeListOf;\n getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/1999/xhtml\", localName: string): HTMLCollectionOf;\n getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/2000/svg\", localName: string): HTMLCollectionOf;\n getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf;\n /**\n * Returns an object representing the current selection of the document that is loaded into the object displaying a webpage.\n */\n getSelection(): Selection;\n /**\n * Gets a value indicating whether the object currently has focus.\n */\n hasFocus(): boolean;\n importNode(importedNode: Node, deep: boolean): Node;\n msElementsFromPoint(x: number, y: number): NodeListOf;\n msElementsFromRect(left: number, top: number, width: number, height: number): NodeListOf;\n /**\n * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method.\n * @param url Specifies a MIME type for the document.\n * @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element.\n * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, \"fullscreen=yes, toolbar=yes\"). The following values are supported.\n * @param replace Specifies whether the existing entry for the document is replaced in the history list.\n */\n open(url?: string, name?: string, features?: string, replace?: boolean): Document;\n /** \n * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document.\n * @param commandId Specifies a command identifier.\n */\n queryCommandEnabled(commandId: string): boolean;\n /**\n * Returns a Boolean value that indicates whether the specified command is in the indeterminate state.\n * @param commandId String that specifies a command identifier.\n */\n queryCommandIndeterm(commandId: string): boolean;\n /**\n * Returns a Boolean value that indicates the current state of the command.\n * @param commandId String that specifies a command identifier.\n */\n queryCommandState(commandId: string): boolean;\n /**\n * Returns a Boolean value that indicates whether the current command is supported on the current range.\n * @param commandId Specifies a command identifier.\n */\n queryCommandSupported(commandId: string): boolean;\n /**\n * Retrieves the string associated with a command.\n * @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers. \n */\n queryCommandText(commandId: string): string;\n /**\n * Returns the current value of the document, range, or current selection for the given command.\n * @param commandId String that specifies a command identifier.\n */\n queryCommandValue(commandId: string): string;\n releaseEvents(): void;\n /**\n * Allows updating the print settings for the page.\n */\n updateSettings(): void;\n webkitCancelFullScreen(): void;\n webkitExitFullscreen(): void;\n /**\n * Writes one or more HTML expressions to a document in the specified window. \n * @param content Specifies the text and HTML tags to write.\n */\n write(...content: string[]): void;\n /**\n * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. \n * @param content The text and HTML tags to write.\n */\n writeln(...content: string[]): void;\n addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var Document: {\n prototype: Document;\n new(): Document;\n}\n\ninterface DocumentFragment extends Node, NodeSelector, ParentNode {\n}\n\ndeclare var DocumentFragment: {\n prototype: DocumentFragment;\n new(): DocumentFragment;\n}\n\ninterface DocumentType extends Node, ChildNode {\n readonly entities: NamedNodeMap;\n readonly internalSubset: string | null;\n readonly name: string;\n readonly notations: NamedNodeMap;\n readonly publicId: string | null;\n readonly systemId: string | null;\n}\n\ndeclare var DocumentType: {\n prototype: DocumentType;\n new(): DocumentType;\n}\n\ninterface DragEvent extends MouseEvent {\n readonly dataTransfer: DataTransfer;\n initDragEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, dataTransferArg: DataTransfer): void;\n msConvertURL(file: File, targetType: string, targetURL?: string): void;\n}\n\ndeclare var DragEvent: {\n prototype: DragEvent;\n new(): DragEvent;\n}\n\ninterface DynamicsCompressorNode extends AudioNode {\n readonly attack: AudioParam;\n readonly knee: AudioParam;\n readonly ratio: AudioParam;\n readonly reduction: AudioParam;\n readonly release: AudioParam;\n readonly threshold: AudioParam;\n}\n\ndeclare var DynamicsCompressorNode: {\n prototype: DynamicsCompressorNode;\n new(): DynamicsCompressorNode;\n}\n\ninterface EXT_frag_depth {\n}\n\ndeclare var EXT_frag_depth: {\n prototype: EXT_frag_depth;\n new(): EXT_frag_depth;\n}\n\ninterface EXT_texture_filter_anisotropic {\n readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number;\n readonly TEXTURE_MAX_ANISOTROPY_EXT: number;\n}\n\ndeclare var EXT_texture_filter_anisotropic: {\n prototype: EXT_texture_filter_anisotropic;\n new(): EXT_texture_filter_anisotropic;\n readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number;\n readonly TEXTURE_MAX_ANISOTROPY_EXT: number;\n}\n\ninterface ElementEventMap extends GlobalEventHandlersEventMap {\n \"ariarequest\": AriaRequestEvent;\n \"command\": CommandEvent;\n \"gotpointercapture\": PointerEvent;\n \"lostpointercapture\": PointerEvent;\n \"MSGestureChange\": MSGestureEvent;\n \"MSGestureDoubleTap\": MSGestureEvent;\n \"MSGestureEnd\": MSGestureEvent;\n \"MSGestureHold\": MSGestureEvent;\n \"MSGestureStart\": MSGestureEvent;\n \"MSGestureTap\": MSGestureEvent;\n \"MSGotPointerCapture\": MSPointerEvent;\n \"MSInertiaStart\": MSGestureEvent;\n \"MSLostPointerCapture\": MSPointerEvent;\n \"MSPointerCancel\": MSPointerEvent;\n \"MSPointerDown\": MSPointerEvent;\n \"MSPointerEnter\": MSPointerEvent;\n \"MSPointerLeave\": MSPointerEvent;\n \"MSPointerMove\": MSPointerEvent;\n \"MSPointerOut\": MSPointerEvent;\n \"MSPointerOver\": MSPointerEvent;\n \"MSPointerUp\": MSPointerEvent;\n \"touchcancel\": TouchEvent;\n \"touchend\": TouchEvent;\n \"touchmove\": TouchEvent;\n \"touchstart\": TouchEvent;\n \"webkitfullscreenchange\": Event;\n \"webkitfullscreenerror\": Event;\n}\n\ninterface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode, ParentNode {\n readonly classList: DOMTokenList;\n className: string;\n readonly clientHeight: number;\n readonly clientLeft: number;\n readonly clientTop: number;\n readonly clientWidth: number;\n id: string;\n msContentZoomFactor: number;\n readonly msRegionOverflow: string;\n onariarequest: (this: Element, ev: AriaRequestEvent) => any;\n oncommand: (this: Element, ev: CommandEvent) => any;\n ongotpointercapture: (this: Element, ev: PointerEvent) => any;\n onlostpointercapture: (this: Element, ev: PointerEvent) => any;\n onmsgesturechange: (this: Element, ev: MSGestureEvent) => any;\n onmsgesturedoubletap: (this: Element, ev: MSGestureEvent) => any;\n onmsgestureend: (this: Element, ev: MSGestureEvent) => any;\n onmsgesturehold: (this: Element, ev: MSGestureEvent) => any;\n onmsgesturestart: (this: Element, ev: MSGestureEvent) => any;\n onmsgesturetap: (this: Element, ev: MSGestureEvent) => any;\n onmsgotpointercapture: (this: Element, ev: MSPointerEvent) => any;\n onmsinertiastart: (this: Element, ev: MSGestureEvent) => any;\n onmslostpointercapture: (this: Element, ev: MSPointerEvent) => any;\n onmspointercancel: (this: Element, ev: MSPointerEvent) => any;\n onmspointerdown: (this: Element, ev: MSPointerEvent) => any;\n onmspointerenter: (this: Element, ev: MSPointerEvent) => any;\n onmspointerleave: (this: Element, ev: MSPointerEvent) => any;\n onmspointermove: (this: Element, ev: MSPointerEvent) => any;\n onmspointerout: (this: Element, ev: MSPointerEvent) => any;\n onmspointerover: (this: Element, ev: MSPointerEvent) => any;\n onmspointerup: (this: Element, ev: MSPointerEvent) => any;\n ontouchcancel: (ev: TouchEvent) => any;\n ontouchend: (ev: TouchEvent) => any;\n ontouchmove: (ev: TouchEvent) => any;\n ontouchstart: (ev: TouchEvent) => any;\n onwebkitfullscreenchange: (this: Element, ev: Event) => any;\n onwebkitfullscreenerror: (this: Element, ev: Event) => any;\n readonly prefix: string | null;\n readonly scrollHeight: number;\n scrollLeft: number;\n scrollTop: number;\n readonly scrollWidth: number;\n readonly tagName: string;\n innerHTML: string;\n readonly assignedSlot: HTMLSlotElement | null;\n slot: string;\n readonly shadowRoot: ShadowRoot | null;\n getAttribute(name: string): string | null;\n getAttributeNS(namespaceURI: string, localName: string): string;\n getAttributeNode(name: string): Attr;\n getAttributeNodeNS(namespaceURI: string, localName: string): Attr;\n getBoundingClientRect(): ClientRect;\n getClientRects(): ClientRectList;\n getElementsByTagName(name: K): ElementListTagNameMap[K];\n getElementsByTagName(name: string): NodeListOf;\n getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/1999/xhtml\", localName: string): HTMLCollectionOf;\n getElementsByTagNameNS(namespaceURI: \"http://www.w3.org/2000/svg\", localName: string): HTMLCollectionOf;\n getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf;\n hasAttribute(name: string): boolean;\n hasAttributeNS(namespaceURI: string, localName: string): boolean;\n msGetRegionContent(): MSRangeCollection;\n msGetUntransformedBounds(): ClientRect;\n msMatchesSelector(selectors: string): boolean;\n msReleasePointerCapture(pointerId: number): void;\n msSetPointerCapture(pointerId: number): void;\n msZoomTo(args: MsZoomToOptions): void;\n releasePointerCapture(pointerId: number): void;\n removeAttribute(name?: string): void;\n removeAttributeNS(namespaceURI: string, localName: string): void;\n removeAttributeNode(oldAttr: Attr): Attr;\n requestFullscreen(): void;\n requestPointerLock(): void;\n setAttribute(name: string, value: string): void;\n setAttributeNS(namespaceURI: string, qualifiedName: string, value: string): void;\n setAttributeNode(newAttr: Attr): Attr;\n setAttributeNodeNS(newAttr: Attr): Attr;\n setPointerCapture(pointerId: number): void;\n webkitMatchesSelector(selectors: string): boolean;\n webkitRequestFullScreen(): void;\n webkitRequestFullscreen(): void;\n getElementsByClassName(classNames: string): NodeListOf;\n matches(selector: string): boolean;\n closest(selector: string): Element | null;\n scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;\n scroll(options?: ScrollToOptions): void;\n scroll(x: number, y: number): void;\n scrollTo(options?: ScrollToOptions): void;\n scrollTo(x: number, y: number): void;\n scrollBy(options?: ScrollToOptions): void;\n scrollBy(x: number, y: number): void;\n insertAdjacentElement(position: string, insertedElement: Element): Element | null;\n insertAdjacentHTML(where: string, html: string): void;\n insertAdjacentText(where: string, text: string): void;\n attachShadow(shadowRootInitDict: ShadowRootInit): ShadowRoot;\n addEventListener(type: K, listener: (this: Element, ev: ElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var Element: {\n prototype: Element;\n new(): Element;\n}\n\ninterface ErrorEvent extends Event {\n readonly colno: number;\n readonly error: any;\n readonly filename: string;\n readonly lineno: number;\n readonly message: string;\n initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void;\n}\n\ndeclare var ErrorEvent: {\n prototype: ErrorEvent;\n new(): ErrorEvent;\n}\n\ninterface Event {\n readonly bubbles: boolean;\n cancelBubble: boolean;\n readonly cancelable: boolean;\n readonly currentTarget: EventTarget;\n readonly defaultPrevented: boolean;\n readonly eventPhase: number;\n readonly isTrusted: boolean;\n returnValue: boolean;\n readonly srcElement: Element | null;\n readonly target: EventTarget;\n readonly timeStamp: number;\n readonly type: string;\n readonly scoped: boolean;\n initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void;\n preventDefault(): void;\n stopImmediatePropagation(): void;\n stopPropagation(): void;\n deepPath(): EventTarget[];\n readonly AT_TARGET: number;\n readonly BUBBLING_PHASE: number;\n readonly CAPTURING_PHASE: number;\n}\n\ndeclare var Event: {\n prototype: Event;\n new(type: string, eventInitDict?: EventInit): Event;\n readonly AT_TARGET: number;\n readonly BUBBLING_PHASE: number;\n readonly CAPTURING_PHASE: number;\n}\n\ninterface EventTarget {\n addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n dispatchEvent(evt: Event): boolean;\n removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var EventTarget: {\n prototype: EventTarget;\n new(): EventTarget;\n}\n\ninterface External {\n}\n\ndeclare var External: {\n prototype: External;\n new(): External;\n}\n\ninterface File extends Blob {\n readonly lastModifiedDate: any;\n readonly name: string;\n readonly webkitRelativePath: string;\n}\n\ndeclare var File: {\n prototype: File;\n new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File;\n}\n\ninterface FileList {\n readonly length: number;\n item(index: number): File;\n [index: number]: File;\n}\n\ndeclare var FileList: {\n prototype: FileList;\n new(): FileList;\n}\n\ninterface FileReader extends EventTarget, MSBaseReader {\n readonly error: DOMError;\n readAsArrayBuffer(blob: Blob): void;\n readAsBinaryString(blob: Blob): void;\n readAsDataURL(blob: Blob): void;\n readAsText(blob: Blob, encoding?: string): void;\n addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var FileReader: {\n prototype: FileReader;\n new(): FileReader;\n}\n\ninterface FocusEvent extends UIEvent {\n readonly relatedTarget: EventTarget;\n initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void;\n}\n\ndeclare var FocusEvent: {\n prototype: FocusEvent;\n new(typeArg: string, eventInitDict?: FocusEventInit): FocusEvent;\n}\n\ninterface FormData {\n append(name: any, value: any, blobName?: string): void;\n}\n\ndeclare var FormData: {\n prototype: FormData;\n new (form?: HTMLFormElement): FormData;\n}\n\ninterface GainNode extends AudioNode {\n readonly gain: AudioParam;\n}\n\ndeclare var GainNode: {\n prototype: GainNode;\n new(): GainNode;\n}\n\ninterface Gamepad {\n readonly axes: number[];\n readonly buttons: GamepadButton[];\n readonly connected: boolean;\n readonly id: string;\n readonly index: number;\n readonly mapping: string;\n readonly timestamp: number;\n}\n\ndeclare var Gamepad: {\n prototype: Gamepad;\n new(): Gamepad;\n}\n\ninterface GamepadButton {\n readonly pressed: boolean;\n readonly value: number;\n}\n\ndeclare var GamepadButton: {\n prototype: GamepadButton;\n new(): GamepadButton;\n}\n\ninterface GamepadEvent extends Event {\n readonly gamepad: Gamepad;\n}\n\ndeclare var GamepadEvent: {\n prototype: GamepadEvent;\n new(): GamepadEvent;\n}\n\ninterface Geolocation {\n clearWatch(watchId: number): void;\n getCurrentPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): void;\n watchPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): number;\n}\n\ndeclare var Geolocation: {\n prototype: Geolocation;\n new(): Geolocation;\n}\n\ninterface HTMLAllCollection extends HTMLCollection {\n namedItem(name: string): Element;\n}\n\ndeclare var HTMLAllCollection: {\n prototype: HTMLAllCollection;\n new(): HTMLAllCollection;\n}\n\ninterface HTMLAnchorElement extends HTMLElement {\n Methods: string;\n /**\n * Sets or retrieves the character set used to encode the object.\n */\n charset: string;\n /**\n * Sets or retrieves the coordinates of the object.\n */\n coords: string;\n download: string;\n /**\n * Contains the anchor portion of the URL including the hash sign (#).\n */\n hash: string;\n /**\n * Contains the hostname and port values of the URL.\n */\n host: string;\n /**\n * Contains the hostname of a URL.\n */\n hostname: string;\n /**\n * Sets or retrieves a destination URL or an anchor point.\n */\n href: string;\n /**\n * Sets or retrieves the language code of the object.\n */\n hreflang: string;\n readonly mimeType: string;\n /**\n * Sets or retrieves the shape of the object.\n */\n name: string;\n readonly nameProp: string;\n /**\n * Contains the pathname of the URL.\n */\n pathname: string;\n /**\n * Sets or retrieves the port number associated with a URL.\n */\n port: string;\n /**\n * Contains the protocol of the URL.\n */\n protocol: string;\n readonly protocolLong: string;\n /**\n * Sets or retrieves the relationship between the object and the destination of the link.\n */\n rel: string;\n /**\n * Sets or retrieves the relationship between the object and the destination of the link.\n */\n rev: string;\n /**\n * Sets or retrieves the substring of the href property that follows the question mark.\n */\n search: string;\n /**\n * Sets or retrieves the shape of the object.\n */\n shape: string;\n /**\n * Sets or retrieves the window or frame at which to target content.\n */\n target: string;\n /**\n * Retrieves or sets the text of the object as a string. \n */\n text: string;\n type: string;\n urn: string;\n /** \n * Returns a string representation of an object.\n */\n toString(): string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLAnchorElement: {\n prototype: HTMLAnchorElement;\n new(): HTMLAnchorElement;\n}\n\ninterface HTMLAppletElement extends HTMLElement {\n /**\n * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element.\n */\n readonly BaseHref: string;\n align: string;\n /**\n * Sets or retrieves a text alternative to the graphic.\n */\n alt: string;\n /**\n * Gets or sets the optional alternative HTML script to execute if the object fails to load.\n */\n altHtml: string;\n /**\n * Sets or retrieves a character string that can be used to implement your own archive functionality for the object.\n */\n archive: string;\n border: string;\n code: string;\n /**\n * Sets or retrieves the URL of the component.\n */\n codeBase: string;\n /**\n * Sets or retrieves the Internet media type for the code associated with the object.\n */\n codeType: string;\n /**\n * Address of a pointer to the document this page or frame contains. If there is no document, then null will be returned.\n */\n readonly contentDocument: Document;\n /**\n * Sets or retrieves the URL that references the data of the object.\n */\n data: string;\n /**\n * Sets or retrieves a character string that can be used to implement your own declare functionality for the object.\n */\n declare: boolean;\n readonly form: HTMLFormElement;\n /**\n * Sets or retrieves the height of the object.\n */\n height: string;\n hspace: number;\n /**\n * Sets or retrieves the shape of the object.\n */\n name: string;\n object: string | null;\n /**\n * Sets or retrieves a message to be displayed while an object is loading.\n */\n standby: string;\n /**\n * Returns the content type of the object.\n */\n type: string;\n /**\n * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map.\n */\n useMap: string;\n vspace: number;\n width: number;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLAppletElement: {\n prototype: HTMLAppletElement;\n new(): HTMLAppletElement;\n}\n\ninterface HTMLAreaElement extends HTMLElement {\n /**\n * Sets or retrieves a text alternative to the graphic.\n */\n alt: string;\n /**\n * Sets or retrieves the coordinates of the object.\n */\n coords: string;\n download: string;\n /**\n * Sets or retrieves the subsection of the href property that follows the number sign (#).\n */\n hash: string;\n /**\n * Sets or retrieves the hostname and port number of the location or URL.\n */\n host: string;\n /**\n * Sets or retrieves the host name part of the location or URL. \n */\n hostname: string;\n /**\n * Sets or retrieves a destination URL or an anchor point.\n */\n href: string;\n /**\n * Sets or gets whether clicks in this region cause action.\n */\n noHref: boolean;\n /**\n * Sets or retrieves the file name or path specified by the object.\n */\n pathname: string;\n /**\n * Sets or retrieves the port number associated with a URL.\n */\n port: string;\n /**\n * Sets or retrieves the protocol portion of a URL.\n */\n protocol: string;\n rel: string;\n /**\n * Sets or retrieves the substring of the href property that follows the question mark.\n */\n search: string;\n /**\n * Sets or retrieves the shape of the object.\n */\n shape: string;\n /**\n * Sets or retrieves the window or frame at which to target content.\n */\n target: string;\n /** \n * Returns a string representation of an object.\n */\n toString(): string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLAreaElement: {\n prototype: HTMLAreaElement;\n new(): HTMLAreaElement;\n}\n\ninterface HTMLAreasCollection extends HTMLCollection {\n /**\n * Adds an element to the areas, controlRange, or options collection.\n */\n add(element: HTMLElement, before?: HTMLElement | number): void;\n /**\n * Removes an element from the collection.\n */\n remove(index?: number): void;\n}\n\ndeclare var HTMLAreasCollection: {\n prototype: HTMLAreasCollection;\n new(): HTMLAreasCollection;\n}\n\ninterface HTMLAudioElement extends HTMLMediaElement {\n addEventListener(type: K, listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLAudioElement: {\n prototype: HTMLAudioElement;\n new(): HTMLAudioElement;\n}\n\ninterface HTMLBRElement extends HTMLElement {\n /**\n * Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document.\n */\n clear: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLBRElement: {\n prototype: HTMLBRElement;\n new(): HTMLBRElement;\n}\n\ninterface HTMLBaseElement extends HTMLElement {\n /**\n * Gets or sets the baseline URL on which relative links are based.\n */\n href: string;\n /**\n * Sets or retrieves the window or frame at which to target content.\n */\n target: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLBaseElement: {\n prototype: HTMLBaseElement;\n new(): HTMLBaseElement;\n}\n\ninterface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedColorProperty {\n /**\n * Sets or retrieves the current typeface family.\n */\n face: string;\n /**\n * Sets or retrieves the font size of the object.\n */\n size: number;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLBaseFontElement: {\n prototype: HTMLBaseFontElement;\n new(): HTMLBaseFontElement;\n}\n\ninterface HTMLBodyElementEventMap extends HTMLElementEventMap {\n \"afterprint\": Event;\n \"beforeprint\": Event;\n \"beforeunload\": BeforeUnloadEvent;\n \"blur\": FocusEvent;\n \"error\": ErrorEvent;\n \"focus\": FocusEvent;\n \"hashchange\": HashChangeEvent;\n \"load\": Event;\n \"message\": MessageEvent;\n \"offline\": Event;\n \"online\": Event;\n \"orientationchange\": Event;\n \"pagehide\": PageTransitionEvent;\n \"pageshow\": PageTransitionEvent;\n \"popstate\": PopStateEvent;\n \"resize\": UIEvent;\n \"storage\": StorageEvent;\n \"unload\": Event;\n}\n\ninterface HTMLBodyElement extends HTMLElement {\n aLink: any;\n background: string;\n bgColor: any;\n bgProperties: string;\n link: any;\n noWrap: boolean;\n onafterprint: (this: HTMLBodyElement, ev: Event) => any;\n onbeforeprint: (this: HTMLBodyElement, ev: Event) => any;\n onbeforeunload: (this: HTMLBodyElement, ev: BeforeUnloadEvent) => any;\n onblur: (this: HTMLBodyElement, ev: FocusEvent) => any;\n onerror: (this: HTMLBodyElement, ev: ErrorEvent) => any;\n onfocus: (this: HTMLBodyElement, ev: FocusEvent) => any;\n onhashchange: (this: HTMLBodyElement, ev: HashChangeEvent) => any;\n onload: (this: HTMLBodyElement, ev: Event) => any;\n onmessage: (this: HTMLBodyElement, ev: MessageEvent) => any;\n onoffline: (this: HTMLBodyElement, ev: Event) => any;\n ononline: (this: HTMLBodyElement, ev: Event) => any;\n onorientationchange: (this: HTMLBodyElement, ev: Event) => any;\n onpagehide: (this: HTMLBodyElement, ev: PageTransitionEvent) => any;\n onpageshow: (this: HTMLBodyElement, ev: PageTransitionEvent) => any;\n onpopstate: (this: HTMLBodyElement, ev: PopStateEvent) => any;\n onresize: (this: HTMLBodyElement, ev: UIEvent) => any;\n onstorage: (this: HTMLBodyElement, ev: StorageEvent) => any;\n onunload: (this: HTMLBodyElement, ev: Event) => any;\n text: any;\n vLink: any;\n addEventListener(type: K, listener: (this: HTMLBodyElement, ev: HTMLBodyElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLBodyElement: {\n prototype: HTMLBodyElement;\n new(): HTMLBodyElement;\n}\n\ninterface HTMLButtonElement extends HTMLElement {\n /**\n * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing.\n */\n autofocus: boolean;\n disabled: boolean;\n /**\n * Retrieves a reference to the form that the object is embedded in.\n */\n readonly form: HTMLFormElement;\n /**\n * Overrides the action attribute (where the data on a form is sent) on the parent form element.\n */\n formAction: string;\n /**\n * Used to override the encoding (formEnctype attribute) specified on the form element.\n */\n formEnctype: string;\n /**\n * Overrides the submit method attribute previously specified on a form element.\n */\n formMethod: string;\n /**\n * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a \"save draft\"-type submit option.\n */\n formNoValidate: string;\n /**\n * Overrides the target attribute on a form element.\n */\n formTarget: string;\n /** \n * Sets or retrieves the name of the object.\n */\n name: string;\n status: any;\n /**\n * Gets the classification and default behavior of the button.\n */\n type: string;\n /**\n * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\n */\n readonly validationMessage: string;\n /**\n * Returns a ValidityState object that represents the validity states of an element.\n */\n readonly validity: ValidityState;\n /** \n * Sets or retrieves the default or selected value of the control.\n */\n value: string;\n /**\n * Returns whether an element will successfully validate based on forms validation rules and constraints.\n */\n readonly willValidate: boolean;\n /**\n * Returns whether a form will validate when it is submitted, without having to submit it.\n */\n checkValidity(): boolean;\n /**\n * Sets a custom error message that is displayed when a form is submitted.\n * @param error Sets a custom error message that is displayed when a form is submitted.\n */\n setCustomValidity(error: string): void;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLButtonElement: {\n prototype: HTMLButtonElement;\n new(): HTMLButtonElement;\n}\n\ninterface HTMLCanvasElement extends HTMLElement {\n /**\n * Gets or sets the height of a canvas element on a document.\n */\n height: number;\n /**\n * Gets or sets the width of a canvas element on a document.\n */\n width: number;\n /**\n * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas.\n * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext(\"2d\"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext(\"experimental-webgl\");\n */\n getContext(contextId: \"2d\", contextAttributes?: Canvas2DContextAttributes): CanvasRenderingContext2D | null;\n getContext(contextId: \"webgl\" | \"experimental-webgl\", contextAttributes?: WebGLContextAttributes): WebGLRenderingContext | null;\n getContext(contextId: string, contextAttributes?: {}): CanvasRenderingContext2D | WebGLRenderingContext | null;\n /**\n * Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing.\n */\n msToBlob(): Blob;\n /**\n * Returns the content of the current canvas as an image that you can use as a source for another canvas or an HTML element.\n * @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image.\n */\n toDataURL(type?: string, ...args: any[]): string;\n toBlob(callback: (result: Blob | null) => void, type?: string, ...arguments: any[]): void;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLCanvasElement: {\n prototype: HTMLCanvasElement;\n new(): HTMLCanvasElement;\n}\n\ninterface HTMLCollection {\n /**\n * Sets or retrieves the number of objects in a collection.\n */\n readonly length: number;\n /**\n * Retrieves an object from various collections.\n */\n item(index: number): Element;\n /**\n * Retrieves a select object or an object from an options collection.\n */\n namedItem(name: string): Element;\n [index: number]: Element;\n}\n\ndeclare var HTMLCollection: {\n prototype: HTMLCollection;\n new(): HTMLCollection;\n}\n\ninterface HTMLDListElement extends HTMLElement {\n compact: boolean;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLDListElement: {\n prototype: HTMLDListElement;\n new(): HTMLDListElement;\n}\n\ninterface HTMLDataListElement extends HTMLElement {\n options: HTMLCollectionOf;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLDataListElement: {\n prototype: HTMLDataListElement;\n new(): HTMLDataListElement;\n}\n\ninterface HTMLDirectoryElement extends HTMLElement {\n compact: boolean;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLDirectoryElement: {\n prototype: HTMLDirectoryElement;\n new(): HTMLDirectoryElement;\n}\n\ninterface HTMLDivElement extends HTMLElement {\n /**\n * Sets or retrieves how the object is aligned with adjacent text. \n */\n align: string;\n /**\n * Sets or retrieves whether the browser automatically performs wordwrap.\n */\n noWrap: boolean;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLDivElement: {\n prototype: HTMLDivElement;\n new(): HTMLDivElement;\n}\n\ninterface HTMLDocument extends Document {\n addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLDocument: {\n prototype: HTMLDocument;\n new(): HTMLDocument;\n}\n\ninterface HTMLElementEventMap extends ElementEventMap {\n \"abort\": UIEvent;\n \"activate\": UIEvent;\n \"beforeactivate\": UIEvent;\n \"beforecopy\": ClipboardEvent;\n \"beforecut\": ClipboardEvent;\n \"beforedeactivate\": UIEvent;\n \"beforepaste\": ClipboardEvent;\n \"blur\": FocusEvent;\n \"canplay\": Event;\n \"canplaythrough\": Event;\n \"change\": Event;\n \"click\": MouseEvent;\n \"contextmenu\": PointerEvent;\n \"copy\": ClipboardEvent;\n \"cuechange\": Event;\n \"cut\": ClipboardEvent;\n \"dblclick\": MouseEvent;\n \"deactivate\": UIEvent;\n \"drag\": DragEvent;\n \"dragend\": DragEvent;\n \"dragenter\": DragEvent;\n \"dragleave\": DragEvent;\n \"dragover\": DragEvent;\n \"dragstart\": DragEvent;\n \"drop\": DragEvent;\n \"durationchange\": Event;\n \"emptied\": Event;\n \"ended\": MediaStreamErrorEvent;\n \"error\": ErrorEvent;\n \"focus\": FocusEvent;\n \"input\": Event;\n \"invalid\": Event;\n \"keydown\": KeyboardEvent;\n \"keypress\": KeyboardEvent;\n \"keyup\": KeyboardEvent;\n \"load\": Event;\n \"loadeddata\": Event;\n \"loadedmetadata\": Event;\n \"loadstart\": Event;\n \"mousedown\": MouseEvent;\n \"mouseenter\": MouseEvent;\n \"mouseleave\": MouseEvent;\n \"mousemove\": MouseEvent;\n \"mouseout\": MouseEvent;\n \"mouseover\": MouseEvent;\n \"mouseup\": MouseEvent;\n \"mousewheel\": WheelEvent;\n \"MSContentZoom\": UIEvent;\n \"MSManipulationStateChanged\": MSManipulationEvent;\n \"paste\": ClipboardEvent;\n \"pause\": Event;\n \"play\": Event;\n \"playing\": Event;\n \"progress\": ProgressEvent;\n \"ratechange\": Event;\n \"reset\": Event;\n \"scroll\": UIEvent;\n \"seeked\": Event;\n \"seeking\": Event;\n \"select\": UIEvent;\n \"selectstart\": Event;\n \"stalled\": Event;\n \"submit\": Event;\n \"suspend\": Event;\n \"timeupdate\": Event;\n \"volumechange\": Event;\n \"waiting\": Event;\n}\n\ninterface HTMLElement extends Element {\n accessKey: string;\n readonly children: HTMLCollection;\n contentEditable: string;\n readonly dataset: DOMStringMap;\n dir: string;\n draggable: boolean;\n hidden: boolean;\n hideFocus: boolean;\n innerHTML: string;\n innerText: string;\n readonly isContentEditable: boolean;\n lang: string;\n readonly offsetHeight: number;\n readonly offsetLeft: number;\n readonly offsetParent: Element;\n readonly offsetTop: number;\n readonly offsetWidth: number;\n onabort: (this: HTMLElement, ev: UIEvent) => any;\n onactivate: (this: HTMLElement, ev: UIEvent) => any;\n onbeforeactivate: (this: HTMLElement, ev: UIEvent) => any;\n onbeforecopy: (this: HTMLElement, ev: ClipboardEvent) => any;\n onbeforecut: (this: HTMLElement, ev: ClipboardEvent) => any;\n onbeforedeactivate: (this: HTMLElement, ev: UIEvent) => any;\n onbeforepaste: (this: HTMLElement, ev: ClipboardEvent) => any;\n onblur: (this: HTMLElement, ev: FocusEvent) => any;\n oncanplay: (this: HTMLElement, ev: Event) => any;\n oncanplaythrough: (this: HTMLElement, ev: Event) => any;\n onchange: (this: HTMLElement, ev: Event) => any;\n onclick: (this: HTMLElement, ev: MouseEvent) => any;\n oncontextmenu: (this: HTMLElement, ev: PointerEvent) => any;\n oncopy: (this: HTMLElement, ev: ClipboardEvent) => any;\n oncuechange: (this: HTMLElement, ev: Event) => any;\n oncut: (this: HTMLElement, ev: ClipboardEvent) => any;\n ondblclick: (this: HTMLElement, ev: MouseEvent) => any;\n ondeactivate: (this: HTMLElement, ev: UIEvent) => any;\n ondrag: (this: HTMLElement, ev: DragEvent) => any;\n ondragend: (this: HTMLElement, ev: DragEvent) => any;\n ondragenter: (this: HTMLElement, ev: DragEvent) => any;\n ondragleave: (this: HTMLElement, ev: DragEvent) => any;\n ondragover: (this: HTMLElement, ev: DragEvent) => any;\n ondragstart: (this: HTMLElement, ev: DragEvent) => any;\n ondrop: (this: HTMLElement, ev: DragEvent) => any;\n ondurationchange: (this: HTMLElement, ev: Event) => any;\n onemptied: (this: HTMLElement, ev: Event) => any;\n onended: (this: HTMLElement, ev: MediaStreamErrorEvent) => any;\n onerror: (this: HTMLElement, ev: ErrorEvent) => any;\n onfocus: (this: HTMLElement, ev: FocusEvent) => any;\n oninput: (this: HTMLElement, ev: Event) => any;\n oninvalid: (this: HTMLElement, ev: Event) => any;\n onkeydown: (this: HTMLElement, ev: KeyboardEvent) => any;\n onkeypress: (this: HTMLElement, ev: KeyboardEvent) => any;\n onkeyup: (this: HTMLElement, ev: KeyboardEvent) => any;\n onload: (this: HTMLElement, ev: Event) => any;\n onloadeddata: (this: HTMLElement, ev: Event) => any;\n onloadedmetadata: (this: HTMLElement, ev: Event) => any;\n onloadstart: (this: HTMLElement, ev: Event) => any;\n onmousedown: (this: HTMLElement, ev: MouseEvent) => any;\n onmouseenter: (this: HTMLElement, ev: MouseEvent) => any;\n onmouseleave: (this: HTMLElement, ev: MouseEvent) => any;\n onmousemove: (this: HTMLElement, ev: MouseEvent) => any;\n onmouseout: (this: HTMLElement, ev: MouseEvent) => any;\n onmouseover: (this: HTMLElement, ev: MouseEvent) => any;\n onmouseup: (this: HTMLElement, ev: MouseEvent) => any;\n onmousewheel: (this: HTMLElement, ev: WheelEvent) => any;\n onmscontentzoom: (this: HTMLElement, ev: UIEvent) => any;\n onmsmanipulationstatechanged: (this: HTMLElement, ev: MSManipulationEvent) => any;\n onpaste: (this: HTMLElement, ev: ClipboardEvent) => any;\n onpause: (this: HTMLElement, ev: Event) => any;\n onplay: (this: HTMLElement, ev: Event) => any;\n onplaying: (this: HTMLElement, ev: Event) => any;\n onprogress: (this: HTMLElement, ev: ProgressEvent) => any;\n onratechange: (this: HTMLElement, ev: Event) => any;\n onreset: (this: HTMLElement, ev: Event) => any;\n onscroll: (this: HTMLElement, ev: UIEvent) => any;\n onseeked: (this: HTMLElement, ev: Event) => any;\n onseeking: (this: HTMLElement, ev: Event) => any;\n onselect: (this: HTMLElement, ev: UIEvent) => any;\n onselectstart: (this: HTMLElement, ev: Event) => any;\n onstalled: (this: HTMLElement, ev: Event) => any;\n onsubmit: (this: HTMLElement, ev: Event) => any;\n onsuspend: (this: HTMLElement, ev: Event) => any;\n ontimeupdate: (this: HTMLElement, ev: Event) => any;\n onvolumechange: (this: HTMLElement, ev: Event) => any;\n onwaiting: (this: HTMLElement, ev: Event) => any;\n outerHTML: string;\n outerText: string;\n spellcheck: boolean;\n readonly style: CSSStyleDeclaration;\n tabIndex: number;\n title: string;\n blur(): void;\n click(): void;\n dragDrop(): boolean;\n focus(): void;\n msGetInputContext(): MSInputMethodContext;\n setActive(): void;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLElement: {\n prototype: HTMLElement;\n new(): HTMLElement;\n}\n\ninterface HTMLEmbedElement extends HTMLElement, GetSVGDocument {\n /**\n * Sets or retrieves the height of the object.\n */\n height: string;\n hidden: any;\n /**\n * Gets or sets whether the DLNA PlayTo device is available.\n */\n msPlayToDisabled: boolean;\n /**\n * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server.\n */\n msPlayToPreferredSourceUri: string;\n /**\n * Gets or sets the primary DLNA PlayTo device.\n */\n msPlayToPrimary: boolean;\n /**\n * Gets the source associated with the media element for use by the PlayToManager.\n */\n readonly msPlayToSource: any;\n /**\n * Sets or retrieves the name of the object.\n */\n name: string;\n /**\n * Retrieves the palette used for the embedded document.\n */\n readonly palette: string;\n /**\n * Retrieves the URL of the plug-in used to view an embedded document.\n */\n readonly pluginspage: string;\n readonly readyState: string;\n /**\n * Sets or retrieves a URL to be loaded by the object.\n */\n src: string;\n /**\n * Sets or retrieves the height and width units of the embed object.\n */\n units: string;\n /**\n * Sets or retrieves the width of the object.\n */\n width: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLEmbedElement: {\n prototype: HTMLEmbedElement;\n new(): HTMLEmbedElement;\n}\n\ninterface HTMLFieldSetElement extends HTMLElement {\n /**\n * Sets or retrieves how the object is aligned with adjacent text.\n */\n align: string;\n disabled: boolean;\n /**\n * Retrieves a reference to the form that the object is embedded in.\n */\n readonly form: HTMLFormElement;\n /**\n * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\n */\n readonly validationMessage: string;\n /**\n * Returns a ValidityState object that represents the validity states of an element.\n */\n readonly validity: ValidityState;\n /**\n * Returns whether an element will successfully validate based on forms validation rules and constraints.\n */\n readonly willValidate: boolean;\n /**\n * Returns whether a form will validate when it is submitted, without having to submit it.\n */\n checkValidity(): boolean;\n /**\n * Sets a custom error message that is displayed when a form is submitted.\n * @param error Sets a custom error message that is displayed when a form is submitted.\n */\n setCustomValidity(error: string): void;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLFieldSetElement: {\n prototype: HTMLFieldSetElement;\n new(): HTMLFieldSetElement;\n}\n\ninterface HTMLFontElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty {\n /**\n * Sets or retrieves the current typeface family.\n */\n face: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLFontElement: {\n prototype: HTMLFontElement;\n new(): HTMLFontElement;\n}\n\ninterface HTMLFormElement extends HTMLElement {\n /**\n * Sets or retrieves a list of character encodings for input data that must be accepted by the server processing the form.\n */\n acceptCharset: string;\n /**\n * Sets or retrieves the URL to which the form content is sent for processing.\n */\n action: string;\n /**\n * Specifies whether autocomplete is applied to an editable text field.\n */\n autocomplete: string;\n /**\n * Retrieves a collection, in source order, of all controls in a given form.\n */\n readonly elements: HTMLCollection;\n /**\n * Sets or retrieves the MIME encoding for the form.\n */\n encoding: string;\n /**\n * Sets or retrieves the encoding type for the form.\n */\n enctype: string;\n /**\n * Sets or retrieves the number of objects in a collection.\n */\n readonly length: number;\n /**\n * Sets or retrieves how to send the form data to the server.\n */\n method: string;\n /**\n * Sets or retrieves the name of the object.\n */\n name: string;\n /**\n * Designates a form that is not validated when submitted.\n */\n noValidate: boolean;\n /**\n * Sets or retrieves the window or frame at which to target content.\n */\n target: string;\n /**\n * Returns whether a form will validate when it is submitted, without having to submit it.\n */\n checkValidity(): boolean;\n /**\n * Retrieves a form object or an object from an elements collection.\n * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is a Number, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made.\n * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned.\n */\n item(name?: any, index?: any): any;\n /**\n * Retrieves a form object or an object from an elements collection.\n */\n namedItem(name: string): any;\n /**\n * Fires when the user resets a form.\n */\n reset(): void;\n /**\n * Fires when a FORM is about to be submitted.\n */\n submit(): void;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n [name: string]: any;\n}\n\ndeclare var HTMLFormElement: {\n prototype: HTMLFormElement;\n new(): HTMLFormElement;\n}\n\ninterface HTMLFrameElementEventMap extends HTMLElementEventMap {\n \"load\": Event;\n}\n\ninterface HTMLFrameElement extends HTMLElement, GetSVGDocument {\n /**\n * Specifies the properties of a border drawn around an object.\n */\n border: string;\n /**\n * Sets or retrieves the border color of the object.\n */\n borderColor: any;\n /**\n * Retrieves the document object of the page or frame.\n */\n readonly contentDocument: Document;\n /**\n * Retrieves the object of the specified.\n */\n readonly contentWindow: Window;\n /**\n * Sets or retrieves whether to display a border for the frame.\n */\n frameBorder: string;\n /**\n * Sets or retrieves the amount of additional space between the frames.\n */\n frameSpacing: any;\n /**\n * Sets or retrieves the height of the object.\n */\n height: string | number;\n /**\n * Sets or retrieves a URI to a long description of the object.\n */\n longDesc: string;\n /**\n * Sets or retrieves the top and bottom margin heights before displaying the text in a frame.\n */\n marginHeight: string;\n /**\n * Sets or retrieves the left and right margin widths before displaying the text in a frame.\n */\n marginWidth: string;\n /**\n * Sets or retrieves the frame name.\n */\n name: string;\n /**\n * Sets or retrieves whether the user can resize the frame.\n */\n noResize: boolean;\n /**\n * Raised when the object has been completely received from the server.\n */\n onload: (this: HTMLFrameElement, ev: Event) => any;\n /**\n * Sets or retrieves whether the frame can be scrolled.\n */\n scrolling: string;\n /**\n * Sets or retrieves a URL to be loaded by the object.\n */\n src: string;\n /**\n * Sets or retrieves the width of the object.\n */\n width: string | number;\n addEventListener(type: K, listener: (this: HTMLFrameElement, ev: HTMLFrameElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLFrameElement: {\n prototype: HTMLFrameElement;\n new(): HTMLFrameElement;\n}\n\ninterface HTMLFrameSetElementEventMap extends HTMLElementEventMap {\n \"beforeprint\": Event;\n \"beforeunload\": BeforeUnloadEvent;\n \"blur\": FocusEvent;\n \"error\": ErrorEvent;\n \"focus\": FocusEvent;\n \"hashchange\": HashChangeEvent;\n \"load\": Event;\n \"message\": MessageEvent;\n \"offline\": Event;\n \"online\": Event;\n \"orientationchange\": Event;\n \"pagehide\": PageTransitionEvent;\n \"pageshow\": PageTransitionEvent;\n \"resize\": UIEvent;\n \"storage\": StorageEvent;\n \"unload\": Event;\n}\n\ninterface HTMLFrameSetElement extends HTMLElement {\n border: string;\n /**\n * Sets or retrieves the border color of the object.\n */\n borderColor: any;\n /**\n * Sets or retrieves the frame widths of the object.\n */\n cols: string;\n /**\n * Sets or retrieves whether to display a border for the frame.\n */\n frameBorder: string;\n /**\n * Sets or retrieves the amount of additional space between the frames.\n */\n frameSpacing: any;\n name: string;\n onafterprint: (this: HTMLFrameSetElement, ev: Event) => any;\n onbeforeprint: (this: HTMLFrameSetElement, ev: Event) => any;\n onbeforeunload: (this: HTMLFrameSetElement, ev: BeforeUnloadEvent) => any;\n /**\n * Fires when the object loses the input focus.\n */\n onblur: (this: HTMLFrameSetElement, ev: FocusEvent) => any;\n onerror: (this: HTMLFrameSetElement, ev: ErrorEvent) => any;\n /**\n * Fires when the object receives focus.\n */\n onfocus: (this: HTMLFrameSetElement, ev: FocusEvent) => any;\n onhashchange: (this: HTMLFrameSetElement, ev: HashChangeEvent) => any;\n onload: (this: HTMLFrameSetElement, ev: Event) => any;\n onmessage: (this: HTMLFrameSetElement, ev: MessageEvent) => any;\n onoffline: (this: HTMLFrameSetElement, ev: Event) => any;\n ononline: (this: HTMLFrameSetElement, ev: Event) => any;\n onorientationchange: (this: HTMLFrameSetElement, ev: Event) => any;\n onpagehide: (this: HTMLFrameSetElement, ev: PageTransitionEvent) => any;\n onpageshow: (this: HTMLFrameSetElement, ev: PageTransitionEvent) => any;\n onresize: (this: HTMLFrameSetElement, ev: UIEvent) => any;\n onstorage: (this: HTMLFrameSetElement, ev: StorageEvent) => any;\n onunload: (this: HTMLFrameSetElement, ev: Event) => any;\n /**\n * Sets or retrieves the frame heights of the object.\n */\n rows: string;\n addEventListener(type: K, listener: (this: HTMLFrameSetElement, ev: HTMLFrameSetElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLFrameSetElement: {\n prototype: HTMLFrameSetElement;\n new(): HTMLFrameSetElement;\n}\n\ninterface HTMLHRElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty {\n /**\n * Sets or retrieves how the object is aligned with adjacent text.\n */\n align: string;\n /**\n * Sets or retrieves whether the horizontal rule is drawn with 3-D shading.\n */\n noShade: boolean;\n /**\n * Sets or retrieves the width of the object.\n */\n width: number;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLHRElement: {\n prototype: HTMLHRElement;\n new(): HTMLHRElement;\n}\n\ninterface HTMLHeadElement extends HTMLElement {\n profile: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLHeadElement: {\n prototype: HTMLHeadElement;\n new(): HTMLHeadElement;\n}\n\ninterface HTMLHeadingElement extends HTMLElement {\n /**\n * Sets or retrieves a value that indicates the table alignment.\n */\n align: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLHeadingElement: {\n prototype: HTMLHeadingElement;\n new(): HTMLHeadingElement;\n}\n\ninterface HTMLHtmlElement extends HTMLElement {\n /**\n * Sets or retrieves the DTD version that governs the current document.\n */\n version: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLHtmlElement: {\n prototype: HTMLHtmlElement;\n new(): HTMLHtmlElement;\n}\n\ninterface HTMLIFrameElementEventMap extends HTMLElementEventMap {\n \"load\": Event;\n}\n\ninterface HTMLIFrameElement extends HTMLElement, GetSVGDocument {\n /**\n * Sets or retrieves how the object is aligned with adjacent text.\n */\n align: string;\n allowFullscreen: boolean;\n /**\n * Specifies the properties of a border drawn around an object.\n */\n border: string;\n /**\n * Retrieves the document object of the page or frame.\n */\n readonly contentDocument: Document;\n /**\n * Retrieves the object of the specified.\n */\n readonly contentWindow: Window;\n /**\n * Sets or retrieves whether to display a border for the frame.\n */\n frameBorder: string;\n /**\n * Sets or retrieves the amount of additional space between the frames.\n */\n frameSpacing: any;\n /**\n * Sets or retrieves the height of the object.\n */\n height: string;\n /**\n * Sets or retrieves the horizontal margin for the object.\n */\n hspace: number;\n /**\n * Sets or retrieves a URI to a long description of the object.\n */\n longDesc: string;\n /**\n * Sets or retrieves the top and bottom margin heights before displaying the text in a frame.\n */\n marginHeight: string;\n /**\n * Sets or retrieves the left and right margin widths before displaying the text in a frame.\n */\n marginWidth: string;\n /**\n * Sets or retrieves the frame name.\n */\n name: string;\n /**\n * Sets or retrieves whether the user can resize the frame.\n */\n noResize: boolean;\n /**\n * Raised when the object has been completely received from the server.\n */\n onload: (this: HTMLIFrameElement, ev: Event) => any;\n readonly sandbox: DOMSettableTokenList;\n /**\n * Sets or retrieves whether the frame can be scrolled.\n */\n scrolling: string;\n /**\n * Sets or retrieves a URL to be loaded by the object.\n */\n src: string;\n /**\n * Sets or retrieves the vertical margin for the object.\n */\n vspace: number;\n /**\n * Sets or retrieves the width of the object.\n */\n width: string;\n addEventListener(type: K, listener: (this: HTMLIFrameElement, ev: HTMLIFrameElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLIFrameElement: {\n prototype: HTMLIFrameElement;\n new(): HTMLIFrameElement;\n}\n\ninterface HTMLImageElement extends HTMLElement {\n /**\n * Sets or retrieves how the object is aligned with adjacent text.\n */\n align: string;\n /**\n * Sets or retrieves a text alternative to the graphic.\n */\n alt: string;\n /**\n * Specifies the properties of a border drawn around an object.\n */\n border: string;\n /**\n * Retrieves whether the object is fully loaded.\n */\n readonly complete: boolean;\n crossOrigin: string;\n readonly currentSrc: string;\n /**\n * Sets or retrieves the height of the object.\n */\n height: number;\n /**\n * Sets or retrieves the width of the border to draw around the object.\n */\n hspace: number;\n /**\n * Sets or retrieves whether the image is a server-side image map.\n */\n isMap: boolean;\n /**\n * Sets or retrieves a Uniform Resource Identifier (URI) to a long description of the object.\n */\n longDesc: string;\n lowsrc: string;\n /**\n * Gets or sets whether the DLNA PlayTo device is available.\n */\n msPlayToDisabled: boolean;\n msPlayToPreferredSourceUri: string;\n /**\n * Gets or sets the primary DLNA PlayTo device.\n */\n msPlayToPrimary: boolean;\n /**\n * Gets the source associated with the media element for use by the PlayToManager.\n */\n readonly msPlayToSource: any;\n /**\n * Sets or retrieves the name of the object.\n */\n name: string;\n /**\n * The original height of the image resource before sizing.\n */\n readonly naturalHeight: number;\n /**\n * The original width of the image resource before sizing.\n */\n readonly naturalWidth: number;\n sizes: string;\n /**\n * The address or URL of the a media resource that is to be considered.\n */\n src: string;\n srcset: string;\n /**\n * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map.\n */\n useMap: string;\n /**\n * Sets or retrieves the vertical margin for the object.\n */\n vspace: number;\n /**\n * Sets or retrieves the width of the object.\n */\n width: number;\n readonly x: number;\n readonly y: number;\n msGetAsCastingSource(): any;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLImageElement: {\n prototype: HTMLImageElement;\n new(): HTMLImageElement;\n create(): HTMLImageElement;\n}\n\ninterface HTMLInputElement extends HTMLElement {\n /**\n * Sets or retrieves a comma-separated list of content types.\n */\n accept: string;\n /**\n * Sets or retrieves how the object is aligned with adjacent text.\n */\n align: string;\n /**\n * Sets or retrieves a text alternative to the graphic.\n */\n alt: string;\n /**\n * Specifies whether autocomplete is applied to an editable text field.\n */\n autocomplete: string;\n /**\n * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing.\n */\n autofocus: boolean;\n /**\n * Sets or retrieves the width of the border to draw around the object.\n */\n border: string;\n /**\n * Sets or retrieves the state of the check box or radio button.\n */\n checked: boolean;\n /**\n * Retrieves whether the object is fully loaded.\n */\n readonly complete: boolean;\n /**\n * Sets or retrieves the state of the check box or radio button.\n */\n defaultChecked: boolean;\n /**\n * Sets or retrieves the initial contents of the object.\n */\n defaultValue: string;\n disabled: boolean;\n /**\n * Returns a FileList object on a file type input object.\n */\n readonly files: FileList | null;\n /**\n * Retrieves a reference to the form that the object is embedded in. \n */\n readonly form: HTMLFormElement;\n /**\n * Overrides the action attribute (where the data on a form is sent) on the parent form element.\n */\n formAction: string;\n /**\n * Used to override the encoding (formEnctype attribute) specified on the form element.\n */\n formEnctype: string;\n /**\n * Overrides the submit method attribute previously specified on a form element.\n */\n formMethod: string;\n /**\n * Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a \"save draft\"-type submit option.\n */\n formNoValidate: string;\n /**\n * Overrides the target attribute on a form element.\n */\n formTarget: string;\n /**\n * Sets or retrieves the height of the object.\n */\n height: string;\n /**\n * Sets or retrieves the width of the border to draw around the object.\n */\n hspace: number;\n indeterminate: boolean;\n /**\n * Specifies the ID of a pre-defined datalist of options for an input element.\n */\n readonly list: HTMLElement;\n /**\n * Defines the maximum acceptable value for an input element with type=\"number\".When used with the min and step attributes, lets you control the range and increment (such as only even numbers) that the user can enter into an input field.\n */\n max: string;\n /**\n * Sets or retrieves the maximum number of characters that the user can enter in a text control.\n */\n maxLength: number;\n /**\n * Defines the minimum acceptable value for an input element with type=\"number\". When used with the max and step attributes, lets you control the range and increment (such as even numbers only) that the user can enter into an input field.\n */\n min: string;\n /**\n * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list.\n */\n multiple: boolean;\n /**\n * Sets or retrieves the name of the object.\n */\n name: string;\n /**\n * Gets or sets a string containing a regular expression that the user's input must match.\n */\n pattern: string;\n /**\n * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field.\n */\n placeholder: string;\n readOnly: boolean;\n /**\n * When present, marks an element that can't be submitted without a value.\n */\n required: boolean;\n selectionDirection: string;\n /**\n * Gets or sets the end position or offset of a text selection.\n */\n selectionEnd: number;\n /**\n * Gets or sets the starting position or offset of a text selection.\n */\n selectionStart: number;\n size: number;\n /**\n * The address or URL of the a media resource that is to be considered.\n */\n src: string;\n status: boolean;\n /**\n * Defines an increment or jump between values that you want to allow the user to enter. When used with the max and min attributes, lets you control the range and increment (for example, allow only even numbers) that the user can enter into an input field.\n */\n step: string;\n /**\n * Returns the content type of the object.\n */\n type: string;\n /**\n * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map.\n */\n useMap: string;\n /**\n * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\n */\n readonly validationMessage: string;\n /**\n * Returns a ValidityState object that represents the validity states of an element.\n */\n readonly validity: ValidityState;\n /**\n * Returns the value of the data at the cursor's current position.\n */\n value: string;\n valueAsDate: Date;\n /**\n * Returns the input field value as a number.\n */\n valueAsNumber: number;\n /**\n * Sets or retrieves the vertical margin for the object.\n */\n vspace: number;\n webkitdirectory: boolean;\n /**\n * Sets or retrieves the width of the object.\n */\n width: string;\n /**\n * Returns whether an element will successfully validate based on forms validation rules and constraints.\n */\n readonly willValidate: boolean;\n minLength: number;\n /**\n * Returns whether a form will validate when it is submitted, without having to submit it.\n */\n checkValidity(): boolean;\n /**\n * Makes the selection equal to the current object.\n */\n select(): void;\n /**\n * Sets a custom error message that is displayed when a form is submitted.\n * @param error Sets a custom error message that is displayed when a form is submitted.\n */\n setCustomValidity(error: string): void;\n /**\n * Sets the start and end positions of a selection in a text field.\n * @param start The offset into the text field for the start of the selection.\n * @param end The offset into the text field for the end of the selection.\n */\n setSelectionRange(start?: number, end?: number, direction?: string): void;\n /**\n * Decrements a range input control's value by the value given by the Step attribute. If the optional parameter is used, it will decrement the input control's step value multiplied by the parameter's value.\n * @param n Value to decrement the value by.\n */\n stepDown(n?: number): void;\n /**\n * Increments a range input control's value by the value given by the Step attribute. If the optional parameter is used, will increment the input control's value by that value.\n * @param n Value to increment the value by.\n */\n stepUp(n?: number): void;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLInputElement: {\n prototype: HTMLInputElement;\n new(): HTMLInputElement;\n}\n\ninterface HTMLLIElement extends HTMLElement {\n type: string;\n /**\n * Sets or retrieves the value of a list item.\n */\n value: number;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLLIElement: {\n prototype: HTMLLIElement;\n new(): HTMLLIElement;\n}\n\ninterface HTMLLabelElement extends HTMLElement {\n /**\n * Retrieves a reference to the form that the object is embedded in.\n */\n readonly form: HTMLFormElement;\n /**\n * Sets or retrieves the object to which the given label object is assigned.\n */\n htmlFor: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLLabelElement: {\n prototype: HTMLLabelElement;\n new(): HTMLLabelElement;\n}\n\ninterface HTMLLegendElement extends HTMLElement {\n /**\n * Retrieves a reference to the form that the object is embedded in.\n */\n align: string;\n /**\n * Retrieves a reference to the form that the object is embedded in.\n */\n readonly form: HTMLFormElement;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLLegendElement: {\n prototype: HTMLLegendElement;\n new(): HTMLLegendElement;\n}\n\ninterface HTMLLinkElement extends HTMLElement, LinkStyle {\n /**\n * Sets or retrieves the character set used to encode the object.\n */\n charset: string;\n disabled: boolean;\n /**\n * Sets or retrieves a destination URL or an anchor point.\n */\n href: string;\n /**\n * Sets or retrieves the language code of the object.\n */\n hreflang: string;\n /**\n * Sets or retrieves the media type.\n */\n media: string;\n /**\n * Sets or retrieves the relationship between the object and the destination of the link.\n */\n rel: string;\n /**\n * Sets or retrieves the relationship between the object and the destination of the link.\n */\n rev: string;\n /**\n * Sets or retrieves the window or frame at which to target content.\n */\n target: string;\n /**\n * Sets or retrieves the MIME type of the object.\n */\n type: string;\n import?: Document;\n integrity: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLLinkElement: {\n prototype: HTMLLinkElement;\n new(): HTMLLinkElement;\n}\n\ninterface HTMLMapElement extends HTMLElement {\n /**\n * Retrieves a collection of the area objects defined for the given map object.\n */\n readonly areas: HTMLAreasCollection;\n /**\n * Sets or retrieves the name of the object.\n */\n name: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLMapElement: {\n prototype: HTMLMapElement;\n new(): HTMLMapElement;\n}\n\ninterface HTMLMarqueeElementEventMap extends HTMLElementEventMap {\n \"bounce\": Event;\n \"finish\": Event;\n \"start\": Event;\n}\n\ninterface HTMLMarqueeElement extends HTMLElement {\n behavior: string;\n bgColor: any;\n direction: string;\n height: string;\n hspace: number;\n loop: number;\n onbounce: (this: HTMLMarqueeElement, ev: Event) => any;\n onfinish: (this: HTMLMarqueeElement, ev: Event) => any;\n onstart: (this: HTMLMarqueeElement, ev: Event) => any;\n scrollAmount: number;\n scrollDelay: number;\n trueSpeed: boolean;\n vspace: number;\n width: string;\n start(): void;\n stop(): void;\n addEventListener(type: K, listener: (this: HTMLMarqueeElement, ev: HTMLMarqueeElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLMarqueeElement: {\n prototype: HTMLMarqueeElement;\n new(): HTMLMarqueeElement;\n}\n\ninterface HTMLMediaElementEventMap extends HTMLElementEventMap {\n \"encrypted\": MediaEncryptedEvent;\n \"msneedkey\": MSMediaKeyNeededEvent;\n}\n\ninterface HTMLMediaElement extends HTMLElement {\n /**\n * Returns an AudioTrackList object with the audio tracks for a given video element.\n */\n readonly audioTracks: AudioTrackList;\n /**\n * Gets or sets a value that indicates whether to start playing the media automatically.\n */\n autoplay: boolean;\n /**\n * Gets a collection of buffered time ranges.\n */\n readonly buffered: TimeRanges;\n /**\n * Gets or sets a flag that indicates whether the client provides a set of controls for the media (in case the developer does not include controls for the player).\n */\n controls: boolean;\n crossOrigin: string;\n /**\n * Gets the address or URL of the current media resource that is selected by IHTMLMediaElement.\n */\n readonly currentSrc: string;\n /**\n * Gets or sets the current playback position, in seconds.\n */\n currentTime: number;\n defaultMuted: boolean;\n /**\n * Gets or sets the default playback rate when the user is not using fast forward or reverse for a video or audio resource.\n */\n defaultPlaybackRate: number;\n /**\n * Returns the duration in seconds of the current media resource. A NaN value is returned if duration is not available, or Infinity if the media resource is streaming.\n */\n readonly duration: number;\n /**\n * Gets information about whether the playback has ended or not.\n */\n readonly ended: boolean;\n /**\n * Returns an object representing the current error state of the audio or video element.\n */\n readonly error: MediaError;\n /**\n * Gets or sets a flag to specify whether playback should restart after it completes.\n */\n loop: boolean;\n readonly mediaKeys: MediaKeys | null;\n /**\n * Specifies the purpose of the audio or video media, such as background audio or alerts.\n */\n msAudioCategory: string;\n /**\n * Specifies the output device id that the audio will be sent to.\n */\n msAudioDeviceType: string;\n readonly msGraphicsTrustStatus: MSGraphicsTrust;\n /**\n * Gets the MSMediaKeys object, which is used for decrypting media data, that is associated with this media element.\n */\n readonly msKeys: MSMediaKeys;\n /**\n * Gets or sets whether the DLNA PlayTo device is available.\n */\n msPlayToDisabled: boolean;\n /**\n * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server.\n */\n msPlayToPreferredSourceUri: string;\n /**\n * Gets or sets the primary DLNA PlayTo device.\n */\n msPlayToPrimary: boolean;\n /**\n * Gets the source associated with the media element for use by the PlayToManager.\n */\n readonly msPlayToSource: any;\n /**\n * Specifies whether or not to enable low-latency playback on the media element.\n */\n msRealTime: boolean;\n /**\n * Gets or sets a flag that indicates whether the audio (either audio or the audio track on video media) is muted.\n */\n muted: boolean;\n /**\n * Gets the current network activity for the element.\n */\n readonly networkState: number;\n onencrypted: (this: HTMLMediaElement, ev: MediaEncryptedEvent) => any;\n onmsneedkey: (this: HTMLMediaElement, ev: MSMediaKeyNeededEvent) => any;\n /**\n * Gets a flag that specifies whether playback is paused.\n */\n readonly paused: boolean;\n /**\n * Gets or sets the current rate of speed for the media resource to play. This speed is expressed as a multiple of the normal speed of the media resource.\n */\n playbackRate: number;\n /**\n * Gets TimeRanges for the current media resource that has been played.\n */\n readonly played: TimeRanges;\n /**\n * Gets or sets the current playback position, in seconds.\n */\n preload: string;\n readyState: number;\n /**\n * Returns a TimeRanges object that represents the ranges of the current media resource that can be seeked.\n */\n readonly seekable: TimeRanges;\n /**\n * Gets a flag that indicates whether the the client is currently moving to a new playback position in the media resource.\n */\n readonly seeking: boolean;\n /**\n * The address or URL of the a media resource that is to be considered.\n */\n src: string;\n srcObject: MediaStream | null;\n readonly textTracks: TextTrackList;\n readonly videoTracks: VideoTrackList;\n /**\n * Gets or sets the volume level for audio portions of the media element.\n */\n volume: number;\n addTextTrack(kind: string, label?: string, language?: string): TextTrack;\n /**\n * Returns a string that specifies whether the client can play a given media resource type.\n */\n canPlayType(type: string): string;\n /**\n * Resets the audio or video object and loads a new media resource.\n */\n load(): void;\n /**\n * Clears all effects from the media pipeline.\n */\n msClearEffects(): void;\n msGetAsCastingSource(): any;\n /**\n * Inserts the specified audio effect into media pipeline.\n */\n msInsertAudioEffect(activatableClassId: string, effectRequired: boolean, config?: any): void;\n msSetMediaKeys(mediaKeys: MSMediaKeys): void;\n /**\n * Specifies the media protection manager for a given media pipeline.\n */\n msSetMediaProtectionManager(mediaProtectionManager?: any): void;\n /**\n * Pauses the current playback and sets paused to TRUE. This can be used to test whether the media is playing or paused. You can also use the pause or play events to tell whether the media is playing or not.\n */\n pause(): void;\n /**\n * Loads and starts playback of a media resource.\n */\n play(): void;\n setMediaKeys(mediaKeys: MediaKeys | null): PromiseLike;\n readonly HAVE_CURRENT_DATA: number;\n readonly HAVE_ENOUGH_DATA: number;\n readonly HAVE_FUTURE_DATA: number;\n readonly HAVE_METADATA: number;\n readonly HAVE_NOTHING: number;\n readonly NETWORK_EMPTY: number;\n readonly NETWORK_IDLE: number;\n readonly NETWORK_LOADING: number;\n readonly NETWORK_NO_SOURCE: number;\n addEventListener(type: K, listener: (this: HTMLMediaElement, ev: HTMLMediaElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLMediaElement: {\n prototype: HTMLMediaElement;\n new(): HTMLMediaElement;\n readonly HAVE_CURRENT_DATA: number;\n readonly HAVE_ENOUGH_DATA: number;\n readonly HAVE_FUTURE_DATA: number;\n readonly HAVE_METADATA: number;\n readonly HAVE_NOTHING: number;\n readonly NETWORK_EMPTY: number;\n readonly NETWORK_IDLE: number;\n readonly NETWORK_LOADING: number;\n readonly NETWORK_NO_SOURCE: number;\n}\n\ninterface HTMLMenuElement extends HTMLElement {\n compact: boolean;\n type: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLMenuElement: {\n prototype: HTMLMenuElement;\n new(): HTMLMenuElement;\n}\n\ninterface HTMLMetaElement extends HTMLElement {\n /**\n * Sets or retrieves the character set used to encode the object.\n */\n charset: string;\n /**\n * Gets or sets meta-information to associate with httpEquiv or name.\n */\n content: string;\n /**\n * Gets or sets information used to bind the value of a content attribute of a meta element to an HTTP response header.\n */\n httpEquiv: string;\n /**\n * Sets or retrieves the value specified in the content attribute of the meta object.\n */\n name: string;\n /**\n * Sets or retrieves a scheme to be used in interpreting the value of a property specified for the object.\n */\n scheme: string;\n /**\n * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. \n */\n url: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLMetaElement: {\n prototype: HTMLMetaElement;\n new(): HTMLMetaElement;\n}\n\ninterface HTMLMeterElement extends HTMLElement {\n high: number;\n low: number;\n max: number;\n min: number;\n optimum: number;\n value: number;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLMeterElement: {\n prototype: HTMLMeterElement;\n new(): HTMLMeterElement;\n}\n\ninterface HTMLModElement extends HTMLElement {\n /**\n * Sets or retrieves reference information about the object.\n */\n cite: string;\n /**\n * Sets or retrieves the date and time of a modification to the object.\n */\n dateTime: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLModElement: {\n prototype: HTMLModElement;\n new(): HTMLModElement;\n}\n\ninterface HTMLOListElement extends HTMLElement {\n compact: boolean;\n /**\n * The starting number.\n */\n start: number;\n type: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLOListElement: {\n prototype: HTMLOListElement;\n new(): HTMLOListElement;\n}\n\ninterface HTMLObjectElement extends HTMLElement, GetSVGDocument {\n /**\n * Retrieves a string of the URL where the object tag can be found. This is often the href of the document that the object is in, or the value set by a base element.\n */\n readonly BaseHref: string;\n align: string;\n /**\n * Sets or retrieves a text alternative to the graphic.\n */\n alt: string;\n /**\n * Gets or sets the optional alternative HTML script to execute if the object fails to load.\n */\n altHtml: string;\n /**\n * Sets or retrieves a character string that can be used to implement your own archive functionality for the object.\n */\n archive: string;\n border: string;\n /**\n * Sets or retrieves the URL of the file containing the compiled Java class.\n */\n code: string;\n /**\n * Sets or retrieves the URL of the component.\n */\n codeBase: string;\n /**\n * Sets or retrieves the Internet media type for the code associated with the object.\n */\n codeType: string;\n /**\n * Retrieves the document object of the page or frame.\n */\n readonly contentDocument: Document;\n /**\n * Sets or retrieves the URL that references the data of the object.\n */\n data: string;\n declare: boolean;\n /**\n * Retrieves a reference to the form that the object is embedded in.\n */\n readonly form: HTMLFormElement;\n /**\n * Sets or retrieves the height of the object.\n */\n height: string;\n hspace: number;\n /**\n * Gets or sets whether the DLNA PlayTo device is available.\n */\n msPlayToDisabled: boolean;\n /**\n * Gets or sets the path to the preferred media source. This enables the Play To target device to stream the media content, which can be DRM protected, from a different location, such as a cloud media server.\n */\n msPlayToPreferredSourceUri: string;\n /**\n * Gets or sets the primary DLNA PlayTo device.\n */\n msPlayToPrimary: boolean;\n /**\n * Gets the source associated with the media element for use by the PlayToManager.\n */\n readonly msPlayToSource: any;\n /**\n * Sets or retrieves the name of the object.\n */\n name: string;\n /**\n * Retrieves the contained object.\n */\n readonly object: any;\n readonly readyState: number;\n /**\n * Sets or retrieves a message to be displayed while an object is loading.\n */\n standby: string;\n /**\n * Sets or retrieves the MIME type of the object.\n */\n type: string;\n /**\n * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map.\n */\n useMap: string;\n /**\n * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\n */\n readonly validationMessage: string;\n /**\n * Returns a ValidityState object that represents the validity states of an element.\n */\n readonly validity: ValidityState;\n vspace: number;\n /**\n * Sets or retrieves the width of the object.\n */\n width: string;\n /**\n * Returns whether an element will successfully validate based on forms validation rules and constraints.\n */\n readonly willValidate: boolean;\n /**\n * Returns whether a form will validate when it is submitted, without having to submit it.\n */\n checkValidity(): boolean;\n /**\n * Sets a custom error message that is displayed when a form is submitted.\n * @param error Sets a custom error message that is displayed when a form is submitted.\n */\n setCustomValidity(error: string): void;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLObjectElement: {\n prototype: HTMLObjectElement;\n new(): HTMLObjectElement;\n}\n\ninterface HTMLOptGroupElement extends HTMLElement {\n /**\n * Sets or retrieves the status of an option.\n */\n defaultSelected: boolean;\n disabled: boolean;\n /**\n * Retrieves a reference to the form that the object is embedded in.\n */\n readonly form: HTMLFormElement;\n /**\n * Sets or retrieves the ordinal position of an option in a list box.\n */\n readonly index: number;\n /**\n * Sets or retrieves a value that you can use to implement your own label functionality for the object.\n */\n label: string;\n /**\n * Sets or retrieves whether the option in the list box is the default item.\n */\n selected: boolean;\n /**\n * Sets or retrieves the text string specified by the option tag.\n */\n readonly text: string;\n /**\n * Sets or retrieves the value which is returned to the server when the form control is submitted.\n */\n value: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLOptGroupElement: {\n prototype: HTMLOptGroupElement;\n new(): HTMLOptGroupElement;\n}\n\ninterface HTMLOptionElement extends HTMLElement {\n /**\n * Sets or retrieves the status of an option.\n */\n defaultSelected: boolean;\n disabled: boolean;\n /**\n * Retrieves a reference to the form that the object is embedded in.\n */\n readonly form: HTMLFormElement;\n /**\n * Sets or retrieves the ordinal position of an option in a list box.\n */\n readonly index: number;\n /**\n * Sets or retrieves a value that you can use to implement your own label functionality for the object.\n */\n label: string;\n /**\n * Sets or retrieves whether the option in the list box is the default item.\n */\n selected: boolean;\n /**\n * Sets or retrieves the text string specified by the option tag.\n */\n text: string;\n /**\n * Sets or retrieves the value which is returned to the server when the form control is submitted.\n */\n value: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLOptionElement: {\n prototype: HTMLOptionElement;\n new(): HTMLOptionElement;\n create(): HTMLOptionElement;\n}\n\ninterface HTMLOptionsCollection extends HTMLCollectionOf {\n length: number;\n selectedIndex: number;\n add(element: HTMLOptionElement | HTMLOptGroupElement, before?: HTMLElement | number): void;\n remove(index: number): void;\n}\n\ndeclare var HTMLOptionsCollection: {\n prototype: HTMLOptionsCollection;\n new(): HTMLOptionsCollection;\n}\n\ninterface HTMLParagraphElement extends HTMLElement {\n /**\n * Sets or retrieves how the object is aligned with adjacent text. \n */\n align: string;\n clear: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLParagraphElement: {\n prototype: HTMLParagraphElement;\n new(): HTMLParagraphElement;\n}\n\ninterface HTMLParamElement extends HTMLElement {\n /**\n * Sets or retrieves the name of an input parameter for an element.\n */\n name: string;\n /**\n * Sets or retrieves the content type of the resource designated by the value attribute.\n */\n type: string;\n /**\n * Sets or retrieves the value of an input parameter for an element.\n */\n value: string;\n /**\n * Sets or retrieves the data type of the value attribute.\n */\n valueType: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLParamElement: {\n prototype: HTMLParamElement;\n new(): HTMLParamElement;\n}\n\ninterface HTMLPictureElement extends HTMLElement {\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLPictureElement: {\n prototype: HTMLPictureElement;\n new(): HTMLPictureElement;\n}\n\ninterface HTMLPreElement extends HTMLElement {\n /**\n * Sets or gets a value that you can use to implement your own width functionality for the object.\n */\n width: number;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLPreElement: {\n prototype: HTMLPreElement;\n new(): HTMLPreElement;\n}\n\ninterface HTMLProgressElement extends HTMLElement {\n /**\n * Retrieves a reference to the form that the object is embedded in.\n */\n readonly form: HTMLFormElement;\n /**\n * Defines the maximum, or \"done\" value for a progress element.\n */\n max: number;\n /**\n * Returns the quotient of value/max when the value attribute is set (determinate progress bar), or -1 when the value attribute is missing (indeterminate progress bar).\n */\n readonly position: number;\n /**\n * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value.\n */\n value: number;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLProgressElement: {\n prototype: HTMLProgressElement;\n new(): HTMLProgressElement;\n}\n\ninterface HTMLQuoteElement extends HTMLElement {\n /**\n * Sets or retrieves reference information about the object.\n */\n cite: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLQuoteElement: {\n prototype: HTMLQuoteElement;\n new(): HTMLQuoteElement;\n}\n\ninterface HTMLScriptElement extends HTMLElement {\n async: boolean;\n /**\n * Sets or retrieves the character set used to encode the object.\n */\n charset: string;\n /**\n * Sets or retrieves the status of the script.\n */\n defer: boolean;\n /**\n * Sets or retrieves the event for which the script is written. \n */\n event: string;\n /** \n * Sets or retrieves the object that is bound to the event script.\n */\n htmlFor: string;\n /**\n * Retrieves the URL to an external file that contains the source code or data.\n */\n src: string;\n /**\n * Retrieves or sets the text of the object as a string. \n */\n text: string;\n /**\n * Sets or retrieves the MIME type for the associated scripting engine.\n */\n type: string;\n integrity: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLScriptElement: {\n prototype: HTMLScriptElement;\n new(): HTMLScriptElement;\n}\n\ninterface HTMLSelectElement extends HTMLElement {\n /**\n * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing.\n */\n autofocus: boolean;\n disabled: boolean;\n /**\n * Retrieves a reference to the form that the object is embedded in. \n */\n readonly form: HTMLFormElement;\n /**\n * Sets or retrieves the number of objects in a collection.\n */\n length: number;\n /**\n * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list.\n */\n multiple: boolean;\n /**\n * Sets or retrieves the name of the object.\n */\n name: string;\n readonly options: HTMLOptionsCollection;\n /**\n * When present, marks an element that can't be submitted without a value.\n */\n required: boolean;\n /**\n * Sets or retrieves the index of the selected option in a select object.\n */\n selectedIndex: number;\n selectedOptions: HTMLCollectionOf;\n /**\n * Sets or retrieves the number of rows in the list box. \n */\n size: number;\n /**\n * Retrieves the type of select control based on the value of the MULTIPLE attribute.\n */\n readonly type: string;\n /**\n * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\n */\n readonly validationMessage: string;\n /**\n * Returns a ValidityState object that represents the validity states of an element.\n */\n readonly validity: ValidityState;\n /**\n * Sets or retrieves the value which is returned to the server when the form control is submitted.\n */\n value: string;\n /**\n * Returns whether an element will successfully validate based on forms validation rules and constraints.\n */\n readonly willValidate: boolean;\n /**\n * Adds an element to the areas, controlRange, or options collection.\n * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection.\n * @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection. \n */\n add(element: HTMLElement, before?: HTMLElement | number): void;\n /**\n * Returns whether a form will validate when it is submitted, without having to submit it.\n */\n checkValidity(): boolean;\n /**\n * Retrieves a select object or an object from an options collection.\n * @param name Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is an integer, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made.\n * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned.\n */\n item(name?: any, index?: any): any;\n /**\n * Retrieves a select object or an object from an options collection.\n * @param namedItem A String that specifies the name or id property of the object to retrieve. A collection is returned if more than one match is made.\n */\n namedItem(name: string): any;\n /**\n * Removes an element from the collection.\n * @param index Number that specifies the zero-based index of the element to remove from the collection.\n */\n remove(index?: number): void;\n /**\n * Sets a custom error message that is displayed when a form is submitted.\n * @param error Sets a custom error message that is displayed when a form is submitted.\n */\n setCustomValidity(error: string): void;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n [name: string]: any;\n}\n\ndeclare var HTMLSelectElement: {\n prototype: HTMLSelectElement;\n new(): HTMLSelectElement;\n}\n\ninterface HTMLSourceElement extends HTMLElement {\n /**\n * Gets or sets the intended media type of the media source.\n */\n media: string;\n msKeySystem: string;\n sizes: string;\n /**\n * The address or URL of the a media resource that is to be considered.\n */\n src: string;\n srcset: string;\n /**\n * Gets or sets the MIME type of a media resource.\n */\n type: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLSourceElement: {\n prototype: HTMLSourceElement;\n new(): HTMLSourceElement;\n}\n\ninterface HTMLSpanElement extends HTMLElement {\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLSpanElement: {\n prototype: HTMLSpanElement;\n new(): HTMLSpanElement;\n}\n\ninterface HTMLStyleElement extends HTMLElement, LinkStyle {\n disabled: boolean;\n /**\n * Sets or retrieves the media type.\n */\n media: string;\n /**\n * Retrieves the CSS language in which the style sheet is written.\n */\n type: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLStyleElement: {\n prototype: HTMLStyleElement;\n new(): HTMLStyleElement;\n}\n\ninterface HTMLTableCaptionElement extends HTMLElement {\n /**\n * Sets or retrieves the alignment of the caption or legend.\n */\n align: string;\n /**\n * Sets or retrieves whether the caption appears at the top or bottom of the table.\n */\n vAlign: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTableCaptionElement: {\n prototype: HTMLTableCaptionElement;\n new(): HTMLTableCaptionElement;\n}\n\ninterface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment {\n /**\n * Sets or retrieves abbreviated text for the object.\n */\n abbr: string;\n /**\n * Sets or retrieves how the object is aligned with adjacent text.\n */\n align: string;\n /**\n * Sets or retrieves a comma-delimited list of conceptual categories associated with the object.\n */\n axis: string;\n bgColor: any;\n /**\n * Retrieves the position of the object in the cells collection of a row.\n */\n readonly cellIndex: number;\n /**\n * Sets or retrieves the number columns in the table that the object should span.\n */\n colSpan: number;\n /**\n * Sets or retrieves a list of header cells that provide information for the object.\n */\n headers: string;\n /**\n * Sets or retrieves the height of the object.\n */\n height: any;\n /**\n * Sets or retrieves whether the browser automatically performs wordwrap.\n */\n noWrap: boolean;\n /**\n * Sets or retrieves how many rows in a table the cell should span.\n */\n rowSpan: number;\n /**\n * Sets or retrieves the group of cells in a table to which the object's information applies.\n */\n scope: string;\n /**\n * Sets or retrieves the width of the object.\n */\n width: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTableCellElement: {\n prototype: HTMLTableCellElement;\n new(): HTMLTableCellElement;\n}\n\ninterface HTMLTableColElement extends HTMLElement, HTMLTableAlignment {\n /**\n * Sets or retrieves the alignment of the object relative to the display or table.\n */\n align: string;\n /**\n * Sets or retrieves the number of columns in the group.\n */\n span: number;\n /**\n * Sets or retrieves the width of the object.\n */\n width: any;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTableColElement: {\n prototype: HTMLTableColElement;\n new(): HTMLTableColElement;\n}\n\ninterface HTMLTableDataCellElement extends HTMLTableCellElement {\n}\n\ndeclare var HTMLTableDataCellElement: {\n prototype: HTMLTableDataCellElement;\n new(): HTMLTableDataCellElement;\n}\n\ninterface HTMLTableElement extends HTMLElement {\n /**\n * Sets or retrieves a value that indicates the table alignment.\n */\n align: string;\n bgColor: any;\n /**\n * Sets or retrieves the width of the border to draw around the object.\n */\n border: string;\n /**\n * Sets or retrieves the border color of the object. \n */\n borderColor: any;\n /**\n * Retrieves the caption object of a table.\n */\n caption: HTMLTableCaptionElement;\n /**\n * Sets or retrieves the amount of space between the border of the cell and the content of the cell.\n */\n cellPadding: string;\n /**\n * Sets or retrieves the amount of space between cells in a table.\n */\n cellSpacing: string;\n /**\n * Sets or retrieves the number of columns in the table.\n */\n cols: number;\n /**\n * Sets or retrieves the way the border frame around the table is displayed.\n */\n frame: string;\n /**\n * Sets or retrieves the height of the object.\n */\n height: any;\n /**\n * Sets or retrieves the number of horizontal rows contained in the object.\n */\n rows: HTMLCollectionOf;\n /**\n * Sets or retrieves which dividing lines (inner borders) are displayed.\n */\n rules: string;\n /**\n * Sets or retrieves a description and/or structure of the object.\n */\n summary: string;\n /**\n * Retrieves a collection of all tBody objects in the table. Objects in this collection are in source order.\n */\n tBodies: HTMLCollectionOf;\n /**\n * Retrieves the tFoot object of the table.\n */\n tFoot: HTMLTableSectionElement;\n /**\n * Retrieves the tHead object of the table.\n */\n tHead: HTMLTableSectionElement;\n /**\n * Sets or retrieves the width of the object.\n */\n width: string;\n /**\n * Creates an empty caption element in the table.\n */\n createCaption(): HTMLTableCaptionElement;\n /**\n * Creates an empty tBody element in the table.\n */\n createTBody(): HTMLTableSectionElement;\n /**\n * Creates an empty tFoot element in the table.\n */\n createTFoot(): HTMLTableSectionElement;\n /**\n * Returns the tHead element object if successful, or null otherwise.\n */\n createTHead(): HTMLTableSectionElement;\n /**\n * Deletes the caption element and its contents from the table.\n */\n deleteCaption(): void;\n /**\n * Removes the specified row (tr) from the element and from the rows collection.\n * @param index Number that specifies the zero-based position in the rows collection of the row to remove.\n */\n deleteRow(index?: number): void;\n /**\n * Deletes the tFoot element and its contents from the table.\n */\n deleteTFoot(): void;\n /**\n * Deletes the tHead element and its contents from the table.\n */\n deleteTHead(): void;\n /**\n * Creates a new row (tr) in the table, and adds the row to the rows collection.\n * @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.\n */\n insertRow(index?: number): HTMLTableRowElement;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTableElement: {\n prototype: HTMLTableElement;\n new(): HTMLTableElement;\n}\n\ninterface HTMLTableHeaderCellElement extends HTMLTableCellElement {\n /**\n * Sets or retrieves the group of cells in a table to which the object's information applies.\n */\n scope: string;\n}\n\ndeclare var HTMLTableHeaderCellElement: {\n prototype: HTMLTableHeaderCellElement;\n new(): HTMLTableHeaderCellElement;\n}\n\ninterface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment {\n /**\n * Sets or retrieves how the object is aligned with adjacent text.\n */\n align: string;\n bgColor: any;\n /**\n * Retrieves a collection of all cells in the table row.\n */\n cells: HTMLCollectionOf;\n /**\n * Sets or retrieves the height of the object.\n */\n height: any;\n /**\n * Retrieves the position of the object in the rows collection for the table.\n */\n readonly rowIndex: number;\n /**\n * Retrieves the position of the object in the collection.\n */\n readonly sectionRowIndex: number;\n /**\n * Removes the specified cell from the table row, as well as from the cells collection.\n * @param index Number that specifies the zero-based position of the cell to remove from the table row. If no value is provided, the last cell in the cells collection is deleted.\n */\n deleteCell(index?: number): void;\n /**\n * Creates a new cell in the table row, and adds the cell to the cells collection.\n * @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.\n */\n insertCell(index?: number): HTMLTableDataCellElement;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTableRowElement: {\n prototype: HTMLTableRowElement;\n new(): HTMLTableRowElement;\n}\n\ninterface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment {\n /**\n * Sets or retrieves a value that indicates the table alignment.\n */\n align: string;\n /**\n * Sets or retrieves the number of horizontal rows contained in the object.\n */\n rows: HTMLCollectionOf;\n /**\n * Removes the specified row (tr) from the element and from the rows collection.\n * @param index Number that specifies the zero-based position in the rows collection of the row to remove.\n */\n deleteRow(index?: number): void;\n /**\n * Creates a new row (tr) in the table, and adds the row to the rows collection.\n * @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.\n */\n insertRow(index?: number): HTMLTableRowElement;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTableSectionElement: {\n prototype: HTMLTableSectionElement;\n new(): HTMLTableSectionElement;\n}\n\ninterface HTMLTemplateElement extends HTMLElement {\n readonly content: DocumentFragment;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTemplateElement: {\n prototype: HTMLTemplateElement;\n new(): HTMLTemplateElement;\n}\n\ninterface HTMLTextAreaElement extends HTMLElement {\n /**\n * Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing.\n */\n autofocus: boolean;\n /**\n * Sets or retrieves the width of the object.\n */\n cols: number;\n /**\n * Sets or retrieves the initial contents of the object.\n */\n defaultValue: string;\n disabled: boolean;\n /**\n * Retrieves a reference to the form that the object is embedded in.\n */\n readonly form: HTMLFormElement;\n /**\n * Sets or retrieves the maximum number of characters that the user can enter in a text control.\n */\n maxLength: number;\n /**\n * Sets or retrieves the name of the object.\n */\n name: string;\n /**\n * Gets or sets a text string that is displayed in an input field as a hint or prompt to users as the format or type of information they need to enter.The text appears in an input field until the user puts focus on the field.\n */\n placeholder: string;\n /**\n * Sets or retrieves the value indicated whether the content of the object is read-only.\n */\n readOnly: boolean;\n /**\n * When present, marks an element that can't be submitted without a value.\n */\n required: boolean;\n /**\n * Sets or retrieves the number of horizontal rows contained in the object.\n */\n rows: number;\n /**\n * Gets or sets the end position or offset of a text selection.\n */\n selectionEnd: number;\n /**\n * Gets or sets the starting position or offset of a text selection.\n */\n selectionStart: number;\n /**\n * Sets or retrieves the value indicating whether the control is selected.\n */\n status: any;\n /**\n * Retrieves the type of control.\n */\n readonly type: string;\n /**\n * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as \"this is a required field\". The result is that the user sees validation messages without actually submitting.\n */\n readonly validationMessage: string;\n /**\n * Returns a ValidityState object that represents the validity states of an element.\n */\n readonly validity: ValidityState;\n /**\n * Retrieves or sets the text in the entry field of the textArea element.\n */\n value: string;\n /**\n * Returns whether an element will successfully validate based on forms validation rules and constraints.\n */\n readonly willValidate: boolean;\n /**\n * Sets or retrieves how to handle wordwrapping in the object.\n */\n wrap: string;\n minLength: number;\n /**\n * Returns whether a form will validate when it is submitted, without having to submit it.\n */\n checkValidity(): boolean;\n /**\n * Highlights the input area of a form element.\n */\n select(): void;\n /**\n * Sets a custom error message that is displayed when a form is submitted.\n * @param error Sets a custom error message that is displayed when a form is submitted.\n */\n setCustomValidity(error: string): void;\n /**\n * Sets the start and end positions of a selection in a text field.\n * @param start The offset into the text field for the start of the selection.\n * @param end The offset into the text field for the end of the selection.\n */\n setSelectionRange(start: number, end: number): void;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTextAreaElement: {\n prototype: HTMLTextAreaElement;\n new(): HTMLTextAreaElement;\n}\n\ninterface HTMLTitleElement extends HTMLElement {\n /**\n * Retrieves or sets the text of the object as a string. \n */\n text: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTitleElement: {\n prototype: HTMLTitleElement;\n new(): HTMLTitleElement;\n}\n\ninterface HTMLTrackElement extends HTMLElement {\n default: boolean;\n kind: string;\n label: string;\n readonly readyState: number;\n src: string;\n srclang: string;\n readonly track: TextTrack;\n readonly ERROR: number;\n readonly LOADED: number;\n readonly LOADING: number;\n readonly NONE: number;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLTrackElement: {\n prototype: HTMLTrackElement;\n new(): HTMLTrackElement;\n readonly ERROR: number;\n readonly LOADED: number;\n readonly LOADING: number;\n readonly NONE: number;\n}\n\ninterface HTMLUListElement extends HTMLElement {\n compact: boolean;\n type: string;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLUListElement: {\n prototype: HTMLUListElement;\n new(): HTMLUListElement;\n}\n\ninterface HTMLUnknownElement extends HTMLElement {\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLUnknownElement: {\n prototype: HTMLUnknownElement;\n new(): HTMLUnknownElement;\n}\n\ninterface HTMLVideoElementEventMap extends HTMLMediaElementEventMap {\n \"MSVideoFormatChanged\": Event;\n \"MSVideoFrameStepCompleted\": Event;\n \"MSVideoOptimalLayoutChanged\": Event;\n}\n\ninterface HTMLVideoElement extends HTMLMediaElement {\n /**\n * Gets or sets the height of the video element.\n */\n height: number;\n msHorizontalMirror: boolean;\n readonly msIsLayoutOptimalForPlayback: boolean;\n readonly msIsStereo3D: boolean;\n msStereo3DPackingMode: string;\n msStereo3DRenderMode: string;\n msZoom: boolean;\n onMSVideoFormatChanged: (this: HTMLVideoElement, ev: Event) => any;\n onMSVideoFrameStepCompleted: (this: HTMLVideoElement, ev: Event) => any;\n onMSVideoOptimalLayoutChanged: (this: HTMLVideoElement, ev: Event) => any;\n /**\n * 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.\n */\n poster: string;\n /**\n * Gets the intrinsic height of a video in CSS pixels, or zero if the dimensions are not known.\n */\n readonly videoHeight: number;\n /**\n * Gets the intrinsic width of a video in CSS pixels, or zero if the dimensions are not known.\n */\n readonly videoWidth: number;\n readonly webkitDisplayingFullscreen: boolean;\n readonly webkitSupportsFullscreen: boolean;\n /**\n * Gets or sets the width of the video element.\n */\n width: number;\n getVideoPlaybackQuality(): VideoPlaybackQuality;\n msFrameStep(forward: boolean): void;\n msInsertVideoEffect(activatableClassId: string, effectRequired: boolean, config?: any): void;\n msSetVideoRectangle(left: number, top: number, right: number, bottom: number): void;\n webkitEnterFullScreen(): void;\n webkitEnterFullscreen(): void;\n webkitExitFullScreen(): void;\n webkitExitFullscreen(): void;\n addEventListener(type: K, listener: (this: HTMLVideoElement, ev: HTMLVideoElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var HTMLVideoElement: {\n prototype: HTMLVideoElement;\n new(): HTMLVideoElement;\n}\n\ninterface HashChangeEvent extends Event {\n readonly newURL: string | null;\n readonly oldURL: string | null;\n}\n\ndeclare var HashChangeEvent: {\n prototype: HashChangeEvent;\n new(type: string, eventInitDict?: HashChangeEventInit): HashChangeEvent;\n}\n\ninterface History {\n readonly length: number;\n readonly state: any;\n scrollRestoration: ScrollRestoration;\n back(): void;\n forward(): void;\n go(delta?: number): void;\n pushState(data: any, title: string, url?: string | null): void;\n replaceState(data: any, title: string, url?: string | null): void;\n}\n\ndeclare var History: {\n prototype: History;\n new(): History;\n}\n\ninterface IDBCursor {\n readonly direction: string;\n key: IDBKeyRange | IDBValidKey;\n readonly primaryKey: any;\n source: IDBObjectStore | IDBIndex;\n advance(count: number): void;\n continue(key?: IDBKeyRange | IDBValidKey): void;\n delete(): IDBRequest;\n update(value: any): IDBRequest;\n readonly NEXT: string;\n readonly NEXT_NO_DUPLICATE: string;\n readonly PREV: string;\n readonly PREV_NO_DUPLICATE: string;\n}\n\ndeclare var IDBCursor: {\n prototype: IDBCursor;\n new(): IDBCursor;\n readonly NEXT: string;\n readonly NEXT_NO_DUPLICATE: string;\n readonly PREV: string;\n readonly PREV_NO_DUPLICATE: string;\n}\n\ninterface IDBCursorWithValue extends IDBCursor {\n readonly value: any;\n}\n\ndeclare var IDBCursorWithValue: {\n prototype: IDBCursorWithValue;\n new(): IDBCursorWithValue;\n}\n\ninterface IDBDatabaseEventMap {\n \"abort\": Event;\n \"error\": ErrorEvent;\n}\n\ninterface IDBDatabase extends EventTarget {\n readonly name: string;\n readonly objectStoreNames: DOMStringList;\n onabort: (this: IDBDatabase, ev: Event) => any;\n onerror: (this: IDBDatabase, ev: ErrorEvent) => any;\n version: number;\n onversionchange: (ev: IDBVersionChangeEvent) => any;\n close(): void;\n createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore;\n deleteObjectStore(name: string): void;\n transaction(storeNames: string | string[], mode?: string): IDBTransaction;\n addEventListener(type: \"versionchange\", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void;\n addEventListener(type: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var IDBDatabase: {\n prototype: IDBDatabase;\n new(): IDBDatabase;\n}\n\ninterface IDBFactory {\n cmp(first: any, second: any): number;\n deleteDatabase(name: string): IDBOpenDBRequest;\n open(name: string, version?: number): IDBOpenDBRequest;\n}\n\ndeclare var IDBFactory: {\n prototype: IDBFactory;\n new(): IDBFactory;\n}\n\ninterface IDBIndex {\n keyPath: string | string[];\n readonly name: string;\n readonly objectStore: IDBObjectStore;\n readonly unique: boolean;\n multiEntry: boolean;\n count(key?: IDBKeyRange | IDBValidKey): IDBRequest;\n get(key: IDBKeyRange | IDBValidKey): IDBRequest;\n getKey(key: IDBKeyRange | IDBValidKey): IDBRequest;\n openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest;\n openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest;\n}\n\ndeclare var IDBIndex: {\n prototype: IDBIndex;\n new(): IDBIndex;\n}\n\ninterface IDBKeyRange {\n readonly lower: any;\n readonly lowerOpen: boolean;\n readonly upper: any;\n readonly upperOpen: boolean;\n}\n\ndeclare var IDBKeyRange: {\n prototype: IDBKeyRange;\n new(): IDBKeyRange;\n bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange;\n lowerBound(lower: any, open?: boolean): IDBKeyRange;\n only(value: any): IDBKeyRange;\n upperBound(upper: any, open?: boolean): IDBKeyRange;\n}\n\ninterface IDBObjectStore {\n readonly indexNames: DOMStringList;\n keyPath: string | string[];\n readonly name: string;\n readonly transaction: IDBTransaction;\n autoIncrement: boolean;\n add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest;\n clear(): IDBRequest;\n count(key?: IDBKeyRange | IDBValidKey): IDBRequest;\n createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex;\n delete(key: IDBKeyRange | IDBValidKey): IDBRequest;\n deleteIndex(indexName: string): void;\n get(key: any): IDBRequest;\n index(name: string): IDBIndex;\n openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest;\n put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest;\n}\n\ndeclare var IDBObjectStore: {\n prototype: IDBObjectStore;\n new(): IDBObjectStore;\n}\n\ninterface IDBOpenDBRequestEventMap extends IDBRequestEventMap {\n \"blocked\": Event;\n \"upgradeneeded\": IDBVersionChangeEvent;\n}\n\ninterface IDBOpenDBRequest extends IDBRequest {\n onblocked: (this: IDBOpenDBRequest, ev: Event) => any;\n onupgradeneeded: (this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any;\n addEventListener(type: K, listener: (this: IDBOpenDBRequest, ev: IDBOpenDBRequestEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var IDBOpenDBRequest: {\n prototype: IDBOpenDBRequest;\n new(): IDBOpenDBRequest;\n}\n\ninterface IDBRequestEventMap {\n \"error\": ErrorEvent;\n \"success\": Event;\n}\n\ninterface IDBRequest extends EventTarget {\n readonly error: DOMError;\n onerror: (this: IDBRequest, ev: ErrorEvent) => any;\n onsuccess: (this: IDBRequest, ev: Event) => any;\n readonly readyState: string;\n readonly result: any;\n source: IDBObjectStore | IDBIndex | IDBCursor;\n readonly transaction: IDBTransaction;\n addEventListener(type: K, listener: (this: IDBRequest, ev: IDBRequestEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var IDBRequest: {\n prototype: IDBRequest;\n new(): IDBRequest;\n}\n\ninterface IDBTransactionEventMap {\n \"abort\": Event;\n \"complete\": Event;\n \"error\": ErrorEvent;\n}\n\ninterface IDBTransaction extends EventTarget {\n readonly db: IDBDatabase;\n readonly error: DOMError;\n readonly mode: string;\n onabort: (this: IDBTransaction, ev: Event) => any;\n oncomplete: (this: IDBTransaction, ev: Event) => any;\n onerror: (this: IDBTransaction, ev: ErrorEvent) => any;\n abort(): void;\n objectStore(name: string): IDBObjectStore;\n readonly READ_ONLY: string;\n readonly READ_WRITE: string;\n readonly VERSION_CHANGE: string;\n addEventListener(type: K, listener: (this: IDBTransaction, ev: IDBTransactionEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var IDBTransaction: {\n prototype: IDBTransaction;\n new(): IDBTransaction;\n readonly READ_ONLY: string;\n readonly READ_WRITE: string;\n readonly VERSION_CHANGE: string;\n}\n\ninterface IDBVersionChangeEvent extends Event {\n readonly newVersion: number | null;\n readonly oldVersion: number;\n}\n\ndeclare var IDBVersionChangeEvent: {\n prototype: IDBVersionChangeEvent;\n new(): IDBVersionChangeEvent;\n}\n\ninterface ImageData {\n data: Uint8ClampedArray;\n readonly height: number;\n readonly width: number;\n}\n\ndeclare var ImageData: {\n prototype: ImageData;\n new(width: number, height: number): ImageData;\n new(array: Uint8ClampedArray, width: number, height: number): ImageData;\n}\n\ninterface KeyboardEvent extends UIEvent {\n readonly altKey: boolean;\n readonly char: string | null;\n readonly charCode: number;\n readonly ctrlKey: boolean;\n readonly key: string;\n readonly keyCode: number;\n readonly locale: string;\n readonly location: number;\n readonly metaKey: boolean;\n readonly repeat: boolean;\n readonly shiftKey: boolean;\n readonly which: number;\n readonly code: string;\n getModifierState(keyArg: string): boolean;\n initKeyboardEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, keyArg: string, locationArg: number, modifiersListArg: string, repeat: boolean, locale: string): void;\n readonly DOM_KEY_LOCATION_JOYSTICK: number;\n readonly DOM_KEY_LOCATION_LEFT: number;\n readonly DOM_KEY_LOCATION_MOBILE: number;\n readonly DOM_KEY_LOCATION_NUMPAD: number;\n readonly DOM_KEY_LOCATION_RIGHT: number;\n readonly DOM_KEY_LOCATION_STANDARD: number;\n}\n\ndeclare var KeyboardEvent: {\n prototype: KeyboardEvent;\n new(typeArg: string, eventInitDict?: KeyboardEventInit): KeyboardEvent;\n readonly DOM_KEY_LOCATION_JOYSTICK: number;\n readonly DOM_KEY_LOCATION_LEFT: number;\n readonly DOM_KEY_LOCATION_MOBILE: number;\n readonly DOM_KEY_LOCATION_NUMPAD: number;\n readonly DOM_KEY_LOCATION_RIGHT: number;\n readonly DOM_KEY_LOCATION_STANDARD: number;\n}\n\ninterface ListeningStateChangedEvent extends Event {\n readonly label: string;\n readonly state: string;\n}\n\ndeclare var ListeningStateChangedEvent: {\n prototype: ListeningStateChangedEvent;\n new(): ListeningStateChangedEvent;\n}\n\ninterface Location {\n hash: string;\n host: string;\n hostname: string;\n href: string;\n readonly origin: string;\n pathname: string;\n port: string;\n protocol: string;\n search: string;\n assign(url: string): void;\n reload(forcedReload?: boolean): void;\n replace(url: string): void;\n toString(): string;\n}\n\ndeclare var Location: {\n prototype: Location;\n new(): Location;\n}\n\ninterface LongRunningScriptDetectedEvent extends Event {\n readonly executionTime: number;\n stopPageScriptExecution: boolean;\n}\n\ndeclare var LongRunningScriptDetectedEvent: {\n prototype: LongRunningScriptDetectedEvent;\n new(): LongRunningScriptDetectedEvent;\n}\n\ninterface MSApp {\n clearTemporaryWebDataAsync(): MSAppAsyncOperation;\n createBlobFromRandomAccessStream(type: string, seeker: any): Blob;\n createDataPackage(object: any): any;\n createDataPackageFromSelection(): any;\n createFileFromStorageFile(storageFile: any): File;\n createStreamFromInputStream(type: string, inputStream: any): MSStream;\n execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void;\n execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any;\n getCurrentPriority(): string;\n getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike;\n getViewId(view: any): any;\n isTaskScheduledAtPriorityOrHigher(priority: string): boolean;\n pageHandlesAllApplicationActivations(enabled: boolean): void;\n suppressSubdownloadCredentialPrompts(suppress: boolean): void;\n terminateApp(exceptionObject: any): void;\n readonly CURRENT: string;\n readonly HIGH: string;\n readonly IDLE: string;\n readonly NORMAL: string;\n}\ndeclare var MSApp: MSApp;\n\ninterface MSAppAsyncOperationEventMap {\n \"complete\": Event;\n \"error\": ErrorEvent;\n}\n\ninterface MSAppAsyncOperation extends EventTarget {\n readonly error: DOMError;\n oncomplete: (this: MSAppAsyncOperation, ev: Event) => any;\n onerror: (this: MSAppAsyncOperation, ev: ErrorEvent) => any;\n readonly readyState: number;\n readonly result: any;\n start(): void;\n readonly COMPLETED: number;\n readonly ERROR: number;\n readonly STARTED: number;\n addEventListener(type: K, listener: (this: MSAppAsyncOperation, ev: MSAppAsyncOperationEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MSAppAsyncOperation: {\n prototype: MSAppAsyncOperation;\n new(): MSAppAsyncOperation;\n readonly COMPLETED: number;\n readonly ERROR: number;\n readonly STARTED: number;\n}\n\ninterface MSAssertion {\n readonly id: string;\n readonly type: string;\n}\n\ndeclare var MSAssertion: {\n prototype: MSAssertion;\n new(): MSAssertion;\n}\n\ninterface MSBlobBuilder {\n append(data: any, endings?: string): void;\n getBlob(contentType?: string): Blob;\n}\n\ndeclare var MSBlobBuilder: {\n prototype: MSBlobBuilder;\n new(): MSBlobBuilder;\n}\n\ninterface MSCredentials {\n getAssertion(challenge: string, filter?: MSCredentialFilter, params?: MSSignatureParameters): PromiseLike;\n makeCredential(accountInfo: MSAccountInfo, params: MSCredentialParameters[], challenge?: string): PromiseLike;\n}\n\ndeclare var MSCredentials: {\n prototype: MSCredentials;\n new(): MSCredentials;\n}\n\ninterface MSFIDOCredentialAssertion extends MSAssertion {\n readonly algorithm: string | Algorithm;\n readonly attestation: any;\n readonly publicKey: string;\n readonly transportHints: string[];\n}\n\ndeclare var MSFIDOCredentialAssertion: {\n prototype: MSFIDOCredentialAssertion;\n new(): MSFIDOCredentialAssertion;\n}\n\ninterface MSFIDOSignature {\n readonly authnrData: string;\n readonly clientData: string;\n readonly signature: string;\n}\n\ndeclare var MSFIDOSignature: {\n prototype: MSFIDOSignature;\n new(): MSFIDOSignature;\n}\n\ninterface MSFIDOSignatureAssertion extends MSAssertion {\n readonly signature: MSFIDOSignature;\n}\n\ndeclare var MSFIDOSignatureAssertion: {\n prototype: MSFIDOSignatureAssertion;\n new(): MSFIDOSignatureAssertion;\n}\n\ninterface MSGesture {\n target: Element;\n addPointer(pointerId: number): void;\n stop(): void;\n}\n\ndeclare var MSGesture: {\n prototype: MSGesture;\n new(): MSGesture;\n}\n\ninterface MSGestureEvent extends UIEvent {\n readonly clientX: number;\n readonly clientY: number;\n readonly expansion: number;\n readonly gestureObject: any;\n readonly hwTimestamp: number;\n readonly offsetX: number;\n readonly offsetY: number;\n readonly rotation: number;\n readonly scale: number;\n readonly screenX: number;\n readonly screenY: number;\n readonly translationX: number;\n readonly translationY: number;\n readonly velocityAngular: number;\n readonly velocityExpansion: number;\n readonly velocityX: number;\n readonly velocityY: number;\n initGestureEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, offsetXArg: number, offsetYArg: number, translationXArg: number, translationYArg: number, scaleArg: number, expansionArg: number, rotationArg: number, velocityXArg: number, velocityYArg: number, velocityExpansionArg: number, velocityAngularArg: number, hwTimestampArg: number): void;\n readonly MSGESTURE_FLAG_BEGIN: number;\n readonly MSGESTURE_FLAG_CANCEL: number;\n readonly MSGESTURE_FLAG_END: number;\n readonly MSGESTURE_FLAG_INERTIA: number;\n readonly MSGESTURE_FLAG_NONE: number;\n}\n\ndeclare var MSGestureEvent: {\n prototype: MSGestureEvent;\n new(): MSGestureEvent;\n readonly MSGESTURE_FLAG_BEGIN: number;\n readonly MSGESTURE_FLAG_CANCEL: number;\n readonly MSGESTURE_FLAG_END: number;\n readonly MSGESTURE_FLAG_INERTIA: number;\n readonly MSGESTURE_FLAG_NONE: number;\n}\n\ninterface MSGraphicsTrust {\n readonly constrictionActive: boolean;\n readonly status: string;\n}\n\ndeclare var MSGraphicsTrust: {\n prototype: MSGraphicsTrust;\n new(): MSGraphicsTrust;\n}\n\ninterface MSHTMLWebViewElement extends HTMLElement {\n readonly canGoBack: boolean;\n readonly canGoForward: boolean;\n readonly containsFullScreenElement: boolean;\n readonly documentTitle: string;\n height: number;\n readonly settings: MSWebViewSettings;\n src: string;\n width: number;\n addWebAllowedObject(name: string, applicationObject: any): void;\n buildLocalStreamUri(contentIdentifier: string, relativePath: string): string;\n capturePreviewToBlobAsync(): MSWebViewAsyncOperation;\n captureSelectedContentToDataPackageAsync(): MSWebViewAsyncOperation;\n getDeferredPermissionRequestById(id: number): DeferredPermissionRequest;\n getDeferredPermissionRequests(): DeferredPermissionRequest[];\n goBack(): void;\n goForward(): void;\n invokeScriptAsync(scriptName: string, ...args: any[]): MSWebViewAsyncOperation;\n navigate(uri: string): void;\n navigateToLocalStreamUri(source: string, streamResolver: any): void;\n navigateToString(contents: string): void;\n navigateWithHttpRequestMessage(requestMessage: any): void;\n refresh(): void;\n stop(): void;\n addEventListener(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MSHTMLWebViewElement: {\n prototype: MSHTMLWebViewElement;\n new(): MSHTMLWebViewElement;\n}\n\ninterface MSInputMethodContextEventMap {\n \"MSCandidateWindowHide\": Event;\n \"MSCandidateWindowShow\": Event;\n \"MSCandidateWindowUpdate\": Event;\n}\n\ninterface MSInputMethodContext extends EventTarget {\n readonly compositionEndOffset: number;\n readonly compositionStartOffset: number;\n oncandidatewindowhide: (this: MSInputMethodContext, ev: Event) => any;\n oncandidatewindowshow: (this: MSInputMethodContext, ev: Event) => any;\n oncandidatewindowupdate: (this: MSInputMethodContext, ev: Event) => any;\n readonly target: HTMLElement;\n getCandidateWindowClientRect(): ClientRect;\n getCompositionAlternatives(): string[];\n hasComposition(): boolean;\n isCandidateWindowVisible(): boolean;\n addEventListener(type: K, listener: (this: MSInputMethodContext, ev: MSInputMethodContextEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MSInputMethodContext: {\n prototype: MSInputMethodContext;\n new(): MSInputMethodContext;\n}\n\ninterface MSManipulationEvent extends UIEvent {\n readonly currentState: number;\n readonly inertiaDestinationX: number;\n readonly inertiaDestinationY: number;\n readonly lastState: number;\n initMSManipulationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, lastState: number, currentState: number): void;\n readonly MS_MANIPULATION_STATE_ACTIVE: number;\n readonly MS_MANIPULATION_STATE_CANCELLED: number;\n readonly MS_MANIPULATION_STATE_COMMITTED: number;\n readonly MS_MANIPULATION_STATE_DRAGGING: number;\n readonly MS_MANIPULATION_STATE_INERTIA: number;\n readonly MS_MANIPULATION_STATE_PRESELECT: number;\n readonly MS_MANIPULATION_STATE_SELECTING: number;\n readonly MS_MANIPULATION_STATE_STOPPED: number;\n}\n\ndeclare var MSManipulationEvent: {\n prototype: MSManipulationEvent;\n new(): MSManipulationEvent;\n readonly MS_MANIPULATION_STATE_ACTIVE: number;\n readonly MS_MANIPULATION_STATE_CANCELLED: number;\n readonly MS_MANIPULATION_STATE_COMMITTED: number;\n readonly MS_MANIPULATION_STATE_DRAGGING: number;\n readonly MS_MANIPULATION_STATE_INERTIA: number;\n readonly MS_MANIPULATION_STATE_PRESELECT: number;\n readonly MS_MANIPULATION_STATE_SELECTING: number;\n readonly MS_MANIPULATION_STATE_STOPPED: number;\n}\n\ninterface MSMediaKeyError {\n readonly code: number;\n readonly systemCode: number;\n readonly MS_MEDIA_KEYERR_CLIENT: number;\n readonly MS_MEDIA_KEYERR_DOMAIN: number;\n readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number;\n readonly MS_MEDIA_KEYERR_OUTPUT: number;\n readonly MS_MEDIA_KEYERR_SERVICE: number;\n readonly MS_MEDIA_KEYERR_UNKNOWN: number;\n}\n\ndeclare var MSMediaKeyError: {\n prototype: MSMediaKeyError;\n new(): MSMediaKeyError;\n readonly MS_MEDIA_KEYERR_CLIENT: number;\n readonly MS_MEDIA_KEYERR_DOMAIN: number;\n readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number;\n readonly MS_MEDIA_KEYERR_OUTPUT: number;\n readonly MS_MEDIA_KEYERR_SERVICE: number;\n readonly MS_MEDIA_KEYERR_UNKNOWN: number;\n}\n\ninterface MSMediaKeyMessageEvent extends Event {\n readonly destinationURL: string | null;\n readonly message: Uint8Array;\n}\n\ndeclare var MSMediaKeyMessageEvent: {\n prototype: MSMediaKeyMessageEvent;\n new(): MSMediaKeyMessageEvent;\n}\n\ninterface MSMediaKeyNeededEvent extends Event {\n readonly initData: Uint8Array | null;\n}\n\ndeclare var MSMediaKeyNeededEvent: {\n prototype: MSMediaKeyNeededEvent;\n new(): MSMediaKeyNeededEvent;\n}\n\ninterface MSMediaKeySession extends EventTarget {\n readonly error: MSMediaKeyError | null;\n readonly keySystem: string;\n readonly sessionId: string;\n close(): void;\n update(key: Uint8Array): void;\n}\n\ndeclare var MSMediaKeySession: {\n prototype: MSMediaKeySession;\n new(): MSMediaKeySession;\n}\n\ninterface MSMediaKeys {\n readonly keySystem: string;\n createSession(type: string, initData: Uint8Array, cdmData?: Uint8Array): MSMediaKeySession;\n}\n\ndeclare var MSMediaKeys: {\n prototype: MSMediaKeys;\n new(keySystem: string): MSMediaKeys;\n isTypeSupported(keySystem: string, type?: string): boolean;\n isTypeSupportedWithFeatures(keySystem: string, type?: string): string;\n}\n\ninterface MSPointerEvent extends MouseEvent {\n readonly currentPoint: any;\n readonly height: number;\n readonly hwTimestamp: number;\n readonly intermediatePoints: any;\n readonly isPrimary: boolean;\n readonly pointerId: number;\n readonly pointerType: any;\n readonly pressure: number;\n readonly rotation: number;\n readonly tiltX: number;\n readonly tiltY: number;\n readonly width: number;\n getCurrentPoint(element: Element): void;\n getIntermediatePoints(element: Element): void;\n initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void;\n}\n\ndeclare var MSPointerEvent: {\n prototype: MSPointerEvent;\n new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent;\n}\n\ninterface MSRangeCollection {\n readonly length: number;\n item(index: number): Range;\n [index: number]: Range;\n}\n\ndeclare var MSRangeCollection: {\n prototype: MSRangeCollection;\n new(): MSRangeCollection;\n}\n\ninterface MSSiteModeEvent extends Event {\n readonly actionURL: string;\n readonly buttonID: number;\n}\n\ndeclare var MSSiteModeEvent: {\n prototype: MSSiteModeEvent;\n new(): MSSiteModeEvent;\n}\n\ninterface MSStream {\n readonly type: string;\n msClose(): void;\n msDetachStream(): any;\n}\n\ndeclare var MSStream: {\n prototype: MSStream;\n new(): MSStream;\n}\n\ninterface MSStreamReader extends EventTarget, MSBaseReader {\n readonly error: DOMError;\n readAsArrayBuffer(stream: MSStream, size?: number): void;\n readAsBinaryString(stream: MSStream, size?: number): void;\n readAsBlob(stream: MSStream, size?: number): void;\n readAsDataURL(stream: MSStream, size?: number): void;\n readAsText(stream: MSStream, encoding?: string, size?: number): void;\n addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MSStreamReader: {\n prototype: MSStreamReader;\n new(): MSStreamReader;\n}\n\ninterface MSWebViewAsyncOperationEventMap {\n \"complete\": Event;\n \"error\": ErrorEvent;\n}\n\ninterface MSWebViewAsyncOperation extends EventTarget {\n readonly error: DOMError;\n oncomplete: (this: MSWebViewAsyncOperation, ev: Event) => any;\n onerror: (this: MSWebViewAsyncOperation, ev: ErrorEvent) => any;\n readonly readyState: number;\n readonly result: any;\n readonly target: MSHTMLWebViewElement;\n readonly type: number;\n start(): void;\n readonly COMPLETED: number;\n readonly ERROR: number;\n readonly STARTED: number;\n readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number;\n readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number;\n readonly TYPE_INVOKE_SCRIPT: number;\n addEventListener(type: K, listener: (this: MSWebViewAsyncOperation, ev: MSWebViewAsyncOperationEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MSWebViewAsyncOperation: {\n prototype: MSWebViewAsyncOperation;\n new(): MSWebViewAsyncOperation;\n readonly COMPLETED: number;\n readonly ERROR: number;\n readonly STARTED: number;\n readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number;\n readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number;\n readonly TYPE_INVOKE_SCRIPT: number;\n}\n\ninterface MSWebViewSettings {\n isIndexedDBEnabled: boolean;\n isJavaScriptEnabled: boolean;\n}\n\ndeclare var MSWebViewSettings: {\n prototype: MSWebViewSettings;\n new(): MSWebViewSettings;\n}\n\ninterface MediaDeviceInfo {\n readonly deviceId: string;\n readonly groupId: string;\n readonly kind: string;\n readonly label: string;\n}\n\ndeclare var MediaDeviceInfo: {\n prototype: MediaDeviceInfo;\n new(): MediaDeviceInfo;\n}\n\ninterface MediaDevicesEventMap {\n \"devicechange\": Event;\n}\n\ninterface MediaDevices extends EventTarget {\n ondevicechange: (this: MediaDevices, ev: Event) => any;\n enumerateDevices(): any;\n getSupportedConstraints(): MediaTrackSupportedConstraints;\n getUserMedia(constraints: MediaStreamConstraints): PromiseLike;\n addEventListener(type: K, listener: (this: MediaDevices, ev: MediaDevicesEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MediaDevices: {\n prototype: MediaDevices;\n new(): MediaDevices;\n}\n\ninterface MediaElementAudioSourceNode extends AudioNode {\n}\n\ndeclare var MediaElementAudioSourceNode: {\n prototype: MediaElementAudioSourceNode;\n new(): MediaElementAudioSourceNode;\n}\n\ninterface MediaEncryptedEvent extends Event {\n readonly initData: ArrayBuffer | null;\n readonly initDataType: string;\n}\n\ndeclare var MediaEncryptedEvent: {\n prototype: MediaEncryptedEvent;\n new(type: string, eventInitDict?: MediaEncryptedEventInit): MediaEncryptedEvent;\n}\n\ninterface MediaError {\n readonly code: number;\n readonly msExtendedCode: number;\n readonly MEDIA_ERR_ABORTED: number;\n readonly MEDIA_ERR_DECODE: number;\n readonly MEDIA_ERR_NETWORK: number;\n readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number;\n readonly MS_MEDIA_ERR_ENCRYPTED: number;\n}\n\ndeclare var MediaError: {\n prototype: MediaError;\n new(): MediaError;\n readonly MEDIA_ERR_ABORTED: number;\n readonly MEDIA_ERR_DECODE: number;\n readonly MEDIA_ERR_NETWORK: number;\n readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number;\n readonly MS_MEDIA_ERR_ENCRYPTED: number;\n}\n\ninterface MediaKeyMessageEvent extends Event {\n readonly message: ArrayBuffer;\n readonly messageType: string;\n}\n\ndeclare var MediaKeyMessageEvent: {\n prototype: MediaKeyMessageEvent;\n new(type: string, eventInitDict?: MediaKeyMessageEventInit): MediaKeyMessageEvent;\n}\n\ninterface MediaKeySession extends EventTarget {\n readonly closed: PromiseLike;\n readonly expiration: number;\n readonly keyStatuses: MediaKeyStatusMap;\n readonly sessionId: string;\n close(): PromiseLike;\n generateRequest(initDataType: string, initData: any): PromiseLike;\n load(sessionId: string): PromiseLike;\n remove(): PromiseLike;\n update(response: any): PromiseLike;\n}\n\ndeclare var MediaKeySession: {\n prototype: MediaKeySession;\n new(): MediaKeySession;\n}\n\ninterface MediaKeyStatusMap {\n readonly size: number;\n forEach(callback: ForEachCallback): void;\n get(keyId: any): string;\n has(keyId: any): boolean;\n}\n\ndeclare var MediaKeyStatusMap: {\n prototype: MediaKeyStatusMap;\n new(): MediaKeyStatusMap;\n}\n\ninterface MediaKeySystemAccess {\n readonly keySystem: string;\n createMediaKeys(): PromiseLike;\n getConfiguration(): MediaKeySystemConfiguration;\n}\n\ndeclare var MediaKeySystemAccess: {\n prototype: MediaKeySystemAccess;\n new(): MediaKeySystemAccess;\n}\n\ninterface MediaKeys {\n createSession(sessionType?: string): MediaKeySession;\n setServerCertificate(serverCertificate: any): PromiseLike;\n}\n\ndeclare var MediaKeys: {\n prototype: MediaKeys;\n new(): MediaKeys;\n}\n\ninterface MediaList {\n readonly length: number;\n mediaText: string;\n appendMedium(newMedium: string): void;\n deleteMedium(oldMedium: string): void;\n item(index: number): string;\n toString(): string;\n [index: number]: string;\n}\n\ndeclare var MediaList: {\n prototype: MediaList;\n new(): MediaList;\n}\n\ninterface MediaQueryList {\n readonly matches: boolean;\n readonly media: string;\n addListener(listener: MediaQueryListListener): void;\n removeListener(listener: MediaQueryListListener): void;\n}\n\ndeclare var MediaQueryList: {\n prototype: MediaQueryList;\n new(): MediaQueryList;\n}\n\ninterface MediaSource extends EventTarget {\n readonly activeSourceBuffers: SourceBufferList;\n duration: number;\n readonly readyState: string;\n readonly sourceBuffers: SourceBufferList;\n addSourceBuffer(type: string): SourceBuffer;\n endOfStream(error?: number): void;\n removeSourceBuffer(sourceBuffer: SourceBuffer): void;\n}\n\ndeclare var MediaSource: {\n prototype: MediaSource;\n new(): MediaSource;\n isTypeSupported(type: string): boolean;\n}\n\ninterface MediaStreamEventMap {\n \"active\": Event;\n \"addtrack\": TrackEvent;\n \"inactive\": Event;\n \"removetrack\": TrackEvent;\n}\n\ninterface MediaStream extends EventTarget {\n readonly active: boolean;\n readonly id: string;\n onactive: (this: MediaStream, ev: Event) => any;\n onaddtrack: (this: MediaStream, ev: TrackEvent) => any;\n oninactive: (this: MediaStream, ev: Event) => any;\n onremovetrack: (this: MediaStream, ev: TrackEvent) => any;\n addTrack(track: MediaStreamTrack): void;\n clone(): MediaStream;\n getAudioTracks(): MediaStreamTrack[];\n getTrackById(trackId: string): MediaStreamTrack | null;\n getTracks(): MediaStreamTrack[];\n getVideoTracks(): MediaStreamTrack[];\n removeTrack(track: MediaStreamTrack): void;\n stop(): void;\n addEventListener(type: K, listener: (this: MediaStream, ev: MediaStreamEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MediaStream: {\n prototype: MediaStream;\n new(streamOrTracks?: MediaStream | MediaStreamTrack[]): MediaStream;\n}\n\ninterface MediaStreamAudioSourceNode extends AudioNode {\n}\n\ndeclare var MediaStreamAudioSourceNode: {\n prototype: MediaStreamAudioSourceNode;\n new(): MediaStreamAudioSourceNode;\n}\n\ninterface MediaStreamError {\n readonly constraintName: string | null;\n readonly message: string | null;\n readonly name: string;\n}\n\ndeclare var MediaStreamError: {\n prototype: MediaStreamError;\n new(): MediaStreamError;\n}\n\ninterface MediaStreamErrorEvent extends Event {\n readonly error: MediaStreamError | null;\n}\n\ndeclare var MediaStreamErrorEvent: {\n prototype: MediaStreamErrorEvent;\n new(type: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent;\n}\n\ninterface MediaStreamTrackEventMap {\n \"ended\": MediaStreamErrorEvent;\n \"mute\": Event;\n \"overconstrained\": MediaStreamErrorEvent;\n \"unmute\": Event;\n}\n\ninterface MediaStreamTrack extends EventTarget {\n enabled: boolean;\n readonly id: string;\n readonly kind: string;\n readonly label: string;\n readonly muted: boolean;\n onended: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any;\n onmute: (this: MediaStreamTrack, ev: Event) => any;\n onoverconstrained: (this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any;\n onunmute: (this: MediaStreamTrack, ev: Event) => any;\n readonly readonly: boolean;\n readonly readyState: string;\n readonly remote: boolean;\n applyConstraints(constraints: MediaTrackConstraints): PromiseLike;\n clone(): MediaStreamTrack;\n getCapabilities(): MediaTrackCapabilities;\n getConstraints(): MediaTrackConstraints;\n getSettings(): MediaTrackSettings;\n stop(): void;\n addEventListener(type: K, listener: (this: MediaStreamTrack, ev: MediaStreamTrackEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MediaStreamTrack: {\n prototype: MediaStreamTrack;\n new(): MediaStreamTrack;\n}\n\ninterface MediaStreamTrackEvent extends Event {\n readonly track: MediaStreamTrack;\n}\n\ndeclare var MediaStreamTrackEvent: {\n prototype: MediaStreamTrackEvent;\n new(type: string, eventInitDict?: MediaStreamTrackEventInit): MediaStreamTrackEvent;\n}\n\ninterface MessageChannel {\n readonly port1: MessagePort;\n readonly port2: MessagePort;\n}\n\ndeclare var MessageChannel: {\n prototype: MessageChannel;\n new(): MessageChannel;\n}\n\ninterface MessageEvent extends Event {\n readonly data: any;\n readonly origin: string;\n readonly ports: any;\n readonly source: Window;\n initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: Window): void;\n}\n\ndeclare var MessageEvent: {\n prototype: MessageEvent;\n new(type: string, eventInitDict?: MessageEventInit): MessageEvent;\n}\n\ninterface MessagePortEventMap {\n \"message\": MessageEvent;\n}\n\ninterface MessagePort extends EventTarget {\n onmessage: (this: MessagePort, ev: MessageEvent) => any;\n close(): void;\n postMessage(message?: any, ports?: any): void;\n start(): void;\n addEventListener(type: K, listener: (this: MessagePort, ev: MessagePortEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var MessagePort: {\n prototype: MessagePort;\n new(): MessagePort;\n}\n\ninterface MimeType {\n readonly description: string;\n readonly enabledPlugin: Plugin;\n readonly suffixes: string;\n readonly type: string;\n}\n\ndeclare var MimeType: {\n prototype: MimeType;\n new(): MimeType;\n}\n\ninterface MimeTypeArray {\n readonly length: number;\n item(index: number): Plugin;\n namedItem(type: string): Plugin;\n [index: number]: Plugin;\n}\n\ndeclare var MimeTypeArray: {\n prototype: MimeTypeArray;\n new(): MimeTypeArray;\n}\n\ninterface MouseEvent extends UIEvent {\n readonly altKey: boolean;\n readonly button: number;\n readonly buttons: number;\n readonly clientX: number;\n readonly clientY: number;\n readonly ctrlKey: boolean;\n readonly fromElement: Element;\n readonly layerX: number;\n readonly layerY: number;\n readonly metaKey: boolean;\n readonly movementX: number;\n readonly movementY: number;\n readonly offsetX: number;\n readonly offsetY: number;\n readonly pageX: number;\n readonly pageY: number;\n readonly relatedTarget: EventTarget;\n readonly screenX: number;\n readonly screenY: number;\n readonly shiftKey: boolean;\n readonly toElement: Element;\n readonly which: number;\n readonly x: number;\n readonly y: number;\n getModifierState(keyArg: string): boolean;\n initMouseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget | null): void;\n}\n\ndeclare var MouseEvent: {\n prototype: MouseEvent;\n new(typeArg: string, eventInitDict?: MouseEventInit): MouseEvent;\n}\n\ninterface MutationEvent extends Event {\n readonly attrChange: number;\n readonly attrName: string;\n readonly newValue: string;\n readonly prevValue: string;\n readonly relatedNode: Node;\n initMutationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, relatedNodeArg: Node, prevValueArg: string, newValueArg: string, attrNameArg: string, attrChangeArg: number): void;\n readonly ADDITION: number;\n readonly MODIFICATION: number;\n readonly REMOVAL: number;\n}\n\ndeclare var MutationEvent: {\n prototype: MutationEvent;\n new(): MutationEvent;\n readonly ADDITION: number;\n readonly MODIFICATION: number;\n readonly REMOVAL: number;\n}\n\ninterface MutationObserver {\n disconnect(): void;\n observe(target: Node, options: MutationObserverInit): void;\n takeRecords(): MutationRecord[];\n}\n\ndeclare var MutationObserver: {\n prototype: MutationObserver;\n new(callback: MutationCallback): MutationObserver;\n}\n\ninterface MutationRecord {\n readonly addedNodes: NodeList;\n readonly attributeName: string | null;\n readonly attributeNamespace: string | null;\n readonly nextSibling: Node | null;\n readonly oldValue: string | null;\n readonly previousSibling: Node | null;\n readonly removedNodes: NodeList;\n readonly target: Node;\n readonly type: string;\n}\n\ndeclare var MutationRecord: {\n prototype: MutationRecord;\n new(): MutationRecord;\n}\n\ninterface NamedNodeMap {\n readonly length: number;\n getNamedItem(name: string): Attr;\n getNamedItemNS(namespaceURI: string | null, localName: string | null): Attr;\n item(index: number): Attr;\n removeNamedItem(name: string): Attr;\n removeNamedItemNS(namespaceURI: string | null, localName: string | null): Attr;\n setNamedItem(arg: Attr): Attr;\n setNamedItemNS(arg: Attr): Attr;\n [index: number]: Attr;\n}\n\ndeclare var NamedNodeMap: {\n prototype: NamedNodeMap;\n new(): NamedNodeMap;\n}\n\ninterface NavigationCompletedEvent extends NavigationEvent {\n readonly isSuccess: boolean;\n readonly webErrorStatus: number;\n}\n\ndeclare var NavigationCompletedEvent: {\n prototype: NavigationCompletedEvent;\n new(): NavigationCompletedEvent;\n}\n\ninterface NavigationEvent extends Event {\n readonly uri: string;\n}\n\ndeclare var NavigationEvent: {\n prototype: NavigationEvent;\n new(): NavigationEvent;\n}\n\ninterface NavigationEventWithReferrer extends NavigationEvent {\n readonly referer: string;\n}\n\ndeclare var NavigationEventWithReferrer: {\n prototype: NavigationEventWithReferrer;\n new(): NavigationEventWithReferrer;\n}\n\ninterface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver, NavigatorUserMedia {\n readonly appCodeName: string;\n readonly cookieEnabled: boolean;\n readonly language: string;\n readonly maxTouchPoints: number;\n readonly mimeTypes: MimeTypeArray;\n readonly msManipulationViewsEnabled: boolean;\n readonly msMaxTouchPoints: number;\n readonly msPointerEnabled: boolean;\n readonly plugins: PluginArray;\n readonly pointerEnabled: boolean;\n readonly webdriver: boolean;\n readonly hardwareConcurrency: number;\n getGamepads(): Gamepad[];\n javaEnabled(): boolean;\n msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void;\n requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): PromiseLike;\n vibrate(pattern: number | number[]): boolean;\n}\n\ndeclare var Navigator: {\n prototype: Navigator;\n new(): Navigator;\n}\n\ninterface Node extends EventTarget {\n readonly attributes: NamedNodeMap;\n readonly baseURI: string | null;\n readonly childNodes: NodeList;\n readonly firstChild: Node | null;\n readonly lastChild: Node | null;\n readonly localName: string | null;\n readonly namespaceURI: string | null;\n readonly nextSibling: Node | null;\n readonly nodeName: string;\n readonly nodeType: number;\n nodeValue: string | null;\n readonly ownerDocument: Document;\n readonly parentElement: HTMLElement | null;\n readonly parentNode: Node | null;\n readonly previousSibling: Node | null;\n textContent: string | null;\n appendChild(newChild: Node): Node;\n cloneNode(deep?: boolean): Node;\n compareDocumentPosition(other: Node): number;\n contains(child: Node): boolean;\n hasAttributes(): boolean;\n hasChildNodes(): boolean;\n insertBefore(newChild: Node, refChild: Node | null): Node;\n isDefaultNamespace(namespaceURI: string | null): boolean;\n isEqualNode(arg: Node): boolean;\n isSameNode(other: Node): boolean;\n lookupNamespaceURI(prefix: string | null): string | null;\n lookupPrefix(namespaceURI: string | null): string | null;\n normalize(): void;\n removeChild(oldChild: Node): Node;\n replaceChild(newChild: Node, oldChild: Node): Node;\n readonly ATTRIBUTE_NODE: number;\n readonly CDATA_SECTION_NODE: number;\n readonly COMMENT_NODE: number;\n readonly DOCUMENT_FRAGMENT_NODE: number;\n readonly DOCUMENT_NODE: number;\n readonly DOCUMENT_POSITION_CONTAINED_BY: number;\n readonly DOCUMENT_POSITION_CONTAINS: number;\n readonly DOCUMENT_POSITION_DISCONNECTED: number;\n readonly DOCUMENT_POSITION_FOLLOWING: number;\n readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number;\n readonly DOCUMENT_POSITION_PRECEDING: number;\n readonly DOCUMENT_TYPE_NODE: number;\n readonly ELEMENT_NODE: number;\n readonly ENTITY_NODE: number;\n readonly ENTITY_REFERENCE_NODE: number;\n readonly NOTATION_NODE: number;\n readonly PROCESSING_INSTRUCTION_NODE: number;\n readonly TEXT_NODE: number;\n}\n\ndeclare var Node: {\n prototype: Node;\n new(): Node;\n readonly ATTRIBUTE_NODE: number;\n readonly CDATA_SECTION_NODE: number;\n readonly COMMENT_NODE: number;\n readonly DOCUMENT_FRAGMENT_NODE: number;\n readonly DOCUMENT_NODE: number;\n readonly DOCUMENT_POSITION_CONTAINED_BY: number;\n readonly DOCUMENT_POSITION_CONTAINS: number;\n readonly DOCUMENT_POSITION_DISCONNECTED: number;\n readonly DOCUMENT_POSITION_FOLLOWING: number;\n readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number;\n readonly DOCUMENT_POSITION_PRECEDING: number;\n readonly DOCUMENT_TYPE_NODE: number;\n readonly ELEMENT_NODE: number;\n readonly ENTITY_NODE: number;\n readonly ENTITY_REFERENCE_NODE: number;\n readonly NOTATION_NODE: number;\n readonly PROCESSING_INSTRUCTION_NODE: number;\n readonly TEXT_NODE: number;\n}\n\ninterface NodeFilter {\n acceptNode(n: Node): number;\n}\n\ndeclare var NodeFilter: {\n readonly FILTER_ACCEPT: number;\n readonly FILTER_REJECT: number;\n readonly FILTER_SKIP: number;\n readonly SHOW_ALL: number;\n readonly SHOW_ATTRIBUTE: number;\n readonly SHOW_CDATA_SECTION: number;\n readonly SHOW_COMMENT: number;\n readonly SHOW_DOCUMENT: number;\n readonly SHOW_DOCUMENT_FRAGMENT: number;\n readonly SHOW_DOCUMENT_TYPE: number;\n readonly SHOW_ELEMENT: number;\n readonly SHOW_ENTITY: number;\n readonly SHOW_ENTITY_REFERENCE: number;\n readonly SHOW_NOTATION: number;\n readonly SHOW_PROCESSING_INSTRUCTION: number;\n readonly SHOW_TEXT: number;\n}\n\ninterface NodeIterator {\n readonly expandEntityReferences: boolean;\n readonly filter: NodeFilter;\n readonly root: Node;\n readonly whatToShow: number;\n detach(): void;\n nextNode(): Node;\n previousNode(): Node;\n}\n\ndeclare var NodeIterator: {\n prototype: NodeIterator;\n new(): NodeIterator;\n}\n\ninterface NodeList {\n readonly length: number;\n item(index: number): Node;\n [index: number]: Node;\n}\n\ndeclare var NodeList: {\n prototype: NodeList;\n new(): NodeList;\n}\n\ninterface OES_element_index_uint {\n}\n\ndeclare var OES_element_index_uint: {\n prototype: OES_element_index_uint;\n new(): OES_element_index_uint;\n}\n\ninterface OES_standard_derivatives {\n readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number;\n}\n\ndeclare var OES_standard_derivatives: {\n prototype: OES_standard_derivatives;\n new(): OES_standard_derivatives;\n readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number;\n}\n\ninterface OES_texture_float {\n}\n\ndeclare var OES_texture_float: {\n prototype: OES_texture_float;\n new(): OES_texture_float;\n}\n\ninterface OES_texture_float_linear {\n}\n\ndeclare var OES_texture_float_linear: {\n prototype: OES_texture_float_linear;\n new(): OES_texture_float_linear;\n}\n\ninterface OfflineAudioCompletionEvent extends Event {\n readonly renderedBuffer: AudioBuffer;\n}\n\ndeclare var OfflineAudioCompletionEvent: {\n prototype: OfflineAudioCompletionEvent;\n new(): OfflineAudioCompletionEvent;\n}\n\ninterface OfflineAudioContextEventMap {\n \"complete\": Event;\n}\n\ninterface OfflineAudioContext extends AudioContext {\n oncomplete: (this: OfflineAudioContext, ev: Event) => any;\n startRendering(): PromiseLike;\n addEventListener(type: K, listener: (this: OfflineAudioContext, ev: OfflineAudioContextEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var OfflineAudioContext: {\n prototype: OfflineAudioContext;\n new(numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext;\n}\n\ninterface OscillatorNodeEventMap {\n \"ended\": MediaStreamErrorEvent;\n}\n\ninterface OscillatorNode extends AudioNode {\n readonly detune: AudioParam;\n readonly frequency: AudioParam;\n onended: (this: OscillatorNode, ev: MediaStreamErrorEvent) => any;\n type: string;\n setPeriodicWave(periodicWave: PeriodicWave): void;\n start(when?: number): void;\n stop(when?: number): void;\n addEventListener(type: K, listener: (this: OscillatorNode, ev: OscillatorNodeEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var OscillatorNode: {\n prototype: OscillatorNode;\n new(): OscillatorNode;\n}\n\ninterface OverflowEvent extends UIEvent {\n readonly horizontalOverflow: boolean;\n readonly orient: number;\n readonly verticalOverflow: boolean;\n readonly BOTH: number;\n readonly HORIZONTAL: number;\n readonly VERTICAL: number;\n}\n\ndeclare var OverflowEvent: {\n prototype: OverflowEvent;\n new(): OverflowEvent;\n readonly BOTH: number;\n readonly HORIZONTAL: number;\n readonly VERTICAL: number;\n}\n\ninterface PageTransitionEvent extends Event {\n readonly persisted: boolean;\n}\n\ndeclare var PageTransitionEvent: {\n prototype: PageTransitionEvent;\n new(): PageTransitionEvent;\n}\n\ninterface PannerNode extends AudioNode {\n coneInnerAngle: number;\n coneOuterAngle: number;\n coneOuterGain: number;\n distanceModel: string;\n maxDistance: number;\n panningModel: string;\n refDistance: number;\n rolloffFactor: number;\n setOrientation(x: number, y: number, z: number): void;\n setPosition(x: number, y: number, z: number): void;\n setVelocity(x: number, y: number, z: number): void;\n}\n\ndeclare var PannerNode: {\n prototype: PannerNode;\n new(): PannerNode;\n}\n\ninterface PerfWidgetExternal {\n readonly activeNetworkRequestCount: number;\n readonly averageFrameTime: number;\n readonly averagePaintTime: number;\n readonly extraInformationEnabled: boolean;\n readonly independentRenderingEnabled: boolean;\n readonly irDisablingContentString: string;\n readonly irStatusAvailable: boolean;\n readonly maxCpuSpeed: number;\n readonly paintRequestsPerSecond: number;\n readonly performanceCounter: number;\n readonly performanceCounterFrequency: number;\n addEventListener(eventType: string, callback: Function): void;\n getMemoryUsage(): number;\n getProcessCpuUsage(): number;\n getRecentCpuUsage(last: number | null): any;\n getRecentFrames(last: number | null): any;\n getRecentMemoryUsage(last: number | null): any;\n getRecentPaintRequests(last: number | null): any;\n removeEventListener(eventType: string, callback: Function): void;\n repositionWindow(x: number, y: number): void;\n resizeWindow(width: number, height: number): void;\n}\n\ndeclare var PerfWidgetExternal: {\n prototype: PerfWidgetExternal;\n new(): PerfWidgetExternal;\n}\n\ninterface Performance {\n readonly navigation: PerformanceNavigation;\n readonly timing: PerformanceTiming;\n clearMarks(markName?: string): void;\n clearMeasures(measureName?: string): void;\n clearResourceTimings(): void;\n getEntries(): any;\n getEntriesByName(name: string, entryType?: string): any;\n getEntriesByType(entryType: string): any;\n getMarks(markName?: string): any;\n getMeasures(measureName?: string): any;\n mark(markName: string): void;\n measure(measureName: string, startMarkName?: string, endMarkName?: string): void;\n now(): number;\n setResourceTimingBufferSize(maxSize: number): void;\n toJSON(): any;\n}\n\ndeclare var Performance: {\n prototype: Performance;\n new(): Performance;\n}\n\ninterface PerformanceEntry {\n readonly duration: number;\n readonly entryType: string;\n readonly name: string;\n readonly startTime: number;\n}\n\ndeclare var PerformanceEntry: {\n prototype: PerformanceEntry;\n new(): PerformanceEntry;\n}\n\ninterface PerformanceMark extends PerformanceEntry {\n}\n\ndeclare var PerformanceMark: {\n prototype: PerformanceMark;\n new(): PerformanceMark;\n}\n\ninterface PerformanceMeasure extends PerformanceEntry {\n}\n\ndeclare var PerformanceMeasure: {\n prototype: PerformanceMeasure;\n new(): PerformanceMeasure;\n}\n\ninterface PerformanceNavigation {\n readonly redirectCount: number;\n readonly type: number;\n toJSON(): any;\n readonly TYPE_BACK_FORWARD: number;\n readonly TYPE_NAVIGATE: number;\n readonly TYPE_RELOAD: number;\n readonly TYPE_RESERVED: number;\n}\n\ndeclare var PerformanceNavigation: {\n prototype: PerformanceNavigation;\n new(): PerformanceNavigation;\n readonly TYPE_BACK_FORWARD: number;\n readonly TYPE_NAVIGATE: number;\n readonly TYPE_RELOAD: number;\n readonly TYPE_RESERVED: number;\n}\n\ninterface PerformanceNavigationTiming extends PerformanceEntry {\n readonly connectEnd: number;\n readonly connectStart: number;\n readonly domComplete: number;\n readonly domContentLoadedEventEnd: number;\n readonly domContentLoadedEventStart: number;\n readonly domInteractive: number;\n readonly domLoading: number;\n readonly domainLookupEnd: number;\n readonly domainLookupStart: number;\n readonly fetchStart: number;\n readonly loadEventEnd: number;\n readonly loadEventStart: number;\n readonly navigationStart: number;\n readonly redirectCount: number;\n readonly redirectEnd: number;\n readonly redirectStart: number;\n readonly requestStart: number;\n readonly responseEnd: number;\n readonly responseStart: number;\n readonly type: string;\n readonly unloadEventEnd: number;\n readonly unloadEventStart: number;\n}\n\ndeclare var PerformanceNavigationTiming: {\n prototype: PerformanceNavigationTiming;\n new(): PerformanceNavigationTiming;\n}\n\ninterface PerformanceResourceTiming extends PerformanceEntry {\n readonly connectEnd: number;\n readonly connectStart: number;\n readonly domainLookupEnd: number;\n readonly domainLookupStart: number;\n readonly fetchStart: number;\n readonly initiatorType: string;\n readonly redirectEnd: number;\n readonly redirectStart: number;\n readonly requestStart: number;\n readonly responseEnd: number;\n readonly responseStart: number;\n}\n\ndeclare var PerformanceResourceTiming: {\n prototype: PerformanceResourceTiming;\n new(): PerformanceResourceTiming;\n}\n\ninterface PerformanceTiming {\n readonly connectEnd: number;\n readonly connectStart: number;\n readonly domComplete: number;\n readonly domContentLoadedEventEnd: number;\n readonly domContentLoadedEventStart: number;\n readonly domInteractive: number;\n readonly domLoading: number;\n readonly domainLookupEnd: number;\n readonly domainLookupStart: number;\n readonly fetchStart: number;\n readonly loadEventEnd: number;\n readonly loadEventStart: number;\n readonly msFirstPaint: number;\n readonly navigationStart: number;\n readonly redirectEnd: number;\n readonly redirectStart: number;\n readonly requestStart: number;\n readonly responseEnd: number;\n readonly responseStart: number;\n readonly unloadEventEnd: number;\n readonly unloadEventStart: number;\n readonly secureConnectionStart: number;\n toJSON(): any;\n}\n\ndeclare var PerformanceTiming: {\n prototype: PerformanceTiming;\n new(): PerformanceTiming;\n}\n\ninterface PeriodicWave {\n}\n\ndeclare var PeriodicWave: {\n prototype: PeriodicWave;\n new(): PeriodicWave;\n}\n\ninterface PermissionRequest extends DeferredPermissionRequest {\n readonly state: string;\n defer(): void;\n}\n\ndeclare var PermissionRequest: {\n prototype: PermissionRequest;\n new(): PermissionRequest;\n}\n\ninterface PermissionRequestedEvent extends Event {\n readonly permissionRequest: PermissionRequest;\n}\n\ndeclare var PermissionRequestedEvent: {\n prototype: PermissionRequestedEvent;\n new(): PermissionRequestedEvent;\n}\n\ninterface Plugin {\n readonly description: string;\n readonly filename: string;\n readonly length: number;\n readonly name: string;\n readonly version: string;\n item(index: number): MimeType;\n namedItem(type: string): MimeType;\n [index: number]: MimeType;\n}\n\ndeclare var Plugin: {\n prototype: Plugin;\n new(): Plugin;\n}\n\ninterface PluginArray {\n readonly length: number;\n item(index: number): Plugin;\n namedItem(name: string): Plugin;\n refresh(reload?: boolean): void;\n [index: number]: Plugin;\n}\n\ndeclare var PluginArray: {\n prototype: PluginArray;\n new(): PluginArray;\n}\n\ninterface PointerEvent extends MouseEvent {\n readonly currentPoint: any;\n readonly height: number;\n readonly hwTimestamp: number;\n readonly intermediatePoints: any;\n readonly isPrimary: boolean;\n readonly pointerId: number;\n readonly pointerType: any;\n readonly pressure: number;\n readonly rotation: number;\n readonly tiltX: number;\n readonly tiltY: number;\n readonly width: number;\n getCurrentPoint(element: Element): void;\n getIntermediatePoints(element: Element): void;\n initPointerEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, ctrlKeyArg: boolean, altKeyArg: boolean, shiftKeyArg: boolean, metaKeyArg: boolean, buttonArg: number, relatedTargetArg: EventTarget, offsetXArg: number, offsetYArg: number, widthArg: number, heightArg: number, pressure: number, rotation: number, tiltX: number, tiltY: number, pointerIdArg: number, pointerType: any, hwTimestampArg: number, isPrimary: boolean): void;\n}\n\ndeclare var PointerEvent: {\n prototype: PointerEvent;\n new(typeArg: string, eventInitDict?: PointerEventInit): PointerEvent;\n}\n\ninterface PopStateEvent extends Event {\n readonly state: any;\n initPopStateEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, stateArg: any): void;\n}\n\ndeclare var PopStateEvent: {\n prototype: PopStateEvent;\n new(): PopStateEvent;\n}\n\ninterface Position {\n readonly coords: Coordinates;\n readonly timestamp: number;\n}\n\ndeclare var Position: {\n prototype: Position;\n new(): Position;\n}\n\ninterface PositionError {\n readonly code: number;\n readonly message: string;\n toString(): string;\n readonly PERMISSION_DENIED: number;\n readonly POSITION_UNAVAILABLE: number;\n readonly TIMEOUT: number;\n}\n\ndeclare var PositionError: {\n prototype: PositionError;\n new(): PositionError;\n readonly PERMISSION_DENIED: number;\n readonly POSITION_UNAVAILABLE: number;\n readonly TIMEOUT: number;\n}\n\ninterface ProcessingInstruction extends CharacterData {\n readonly target: string;\n}\n\ndeclare var ProcessingInstruction: {\n prototype: ProcessingInstruction;\n new(): ProcessingInstruction;\n}\n\ninterface ProgressEvent extends Event {\n readonly lengthComputable: boolean;\n readonly loaded: number;\n readonly total: number;\n initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void;\n}\n\ndeclare var ProgressEvent: {\n prototype: ProgressEvent;\n new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent;\n}\n\ninterface RTCDTMFToneChangeEvent extends Event {\n readonly tone: string;\n}\n\ndeclare var RTCDTMFToneChangeEvent: {\n prototype: RTCDTMFToneChangeEvent;\n new(type: string, eventInitDict: RTCDTMFToneChangeEventInit): RTCDTMFToneChangeEvent;\n}\n\ninterface RTCDtlsTransportEventMap {\n \"dtlsstatechange\": RTCDtlsTransportStateChangedEvent;\n \"error\": ErrorEvent;\n}\n\ninterface RTCDtlsTransport extends RTCStatsProvider {\n ondtlsstatechange: ((this: RTCDtlsTransport, ev: RTCDtlsTransportStateChangedEvent) => any) | null;\n onerror: ((this: RTCDtlsTransport, ev: ErrorEvent) => any) | null;\n readonly state: string;\n readonly transport: RTCIceTransport;\n getLocalParameters(): RTCDtlsParameters;\n getRemoteCertificates(): ArrayBuffer[];\n getRemoteParameters(): RTCDtlsParameters | null;\n start(remoteParameters: RTCDtlsParameters): void;\n stop(): void;\n addEventListener(type: K, listener: (this: RTCDtlsTransport, ev: RTCDtlsTransportEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var RTCDtlsTransport: {\n prototype: RTCDtlsTransport;\n new(transport: RTCIceTransport): RTCDtlsTransport;\n}\n\ninterface RTCDtlsTransportStateChangedEvent extends Event {\n readonly state: string;\n}\n\ndeclare var RTCDtlsTransportStateChangedEvent: {\n prototype: RTCDtlsTransportStateChangedEvent;\n new(): RTCDtlsTransportStateChangedEvent;\n}\n\ninterface RTCDtmfSenderEventMap {\n \"tonechange\": RTCDTMFToneChangeEvent;\n}\n\ninterface RTCDtmfSender extends EventTarget {\n readonly canInsertDTMF: boolean;\n readonly duration: number;\n readonly interToneGap: number;\n ontonechange: (this: RTCDtmfSender, ev: RTCDTMFToneChangeEvent) => any;\n readonly sender: RTCRtpSender;\n readonly toneBuffer: string;\n insertDTMF(tones: string, duration?: number, interToneGap?: number): void;\n addEventListener(type: K, listener: (this: RTCDtmfSender, ev: RTCDtmfSenderEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var RTCDtmfSender: {\n prototype: RTCDtmfSender;\n new(sender: RTCRtpSender): RTCDtmfSender;\n}\n\ninterface RTCIceCandidatePairChangedEvent extends Event {\n readonly pair: RTCIceCandidatePair;\n}\n\ndeclare var RTCIceCandidatePairChangedEvent: {\n prototype: RTCIceCandidatePairChangedEvent;\n new(): RTCIceCandidatePairChangedEvent;\n}\n\ninterface RTCIceGathererEventMap {\n \"error\": ErrorEvent;\n \"localcandidate\": RTCIceGathererEvent;\n}\n\ninterface RTCIceGatherer extends RTCStatsProvider {\n readonly component: string;\n onerror: ((this: RTCIceGatherer, ev: ErrorEvent) => any) | null;\n onlocalcandidate: ((this: RTCIceGatherer, ev: RTCIceGathererEvent) => any) | null;\n createAssociatedGatherer(): RTCIceGatherer;\n getLocalCandidates(): RTCIceCandidate[];\n getLocalParameters(): RTCIceParameters;\n addEventListener(type: K, listener: (this: RTCIceGatherer, ev: RTCIceGathererEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var RTCIceGatherer: {\n prototype: RTCIceGatherer;\n new(options: RTCIceGatherOptions): RTCIceGatherer;\n}\n\ninterface RTCIceGathererEvent extends Event {\n readonly candidate: RTCIceCandidate | RTCIceCandidateComplete;\n}\n\ndeclare var RTCIceGathererEvent: {\n prototype: RTCIceGathererEvent;\n new(): RTCIceGathererEvent;\n}\n\ninterface RTCIceTransportEventMap {\n \"candidatepairchange\": RTCIceCandidatePairChangedEvent;\n \"icestatechange\": RTCIceTransportStateChangedEvent;\n}\n\ninterface RTCIceTransport extends RTCStatsProvider {\n readonly component: string;\n readonly iceGatherer: RTCIceGatherer | null;\n oncandidatepairchange: ((this: RTCIceTransport, ev: RTCIceCandidatePairChangedEvent) => any) | null;\n onicestatechange: ((this: RTCIceTransport, ev: RTCIceTransportStateChangedEvent) => any) | null;\n readonly role: string;\n readonly state: string;\n addRemoteCandidate(remoteCandidate: RTCIceCandidate | RTCIceCandidateComplete): void;\n createAssociatedTransport(): RTCIceTransport;\n getNominatedCandidatePair(): RTCIceCandidatePair | null;\n getRemoteCandidates(): RTCIceCandidate[];\n getRemoteParameters(): RTCIceParameters | null;\n setRemoteCandidates(remoteCandidates: RTCIceCandidate[]): void;\n start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: string): void;\n stop(): void;\n addEventListener(type: K, listener: (this: RTCIceTransport, ev: RTCIceTransportEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var RTCIceTransport: {\n prototype: RTCIceTransport;\n new(): RTCIceTransport;\n}\n\ninterface RTCIceTransportStateChangedEvent extends Event {\n readonly state: string;\n}\n\ndeclare var RTCIceTransportStateChangedEvent: {\n prototype: RTCIceTransportStateChangedEvent;\n new(): RTCIceTransportStateChangedEvent;\n}\n\ninterface RTCRtpReceiverEventMap {\n \"error\": ErrorEvent;\n}\n\ninterface RTCRtpReceiver extends RTCStatsProvider {\n onerror: ((this: RTCRtpReceiver, ev: ErrorEvent) => any) | null;\n readonly rtcpTransport: RTCDtlsTransport;\n readonly track: MediaStreamTrack | null;\n readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport;\n getContributingSources(): RTCRtpContributingSource[];\n receive(parameters: RTCRtpParameters): void;\n requestSendCSRC(csrc: number): void;\n setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void;\n stop(): void;\n addEventListener(type: K, listener: (this: RTCRtpReceiver, ev: RTCRtpReceiverEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var RTCRtpReceiver: {\n prototype: RTCRtpReceiver;\n new(transport: RTCDtlsTransport | RTCSrtpSdesTransport, kind: string, rtcpTransport?: RTCDtlsTransport): RTCRtpReceiver;\n getCapabilities(kind?: string): RTCRtpCapabilities;\n}\n\ninterface RTCRtpSenderEventMap {\n \"error\": ErrorEvent;\n \"ssrcconflict\": RTCSsrcConflictEvent;\n}\n\ninterface RTCRtpSender extends RTCStatsProvider {\n onerror: ((this: RTCRtpSender, ev: ErrorEvent) => any) | null;\n onssrcconflict: ((this: RTCRtpSender, ev: RTCSsrcConflictEvent) => any) | null;\n readonly rtcpTransport: RTCDtlsTransport;\n readonly track: MediaStreamTrack;\n readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport;\n send(parameters: RTCRtpParameters): void;\n setTrack(track: MediaStreamTrack): void;\n setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void;\n stop(): void;\n addEventListener(type: K, listener: (this: RTCRtpSender, ev: RTCRtpSenderEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var RTCRtpSender: {\n prototype: RTCRtpSender;\n new(track: MediaStreamTrack, transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): RTCRtpSender;\n getCapabilities(kind?: string): RTCRtpCapabilities;\n}\n\ninterface RTCSrtpSdesTransportEventMap {\n \"error\": ErrorEvent;\n}\n\ninterface RTCSrtpSdesTransport extends EventTarget {\n onerror: ((this: RTCSrtpSdesTransport, ev: ErrorEvent) => any) | null;\n readonly transport: RTCIceTransport;\n addEventListener(type: K, listener: (this: RTCSrtpSdesTransport, ev: RTCSrtpSdesTransportEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var RTCSrtpSdesTransport: {\n prototype: RTCSrtpSdesTransport;\n new(transport: RTCIceTransport, encryptParameters: RTCSrtpSdesParameters, decryptParameters: RTCSrtpSdesParameters): RTCSrtpSdesTransport;\n getLocalParameters(): RTCSrtpSdesParameters[];\n}\n\ninterface RTCSsrcConflictEvent extends Event {\n readonly ssrc: number;\n}\n\ndeclare var RTCSsrcConflictEvent: {\n prototype: RTCSsrcConflictEvent;\n new(): RTCSsrcConflictEvent;\n}\n\ninterface RTCStatsProvider extends EventTarget {\n getStats(): PromiseLike;\n msGetStats(): PromiseLike;\n}\n\ndeclare var RTCStatsProvider: {\n prototype: RTCStatsProvider;\n new(): RTCStatsProvider;\n}\n\ninterface Range {\n readonly collapsed: boolean;\n readonly commonAncestorContainer: Node;\n readonly endContainer: Node;\n readonly endOffset: number;\n readonly startContainer: Node;\n readonly startOffset: number;\n cloneContents(): DocumentFragment;\n cloneRange(): Range;\n collapse(toStart: boolean): void;\n compareBoundaryPoints(how: number, sourceRange: Range): number;\n createContextualFragment(fragment: string): DocumentFragment;\n deleteContents(): void;\n detach(): void;\n expand(Unit: string): boolean;\n extractContents(): DocumentFragment;\n getBoundingClientRect(): ClientRect;\n getClientRects(): ClientRectList;\n insertNode(newNode: Node): void;\n selectNode(refNode: Node): void;\n selectNodeContents(refNode: Node): void;\n setEnd(refNode: Node, offset: number): void;\n setEndAfter(refNode: Node): void;\n setEndBefore(refNode: Node): void;\n setStart(refNode: Node, offset: number): void;\n setStartAfter(refNode: Node): void;\n setStartBefore(refNode: Node): void;\n surroundContents(newParent: Node): void;\n toString(): string;\n readonly END_TO_END: number;\n readonly END_TO_START: number;\n readonly START_TO_END: number;\n readonly START_TO_START: number;\n}\n\ndeclare var Range: {\n prototype: Range;\n new(): Range;\n readonly END_TO_END: number;\n readonly END_TO_START: number;\n readonly START_TO_END: number;\n readonly START_TO_START: number;\n}\n\ninterface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference {\n readonly target: SVGAnimatedString;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGAElement: {\n prototype: SVGAElement;\n new(): SVGAElement;\n}\n\ninterface SVGAngle {\n readonly unitType: number;\n value: number;\n valueAsString: string;\n valueInSpecifiedUnits: number;\n convertToSpecifiedUnits(unitType: number): void;\n newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void;\n readonly SVG_ANGLETYPE_DEG: number;\n readonly SVG_ANGLETYPE_GRAD: number;\n readonly SVG_ANGLETYPE_RAD: number;\n readonly SVG_ANGLETYPE_UNKNOWN: number;\n readonly SVG_ANGLETYPE_UNSPECIFIED: number;\n}\n\ndeclare var SVGAngle: {\n prototype: SVGAngle;\n new(): SVGAngle;\n readonly SVG_ANGLETYPE_DEG: number;\n readonly SVG_ANGLETYPE_GRAD: number;\n readonly SVG_ANGLETYPE_RAD: number;\n readonly SVG_ANGLETYPE_UNKNOWN: number;\n readonly SVG_ANGLETYPE_UNSPECIFIED: number;\n}\n\ninterface SVGAnimatedAngle {\n readonly animVal: SVGAngle;\n readonly baseVal: SVGAngle;\n}\n\ndeclare var SVGAnimatedAngle: {\n prototype: SVGAnimatedAngle;\n new(): SVGAnimatedAngle;\n}\n\ninterface SVGAnimatedBoolean {\n readonly animVal: boolean;\n baseVal: boolean;\n}\n\ndeclare var SVGAnimatedBoolean: {\n prototype: SVGAnimatedBoolean;\n new(): SVGAnimatedBoolean;\n}\n\ninterface SVGAnimatedEnumeration {\n readonly animVal: number;\n baseVal: number;\n}\n\ndeclare var SVGAnimatedEnumeration: {\n prototype: SVGAnimatedEnumeration;\n new(): SVGAnimatedEnumeration;\n}\n\ninterface SVGAnimatedInteger {\n readonly animVal: number;\n baseVal: number;\n}\n\ndeclare var SVGAnimatedInteger: {\n prototype: SVGAnimatedInteger;\n new(): SVGAnimatedInteger;\n}\n\ninterface SVGAnimatedLength {\n readonly animVal: SVGLength;\n readonly baseVal: SVGLength;\n}\n\ndeclare var SVGAnimatedLength: {\n prototype: SVGAnimatedLength;\n new(): SVGAnimatedLength;\n}\n\ninterface SVGAnimatedLengthList {\n readonly animVal: SVGLengthList;\n readonly baseVal: SVGLengthList;\n}\n\ndeclare var SVGAnimatedLengthList: {\n prototype: SVGAnimatedLengthList;\n new(): SVGAnimatedLengthList;\n}\n\ninterface SVGAnimatedNumber {\n readonly animVal: number;\n baseVal: number;\n}\n\ndeclare var SVGAnimatedNumber: {\n prototype: SVGAnimatedNumber;\n new(): SVGAnimatedNumber;\n}\n\ninterface SVGAnimatedNumberList {\n readonly animVal: SVGNumberList;\n readonly baseVal: SVGNumberList;\n}\n\ndeclare var SVGAnimatedNumberList: {\n prototype: SVGAnimatedNumberList;\n new(): SVGAnimatedNumberList;\n}\n\ninterface SVGAnimatedPreserveAspectRatio {\n readonly animVal: SVGPreserveAspectRatio;\n readonly baseVal: SVGPreserveAspectRatio;\n}\n\ndeclare var SVGAnimatedPreserveAspectRatio: {\n prototype: SVGAnimatedPreserveAspectRatio;\n new(): SVGAnimatedPreserveAspectRatio;\n}\n\ninterface SVGAnimatedRect {\n readonly animVal: SVGRect;\n readonly baseVal: SVGRect;\n}\n\ndeclare var SVGAnimatedRect: {\n prototype: SVGAnimatedRect;\n new(): SVGAnimatedRect;\n}\n\ninterface SVGAnimatedString {\n readonly animVal: string;\n baseVal: string;\n}\n\ndeclare var SVGAnimatedString: {\n prototype: SVGAnimatedString;\n new(): SVGAnimatedString;\n}\n\ninterface SVGAnimatedTransformList {\n readonly animVal: SVGTransformList;\n readonly baseVal: SVGTransformList;\n}\n\ndeclare var SVGAnimatedTransformList: {\n prototype: SVGAnimatedTransformList;\n new(): SVGAnimatedTransformList;\n}\n\ninterface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n readonly cx: SVGAnimatedLength;\n readonly cy: SVGAnimatedLength;\n readonly r: SVGAnimatedLength;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGCircleElement: {\n prototype: SVGCircleElement;\n new(): SVGCircleElement;\n}\n\ninterface SVGClipPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes {\n readonly clipPathUnits: SVGAnimatedEnumeration;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGClipPathElement: {\n prototype: SVGClipPathElement;\n new(): SVGClipPathElement;\n}\n\ninterface SVGComponentTransferFunctionElement extends SVGElement {\n readonly amplitude: SVGAnimatedNumber;\n readonly exponent: SVGAnimatedNumber;\n readonly intercept: SVGAnimatedNumber;\n readonly offset: SVGAnimatedNumber;\n readonly slope: SVGAnimatedNumber;\n readonly tableValues: SVGAnimatedNumberList;\n readonly type: SVGAnimatedEnumeration;\n readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number;\n readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number;\n readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number;\n readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number;\n readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number;\n readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGComponentTransferFunctionElement: {\n prototype: SVGComponentTransferFunctionElement;\n new(): SVGComponentTransferFunctionElement;\n readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number;\n readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number;\n readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number;\n readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number;\n readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number;\n readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number;\n}\n\ninterface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGDefsElement: {\n prototype: SVGDefsElement;\n new(): SVGDefsElement;\n}\n\ninterface SVGDescElement extends SVGElement, SVGStylable, SVGLangSpace {\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGDescElement: {\n prototype: SVGDescElement;\n new(): SVGDescElement;\n}\n\ninterface SVGElementEventMap extends ElementEventMap {\n \"click\": MouseEvent;\n \"dblclick\": MouseEvent;\n \"focusin\": FocusEvent;\n \"focusout\": FocusEvent;\n \"load\": Event;\n \"mousedown\": MouseEvent;\n \"mousemove\": MouseEvent;\n \"mouseout\": MouseEvent;\n \"mouseover\": MouseEvent;\n \"mouseup\": MouseEvent;\n}\n\ninterface SVGElement extends Element {\n onclick: (this: SVGElement, ev: MouseEvent) => any;\n ondblclick: (this: SVGElement, ev: MouseEvent) => any;\n onfocusin: (this: SVGElement, ev: FocusEvent) => any;\n onfocusout: (this: SVGElement, ev: FocusEvent) => any;\n onload: (this: SVGElement, ev: Event) => any;\n onmousedown: (this: SVGElement, ev: MouseEvent) => any;\n onmousemove: (this: SVGElement, ev: MouseEvent) => any;\n onmouseout: (this: SVGElement, ev: MouseEvent) => any;\n onmouseover: (this: SVGElement, ev: MouseEvent) => any;\n onmouseup: (this: SVGElement, ev: MouseEvent) => any;\n readonly ownerSVGElement: SVGSVGElement;\n readonly viewportElement: SVGElement;\n xmlbase: string;\n className: any;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGElement: {\n prototype: SVGElement;\n new(): SVGElement;\n}\n\ninterface SVGElementInstance extends EventTarget {\n readonly childNodes: SVGElementInstanceList;\n readonly correspondingElement: SVGElement;\n readonly correspondingUseElement: SVGUseElement;\n readonly firstChild: SVGElementInstance;\n readonly lastChild: SVGElementInstance;\n readonly nextSibling: SVGElementInstance;\n readonly parentNode: SVGElementInstance;\n readonly previousSibling: SVGElementInstance;\n}\n\ndeclare var SVGElementInstance: {\n prototype: SVGElementInstance;\n new(): SVGElementInstance;\n}\n\ninterface SVGElementInstanceList {\n readonly length: number;\n item(index: number): SVGElementInstance;\n}\n\ndeclare var SVGElementInstanceList: {\n prototype: SVGElementInstanceList;\n new(): SVGElementInstanceList;\n}\n\ninterface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n readonly cx: SVGAnimatedLength;\n readonly cy: SVGAnimatedLength;\n readonly rx: SVGAnimatedLength;\n readonly ry: SVGAnimatedLength;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGEllipseElement: {\n prototype: SVGEllipseElement;\n new(): SVGEllipseElement;\n}\n\ninterface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n readonly in1: SVGAnimatedString;\n readonly in2: SVGAnimatedString;\n readonly mode: SVGAnimatedEnumeration;\n readonly SVG_FEBLEND_MODE_COLOR: number;\n readonly SVG_FEBLEND_MODE_COLOR_BURN: number;\n readonly SVG_FEBLEND_MODE_COLOR_DODGE: number;\n readonly SVG_FEBLEND_MODE_DARKEN: number;\n readonly SVG_FEBLEND_MODE_DIFFERENCE: number;\n readonly SVG_FEBLEND_MODE_EXCLUSION: number;\n readonly SVG_FEBLEND_MODE_HARD_LIGHT: number;\n readonly SVG_FEBLEND_MODE_HUE: number;\n readonly SVG_FEBLEND_MODE_LIGHTEN: number;\n readonly SVG_FEBLEND_MODE_LUMINOSITY: number;\n readonly SVG_FEBLEND_MODE_MULTIPLY: number;\n readonly SVG_FEBLEND_MODE_NORMAL: number;\n readonly SVG_FEBLEND_MODE_OVERLAY: number;\n readonly SVG_FEBLEND_MODE_SATURATION: number;\n readonly SVG_FEBLEND_MODE_SCREEN: number;\n readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number;\n readonly SVG_FEBLEND_MODE_UNKNOWN: number;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEBlendElement: {\n prototype: SVGFEBlendElement;\n new(): SVGFEBlendElement;\n readonly SVG_FEBLEND_MODE_COLOR: number;\n readonly SVG_FEBLEND_MODE_COLOR_BURN: number;\n readonly SVG_FEBLEND_MODE_COLOR_DODGE: number;\n readonly SVG_FEBLEND_MODE_DARKEN: number;\n readonly SVG_FEBLEND_MODE_DIFFERENCE: number;\n readonly SVG_FEBLEND_MODE_EXCLUSION: number;\n readonly SVG_FEBLEND_MODE_HARD_LIGHT: number;\n readonly SVG_FEBLEND_MODE_HUE: number;\n readonly SVG_FEBLEND_MODE_LIGHTEN: number;\n readonly SVG_FEBLEND_MODE_LUMINOSITY: number;\n readonly SVG_FEBLEND_MODE_MULTIPLY: number;\n readonly SVG_FEBLEND_MODE_NORMAL: number;\n readonly SVG_FEBLEND_MODE_OVERLAY: number;\n readonly SVG_FEBLEND_MODE_SATURATION: number;\n readonly SVG_FEBLEND_MODE_SCREEN: number;\n readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number;\n readonly SVG_FEBLEND_MODE_UNKNOWN: number;\n}\n\ninterface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n readonly in1: SVGAnimatedString;\n readonly type: SVGAnimatedEnumeration;\n readonly values: SVGAnimatedNumberList;\n readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number;\n readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number;\n readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number;\n readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number;\n readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEColorMatrixElement: {\n prototype: SVGFEColorMatrixElement;\n new(): SVGFEColorMatrixElement;\n readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number;\n readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number;\n readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number;\n readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number;\n readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number;\n}\n\ninterface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n readonly in1: SVGAnimatedString;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEComponentTransferElement: {\n prototype: SVGFEComponentTransferElement;\n new(): SVGFEComponentTransferElement;\n}\n\ninterface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n readonly in1: SVGAnimatedString;\n readonly in2: SVGAnimatedString;\n readonly k1: SVGAnimatedNumber;\n readonly k2: SVGAnimatedNumber;\n readonly k3: SVGAnimatedNumber;\n readonly k4: SVGAnimatedNumber;\n readonly operator: SVGAnimatedEnumeration;\n readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number;\n readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number;\n readonly SVG_FECOMPOSITE_OPERATOR_IN: number;\n readonly SVG_FECOMPOSITE_OPERATOR_OUT: number;\n readonly SVG_FECOMPOSITE_OPERATOR_OVER: number;\n readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number;\n readonly SVG_FECOMPOSITE_OPERATOR_XOR: number;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFECompositeElement: {\n prototype: SVGFECompositeElement;\n new(): SVGFECompositeElement;\n readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number;\n readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number;\n readonly SVG_FECOMPOSITE_OPERATOR_IN: number;\n readonly SVG_FECOMPOSITE_OPERATOR_OUT: number;\n readonly SVG_FECOMPOSITE_OPERATOR_OVER: number;\n readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number;\n readonly SVG_FECOMPOSITE_OPERATOR_XOR: number;\n}\n\ninterface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n readonly bias: SVGAnimatedNumber;\n readonly divisor: SVGAnimatedNumber;\n readonly edgeMode: SVGAnimatedEnumeration;\n readonly in1: SVGAnimatedString;\n readonly kernelMatrix: SVGAnimatedNumberList;\n readonly kernelUnitLengthX: SVGAnimatedNumber;\n readonly kernelUnitLengthY: SVGAnimatedNumber;\n readonly orderX: SVGAnimatedInteger;\n readonly orderY: SVGAnimatedInteger;\n readonly preserveAlpha: SVGAnimatedBoolean;\n readonly targetX: SVGAnimatedInteger;\n readonly targetY: SVGAnimatedInteger;\n readonly SVG_EDGEMODE_DUPLICATE: number;\n readonly SVG_EDGEMODE_NONE: number;\n readonly SVG_EDGEMODE_UNKNOWN: number;\n readonly SVG_EDGEMODE_WRAP: number;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEConvolveMatrixElement: {\n prototype: SVGFEConvolveMatrixElement;\n new(): SVGFEConvolveMatrixElement;\n readonly SVG_EDGEMODE_DUPLICATE: number;\n readonly SVG_EDGEMODE_NONE: number;\n readonly SVG_EDGEMODE_UNKNOWN: number;\n readonly SVG_EDGEMODE_WRAP: number;\n}\n\ninterface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n readonly diffuseConstant: SVGAnimatedNumber;\n readonly in1: SVGAnimatedString;\n readonly kernelUnitLengthX: SVGAnimatedNumber;\n readonly kernelUnitLengthY: SVGAnimatedNumber;\n readonly surfaceScale: SVGAnimatedNumber;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEDiffuseLightingElement: {\n prototype: SVGFEDiffuseLightingElement;\n new(): SVGFEDiffuseLightingElement;\n}\n\ninterface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n readonly in1: SVGAnimatedString;\n readonly in2: SVGAnimatedString;\n readonly scale: SVGAnimatedNumber;\n readonly xChannelSelector: SVGAnimatedEnumeration;\n readonly yChannelSelector: SVGAnimatedEnumeration;\n readonly SVG_CHANNEL_A: number;\n readonly SVG_CHANNEL_B: number;\n readonly SVG_CHANNEL_G: number;\n readonly SVG_CHANNEL_R: number;\n readonly SVG_CHANNEL_UNKNOWN: number;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEDisplacementMapElement: {\n prototype: SVGFEDisplacementMapElement;\n new(): SVGFEDisplacementMapElement;\n readonly SVG_CHANNEL_A: number;\n readonly SVG_CHANNEL_B: number;\n readonly SVG_CHANNEL_G: number;\n readonly SVG_CHANNEL_R: number;\n readonly SVG_CHANNEL_UNKNOWN: number;\n}\n\ninterface SVGFEDistantLightElement extends SVGElement {\n readonly azimuth: SVGAnimatedNumber;\n readonly elevation: SVGAnimatedNumber;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEDistantLightElement: {\n prototype: SVGFEDistantLightElement;\n new(): SVGFEDistantLightElement;\n}\n\ninterface SVGFEFloodElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEFloodElement: {\n prototype: SVGFEFloodElement;\n new(): SVGFEFloodElement;\n}\n\ninterface SVGFEFuncAElement extends SVGComponentTransferFunctionElement {\n}\n\ndeclare var SVGFEFuncAElement: {\n prototype: SVGFEFuncAElement;\n new(): SVGFEFuncAElement;\n}\n\ninterface SVGFEFuncBElement extends SVGComponentTransferFunctionElement {\n}\n\ndeclare var SVGFEFuncBElement: {\n prototype: SVGFEFuncBElement;\n new(): SVGFEFuncBElement;\n}\n\ninterface SVGFEFuncGElement extends SVGComponentTransferFunctionElement {\n}\n\ndeclare var SVGFEFuncGElement: {\n prototype: SVGFEFuncGElement;\n new(): SVGFEFuncGElement;\n}\n\ninterface SVGFEFuncRElement extends SVGComponentTransferFunctionElement {\n}\n\ndeclare var SVGFEFuncRElement: {\n prototype: SVGFEFuncRElement;\n new(): SVGFEFuncRElement;\n}\n\ninterface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n readonly in1: SVGAnimatedString;\n readonly stdDeviationX: SVGAnimatedNumber;\n readonly stdDeviationY: SVGAnimatedNumber;\n setStdDeviation(stdDeviationX: number, stdDeviationY: number): void;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEGaussianBlurElement: {\n prototype: SVGFEGaussianBlurElement;\n new(): SVGFEGaussianBlurElement;\n}\n\ninterface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired {\n readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEImageElement: {\n prototype: SVGFEImageElement;\n new(): SVGFEImageElement;\n}\n\ninterface SVGFEMergeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEMergeElement: {\n prototype: SVGFEMergeElement;\n new(): SVGFEMergeElement;\n}\n\ninterface SVGFEMergeNodeElement extends SVGElement {\n readonly in1: SVGAnimatedString;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEMergeNodeElement: {\n prototype: SVGFEMergeNodeElement;\n new(): SVGFEMergeNodeElement;\n}\n\ninterface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n readonly in1: SVGAnimatedString;\n readonly operator: SVGAnimatedEnumeration;\n readonly radiusX: SVGAnimatedNumber;\n readonly radiusY: SVGAnimatedNumber;\n readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number;\n readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number;\n readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEMorphologyElement: {\n prototype: SVGFEMorphologyElement;\n new(): SVGFEMorphologyElement;\n readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number;\n readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number;\n readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number;\n}\n\ninterface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n readonly dx: SVGAnimatedNumber;\n readonly dy: SVGAnimatedNumber;\n readonly in1: SVGAnimatedString;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEOffsetElement: {\n prototype: SVGFEOffsetElement;\n new(): SVGFEOffsetElement;\n}\n\ninterface SVGFEPointLightElement extends SVGElement {\n readonly x: SVGAnimatedNumber;\n readonly y: SVGAnimatedNumber;\n readonly z: SVGAnimatedNumber;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFEPointLightElement: {\n prototype: SVGFEPointLightElement;\n new(): SVGFEPointLightElement;\n}\n\ninterface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n readonly in1: SVGAnimatedString;\n readonly kernelUnitLengthX: SVGAnimatedNumber;\n readonly kernelUnitLengthY: SVGAnimatedNumber;\n readonly specularConstant: SVGAnimatedNumber;\n readonly specularExponent: SVGAnimatedNumber;\n readonly surfaceScale: SVGAnimatedNumber;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFESpecularLightingElement: {\n prototype: SVGFESpecularLightingElement;\n new(): SVGFESpecularLightingElement;\n}\n\ninterface SVGFESpotLightElement extends SVGElement {\n readonly limitingConeAngle: SVGAnimatedNumber;\n readonly pointsAtX: SVGAnimatedNumber;\n readonly pointsAtY: SVGAnimatedNumber;\n readonly pointsAtZ: SVGAnimatedNumber;\n readonly specularExponent: SVGAnimatedNumber;\n readonly x: SVGAnimatedNumber;\n readonly y: SVGAnimatedNumber;\n readonly z: SVGAnimatedNumber;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFESpotLightElement: {\n prototype: SVGFESpotLightElement;\n new(): SVGFESpotLightElement;\n}\n\ninterface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n readonly in1: SVGAnimatedString;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFETileElement: {\n prototype: SVGFETileElement;\n new(): SVGFETileElement;\n}\n\ninterface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {\n readonly baseFrequencyX: SVGAnimatedNumber;\n readonly baseFrequencyY: SVGAnimatedNumber;\n readonly numOctaves: SVGAnimatedInteger;\n readonly seed: SVGAnimatedNumber;\n readonly stitchTiles: SVGAnimatedEnumeration;\n readonly type: SVGAnimatedEnumeration;\n readonly SVG_STITCHTYPE_NOSTITCH: number;\n readonly SVG_STITCHTYPE_STITCH: number;\n readonly SVG_STITCHTYPE_UNKNOWN: number;\n readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number;\n readonly SVG_TURBULENCE_TYPE_TURBULENCE: number;\n readonly SVG_TURBULENCE_TYPE_UNKNOWN: number;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFETurbulenceElement: {\n prototype: SVGFETurbulenceElement;\n new(): SVGFETurbulenceElement;\n readonly SVG_STITCHTYPE_NOSTITCH: number;\n readonly SVG_STITCHTYPE_STITCH: number;\n readonly SVG_STITCHTYPE_UNKNOWN: number;\n readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number;\n readonly SVG_TURBULENCE_TYPE_TURBULENCE: number;\n readonly SVG_TURBULENCE_TYPE_UNKNOWN: number;\n}\n\ninterface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired {\n readonly filterResX: SVGAnimatedInteger;\n readonly filterResY: SVGAnimatedInteger;\n readonly filterUnits: SVGAnimatedEnumeration;\n readonly height: SVGAnimatedLength;\n readonly primitiveUnits: SVGAnimatedEnumeration;\n readonly width: SVGAnimatedLength;\n readonly x: SVGAnimatedLength;\n readonly y: SVGAnimatedLength;\n setFilterRes(filterResX: number, filterResY: number): void;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGFilterElement: {\n prototype: SVGFilterElement;\n new(): SVGFilterElement;\n}\n\ninterface SVGForeignObjectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n readonly height: SVGAnimatedLength;\n readonly width: SVGAnimatedLength;\n readonly x: SVGAnimatedLength;\n readonly y: SVGAnimatedLength;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGForeignObjectElement: {\n prototype: SVGForeignObjectElement;\n new(): SVGForeignObjectElement;\n}\n\ninterface SVGGElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGGElement: {\n prototype: SVGGElement;\n new(): SVGGElement;\n}\n\ninterface SVGGradientElement extends SVGElement, SVGStylable, SVGExternalResourcesRequired, SVGURIReference, SVGUnitTypes {\n readonly gradientTransform: SVGAnimatedTransformList;\n readonly gradientUnits: SVGAnimatedEnumeration;\n readonly spreadMethod: SVGAnimatedEnumeration;\n readonly SVG_SPREADMETHOD_PAD: number;\n readonly SVG_SPREADMETHOD_REFLECT: number;\n readonly SVG_SPREADMETHOD_REPEAT: number;\n readonly SVG_SPREADMETHOD_UNKNOWN: number;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGGradientElement: {\n prototype: SVGGradientElement;\n new(): SVGGradientElement;\n readonly SVG_SPREADMETHOD_PAD: number;\n readonly SVG_SPREADMETHOD_REFLECT: number;\n readonly SVG_SPREADMETHOD_REPEAT: number;\n readonly SVG_SPREADMETHOD_UNKNOWN: number;\n}\n\ninterface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference {\n readonly height: SVGAnimatedLength;\n readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio;\n readonly width: SVGAnimatedLength;\n readonly x: SVGAnimatedLength;\n readonly y: SVGAnimatedLength;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGImageElement: {\n prototype: SVGImageElement;\n new(): SVGImageElement;\n}\n\ninterface SVGLength {\n readonly unitType: number;\n value: number;\n valueAsString: string;\n valueInSpecifiedUnits: number;\n convertToSpecifiedUnits(unitType: number): void;\n newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void;\n readonly SVG_LENGTHTYPE_CM: number;\n readonly SVG_LENGTHTYPE_EMS: number;\n readonly SVG_LENGTHTYPE_EXS: number;\n readonly SVG_LENGTHTYPE_IN: number;\n readonly SVG_LENGTHTYPE_MM: number;\n readonly SVG_LENGTHTYPE_NUMBER: number;\n readonly SVG_LENGTHTYPE_PC: number;\n readonly SVG_LENGTHTYPE_PERCENTAGE: number;\n readonly SVG_LENGTHTYPE_PT: number;\n readonly SVG_LENGTHTYPE_PX: number;\n readonly SVG_LENGTHTYPE_UNKNOWN: number;\n}\n\ndeclare var SVGLength: {\n prototype: SVGLength;\n new(): SVGLength;\n readonly SVG_LENGTHTYPE_CM: number;\n readonly SVG_LENGTHTYPE_EMS: number;\n readonly SVG_LENGTHTYPE_EXS: number;\n readonly SVG_LENGTHTYPE_IN: number;\n readonly SVG_LENGTHTYPE_MM: number;\n readonly SVG_LENGTHTYPE_NUMBER: number;\n readonly SVG_LENGTHTYPE_PC: number;\n readonly SVG_LENGTHTYPE_PERCENTAGE: number;\n readonly SVG_LENGTHTYPE_PT: number;\n readonly SVG_LENGTHTYPE_PX: number;\n readonly SVG_LENGTHTYPE_UNKNOWN: number;\n}\n\ninterface SVGLengthList {\n readonly numberOfItems: number;\n appendItem(newItem: SVGLength): SVGLength;\n clear(): void;\n getItem(index: number): SVGLength;\n initialize(newItem: SVGLength): SVGLength;\n insertItemBefore(newItem: SVGLength, index: number): SVGLength;\n removeItem(index: number): SVGLength;\n replaceItem(newItem: SVGLength, index: number): SVGLength;\n}\n\ndeclare var SVGLengthList: {\n prototype: SVGLengthList;\n new(): SVGLengthList;\n}\n\ninterface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n readonly x1: SVGAnimatedLength;\n readonly x2: SVGAnimatedLength;\n readonly y1: SVGAnimatedLength;\n readonly y2: SVGAnimatedLength;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGLineElement: {\n prototype: SVGLineElement;\n new(): SVGLineElement;\n}\n\ninterface SVGLinearGradientElement extends SVGGradientElement {\n readonly x1: SVGAnimatedLength;\n readonly x2: SVGAnimatedLength;\n readonly y1: SVGAnimatedLength;\n readonly y2: SVGAnimatedLength;\n}\n\ndeclare var SVGLinearGradientElement: {\n prototype: SVGLinearGradientElement;\n new(): SVGLinearGradientElement;\n}\n\ninterface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox {\n readonly markerHeight: SVGAnimatedLength;\n readonly markerUnits: SVGAnimatedEnumeration;\n readonly markerWidth: SVGAnimatedLength;\n readonly orientAngle: SVGAnimatedAngle;\n readonly orientType: SVGAnimatedEnumeration;\n readonly refX: SVGAnimatedLength;\n readonly refY: SVGAnimatedLength;\n setOrientToAngle(angle: SVGAngle): void;\n setOrientToAuto(): void;\n readonly SVG_MARKERUNITS_STROKEWIDTH: number;\n readonly SVG_MARKERUNITS_UNKNOWN: number;\n readonly SVG_MARKERUNITS_USERSPACEONUSE: number;\n readonly SVG_MARKER_ORIENT_ANGLE: number;\n readonly SVG_MARKER_ORIENT_AUTO: number;\n readonly SVG_MARKER_ORIENT_UNKNOWN: number;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGMarkerElement: {\n prototype: SVGMarkerElement;\n new(): SVGMarkerElement;\n readonly SVG_MARKERUNITS_STROKEWIDTH: number;\n readonly SVG_MARKERUNITS_UNKNOWN: number;\n readonly SVG_MARKERUNITS_USERSPACEONUSE: number;\n readonly SVG_MARKER_ORIENT_ANGLE: number;\n readonly SVG_MARKER_ORIENT_AUTO: number;\n readonly SVG_MARKER_ORIENT_UNKNOWN: number;\n}\n\ninterface SVGMaskElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes {\n readonly height: SVGAnimatedLength;\n readonly maskContentUnits: SVGAnimatedEnumeration;\n readonly maskUnits: SVGAnimatedEnumeration;\n readonly width: SVGAnimatedLength;\n readonly x: SVGAnimatedLength;\n readonly y: SVGAnimatedLength;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGMaskElement: {\n prototype: SVGMaskElement;\n new(): SVGMaskElement;\n}\n\ninterface SVGMatrix {\n a: number;\n b: number;\n c: number;\n d: number;\n e: number;\n f: number;\n flipX(): SVGMatrix;\n flipY(): SVGMatrix;\n inverse(): SVGMatrix;\n multiply(secondMatrix: SVGMatrix): SVGMatrix;\n rotate(angle: number): SVGMatrix;\n rotateFromVector(x: number, y: number): SVGMatrix;\n scale(scaleFactor: number): SVGMatrix;\n scaleNonUniform(scaleFactorX: number, scaleFactorY: number): SVGMatrix;\n skewX(angle: number): SVGMatrix;\n skewY(angle: number): SVGMatrix;\n translate(x: number, y: number): SVGMatrix;\n}\n\ndeclare var SVGMatrix: {\n prototype: SVGMatrix;\n new(): SVGMatrix;\n}\n\ninterface SVGMetadataElement extends SVGElement {\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGMetadataElement: {\n prototype: SVGMetadataElement;\n new(): SVGMetadataElement;\n}\n\ninterface SVGNumber {\n value: number;\n}\n\ndeclare var SVGNumber: {\n prototype: SVGNumber;\n new(): SVGNumber;\n}\n\ninterface SVGNumberList {\n readonly numberOfItems: number;\n appendItem(newItem: SVGNumber): SVGNumber;\n clear(): void;\n getItem(index: number): SVGNumber;\n initialize(newItem: SVGNumber): SVGNumber;\n insertItemBefore(newItem: SVGNumber, index: number): SVGNumber;\n removeItem(index: number): SVGNumber;\n replaceItem(newItem: SVGNumber, index: number): SVGNumber;\n}\n\ndeclare var SVGNumberList: {\n prototype: SVGNumberList;\n new(): SVGNumberList;\n}\n\ninterface SVGPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPathData {\n createSVGPathSegArcAbs(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcAbs;\n createSVGPathSegArcRel(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcRel;\n createSVGPathSegClosePath(): SVGPathSegClosePath;\n createSVGPathSegCurvetoCubicAbs(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicAbs;\n createSVGPathSegCurvetoCubicRel(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicRel;\n createSVGPathSegCurvetoCubicSmoothAbs(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothAbs;\n createSVGPathSegCurvetoCubicSmoothRel(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothRel;\n createSVGPathSegCurvetoQuadraticAbs(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticAbs;\n createSVGPathSegCurvetoQuadraticRel(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticRel;\n createSVGPathSegCurvetoQuadraticSmoothAbs(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothAbs;\n createSVGPathSegCurvetoQuadraticSmoothRel(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothRel;\n createSVGPathSegLinetoAbs(x: number, y: number): SVGPathSegLinetoAbs;\n createSVGPathSegLinetoHorizontalAbs(x: number): SVGPathSegLinetoHorizontalAbs;\n createSVGPathSegLinetoHorizontalRel(x: number): SVGPathSegLinetoHorizontalRel;\n createSVGPathSegLinetoRel(x: number, y: number): SVGPathSegLinetoRel;\n createSVGPathSegLinetoVerticalAbs(y: number): SVGPathSegLinetoVerticalAbs;\n createSVGPathSegLinetoVerticalRel(y: number): SVGPathSegLinetoVerticalRel;\n createSVGPathSegMovetoAbs(x: number, y: number): SVGPathSegMovetoAbs;\n createSVGPathSegMovetoRel(x: number, y: number): SVGPathSegMovetoRel;\n getPathSegAtLength(distance: number): number;\n getPointAtLength(distance: number): SVGPoint;\n getTotalLength(): number;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGPathElement: {\n prototype: SVGPathElement;\n new(): SVGPathElement;\n}\n\ninterface SVGPathSeg {\n readonly pathSegType: number;\n readonly pathSegTypeAsLetter: string;\n readonly PATHSEG_ARC_ABS: number;\n readonly PATHSEG_ARC_REL: number;\n readonly PATHSEG_CLOSEPATH: number;\n readonly PATHSEG_CURVETO_CUBIC_ABS: number;\n readonly PATHSEG_CURVETO_CUBIC_REL: number;\n readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number;\n readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number;\n readonly PATHSEG_CURVETO_QUADRATIC_ABS: number;\n readonly PATHSEG_CURVETO_QUADRATIC_REL: number;\n readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number;\n readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number;\n readonly PATHSEG_LINETO_ABS: number;\n readonly PATHSEG_LINETO_HORIZONTAL_ABS: number;\n readonly PATHSEG_LINETO_HORIZONTAL_REL: number;\n readonly PATHSEG_LINETO_REL: number;\n readonly PATHSEG_LINETO_VERTICAL_ABS: number;\n readonly PATHSEG_LINETO_VERTICAL_REL: number;\n readonly PATHSEG_MOVETO_ABS: number;\n readonly PATHSEG_MOVETO_REL: number;\n readonly PATHSEG_UNKNOWN: number;\n}\n\ndeclare var SVGPathSeg: {\n prototype: SVGPathSeg;\n new(): SVGPathSeg;\n readonly PATHSEG_ARC_ABS: number;\n readonly PATHSEG_ARC_REL: number;\n readonly PATHSEG_CLOSEPATH: number;\n readonly PATHSEG_CURVETO_CUBIC_ABS: number;\n readonly PATHSEG_CURVETO_CUBIC_REL: number;\n readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number;\n readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number;\n readonly PATHSEG_CURVETO_QUADRATIC_ABS: number;\n readonly PATHSEG_CURVETO_QUADRATIC_REL: number;\n readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number;\n readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number;\n readonly PATHSEG_LINETO_ABS: number;\n readonly PATHSEG_LINETO_HORIZONTAL_ABS: number;\n readonly PATHSEG_LINETO_HORIZONTAL_REL: number;\n readonly PATHSEG_LINETO_REL: number;\n readonly PATHSEG_LINETO_VERTICAL_ABS: number;\n readonly PATHSEG_LINETO_VERTICAL_REL: number;\n readonly PATHSEG_MOVETO_ABS: number;\n readonly PATHSEG_MOVETO_REL: number;\n readonly PATHSEG_UNKNOWN: number;\n}\n\ninterface SVGPathSegArcAbs extends SVGPathSeg {\n angle: number;\n largeArcFlag: boolean;\n r1: number;\n r2: number;\n sweepFlag: boolean;\n x: number;\n y: number;\n}\n\ndeclare var SVGPathSegArcAbs: {\n prototype: SVGPathSegArcAbs;\n new(): SVGPathSegArcAbs;\n}\n\ninterface SVGPathSegArcRel extends SVGPathSeg {\n angle: number;\n largeArcFlag: boolean;\n r1: number;\n r2: number;\n sweepFlag: boolean;\n x: number;\n y: number;\n}\n\ndeclare var SVGPathSegArcRel: {\n prototype: SVGPathSegArcRel;\n new(): SVGPathSegArcRel;\n}\n\ninterface SVGPathSegClosePath extends SVGPathSeg {\n}\n\ndeclare var SVGPathSegClosePath: {\n prototype: SVGPathSegClosePath;\n new(): SVGPathSegClosePath;\n}\n\ninterface SVGPathSegCurvetoCubicAbs extends SVGPathSeg {\n x: number;\n x1: number;\n x2: number;\n y: number;\n y1: number;\n y2: number;\n}\n\ndeclare var SVGPathSegCurvetoCubicAbs: {\n prototype: SVGPathSegCurvetoCubicAbs;\n new(): SVGPathSegCurvetoCubicAbs;\n}\n\ninterface SVGPathSegCurvetoCubicRel extends SVGPathSeg {\n x: number;\n x1: number;\n x2: number;\n y: number;\n y1: number;\n y2: number;\n}\n\ndeclare var SVGPathSegCurvetoCubicRel: {\n prototype: SVGPathSegCurvetoCubicRel;\n new(): SVGPathSegCurvetoCubicRel;\n}\n\ninterface SVGPathSegCurvetoCubicSmoothAbs extends SVGPathSeg {\n x: number;\n x2: number;\n y: number;\n y2: number;\n}\n\ndeclare var SVGPathSegCurvetoCubicSmoothAbs: {\n prototype: SVGPathSegCurvetoCubicSmoothAbs;\n new(): SVGPathSegCurvetoCubicSmoothAbs;\n}\n\ninterface SVGPathSegCurvetoCubicSmoothRel extends SVGPathSeg {\n x: number;\n x2: number;\n y: number;\n y2: number;\n}\n\ndeclare var SVGPathSegCurvetoCubicSmoothRel: {\n prototype: SVGPathSegCurvetoCubicSmoothRel;\n new(): SVGPathSegCurvetoCubicSmoothRel;\n}\n\ninterface SVGPathSegCurvetoQuadraticAbs extends SVGPathSeg {\n x: number;\n x1: number;\n y: number;\n y1: number;\n}\n\ndeclare var SVGPathSegCurvetoQuadraticAbs: {\n prototype: SVGPathSegCurvetoQuadraticAbs;\n new(): SVGPathSegCurvetoQuadraticAbs;\n}\n\ninterface SVGPathSegCurvetoQuadraticRel extends SVGPathSeg {\n x: number;\n x1: number;\n y: number;\n y1: number;\n}\n\ndeclare var SVGPathSegCurvetoQuadraticRel: {\n prototype: SVGPathSegCurvetoQuadraticRel;\n new(): SVGPathSegCurvetoQuadraticRel;\n}\n\ninterface SVGPathSegCurvetoQuadraticSmoothAbs extends SVGPathSeg {\n x: number;\n y: number;\n}\n\ndeclare var SVGPathSegCurvetoQuadraticSmoothAbs: {\n prototype: SVGPathSegCurvetoQuadraticSmoothAbs;\n new(): SVGPathSegCurvetoQuadraticSmoothAbs;\n}\n\ninterface SVGPathSegCurvetoQuadraticSmoothRel extends SVGPathSeg {\n x: number;\n y: number;\n}\n\ndeclare var SVGPathSegCurvetoQuadraticSmoothRel: {\n prototype: SVGPathSegCurvetoQuadraticSmoothRel;\n new(): SVGPathSegCurvetoQuadraticSmoothRel;\n}\n\ninterface SVGPathSegLinetoAbs extends SVGPathSeg {\n x: number;\n y: number;\n}\n\ndeclare var SVGPathSegLinetoAbs: {\n prototype: SVGPathSegLinetoAbs;\n new(): SVGPathSegLinetoAbs;\n}\n\ninterface SVGPathSegLinetoHorizontalAbs extends SVGPathSeg {\n x: number;\n}\n\ndeclare var SVGPathSegLinetoHorizontalAbs: {\n prototype: SVGPathSegLinetoHorizontalAbs;\n new(): SVGPathSegLinetoHorizontalAbs;\n}\n\ninterface SVGPathSegLinetoHorizontalRel extends SVGPathSeg {\n x: number;\n}\n\ndeclare var SVGPathSegLinetoHorizontalRel: {\n prototype: SVGPathSegLinetoHorizontalRel;\n new(): SVGPathSegLinetoHorizontalRel;\n}\n\ninterface SVGPathSegLinetoRel extends SVGPathSeg {\n x: number;\n y: number;\n}\n\ndeclare var SVGPathSegLinetoRel: {\n prototype: SVGPathSegLinetoRel;\n new(): SVGPathSegLinetoRel;\n}\n\ninterface SVGPathSegLinetoVerticalAbs extends SVGPathSeg {\n y: number;\n}\n\ndeclare var SVGPathSegLinetoVerticalAbs: {\n prototype: SVGPathSegLinetoVerticalAbs;\n new(): SVGPathSegLinetoVerticalAbs;\n}\n\ninterface SVGPathSegLinetoVerticalRel extends SVGPathSeg {\n y: number;\n}\n\ndeclare var SVGPathSegLinetoVerticalRel: {\n prototype: SVGPathSegLinetoVerticalRel;\n new(): SVGPathSegLinetoVerticalRel;\n}\n\ninterface SVGPathSegList {\n readonly numberOfItems: number;\n appendItem(newItem: SVGPathSeg): SVGPathSeg;\n clear(): void;\n getItem(index: number): SVGPathSeg;\n initialize(newItem: SVGPathSeg): SVGPathSeg;\n insertItemBefore(newItem: SVGPathSeg, index: number): SVGPathSeg;\n removeItem(index: number): SVGPathSeg;\n replaceItem(newItem: SVGPathSeg, index: number): SVGPathSeg;\n}\n\ndeclare var SVGPathSegList: {\n prototype: SVGPathSegList;\n new(): SVGPathSegList;\n}\n\ninterface SVGPathSegMovetoAbs extends SVGPathSeg {\n x: number;\n y: number;\n}\n\ndeclare var SVGPathSegMovetoAbs: {\n prototype: SVGPathSegMovetoAbs;\n new(): SVGPathSegMovetoAbs;\n}\n\ninterface SVGPathSegMovetoRel extends SVGPathSeg {\n x: number;\n y: number;\n}\n\ndeclare var SVGPathSegMovetoRel: {\n prototype: SVGPathSegMovetoRel;\n new(): SVGPathSegMovetoRel;\n}\n\ninterface SVGPatternElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGURIReference, SVGUnitTypes {\n readonly height: SVGAnimatedLength;\n readonly patternContentUnits: SVGAnimatedEnumeration;\n readonly patternTransform: SVGAnimatedTransformList;\n readonly patternUnits: SVGAnimatedEnumeration;\n readonly width: SVGAnimatedLength;\n readonly x: SVGAnimatedLength;\n readonly y: SVGAnimatedLength;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGPatternElement: {\n prototype: SVGPatternElement;\n new(): SVGPatternElement;\n}\n\ninterface SVGPoint {\n x: number;\n y: number;\n matrixTransform(matrix: SVGMatrix): SVGPoint;\n}\n\ndeclare var SVGPoint: {\n prototype: SVGPoint;\n new(): SVGPoint;\n}\n\ninterface SVGPointList {\n readonly numberOfItems: number;\n appendItem(newItem: SVGPoint): SVGPoint;\n clear(): void;\n getItem(index: number): SVGPoint;\n initialize(newItem: SVGPoint): SVGPoint;\n insertItemBefore(newItem: SVGPoint, index: number): SVGPoint;\n removeItem(index: number): SVGPoint;\n replaceItem(newItem: SVGPoint, index: number): SVGPoint;\n}\n\ndeclare var SVGPointList: {\n prototype: SVGPointList;\n new(): SVGPointList;\n}\n\ninterface SVGPolygonElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints {\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGPolygonElement: {\n prototype: SVGPolygonElement;\n new(): SVGPolygonElement;\n}\n\ninterface SVGPolylineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints {\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGPolylineElement: {\n prototype: SVGPolylineElement;\n new(): SVGPolylineElement;\n}\n\ninterface SVGPreserveAspectRatio {\n align: number;\n meetOrSlice: number;\n readonly SVG_MEETORSLICE_MEET: number;\n readonly SVG_MEETORSLICE_SLICE: number;\n readonly SVG_MEETORSLICE_UNKNOWN: number;\n readonly SVG_PRESERVEASPECTRATIO_NONE: number;\n readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number;\n readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number;\n readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number;\n readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number;\n readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number;\n readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number;\n readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number;\n readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number;\n readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number;\n readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number;\n}\n\ndeclare var SVGPreserveAspectRatio: {\n prototype: SVGPreserveAspectRatio;\n new(): SVGPreserveAspectRatio;\n readonly SVG_MEETORSLICE_MEET: number;\n readonly SVG_MEETORSLICE_SLICE: number;\n readonly SVG_MEETORSLICE_UNKNOWN: number;\n readonly SVG_PRESERVEASPECTRATIO_NONE: number;\n readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number;\n readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number;\n readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number;\n readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number;\n readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number;\n readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number;\n readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number;\n readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number;\n readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number;\n readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number;\n}\n\ninterface SVGRadialGradientElement extends SVGGradientElement {\n readonly cx: SVGAnimatedLength;\n readonly cy: SVGAnimatedLength;\n readonly fx: SVGAnimatedLength;\n readonly fy: SVGAnimatedLength;\n readonly r: SVGAnimatedLength;\n}\n\ndeclare var SVGRadialGradientElement: {\n prototype: SVGRadialGradientElement;\n new(): SVGRadialGradientElement;\n}\n\ninterface SVGRect {\n height: number;\n width: number;\n x: number;\n y: number;\n}\n\ndeclare var SVGRect: {\n prototype: SVGRect;\n new(): SVGRect;\n}\n\ninterface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n readonly height: SVGAnimatedLength;\n readonly rx: SVGAnimatedLength;\n readonly ry: SVGAnimatedLength;\n readonly width: SVGAnimatedLength;\n readonly x: SVGAnimatedLength;\n readonly y: SVGAnimatedLength;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGRectElement: {\n prototype: SVGRectElement;\n new(): SVGRectElement;\n}\n\ninterface SVGSVGElementEventMap extends SVGElementEventMap {\n \"SVGAbort\": Event;\n \"SVGError\": Event;\n \"resize\": UIEvent;\n \"scroll\": UIEvent;\n \"SVGUnload\": Event;\n \"SVGZoom\": SVGZoomEvent;\n}\n\ninterface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTests, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan {\n contentScriptType: string;\n contentStyleType: string;\n currentScale: number;\n readonly currentTranslate: SVGPoint;\n readonly height: SVGAnimatedLength;\n onabort: (this: SVGSVGElement, ev: Event) => any;\n onerror: (this: SVGSVGElement, ev: Event) => any;\n onresize: (this: SVGSVGElement, ev: UIEvent) => any;\n onscroll: (this: SVGSVGElement, ev: UIEvent) => any;\n onunload: (this: SVGSVGElement, ev: Event) => any;\n onzoom: (this: SVGSVGElement, ev: SVGZoomEvent) => any;\n readonly pixelUnitToMillimeterX: number;\n readonly pixelUnitToMillimeterY: number;\n readonly screenPixelToMillimeterX: number;\n readonly screenPixelToMillimeterY: number;\n readonly viewport: SVGRect;\n readonly width: SVGAnimatedLength;\n readonly x: SVGAnimatedLength;\n readonly y: SVGAnimatedLength;\n checkEnclosure(element: SVGElement, rect: SVGRect): boolean;\n checkIntersection(element: SVGElement, rect: SVGRect): boolean;\n createSVGAngle(): SVGAngle;\n createSVGLength(): SVGLength;\n createSVGMatrix(): SVGMatrix;\n createSVGNumber(): SVGNumber;\n createSVGPoint(): SVGPoint;\n createSVGRect(): SVGRect;\n createSVGTransform(): SVGTransform;\n createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform;\n deselectAll(): void;\n forceRedraw(): void;\n getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration;\n getCurrentTime(): number;\n getElementById(elementId: string): Element;\n getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeListOf;\n getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeListOf;\n pauseAnimations(): void;\n setCurrentTime(seconds: number): void;\n suspendRedraw(maxWaitMilliseconds: number): number;\n unpauseAnimations(): void;\n unsuspendRedraw(suspendHandleID: number): void;\n unsuspendRedrawAll(): void;\n addEventListener(type: K, listener: (this: SVGSVGElement, ev: SVGSVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGSVGElement: {\n prototype: SVGSVGElement;\n new(): SVGSVGElement;\n}\n\ninterface SVGScriptElement extends SVGElement, SVGExternalResourcesRequired, SVGURIReference {\n type: string;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGScriptElement: {\n prototype: SVGScriptElement;\n new(): SVGScriptElement;\n}\n\ninterface SVGStopElement extends SVGElement, SVGStylable {\n readonly offset: SVGAnimatedNumber;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGStopElement: {\n prototype: SVGStopElement;\n new(): SVGStopElement;\n}\n\ninterface SVGStringList {\n readonly numberOfItems: number;\n appendItem(newItem: string): string;\n clear(): void;\n getItem(index: number): string;\n initialize(newItem: string): string;\n insertItemBefore(newItem: string, index: number): string;\n removeItem(index: number): string;\n replaceItem(newItem: string, index: number): string;\n}\n\ndeclare var SVGStringList: {\n prototype: SVGStringList;\n new(): SVGStringList;\n}\n\ninterface SVGStyleElement extends SVGElement, SVGLangSpace {\n disabled: boolean;\n media: string;\n title: string;\n type: string;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGStyleElement: {\n prototype: SVGStyleElement;\n new(): SVGStyleElement;\n}\n\ninterface SVGSwitchElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGSwitchElement: {\n prototype: SVGSwitchElement;\n new(): SVGSwitchElement;\n}\n\ninterface SVGSymbolElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox {\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGSymbolElement: {\n prototype: SVGSymbolElement;\n new(): SVGSymbolElement;\n}\n\ninterface SVGTSpanElement extends SVGTextPositioningElement {\n}\n\ndeclare var SVGTSpanElement: {\n prototype: SVGTSpanElement;\n new(): SVGTSpanElement;\n}\n\ninterface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired {\n readonly lengthAdjust: SVGAnimatedEnumeration;\n readonly textLength: SVGAnimatedLength;\n getCharNumAtPosition(point: SVGPoint): number;\n getComputedTextLength(): number;\n getEndPositionOfChar(charnum: number): SVGPoint;\n getExtentOfChar(charnum: number): SVGRect;\n getNumberOfChars(): number;\n getRotationOfChar(charnum: number): number;\n getStartPositionOfChar(charnum: number): SVGPoint;\n getSubStringLength(charnum: number, nchars: number): number;\n selectSubString(charnum: number, nchars: number): void;\n readonly LENGTHADJUST_SPACING: number;\n readonly LENGTHADJUST_SPACINGANDGLYPHS: number;\n readonly LENGTHADJUST_UNKNOWN: number;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGTextContentElement: {\n prototype: SVGTextContentElement;\n new(): SVGTextContentElement;\n readonly LENGTHADJUST_SPACING: number;\n readonly LENGTHADJUST_SPACINGANDGLYPHS: number;\n readonly LENGTHADJUST_UNKNOWN: number;\n}\n\ninterface SVGTextElement extends SVGTextPositioningElement, SVGTransformable {\n}\n\ndeclare var SVGTextElement: {\n prototype: SVGTextElement;\n new(): SVGTextElement;\n}\n\ninterface SVGTextPathElement extends SVGTextContentElement, SVGURIReference {\n readonly method: SVGAnimatedEnumeration;\n readonly spacing: SVGAnimatedEnumeration;\n readonly startOffset: SVGAnimatedLength;\n readonly TEXTPATH_METHODTYPE_ALIGN: number;\n readonly TEXTPATH_METHODTYPE_STRETCH: number;\n readonly TEXTPATH_METHODTYPE_UNKNOWN: number;\n readonly TEXTPATH_SPACINGTYPE_AUTO: number;\n readonly TEXTPATH_SPACINGTYPE_EXACT: number;\n readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number;\n}\n\ndeclare var SVGTextPathElement: {\n prototype: SVGTextPathElement;\n new(): SVGTextPathElement;\n readonly TEXTPATH_METHODTYPE_ALIGN: number;\n readonly TEXTPATH_METHODTYPE_STRETCH: number;\n readonly TEXTPATH_METHODTYPE_UNKNOWN: number;\n readonly TEXTPATH_SPACINGTYPE_AUTO: number;\n readonly TEXTPATH_SPACINGTYPE_EXACT: number;\n readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number;\n}\n\ninterface SVGTextPositioningElement extends SVGTextContentElement {\n readonly dx: SVGAnimatedLengthList;\n readonly dy: SVGAnimatedLengthList;\n readonly rotate: SVGAnimatedNumberList;\n readonly x: SVGAnimatedLengthList;\n readonly y: SVGAnimatedLengthList;\n}\n\ndeclare var SVGTextPositioningElement: {\n prototype: SVGTextPositioningElement;\n new(): SVGTextPositioningElement;\n}\n\ninterface SVGTitleElement extends SVGElement, SVGStylable, SVGLangSpace {\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGTitleElement: {\n prototype: SVGTitleElement;\n new(): SVGTitleElement;\n}\n\ninterface SVGTransform {\n readonly angle: number;\n readonly matrix: SVGMatrix;\n readonly type: number;\n setMatrix(matrix: SVGMatrix): void;\n setRotate(angle: number, cx: number, cy: number): void;\n setScale(sx: number, sy: number): void;\n setSkewX(angle: number): void;\n setSkewY(angle: number): void;\n setTranslate(tx: number, ty: number): void;\n readonly SVG_TRANSFORM_MATRIX: number;\n readonly SVG_TRANSFORM_ROTATE: number;\n readonly SVG_TRANSFORM_SCALE: number;\n readonly SVG_TRANSFORM_SKEWX: number;\n readonly SVG_TRANSFORM_SKEWY: number;\n readonly SVG_TRANSFORM_TRANSLATE: number;\n readonly SVG_TRANSFORM_UNKNOWN: number;\n}\n\ndeclare var SVGTransform: {\n prototype: SVGTransform;\n new(): SVGTransform;\n readonly SVG_TRANSFORM_MATRIX: number;\n readonly SVG_TRANSFORM_ROTATE: number;\n readonly SVG_TRANSFORM_SCALE: number;\n readonly SVG_TRANSFORM_SKEWX: number;\n readonly SVG_TRANSFORM_SKEWY: number;\n readonly SVG_TRANSFORM_TRANSLATE: number;\n readonly SVG_TRANSFORM_UNKNOWN: number;\n}\n\ninterface SVGTransformList {\n readonly numberOfItems: number;\n appendItem(newItem: SVGTransform): SVGTransform;\n clear(): void;\n consolidate(): SVGTransform;\n createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform;\n getItem(index: number): SVGTransform;\n initialize(newItem: SVGTransform): SVGTransform;\n insertItemBefore(newItem: SVGTransform, index: number): SVGTransform;\n removeItem(index: number): SVGTransform;\n replaceItem(newItem: SVGTransform, index: number): SVGTransform;\n}\n\ndeclare var SVGTransformList: {\n prototype: SVGTransformList;\n new(): SVGTransformList;\n}\n\ninterface SVGUnitTypes {\n readonly SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number;\n readonly SVG_UNIT_TYPE_UNKNOWN: number;\n readonly SVG_UNIT_TYPE_USERSPACEONUSE: number;\n}\ndeclare var SVGUnitTypes: SVGUnitTypes;\n\ninterface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference {\n readonly animatedInstanceRoot: SVGElementInstance;\n readonly height: SVGAnimatedLength;\n readonly instanceRoot: SVGElementInstance;\n readonly width: SVGAnimatedLength;\n readonly x: SVGAnimatedLength;\n readonly y: SVGAnimatedLength;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGUseElement: {\n prototype: SVGUseElement;\n new(): SVGUseElement;\n}\n\ninterface SVGViewElement extends SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan {\n readonly viewTarget: SVGStringList;\n addEventListener(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var SVGViewElement: {\n prototype: SVGViewElement;\n new(): SVGViewElement;\n}\n\ninterface SVGZoomAndPan {\n readonly zoomAndPan: number;\n}\n\ndeclare var SVGZoomAndPan: {\n readonly SVG_ZOOMANDPAN_DISABLE: number;\n readonly SVG_ZOOMANDPAN_MAGNIFY: number;\n readonly SVG_ZOOMANDPAN_UNKNOWN: number;\n}\n\ninterface SVGZoomEvent extends UIEvent {\n readonly newScale: number;\n readonly newTranslate: SVGPoint;\n readonly previousScale: number;\n readonly previousTranslate: SVGPoint;\n readonly zoomRectScreen: SVGRect;\n}\n\ndeclare var SVGZoomEvent: {\n prototype: SVGZoomEvent;\n new(): SVGZoomEvent;\n}\n\ninterface ScreenEventMap {\n \"MSOrientationChange\": Event;\n}\n\ninterface Screen extends EventTarget {\n readonly availHeight: number;\n readonly availWidth: number;\n bufferDepth: number;\n readonly colorDepth: number;\n readonly deviceXDPI: number;\n readonly deviceYDPI: number;\n readonly fontSmoothingEnabled: boolean;\n readonly height: number;\n readonly logicalXDPI: number;\n readonly logicalYDPI: number;\n readonly msOrientation: string;\n onmsorientationchange: (this: Screen, ev: Event) => any;\n readonly pixelDepth: number;\n readonly systemXDPI: number;\n readonly systemYDPI: number;\n readonly width: number;\n msLockOrientation(orientations: string | string[]): boolean;\n msUnlockOrientation(): void;\n addEventListener(type: K, listener: (this: Screen, ev: ScreenEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var Screen: {\n prototype: Screen;\n new(): Screen;\n}\n\ninterface ScriptNotifyEvent extends Event {\n readonly callingUri: string;\n readonly value: string;\n}\n\ndeclare var ScriptNotifyEvent: {\n prototype: ScriptNotifyEvent;\n new(): ScriptNotifyEvent;\n}\n\ninterface ScriptProcessorNodeEventMap {\n \"audioprocess\": AudioProcessingEvent;\n}\n\ninterface ScriptProcessorNode extends AudioNode {\n readonly bufferSize: number;\n onaudioprocess: (this: ScriptProcessorNode, ev: AudioProcessingEvent) => any;\n addEventListener(type: K, listener: (this: ScriptProcessorNode, ev: ScriptProcessorNodeEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var ScriptProcessorNode: {\n prototype: ScriptProcessorNode;\n new(): ScriptProcessorNode;\n}\n\ninterface Selection {\n readonly anchorNode: Node;\n readonly anchorOffset: number;\n readonly focusNode: Node;\n readonly focusOffset: number;\n readonly isCollapsed: boolean;\n readonly rangeCount: number;\n readonly type: string;\n addRange(range: Range): void;\n collapse(parentNode: Node, offset: number): void;\n collapseToEnd(): void;\n collapseToStart(): void;\n containsNode(node: Node, partlyContained: boolean): boolean;\n deleteFromDocument(): void;\n empty(): void;\n extend(newNode: Node, offset: number): void;\n getRangeAt(index: number): Range;\n removeAllRanges(): void;\n removeRange(range: Range): void;\n selectAllChildren(parentNode: Node): void;\n setBaseAndExtent(baseNode: Node, baseOffset: number, extentNode: Node, extentOffset: number): void;\n toString(): string;\n}\n\ndeclare var Selection: {\n prototype: Selection;\n new(): Selection;\n}\n\ninterface SourceBuffer extends EventTarget {\n appendWindowEnd: number;\n appendWindowStart: number;\n readonly audioTracks: AudioTrackList;\n readonly buffered: TimeRanges;\n mode: string;\n timestampOffset: number;\n readonly updating: boolean;\n readonly videoTracks: VideoTrackList;\n abort(): void;\n appendBuffer(data: ArrayBuffer | ArrayBufferView): void;\n appendStream(stream: MSStream, maxSize?: number): void;\n remove(start: number, end: number): void;\n}\n\ndeclare var SourceBuffer: {\n prototype: SourceBuffer;\n new(): SourceBuffer;\n}\n\ninterface SourceBufferList extends EventTarget {\n readonly length: number;\n item(index: number): SourceBuffer;\n [index: number]: SourceBuffer;\n}\n\ndeclare var SourceBufferList: {\n prototype: SourceBufferList;\n new(): SourceBufferList;\n}\n\ninterface StereoPannerNode extends AudioNode {\n readonly pan: AudioParam;\n}\n\ndeclare var StereoPannerNode: {\n prototype: StereoPannerNode;\n new(): StereoPannerNode;\n}\n\ninterface Storage {\n readonly length: number;\n clear(): void;\n getItem(key: string): string | null;\n key(index: number): string | null;\n removeItem(key: string): void;\n setItem(key: string, data: string): void;\n [key: string]: any;\n [index: number]: string;\n}\n\ndeclare var Storage: {\n prototype: Storage;\n new(): Storage;\n}\n\ninterface StorageEvent extends Event {\n readonly url: string;\n key?: string;\n oldValue?: string;\n newValue?: string;\n storageArea?: Storage;\n}\n\ndeclare var StorageEvent: {\n prototype: StorageEvent;\n new (type: string, eventInitDict?: StorageEventInit): StorageEvent;\n}\n\ninterface StyleMedia {\n readonly type: string;\n matchMedium(mediaquery: string): boolean;\n}\n\ndeclare var StyleMedia: {\n prototype: StyleMedia;\n new(): StyleMedia;\n}\n\ninterface StyleSheet {\n disabled: boolean;\n readonly href: string;\n readonly media: MediaList;\n readonly ownerNode: Node;\n readonly parentStyleSheet: StyleSheet;\n readonly title: string;\n readonly type: string;\n}\n\ndeclare var StyleSheet: {\n prototype: StyleSheet;\n new(): StyleSheet;\n}\n\ninterface StyleSheetList {\n readonly length: number;\n item(index?: number): StyleSheet;\n [index: number]: StyleSheet;\n}\n\ndeclare var StyleSheetList: {\n prototype: StyleSheetList;\n new(): StyleSheetList;\n}\n\ninterface StyleSheetPageList {\n readonly length: number;\n item(index: number): CSSPageRule;\n [index: number]: CSSPageRule;\n}\n\ndeclare var StyleSheetPageList: {\n prototype: StyleSheetPageList;\n new(): StyleSheetPageList;\n}\n\ninterface SubtleCrypto {\n decrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike;\n deriveBits(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, length: number): PromiseLike;\n deriveKey(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, derivedKeyType: string | AesDerivedKeyParams | HmacImportParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike;\n digest(algorithm: AlgorithmIdentifier, data: BufferSource): PromiseLike;\n encrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: BufferSource): PromiseLike;\n exportKey(format: \"jwk\", key: CryptoKey): PromiseLike;\n exportKey(format: \"raw\" | \"pkcs8\" | \"spki\", key: CryptoKey): PromiseLike;\n exportKey(format: string, key: CryptoKey): PromiseLike;\n generateKey(algorithm: string, extractable: boolean, keyUsages: string[]): PromiseLike;\n generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams | DhKeyGenParams, extractable: boolean, keyUsages: string[]): PromiseLike;\n generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: string[]): PromiseLike;\n importKey(format: \"jwk\", keyData: JsonWebKey, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike;\n importKey(format: \"raw\" | \"pkcs8\" | \"spki\", keyData: BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike;\n importKey(format: string, keyData: JsonWebKey | BufferSource, algorithm: string | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | DhImportKeyParams, extractable:boolean, keyUsages: string[]): PromiseLike;\n sign(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, data: BufferSource): PromiseLike;\n unwrapKey(format: string, wrappedKey: BufferSource, unwrappingKey: CryptoKey, unwrapAlgorithm: AlgorithmIdentifier, unwrappedKeyAlgorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: string[]): PromiseLike;\n verify(algorithm: string | RsaPssParams | EcdsaParams | AesCmacParams, key: CryptoKey, signature: BufferSource, data: BufferSource): PromiseLike;\n wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier): PromiseLike;\n}\n\ndeclare var SubtleCrypto: {\n prototype: SubtleCrypto;\n new(): SubtleCrypto;\n}\n\ninterface Text extends CharacterData {\n readonly wholeText: string;\n readonly assignedSlot: HTMLSlotElement | null;\n splitText(offset: number): Text;\n}\n\ndeclare var Text: {\n prototype: Text;\n new(): Text;\n}\n\ninterface TextEvent extends UIEvent {\n readonly data: string;\n readonly inputMethod: number;\n readonly locale: string;\n initTextEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, inputMethod: number, locale: string): void;\n readonly DOM_INPUT_METHOD_DROP: number;\n readonly DOM_INPUT_METHOD_HANDWRITING: number;\n readonly DOM_INPUT_METHOD_IME: number;\n readonly DOM_INPUT_METHOD_KEYBOARD: number;\n readonly DOM_INPUT_METHOD_MULTIMODAL: number;\n readonly DOM_INPUT_METHOD_OPTION: number;\n readonly DOM_INPUT_METHOD_PASTE: number;\n readonly DOM_INPUT_METHOD_SCRIPT: number;\n readonly DOM_INPUT_METHOD_UNKNOWN: number;\n readonly DOM_INPUT_METHOD_VOICE: number;\n}\n\ndeclare var TextEvent: {\n prototype: TextEvent;\n new(): TextEvent;\n readonly DOM_INPUT_METHOD_DROP: number;\n readonly DOM_INPUT_METHOD_HANDWRITING: number;\n readonly DOM_INPUT_METHOD_IME: number;\n readonly DOM_INPUT_METHOD_KEYBOARD: number;\n readonly DOM_INPUT_METHOD_MULTIMODAL: number;\n readonly DOM_INPUT_METHOD_OPTION: number;\n readonly DOM_INPUT_METHOD_PASTE: number;\n readonly DOM_INPUT_METHOD_SCRIPT: number;\n readonly DOM_INPUT_METHOD_UNKNOWN: number;\n readonly DOM_INPUT_METHOD_VOICE: number;\n}\n\ninterface TextMetrics {\n readonly width: number;\n}\n\ndeclare var TextMetrics: {\n prototype: TextMetrics;\n new(): TextMetrics;\n}\n\ninterface TextTrackEventMap {\n \"cuechange\": Event;\n \"error\": ErrorEvent;\n \"load\": Event;\n}\n\ninterface TextTrack extends EventTarget {\n readonly activeCues: TextTrackCueList;\n readonly cues: TextTrackCueList;\n readonly inBandMetadataTrackDispatchType: string;\n readonly kind: string;\n readonly label: string;\n readonly language: string;\n mode: any;\n oncuechange: (this: TextTrack, ev: Event) => any;\n onerror: (this: TextTrack, ev: ErrorEvent) => any;\n onload: (this: TextTrack, ev: Event) => any;\n readonly readyState: number;\n addCue(cue: TextTrackCue): void;\n removeCue(cue: TextTrackCue): void;\n readonly DISABLED: number;\n readonly ERROR: number;\n readonly HIDDEN: number;\n readonly LOADED: number;\n readonly LOADING: number;\n readonly NONE: number;\n readonly SHOWING: number;\n addEventListener(type: K, listener: (this: TextTrack, ev: TextTrackEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var TextTrack: {\n prototype: TextTrack;\n new(): TextTrack;\n readonly DISABLED: number;\n readonly ERROR: number;\n readonly HIDDEN: number;\n readonly LOADED: number;\n readonly LOADING: number;\n readonly NONE: number;\n readonly SHOWING: number;\n}\n\ninterface TextTrackCueEventMap {\n \"enter\": Event;\n \"exit\": Event;\n}\n\ninterface TextTrackCue extends EventTarget {\n endTime: number;\n id: string;\n onenter: (this: TextTrackCue, ev: Event) => any;\n onexit: (this: TextTrackCue, ev: Event) => any;\n pauseOnExit: boolean;\n startTime: number;\n text: string;\n readonly track: TextTrack;\n getCueAsHTML(): DocumentFragment;\n addEventListener(type: K, listener: (this: TextTrackCue, ev: TextTrackCueEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var TextTrackCue: {\n prototype: TextTrackCue;\n new(startTime: number, endTime: number, text: string): TextTrackCue;\n}\n\ninterface TextTrackCueList {\n readonly length: number;\n getCueById(id: string): TextTrackCue;\n item(index: number): TextTrackCue;\n [index: number]: TextTrackCue;\n}\n\ndeclare var TextTrackCueList: {\n prototype: TextTrackCueList;\n new(): TextTrackCueList;\n}\n\ninterface TextTrackListEventMap {\n \"addtrack\": TrackEvent;\n}\n\ninterface TextTrackList extends EventTarget {\n readonly length: number;\n onaddtrack: ((this: TextTrackList, ev: TrackEvent) => any) | null;\n item(index: number): TextTrack;\n addEventListener(type: K, listener: (this: TextTrackList, ev: TextTrackListEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n [index: number]: TextTrack;\n}\n\ndeclare var TextTrackList: {\n prototype: TextTrackList;\n new(): TextTrackList;\n}\n\ninterface TimeRanges {\n readonly length: number;\n end(index: number): number;\n start(index: number): number;\n}\n\ndeclare var TimeRanges: {\n prototype: TimeRanges;\n new(): TimeRanges;\n}\n\ninterface Touch {\n readonly clientX: number;\n readonly clientY: number;\n readonly identifier: number;\n readonly pageX: number;\n readonly pageY: number;\n readonly screenX: number;\n readonly screenY: number;\n readonly target: EventTarget;\n}\n\ndeclare var Touch: {\n prototype: Touch;\n new(): Touch;\n}\n\ninterface TouchEvent extends UIEvent {\n readonly altKey: boolean;\n readonly changedTouches: TouchList;\n readonly ctrlKey: boolean;\n readonly metaKey: boolean;\n readonly shiftKey: boolean;\n readonly targetTouches: TouchList;\n readonly touches: TouchList;\n}\n\ndeclare var TouchEvent: {\n prototype: TouchEvent;\n new(): TouchEvent;\n}\n\ninterface TouchList {\n readonly length: number;\n item(index: number): Touch | null;\n [index: number]: Touch;\n}\n\ndeclare var TouchList: {\n prototype: TouchList;\n new(): TouchList;\n}\n\ninterface TrackEvent extends Event {\n readonly track: any;\n}\n\ndeclare var TrackEvent: {\n prototype: TrackEvent;\n new(): TrackEvent;\n}\n\ninterface TransitionEvent extends Event {\n readonly elapsedTime: number;\n readonly propertyName: string;\n initTransitionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, propertyNameArg: string, elapsedTimeArg: number): void;\n}\n\ndeclare var TransitionEvent: {\n prototype: TransitionEvent;\n new(): TransitionEvent;\n}\n\ninterface TreeWalker {\n currentNode: Node;\n readonly expandEntityReferences: boolean;\n readonly filter: NodeFilter;\n readonly root: Node;\n readonly whatToShow: number;\n firstChild(): Node;\n lastChild(): Node;\n nextNode(): Node;\n nextSibling(): Node;\n parentNode(): Node;\n previousNode(): Node;\n previousSibling(): Node;\n}\n\ndeclare var TreeWalker: {\n prototype: TreeWalker;\n new(): TreeWalker;\n}\n\ninterface UIEvent extends Event {\n readonly detail: number;\n readonly view: Window;\n initUIEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number): void;\n}\n\ndeclare var UIEvent: {\n prototype: UIEvent;\n new(type: string, eventInitDict?: UIEventInit): UIEvent;\n}\n\ninterface URL {\n hash: string;\n host: string;\n hostname: string;\n href: string;\n readonly origin: string;\n password: string;\n pathname: string;\n port: string;\n protocol: string;\n search: string;\n username: string;\n toString(): string;\n}\n\ndeclare var URL: {\n prototype: URL;\n new(url: string, base?: string): URL;\n createObjectURL(object: any, options?: ObjectURLOptions): string;\n revokeObjectURL(url: string): void;\n}\n\ninterface UnviewableContentIdentifiedEvent extends NavigationEventWithReferrer {\n readonly mediaType: string;\n}\n\ndeclare var UnviewableContentIdentifiedEvent: {\n prototype: UnviewableContentIdentifiedEvent;\n new(): UnviewableContentIdentifiedEvent;\n}\n\ninterface ValidityState {\n readonly badInput: boolean;\n readonly customError: boolean;\n readonly patternMismatch: boolean;\n readonly rangeOverflow: boolean;\n readonly rangeUnderflow: boolean;\n readonly stepMismatch: boolean;\n readonly tooLong: boolean;\n readonly typeMismatch: boolean;\n readonly valid: boolean;\n readonly valueMissing: boolean;\n}\n\ndeclare var ValidityState: {\n prototype: ValidityState;\n new(): ValidityState;\n}\n\ninterface VideoPlaybackQuality {\n readonly corruptedVideoFrames: number;\n readonly creationTime: number;\n readonly droppedVideoFrames: number;\n readonly totalFrameDelay: number;\n readonly totalVideoFrames: number;\n}\n\ndeclare var VideoPlaybackQuality: {\n prototype: VideoPlaybackQuality;\n new(): VideoPlaybackQuality;\n}\n\ninterface VideoTrack {\n readonly id: string;\n kind: string;\n readonly label: string;\n language: string;\n selected: boolean;\n readonly sourceBuffer: SourceBuffer;\n}\n\ndeclare var VideoTrack: {\n prototype: VideoTrack;\n new(): VideoTrack;\n}\n\ninterface VideoTrackListEventMap {\n \"addtrack\": TrackEvent;\n \"change\": Event;\n \"removetrack\": TrackEvent;\n}\n\ninterface VideoTrackList extends EventTarget {\n readonly length: number;\n onaddtrack: (this: VideoTrackList, ev: TrackEvent) => any;\n onchange: (this: VideoTrackList, ev: Event) => any;\n onremovetrack: (this: VideoTrackList, ev: TrackEvent) => any;\n readonly selectedIndex: number;\n getTrackById(id: string): VideoTrack | null;\n item(index: number): VideoTrack;\n addEventListener(type: K, listener: (this: VideoTrackList, ev: VideoTrackListEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n [index: number]: VideoTrack;\n}\n\ndeclare var VideoTrackList: {\n prototype: VideoTrackList;\n new(): VideoTrackList;\n}\n\ninterface WEBGL_compressed_texture_s3tc {\n readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number;\n readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number;\n readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number;\n readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number;\n}\n\ndeclare var WEBGL_compressed_texture_s3tc: {\n prototype: WEBGL_compressed_texture_s3tc;\n new(): WEBGL_compressed_texture_s3tc;\n readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number;\n readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number;\n readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number;\n readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number;\n}\n\ninterface WEBGL_debug_renderer_info {\n readonly UNMASKED_RENDERER_WEBGL: number;\n readonly UNMASKED_VENDOR_WEBGL: number;\n}\n\ndeclare var WEBGL_debug_renderer_info: {\n prototype: WEBGL_debug_renderer_info;\n new(): WEBGL_debug_renderer_info;\n readonly UNMASKED_RENDERER_WEBGL: number;\n readonly UNMASKED_VENDOR_WEBGL: number;\n}\n\ninterface WEBGL_depth_texture {\n readonly UNSIGNED_INT_24_8_WEBGL: number;\n}\n\ndeclare var WEBGL_depth_texture: {\n prototype: WEBGL_depth_texture;\n new(): WEBGL_depth_texture;\n readonly UNSIGNED_INT_24_8_WEBGL: number;\n}\n\ninterface WaveShaperNode extends AudioNode {\n curve: Float32Array | null;\n oversample: string;\n}\n\ndeclare var WaveShaperNode: {\n prototype: WaveShaperNode;\n new(): WaveShaperNode;\n}\n\ninterface WebGLActiveInfo {\n readonly name: string;\n readonly size: number;\n readonly type: number;\n}\n\ndeclare var WebGLActiveInfo: {\n prototype: WebGLActiveInfo;\n new(): WebGLActiveInfo;\n}\n\ninterface WebGLBuffer extends WebGLObject {\n}\n\ndeclare var WebGLBuffer: {\n prototype: WebGLBuffer;\n new(): WebGLBuffer;\n}\n\ninterface WebGLContextEvent extends Event {\n readonly statusMessage: string;\n}\n\ndeclare var WebGLContextEvent: {\n prototype: WebGLContextEvent;\n new(type: string, eventInitDict?: WebGLContextEventInit): WebGLContextEvent;\n}\n\ninterface WebGLFramebuffer extends WebGLObject {\n}\n\ndeclare var WebGLFramebuffer: {\n prototype: WebGLFramebuffer;\n new(): WebGLFramebuffer;\n}\n\ninterface WebGLObject {\n}\n\ndeclare var WebGLObject: {\n prototype: WebGLObject;\n new(): WebGLObject;\n}\n\ninterface WebGLProgram extends WebGLObject {\n}\n\ndeclare var WebGLProgram: {\n prototype: WebGLProgram;\n new(): WebGLProgram;\n}\n\ninterface WebGLRenderbuffer extends WebGLObject {\n}\n\ndeclare var WebGLRenderbuffer: {\n prototype: WebGLRenderbuffer;\n new(): WebGLRenderbuffer;\n}\n\ninterface WebGLRenderingContext {\n readonly canvas: HTMLCanvasElement;\n readonly drawingBufferHeight: number;\n readonly drawingBufferWidth: number;\n activeTexture(texture: number): void;\n attachShader(program: WebGLProgram | null, shader: WebGLShader | null): void;\n bindAttribLocation(program: WebGLProgram | null, index: number, name: string): void;\n bindBuffer(target: number, buffer: WebGLBuffer | null): void;\n bindFramebuffer(target: number, framebuffer: WebGLFramebuffer | null): void;\n bindRenderbuffer(target: number, renderbuffer: WebGLRenderbuffer | null): void;\n bindTexture(target: number, texture: WebGLTexture | null): void;\n blendColor(red: number, green: number, blue: number, alpha: number): void;\n blendEquation(mode: number): void;\n blendEquationSeparate(modeRGB: number, modeAlpha: number): void;\n blendFunc(sfactor: number, dfactor: number): void;\n blendFuncSeparate(srcRGB: number, dstRGB: number, srcAlpha: number, dstAlpha: number): void;\n bufferData(target: number, size: number | ArrayBufferView | ArrayBuffer, usage: number): void;\n bufferSubData(target: number, offset: number, data: ArrayBufferView | ArrayBuffer): void;\n checkFramebufferStatus(target: number): number;\n clear(mask: number): void;\n clearColor(red: number, green: number, blue: number, alpha: number): void;\n clearDepth(depth: number): void;\n clearStencil(s: number): void;\n colorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void;\n compileShader(shader: WebGLShader | null): void;\n compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: ArrayBufferView): void;\n compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: ArrayBufferView): void;\n copyTexImage2D(target: number, level: number, internalformat: number, x: number, y: number, width: number, height: number, border: number): void;\n copyTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, x: number, y: number, width: number, height: number): void;\n createBuffer(): WebGLBuffer | null;\n createFramebuffer(): WebGLFramebuffer | null;\n createProgram(): WebGLProgram | null;\n createRenderbuffer(): WebGLRenderbuffer | null;\n createShader(type: number): WebGLShader | null;\n createTexture(): WebGLTexture | null;\n cullFace(mode: number): void;\n deleteBuffer(buffer: WebGLBuffer | null): void;\n deleteFramebuffer(framebuffer: WebGLFramebuffer | null): void;\n deleteProgram(program: WebGLProgram | null): void;\n deleteRenderbuffer(renderbuffer: WebGLRenderbuffer | null): void;\n deleteShader(shader: WebGLShader | null): void;\n deleteTexture(texture: WebGLTexture | null): void;\n depthFunc(func: number): void;\n depthMask(flag: boolean): void;\n depthRange(zNear: number, zFar: number): void;\n detachShader(program: WebGLProgram | null, shader: WebGLShader | null): void;\n disable(cap: number): void;\n disableVertexAttribArray(index: number): void;\n drawArrays(mode: number, first: number, count: number): void;\n drawElements(mode: number, count: number, type: number, offset: number): void;\n enable(cap: number): void;\n enableVertexAttribArray(index: number): void;\n finish(): void;\n flush(): void;\n framebufferRenderbuffer(target: number, attachment: number, renderbuffertarget: number, renderbuffer: WebGLRenderbuffer | null): void;\n framebufferTexture2D(target: number, attachment: number, textarget: number, texture: WebGLTexture | null, level: number): void;\n frontFace(mode: number): void;\n generateMipmap(target: number): void;\n getActiveAttrib(program: WebGLProgram | null, index: number): WebGLActiveInfo | null;\n getActiveUniform(program: WebGLProgram | null, index: number): WebGLActiveInfo | null;\n getAttachedShaders(program: WebGLProgram | null): WebGLShader[] | null;\n getAttribLocation(program: WebGLProgram | null, name: string): number;\n getBufferParameter(target: number, pname: number): any;\n getContextAttributes(): WebGLContextAttributes;\n getError(): number;\n getExtension(name: string): any;\n getFramebufferAttachmentParameter(target: number, attachment: number, pname: number): any;\n getParameter(pname: number): any;\n getProgramInfoLog(program: WebGLProgram | null): string | null;\n getProgramParameter(program: WebGLProgram | null, pname: number): any;\n getRenderbufferParameter(target: number, pname: number): any;\n getShaderInfoLog(shader: WebGLShader | null): string | null;\n getShaderParameter(shader: WebGLShader | null, pname: number): any;\n getShaderPrecisionFormat(shadertype: number, precisiontype: number): WebGLShaderPrecisionFormat | null;\n getShaderSource(shader: WebGLShader | null): string | null;\n getSupportedExtensions(): string[] | null;\n getTexParameter(target: number, pname: number): any;\n getUniform(program: WebGLProgram | null, location: WebGLUniformLocation | null): any;\n getUniformLocation(program: WebGLProgram | null, name: string): WebGLUniformLocation | null;\n getVertexAttrib(index: number, pname: number): any;\n getVertexAttribOffset(index: number, pname: number): number;\n hint(target: number, mode: number): void;\n isBuffer(buffer: WebGLBuffer | null): boolean;\n isContextLost(): boolean;\n isEnabled(cap: number): boolean;\n isFramebuffer(framebuffer: WebGLFramebuffer | null): boolean;\n isProgram(program: WebGLProgram | null): boolean;\n isRenderbuffer(renderbuffer: WebGLRenderbuffer | null): boolean;\n isShader(shader: WebGLShader | null): boolean;\n isTexture(texture: WebGLTexture | null): boolean;\n lineWidth(width: number): void;\n linkProgram(program: WebGLProgram | null): void;\n pixelStorei(pname: number, param: number): void;\n polygonOffset(factor: number, units: number): void;\n readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView | null): void;\n renderbufferStorage(target: number, internalformat: number, width: number, height: number): void;\n sampleCoverage(value: number, invert: boolean): void;\n scissor(x: number, y: number, width: number, height: number): void;\n shaderSource(shader: WebGLShader | null, source: string): void;\n stencilFunc(func: number, ref: number, mask: number): void;\n stencilFuncSeparate(face: number, func: number, ref: number, mask: number): void;\n stencilMask(mask: number): void;\n stencilMaskSeparate(face: number, mask: number): void;\n stencilOp(fail: number, zfail: number, zpass: number): void;\n stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void;\n texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels?: ArrayBufferView): void;\n texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void;\n texParameterf(target: number, pname: number, param: number): void;\n texParameteri(target: number, pname: number, param: number): void;\n texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels?: ArrayBufferView): void;\n texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void;\n uniform1f(location: WebGLUniformLocation | null, x: number): void;\n uniform1fv(location: WebGLUniformLocation, v: Float32Array | number[]): void;\n uniform1i(location: WebGLUniformLocation | null, x: number): void;\n uniform1iv(location: WebGLUniformLocation, v: Int32Array | number[]): void;\n uniform2f(location: WebGLUniformLocation | null, x: number, y: number): void;\n uniform2fv(location: WebGLUniformLocation, v: Float32Array | number[]): void;\n uniform2i(location: WebGLUniformLocation | null, x: number, y: number): void;\n uniform2iv(location: WebGLUniformLocation, v: Int32Array | number[]): void;\n uniform3f(location: WebGLUniformLocation | null, x: number, y: number, z: number): void;\n uniform3fv(location: WebGLUniformLocation, v: Float32Array | number[]): void;\n uniform3i(location: WebGLUniformLocation | null, x: number, y: number, z: number): void;\n uniform3iv(location: WebGLUniformLocation, v: Int32Array | number[]): void;\n uniform4f(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void;\n uniform4fv(location: WebGLUniformLocation, v: Float32Array | number[]): void;\n uniform4i(location: WebGLUniformLocation | null, x: number, y: number, z: number, w: number): void;\n uniform4iv(location: WebGLUniformLocation, v: Int32Array | number[]): void;\n uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void;\n uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void;\n uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void;\n useProgram(program: WebGLProgram | null): void;\n validateProgram(program: WebGLProgram | null): void;\n vertexAttrib1f(indx: number, x: number): void;\n vertexAttrib1fv(indx: number, values: Float32Array | number[]): void;\n vertexAttrib2f(indx: number, x: number, y: number): void;\n vertexAttrib2fv(indx: number, values: Float32Array | number[]): void;\n vertexAttrib3f(indx: number, x: number, y: number, z: number): void;\n vertexAttrib3fv(indx: number, values: Float32Array | number[]): void;\n vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void;\n vertexAttrib4fv(indx: number, values: Float32Array | number[]): void;\n vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void;\n viewport(x: number, y: number, width: number, height: number): void;\n readonly ACTIVE_ATTRIBUTES: number;\n readonly ACTIVE_TEXTURE: number;\n readonly ACTIVE_UNIFORMS: number;\n readonly ALIASED_LINE_WIDTH_RANGE: number;\n readonly ALIASED_POINT_SIZE_RANGE: number;\n readonly ALPHA: number;\n readonly ALPHA_BITS: number;\n readonly ALWAYS: number;\n readonly ARRAY_BUFFER: number;\n readonly ARRAY_BUFFER_BINDING: number;\n readonly ATTACHED_SHADERS: number;\n readonly BACK: number;\n readonly BLEND: number;\n readonly BLEND_COLOR: number;\n readonly BLEND_DST_ALPHA: number;\n readonly BLEND_DST_RGB: number;\n readonly BLEND_EQUATION: number;\n readonly BLEND_EQUATION_ALPHA: number;\n readonly BLEND_EQUATION_RGB: number;\n readonly BLEND_SRC_ALPHA: number;\n readonly BLEND_SRC_RGB: number;\n readonly BLUE_BITS: number;\n readonly BOOL: number;\n readonly BOOL_VEC2: number;\n readonly BOOL_VEC3: number;\n readonly BOOL_VEC4: number;\n readonly BROWSER_DEFAULT_WEBGL: number;\n readonly BUFFER_SIZE: number;\n readonly BUFFER_USAGE: number;\n readonly BYTE: number;\n readonly CCW: number;\n readonly CLAMP_TO_EDGE: number;\n readonly COLOR_ATTACHMENT0: number;\n readonly COLOR_BUFFER_BIT: number;\n readonly COLOR_CLEAR_VALUE: number;\n readonly COLOR_WRITEMASK: number;\n readonly COMPILE_STATUS: number;\n readonly COMPRESSED_TEXTURE_FORMATS: number;\n readonly CONSTANT_ALPHA: number;\n readonly CONSTANT_COLOR: number;\n readonly CONTEXT_LOST_WEBGL: number;\n readonly CULL_FACE: number;\n readonly CULL_FACE_MODE: number;\n readonly CURRENT_PROGRAM: number;\n readonly CURRENT_VERTEX_ATTRIB: number;\n readonly CW: number;\n readonly DECR: number;\n readonly DECR_WRAP: number;\n readonly DELETE_STATUS: number;\n readonly DEPTH_ATTACHMENT: number;\n readonly DEPTH_BITS: number;\n readonly DEPTH_BUFFER_BIT: number;\n readonly DEPTH_CLEAR_VALUE: number;\n readonly DEPTH_COMPONENT: number;\n readonly DEPTH_COMPONENT16: number;\n readonly DEPTH_FUNC: number;\n readonly DEPTH_RANGE: number;\n readonly DEPTH_STENCIL: number;\n readonly DEPTH_STENCIL_ATTACHMENT: number;\n readonly DEPTH_TEST: number;\n readonly DEPTH_WRITEMASK: number;\n readonly DITHER: number;\n readonly DONT_CARE: number;\n readonly DST_ALPHA: number;\n readonly DST_COLOR: number;\n readonly DYNAMIC_DRAW: number;\n readonly ELEMENT_ARRAY_BUFFER: number;\n readonly ELEMENT_ARRAY_BUFFER_BINDING: number;\n readonly EQUAL: number;\n readonly FASTEST: number;\n readonly FLOAT: number;\n readonly FLOAT_MAT2: number;\n readonly FLOAT_MAT3: number;\n readonly FLOAT_MAT4: number;\n readonly FLOAT_VEC2: number;\n readonly FLOAT_VEC3: number;\n readonly FLOAT_VEC4: number;\n readonly FRAGMENT_SHADER: number;\n readonly FRAMEBUFFER: number;\n readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number;\n readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number;\n readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number;\n readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number;\n readonly FRAMEBUFFER_BINDING: number;\n readonly FRAMEBUFFER_COMPLETE: number;\n readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number;\n readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number;\n readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number;\n readonly FRAMEBUFFER_UNSUPPORTED: number;\n readonly FRONT: number;\n readonly FRONT_AND_BACK: number;\n readonly FRONT_FACE: number;\n readonly FUNC_ADD: number;\n readonly FUNC_REVERSE_SUBTRACT: number;\n readonly FUNC_SUBTRACT: number;\n readonly GENERATE_MIPMAP_HINT: number;\n readonly GEQUAL: number;\n readonly GREATER: number;\n readonly GREEN_BITS: number;\n readonly HIGH_FLOAT: number;\n readonly HIGH_INT: number;\n readonly IMPLEMENTATION_COLOR_READ_FORMAT: number;\n readonly IMPLEMENTATION_COLOR_READ_TYPE: number;\n readonly INCR: number;\n readonly INCR_WRAP: number;\n readonly INT: number;\n readonly INT_VEC2: number;\n readonly INT_VEC3: number;\n readonly INT_VEC4: number;\n readonly INVALID_ENUM: number;\n readonly INVALID_FRAMEBUFFER_OPERATION: number;\n readonly INVALID_OPERATION: number;\n readonly INVALID_VALUE: number;\n readonly INVERT: number;\n readonly KEEP: number;\n readonly LEQUAL: number;\n readonly LESS: number;\n readonly LINEAR: number;\n readonly LINEAR_MIPMAP_LINEAR: number;\n readonly LINEAR_MIPMAP_NEAREST: number;\n readonly LINES: number;\n readonly LINE_LOOP: number;\n readonly LINE_STRIP: number;\n readonly LINE_WIDTH: number;\n readonly LINK_STATUS: number;\n readonly LOW_FLOAT: number;\n readonly LOW_INT: number;\n readonly LUMINANCE: number;\n readonly LUMINANCE_ALPHA: number;\n readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number;\n readonly MAX_CUBE_MAP_TEXTURE_SIZE: number;\n readonly MAX_FRAGMENT_UNIFORM_VECTORS: number;\n readonly MAX_RENDERBUFFER_SIZE: number;\n readonly MAX_TEXTURE_IMAGE_UNITS: number;\n readonly MAX_TEXTURE_SIZE: number;\n readonly MAX_VARYING_VECTORS: number;\n readonly MAX_VERTEX_ATTRIBS: number;\n readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number;\n readonly MAX_VERTEX_UNIFORM_VECTORS: number;\n readonly MAX_VIEWPORT_DIMS: number;\n readonly MEDIUM_FLOAT: number;\n readonly MEDIUM_INT: number;\n readonly MIRRORED_REPEAT: number;\n readonly NEAREST: number;\n readonly NEAREST_MIPMAP_LINEAR: number;\n readonly NEAREST_MIPMAP_NEAREST: number;\n readonly NEVER: number;\n readonly NICEST: number;\n readonly NONE: number;\n readonly NOTEQUAL: number;\n readonly NO_ERROR: number;\n readonly ONE: number;\n readonly ONE_MINUS_CONSTANT_ALPHA: number;\n readonly ONE_MINUS_CONSTANT_COLOR: number;\n readonly ONE_MINUS_DST_ALPHA: number;\n readonly ONE_MINUS_DST_COLOR: number;\n readonly ONE_MINUS_SRC_ALPHA: number;\n readonly ONE_MINUS_SRC_COLOR: number;\n readonly OUT_OF_MEMORY: number;\n readonly PACK_ALIGNMENT: number;\n readonly POINTS: number;\n readonly POLYGON_OFFSET_FACTOR: number;\n readonly POLYGON_OFFSET_FILL: number;\n readonly POLYGON_OFFSET_UNITS: number;\n readonly RED_BITS: number;\n readonly RENDERBUFFER: number;\n readonly RENDERBUFFER_ALPHA_SIZE: number;\n readonly RENDERBUFFER_BINDING: number;\n readonly RENDERBUFFER_BLUE_SIZE: number;\n readonly RENDERBUFFER_DEPTH_SIZE: number;\n readonly RENDERBUFFER_GREEN_SIZE: number;\n readonly RENDERBUFFER_HEIGHT: number;\n readonly RENDERBUFFER_INTERNAL_FORMAT: number;\n readonly RENDERBUFFER_RED_SIZE: number;\n readonly RENDERBUFFER_STENCIL_SIZE: number;\n readonly RENDERBUFFER_WIDTH: number;\n readonly RENDERER: number;\n readonly REPEAT: number;\n readonly REPLACE: number;\n readonly RGB: number;\n readonly RGB565: number;\n readonly RGB5_A1: number;\n readonly RGBA: number;\n readonly RGBA4: number;\n readonly SAMPLER_2D: number;\n readonly SAMPLER_CUBE: number;\n readonly SAMPLES: number;\n readonly SAMPLE_ALPHA_TO_COVERAGE: number;\n readonly SAMPLE_BUFFERS: number;\n readonly SAMPLE_COVERAGE: number;\n readonly SAMPLE_COVERAGE_INVERT: number;\n readonly SAMPLE_COVERAGE_VALUE: number;\n readonly SCISSOR_BOX: number;\n readonly SCISSOR_TEST: number;\n readonly SHADER_TYPE: number;\n readonly SHADING_LANGUAGE_VERSION: number;\n readonly SHORT: number;\n readonly SRC_ALPHA: number;\n readonly SRC_ALPHA_SATURATE: number;\n readonly SRC_COLOR: number;\n readonly STATIC_DRAW: number;\n readonly STENCIL_ATTACHMENT: number;\n readonly STENCIL_BACK_FAIL: number;\n readonly STENCIL_BACK_FUNC: number;\n readonly STENCIL_BACK_PASS_DEPTH_FAIL: number;\n readonly STENCIL_BACK_PASS_DEPTH_PASS: number;\n readonly STENCIL_BACK_REF: number;\n readonly STENCIL_BACK_VALUE_MASK: number;\n readonly STENCIL_BACK_WRITEMASK: number;\n readonly STENCIL_BITS: number;\n readonly STENCIL_BUFFER_BIT: number;\n readonly STENCIL_CLEAR_VALUE: number;\n readonly STENCIL_FAIL: number;\n readonly STENCIL_FUNC: number;\n readonly STENCIL_INDEX: number;\n readonly STENCIL_INDEX8: number;\n readonly STENCIL_PASS_DEPTH_FAIL: number;\n readonly STENCIL_PASS_DEPTH_PASS: number;\n readonly STENCIL_REF: number;\n readonly STENCIL_TEST: number;\n readonly STENCIL_VALUE_MASK: number;\n readonly STENCIL_WRITEMASK: number;\n readonly STREAM_DRAW: number;\n readonly SUBPIXEL_BITS: number;\n readonly TEXTURE: number;\n readonly TEXTURE0: number;\n readonly TEXTURE1: number;\n readonly TEXTURE10: number;\n readonly TEXTURE11: number;\n readonly TEXTURE12: number;\n readonly TEXTURE13: number;\n readonly TEXTURE14: number;\n readonly TEXTURE15: number;\n readonly TEXTURE16: number;\n readonly TEXTURE17: number;\n readonly TEXTURE18: number;\n readonly TEXTURE19: number;\n readonly TEXTURE2: number;\n readonly TEXTURE20: number;\n readonly TEXTURE21: number;\n readonly TEXTURE22: number;\n readonly TEXTURE23: number;\n readonly TEXTURE24: number;\n readonly TEXTURE25: number;\n readonly TEXTURE26: number;\n readonly TEXTURE27: number;\n readonly TEXTURE28: number;\n readonly TEXTURE29: number;\n readonly TEXTURE3: number;\n readonly TEXTURE30: number;\n readonly TEXTURE31: number;\n readonly TEXTURE4: number;\n readonly TEXTURE5: number;\n readonly TEXTURE6: number;\n readonly TEXTURE7: number;\n readonly TEXTURE8: number;\n readonly TEXTURE9: number;\n readonly TEXTURE_2D: number;\n readonly TEXTURE_BINDING_2D: number;\n readonly TEXTURE_BINDING_CUBE_MAP: number;\n readonly TEXTURE_CUBE_MAP: number;\n readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number;\n readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number;\n readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number;\n readonly TEXTURE_CUBE_MAP_POSITIVE_X: number;\n readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number;\n readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number;\n readonly TEXTURE_MAG_FILTER: number;\n readonly TEXTURE_MIN_FILTER: number;\n readonly TEXTURE_WRAP_S: number;\n readonly TEXTURE_WRAP_T: number;\n readonly TRIANGLES: number;\n readonly TRIANGLE_FAN: number;\n readonly TRIANGLE_STRIP: number;\n readonly UNPACK_ALIGNMENT: number;\n readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number;\n readonly UNPACK_FLIP_Y_WEBGL: number;\n readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number;\n readonly UNSIGNED_BYTE: number;\n readonly UNSIGNED_INT: number;\n readonly UNSIGNED_SHORT: number;\n readonly UNSIGNED_SHORT_4_4_4_4: number;\n readonly UNSIGNED_SHORT_5_5_5_1: number;\n readonly UNSIGNED_SHORT_5_6_5: number;\n readonly VALIDATE_STATUS: number;\n readonly VENDOR: number;\n readonly VERSION: number;\n readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number;\n readonly VERTEX_ATTRIB_ARRAY_ENABLED: number;\n readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number;\n readonly VERTEX_ATTRIB_ARRAY_POINTER: number;\n readonly VERTEX_ATTRIB_ARRAY_SIZE: number;\n readonly VERTEX_ATTRIB_ARRAY_STRIDE: number;\n readonly VERTEX_ATTRIB_ARRAY_TYPE: number;\n readonly VERTEX_SHADER: number;\n readonly VIEWPORT: number;\n readonly ZERO: number;\n}\n\ndeclare var WebGLRenderingContext: {\n prototype: WebGLRenderingContext;\n new(): WebGLRenderingContext;\n readonly ACTIVE_ATTRIBUTES: number;\n readonly ACTIVE_TEXTURE: number;\n readonly ACTIVE_UNIFORMS: number;\n readonly ALIASED_LINE_WIDTH_RANGE: number;\n readonly ALIASED_POINT_SIZE_RANGE: number;\n readonly ALPHA: number;\n readonly ALPHA_BITS: number;\n readonly ALWAYS: number;\n readonly ARRAY_BUFFER: number;\n readonly ARRAY_BUFFER_BINDING: number;\n readonly ATTACHED_SHADERS: number;\n readonly BACK: number;\n readonly BLEND: number;\n readonly BLEND_COLOR: number;\n readonly BLEND_DST_ALPHA: number;\n readonly BLEND_DST_RGB: number;\n readonly BLEND_EQUATION: number;\n readonly BLEND_EQUATION_ALPHA: number;\n readonly BLEND_EQUATION_RGB: number;\n readonly BLEND_SRC_ALPHA: number;\n readonly BLEND_SRC_RGB: number;\n readonly BLUE_BITS: number;\n readonly BOOL: number;\n readonly BOOL_VEC2: number;\n readonly BOOL_VEC3: number;\n readonly BOOL_VEC4: number;\n readonly BROWSER_DEFAULT_WEBGL: number;\n readonly BUFFER_SIZE: number;\n readonly BUFFER_USAGE: number;\n readonly BYTE: number;\n readonly CCW: number;\n readonly CLAMP_TO_EDGE: number;\n readonly COLOR_ATTACHMENT0: number;\n readonly COLOR_BUFFER_BIT: number;\n readonly COLOR_CLEAR_VALUE: number;\n readonly COLOR_WRITEMASK: number;\n readonly COMPILE_STATUS: number;\n readonly COMPRESSED_TEXTURE_FORMATS: number;\n readonly CONSTANT_ALPHA: number;\n readonly CONSTANT_COLOR: number;\n readonly CONTEXT_LOST_WEBGL: number;\n readonly CULL_FACE: number;\n readonly CULL_FACE_MODE: number;\n readonly CURRENT_PROGRAM: number;\n readonly CURRENT_VERTEX_ATTRIB: number;\n readonly CW: number;\n readonly DECR: number;\n readonly DECR_WRAP: number;\n readonly DELETE_STATUS: number;\n readonly DEPTH_ATTACHMENT: number;\n readonly DEPTH_BITS: number;\n readonly DEPTH_BUFFER_BIT: number;\n readonly DEPTH_CLEAR_VALUE: number;\n readonly DEPTH_COMPONENT: number;\n readonly DEPTH_COMPONENT16: number;\n readonly DEPTH_FUNC: number;\n readonly DEPTH_RANGE: number;\n readonly DEPTH_STENCIL: number;\n readonly DEPTH_STENCIL_ATTACHMENT: number;\n readonly DEPTH_TEST: number;\n readonly DEPTH_WRITEMASK: number;\n readonly DITHER: number;\n readonly DONT_CARE: number;\n readonly DST_ALPHA: number;\n readonly DST_COLOR: number;\n readonly DYNAMIC_DRAW: number;\n readonly ELEMENT_ARRAY_BUFFER: number;\n readonly ELEMENT_ARRAY_BUFFER_BINDING: number;\n readonly EQUAL: number;\n readonly FASTEST: number;\n readonly FLOAT: number;\n readonly FLOAT_MAT2: number;\n readonly FLOAT_MAT3: number;\n readonly FLOAT_MAT4: number;\n readonly FLOAT_VEC2: number;\n readonly FLOAT_VEC3: number;\n readonly FLOAT_VEC4: number;\n readonly FRAGMENT_SHADER: number;\n readonly FRAMEBUFFER: number;\n readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number;\n readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number;\n readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number;\n readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number;\n readonly FRAMEBUFFER_BINDING: number;\n readonly FRAMEBUFFER_COMPLETE: number;\n readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number;\n readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number;\n readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number;\n readonly FRAMEBUFFER_UNSUPPORTED: number;\n readonly FRONT: number;\n readonly FRONT_AND_BACK: number;\n readonly FRONT_FACE: number;\n readonly FUNC_ADD: number;\n readonly FUNC_REVERSE_SUBTRACT: number;\n readonly FUNC_SUBTRACT: number;\n readonly GENERATE_MIPMAP_HINT: number;\n readonly GEQUAL: number;\n readonly GREATER: number;\n readonly GREEN_BITS: number;\n readonly HIGH_FLOAT: number;\n readonly HIGH_INT: number;\n readonly IMPLEMENTATION_COLOR_READ_FORMAT: number;\n readonly IMPLEMENTATION_COLOR_READ_TYPE: number;\n readonly INCR: number;\n readonly INCR_WRAP: number;\n readonly INT: number;\n readonly INT_VEC2: number;\n readonly INT_VEC3: number;\n readonly INT_VEC4: number;\n readonly INVALID_ENUM: number;\n readonly INVALID_FRAMEBUFFER_OPERATION: number;\n readonly INVALID_OPERATION: number;\n readonly INVALID_VALUE: number;\n readonly INVERT: number;\n readonly KEEP: number;\n readonly LEQUAL: number;\n readonly LESS: number;\n readonly LINEAR: number;\n readonly LINEAR_MIPMAP_LINEAR: number;\n readonly LINEAR_MIPMAP_NEAREST: number;\n readonly LINES: number;\n readonly LINE_LOOP: number;\n readonly LINE_STRIP: number;\n readonly LINE_WIDTH: number;\n readonly LINK_STATUS: number;\n readonly LOW_FLOAT: number;\n readonly LOW_INT: number;\n readonly LUMINANCE: number;\n readonly LUMINANCE_ALPHA: number;\n readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number;\n readonly MAX_CUBE_MAP_TEXTURE_SIZE: number;\n readonly MAX_FRAGMENT_UNIFORM_VECTORS: number;\n readonly MAX_RENDERBUFFER_SIZE: number;\n readonly MAX_TEXTURE_IMAGE_UNITS: number;\n readonly MAX_TEXTURE_SIZE: number;\n readonly MAX_VARYING_VECTORS: number;\n readonly MAX_VERTEX_ATTRIBS: number;\n readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number;\n readonly MAX_VERTEX_UNIFORM_VECTORS: number;\n readonly MAX_VIEWPORT_DIMS: number;\n readonly MEDIUM_FLOAT: number;\n readonly MEDIUM_INT: number;\n readonly MIRRORED_REPEAT: number;\n readonly NEAREST: number;\n readonly NEAREST_MIPMAP_LINEAR: number;\n readonly NEAREST_MIPMAP_NEAREST: number;\n readonly NEVER: number;\n readonly NICEST: number;\n readonly NONE: number;\n readonly NOTEQUAL: number;\n readonly NO_ERROR: number;\n readonly ONE: number;\n readonly ONE_MINUS_CONSTANT_ALPHA: number;\n readonly ONE_MINUS_CONSTANT_COLOR: number;\n readonly ONE_MINUS_DST_ALPHA: number;\n readonly ONE_MINUS_DST_COLOR: number;\n readonly ONE_MINUS_SRC_ALPHA: number;\n readonly ONE_MINUS_SRC_COLOR: number;\n readonly OUT_OF_MEMORY: number;\n readonly PACK_ALIGNMENT: number;\n readonly POINTS: number;\n readonly POLYGON_OFFSET_FACTOR: number;\n readonly POLYGON_OFFSET_FILL: number;\n readonly POLYGON_OFFSET_UNITS: number;\n readonly RED_BITS: number;\n readonly RENDERBUFFER: number;\n readonly RENDERBUFFER_ALPHA_SIZE: number;\n readonly RENDERBUFFER_BINDING: number;\n readonly RENDERBUFFER_BLUE_SIZE: number;\n readonly RENDERBUFFER_DEPTH_SIZE: number;\n readonly RENDERBUFFER_GREEN_SIZE: number;\n readonly RENDERBUFFER_HEIGHT: number;\n readonly RENDERBUFFER_INTERNAL_FORMAT: number;\n readonly RENDERBUFFER_RED_SIZE: number;\n readonly RENDERBUFFER_STENCIL_SIZE: number;\n readonly RENDERBUFFER_WIDTH: number;\n readonly RENDERER: number;\n readonly REPEAT: number;\n readonly REPLACE: number;\n readonly RGB: number;\n readonly RGB565: number;\n readonly RGB5_A1: number;\n readonly RGBA: number;\n readonly RGBA4: number;\n readonly SAMPLER_2D: number;\n readonly SAMPLER_CUBE: number;\n readonly SAMPLES: number;\n readonly SAMPLE_ALPHA_TO_COVERAGE: number;\n readonly SAMPLE_BUFFERS: number;\n readonly SAMPLE_COVERAGE: number;\n readonly SAMPLE_COVERAGE_INVERT: number;\n readonly SAMPLE_COVERAGE_VALUE: number;\n readonly SCISSOR_BOX: number;\n readonly SCISSOR_TEST: number;\n readonly SHADER_TYPE: number;\n readonly SHADING_LANGUAGE_VERSION: number;\n readonly SHORT: number;\n readonly SRC_ALPHA: number;\n readonly SRC_ALPHA_SATURATE: number;\n readonly SRC_COLOR: number;\n readonly STATIC_DRAW: number;\n readonly STENCIL_ATTACHMENT: number;\n readonly STENCIL_BACK_FAIL: number;\n readonly STENCIL_BACK_FUNC: number;\n readonly STENCIL_BACK_PASS_DEPTH_FAIL: number;\n readonly STENCIL_BACK_PASS_DEPTH_PASS: number;\n readonly STENCIL_BACK_REF: number;\n readonly STENCIL_BACK_VALUE_MASK: number;\n readonly STENCIL_BACK_WRITEMASK: number;\n readonly STENCIL_BITS: number;\n readonly STENCIL_BUFFER_BIT: number;\n readonly STENCIL_CLEAR_VALUE: number;\n readonly STENCIL_FAIL: number;\n readonly STENCIL_FUNC: number;\n readonly STENCIL_INDEX: number;\n readonly STENCIL_INDEX8: number;\n readonly STENCIL_PASS_DEPTH_FAIL: number;\n readonly STENCIL_PASS_DEPTH_PASS: number;\n readonly STENCIL_REF: number;\n readonly STENCIL_TEST: number;\n readonly STENCIL_VALUE_MASK: number;\n readonly STENCIL_WRITEMASK: number;\n readonly STREAM_DRAW: number;\n readonly SUBPIXEL_BITS: number;\n readonly TEXTURE: number;\n readonly TEXTURE0: number;\n readonly TEXTURE1: number;\n readonly TEXTURE10: number;\n readonly TEXTURE11: number;\n readonly TEXTURE12: number;\n readonly TEXTURE13: number;\n readonly TEXTURE14: number;\n readonly TEXTURE15: number;\n readonly TEXTURE16: number;\n readonly TEXTURE17: number;\n readonly TEXTURE18: number;\n readonly TEXTURE19: number;\n readonly TEXTURE2: number;\n readonly TEXTURE20: number;\n readonly TEXTURE21: number;\n readonly TEXTURE22: number;\n readonly TEXTURE23: number;\n readonly TEXTURE24: number;\n readonly TEXTURE25: number;\n readonly TEXTURE26: number;\n readonly TEXTURE27: number;\n readonly TEXTURE28: number;\n readonly TEXTURE29: number;\n readonly TEXTURE3: number;\n readonly TEXTURE30: number;\n readonly TEXTURE31: number;\n readonly TEXTURE4: number;\n readonly TEXTURE5: number;\n readonly TEXTURE6: number;\n readonly TEXTURE7: number;\n readonly TEXTURE8: number;\n readonly TEXTURE9: number;\n readonly TEXTURE_2D: number;\n readonly TEXTURE_BINDING_2D: number;\n readonly TEXTURE_BINDING_CUBE_MAP: number;\n readonly TEXTURE_CUBE_MAP: number;\n readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number;\n readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number;\n readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number;\n readonly TEXTURE_CUBE_MAP_POSITIVE_X: number;\n readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number;\n readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number;\n readonly TEXTURE_MAG_FILTER: number;\n readonly TEXTURE_MIN_FILTER: number;\n readonly TEXTURE_WRAP_S: number;\n readonly TEXTURE_WRAP_T: number;\n readonly TRIANGLES: number;\n readonly TRIANGLE_FAN: number;\n readonly TRIANGLE_STRIP: number;\n readonly UNPACK_ALIGNMENT: number;\n readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number;\n readonly UNPACK_FLIP_Y_WEBGL: number;\n readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number;\n readonly UNSIGNED_BYTE: number;\n readonly UNSIGNED_INT: number;\n readonly UNSIGNED_SHORT: number;\n readonly UNSIGNED_SHORT_4_4_4_4: number;\n readonly UNSIGNED_SHORT_5_5_5_1: number;\n readonly UNSIGNED_SHORT_5_6_5: number;\n readonly VALIDATE_STATUS: number;\n readonly VENDOR: number;\n readonly VERSION: number;\n readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number;\n readonly VERTEX_ATTRIB_ARRAY_ENABLED: number;\n readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number;\n readonly VERTEX_ATTRIB_ARRAY_POINTER: number;\n readonly VERTEX_ATTRIB_ARRAY_SIZE: number;\n readonly VERTEX_ATTRIB_ARRAY_STRIDE: number;\n readonly VERTEX_ATTRIB_ARRAY_TYPE: number;\n readonly VERTEX_SHADER: number;\n readonly VIEWPORT: number;\n readonly ZERO: number;\n}\n\ninterface WebGLShader extends WebGLObject {\n}\n\ndeclare var WebGLShader: {\n prototype: WebGLShader;\n new(): WebGLShader;\n}\n\ninterface WebGLShaderPrecisionFormat {\n readonly precision: number;\n readonly rangeMax: number;\n readonly rangeMin: number;\n}\n\ndeclare var WebGLShaderPrecisionFormat: {\n prototype: WebGLShaderPrecisionFormat;\n new(): WebGLShaderPrecisionFormat;\n}\n\ninterface WebGLTexture extends WebGLObject {\n}\n\ndeclare var WebGLTexture: {\n prototype: WebGLTexture;\n new(): WebGLTexture;\n}\n\ninterface WebGLUniformLocation {\n}\n\ndeclare var WebGLUniformLocation: {\n prototype: WebGLUniformLocation;\n new(): WebGLUniformLocation;\n}\n\ninterface WebKitCSSMatrix {\n a: number;\n b: number;\n c: number;\n d: number;\n e: number;\n f: number;\n m11: number;\n m12: number;\n m13: number;\n m14: number;\n m21: number;\n m22: number;\n m23: number;\n m24: number;\n m31: number;\n m32: number;\n m33: number;\n m34: number;\n m41: number;\n m42: number;\n m43: number;\n m44: number;\n inverse(): WebKitCSSMatrix;\n multiply(secondMatrix: WebKitCSSMatrix): WebKitCSSMatrix;\n rotate(angleX: number, angleY?: number, angleZ?: number): WebKitCSSMatrix;\n rotateAxisAngle(x: number, y: number, z: number, angle: number): WebKitCSSMatrix;\n scale(scaleX: number, scaleY?: number, scaleZ?: number): WebKitCSSMatrix;\n setMatrixValue(value: string): void;\n skewX(angle: number): WebKitCSSMatrix;\n skewY(angle: number): WebKitCSSMatrix;\n toString(): string;\n translate(x: number, y: number, z?: number): WebKitCSSMatrix;\n}\n\ndeclare var WebKitCSSMatrix: {\n prototype: WebKitCSSMatrix;\n new(text?: string): WebKitCSSMatrix;\n}\n\ninterface WebKitPoint {\n x: number;\n y: number;\n}\n\ndeclare var WebKitPoint: {\n prototype: WebKitPoint;\n new(x?: number, y?: number): WebKitPoint;\n}\n\ninterface WebSocketEventMap {\n \"close\": CloseEvent;\n \"error\": ErrorEvent;\n \"message\": MessageEvent;\n \"open\": Event;\n}\n\ninterface WebSocket extends EventTarget {\n binaryType: string;\n readonly bufferedAmount: number;\n readonly extensions: string;\n onclose: (this: WebSocket, ev: CloseEvent) => any;\n onerror: (this: WebSocket, ev: ErrorEvent) => any;\n onmessage: (this: WebSocket, ev: MessageEvent) => any;\n onopen: (this: WebSocket, ev: Event) => any;\n readonly protocol: string;\n readonly readyState: number;\n readonly url: string;\n close(code?: number, reason?: string): void;\n send(data: any): void;\n readonly CLOSED: number;\n readonly CLOSING: number;\n readonly CONNECTING: number;\n readonly OPEN: number;\n addEventListener(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var WebSocket: {\n prototype: WebSocket;\n new(url: string, protocols?: string | string[]): WebSocket;\n readonly CLOSED: number;\n readonly CLOSING: number;\n readonly CONNECTING: number;\n readonly OPEN: number;\n}\n\ninterface WheelEvent extends MouseEvent {\n readonly deltaMode: number;\n readonly deltaX: number;\n readonly deltaY: number;\n readonly deltaZ: number;\n readonly wheelDelta: number;\n readonly wheelDeltaX: number;\n readonly wheelDeltaY: number;\n getCurrentPoint(element: Element): void;\n initWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, deltaXArg: number, deltaYArg: number, deltaZArg: number, deltaMode: number): void;\n readonly DOM_DELTA_LINE: number;\n readonly DOM_DELTA_PAGE: number;\n readonly DOM_DELTA_PIXEL: number;\n}\n\ndeclare var WheelEvent: {\n prototype: WheelEvent;\n new(typeArg: string, eventInitDict?: WheelEventInit): WheelEvent;\n readonly DOM_DELTA_LINE: number;\n readonly DOM_DELTA_PAGE: number;\n readonly DOM_DELTA_PIXEL: number;\n}\n\ninterface WindowEventMap extends GlobalEventHandlersEventMap {\n \"abort\": UIEvent;\n \"afterprint\": Event;\n \"beforeprint\": Event;\n \"beforeunload\": BeforeUnloadEvent;\n \"blur\": FocusEvent;\n \"canplay\": Event;\n \"canplaythrough\": Event;\n \"change\": Event;\n \"click\": MouseEvent;\n \"compassneedscalibration\": Event;\n \"contextmenu\": PointerEvent;\n \"dblclick\": MouseEvent;\n \"devicelight\": DeviceLightEvent;\n \"devicemotion\": DeviceMotionEvent;\n \"deviceorientation\": DeviceOrientationEvent;\n \"drag\": DragEvent;\n \"dragend\": DragEvent;\n \"dragenter\": DragEvent;\n \"dragleave\": DragEvent;\n \"dragover\": DragEvent;\n \"dragstart\": DragEvent;\n \"drop\": DragEvent;\n \"durationchange\": Event;\n \"emptied\": Event;\n \"ended\": MediaStreamErrorEvent;\n \"focus\": FocusEvent;\n \"hashchange\": HashChangeEvent;\n \"input\": Event;\n \"invalid\": Event;\n \"keydown\": KeyboardEvent;\n \"keypress\": KeyboardEvent;\n \"keyup\": KeyboardEvent;\n \"load\": Event;\n \"loadeddata\": Event;\n \"loadedmetadata\": Event;\n \"loadstart\": Event;\n \"message\": MessageEvent;\n \"mousedown\": MouseEvent;\n \"mouseenter\": MouseEvent;\n \"mouseleave\": MouseEvent;\n \"mousemove\": MouseEvent;\n \"mouseout\": MouseEvent;\n \"mouseover\": MouseEvent;\n \"mouseup\": MouseEvent;\n \"mousewheel\": WheelEvent;\n \"MSGestureChange\": MSGestureEvent;\n \"MSGestureDoubleTap\": MSGestureEvent;\n \"MSGestureEnd\": MSGestureEvent;\n \"MSGestureHold\": MSGestureEvent;\n \"MSGestureStart\": MSGestureEvent;\n \"MSGestureTap\": MSGestureEvent;\n \"MSInertiaStart\": MSGestureEvent;\n \"MSPointerCancel\": MSPointerEvent;\n \"MSPointerDown\": MSPointerEvent;\n \"MSPointerEnter\": MSPointerEvent;\n \"MSPointerLeave\": MSPointerEvent;\n \"MSPointerMove\": MSPointerEvent;\n \"MSPointerOut\": MSPointerEvent;\n \"MSPointerOver\": MSPointerEvent;\n \"MSPointerUp\": MSPointerEvent;\n \"offline\": Event;\n \"online\": Event;\n \"orientationchange\": Event;\n \"pagehide\": PageTransitionEvent;\n \"pageshow\": PageTransitionEvent;\n \"pause\": Event;\n \"play\": Event;\n \"playing\": Event;\n \"popstate\": PopStateEvent;\n \"progress\": ProgressEvent;\n \"ratechange\": Event;\n \"readystatechange\": ProgressEvent;\n \"reset\": Event;\n \"resize\": UIEvent;\n \"scroll\": UIEvent;\n \"seeked\": Event;\n \"seeking\": Event;\n \"select\": UIEvent;\n \"stalled\": Event;\n \"storage\": StorageEvent;\n \"submit\": Event;\n \"suspend\": Event;\n \"timeupdate\": Event;\n \"unload\": Event;\n \"volumechange\": Event;\n \"waiting\": Event;\n}\n\ninterface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64 {\n readonly applicationCache: ApplicationCache;\n readonly clientInformation: Navigator;\n readonly closed: boolean;\n readonly crypto: Crypto;\n defaultStatus: string;\n readonly devicePixelRatio: number;\n readonly doNotTrack: string;\n readonly document: Document;\n event: Event | undefined;\n readonly external: External;\n readonly frameElement: Element;\n readonly frames: Window;\n readonly history: History;\n readonly innerHeight: number;\n readonly innerWidth: number;\n readonly length: number;\n readonly location: Location;\n readonly locationbar: BarProp;\n readonly menubar: BarProp;\n readonly msCredentials: MSCredentials;\n name: string;\n readonly navigator: Navigator;\n offscreenBuffering: string | boolean;\n onabort: (this: Window, ev: UIEvent) => any;\n onafterprint: (this: Window, ev: Event) => any;\n onbeforeprint: (this: Window, ev: Event) => any;\n onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any;\n onblur: (this: Window, ev: FocusEvent) => any;\n oncanplay: (this: Window, ev: Event) => any;\n oncanplaythrough: (this: Window, ev: Event) => any;\n onchange: (this: Window, ev: Event) => any;\n onclick: (this: Window, ev: MouseEvent) => any;\n oncompassneedscalibration: (this: Window, ev: Event) => any;\n oncontextmenu: (this: Window, ev: PointerEvent) => any;\n ondblclick: (this: Window, ev: MouseEvent) => any;\n ondevicelight: (this: Window, ev: DeviceLightEvent) => any;\n ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any;\n ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any;\n ondrag: (this: Window, ev: DragEvent) => any;\n ondragend: (this: Window, ev: DragEvent) => any;\n ondragenter: (this: Window, ev: DragEvent) => any;\n ondragleave: (this: Window, ev: DragEvent) => any;\n ondragover: (this: Window, ev: DragEvent) => any;\n ondragstart: (this: Window, ev: DragEvent) => any;\n ondrop: (this: Window, ev: DragEvent) => any;\n ondurationchange: (this: Window, ev: Event) => any;\n onemptied: (this: Window, ev: Event) => any;\n onended: (this: Window, ev: MediaStreamErrorEvent) => any;\n onerror: ErrorEventHandler;\n onfocus: (this: Window, ev: FocusEvent) => any;\n onhashchange: (this: Window, ev: HashChangeEvent) => any;\n oninput: (this: Window, ev: Event) => any;\n oninvalid: (this: Window, ev: Event) => any;\n onkeydown: (this: Window, ev: KeyboardEvent) => any;\n onkeypress: (this: Window, ev: KeyboardEvent) => any;\n onkeyup: (this: Window, ev: KeyboardEvent) => any;\n onload: (this: Window, ev: Event) => any;\n onloadeddata: (this: Window, ev: Event) => any;\n onloadedmetadata: (this: Window, ev: Event) => any;\n onloadstart: (this: Window, ev: Event) => any;\n onmessage: (this: Window, ev: MessageEvent) => any;\n onmousedown: (this: Window, ev: MouseEvent) => any;\n onmouseenter: (this: Window, ev: MouseEvent) => any;\n onmouseleave: (this: Window, ev: MouseEvent) => any;\n onmousemove: (this: Window, ev: MouseEvent) => any;\n onmouseout: (this: Window, ev: MouseEvent) => any;\n onmouseover: (this: Window, ev: MouseEvent) => any;\n onmouseup: (this: Window, ev: MouseEvent) => any;\n onmousewheel: (this: Window, ev: WheelEvent) => any;\n onmsgesturechange: (this: Window, ev: MSGestureEvent) => any;\n onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any;\n onmsgestureend: (this: Window, ev: MSGestureEvent) => any;\n onmsgesturehold: (this: Window, ev: MSGestureEvent) => any;\n onmsgesturestart: (this: Window, ev: MSGestureEvent) => any;\n onmsgesturetap: (this: Window, ev: MSGestureEvent) => any;\n onmsinertiastart: (this: Window, ev: MSGestureEvent) => any;\n onmspointercancel: (this: Window, ev: MSPointerEvent) => any;\n onmspointerdown: (this: Window, ev: MSPointerEvent) => any;\n onmspointerenter: (this: Window, ev: MSPointerEvent) => any;\n onmspointerleave: (this: Window, ev: MSPointerEvent) => any;\n onmspointermove: (this: Window, ev: MSPointerEvent) => any;\n onmspointerout: (this: Window, ev: MSPointerEvent) => any;\n onmspointerover: (this: Window, ev: MSPointerEvent) => any;\n onmspointerup: (this: Window, ev: MSPointerEvent) => any;\n onoffline: (this: Window, ev: Event) => any;\n ononline: (this: Window, ev: Event) => any;\n onorientationchange: (this: Window, ev: Event) => any;\n onpagehide: (this: Window, ev: PageTransitionEvent) => any;\n onpageshow: (this: Window, ev: PageTransitionEvent) => any;\n onpause: (this: Window, ev: Event) => any;\n onplay: (this: Window, ev: Event) => any;\n onplaying: (this: Window, ev: Event) => any;\n onpopstate: (this: Window, ev: PopStateEvent) => any;\n onprogress: (this: Window, ev: ProgressEvent) => any;\n onratechange: (this: Window, ev: Event) => any;\n onreadystatechange: (this: Window, ev: ProgressEvent) => any;\n onreset: (this: Window, ev: Event) => any;\n onresize: (this: Window, ev: UIEvent) => any;\n onscroll: (this: Window, ev: UIEvent) => any;\n onseeked: (this: Window, ev: Event) => any;\n onseeking: (this: Window, ev: Event) => any;\n onselect: (this: Window, ev: UIEvent) => any;\n onstalled: (this: Window, ev: Event) => any;\n onstorage: (this: Window, ev: StorageEvent) => any;\n onsubmit: (this: Window, ev: Event) => any;\n onsuspend: (this: Window, ev: Event) => any;\n ontimeupdate: (this: Window, ev: Event) => any;\n ontouchcancel: (ev: TouchEvent) => any;\n ontouchend: (ev: TouchEvent) => any;\n ontouchmove: (ev: TouchEvent) => any;\n ontouchstart: (ev: TouchEvent) => any;\n onunload: (this: Window, ev: Event) => any;\n onvolumechange: (this: Window, ev: Event) => any;\n onwaiting: (this: Window, ev: Event) => any;\n opener: any;\n orientation: string | number;\n readonly outerHeight: number;\n readonly outerWidth: number;\n readonly pageXOffset: number;\n readonly pageYOffset: number;\n readonly parent: Window;\n readonly performance: Performance;\n readonly personalbar: BarProp;\n readonly screen: Screen;\n readonly screenLeft: number;\n readonly screenTop: number;\n readonly screenX: number;\n readonly screenY: number;\n readonly scrollX: number;\n readonly scrollY: number;\n readonly scrollbars: BarProp;\n readonly self: Window;\n status: string;\n readonly statusbar: BarProp;\n readonly styleMedia: StyleMedia;\n readonly toolbar: BarProp;\n readonly top: Window;\n readonly window: Window;\n URL: typeof URL;\n Blob: typeof Blob;\n alert(message?: any): void;\n blur(): void;\n cancelAnimationFrame(handle: number): void;\n captureEvents(): void;\n close(): void;\n confirm(message?: string): boolean;\n focus(): void;\n getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration;\n getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList;\n getSelection(): Selection;\n matchMedia(mediaQuery: string): MediaQueryList;\n moveBy(x?: number, y?: number): void;\n moveTo(x?: number, y?: number): void;\n msWriteProfilerMark(profilerMarkName: string): void;\n open(url?: string, target?: string, features?: string, replace?: boolean): Window;\n postMessage(message: any, targetOrigin: string, transfer?: any[]): void;\n print(): void;\n prompt(message?: string, _default?: string): string | null;\n releaseEvents(): void;\n requestAnimationFrame(callback: FrameRequestCallback): number;\n resizeBy(x?: number, y?: number): void;\n resizeTo(x?: number, y?: number): void;\n scroll(x?: number, y?: number): void;\n scrollBy(x?: number, y?: number): void;\n scrollTo(x?: number, y?: number): void;\n webkitCancelAnimationFrame(handle: number): void;\n webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint;\n webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint;\n webkitRequestAnimationFrame(callback: FrameRequestCallback): number;\n scroll(options?: ScrollToOptions): void;\n scrollTo(options?: ScrollToOptions): void;\n scrollBy(options?: ScrollToOptions): void;\n addEventListener(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var Window: {\n prototype: Window;\n new(): Window;\n}\n\ninterface WorkerEventMap extends AbstractWorkerEventMap {\n \"message\": MessageEvent;\n}\n\ninterface Worker extends EventTarget, AbstractWorker {\n onmessage: (this: Worker, ev: MessageEvent) => any;\n postMessage(message: any, ports?: any): void;\n terminate(): void;\n addEventListener(type: K, listener: (this: Worker, ev: WorkerEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var Worker: {\n prototype: Worker;\n new(stringUrl: string): Worker;\n}\n\ninterface XMLDocument extends Document {\n addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var XMLDocument: {\n prototype: XMLDocument;\n new(): XMLDocument;\n}\n\ninterface XMLHttpRequestEventMap extends XMLHttpRequestEventTargetEventMap {\n \"readystatechange\": Event;\n}\n\ninterface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {\n onreadystatechange: (this: XMLHttpRequest, ev: Event) => any;\n readonly readyState: number;\n readonly response: any;\n readonly responseText: string;\n responseType: string;\n readonly responseXML: any;\n readonly status: number;\n readonly statusText: string;\n timeout: number;\n readonly upload: XMLHttpRequestUpload;\n withCredentials: boolean;\n msCaching?: string;\n readonly responseURL: string;\n abort(): void;\n getAllResponseHeaders(): string;\n getResponseHeader(header: string): string | null;\n msCachingEnabled(): boolean;\n open(method: string, url: string, async?: boolean, user?: string, password?: string): void;\n overrideMimeType(mime: string): void;\n send(data?: Document): void;\n send(data?: string): void;\n send(data?: any): void;\n setRequestHeader(header: string, value: string): void;\n readonly DONE: number;\n readonly HEADERS_RECEIVED: number;\n readonly LOADING: number;\n readonly OPENED: number;\n readonly UNSENT: number;\n addEventListener(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var XMLHttpRequest: {\n prototype: XMLHttpRequest;\n new(): XMLHttpRequest;\n readonly DONE: number;\n readonly HEADERS_RECEIVED: number;\n readonly LOADING: number;\n readonly OPENED: number;\n readonly UNSENT: number;\n create(): XMLHttpRequest;\n}\n\ninterface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget {\n addEventListener(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ndeclare var XMLHttpRequestUpload: {\n prototype: XMLHttpRequestUpload;\n new(): XMLHttpRequestUpload;\n}\n\ninterface XMLSerializer {\n serializeToString(target: Node): string;\n}\n\ndeclare var XMLSerializer: {\n prototype: XMLSerializer;\n new(): XMLSerializer;\n}\n\ninterface XPathEvaluator {\n createExpression(expression: string, resolver: XPathNSResolver): XPathExpression;\n createNSResolver(nodeResolver?: Node): XPathNSResolver;\n evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | null, type: number, result: XPathResult | null): XPathResult;\n}\n\ndeclare var XPathEvaluator: {\n prototype: XPathEvaluator;\n new(): XPathEvaluator;\n}\n\ninterface XPathExpression {\n evaluate(contextNode: Node, type: number, result: XPathResult | null): XPathResult;\n}\n\ndeclare var XPathExpression: {\n prototype: XPathExpression;\n new(): XPathExpression;\n}\n\ninterface XPathNSResolver {\n lookupNamespaceURI(prefix: string): string;\n}\n\ndeclare var XPathNSResolver: {\n prototype: XPathNSResolver;\n new(): XPathNSResolver;\n}\n\ninterface XPathResult {\n readonly booleanValue: boolean;\n readonly invalidIteratorState: boolean;\n readonly numberValue: number;\n readonly resultType: number;\n readonly singleNodeValue: Node;\n readonly snapshotLength: number;\n readonly stringValue: string;\n iterateNext(): Node;\n snapshotItem(index: number): Node;\n readonly ANY_TYPE: number;\n readonly ANY_UNORDERED_NODE_TYPE: number;\n readonly BOOLEAN_TYPE: number;\n readonly FIRST_ORDERED_NODE_TYPE: number;\n readonly NUMBER_TYPE: number;\n readonly ORDERED_NODE_ITERATOR_TYPE: number;\n readonly ORDERED_NODE_SNAPSHOT_TYPE: number;\n readonly STRING_TYPE: number;\n readonly UNORDERED_NODE_ITERATOR_TYPE: number;\n readonly UNORDERED_NODE_SNAPSHOT_TYPE: number;\n}\n\ndeclare var XPathResult: {\n prototype: XPathResult;\n new(): XPathResult;\n readonly ANY_TYPE: number;\n readonly ANY_UNORDERED_NODE_TYPE: number;\n readonly BOOLEAN_TYPE: number;\n readonly FIRST_ORDERED_NODE_TYPE: number;\n readonly NUMBER_TYPE: number;\n readonly ORDERED_NODE_ITERATOR_TYPE: number;\n readonly ORDERED_NODE_SNAPSHOT_TYPE: number;\n readonly STRING_TYPE: number;\n readonly UNORDERED_NODE_ITERATOR_TYPE: number;\n readonly UNORDERED_NODE_SNAPSHOT_TYPE: number;\n}\n\ninterface XSLTProcessor {\n clearParameters(): void;\n getParameter(namespaceURI: string, localName: string): any;\n importStylesheet(style: Node): void;\n removeParameter(namespaceURI: string, localName: string): void;\n reset(): void;\n setParameter(namespaceURI: string, localName: string, value: any): void;\n transformToDocument(source: Node): Document;\n transformToFragment(source: Node, document: Document): DocumentFragment;\n}\n\ndeclare var XSLTProcessor: {\n prototype: XSLTProcessor;\n new(): XSLTProcessor;\n}\n\ninterface AbstractWorkerEventMap {\n \"error\": ErrorEvent;\n}\n\ninterface AbstractWorker {\n onerror: (this: AbstractWorker, ev: ErrorEvent) => any;\n addEventListener(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ninterface CanvasPathMethods {\n arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;\n arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void;\n bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void;\n closePath(): void;\n ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;\n lineTo(x: number, y: number): void;\n moveTo(x: number, y: number): void;\n quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;\n rect(x: number, y: number, w: number, h: number): void;\n}\n\ninterface ChildNode {\n remove(): void;\n}\n\ninterface DOML2DeprecatedColorProperty {\n color: string;\n}\n\ninterface DOML2DeprecatedSizeProperty {\n size: number;\n}\n\ninterface DocumentEvent {\n createEvent(eventInterface:\"AnimationEvent\"): AnimationEvent;\n createEvent(eventInterface:\"AriaRequestEvent\"): AriaRequestEvent;\n createEvent(eventInterface:\"AudioProcessingEvent\"): AudioProcessingEvent;\n createEvent(eventInterface:\"BeforeUnloadEvent\"): BeforeUnloadEvent;\n createEvent(eventInterface:\"ClipboardEvent\"): ClipboardEvent;\n createEvent(eventInterface:\"CloseEvent\"): CloseEvent;\n createEvent(eventInterface:\"CommandEvent\"): CommandEvent;\n createEvent(eventInterface:\"CompositionEvent\"): CompositionEvent;\n createEvent(eventInterface:\"CustomEvent\"): CustomEvent;\n createEvent(eventInterface:\"DeviceLightEvent\"): DeviceLightEvent;\n createEvent(eventInterface:\"DeviceMotionEvent\"): DeviceMotionEvent;\n createEvent(eventInterface:\"DeviceOrientationEvent\"): DeviceOrientationEvent;\n createEvent(eventInterface:\"DragEvent\"): DragEvent;\n createEvent(eventInterface:\"ErrorEvent\"): ErrorEvent;\n createEvent(eventInterface:\"Event\"): Event;\n createEvent(eventInterface:\"Events\"): Event;\n createEvent(eventInterface:\"FocusEvent\"): FocusEvent;\n createEvent(eventInterface:\"GamepadEvent\"): GamepadEvent;\n createEvent(eventInterface:\"HashChangeEvent\"): HashChangeEvent;\n createEvent(eventInterface:\"IDBVersionChangeEvent\"): IDBVersionChangeEvent;\n createEvent(eventInterface:\"KeyboardEvent\"): KeyboardEvent;\n createEvent(eventInterface:\"ListeningStateChangedEvent\"): ListeningStateChangedEvent;\n createEvent(eventInterface:\"LongRunningScriptDetectedEvent\"): LongRunningScriptDetectedEvent;\n createEvent(eventInterface:\"MSGestureEvent\"): MSGestureEvent;\n createEvent(eventInterface:\"MSManipulationEvent\"): MSManipulationEvent;\n createEvent(eventInterface:\"MSMediaKeyMessageEvent\"): MSMediaKeyMessageEvent;\n createEvent(eventInterface:\"MSMediaKeyNeededEvent\"): MSMediaKeyNeededEvent;\n createEvent(eventInterface:\"MSPointerEvent\"): MSPointerEvent;\n createEvent(eventInterface:\"MSSiteModeEvent\"): MSSiteModeEvent;\n createEvent(eventInterface:\"MediaEncryptedEvent\"): MediaEncryptedEvent;\n createEvent(eventInterface:\"MediaKeyMessageEvent\"): MediaKeyMessageEvent;\n createEvent(eventInterface:\"MediaStreamErrorEvent\"): MediaStreamErrorEvent;\n createEvent(eventInterface:\"MediaStreamTrackEvent\"): MediaStreamTrackEvent;\n createEvent(eventInterface:\"MessageEvent\"): MessageEvent;\n createEvent(eventInterface:\"MouseEvent\"): MouseEvent;\n createEvent(eventInterface:\"MouseEvents\"): MouseEvent;\n createEvent(eventInterface:\"MutationEvent\"): MutationEvent;\n createEvent(eventInterface:\"MutationEvents\"): MutationEvent;\n createEvent(eventInterface:\"NavigationCompletedEvent\"): NavigationCompletedEvent;\n createEvent(eventInterface:\"NavigationEvent\"): NavigationEvent;\n createEvent(eventInterface:\"NavigationEventWithReferrer\"): NavigationEventWithReferrer;\n createEvent(eventInterface:\"OfflineAudioCompletionEvent\"): OfflineAudioCompletionEvent;\n createEvent(eventInterface:\"OverflowEvent\"): OverflowEvent;\n createEvent(eventInterface:\"PageTransitionEvent\"): PageTransitionEvent;\n createEvent(eventInterface:\"PermissionRequestedEvent\"): PermissionRequestedEvent;\n createEvent(eventInterface:\"PointerEvent\"): PointerEvent;\n createEvent(eventInterface:\"PopStateEvent\"): PopStateEvent;\n createEvent(eventInterface:\"ProgressEvent\"): ProgressEvent;\n createEvent(eventInterface:\"RTCDTMFToneChangeEvent\"): RTCDTMFToneChangeEvent;\n createEvent(eventInterface:\"RTCDtlsTransportStateChangedEvent\"): RTCDtlsTransportStateChangedEvent;\n createEvent(eventInterface:\"RTCIceCandidatePairChangedEvent\"): RTCIceCandidatePairChangedEvent;\n createEvent(eventInterface:\"RTCIceGathererEvent\"): RTCIceGathererEvent;\n createEvent(eventInterface:\"RTCIceTransportStateChangedEvent\"): RTCIceTransportStateChangedEvent;\n createEvent(eventInterface:\"RTCSsrcConflictEvent\"): RTCSsrcConflictEvent;\n createEvent(eventInterface:\"SVGZoomEvent\"): SVGZoomEvent;\n createEvent(eventInterface:\"SVGZoomEvents\"): SVGZoomEvent;\n createEvent(eventInterface:\"ScriptNotifyEvent\"): ScriptNotifyEvent;\n createEvent(eventInterface:\"StorageEvent\"): StorageEvent;\n createEvent(eventInterface:\"TextEvent\"): TextEvent;\n createEvent(eventInterface:\"TouchEvent\"): TouchEvent;\n createEvent(eventInterface:\"TrackEvent\"): TrackEvent;\n createEvent(eventInterface:\"TransitionEvent\"): TransitionEvent;\n createEvent(eventInterface:\"UIEvent\"): UIEvent;\n createEvent(eventInterface:\"UIEvents\"): UIEvent;\n createEvent(eventInterface:\"UnviewableContentIdentifiedEvent\"): UnviewableContentIdentifiedEvent;\n createEvent(eventInterface:\"WebGLContextEvent\"): WebGLContextEvent;\n createEvent(eventInterface:\"WheelEvent\"): WheelEvent;\n createEvent(eventInterface: string): Event;\n}\n\ninterface ElementTraversal {\n readonly childElementCount: number;\n readonly firstElementChild: Element;\n readonly lastElementChild: Element;\n readonly nextElementSibling: Element;\n readonly previousElementSibling: Element;\n}\n\ninterface GetSVGDocument {\n getSVGDocument(): Document;\n}\n\ninterface GlobalEventHandlersEventMap {\n \"pointercancel\": PointerEvent;\n \"pointerdown\": PointerEvent;\n \"pointerenter\": PointerEvent;\n \"pointerleave\": PointerEvent;\n \"pointermove\": PointerEvent;\n \"pointerout\": PointerEvent;\n \"pointerover\": PointerEvent;\n \"pointerup\": PointerEvent;\n \"wheel\": WheelEvent;\n}\n\ninterface GlobalEventHandlers {\n onpointercancel: (this: GlobalEventHandlers, ev: PointerEvent) => any;\n onpointerdown: (this: GlobalEventHandlers, ev: PointerEvent) => any;\n onpointerenter: (this: GlobalEventHandlers, ev: PointerEvent) => any;\n onpointerleave: (this: GlobalEventHandlers, ev: PointerEvent) => any;\n onpointermove: (this: GlobalEventHandlers, ev: PointerEvent) => any;\n onpointerout: (this: GlobalEventHandlers, ev: PointerEvent) => any;\n onpointerover: (this: GlobalEventHandlers, ev: PointerEvent) => any;\n onpointerup: (this: GlobalEventHandlers, ev: PointerEvent) => any;\n onwheel: (this: GlobalEventHandlers, ev: WheelEvent) => any;\n addEventListener(type: K, listener: (this: GlobalEventHandlers, ev: GlobalEventHandlersEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ninterface HTMLTableAlignment {\n /**\n * Sets or retrieves a value that you can use to implement your own ch functionality for the object.\n */\n ch: string;\n /**\n * Sets or retrieves a value that you can use to implement your own chOff functionality for the object.\n */\n chOff: string;\n /**\n * Sets or retrieves how text and other content are vertically aligned within the object that contains them.\n */\n vAlign: string;\n}\n\ninterface IDBEnvironment {\n readonly indexedDB: IDBFactory;\n}\n\ninterface LinkStyle {\n readonly sheet: StyleSheet;\n}\n\ninterface MSBaseReaderEventMap {\n \"abort\": Event;\n \"error\": ErrorEvent;\n \"load\": Event;\n \"loadend\": ProgressEvent;\n \"loadstart\": Event;\n \"progress\": ProgressEvent;\n}\n\ninterface MSBaseReader {\n onabort: (this: MSBaseReader, ev: Event) => any;\n onerror: (this: MSBaseReader, ev: ErrorEvent) => any;\n onload: (this: MSBaseReader, ev: Event) => any;\n onloadend: (this: MSBaseReader, ev: ProgressEvent) => any;\n onloadstart: (this: MSBaseReader, ev: Event) => any;\n onprogress: (this: MSBaseReader, ev: ProgressEvent) => any;\n readonly readyState: number;\n readonly result: any;\n abort(): void;\n readonly DONE: number;\n readonly EMPTY: number;\n readonly LOADING: number;\n addEventListener(type: K, listener: (this: MSBaseReader, ev: MSBaseReaderEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ninterface MSFileSaver {\n msSaveBlob(blob: any, defaultName?: string): boolean;\n msSaveOrOpenBlob(blob: any, defaultName?: string): boolean;\n}\n\ninterface MSNavigatorDoNotTrack {\n confirmSiteSpecificTrackingException(args: ConfirmSiteSpecificExceptionsInformation): boolean;\n confirmWebWideTrackingException(args: ExceptionInformation): boolean;\n removeSiteSpecificTrackingException(args: ExceptionInformation): void;\n removeWebWideTrackingException(args: ExceptionInformation): void;\n storeSiteSpecificTrackingException(args: StoreSiteSpecificExceptionsInformation): void;\n storeWebWideTrackingException(args: StoreExceptionsInformation): void;\n}\n\ninterface NavigatorContentUtils {\n}\n\ninterface NavigatorGeolocation {\n readonly geolocation: Geolocation;\n}\n\ninterface NavigatorID {\n readonly appName: string;\n readonly appVersion: string;\n readonly platform: string;\n readonly product: string;\n readonly productSub: string;\n readonly userAgent: string;\n readonly vendor: string;\n readonly vendorSub: string;\n}\n\ninterface NavigatorOnLine {\n readonly onLine: boolean;\n}\n\ninterface NavigatorStorageUtils {\n}\n\ninterface NavigatorUserMedia {\n readonly mediaDevices: MediaDevices;\n getUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void;\n}\n\ninterface NodeSelector {\n querySelector(selectors: K): ElementTagNameMap[K] | null;\n querySelector(selectors: string): Element | null;\n querySelectorAll(selectors: K): ElementListTagNameMap[K];\n querySelectorAll(selectors: string): NodeListOf;\n}\n\ninterface RandomSource {\n getRandomValues(array: ArrayBufferView): ArrayBufferView;\n}\n\ninterface SVGAnimatedPathData {\n readonly pathSegList: SVGPathSegList;\n}\n\ninterface SVGAnimatedPoints {\n readonly animatedPoints: SVGPointList;\n readonly points: SVGPointList;\n}\n\ninterface SVGExternalResourcesRequired {\n readonly externalResourcesRequired: SVGAnimatedBoolean;\n}\n\ninterface SVGFilterPrimitiveStandardAttributes extends SVGStylable {\n readonly height: SVGAnimatedLength;\n readonly result: SVGAnimatedString;\n readonly width: SVGAnimatedLength;\n readonly x: SVGAnimatedLength;\n readonly y: SVGAnimatedLength;\n}\n\ninterface SVGFitToViewBox {\n readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio;\n readonly viewBox: SVGAnimatedRect;\n}\n\ninterface SVGLangSpace {\n xmllang: string;\n xmlspace: string;\n}\n\ninterface SVGLocatable {\n readonly farthestViewportElement: SVGElement;\n readonly nearestViewportElement: SVGElement;\n getBBox(): SVGRect;\n getCTM(): SVGMatrix;\n getScreenCTM(): SVGMatrix;\n getTransformToElement(element: SVGElement): SVGMatrix;\n}\n\ninterface SVGStylable {\n className: any;\n readonly style: CSSStyleDeclaration;\n}\n\ninterface SVGTests {\n readonly requiredExtensions: SVGStringList;\n readonly requiredFeatures: SVGStringList;\n readonly systemLanguage: SVGStringList;\n hasExtension(extension: string): boolean;\n}\n\ninterface SVGTransformable extends SVGLocatable {\n readonly transform: SVGAnimatedTransformList;\n}\n\ninterface SVGURIReference {\n readonly href: SVGAnimatedString;\n}\n\ninterface WindowBase64 {\n atob(encodedString: string): string;\n btoa(rawString: string): string;\n}\n\ninterface WindowConsole {\n readonly console: Console;\n}\n\ninterface WindowLocalStorage {\n readonly localStorage: Storage;\n}\n\ninterface WindowSessionStorage {\n readonly sessionStorage: Storage;\n}\n\ninterface WindowTimers extends Object, WindowTimersExtension {\n clearInterval(handle: number): void;\n clearTimeout(handle: number): void;\n setInterval(handler: (...args: any[]) => void, timeout: number): number;\n setInterval(handler: any, timeout?: any, ...args: any[]): number;\n setTimeout(handler: (...args: any[]) => void, timeout: number): number;\n setTimeout(handler: any, timeout?: any, ...args: any[]): number;\n}\n\ninterface WindowTimersExtension {\n clearImmediate(handle: number): void;\n setImmediate(handler: (...args: any[]) => void): number;\n setImmediate(handler: any, ...args: any[]): number;\n}\n\ninterface XMLHttpRequestEventTargetEventMap {\n \"abort\": Event;\n \"error\": ErrorEvent;\n \"load\": Event;\n \"loadend\": ProgressEvent;\n \"loadstart\": Event;\n \"progress\": ProgressEvent;\n \"timeout\": ProgressEvent;\n}\n\ninterface XMLHttpRequestEventTarget {\n onabort: (this: XMLHttpRequestEventTarget, ev: Event) => any;\n onerror: (this: XMLHttpRequestEventTarget, ev: ErrorEvent) => any;\n onload: (this: XMLHttpRequestEventTarget, ev: Event) => any;\n onloadend: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any;\n onloadstart: (this: XMLHttpRequestEventTarget, ev: Event) => any;\n onprogress: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any;\n ontimeout: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any;\n addEventListener(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void;\n addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\n}\n\ninterface StorageEventInit extends EventInit {\n key?: string;\n oldValue?: string;\n newValue?: string;\n url: string;\n storageArea?: Storage;\n}\n\ninterface Canvas2DContextAttributes {\n alpha?: boolean;\n willReadFrequently?: boolean;\n storage?: boolean;\n [attribute: string]: boolean | string | undefined;\n}\n\ninterface NodeListOf extends NodeList {\n length: number;\n item(index: number): TNode;\n [index: number]: TNode;\n}\n\ninterface HTMLCollectionOf extends HTMLCollection {\n item(index: number): T;\n namedItem(name: string): T;\n [index: number]: T;\n}\n\ninterface BlobPropertyBag {\n type?: string;\n endings?: string;\n}\n\ninterface FilePropertyBag {\n type?: string;\n lastModified?: number;\n}\n\ninterface EventListenerObject {\n handleEvent(evt: Event): void;\n}\n\ninterface MessageEventInit extends EventInit {\n data?: any;\n origin?: string;\n lastEventId?: string;\n channel?: string;\n source?: any;\n ports?: MessagePort[];\n}\n\ninterface ProgressEventInit extends EventInit {\n lengthComputable?: boolean;\n loaded?: number;\n total?: number;\n}\n\ninterface ScrollOptions {\n behavior?: ScrollBehavior;\n}\n\ninterface ScrollToOptions extends ScrollOptions {\n left?: number;\n top?: number;\n}\n\ninterface ScrollIntoViewOptions extends ScrollOptions {\n block?: ScrollLogicalPosition;\n inline?: ScrollLogicalPosition;\n}\n\ninterface ClipboardEventInit extends EventInit {\n data?: string;\n dataType?: string;\n}\n\ninterface IDBArrayKey extends Array {\n}\n\ninterface RsaKeyGenParams extends Algorithm {\n modulusLength: number;\n publicExponent: Uint8Array;\n}\n\ninterface RsaHashedKeyGenParams extends RsaKeyGenParams {\n hash: AlgorithmIdentifier;\n}\n\ninterface RsaKeyAlgorithm extends KeyAlgorithm {\n modulusLength: number;\n publicExponent: Uint8Array;\n}\n\ninterface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm {\n hash: AlgorithmIdentifier;\n}\n\ninterface RsaHashedImportParams {\n hash: AlgorithmIdentifier;\n}\n\ninterface RsaPssParams {\n saltLength: number;\n}\n\ninterface RsaOaepParams extends Algorithm {\n label?: BufferSource;\n}\n\ninterface EcdsaParams extends Algorithm {\n hash: AlgorithmIdentifier;\n}\n\ninterface EcKeyGenParams extends Algorithm {\n namedCurve: string;\n}\n\ninterface EcKeyAlgorithm extends KeyAlgorithm {\n typedCurve: string;\n}\n\ninterface EcKeyImportParams {\n namedCurve: string;\n}\n\ninterface EcdhKeyDeriveParams extends Algorithm {\n public: CryptoKey;\n}\n\ninterface AesCtrParams extends Algorithm {\n counter: BufferSource;\n length: number;\n}\n\ninterface AesKeyAlgorithm extends KeyAlgorithm {\n length: number;\n}\n\ninterface AesKeyGenParams extends Algorithm {\n length: number;\n}\n\ninterface AesDerivedKeyParams extends Algorithm {\n length: number;\n}\n\ninterface AesCbcParams extends Algorithm {\n iv: BufferSource;\n}\n\ninterface AesCmacParams extends Algorithm {\n length: number;\n}\n\ninterface AesGcmParams extends Algorithm {\n iv: BufferSource;\n additionalData?: BufferSource;\n tagLength?: number;\n}\n\ninterface AesCfbParams extends Algorithm {\n iv: BufferSource;\n}\n\ninterface HmacImportParams extends Algorithm {\n hash?: AlgorithmIdentifier;\n length?: number;\n}\n\ninterface HmacKeyAlgorithm extends KeyAlgorithm {\n hash: AlgorithmIdentifier;\n length: number;\n}\n\ninterface HmacKeyGenParams extends Algorithm {\n hash: AlgorithmIdentifier;\n length?: number;\n}\n\ninterface DhKeyGenParams extends Algorithm {\n prime: Uint8Array;\n generator: Uint8Array;\n}\n\ninterface DhKeyAlgorithm extends KeyAlgorithm {\n prime: Uint8Array;\n generator: Uint8Array;\n}\n\ninterface DhKeyDeriveParams extends Algorithm {\n public: CryptoKey;\n}\n\ninterface DhImportKeyParams extends Algorithm {\n prime: Uint8Array;\n generator: Uint8Array;\n}\n\ninterface ConcatParams extends Algorithm {\n hash?: AlgorithmIdentifier;\n algorithmId: Uint8Array;\n partyUInfo: Uint8Array;\n partyVInfo: Uint8Array;\n publicInfo?: Uint8Array;\n privateInfo?: Uint8Array;\n}\n\ninterface HkdfCtrParams extends Algorithm {\n hash: AlgorithmIdentifier;\n label: BufferSource;\n context: BufferSource;\n}\n\ninterface Pbkdf2Params extends Algorithm {\n salt: BufferSource;\n iterations: number;\n hash: AlgorithmIdentifier;\n}\n\ninterface RsaOtherPrimesInfo {\n r: string;\n d: string;\n t: string;\n}\n\ninterface JsonWebKey {\n kty: string;\n use?: string;\n key_ops?: string[];\n alg?: string;\n kid?: string;\n x5u?: string;\n x5c?: string;\n x5t?: string;\n ext?: boolean;\n crv?: string;\n x?: string;\n y?: string;\n d?: string;\n n?: string;\n e?: string;\n p?: string;\n q?: string;\n dp?: string;\n dq?: string;\n qi?: string;\n oth?: RsaOtherPrimesInfo[];\n k?: string;\n}\n\ninterface ParentNode {\n readonly children: HTMLCollection;\n readonly firstElementChild: Element;\n readonly lastElementChild: Element;\n readonly childElementCount: number;\n}\n\ninterface DocumentOrShadowRoot {\n readonly activeElement: Element | null;\n readonly stylesheets: StyleSheetList;\n getSelection(): Selection | null;\n elementFromPoint(x: number, y: number): Element | null;\n elementsFromPoint(x: number, y: number): Element[];\n}\n\ninterface ShadowRoot extends DocumentOrShadowRoot, DocumentFragment {\n readonly host: Element;\n innerHTML: string;\n}\n\ninterface ShadowRootInit {\n mode: 'open'|'closed';\n delegatesFocus?: boolean;\n}\n\ninterface HTMLSlotElement extends HTMLElement {\n name: string;\n assignedNodes(options?: AssignedNodesOptions): Node[];\n}\n\ninterface AssignedNodesOptions {\n flatten?: boolean;\n}\n\ndeclare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;\n\ninterface ErrorEventHandler {\n (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void;\n}\ninterface PositionCallback {\n (position: Position): void;\n}\ninterface PositionErrorCallback {\n (error: PositionError): void;\n}\ninterface MediaQueryListListener {\n (mql: MediaQueryList): void;\n}\ninterface MSLaunchUriCallback {\n (): void;\n}\ninterface FrameRequestCallback {\n (time: number): void;\n}\ninterface MSUnsafeFunctionCallback {\n (): any;\n}\ninterface MSExecAtPriorityFunctionCallback {\n (...args: any[]): any;\n}\ninterface MutationCallback {\n (mutations: MutationRecord[], observer: MutationObserver): void;\n}\ninterface DecodeSuccessCallback {\n (decodedData: AudioBuffer): void;\n}\ninterface DecodeErrorCallback {\n (error: DOMException): void;\n}\ninterface FunctionStringCallback {\n (data: string): void;\n}\ninterface NavigatorUserMediaSuccessCallback {\n (stream: MediaStream): void;\n}\ninterface NavigatorUserMediaErrorCallback {\n (error: MediaStreamError): void;\n}\ninterface ForEachCallback {\n (keyId: any, status: string): void;\n}\ninterface HTMLElementTagNameMap {\n \"a\": HTMLAnchorElement;\n \"applet\": HTMLAppletElement;\n \"area\": HTMLAreaElement;\n \"audio\": HTMLAudioElement;\n \"base\": HTMLBaseElement;\n \"basefont\": HTMLBaseFontElement;\n \"blockquote\": HTMLQuoteElement;\n \"body\": HTMLBodyElement;\n \"br\": HTMLBRElement;\n \"button\": HTMLButtonElement;\n \"canvas\": HTMLCanvasElement;\n \"caption\": HTMLTableCaptionElement;\n \"col\": HTMLTableColElement;\n \"colgroup\": HTMLTableColElement;\n \"datalist\": HTMLDataListElement;\n \"del\": HTMLModElement;\n \"dir\": HTMLDirectoryElement;\n \"div\": HTMLDivElement;\n \"dl\": HTMLDListElement;\n \"embed\": HTMLEmbedElement;\n \"fieldset\": HTMLFieldSetElement;\n \"font\": HTMLFontElement;\n \"form\": HTMLFormElement;\n \"frame\": HTMLFrameElement;\n \"frameset\": HTMLFrameSetElement;\n \"h1\": HTMLHeadingElement;\n \"h2\": HTMLHeadingElement;\n \"h3\": HTMLHeadingElement;\n \"h4\": HTMLHeadingElement;\n \"h5\": HTMLHeadingElement;\n \"h6\": HTMLHeadingElement;\n \"head\": HTMLHeadElement;\n \"hr\": HTMLHRElement;\n \"html\": HTMLHtmlElement;\n \"iframe\": HTMLIFrameElement;\n \"img\": HTMLImageElement;\n \"input\": HTMLInputElement;\n \"ins\": HTMLModElement;\n \"isindex\": HTMLUnknownElement;\n \"label\": HTMLLabelElement;\n \"legend\": HTMLLegendElement;\n \"li\": HTMLLIElement;\n \"link\": HTMLLinkElement;\n \"listing\": HTMLPreElement;\n \"map\": HTMLMapElement;\n \"marquee\": HTMLMarqueeElement;\n \"menu\": HTMLMenuElement;\n \"meta\": HTMLMetaElement;\n \"meter\": HTMLMeterElement;\n \"nextid\": HTMLUnknownElement;\n \"object\": HTMLObjectElement;\n \"ol\": HTMLOListElement;\n \"optgroup\": HTMLOptGroupElement;\n \"option\": HTMLOptionElement;\n \"p\": HTMLParagraphElement;\n \"param\": HTMLParamElement;\n \"picture\": HTMLPictureElement;\n \"pre\": HTMLPreElement;\n \"progress\": HTMLProgressElement;\n \"q\": HTMLQuoteElement;\n \"script\": HTMLScriptElement;\n \"select\": HTMLSelectElement;\n \"source\": HTMLSourceElement;\n \"span\": HTMLSpanElement;\n \"style\": HTMLStyleElement;\n \"table\": HTMLTableElement;\n \"tbody\": HTMLTableSectionElement;\n \"td\": HTMLTableDataCellElement;\n \"template\": HTMLTemplateElement;\n \"textarea\": HTMLTextAreaElement;\n \"tfoot\": HTMLTableSectionElement;\n \"th\": HTMLTableHeaderCellElement;\n \"thead\": HTMLTableSectionElement;\n \"title\": HTMLTitleElement;\n \"tr\": HTMLTableRowElement;\n \"track\": HTMLTrackElement;\n \"ul\": HTMLUListElement;\n \"video\": HTMLVideoElement;\n \"x-ms-webview\": MSHTMLWebViewElement;\n \"xmp\": HTMLPreElement;\n}\n\ninterface ElementTagNameMap {\n \"a\": HTMLAnchorElement;\n \"abbr\": HTMLElement;\n \"acronym\": HTMLElement;\n \"address\": HTMLElement;\n \"applet\": HTMLAppletElement;\n \"area\": HTMLAreaElement;\n \"article\": HTMLElement;\n \"aside\": HTMLElement;\n \"audio\": HTMLAudioElement;\n \"b\": HTMLElement;\n \"base\": HTMLBaseElement;\n \"basefont\": HTMLBaseFontElement;\n \"bdo\": HTMLElement;\n \"big\": HTMLElement;\n \"blockquote\": HTMLQuoteElement;\n \"body\": HTMLBodyElement;\n \"br\": HTMLBRElement;\n \"button\": HTMLButtonElement;\n \"canvas\": HTMLCanvasElement;\n \"caption\": HTMLTableCaptionElement;\n \"center\": HTMLElement;\n \"circle\": SVGCircleElement;\n \"cite\": HTMLElement;\n \"clippath\": SVGClipPathElement;\n \"code\": HTMLElement;\n \"col\": HTMLTableColElement;\n \"colgroup\": HTMLTableColElement;\n \"datalist\": HTMLDataListElement;\n \"dd\": HTMLElement;\n \"defs\": SVGDefsElement;\n \"del\": HTMLModElement;\n \"desc\": SVGDescElement;\n \"dfn\": HTMLElement;\n \"dir\": HTMLDirectoryElement;\n \"div\": HTMLDivElement;\n \"dl\": HTMLDListElement;\n \"dt\": HTMLElement;\n \"ellipse\": SVGEllipseElement;\n \"em\": HTMLElement;\n \"embed\": HTMLEmbedElement;\n \"feblend\": SVGFEBlendElement;\n \"fecolormatrix\": SVGFEColorMatrixElement;\n \"fecomponenttransfer\": SVGFEComponentTransferElement;\n \"fecomposite\": SVGFECompositeElement;\n \"feconvolvematrix\": SVGFEConvolveMatrixElement;\n \"fediffuselighting\": SVGFEDiffuseLightingElement;\n \"fedisplacementmap\": SVGFEDisplacementMapElement;\n \"fedistantlight\": SVGFEDistantLightElement;\n \"feflood\": SVGFEFloodElement;\n \"fefunca\": SVGFEFuncAElement;\n \"fefuncb\": SVGFEFuncBElement;\n \"fefuncg\": SVGFEFuncGElement;\n \"fefuncr\": SVGFEFuncRElement;\n \"fegaussianblur\": SVGFEGaussianBlurElement;\n \"feimage\": SVGFEImageElement;\n \"femerge\": SVGFEMergeElement;\n \"femergenode\": SVGFEMergeNodeElement;\n \"femorphology\": SVGFEMorphologyElement;\n \"feoffset\": SVGFEOffsetElement;\n \"fepointlight\": SVGFEPointLightElement;\n \"fespecularlighting\": SVGFESpecularLightingElement;\n \"fespotlight\": SVGFESpotLightElement;\n \"fetile\": SVGFETileElement;\n \"feturbulence\": SVGFETurbulenceElement;\n \"fieldset\": HTMLFieldSetElement;\n \"figcaption\": HTMLElement;\n \"figure\": HTMLElement;\n \"filter\": SVGFilterElement;\n \"font\": HTMLFontElement;\n \"footer\": HTMLElement;\n \"foreignobject\": SVGForeignObjectElement;\n \"form\": HTMLFormElement;\n \"frame\": HTMLFrameElement;\n \"frameset\": HTMLFrameSetElement;\n \"g\": SVGGElement;\n \"h1\": HTMLHeadingElement;\n \"h2\": HTMLHeadingElement;\n \"h3\": HTMLHeadingElement;\n \"h4\": HTMLHeadingElement;\n \"h5\": HTMLHeadingElement;\n \"h6\": HTMLHeadingElement;\n \"head\": HTMLHeadElement;\n \"header\": HTMLElement;\n \"hgroup\": HTMLElement;\n \"hr\": HTMLHRElement;\n \"html\": HTMLHtmlElement;\n \"i\": HTMLElement;\n \"iframe\": HTMLIFrameElement;\n \"image\": SVGImageElement;\n \"img\": HTMLImageElement;\n \"input\": HTMLInputElement;\n \"ins\": HTMLModElement;\n \"isindex\": HTMLUnknownElement;\n \"kbd\": HTMLElement;\n \"keygen\": HTMLElement;\n \"label\": HTMLLabelElement;\n \"legend\": HTMLLegendElement;\n \"li\": HTMLLIElement;\n \"line\": SVGLineElement;\n \"lineargradient\": SVGLinearGradientElement;\n \"link\": HTMLLinkElement;\n \"listing\": HTMLPreElement;\n \"map\": HTMLMapElement;\n \"mark\": HTMLElement;\n \"marker\": SVGMarkerElement;\n \"marquee\": HTMLMarqueeElement;\n \"mask\": SVGMaskElement;\n \"menu\": HTMLMenuElement;\n \"meta\": HTMLMetaElement;\n \"metadata\": SVGMetadataElement;\n \"meter\": HTMLMeterElement;\n \"nav\": HTMLElement;\n \"nextid\": HTMLUnknownElement;\n \"nobr\": HTMLElement;\n \"noframes\": HTMLElement;\n \"noscript\": HTMLElement;\n \"object\": HTMLObjectElement;\n \"ol\": HTMLOListElement;\n \"optgroup\": HTMLOptGroupElement;\n \"option\": HTMLOptionElement;\n \"p\": HTMLParagraphElement;\n \"param\": HTMLParamElement;\n \"path\": SVGPathElement;\n \"pattern\": SVGPatternElement;\n \"picture\": HTMLPictureElement;\n \"plaintext\": HTMLElement;\n \"polygon\": SVGPolygonElement;\n \"polyline\": SVGPolylineElement;\n \"pre\": HTMLPreElement;\n \"progress\": HTMLProgressElement;\n \"q\": HTMLQuoteElement;\n \"radialgradient\": SVGRadialGradientElement;\n \"rect\": SVGRectElement;\n \"rt\": HTMLElement;\n \"ruby\": HTMLElement;\n \"s\": HTMLElement;\n \"samp\": HTMLElement;\n \"script\": HTMLScriptElement;\n \"section\": HTMLElement;\n \"select\": HTMLSelectElement;\n \"small\": HTMLElement;\n \"source\": HTMLSourceElement;\n \"span\": HTMLSpanElement;\n \"stop\": SVGStopElement;\n \"strike\": HTMLElement;\n \"strong\": HTMLElement;\n \"style\": HTMLStyleElement;\n \"sub\": HTMLElement;\n \"sup\": HTMLElement;\n \"svg\": SVGSVGElement;\n \"switch\": SVGSwitchElement;\n \"symbol\": SVGSymbolElement;\n \"table\": HTMLTableElement;\n \"tbody\": HTMLTableSectionElement;\n \"td\": HTMLTableDataCellElement;\n \"template\": HTMLTemplateElement;\n \"text\": SVGTextElement;\n \"textpath\": SVGTextPathElement;\n \"textarea\": HTMLTextAreaElement;\n \"tfoot\": HTMLTableSectionElement;\n \"th\": HTMLTableHeaderCellElement;\n \"thead\": HTMLTableSectionElement;\n \"title\": HTMLTitleElement;\n \"tr\": HTMLTableRowElement;\n \"track\": HTMLTrackElement;\n \"tspan\": SVGTSpanElement;\n \"tt\": HTMLElement;\n \"u\": HTMLElement;\n \"ul\": HTMLUListElement;\n \"use\": SVGUseElement;\n \"var\": HTMLElement;\n \"video\": HTMLVideoElement;\n \"view\": SVGViewElement;\n \"wbr\": HTMLElement;\n \"x-ms-webview\": MSHTMLWebViewElement;\n \"xmp\": HTMLPreElement;\n}\n\ninterface ElementListTagNameMap {\n \"a\": NodeListOf;\n \"abbr\": NodeListOf;\n \"acronym\": NodeListOf;\n \"address\": NodeListOf;\n \"applet\": NodeListOf;\n \"area\": NodeListOf;\n \"article\": NodeListOf;\n \"aside\": NodeListOf;\n \"audio\": NodeListOf;\n \"b\": NodeListOf;\n \"base\": NodeListOf;\n \"basefont\": NodeListOf;\n \"bdo\": NodeListOf;\n \"big\": NodeListOf;\n \"blockquote\": NodeListOf;\n \"body\": NodeListOf;\n \"br\": NodeListOf;\n \"button\": NodeListOf;\n \"canvas\": NodeListOf;\n \"caption\": NodeListOf;\n \"center\": NodeListOf;\n \"circle\": NodeListOf;\n \"cite\": NodeListOf;\n \"clippath\": NodeListOf;\n \"code\": NodeListOf;\n \"col\": NodeListOf;\n \"colgroup\": NodeListOf;\n \"datalist\": NodeListOf;\n \"dd\": NodeListOf;\n \"defs\": NodeListOf;\n \"del\": NodeListOf;\n \"desc\": NodeListOf;\n \"dfn\": NodeListOf;\n \"dir\": NodeListOf;\n \"div\": NodeListOf;\n \"dl\": NodeListOf;\n \"dt\": NodeListOf;\n \"ellipse\": NodeListOf;\n \"em\": NodeListOf;\n \"embed\": NodeListOf;\n \"feblend\": NodeListOf;\n \"fecolormatrix\": NodeListOf;\n \"fecomponenttransfer\": NodeListOf;\n \"fecomposite\": NodeListOf;\n \"feconvolvematrix\": NodeListOf;\n \"fediffuselighting\": NodeListOf;\n \"fedisplacementmap\": NodeListOf;\n \"fedistantlight\": NodeListOf;\n \"feflood\": NodeListOf;\n \"fefunca\": NodeListOf;\n \"fefuncb\": NodeListOf;\n \"fefuncg\": NodeListOf;\n \"fefuncr\": NodeListOf;\n \"fegaussianblur\": NodeListOf;\n \"feimage\": NodeListOf;\n \"femerge\": NodeListOf;\n \"femergenode\": NodeListOf;\n \"femorphology\": NodeListOf;\n \"feoffset\": NodeListOf;\n \"fepointlight\": NodeListOf;\n \"fespecularlighting\": NodeListOf;\n \"fespotlight\": NodeListOf;\n \"fetile\": NodeListOf;\n \"feturbulence\": NodeListOf;\n \"fieldset\": NodeListOf;\n \"figcaption\": NodeListOf;\n \"figure\": NodeListOf;\n \"filter\": NodeListOf;\n \"font\": NodeListOf;\n \"footer\": NodeListOf;\n \"foreignobject\": NodeListOf;\n \"form\": NodeListOf;\n \"frame\": NodeListOf;\n \"frameset\": NodeListOf;\n \"g\": NodeListOf;\n \"h1\": NodeListOf;\n \"h2\": NodeListOf;\n \"h3\": NodeListOf;\n \"h4\": NodeListOf;\n \"h5\": NodeListOf;\n \"h6\": NodeListOf;\n \"head\": NodeListOf;\n \"header\": NodeListOf;\n \"hgroup\": NodeListOf;\n \"hr\": NodeListOf;\n \"html\": NodeListOf;\n \"i\": NodeListOf;\n \"iframe\": NodeListOf;\n \"image\": NodeListOf;\n \"img\": NodeListOf;\n \"input\": NodeListOf;\n \"ins\": NodeListOf;\n \"isindex\": NodeListOf;\n \"kbd\": NodeListOf;\n \"keygen\": NodeListOf;\n \"label\": NodeListOf;\n \"legend\": NodeListOf;\n \"li\": NodeListOf;\n \"line\": NodeListOf;\n \"lineargradient\": NodeListOf;\n \"link\": NodeListOf;\n \"listing\": NodeListOf;\n \"map\": NodeListOf;\n \"mark\": NodeListOf;\n \"marker\": NodeListOf;\n \"marquee\": NodeListOf;\n \"mask\": NodeListOf;\n \"menu\": NodeListOf;\n \"meta\": NodeListOf;\n \"metadata\": NodeListOf;\n \"meter\": NodeListOf;\n \"nav\": NodeListOf;\n \"nextid\": NodeListOf;\n \"nobr\": NodeListOf;\n \"noframes\": NodeListOf;\n \"noscript\": NodeListOf;\n \"object\": NodeListOf;\n \"ol\": NodeListOf;\n \"optgroup\": NodeListOf;\n \"option\": NodeListOf;\n \"p\": NodeListOf;\n \"param\": NodeListOf;\n \"path\": NodeListOf;\n \"pattern\": NodeListOf;\n \"picture\": NodeListOf;\n \"plaintext\": NodeListOf;\n \"polygon\": NodeListOf;\n \"polyline\": NodeListOf;\n \"pre\": NodeListOf;\n \"progress\": NodeListOf;\n \"q\": NodeListOf;\n \"radialgradient\": NodeListOf;\n \"rect\": NodeListOf;\n \"rt\": NodeListOf;\n \"ruby\": NodeListOf;\n \"s\": NodeListOf;\n \"samp\": NodeListOf;\n \"script\": NodeListOf;\n \"section\": NodeListOf;\n \"select\": NodeListOf;\n \"small\": NodeListOf;\n \"source\": NodeListOf;\n \"span\": NodeListOf;\n \"stop\": NodeListOf;\n \"strike\": NodeListOf;\n \"strong\": NodeListOf;\n \"style\": NodeListOf;\n \"sub\": NodeListOf;\n \"sup\": NodeListOf;\n \"svg\": NodeListOf;\n \"switch\": NodeListOf;\n \"symbol\": NodeListOf;\n \"table\": NodeListOf;\n \"tbody\": NodeListOf;\n \"td\": NodeListOf;\n \"template\": NodeListOf;\n \"text\": NodeListOf;\n \"textpath\": NodeListOf;\n \"textarea\": NodeListOf;\n \"tfoot\": NodeListOf;\n \"th\": NodeListOf;\n \"thead\": NodeListOf;\n \"title\": NodeListOf;\n \"tr\": NodeListOf;\n \"track\": NodeListOf;\n \"tspan\": NodeListOf;\n \"tt\": NodeListOf;\n \"u\": NodeListOf;\n \"ul\": NodeListOf;\n \"use\": NodeListOf;\n \"var\": NodeListOf;\n \"video\": NodeListOf;\n \"view\": NodeListOf;\n \"wbr\": NodeListOf;\n \"x-ms-webview\": NodeListOf;\n \"xmp\": NodeListOf;\n}\n\ndeclare var Audio: {new(src?: string): HTMLAudioElement; };\ndeclare var Image: {new(width?: number, height?: number): HTMLImageElement; };\ndeclare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; };\ndeclare var applicationCache: ApplicationCache;\ndeclare var clientInformation: Navigator;\ndeclare var closed: boolean;\ndeclare var crypto: Crypto;\ndeclare var defaultStatus: string;\ndeclare var devicePixelRatio: number;\ndeclare var doNotTrack: string;\ndeclare var document: Document;\ndeclare var event: Event | undefined;\ndeclare var external: External;\ndeclare var frameElement: Element;\ndeclare var frames: Window;\ndeclare var history: History;\ndeclare var innerHeight: number;\ndeclare var innerWidth: number;\ndeclare var length: number;\ndeclare var location: Location;\ndeclare var locationbar: BarProp;\ndeclare var menubar: BarProp;\ndeclare var msCredentials: MSCredentials;\ndeclare const name: never;\ndeclare var navigator: Navigator;\ndeclare var offscreenBuffering: string | boolean;\ndeclare var onabort: (this: Window, ev: UIEvent) => any;\ndeclare var onafterprint: (this: Window, ev: Event) => any;\ndeclare var onbeforeprint: (this: Window, ev: Event) => any;\ndeclare var onbeforeunload: (this: Window, ev: BeforeUnloadEvent) => any;\ndeclare var onblur: (this: Window, ev: FocusEvent) => any;\ndeclare var oncanplay: (this: Window, ev: Event) => any;\ndeclare var oncanplaythrough: (this: Window, ev: Event) => any;\ndeclare var onchange: (this: Window, ev: Event) => any;\ndeclare var onclick: (this: Window, ev: MouseEvent) => any;\ndeclare var oncompassneedscalibration: (this: Window, ev: Event) => any;\ndeclare var oncontextmenu: (this: Window, ev: PointerEvent) => any;\ndeclare var ondblclick: (this: Window, ev: MouseEvent) => any;\ndeclare var ondevicelight: (this: Window, ev: DeviceLightEvent) => any;\ndeclare var ondevicemotion: (this: Window, ev: DeviceMotionEvent) => any;\ndeclare var ondeviceorientation: (this: Window, ev: DeviceOrientationEvent) => any;\ndeclare var ondrag: (this: Window, ev: DragEvent) => any;\ndeclare var ondragend: (this: Window, ev: DragEvent) => any;\ndeclare var ondragenter: (this: Window, ev: DragEvent) => any;\ndeclare var ondragleave: (this: Window, ev: DragEvent) => any;\ndeclare var ondragover: (this: Window, ev: DragEvent) => any;\ndeclare var ondragstart: (this: Window, ev: DragEvent) => any;\ndeclare var ondrop: (this: Window, ev: DragEvent) => any;\ndeclare var ondurationchange: (this: Window, ev: Event) => any;\ndeclare var onemptied: (this: Window, ev: Event) => any;\ndeclare var onended: (this: Window, ev: MediaStreamErrorEvent) => any;\ndeclare var onerror: ErrorEventHandler;\ndeclare var onfocus: (this: Window, ev: FocusEvent) => any;\ndeclare var onhashchange: (this: Window, ev: HashChangeEvent) => any;\ndeclare var oninput: (this: Window, ev: Event) => any;\ndeclare var oninvalid: (this: Window, ev: Event) => any;\ndeclare var onkeydown: (this: Window, ev: KeyboardEvent) => any;\ndeclare var onkeypress: (this: Window, ev: KeyboardEvent) => any;\ndeclare var onkeyup: (this: Window, ev: KeyboardEvent) => any;\ndeclare var onload: (this: Window, ev: Event) => any;\ndeclare var onloadeddata: (this: Window, ev: Event) => any;\ndeclare var onloadedmetadata: (this: Window, ev: Event) => any;\ndeclare var onloadstart: (this: Window, ev: Event) => any;\ndeclare var onmessage: (this: Window, ev: MessageEvent) => any;\ndeclare var onmousedown: (this: Window, ev: MouseEvent) => any;\ndeclare var onmouseenter: (this: Window, ev: MouseEvent) => any;\ndeclare var onmouseleave: (this: Window, ev: MouseEvent) => any;\ndeclare var onmousemove: (this: Window, ev: MouseEvent) => any;\ndeclare var onmouseout: (this: Window, ev: MouseEvent) => any;\ndeclare var onmouseover: (this: Window, ev: MouseEvent) => any;\ndeclare var onmouseup: (this: Window, ev: MouseEvent) => any;\ndeclare var onmousewheel: (this: Window, ev: WheelEvent) => any;\ndeclare var onmsgesturechange: (this: Window, ev: MSGestureEvent) => any;\ndeclare var onmsgesturedoubletap: (this: Window, ev: MSGestureEvent) => any;\ndeclare var onmsgestureend: (this: Window, ev: MSGestureEvent) => any;\ndeclare var onmsgesturehold: (this: Window, ev: MSGestureEvent) => any;\ndeclare var onmsgesturestart: (this: Window, ev: MSGestureEvent) => any;\ndeclare var onmsgesturetap: (this: Window, ev: MSGestureEvent) => any;\ndeclare var onmsinertiastart: (this: Window, ev: MSGestureEvent) => any;\ndeclare var onmspointercancel: (this: Window, ev: MSPointerEvent) => any;\ndeclare var onmspointerdown: (this: Window, ev: MSPointerEvent) => any;\ndeclare var onmspointerenter: (this: Window, ev: MSPointerEvent) => any;\ndeclare var onmspointerleave: (this: Window, ev: MSPointerEvent) => any;\ndeclare var onmspointermove: (this: Window, ev: MSPointerEvent) => any;\ndeclare var onmspointerout: (this: Window, ev: MSPointerEvent) => any;\ndeclare var onmspointerover: (this: Window, ev: MSPointerEvent) => any;\ndeclare var onmspointerup: (this: Window, ev: MSPointerEvent) => any;\ndeclare var onoffline: (this: Window, ev: Event) => any;\ndeclare var ononline: (this: Window, ev: Event) => any;\ndeclare var onorientationchange: (this: Window, ev: Event) => any;\ndeclare var onpagehide: (this: Window, ev: PageTransitionEvent) => any;\ndeclare var onpageshow: (this: Window, ev: PageTransitionEvent) => any;\ndeclare var onpause: (this: Window, ev: Event) => any;\ndeclare var onplay: (this: Window, ev: Event) => any;\ndeclare var onplaying: (this: Window, ev: Event) => any;\ndeclare var onpopstate: (this: Window, ev: PopStateEvent) => any;\ndeclare var onprogress: (this: Window, ev: ProgressEvent) => any;\ndeclare var onratechange: (this: Window, ev: Event) => any;\ndeclare var onreadystatechange: (this: Window, ev: ProgressEvent) => any;\ndeclare var onreset: (this: Window, ev: Event) => any;\ndeclare var onresize: (this: Window, ev: UIEvent) => any;\ndeclare var onscroll: (this: Window, ev: UIEvent) => any;\ndeclare var onseeked: (this: Window, ev: Event) => any;\ndeclare var onseeking: (this: Window, ev: Event) => any;\ndeclare var onselect: (this: Window, ev: UIEvent) => any;\ndeclare var onstalled: (this: Window, ev: Event) => any;\ndeclare var onstorage: (this: Window, ev: StorageEvent) => any;\ndeclare var onsubmit: (this: Window, ev: Event) => any;\ndeclare var onsuspend: (this: Window, ev: Event) => any;\ndeclare var ontimeupdate: (this: Window, ev: Event) => any;\ndeclare var ontouchcancel: (ev: TouchEvent) => any;\ndeclare var ontouchend: (ev: TouchEvent) => any;\ndeclare var ontouchmove: (ev: TouchEvent) => any;\ndeclare var ontouchstart: (ev: TouchEvent) => any;\ndeclare var onunload: (this: Window, ev: Event) => any;\ndeclare var onvolumechange: (this: Window, ev: Event) => any;\ndeclare var onwaiting: (this: Window, ev: Event) => any;\ndeclare var opener: any;\ndeclare var orientation: string | number;\ndeclare var outerHeight: number;\ndeclare var outerWidth: number;\ndeclare var pageXOffset: number;\ndeclare var pageYOffset: number;\ndeclare var parent: Window;\ndeclare var performance: Performance;\ndeclare var personalbar: BarProp;\ndeclare var screen: Screen;\ndeclare var screenLeft: number;\ndeclare var screenTop: number;\ndeclare var screenX: number;\ndeclare var screenY: number;\ndeclare var scrollX: number;\ndeclare var scrollY: number;\ndeclare var scrollbars: BarProp;\ndeclare var self: Window;\ndeclare var status: string;\ndeclare var statusbar: BarProp;\ndeclare var styleMedia: StyleMedia;\ndeclare var toolbar: BarProp;\ndeclare var top: Window;\ndeclare var window: Window;\ndeclare function alert(message?: any): void;\ndeclare function blur(): void;\ndeclare function cancelAnimationFrame(handle: number): void;\ndeclare function captureEvents(): void;\ndeclare function close(): void;\ndeclare function confirm(message?: string): boolean;\ndeclare function focus(): void;\ndeclare function getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration;\ndeclare function getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList;\ndeclare function getSelection(): Selection;\ndeclare function matchMedia(mediaQuery: string): MediaQueryList;\ndeclare function moveBy(x?: number, y?: number): void;\ndeclare function moveTo(x?: number, y?: number): void;\ndeclare function msWriteProfilerMark(profilerMarkName: string): void;\ndeclare function open(url?: string, target?: string, features?: string, replace?: boolean): Window;\ndeclare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void;\ndeclare function print(): void;\ndeclare function prompt(message?: string, _default?: string): string | null;\ndeclare function releaseEvents(): void;\ndeclare function requestAnimationFrame(callback: FrameRequestCallback): number;\ndeclare function resizeBy(x?: number, y?: number): void;\ndeclare function resizeTo(x?: number, y?: number): void;\ndeclare function scroll(x?: number, y?: number): void;\ndeclare function scrollBy(x?: number, y?: number): void;\ndeclare function scrollTo(x?: number, y?: number): void;\ndeclare function webkitCancelAnimationFrame(handle: number): void;\ndeclare function webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint;\ndeclare function webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint;\ndeclare function webkitRequestAnimationFrame(callback: FrameRequestCallback): number;\ndeclare function scroll(options?: ScrollToOptions): void;\ndeclare function scrollTo(options?: ScrollToOptions): void;\ndeclare function scrollBy(options?: ScrollToOptions): void;\ndeclare function toString(): string;\ndeclare function dispatchEvent(evt: Event): boolean;\ndeclare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void;\ndeclare function clearInterval(handle: number): void;\ndeclare function clearTimeout(handle: number): void;\ndeclare function setInterval(handler: (...args: any[]) => void, timeout: number): number;\ndeclare function setInterval(handler: any, timeout?: any, ...args: any[]): number;\ndeclare function setTimeout(handler: (...args: any[]) => void, timeout: number): number;\ndeclare function setTimeout(handler: any, timeout?: any, ...args: any[]): number;\ndeclare function clearImmediate(handle: number): void;\ndeclare function setImmediate(handler: (...args: any[]) => void): number;\ndeclare function setImmediate(handler: any, ...args: any[]): number;\ndeclare var sessionStorage: Storage;\ndeclare var localStorage: Storage;\ndeclare var console: Console;\ndeclare var onpointercancel: (this: Window, ev: PointerEvent) => any;\ndeclare var onpointerdown: (this: Window, ev: PointerEvent) => any;\ndeclare var onpointerenter: (this: Window, ev: PointerEvent) => any;\ndeclare var onpointerleave: (this: Window, ev: PointerEvent) => any;\ndeclare var onpointermove: (this: Window, ev: PointerEvent) => any;\ndeclare var onpointerout: (this: Window, ev: PointerEvent) => any;\ndeclare var onpointerover: (this: Window, ev: PointerEvent) => any;\ndeclare var onpointerup: (this: Window, ev: PointerEvent) => any;\ndeclare var onwheel: (this: Window, ev: WheelEvent) => any;\ndeclare var indexedDB: IDBFactory;\ndeclare function atob(encodedString: string): string;\ndeclare function btoa(rawString: string): string;\ndeclare function addEventListener(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, useCapture?: boolean): void;\ndeclare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;\ntype AAGUID = string;\ntype AlgorithmIdentifier = string | Algorithm;\ntype ConstrainBoolean = boolean | ConstrainBooleanParameters;\ntype ConstrainDOMString = string | string[] | ConstrainDOMStringParameters;\ntype ConstrainDouble = number | ConstrainDoubleRange;\ntype ConstrainLong = number | ConstrainLongRange;\ntype CryptoOperationData = ArrayBufferView;\ntype GLbitfield = number;\ntype GLboolean = boolean;\ntype GLbyte = number;\ntype GLclampf = number;\ntype GLenum = number;\ntype GLfloat = number;\ntype GLint = number;\ntype GLintptr = number;\ntype GLshort = number;\ntype GLsizei = number;\ntype GLsizeiptr = number;\ntype GLubyte = number;\ntype GLuint = number;\ntype GLushort = number;\ntype IDBKeyPath = string;\ntype KeyFormat = string;\ntype KeyType = string;\ntype KeyUsage = string;\ntype MSInboundPayload = MSVideoRecvPayload | MSAudioRecvPayload;\ntype MSLocalClientEvent = MSLocalClientEventBase | MSAudioLocalClientEvent;\ntype MSOutboundPayload = MSVideoSendPayload | MSAudioSendPayload;\ntype RTCIceGatherCandidate = RTCIceCandidate | RTCIceCandidateComplete;\ntype RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport;\ntype payloadtype = number;\ntype ScrollBehavior = \"auto\" | \"instant\" | \"smooth\";\ntype ScrollLogicalPosition = \"start\" | \"center\" | \"end\" | \"nearest\";\ntype IDBValidKey = number | string | Date | IDBArrayKey;\ntype BufferSource = ArrayBuffer | ArrayBufferView;\ntype MouseWheelEvent = WheelEvent;\ntype ScrollRestoration = \"auto\" | \"manual\";\n\n\n/////////////////////////////\n/// WorkerGlobalScope APIs \n/////////////////////////////\n// These are only available in a Web Worker \ndeclare function importScripts(...urls: string[]): void;\n\n\n\n\n/////////////////////////////\n/// Windows Script Host APIS\n/////////////////////////////\n\n\ninterface ActiveXObject {\n new (s: string): any;\n}\ndeclare var ActiveXObject: ActiveXObject;\n\ninterface ITextWriter {\n Write(s: string): void;\n WriteLine(s: string): void;\n Close(): void;\n}\n\ninterface TextStreamBase {\n /**\n * The column number of the current character position in an input stream.\n */\n Column: number;\n\n /**\n * The current line number in an input stream.\n */\n Line: number;\n\n /**\n * Closes a text stream.\n * It is not necessary to close standard streams; they close automatically when the process ends. If \n * you close a standard stream, be aware that any other pointers to that standard stream become invalid.\n */\n Close(): void;\n}\n\ninterface TextStreamWriter extends TextStreamBase {\n /**\n * Sends a string to an output stream.\n */\n Write(s: string): void;\n\n /**\n * Sends a specified number of blank lines (newline characters) to an output stream.\n */\n WriteBlankLines(intLines: number): void;\n\n /**\n * Sends a string followed by a newline character to an output stream.\n */\n WriteLine(s: string): void;\n}\n\ninterface TextStreamReader extends TextStreamBase {\n /**\n * Returns a specified number of characters from an input stream, starting at the current pointer position.\n * Does not return until the ENTER key is pressed.\n * Can only be used on a stream in reading mode; causes an error in writing or appending mode.\n */\n Read(characters: number): string;\n\n /**\n * Returns all characters from an input stream.\n * Can only be used on a stream in reading mode; causes an error in writing or appending mode.\n */\n ReadAll(): string;\n\n /**\n * Returns an entire line from an input stream.\n * Although this method extracts the newline character, it does not add it to the returned string.\n * Can only be used on a stream in reading mode; causes an error in writing or appending mode.\n */\n ReadLine(): string;\n\n /**\n * Skips a specified number of characters when reading from an input text stream.\n * Can only be used on a stream in reading mode; causes an error in writing or appending mode.\n * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.)\n */\n Skip(characters: number): void;\n\n /**\n * Skips the next line when reading from an input text stream.\n * Can only be used on a stream in reading mode, not writing or appending mode.\n */\n SkipLine(): void;\n\n /**\n * Indicates whether the stream pointer position is at the end of a line.\n */\n AtEndOfLine: boolean;\n\n /**\n * Indicates whether the stream pointer position is at the end of a stream.\n */\n AtEndOfStream: boolean;\n}\n\ndeclare var WScript: {\n /**\n * Outputs text to either a message box (under WScript.exe) or the command console window followed by\n * a newline (under CScript.exe).\n */\n Echo(s: any): void;\n\n /**\n * Exposes the write-only error output stream for the current script.\n * Can be accessed only while using CScript.exe.\n */\n StdErr: TextStreamWriter;\n\n /**\n * Exposes the write-only output stream for the current script.\n * Can be accessed only while using CScript.exe.\n */\n StdOut: TextStreamWriter;\n Arguments: { length: number; Item(n: number): string; };\n\n /**\n * The full path of the currently running script.\n */\n ScriptFullName: string;\n\n /**\n * Forces the script to stop immediately, with an optional exit code.\n */\n Quit(exitCode?: number): number;\n\n /**\n * The Windows Script Host build version number.\n */\n BuildVersion: number;\n\n /**\n * Fully qualified path of the host executable.\n */\n FullName: string;\n\n /**\n * Gets/sets the script mode - interactive(true) or batch(false).\n */\n Interactive: boolean;\n\n /**\n * The name of the host executable (WScript.exe or CScript.exe).\n */\n Name: string;\n\n /**\n * Path of the directory containing the host executable.\n */\n Path: string;\n\n /**\n * The filename of the currently running script.\n */\n ScriptName: string;\n\n /**\n * Exposes the read-only input stream for the current script.\n * Can be accessed only while using CScript.exe.\n */\n StdIn: TextStreamReader;\n\n /**\n * Windows Script Host version\n */\n Version: string;\n\n /**\n * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event.\n */\n ConnectObject(objEventSource: any, strPrefix: string): void;\n\n /**\n * Creates a COM object.\n * @param strProgiID\n * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.\n */\n CreateObject(strProgID: string, strPrefix?: string): any;\n\n /**\n * Disconnects a COM object from its event sources.\n */\n DisconnectObject(obj: any): void;\n\n /**\n * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file.\n * @param strPathname Fully qualified path to the file containing the object persisted to disk.\n * For objects in memory, pass a zero-length string.\n * @param strProgID\n * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.\n */\n GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any;\n\n /**\n * Suspends script execution for a specified length of time, then continues execution.\n * @param intTime Interval (in milliseconds) to suspend script execution.\n */\n Sleep(intTime: number): void;\n};\n\n/**\n * Allows enumerating over a COM collection, which may not have indexed item access.\n */\ninterface Enumerator {\n /**\n * Returns true if the current item is the last one in the collection, or the collection is empty,\n * or the current item is undefined.\n */\n atEnd(): boolean;\n\n /**\n * Returns the current item in the collection\n */\n item(): T;\n\n /**\n * Resets the current item in the collection to the first item. If there are no items in the collection,\n * the current item is set to undefined.\n */\n moveFirst(): void;\n\n /**\n * Moves the current item to the next item in the collection. If the enumerator is at the end of\n * the collection or the collection is empty, the current item is set to undefined.\n */\n moveNext(): void;\n}\n\ninterface EnumeratorConstructor {\n new (collection: any): Enumerator;\n new (collection: any): Enumerator;\n}\n\ndeclare var Enumerator: EnumeratorConstructor;\n\n/**\n * Enables reading from a COM safe array, which might have an alternate lower bound, or multiple dimensions.\n */\ninterface VBArray {\n /**\n * Returns the number of dimensions (1-based).\n */\n dimensions(): number;\n\n /**\n * Takes an index for each dimension in the array, and returns the item at the corresponding location.\n */\n getItem(dimension1Index: number, ...dimensionNIndexes: number[]): T;\n\n /**\n * Returns the smallest available index for a given dimension.\n * @param dimension 1-based dimension (defaults to 1)\n */\n lbound(dimension?: number): number;\n\n /**\n * Returns the largest available index for a given dimension.\n * @param dimension 1-based dimension (defaults to 1)\n */\n ubound(dimension?: number): number;\n\n /**\n * Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions,\n * each successive dimension is appended to the end of the array.\n * Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6]\n */\n toArray(): T[];\n}\n\ninterface VBArrayConstructor {\n new (safeArray: any): VBArray;\n new (safeArray: any): VBArray;\n}\n\ndeclare var VBArray: VBArrayConstructor;\n\n/**\n * Automation date (VT_DATE)\n */\ninterface VarDate { }\n\ninterface DateConstructor {\n new (vd: VarDate): Date;\n}\n\ninterface Date {\n getVarDate: () => VarDate;\n}\n"}; }); diff --git a/lib/typescriptServices.d.ts b/lib/typescriptServices.d.ts index 0aa49bae..5b72478e 100644 --- a/lib/typescriptServices.d.ts +++ b/lib/typescriptServices.d.ts @@ -1,18 +1,18 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + declare namespace ts { interface MapLike { [index: string]: T; @@ -29,6 +29,7 @@ declare namespace ts { contains(fileName: Path): boolean; remove(fileName: Path): void; forEachValue(f: (key: Path, v: T) => void): void; + getKeys(): Path[]; clear(): void; } interface TextRange { @@ -46,313 +47,352 @@ declare namespace ts { ConflictMarkerTrivia = 7, NumericLiteral = 8, StringLiteral = 9, - RegularExpressionLiteral = 10, - NoSubstitutionTemplateLiteral = 11, - TemplateHead = 12, - TemplateMiddle = 13, - TemplateTail = 14, - OpenBraceToken = 15, - CloseBraceToken = 16, - OpenParenToken = 17, - CloseParenToken = 18, - OpenBracketToken = 19, - CloseBracketToken = 20, - DotToken = 21, - DotDotDotToken = 22, - SemicolonToken = 23, - CommaToken = 24, - LessThanToken = 25, - LessThanSlashToken = 26, - GreaterThanToken = 27, - LessThanEqualsToken = 28, - GreaterThanEqualsToken = 29, - EqualsEqualsToken = 30, - ExclamationEqualsToken = 31, - EqualsEqualsEqualsToken = 32, - ExclamationEqualsEqualsToken = 33, - EqualsGreaterThanToken = 34, - PlusToken = 35, - MinusToken = 36, - AsteriskToken = 37, - AsteriskAsteriskToken = 38, - SlashToken = 39, - PercentToken = 40, - PlusPlusToken = 41, - MinusMinusToken = 42, - LessThanLessThanToken = 43, - GreaterThanGreaterThanToken = 44, - GreaterThanGreaterThanGreaterThanToken = 45, - AmpersandToken = 46, - BarToken = 47, - CaretToken = 48, - ExclamationToken = 49, - TildeToken = 50, - AmpersandAmpersandToken = 51, - BarBarToken = 52, - QuestionToken = 53, - ColonToken = 54, - AtToken = 55, - EqualsToken = 56, - PlusEqualsToken = 57, - MinusEqualsToken = 58, - AsteriskEqualsToken = 59, - AsteriskAsteriskEqualsToken = 60, - SlashEqualsToken = 61, - PercentEqualsToken = 62, - LessThanLessThanEqualsToken = 63, - GreaterThanGreaterThanEqualsToken = 64, - GreaterThanGreaterThanGreaterThanEqualsToken = 65, - AmpersandEqualsToken = 66, - BarEqualsToken = 67, - CaretEqualsToken = 68, - Identifier = 69, - BreakKeyword = 70, - CaseKeyword = 71, - CatchKeyword = 72, - ClassKeyword = 73, - ConstKeyword = 74, - ContinueKeyword = 75, - DebuggerKeyword = 76, - DefaultKeyword = 77, - DeleteKeyword = 78, - DoKeyword = 79, - ElseKeyword = 80, - EnumKeyword = 81, - ExportKeyword = 82, - ExtendsKeyword = 83, - FalseKeyword = 84, - FinallyKeyword = 85, - ForKeyword = 86, - FunctionKeyword = 87, - IfKeyword = 88, - ImportKeyword = 89, - InKeyword = 90, - InstanceOfKeyword = 91, - NewKeyword = 92, - NullKeyword = 93, - ReturnKeyword = 94, - SuperKeyword = 95, - SwitchKeyword = 96, - ThisKeyword = 97, - ThrowKeyword = 98, - TrueKeyword = 99, - TryKeyword = 100, - TypeOfKeyword = 101, - VarKeyword = 102, - VoidKeyword = 103, - WhileKeyword = 104, - WithKeyword = 105, - ImplementsKeyword = 106, - InterfaceKeyword = 107, - LetKeyword = 108, - PackageKeyword = 109, - PrivateKeyword = 110, - ProtectedKeyword = 111, - PublicKeyword = 112, - StaticKeyword = 113, - YieldKeyword = 114, - AbstractKeyword = 115, - AsKeyword = 116, - AnyKeyword = 117, - AsyncKeyword = 118, - AwaitKeyword = 119, - BooleanKeyword = 120, - ConstructorKeyword = 121, - DeclareKeyword = 122, - GetKeyword = 123, - IsKeyword = 124, - ModuleKeyword = 125, - NamespaceKeyword = 126, - NeverKeyword = 127, - ReadonlyKeyword = 128, - RequireKeyword = 129, - NumberKeyword = 130, - SetKeyword = 131, - StringKeyword = 132, - SymbolKeyword = 133, - TypeKeyword = 134, - UndefinedKeyword = 135, - FromKeyword = 136, - GlobalKeyword = 137, - OfKeyword = 138, - QualifiedName = 139, - ComputedPropertyName = 140, - TypeParameter = 141, - Parameter = 142, - Decorator = 143, - PropertySignature = 144, - PropertyDeclaration = 145, - MethodSignature = 146, - MethodDeclaration = 147, - Constructor = 148, - GetAccessor = 149, - SetAccessor = 150, - CallSignature = 151, - ConstructSignature = 152, - IndexSignature = 153, - TypePredicate = 154, - TypeReference = 155, - FunctionType = 156, - ConstructorType = 157, - TypeQuery = 158, - TypeLiteral = 159, - ArrayType = 160, - TupleType = 161, - UnionType = 162, - IntersectionType = 163, - ParenthesizedType = 164, - ThisType = 165, - LiteralType = 166, - ObjectBindingPattern = 167, - ArrayBindingPattern = 168, - BindingElement = 169, - ArrayLiteralExpression = 170, - ObjectLiteralExpression = 171, - PropertyAccessExpression = 172, - ElementAccessExpression = 173, - CallExpression = 174, - NewExpression = 175, - TaggedTemplateExpression = 176, - TypeAssertionExpression = 177, - ParenthesizedExpression = 178, - FunctionExpression = 179, - ArrowFunction = 180, - DeleteExpression = 181, - TypeOfExpression = 182, - VoidExpression = 183, - AwaitExpression = 184, - PrefixUnaryExpression = 185, - PostfixUnaryExpression = 186, - BinaryExpression = 187, - ConditionalExpression = 188, - TemplateExpression = 189, - YieldExpression = 190, - SpreadElementExpression = 191, - ClassExpression = 192, - OmittedExpression = 193, - ExpressionWithTypeArguments = 194, - AsExpression = 195, - NonNullExpression = 196, - TemplateSpan = 197, - SemicolonClassElement = 198, - Block = 199, - VariableStatement = 200, - EmptyStatement = 201, - ExpressionStatement = 202, - IfStatement = 203, - DoStatement = 204, - WhileStatement = 205, - ForStatement = 206, - ForInStatement = 207, - ForOfStatement = 208, - ContinueStatement = 209, - BreakStatement = 210, - ReturnStatement = 211, - WithStatement = 212, - SwitchStatement = 213, - LabeledStatement = 214, - ThrowStatement = 215, - TryStatement = 216, - DebuggerStatement = 217, - VariableDeclaration = 218, - VariableDeclarationList = 219, - FunctionDeclaration = 220, - ClassDeclaration = 221, - InterfaceDeclaration = 222, - TypeAliasDeclaration = 223, - EnumDeclaration = 224, - ModuleDeclaration = 225, - ModuleBlock = 226, - CaseBlock = 227, - NamespaceExportDeclaration = 228, - ImportEqualsDeclaration = 229, - ImportDeclaration = 230, - ImportClause = 231, - NamespaceImport = 232, - NamedImports = 233, - ImportSpecifier = 234, - ExportAssignment = 235, - ExportDeclaration = 236, - NamedExports = 237, - ExportSpecifier = 238, - MissingDeclaration = 239, - ExternalModuleReference = 240, - JsxElement = 241, - JsxSelfClosingElement = 242, - JsxOpeningElement = 243, - JsxText = 244, - JsxClosingElement = 245, - JsxAttribute = 246, - JsxSpreadAttribute = 247, - JsxExpression = 248, - CaseClause = 249, - DefaultClause = 250, - HeritageClause = 251, - CatchClause = 252, - PropertyAssignment = 253, - ShorthandPropertyAssignment = 254, - EnumMember = 255, - SourceFile = 256, - JSDocTypeExpression = 257, - JSDocAllType = 258, - JSDocUnknownType = 259, - JSDocArrayType = 260, - JSDocUnionType = 261, - JSDocTupleType = 262, - JSDocNullableType = 263, - JSDocNonNullableType = 264, - JSDocRecordType = 265, - JSDocRecordMember = 266, - JSDocTypeReference = 267, - JSDocOptionalType = 268, - JSDocFunctionType = 269, - JSDocVariadicType = 270, - JSDocConstructorType = 271, - JSDocThisType = 272, - JSDocComment = 273, - JSDocTag = 274, - JSDocParameterTag = 275, - JSDocReturnTag = 276, - JSDocTypeTag = 277, - JSDocTemplateTag = 278, - JSDocTypedefTag = 279, - JSDocPropertyTag = 280, - JSDocTypeLiteral = 281, - JSDocLiteralType = 282, - JSDocNullKeyword = 283, - JSDocUndefinedKeyword = 284, - JSDocNeverKeyword = 285, - SyntaxList = 286, - Count = 287, - FirstAssignment = 56, - LastAssignment = 68, - FirstReservedWord = 70, - LastReservedWord = 105, - FirstKeyword = 70, - LastKeyword = 138, - FirstFutureReservedWord = 106, - LastFutureReservedWord = 114, - FirstTypeNode = 154, - LastTypeNode = 166, - FirstPunctuation = 15, - LastPunctuation = 68, + JsxText = 10, + RegularExpressionLiteral = 11, + NoSubstitutionTemplateLiteral = 12, + TemplateHead = 13, + TemplateMiddle = 14, + TemplateTail = 15, + OpenBraceToken = 16, + CloseBraceToken = 17, + OpenParenToken = 18, + CloseParenToken = 19, + OpenBracketToken = 20, + CloseBracketToken = 21, + DotToken = 22, + DotDotDotToken = 23, + SemicolonToken = 24, + CommaToken = 25, + LessThanToken = 26, + LessThanSlashToken = 27, + GreaterThanToken = 28, + LessThanEqualsToken = 29, + GreaterThanEqualsToken = 30, + EqualsEqualsToken = 31, + ExclamationEqualsToken = 32, + EqualsEqualsEqualsToken = 33, + ExclamationEqualsEqualsToken = 34, + EqualsGreaterThanToken = 35, + PlusToken = 36, + MinusToken = 37, + AsteriskToken = 38, + AsteriskAsteriskToken = 39, + SlashToken = 40, + PercentToken = 41, + PlusPlusToken = 42, + MinusMinusToken = 43, + LessThanLessThanToken = 44, + GreaterThanGreaterThanToken = 45, + GreaterThanGreaterThanGreaterThanToken = 46, + AmpersandToken = 47, + BarToken = 48, + CaretToken = 49, + ExclamationToken = 50, + TildeToken = 51, + AmpersandAmpersandToken = 52, + BarBarToken = 53, + QuestionToken = 54, + ColonToken = 55, + AtToken = 56, + EqualsToken = 57, + PlusEqualsToken = 58, + MinusEqualsToken = 59, + AsteriskEqualsToken = 60, + AsteriskAsteriskEqualsToken = 61, + SlashEqualsToken = 62, + PercentEqualsToken = 63, + LessThanLessThanEqualsToken = 64, + GreaterThanGreaterThanEqualsToken = 65, + GreaterThanGreaterThanGreaterThanEqualsToken = 66, + AmpersandEqualsToken = 67, + BarEqualsToken = 68, + CaretEqualsToken = 69, + Identifier = 70, + BreakKeyword = 71, + CaseKeyword = 72, + CatchKeyword = 73, + ClassKeyword = 74, + ConstKeyword = 75, + ContinueKeyword = 76, + DebuggerKeyword = 77, + DefaultKeyword = 78, + DeleteKeyword = 79, + DoKeyword = 80, + ElseKeyword = 81, + EnumKeyword = 82, + ExportKeyword = 83, + ExtendsKeyword = 84, + FalseKeyword = 85, + FinallyKeyword = 86, + ForKeyword = 87, + FunctionKeyword = 88, + IfKeyword = 89, + ImportKeyword = 90, + InKeyword = 91, + InstanceOfKeyword = 92, + NewKeyword = 93, + NullKeyword = 94, + ReturnKeyword = 95, + SuperKeyword = 96, + SwitchKeyword = 97, + ThisKeyword = 98, + ThrowKeyword = 99, + TrueKeyword = 100, + TryKeyword = 101, + TypeOfKeyword = 102, + VarKeyword = 103, + VoidKeyword = 104, + WhileKeyword = 105, + WithKeyword = 106, + ImplementsKeyword = 107, + InterfaceKeyword = 108, + LetKeyword = 109, + PackageKeyword = 110, + PrivateKeyword = 111, + ProtectedKeyword = 112, + PublicKeyword = 113, + StaticKeyword = 114, + YieldKeyword = 115, + AbstractKeyword = 116, + AsKeyword = 117, + AnyKeyword = 118, + AsyncKeyword = 119, + AwaitKeyword = 120, + BooleanKeyword = 121, + ConstructorKeyword = 122, + DeclareKeyword = 123, + GetKeyword = 124, + IsKeyword = 125, + KeyOfKeyword = 126, + ModuleKeyword = 127, + NamespaceKeyword = 128, + NeverKeyword = 129, + ReadonlyKeyword = 130, + RequireKeyword = 131, + NumberKeyword = 132, + SetKeyword = 133, + StringKeyword = 134, + SymbolKeyword = 135, + TypeKeyword = 136, + UndefinedKeyword = 137, + FromKeyword = 138, + GlobalKeyword = 139, + OfKeyword = 140, + QualifiedName = 141, + ComputedPropertyName = 142, + TypeParameter = 143, + Parameter = 144, + Decorator = 145, + PropertySignature = 146, + PropertyDeclaration = 147, + MethodSignature = 148, + MethodDeclaration = 149, + Constructor = 150, + GetAccessor = 151, + SetAccessor = 152, + CallSignature = 153, + ConstructSignature = 154, + IndexSignature = 155, + TypePredicate = 156, + TypeReference = 157, + FunctionType = 158, + ConstructorType = 159, + TypeQuery = 160, + TypeLiteral = 161, + ArrayType = 162, + TupleType = 163, + UnionType = 164, + IntersectionType = 165, + ParenthesizedType = 166, + ThisType = 167, + TypeOperator = 168, + IndexedAccessType = 169, + MappedType = 170, + LiteralType = 171, + ObjectBindingPattern = 172, + ArrayBindingPattern = 173, + BindingElement = 174, + ArrayLiteralExpression = 175, + ObjectLiteralExpression = 176, + PropertyAccessExpression = 177, + ElementAccessExpression = 178, + CallExpression = 179, + NewExpression = 180, + TaggedTemplateExpression = 181, + TypeAssertionExpression = 182, + ParenthesizedExpression = 183, + FunctionExpression = 184, + ArrowFunction = 185, + DeleteExpression = 186, + TypeOfExpression = 187, + VoidExpression = 188, + AwaitExpression = 189, + PrefixUnaryExpression = 190, + PostfixUnaryExpression = 191, + BinaryExpression = 192, + ConditionalExpression = 193, + TemplateExpression = 194, + YieldExpression = 195, + SpreadElement = 196, + ClassExpression = 197, + OmittedExpression = 198, + ExpressionWithTypeArguments = 199, + AsExpression = 200, + NonNullExpression = 201, + TemplateSpan = 202, + SemicolonClassElement = 203, + Block = 204, + VariableStatement = 205, + EmptyStatement = 206, + ExpressionStatement = 207, + IfStatement = 208, + DoStatement = 209, + WhileStatement = 210, + ForStatement = 211, + ForInStatement = 212, + ForOfStatement = 213, + ContinueStatement = 214, + BreakStatement = 215, + ReturnStatement = 216, + WithStatement = 217, + SwitchStatement = 218, + LabeledStatement = 219, + ThrowStatement = 220, + TryStatement = 221, + DebuggerStatement = 222, + VariableDeclaration = 223, + VariableDeclarationList = 224, + FunctionDeclaration = 225, + ClassDeclaration = 226, + InterfaceDeclaration = 227, + TypeAliasDeclaration = 228, + EnumDeclaration = 229, + ModuleDeclaration = 230, + ModuleBlock = 231, + CaseBlock = 232, + NamespaceExportDeclaration = 233, + ImportEqualsDeclaration = 234, + ImportDeclaration = 235, + ImportClause = 236, + NamespaceImport = 237, + NamedImports = 238, + ImportSpecifier = 239, + ExportAssignment = 240, + ExportDeclaration = 241, + NamedExports = 242, + ExportSpecifier = 243, + MissingDeclaration = 244, + ExternalModuleReference = 245, + JsxElement = 246, + JsxSelfClosingElement = 247, + JsxOpeningElement = 248, + JsxClosingElement = 249, + JsxAttribute = 250, + JsxSpreadAttribute = 251, + JsxExpression = 252, + CaseClause = 253, + DefaultClause = 254, + HeritageClause = 255, + CatchClause = 256, + PropertyAssignment = 257, + ShorthandPropertyAssignment = 258, + SpreadAssignment = 259, + EnumMember = 260, + SourceFile = 261, + JSDocTypeExpression = 262, + JSDocAllType = 263, + JSDocUnknownType = 264, + JSDocArrayType = 265, + JSDocUnionType = 266, + JSDocTupleType = 267, + JSDocNullableType = 268, + JSDocNonNullableType = 269, + JSDocRecordType = 270, + JSDocRecordMember = 271, + JSDocTypeReference = 272, + JSDocOptionalType = 273, + JSDocFunctionType = 274, + JSDocVariadicType = 275, + JSDocConstructorType = 276, + JSDocThisType = 277, + JSDocComment = 278, + JSDocTag = 279, + 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, + Count = 297, + FirstAssignment = 57, + LastAssignment = 69, + FirstCompoundAssignment = 58, + LastCompoundAssignment = 69, + FirstReservedWord = 71, + LastReservedWord = 106, + FirstKeyword = 71, + LastKeyword = 140, + FirstFutureReservedWord = 107, + LastFutureReservedWord = 115, + FirstTypeNode = 156, + LastTypeNode = 171, + FirstPunctuation = 16, + LastPunctuation = 69, FirstToken = 0, - LastToken = 138, + LastToken = 140, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, - LastLiteralToken = 11, - FirstTemplateToken = 11, - LastTemplateToken = 14, - FirstBinaryOperator = 25, - LastBinaryOperator = 68, - FirstNode = 139, - FirstJSDocNode = 257, - LastJSDocNode = 282, - FirstJSDocTagNode = 273, - LastJSDocTagNode = 285, + LastLiteralToken = 12, + FirstTemplateToken = 12, + LastTemplateToken = 15, + FirstBinaryOperator = 26, + LastBinaryOperator = 69, + FirstNode = 141, + FirstJSDocNode = 262, + LastJSDocNode = 288, + FirstJSDocTagNode = 278, + LastJSDocTagNode = 291, } enum NodeFlags { + None = 0, + Let = 1, + Const = 2, + NestedNamespace = 4, + Synthesized = 8, + Namespace = 16, + ExportContext = 32, + ContainsThis = 64, + HasImplicitReturn = 128, + HasExplicitReturn = 256, + GlobalAugmentation = 512, + HasAsyncFunctions = 1024, + DisallowInContext = 2048, + YieldContext = 4096, + DecoratorContext = 8192, + AwaitContext = 16384, + ThisNodeHasError = 32768, + JavaScriptFile = 65536, + ThisNodeOrAnySubNodesHasError = 131072, + HasAggregatedChildData = 262144, + BlockScoped = 3, + ReachabilityCheckFlags = 384, + ReachabilityAndEmitFlags = 1408, + ContextFlags = 96256, + TypeExcludesFlags = 20480, + } + enum ModifierFlags { None = 0, Export = 1, Ambient = 2, @@ -364,36 +404,13 @@ declare namespace ts { Abstract = 128, Async = 256, Default = 512, - Let = 1024, Const = 2048, - Namespace = 4096, - ExportContext = 8192, - ContainsThis = 16384, - HasImplicitReturn = 32768, - HasExplicitReturn = 65536, - GlobalAugmentation = 131072, - HasClassExtends = 262144, - HasDecorators = 524288, - HasParamDecorators = 1048576, - HasAsyncFunctions = 2097152, - DisallowInContext = 4194304, - YieldContext = 8388608, - DecoratorContext = 16777216, - AwaitContext = 33554432, - ThisNodeHasError = 67108864, - JavaScriptFile = 134217728, - ThisNodeOrAnySubNodesHasError = 268435456, - HasAggregatedChildData = 536870912, - HasJsxSpreadAttribute = 1073741824, - Modifier = 1023, + HasComputedFlags = 536870912, AccessibilityModifier = 28, ParameterPropertyModifier = 92, - BlockScoped = 3072, - ReachabilityCheckFlags = 98304, - EmitHelperFlags = 3932160, - ReachabilityAndEmitFlags = 4030464, - ContextFlags = 197132288, - TypeExcludesFlags = 41943040, + NonPublicAccessibilityModifier = 24, + TypeScriptModifier = 2270, + ExportDefault = 513, } enum JsxFlags { None = 0, @@ -410,42 +427,57 @@ declare namespace ts { modifiers?: ModifiersArray; parent?: Node; } - interface NodeArray extends Array, TextRange { + interface NodeArray extends Array, TextRange { hasTrailingComma?: boolean; } - interface ModifiersArray extends NodeArray { - flags: NodeFlags; - } - interface Token extends Node { - __tokenTag: any; - } - interface Modifier extends Token { + interface Token extends Node { + kind: TKind; } + type DotDotDotToken = Token; + type QuestionToken = Token; + type ColonToken = Token; + type EqualsToken = Token; + type AsteriskToken = Token; + type EqualsGreaterThanToken = Token; + type EndOfFileToken = Token; + type AtToken = Token; + type ReadonlyToken = Token; + type Modifier = Token | Token | Token | Token | Token | Token | Token | Token | Token | Token | Token; + type ModifiersArray = NodeArray; interface Identifier extends PrimaryExpression { + kind: SyntaxKind.Identifier; text: string; originalKeywordKind?: SyntaxKind; + isInJSDocNamespace?: boolean; + } + interface TransientIdentifier extends Identifier { + resolvedSymbol: Symbol; } interface QualifiedName extends Node { + kind: SyntaxKind.QualifiedName; left: EntityName; 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; + name?: Identifier | StringLiteral | NumericLiteral; } interface ComputedPropertyName extends Node { + kind: SyntaxKind.ComputedPropertyName; expression: Expression; } interface Decorator extends Node { + kind: SyntaxKind.Decorator; expression: LeftHandSideExpression; } interface TypeParameterDeclaration extends Declaration { + kind: SyntaxKind.TypeParameter; name: Identifier; constraint?: TypeNode; expression?: Expression; @@ -457,39 +489,48 @@ declare namespace ts { type?: TypeNode; } interface CallSignatureDeclaration extends SignatureDeclaration, TypeElement { + kind: SyntaxKind.CallSignature; } interface ConstructSignatureDeclaration extends SignatureDeclaration, TypeElement { + kind: SyntaxKind.ConstructSignature; } + type BindingName = Identifier | BindingPattern; interface VariableDeclaration extends Declaration { + kind: SyntaxKind.VariableDeclaration; parent?: VariableDeclarationList; - name: Identifier | BindingPattern; + name: BindingName; type?: TypeNode; initializer?: Expression; } interface VariableDeclarationList extends Node { + kind: SyntaxKind.VariableDeclarationList; declarations: NodeArray; } interface ParameterDeclaration extends Declaration { - dotDotDotToken?: Node; - name: Identifier | BindingPattern; - questionToken?: Node; + kind: SyntaxKind.Parameter; + dotDotDotToken?: DotDotDotToken; + name: BindingName; + questionToken?: QuestionToken; type?: TypeNode; initializer?: Expression; } interface BindingElement extends Declaration { + kind: SyntaxKind.BindingElement; propertyName?: PropertyName; - dotDotDotToken?: Node; - name: Identifier | BindingPattern; + dotDotDotToken?: DotDotDotToken; + name: BindingName; initializer?: Expression; } interface PropertySignature extends TypeElement { + kind: SyntaxKind.PropertySignature | SyntaxKind.JSDocRecordMember; name: PropertyName; - questionToken?: Node; + questionToken?: QuestionToken; type?: TypeNode; initializer?: Expression; } interface PropertyDeclaration extends ClassElement { - questionToken?: Node; + kind: SyntaxKind.PropertyDeclaration; + questionToken?: QuestionToken; name: PropertyName; type?: TypeNode; initializer?: Expression; @@ -498,36 +539,45 @@ declare namespace ts { _objectLiteralBrandBrand: any; name?: PropertyName; } + type ObjectLiteralElementLike = PropertyAssignment | ShorthandPropertyAssignment | MethodDeclaration | AccessorDeclaration | SpreadAssignment; interface PropertyAssignment extends ObjectLiteralElement { - _propertyAssignmentBrand: any; + kind: SyntaxKind.PropertyAssignment; name: PropertyName; - questionToken?: Node; + questionToken?: QuestionToken; initializer: Expression; } interface ShorthandPropertyAssignment extends ObjectLiteralElement { + kind: SyntaxKind.ShorthandPropertyAssignment; name: Identifier; - questionToken?: Node; - equalsToken?: Node; + questionToken?: QuestionToken; + equalsToken?: Token; objectAssignmentInitializer?: Expression; } + interface SpreadAssignment extends ObjectLiteralElement { + kind: SyntaxKind.SpreadAssignment; + expression: Expression; + } interface VariableLikeDeclaration extends Declaration { propertyName?: PropertyName; - dotDotDotToken?: Node; + dotDotDotToken?: DotDotDotToken; name: DeclarationName; - questionToken?: Node; + questionToken?: QuestionToken; type?: TypeNode; initializer?: Expression; } interface PropertyLikeDeclaration extends Declaration { name: PropertyName; } - interface BindingPattern extends Node { + interface ObjectBindingPattern extends Node { + kind: SyntaxKind.ObjectBindingPattern; elements: NodeArray; } - interface ObjectBindingPattern extends BindingPattern { - } - interface ArrayBindingPattern extends BindingPattern { + interface ArrayBindingPattern extends Node { + kind: SyntaxKind.ArrayBindingPattern; + elements: NodeArray; } + 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. @@ -538,94 +588,133 @@ declare namespace ts { */ interface FunctionLikeDeclaration extends SignatureDeclaration { _functionLikeDeclarationBrand: any; - asteriskToken?: Node; - questionToken?: Node; + asteriskToken?: AsteriskToken; + questionToken?: QuestionToken; body?: Block | Expression; } interface FunctionDeclaration extends FunctionLikeDeclaration, DeclarationStatement { + kind: SyntaxKind.FunctionDeclaration; name?: Identifier; body?: FunctionBody; } interface MethodSignature extends SignatureDeclaration, TypeElement { + kind: SyntaxKind.MethodSignature; name: PropertyName; } interface MethodDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { + kind: SyntaxKind.MethodDeclaration; name: PropertyName; body?: FunctionBody; } interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement { + kind: SyntaxKind.Constructor; body?: FunctionBody; } interface SemicolonClassElement extends ClassElement { - _semicolonClassElementBrand: any; + kind: SyntaxKind.SemicolonClassElement; } - interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { - _accessorDeclarationBrand: any; + interface GetAccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { + kind: SyntaxKind.GetAccessor; name: PropertyName; body: FunctionBody; } - interface GetAccessorDeclaration extends AccessorDeclaration { - } - interface SetAccessorDeclaration extends AccessorDeclaration { + interface SetAccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { + kind: SyntaxKind.SetAccessor; + name: PropertyName; + body: FunctionBody; } + type AccessorDeclaration = GetAccessorDeclaration | SetAccessorDeclaration; interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement, TypeElement { - _indexSignatureDeclarationBrand: any; + kind: SyntaxKind.IndexSignature; } interface TypeNode extends Node { _typeNodeBrand: any; } + interface KeywordTypeNode extends TypeNode { + kind: SyntaxKind.AnyKeyword | SyntaxKind.NumberKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.VoidKeyword; + } interface ThisTypeNode extends TypeNode { - _thisTypeNodeBrand: any; + kind: SyntaxKind.ThisType; } interface FunctionOrConstructorTypeNode extends TypeNode, SignatureDeclaration { - _functionOrConstructorTypeNodeBrand: any; + kind: SyntaxKind.FunctionType | SyntaxKind.ConstructorType; } interface FunctionTypeNode extends FunctionOrConstructorTypeNode { + kind: SyntaxKind.FunctionType; } interface ConstructorTypeNode extends FunctionOrConstructorTypeNode { + kind: SyntaxKind.ConstructorType; } interface TypeReferenceNode extends TypeNode { + kind: SyntaxKind.TypeReference; typeName: EntityName; typeArguments?: NodeArray; } interface TypePredicateNode extends TypeNode { + kind: SyntaxKind.TypePredicate; parameterName: Identifier | ThisTypeNode; type: TypeNode; } interface TypeQueryNode extends TypeNode { + kind: SyntaxKind.TypeQuery; exprName: EntityName; } interface TypeLiteralNode extends TypeNode, Declaration { + kind: SyntaxKind.TypeLiteral; members: NodeArray; } interface ArrayTypeNode extends TypeNode { + kind: SyntaxKind.ArrayType; elementType: TypeNode; } interface TupleTypeNode extends TypeNode { + kind: SyntaxKind.TupleType; elementTypes: NodeArray; } interface UnionOrIntersectionTypeNode extends TypeNode { + kind: SyntaxKind.UnionType | SyntaxKind.IntersectionType; types: NodeArray; } interface UnionTypeNode extends UnionOrIntersectionTypeNode { + kind: SyntaxKind.UnionType; } interface IntersectionTypeNode extends UnionOrIntersectionTypeNode { + kind: SyntaxKind.IntersectionType; } interface ParenthesizedTypeNode extends TypeNode { + kind: SyntaxKind.ParenthesizedType; type: TypeNode; } + interface TypeOperatorNode extends TypeNode { + kind: SyntaxKind.TypeOperator; + operator: SyntaxKind.KeyOfKeyword; + type: TypeNode; + } + interface IndexedAccessTypeNode extends TypeNode { + kind: SyntaxKind.IndexedAccessType; + objectType: TypeNode; + indexType: TypeNode; + } + interface MappedTypeNode extends TypeNode, Declaration { + kind: SyntaxKind.MappedType; + readonlyToken?: ReadonlyToken; + typeParameter: TypeParameterDeclaration; + questionToken?: QuestionToken; + type?: TypeNode; + } interface LiteralTypeNode extends TypeNode { - _stringLiteralTypeBrand: any; + kind: SyntaxKind.LiteralType; literal: Expression; } interface StringLiteral extends LiteralExpression { - _stringLiteralBrand: any; + kind: SyntaxKind.StringLiteral; } interface Expression extends Node { _expressionBrand: any; contextualType?: Type; } interface OmittedExpression extends Expression { + kind: SyntaxKind.OmittedExpression; } interface UnaryExpression extends Expression { _unaryExpressionBrand: any; @@ -633,16 +722,17 @@ declare namespace ts { interface IncrementExpression extends UnaryExpression { _incrementExpressionBrand: any; } + type PrefixUnaryOperator = SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.TildeToken | SyntaxKind.ExclamationToken; interface PrefixUnaryExpression extends IncrementExpression { - operator: SyntaxKind; + kind: SyntaxKind.PrefixUnaryExpression; + operator: PrefixUnaryOperator; operand: UnaryExpression; } + type PostfixUnaryOperator = SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken; interface PostfixUnaryExpression extends IncrementExpression { + kind: SyntaxKind.PostfixUnaryExpression; operand: LeftHandSideExpression; - operator: SyntaxKind; - } - interface PostfixExpression extends UnaryExpression { - _postfixExpressionBrand: any; + operator: PostfixUnaryOperator; } interface LeftHandSideExpression extends IncrementExpression { _leftHandSideExpressionBrand: any; @@ -653,42 +743,102 @@ declare namespace ts { interface PrimaryExpression extends MemberExpression { _primaryExpressionBrand: any; } + interface NullLiteral extends PrimaryExpression { + kind: SyntaxKind.NullKeyword; + } + interface BooleanLiteral extends PrimaryExpression { + kind: SyntaxKind.TrueKeyword | SyntaxKind.FalseKeyword; + } + interface ThisExpression extends PrimaryExpression { + kind: SyntaxKind.ThisKeyword; + } + interface SuperExpression extends PrimaryExpression { + kind: SyntaxKind.SuperKeyword; + } interface DeleteExpression extends UnaryExpression { + kind: SyntaxKind.DeleteExpression; expression: UnaryExpression; } interface TypeOfExpression extends UnaryExpression { + kind: SyntaxKind.TypeOfExpression; expression: UnaryExpression; } interface VoidExpression extends UnaryExpression { + kind: SyntaxKind.VoidExpression; expression: UnaryExpression; } interface AwaitExpression extends UnaryExpression { + kind: SyntaxKind.AwaitExpression; expression: UnaryExpression; } interface YieldExpression extends Expression { - asteriskToken?: Node; + kind: SyntaxKind.YieldExpression; + asteriskToken?: AsteriskToken; expression?: Expression; } + type ExponentiationOperator = SyntaxKind.AsteriskAsteriskToken; + type MultiplicativeOperator = SyntaxKind.AsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken; + type MultiplicativeOperatorOrHigher = ExponentiationOperator | MultiplicativeOperator; + type AdditiveOperator = SyntaxKind.PlusToken | SyntaxKind.MinusToken; + type AdditiveOperatorOrHigher = MultiplicativeOperatorOrHigher | AdditiveOperator; + type ShiftOperator = SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken; + type ShiftOperatorOrHigher = AdditiveOperatorOrHigher | ShiftOperator; + type RelationalOperator = SyntaxKind.LessThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.InstanceOfKeyword | SyntaxKind.InKeyword; + type RelationalOperatorOrHigher = ShiftOperatorOrHigher | RelationalOperator; + type EqualityOperator = SyntaxKind.EqualsEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.ExclamationEqualsToken; + type EqualityOperatorOrHigher = RelationalOperatorOrHigher | EqualityOperator; + type BitwiseOperator = SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken; + type BitwiseOperatorOrHigher = EqualityOperatorOrHigher | BitwiseOperator; + type LogicalOperator = SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken; + type LogicalOperatorOrHigher = BitwiseOperatorOrHigher | LogicalOperator; + type CompoundAssignmentOperator = SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken; + type AssignmentOperator = SyntaxKind.EqualsToken | CompoundAssignmentOperator; + type AssignmentOperatorOrHigher = LogicalOperatorOrHigher | AssignmentOperator; + type BinaryOperator = AssignmentOperatorOrHigher | SyntaxKind.CommaToken; + type BinaryOperatorToken = Token; interface BinaryExpression extends Expression, Declaration { + kind: SyntaxKind.BinaryExpression; left: Expression; - operatorToken: Node; + operatorToken: BinaryOperatorToken; right: Expression; } + type AssignmentOperatorToken = Token; + interface AssignmentExpression extends BinaryExpression { + left: LeftHandSideExpression; + operatorToken: TOperator; + } + interface ObjectDestructuringAssignment extends AssignmentExpression { + left: ObjectLiteralExpression; + } + interface ArrayDestructuringAssignment extends AssignmentExpression { + left: ArrayLiteralExpression; + } + type DestructuringAssignment = ObjectDestructuringAssignment | ArrayDestructuringAssignment; + type BindingOrAssignmentElement = VariableDeclaration | ParameterDeclaration | BindingElement | PropertyAssignment | ShorthandPropertyAssignment | SpreadAssignment | OmittedExpression | SpreadElement | ArrayLiteralExpression | ObjectLiteralExpression | AssignmentExpression | 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; - questionToken: Node; + questionToken: QuestionToken; whenTrue: Expression; - colonToken: Node; + colonToken: ColonToken; whenFalse: Expression; } type FunctionBody = Block; type ConciseBody = FunctionBody | Expression; interface FunctionExpression extends PrimaryExpression, FunctionLikeDeclaration { + kind: SyntaxKind.FunctionExpression; name?: Identifier; body: FunctionBody; } interface ArrowFunction extends Expression, FunctionLikeDeclaration { - equalsGreaterThanToken: Node; + kind: SyntaxKind.ArrowFunction; + equalsGreaterThanToken: EqualsGreaterThanToken; body: ConciseBody; } interface LiteralLikeNode extends Node { @@ -699,125 +849,193 @@ declare namespace ts { interface LiteralExpression extends LiteralLikeNode, PrimaryExpression { _literalExpressionBrand: any; } - interface TemplateLiteralFragment extends LiteralLikeNode { - _templateLiteralFragmentBrand: any; + interface RegularExpressionLiteral extends LiteralExpression { + kind: SyntaxKind.RegularExpressionLiteral; } + interface NoSubstitutionTemplateLiteral extends LiteralExpression { + kind: SyntaxKind.NoSubstitutionTemplateLiteral; + } + interface NumericLiteral extends LiteralExpression { + kind: SyntaxKind.NumericLiteral; + trailingComment?: string; + } + interface TemplateHead extends LiteralLikeNode { + kind: SyntaxKind.TemplateHead; + } + interface TemplateMiddle extends LiteralLikeNode { + kind: SyntaxKind.TemplateMiddle; + } + interface TemplateTail extends LiteralLikeNode { + kind: SyntaxKind.TemplateTail; + } + type TemplateLiteral = TemplateExpression | NoSubstitutionTemplateLiteral; interface TemplateExpression extends PrimaryExpression { - head: TemplateLiteralFragment; + kind: SyntaxKind.TemplateExpression; + head: TemplateHead; templateSpans: NodeArray; } interface TemplateSpan extends Node { + kind: SyntaxKind.TemplateSpan; expression: Expression; - literal: TemplateLiteralFragment; + literal: TemplateMiddle | TemplateTail; } interface ParenthesizedExpression extends PrimaryExpression { + kind: SyntaxKind.ParenthesizedExpression; expression: Expression; } interface ArrayLiteralExpression extends PrimaryExpression { + kind: SyntaxKind.ArrayLiteralExpression; elements: NodeArray; } - interface SpreadElementExpression extends Expression { + interface SpreadElement extends Expression { + kind: SyntaxKind.SpreadElement; expression: Expression; } - interface ObjectLiteralExpression extends PrimaryExpression, Declaration { - properties: NodeArray; + /** + * This interface is a base interface for ObjectLiteralExpression and JSXAttributes to extend from. JSXAttributes is similar to + * ObjectLiteralExpression in that it contains array of properties; however, JSXAttributes' properties can only be + * JSXAttribute or JSXSpreadAttribute. ObjectLiteralExpression, on the other hand, can only have properties of type + * ObjectLiteralElement (e.g. PropertyAssignment, ShorthandPropertyAssignment etc.) + **/ + interface ObjectLiteralExpressionBase extends PrimaryExpression, Declaration { + properties: NodeArray; + } + interface ObjectLiteralExpression extends ObjectLiteralExpressionBase { + kind: SyntaxKind.ObjectLiteralExpression; } type EntityNameExpression = Identifier | PropertyAccessEntityNameExpression; type EntityNameOrEntityNameExpression = EntityName | EntityNameExpression; interface PropertyAccessExpression extends MemberExpression, Declaration { + kind: SyntaxKind.PropertyAccessExpression; expression: LeftHandSideExpression; name: Identifier; } + interface SuperPropertyAccessExpression extends PropertyAccessExpression { + expression: SuperExpression; + } /** Brand for a PropertyAccessExpression which, like a QualifiedName, consists of a sequence of identifiers separated by dots. */ interface PropertyAccessEntityNameExpression extends PropertyAccessExpression { _propertyAccessExpressionLikeQualifiedNameBrand?: any; expression: EntityNameExpression; } interface ElementAccessExpression extends MemberExpression { + kind: SyntaxKind.ElementAccessExpression; expression: LeftHandSideExpression; argumentExpression?: Expression; } + interface SuperElementAccessExpression extends ElementAccessExpression { + expression: SuperExpression; + } + type SuperProperty = SuperPropertyAccessExpression | SuperElementAccessExpression; interface CallExpression extends LeftHandSideExpression, Declaration { + kind: SyntaxKind.CallExpression; expression: LeftHandSideExpression; typeArguments?: NodeArray; arguments: NodeArray; } + interface SuperCall extends CallExpression { + expression: SuperExpression; + } interface ExpressionWithTypeArguments extends TypeNode { + kind: SyntaxKind.ExpressionWithTypeArguments; expression: LeftHandSideExpression; typeArguments?: NodeArray; } - interface NewExpression extends CallExpression, PrimaryExpression { + interface NewExpression extends PrimaryExpression, Declaration { + kind: SyntaxKind.NewExpression; + expression: LeftHandSideExpression; + typeArguments?: NodeArray; + arguments: NodeArray; } interface TaggedTemplateExpression extends MemberExpression { + kind: SyntaxKind.TaggedTemplateExpression; tag: LeftHandSideExpression; - template: LiteralExpression | TemplateExpression; + template: TemplateLiteral; } type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator; interface AsExpression extends Expression { + kind: SyntaxKind.AsExpression; expression: Expression; type: TypeNode; } interface TypeAssertion extends UnaryExpression { + kind: SyntaxKind.TypeAssertionExpression; type: TypeNode; expression: UnaryExpression; } type AssertionExpression = TypeAssertion | AsExpression; interface NonNullExpression extends LeftHandSideExpression { + kind: SyntaxKind.NonNullExpression; expression: Expression; } interface JsxElement extends PrimaryExpression { + kind: SyntaxKind.JsxElement; openingElement: JsxOpeningElement; children: NodeArray; closingElement: JsxClosingElement; } type JsxTagNameExpression = PrimaryExpression | PropertyAccessExpression; interface JsxOpeningElement extends Expression { - _openingElementBrand?: any; + kind: SyntaxKind.JsxOpeningElement; tagName: JsxTagNameExpression; attributes: NodeArray; } - interface JsxSelfClosingElement extends PrimaryExpression, JsxOpeningElement { - _selfClosingElementBrand?: any; + interface JsxSelfClosingElement extends PrimaryExpression { + kind: SyntaxKind.JsxSelfClosingElement; + tagName: JsxTagNameExpression; + attributes: NodeArray; } type JsxOpeningLikeElement = JsxSelfClosingElement | JsxOpeningElement; + type JsxAttributeLike = JsxAttribute | JsxSpreadAttribute; interface JsxAttribute extends Node { + kind: SyntaxKind.JsxAttribute; name: Identifier; - initializer?: Expression; + initializer?: StringLiteral | JsxExpression; } interface JsxSpreadAttribute extends Node { + kind: SyntaxKind.JsxSpreadAttribute; expression: Expression; } interface JsxClosingElement extends Node { + kind: SyntaxKind.JsxClosingElement; tagName: JsxTagNameExpression; } interface JsxExpression extends Expression { + kind: SyntaxKind.JsxExpression; expression?: Expression; } interface JsxText extends Node { - _jsxTextExpressionBrand: any; + kind: SyntaxKind.JsxText; } type JsxChild = JsxText | JsxExpression | JsxElement | JsxSelfClosingElement; interface Statement extends Node { _statementBrand: any; } interface EmptyStatement extends Statement { + kind: SyntaxKind.EmptyStatement; } interface DebuggerStatement extends Statement { + kind: SyntaxKind.DebuggerStatement; } interface MissingDeclaration extends DeclarationStatement, ClassElement, ObjectLiteralElement, TypeElement { + kind: SyntaxKind.MissingDeclaration; name?: Identifier; } type BlockLike = SourceFile | Block | ModuleBlock | CaseClause; interface Block extends Statement { + kind: SyntaxKind.Block; statements: NodeArray; } interface VariableStatement extends Statement { + kind: SyntaxKind.VariableStatement; declarationList: VariableDeclarationList; } interface ExpressionStatement extends Statement { + kind: SyntaxKind.ExpressionStatement; expression: Expression; } interface IfStatement extends Statement { + kind: SyntaxKind.IfStatement; expression: Expression; thenStatement: Statement; elseStatement?: Statement; @@ -826,67 +1044,85 @@ declare namespace ts { statement: Statement; } interface DoStatement extends IterationStatement { + kind: SyntaxKind.DoStatement; expression: Expression; } interface WhileStatement extends IterationStatement { + kind: SyntaxKind.WhileStatement; expression: Expression; } + type ForInitializer = VariableDeclarationList | Expression; interface ForStatement extends IterationStatement { - initializer?: VariableDeclarationList | Expression; + kind: SyntaxKind.ForStatement; + initializer?: ForInitializer; condition?: Expression; incrementor?: Expression; } interface ForInStatement extends IterationStatement { - initializer: VariableDeclarationList | Expression; + kind: SyntaxKind.ForInStatement; + initializer: ForInitializer; expression: Expression; } interface ForOfStatement extends IterationStatement { - initializer: VariableDeclarationList | Expression; + kind: SyntaxKind.ForOfStatement; + initializer: ForInitializer; expression: Expression; } interface BreakStatement extends Statement { + kind: SyntaxKind.BreakStatement; label?: Identifier; } interface ContinueStatement extends Statement { + kind: SyntaxKind.ContinueStatement; label?: Identifier; } type BreakOrContinueStatement = BreakStatement | ContinueStatement; interface ReturnStatement extends Statement { + kind: SyntaxKind.ReturnStatement; expression?: Expression; } interface WithStatement extends Statement { + kind: SyntaxKind.WithStatement; expression: Expression; statement: Statement; } interface SwitchStatement extends Statement { + kind: SyntaxKind.SwitchStatement; expression: Expression; caseBlock: CaseBlock; possiblyExhaustive?: boolean; } interface CaseBlock extends Node { + kind: SyntaxKind.CaseBlock; clauses: NodeArray; } interface CaseClause extends Node { + kind: SyntaxKind.CaseClause; expression: Expression; statements: NodeArray; } interface DefaultClause extends Node { + kind: SyntaxKind.DefaultClause; statements: NodeArray; } type CaseOrDefaultClause = CaseClause | DefaultClause; interface LabeledStatement extends Statement { + kind: SyntaxKind.LabeledStatement; label: Identifier; statement: Statement; } interface ThrowStatement extends Statement { + kind: SyntaxKind.ThrowStatement; expression: Expression; } interface TryStatement extends Statement { + kind: SyntaxKind.TryStatement; tryBlock: Block; catchClause?: CatchClause; finallyBlock?: Block; } interface CatchClause extends Node { + kind: SyntaxKind.CatchClause; variableDeclaration: VariableDeclaration; block: Block; } @@ -898,9 +1134,11 @@ declare namespace ts { members: NodeArray; } interface ClassDeclaration extends ClassLikeDeclaration, DeclarationStatement { + kind: SyntaxKind.ClassDeclaration; name?: Identifier; } interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression { + kind: SyntaxKind.ClassExpression; } interface ClassElement extends Declaration { _classElementBrand: any; @@ -909,82 +1147,112 @@ declare namespace ts { interface TypeElement extends Declaration { _typeElementBrand: any; name?: PropertyName; - questionToken?: Node; + questionToken?: QuestionToken; } interface InterfaceDeclaration extends DeclarationStatement { + kind: SyntaxKind.InterfaceDeclaration; name: Identifier; typeParameters?: NodeArray; heritageClauses?: NodeArray; members: NodeArray; } interface HeritageClause extends Node { + kind: SyntaxKind.HeritageClause; token: SyntaxKind; types?: NodeArray; } interface TypeAliasDeclaration extends DeclarationStatement { + kind: SyntaxKind.TypeAliasDeclaration; name: Identifier; typeParameters?: NodeArray; type: TypeNode; } interface EnumMember extends Declaration { - name: DeclarationName; + kind: SyntaxKind.EnumMember; + name: PropertyName; initializer?: Expression; } interface EnumDeclaration extends DeclarationStatement { + kind: SyntaxKind.EnumDeclaration; name: Identifier; members: NodeArray; } type ModuleBody = ModuleBlock | ModuleDeclaration; + type ModuleName = Identifier | StringLiteral; interface ModuleDeclaration extends DeclarationStatement { - name: Identifier | LiteralExpression; - body?: ModuleBlock | ModuleDeclaration; + kind: SyntaxKind.ModuleDeclaration; + name: Identifier | StringLiteral; + body?: ModuleBlock | NamespaceDeclaration | JSDocNamespaceDeclaration | Identifier; + } + interface NamespaceDeclaration extends ModuleDeclaration { + name: Identifier; + body: ModuleBlock | NamespaceDeclaration; + } + interface JSDocNamespaceDeclaration extends ModuleDeclaration { + name: Identifier; + body: JSDocNamespaceDeclaration | Identifier; } interface ModuleBlock extends Node, Statement { + kind: SyntaxKind.ModuleBlock; statements: NodeArray; } + type ModuleReference = EntityName | ExternalModuleReference; interface ImportEqualsDeclaration extends DeclarationStatement { + kind: SyntaxKind.ImportEqualsDeclaration; name: Identifier; - moduleReference: EntityName | ExternalModuleReference; + moduleReference: ModuleReference; } interface ExternalModuleReference extends Node { + kind: SyntaxKind.ExternalModuleReference; expression?: Expression; } interface ImportDeclaration extends Statement { + kind: SyntaxKind.ImportDeclaration; importClause?: ImportClause; moduleSpecifier: Expression; } + type NamedImportBindings = NamespaceImport | NamedImports; interface ImportClause extends Declaration { + kind: SyntaxKind.ImportClause; name?: Identifier; - namedBindings?: NamespaceImport | NamedImports; + namedBindings?: NamedImportBindings; } interface NamespaceImport extends Declaration { + kind: SyntaxKind.NamespaceImport; name: Identifier; } interface NamespaceExportDeclaration extends DeclarationStatement { + kind: SyntaxKind.NamespaceExportDeclaration; name: Identifier; moduleReference: LiteralLikeNode; } interface ExportDeclaration extends DeclarationStatement { + kind: SyntaxKind.ExportDeclaration; exportClause?: NamedExports; moduleSpecifier?: Expression; } interface NamedImports extends Node { + kind: SyntaxKind.NamedImports; elements: NodeArray; } interface NamedExports extends Node { + kind: SyntaxKind.NamedExports; elements: NodeArray; } type NamedImportsOrExports = NamedImports | NamedExports; interface ImportSpecifier extends Declaration { + kind: SyntaxKind.ImportSpecifier; propertyName?: Identifier; name: Identifier; } interface ExportSpecifier extends Declaration { + kind: SyntaxKind.ExportSpecifier; propertyName?: Identifier; name: Identifier; } type ImportOrExportSpecifier = ImportSpecifier | ExportSpecifier; interface ExportAssignment extends DeclarationStatement { + kind: SyntaxKind.ExportAssignment; isExportEquals?: boolean; expression: Expression; } @@ -996,96 +1264,133 @@ declare namespace ts { kind: SyntaxKind; } interface JSDocTypeExpression extends Node { + kind: SyntaxKind.JSDocTypeExpression; type: JSDocType; } interface JSDocType extends TypeNode { _jsDocTypeBrand: any; } interface JSDocAllType extends JSDocType { - _JSDocAllTypeBrand: any; + kind: SyntaxKind.JSDocAllType; } interface JSDocUnknownType extends JSDocType { - _JSDocUnknownTypeBrand: any; + kind: SyntaxKind.JSDocUnknownType; } interface JSDocArrayType extends JSDocType { + kind: SyntaxKind.JSDocArrayType; elementType: JSDocType; } interface JSDocUnionType extends JSDocType { + kind: SyntaxKind.JSDocUnionType; types: NodeArray; } interface JSDocTupleType extends JSDocType { + kind: SyntaxKind.JSDocTupleType; types: NodeArray; } interface JSDocNonNullableType extends JSDocType { + kind: SyntaxKind.JSDocNonNullableType; type: JSDocType; } interface JSDocNullableType extends JSDocType { + kind: SyntaxKind.JSDocNullableType; type: JSDocType; } - interface JSDocRecordType extends JSDocType, TypeLiteralNode { - members: NodeArray; + interface JSDocRecordType extends JSDocType { + kind: SyntaxKind.JSDocRecordType; + literal: TypeLiteralNode; } interface JSDocTypeReference extends JSDocType { + kind: SyntaxKind.JSDocTypeReference; name: EntityName; typeArguments: NodeArray; } interface JSDocOptionalType extends JSDocType { + kind: SyntaxKind.JSDocOptionalType; type: JSDocType; } interface JSDocFunctionType extends JSDocType, SignatureDeclaration { + kind: SyntaxKind.JSDocFunctionType; parameters: NodeArray; type: JSDocType; } interface JSDocVariadicType extends JSDocType { + kind: SyntaxKind.JSDocVariadicType; type: JSDocType; } interface JSDocConstructorType extends JSDocType { + kind: SyntaxKind.JSDocConstructorType; type: JSDocType; } interface JSDocThisType extends JSDocType { + kind: SyntaxKind.JSDocThisType; type: JSDocType; } interface JSDocLiteralType extends JSDocType { + kind: SyntaxKind.JSDocLiteralType; literal: LiteralTypeNode; } type JSDocTypeReferencingNode = JSDocThisType | JSDocConstructorType | JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType; interface JSDocRecordMember extends PropertySignature { - name: Identifier | LiteralExpression; + kind: SyntaxKind.JSDocRecordMember; + name: Identifier | StringLiteral | NumericLiteral; type?: JSDocType; } - interface JSDocComment extends Node { - tags: NodeArray; + interface JSDoc extends Node { + kind: SyntaxKind.JSDocComment; + tags: NodeArray | undefined; + comment: string | undefined; } interface JSDocTag extends Node { - atToken: Node; + atToken: AtToken; tagName: Identifier; + comment: string | undefined; + } + 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; } interface JSDocReturnTag extends JSDocTag { + kind: SyntaxKind.JSDocReturnTag; typeExpression: JSDocTypeExpression; } interface JSDocTypeTag extends JSDocTag { + kind: SyntaxKind.JSDocTypeTag; typeExpression: JSDocTypeExpression; } interface JSDocTypedefTag extends JSDocTag, Declaration { + kind: SyntaxKind.JSDocTypedefTag; + fullName?: JSDocNamespaceDeclaration | Identifier; name?: Identifier; typeExpression?: JSDocTypeExpression; jsDocTypeLiteral?: JSDocTypeLiteral; } interface JSDocPropertyTag extends JSDocTag, TypeElement { + kind: SyntaxKind.JSDocPropertyTag; name: Identifier; typeExpression: JSDocTypeExpression; } interface JSDocTypeLiteral extends JSDocType { + kind: SyntaxKind.JSDocTypeLiteral; jsDocPropertyTags?: NodeArray; jsDocTypeTag?: JSDocTypeTag; } interface JSDocParameterTag extends JSDocTag { + kind: SyntaxKind.JSDocParameterTag; + /** the parameter name, if provided *before* the type (TypeScript-style) */ preParameterName?: Identifier; typeExpression?: JSDocTypeExpression; + /** the parameter name, if provided *after* the type (JSDoc-standard) */ postParameterName?: Identifier; + /** the parameter name, regardless of the location it was provided */ + parameterName: Identifier; isBracketed: boolean; } enum FlowFlags { @@ -1097,8 +1402,9 @@ declare namespace ts { TrueCondition = 32, FalseCondition = 64, SwitchClause = 128, - Referenced = 256, - Shared = 512, + ArrayMutation = 256, + Referenced = 512, + Shared = 1024, Label = 12, Condition = 96, } @@ -1107,7 +1413,7 @@ declare namespace ts { id?: number; } interface FlowStart extends FlowNode { - container?: FunctionExpression | ArrowFunction; + container?: FunctionExpression | ArrowFunction | MethodDeclaration; } interface FlowLabel extends FlowNode { antecedents: FlowNode[]; @@ -1126,6 +1432,10 @@ declare namespace ts { clauseEnd: number; antecedent: FlowNode; } + interface FlowArrayMutation extends FlowNode { + node: CallExpression | BinaryExpression; + antecedent: FlowNode; + } type FlowType = Type | IncompleteType; interface IncompleteType { flags: TypeFlags; @@ -1136,8 +1446,9 @@ declare namespace ts { name: string; } interface SourceFile extends Declaration { + kind: SyntaxKind.SourceFile; statements: NodeArray; - endOfFileToken: Node; + endOfFileToken: Token; fileName: string; path: Path; text: string; @@ -1172,6 +1483,7 @@ declare namespace ts { * @param path The path to test. */ fileExists(path: string): boolean; + readFile(path: string): string; } interface WriteFileCallback { (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void, sourceFiles?: SourceFile[]): void; @@ -1202,7 +1514,7 @@ declare namespace ts { * used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter * will be invoked when writing the JavaScript and declaration files. */ - emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken): EmitResult; + emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean): EmitResult; getOptionsDiagnostics(cancellationToken?: CancellationToken): Diagnostic[]; getGlobalDiagnostics(cancellationToken?: CancellationToken): Diagnostic[]; getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; @@ -1288,6 +1600,8 @@ declare namespace ts { getJsxElementAttributesType(elementNode: JsxOpeningLikeElement): Type; 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; @@ -1308,6 +1622,7 @@ declare namespace ts { writeSpace(text: string): void; writeStringLiteral(text: string): void; writeParameter(text: string): void; + writeProperty(text: string): void; writeSymbol(text: string, symbol: Symbol): void; writeLine(): void; increaseIndent(): void; @@ -1344,9 +1659,10 @@ declare namespace ts { type: Type; } interface ThisTypePredicate extends TypePredicateBase { - _thisTypePredicateBrand: any; + kind: TypePredicateKind.This; } interface IdentifierTypePredicate extends TypePredicateBase { + kind: TypePredicateKind.Identifier; parameterName: string; parameterIndex: number; } @@ -1444,28 +1760,24 @@ declare namespace ts { Null = 4096, Never = 8192, TypeParameter = 16384, - Class = 32768, - Interface = 65536, - Reference = 131072, - Tuple = 262144, - Union = 524288, - Intersection = 1048576, - Anonymous = 2097152, - Instantiated = 4194304, - ThisType = 268435456, - ObjectLiteralPatternWithComputedProperties = 536870912, + Object = 32768, + Union = 65536, + Intersection = 131072, + Index = 262144, + IndexedAccess = 524288, Literal = 480, + StringOrNumberLiteral = 96, PossiblyFalsy = 7406, - StringLike = 34, + StringLike = 262178, NumberLike = 340, BooleanLike = 136, EnumLike = 272, - ObjectType = 2588672, - UnionOrIntersection = 1572864, - StructuredType = 4161536, - StructuredOrTypeParameter = 4177920, - Narrowable = 4178943, - NotUnionOrUnit = 2589191, + UnionOrIntersection = 196608, + StructuredType = 229376, + StructuredOrTypeParameter = 507904, + TypeVariable = 540672, + Narrowable = 1033215, + NotUnionOrUnit = 33281, } type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; interface Type { @@ -1477,6 +1789,8 @@ declare namespace ts { } interface LiteralType extends Type { text: string; + freshType?: LiteralType; + regularType?: LiteralType; } interface EnumType extends Type { memberTypes: Map; @@ -1484,7 +1798,21 @@ declare namespace ts { interface EnumLiteralType extends LiteralType { baseType: EnumType & UnionType; } + enum ObjectFlags { + Class = 1, + Interface = 2, + Reference = 4, + Tuple = 8, + Anonymous = 16, + Mapped = 32, + Instantiated = 64, + ObjectLiteral = 128, + EvolvingArray = 256, + ObjectLiteralPatternWithComputedProperties = 512, + ClassOrInterface = 3, + } interface ObjectType extends Type { + objectFlags: ObjectFlags; } interface InterfaceType extends ObjectType { typeParameters: TypeParameter[]; @@ -1512,9 +1840,24 @@ declare namespace ts { } interface IntersectionType extends UnionOrIntersectionType { } - interface TypeParameter extends Type { + type StructuredType = ObjectType | UnionType | IntersectionType; + interface EvolvingArrayType extends ObjectType { + elementType: Type; + finalArrayType?: Type; + } + interface TypeVariable extends Type { + } + interface TypeParameter extends TypeVariable { constraint: Type; } + interface IndexedAccessType extends TypeVariable { + objectType: Type; + indexType: Type; + constraint?: Type; + } + interface IndexType extends Type { + type: TypeVariable | UnionOrIntersectionType; + } enum SignatureKind { Call = 0, Construct = 1, @@ -1533,6 +1876,11 @@ declare namespace ts { isReadonly: boolean; declaration?: SignatureDeclaration; } + interface FileExtensionInfo { + extension: string; + scriptKind: ScriptKind; + isMixedContent: boolean; + } interface DiagnosticMessage { key: string; category: DiagnosticCategory; @@ -1568,15 +1916,13 @@ declare namespace ts { Classic = 1, NodeJs = 2, } - type RootPaths = string[]; - type PathSubstitutions = MapLike; - type TsConfigOnlyOptions = RootPaths | PathSubstitutions; - type CompilerOptionsValue = string | number | boolean | (string | number)[] | TsConfigOnlyOptions; + type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike; interface CompilerOptions { allowJs?: boolean; allowSyntheticDefaultImports?: boolean; allowUnreachableCode?: boolean; allowUnusedLabels?: boolean; + alwaysStrict?: boolean; baseUrl?: string; charset?: string; declaration?: boolean; @@ -1586,6 +1932,7 @@ declare namespace ts { emitDecoratorMetadata?: boolean; experimentalDecorators?: boolean; forceConsistentCasingInFileNames?: boolean; + importHelpers?: boolean; inlineSourceMap?: boolean; inlineSources?: boolean; isolatedModules?: boolean; @@ -1613,13 +1960,14 @@ declare namespace ts { out?: string; outDir?: string; outFile?: string; - paths?: PathSubstitutions; + paths?: MapLike; preserveConstEnums?: boolean; project?: string; reactNamespace?: string; + jsxFactory?: string; removeComments?: boolean; rootDir?: string; - rootDirs?: RootPaths; + rootDirs?: string[]; skipLibCheck?: boolean; skipDefaultLibCheck?: boolean; sourceMap?: boolean; @@ -1630,12 +1978,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; @@ -1645,8 +1994,9 @@ declare namespace ts { projectRootPath: string; safeListPath: string; packageNameToTypingLocation: Map; - typingOptions: TypingOptions; + typeAcquisition: TypeAcquisition; compilerOptions: CompilerOptions; + unresolvedImports: ReadonlyArray; } enum ModuleKind { None = 0, @@ -1654,7 +2004,6 @@ declare namespace ts { AMD = 2, UMD = 3, System = 4, - ES6 = 5, ES2015 = 5, } enum JsxEmit { @@ -1680,21 +2029,25 @@ declare namespace ts { enum ScriptTarget { ES3 = 0, ES5 = 1, - ES6 = 2, ES2015 = 2, - Latest = 2, + ES2016 = 3, + ES2017 = 4, + ESNext = 5, + Latest = 5, } enum LanguageVariant { Standard = 0, JSX = 1, } + /** Either a parsed command line or a parsed tsconfig.json */ interface ParsedCommandLine { options: CompilerOptions; - typingOptions?: TypingOptions; + typeAcquisition?: TypeAcquisition; fileNames: string[]; raw?: any; errors: Diagnostic[]; wildcardDirectories?: MapLike; + compileOnSave?: boolean; } enum WatchDirectoryFlags { None = 0, @@ -1713,12 +2066,45 @@ declare namespace ts { getCurrentDirectory?(): string; getDirectories?(path: string): string[]; } + /** + * Represents the result of module resolution. + * Module resolution will pick up tsx/jsx/js files even if '--jsx' and '--allowJs' are turned off. + * The Program will then filter results based on these flags. + * + * Prefer to return a `ResolvedModuleFull` so that the file type does not have to be inferred. + */ interface ResolvedModule { + /** Path of the file the module was resolved to. */ resolvedFileName: string; + /** + * Denotes if 'resolvedFileName' is isExternalLibraryImport and thus should be a proper external module: + * - be a .d.ts file + * - use top level imports\exports + * - don't use tripleslash references + */ isExternalLibraryImport?: boolean; } + /** + * ResolvedModule with an explicitly provided `extension` property. + * Prefer this over `ResolvedModule`. + */ + interface ResolvedModuleFull extends ResolvedModule { + /** + * Extension of resolvedFileName. This must match what's at the end of resolvedFileName. + * This is optional for backwards-compatibility, but will be added if not provided. + */ + extension: Extension; + } + enum Extension { + Ts = 0, + Tsx = 1, + Dts = 2, + Js = 3, + Jsx = 4, + LastTypeScriptExtension = 2, + } interface ResolvedModuleWithFailedLookupLocations { - resolvedModule: ResolvedModule; + resolvedModule: ResolvedModuleFull | undefined; failedLookupLocations: string[]; } interface ResolvedTypeReferenceDirective { @@ -1746,6 +2132,7 @@ declare namespace ts { * This method is a companion for 'resolveModuleNames' and is used to resolve 'types' references to actual type declaration files */ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; + getEnvironmentVariable?(name: string): string; } interface TextSpan { start: number; @@ -1759,6 +2146,10 @@ declare namespace ts { _children: Node[]; } } +declare namespace ts { + /** The version of the TypeScript compiler release */ + const version = "2.1.5"; +} declare namespace ts { type FileWatcherCallback = (fileName: string, removed?: boolean) => void; type DirectoryWatcherCallback = (fileName: string) => void; @@ -1775,7 +2166,11 @@ declare namespace ts { readFile(path: string, encoding?: string): string; getFileSize?(path: string): number; writeFile(path: string, data: string, writeByteOrderMark?: boolean): void; - watchFile?(path: string, callback: FileWatcherCallback): FileWatcher; + /** + * @pollingInterval - this parameter is used in polling-based watchers and ignored in watchers that + * use native OS file watching + */ + watchFile?(path: string, callback: FileWatcherCallback, pollingInterval?: number): FileWatcher; watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher; resolvePath(path: string): string; fileExists(path: string): boolean; @@ -1790,6 +2185,8 @@ declare namespace ts { getMemoryUsage?(): number; exit(exitCode?: number): void; realpath?(path: string): string; + setTimeout?(callback: (...args: any[]) => void, ms: number, ...args: any[]): any; + clearTimeout?(timeoutId: any): void; } interface FileWatcher { close(): void; @@ -1798,7 +2195,7 @@ declare namespace ts { directoryName: string; referenceCount: number; } - var sys: System; + let sys: System; } declare namespace ts { interface ErrorCallback { @@ -1820,6 +2217,7 @@ declare namespace ts { reScanSlashToken(): SyntaxKind; reScanTemplateToken(): SyntaxKind; scanJsxIdentifier(): SyntaxKind; + scanJsxAttributeValue(): SyntaxKind; reScanJsxToken(): SyntaxKind; scanJsxToken(): SyntaxKind; scanJSDocToken(): SyntaxKind; @@ -1842,6 +2240,10 @@ declare namespace ts { function isWhiteSpaceSingleLine(ch: number): boolean; function isLineBreak(ch: number): boolean; function couldStartTrivia(text: string, pos: number): boolean; + function forEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T) => U, state?: T): U; + function forEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T) => U, state?: T): U; + function reduceEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U; + function reduceEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: SyntaxKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U; function getLeadingCommentRanges(text: string, pos: number): CommentRange[]; function getTrailingCommentRanges(text: string, pos: number): CommentRange[]; /** Optionally, get the shebang */ @@ -1879,38 +2281,40 @@ 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; function forEachChild(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T; function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean, scriptKind?: ScriptKind): SourceFile; + function parseIsolatedEntityName(text: string, languageVersion: ScriptTarget): EntityName; function isExternalModule(file: SourceFile): boolean; function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; } declare namespace ts { - /** The version of the TypeScript compiler release */ - const version: string; - function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean): string; - function resolveTripleslashReference(moduleName: string, containingFile: string): string; + function moduleHasNonRelativeName(moduleName: string): boolean; + function getEffectiveTypeRoots(options: CompilerOptions, host: { + directoryExists?: (directoryName: string) => boolean; + getCurrentDirectory?: () => string; + }): string[] | undefined; /** * @param {string | undefined} containingFile - file that contains type reference directive, can be undefined if containing file is unknown. * This is possible in case if resolution is performed for directives specified via 'types' parameter. In this case initial path for secondary lookups * is assumed to be the same as root directory of the project. */ - function resolveTypeReferenceDirective(typeReferenceDirectiveName: string, containingFile: string, options: CompilerOptions, host: ModuleResolutionHost): ResolvedTypeReferenceDirectiveWithFailedLookupLocations; - function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; - function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; - function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations; - function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost; - function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; - interface FormatDiagnosticsHost { - getCurrentDirectory(): string; - getCanonicalFileName(fileName: string): string; - getNewLine(): string; - } - function formatDiagnostics(diagnostics: Diagnostic[], host: FormatDiagnosticsHost): string; - function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; + function resolveTypeReferenceDirective(typeReferenceDirectiveName: string, containingFile: string | undefined, options: CompilerOptions, host: ModuleResolutionHost): ResolvedTypeReferenceDirectiveWithFailedLookupLocations; /** * Given a set of options, returns the set of type directive names * that should be included for this program automatically. @@ -1920,9 +2324,45 @@ declare namespace ts { * this list is only the set of defaults that are implicitly included. */ function getAutomaticTypeDirectiveNames(options: CompilerOptions, host: ModuleResolutionHost): string[]; + /** + * Cached module resolutions per containing directory. + * This assumes that any module id will have the same resolution for sibling files located in the same folder. + */ + interface ModuleResolutionCache extends NonRelativeModuleNameResolutionCache { + getOrCreateCacheForDirectory(directoryName: string): Map; + } + /** + * Stored map from non-relative module name to a table: directory -> result of module lookup in this directory + * We support only non-relative module names because resolution of relative module names is usually more deterministic and thus less expensive. + */ + interface NonRelativeModuleNameResolutionCache { + getOrCreateCacheForModuleName(nonRelativeModuleName: string): PerModuleNameCache; + } + interface PerModuleNameCache { + get(directory: string): ResolvedModuleWithFailedLookupLocations; + set(directory: string, result: ResolvedModuleWithFailedLookupLocations): void; + } + function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string): ModuleResolutionCache; + function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations; + function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations; + function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: NonRelativeModuleNameResolutionCache): ResolvedModuleWithFailedLookupLocations; +} +declare namespace ts { + 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; + function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; + interface FormatDiagnosticsHost { + getCurrentDirectory(): string; + getCanonicalFileName(fileName: string): string; + getNewLine(): string; + } + function formatDiagnostics(diagnostics: Diagnostic[], host: FormatDiagnosticsHost): string; + function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program; } declare namespace ts { + function parseCommandLine(commandLine: string[], readFile?: (path: string) => string): ParsedCommandLine; /** * Read tsconfig.json file * @param fileName The path to the config file @@ -1936,7 +2376,7 @@ declare namespace ts { * @param fileName The path to the config file * @param jsonText The text of the config file */ - function parseConfigFileTextToJson(fileName: string, jsonText: string): { + function parseConfigFileTextToJson(fileName: string, jsonText: string, stripComments?: boolean): { config?: any; error?: Diagnostic; }; @@ -1947,19 +2387,18 @@ declare namespace ts { * @param basePath A root directory to resolve relative path entries in the config * file to. e.g. outDir */ - function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string): ParsedCommandLine; + function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: FileExtensionInfo[]): ParsedCommandLine; + function convertCompileOnSaveOptionFromJson(jsonOption: any, basePath: string, errors: Diagnostic[]): boolean; function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { options: CompilerOptions; errors: Diagnostic[]; }; - function convertTypingOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { - options: CompilerOptions; + function convertTypeAcquisitionFromJson(jsonOptions: any, basePath: string, configFileName?: string): { + options: TypeAcquisition; errors: Diagnostic[]; }; } declare namespace ts { - /** The version of the language service API */ - const servicesVersion: string; interface Node { getSourceFile(): SourceFile; getChildCount(sourceFile?: SourceFile): number; @@ -1981,6 +2420,7 @@ declare namespace ts { getName(): string; getDeclarations(): Declaration[]; getDocumentationComment(): SymbolDisplayPart[]; + getJsDocTags(): JSDocTagInfo[]; } interface Type { getFlags(): TypeFlags; @@ -2001,9 +2441,11 @@ declare namespace ts { getParameters(): Symbol[]; getReturnType(): Type; getDocumentationComment(): SymbolDisplayPart[]; + getJsDocTags(): JSDocTagInfo[]; } interface SourceFile { getLineAndCharacterOfPosition(pos: number): LineAndCharacter; + getLineEndOfPosition(pos: number): number; getLineStarts(): number[]; getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; @@ -2058,6 +2500,10 @@ declare namespace ts { trace?(s: string): void; error?(s: string): void; useCaseSensitiveFileNames?(): boolean; + readDirectory?(path: string, extensions?: string[], exclude?: string[], include?: string[]): string[]; + readFile?(path: string, encoding?: string): string; + fileExists?(path: string): boolean; + getTypeRootsVersion?(): number; resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[]; resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; directoryExists?(directoryName: string): boolean; @@ -2080,6 +2526,7 @@ declare namespace ts { getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications; getCompletionsAtPosition(fileName: string, position: number): CompletionInfo; getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails; + getCompletionEntrySymbol(fileName: string, position: number, entryName: string): Symbol; getQuickInfoAtPosition(fileName: string, position: number): QuickInfo; getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan; getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan; @@ -2088,23 +2535,26 @@ declare namespace ts { findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[]; getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; getTypeDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; + getImplementationAtPosition(fileName: string, position: number): ImplementationLocation[]; getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; findReferences(fileName: string, position: number): ReferencedSymbol[]; getDocumentHighlights(fileName: string, position: number, filesToSearch: string[]): DocumentHighlights[]; /** @deprecated */ getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; - getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; + getNavigateToItems(searchValue: string, maxResultCount?: number, fileName?: string, excludeDtsFiles?: boolean): NavigateToItem[]; getNavigationBarItems(fileName: string): NavigationBarItem[]; + getNavigationTree(fileName: string): NavigationTree; getOutliningSpans(fileName: string): OutliningSpan[]; getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[]; - getIndentationAtPosition(fileName: string, position: number, options: EditorOptions): number; - getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions): TextChange[]; - getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions): TextChange[]; - getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): TextChange[]; + getIndentationAtPosition(fileName: string, position: number, options: EditorOptions | EditorSettings): number; + getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions | FormatCodeSettings): TextChange[]; + getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[]; + getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[]; getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion; isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean; - getEmitOutput(fileName: string): EmitOutput; + getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[]): CodeAction[]; + getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean): EmitOutput; getProgram(): Program; dispose(): void; } @@ -2116,6 +2566,12 @@ declare namespace ts { textSpan: TextSpan; classificationType: string; } + /** + * Navigation bar interface designed for visual studio's dual-column layout. + * This does not form a proper tree. + * The navbar is returned as a list of top-level items, each of which has a list of child items. + * Child items always have an empty array for their `childItems`. + */ interface NavigationBarItem { text: string; kind: string; @@ -2126,6 +2582,25 @@ declare namespace ts { bolded: boolean; grayed: boolean; } + /** + * Node in a tree of nested declarations in a file. + * The top node is always a script or module node. + */ + interface NavigationTree { + /** Name of the declaration, or a short description, e.g. "". */ + text: string; + /** A ScriptElementKind */ + kind: string; + /** ScriptElementKindModifier separated by commas, e.g. "public,abstract" */ + kindModifiers: string; + /** + * Spans of the nodes that generated this declaration. + * There will be more than one if this is the result of merging. + */ + spans: TextSpan[]; + /** Present if non-empty */ + childItems?: NavigationTree[]; + } interface TodoCommentDescriptor { text: string; priority: number; @@ -2139,6 +2614,16 @@ declare namespace ts { span: TextSpan; newText: string; } + interface FileTextChanges { + fileName: string; + textChanges: TextChange[]; + } + interface CodeAction { + /** Description of the code action to display in the UI of the editor */ + description: string; + /** Text changes to apply to each file as part of the code action */ + changes: FileTextChanges[]; + } interface TextInsertion { newText: string; /** The position in newText the caret should point to after the insertion. */ @@ -2154,15 +2639,19 @@ declare namespace ts { isWriteAccess: boolean; isDefinition: boolean; } + interface ImplementationLocation { + textSpan: TextSpan; + fileName: string; + } interface DocumentHighlights { fileName: string; highlightSpans: HighlightSpan[]; } namespace HighlightSpanKind { - const none: string; - const definition: string; - const reference: string; - const writtenReference: string; + const none = "none"; + const definition = "definition"; + const reference = "reference"; + const writtenReference = "writtenReference"; } interface HighlightSpan { fileName?: string; @@ -2180,6 +2669,11 @@ declare namespace ts { containerName: string; containerKind: string; } + enum IndentStyle { + None = 0, + Block = 1, + Smart = 2, + } interface EditorOptions { BaseIndentSize?: number; IndentSize: number; @@ -2188,24 +2682,47 @@ declare namespace ts { ConvertTabsToSpaces: boolean; IndentStyle: IndentStyle; } - enum IndentStyle { - None = 0, - Block = 1, - Smart = 2, + interface EditorSettings { + baseIndentSize?: number; + indentSize?: number; + tabSize?: number; + newLineCharacter?: string; + convertTabsToSpaces?: boolean; + indentStyle?: IndentStyle; } interface FormatCodeOptions extends EditorOptions { InsertSpaceAfterCommaDelimiter: boolean; InsertSpaceAfterSemicolonInForStatements: boolean; InsertSpaceBeforeAndAfterBinaryOperators: boolean; + InsertSpaceAfterConstructor?: boolean; InsertSpaceAfterKeywordsInControlFlowStatements: boolean; InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean; InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: boolean; + InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces?: boolean; InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: boolean; InsertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean; + InsertSpaceAfterTypeAssertion?: boolean; + InsertSpaceBeforeFunctionParenthesis?: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; - [s: string]: boolean | number | string | undefined; + } + interface FormatCodeSettings extends EditorSettings { + insertSpaceAfterCommaDelimiter?: boolean; + insertSpaceAfterSemicolonInForStatements?: boolean; + insertSpaceBeforeAndAfterBinaryOperators?: boolean; + insertSpaceAfterConstructor?: boolean; + insertSpaceAfterKeywordsInControlFlowStatements?: boolean; + insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean; + insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean; + insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean; + insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces?: boolean; + insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean; + insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean; + insertSpaceAfterTypeAssertion?: boolean; + insertSpaceBeforeFunctionParenthesis?: boolean; + placeOpenBraceOnNewLineForFunctions?: boolean; + placeOpenBraceOnNewLineForControlBlocks?: boolean; } interface DefinitionInfo { fileName: string; @@ -2215,8 +2732,11 @@ declare namespace ts { containerKind: string; containerName: string; } + interface ReferencedSymbolDefinitionInfo extends DefinitionInfo { + displayParts: SymbolDisplayPart[]; + } interface ReferencedSymbol { - definition: DefinitionInfo; + definition: ReferencedSymbolDefinitionInfo; references: ReferenceEntry[]; } enum SymbolDisplayPartKind { @@ -2247,12 +2767,17 @@ declare namespace ts { text: string; kind: string; } + interface JSDocTagInfo { + name: string; + text?: string; + } interface QuickInfo { kind: string; kindModifiers: string; textSpan: TextSpan; displayParts: SymbolDisplayPart[]; documentation: SymbolDisplayPart[]; + tags: JSDocTagInfo[]; } interface RenameInfo { canRename: boolean; @@ -2283,6 +2808,7 @@ declare namespace ts { separatorDisplayParts: SymbolDisplayPart[]; parameters: SignatureHelpParameter[]; documentation: SymbolDisplayPart[]; + tags: JSDocTagInfo[]; } /** * Represents a set of signature help items, and the preferred item that should be selected. @@ -2295,7 +2821,11 @@ declare namespace ts { argumentCount: number; } interface CompletionInfo { + isGlobalCompletion: boolean; isMemberCompletion: boolean; + /** + * true when the current location also allows for a new identifier + */ isNewIdentifierLocation: boolean; entries: CompletionEntry[]; } @@ -2304,6 +2834,12 @@ declare namespace ts { kind: string; kindModifiers: string; sortText: string; + /** + * An optional span that indicates the text to be replaced by this completion item. It will be + * set if the required span differs from the one generated by the default replacement behavior and should + * be used in that case + */ + replacementSpan?: TextSpan; } interface CompletionEntryDetails { name: string; @@ -2311,6 +2847,7 @@ declare namespace ts { kindModifiers: string; displayParts: SymbolDisplayPart[]; documentation: SymbolDisplayPart[]; + tags: JSDocTagInfo[]; } interface OutliningSpan { /** The span of the document to actually collapse. */ @@ -2391,6 +2928,135 @@ declare namespace ts { getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult; getEncodedLexicalClassifications(text: string, endOfLineState: EndOfLineState, syntacticClassifierAbsent: boolean): Classifications; } + namespace ScriptElementKind { + const unknown = ""; + const warning = "warning"; + /** predefined type (void) or keyword (class) */ + const keyword = "keyword"; + /** top level script node */ + const scriptElement = "script"; + /** module foo {} */ + const moduleElement = "module"; + /** class X {} */ + const classElement = "class"; + /** var x = class X {} */ + const localClassElement = "local class"; + /** interface Y {} */ + const interfaceElement = "interface"; + /** type T = ... */ + const typeElement = "type"; + /** enum E */ + const enumElement = "enum"; + const enumMemberElement = "const"; + /** + * Inside module and script only + * const v = .. + */ + const variableElement = "var"; + /** Inside function */ + const localVariableElement = "local var"; + /** + * Inside module and script only + * function f() { } + */ + const functionElement = "function"; + /** Inside function */ + const localFunctionElement = "local function"; + /** class X { [public|private]* foo() {} } */ + const memberFunctionElement = "method"; + /** class X { [public|private]* [get|set] foo:number; } */ + const memberGetAccessorElement = "getter"; + const memberSetAccessorElement = "setter"; + /** + * class X { [public|private]* foo:number; } + * interface Y { foo:number; } + */ + const memberVariableElement = "property"; + /** class X { constructor() { } } */ + const constructorImplementationElement = "constructor"; + /** interface Y { ():number; } */ + const callSignatureElement = "call"; + /** interface Y { []:number; } */ + const indexSignatureElement = "index"; + /** interface Y { new():Y; } */ + const constructSignatureElement = "construct"; + /** function foo(*Y*: string) */ + const parameterElement = "parameter"; + const typeParameterElement = "type parameter"; + const primitiveType = "primitive type"; + const label = "label"; + const alias = "alias"; + const constElement = "const"; + const letElement = "let"; + const directory = "directory"; + const externalModuleName = "external module name"; + } + namespace ScriptElementKindModifier { + const none = ""; + const publicMemberModifier = "public"; + const privateMemberModifier = "private"; + const protectedMemberModifier = "protected"; + const exportedModifier = "export"; + const ambientModifier = "declare"; + const staticModifier = "static"; + const abstractModifier = "abstract"; + } + class ClassificationTypeNames { + static comment: string; + static identifier: string; + static keyword: string; + static numericLiteral: string; + static operator: string; + static stringLiteral: string; + static whiteSpace: string; + static text: string; + static punctuation: string; + static className: string; + static enumName: string; + static interfaceName: string; + static moduleName: string; + static typeParameterName: string; + static typeAliasName: string; + static parameterName: string; + static docCommentTagName: string; + static jsxOpenTagName: string; + static jsxCloseTagName: string; + static jsxSelfClosingTagName: string; + static jsxAttribute: string; + static jsxText: string; + static jsxAttributeStringLiteralValue: string; + } + enum ClassificationType { + comment = 1, + identifier = 2, + keyword = 3, + numericLiteral = 4, + operator = 5, + stringLiteral = 6, + regularExpressionLiteral = 7, + whiteSpace = 8, + text = 9, + punctuation = 10, + className = 11, + enumName = 12, + interfaceName = 13, + moduleName = 14, + typeParameterName = 15, + typeAliasName = 16, + parameterName = 17, + docCommentTagName = 18, + jsxOpenTagName = 19, + jsxCloseTagName = 20, + jsxSelfClosingTagName = 21, + jsxAttribute = 22, + jsxText = 23, + jsxAttributeStringLiteralValue = 24, + } +} +declare namespace ts { + function createClassifier(): Classifier; +} +declare namespace ts { /** * The document registry represents a store of SourceFile objects that can be shared between * multiple LanguageService instances. A LanguageService instance holds on the SourceFile (AST) @@ -2454,133 +3120,12 @@ declare namespace ts { type DocumentRegistryBucketKey = string & { __bucketKey: any; }; - namespace ScriptElementKind { - const unknown: string; - const warning: string; - /** predefined type (void) or keyword (class) */ - const keyword: string; - /** top level script node */ - const scriptElement: string; - /** module foo {} */ - const moduleElement: string; - /** class X {} */ - const classElement: string; - /** var x = class X {} */ - const localClassElement: string; - /** interface Y {} */ - const interfaceElement: string; - /** type T = ... */ - const typeElement: string; - /** enum E */ - const enumElement: string; - const enumMemberElement: string; - /** - * Inside module and script only - * const v = .. - */ - const variableElement: string; - /** Inside function */ - const localVariableElement: string; - /** - * Inside module and script only - * function f() { } - */ - const functionElement: string; - /** Inside function */ - const localFunctionElement: string; - /** class X { [public|private]* foo() {} } */ - const memberFunctionElement: string; - /** class X { [public|private]* [get|set] foo:number; } */ - const memberGetAccessorElement: string; - const memberSetAccessorElement: string; - /** - * class X { [public|private]* foo:number; } - * interface Y { foo:number; } - */ - const memberVariableElement: string; - /** class X { constructor() { } } */ - const constructorImplementationElement: string; - /** interface Y { ():number; } */ - const callSignatureElement: string; - /** interface Y { []:number; } */ - const indexSignatureElement: string; - /** interface Y { new():Y; } */ - const constructSignatureElement: string; - /** function foo(*Y*: string) */ - const parameterElement: string; - const typeParameterElement: string; - const primitiveType: string; - const label: string; - const alias: string; - const constElement: string; - const letElement: string; - } - namespace ScriptElementKindModifier { - const none: string; - const publicMemberModifier: string; - const privateMemberModifier: string; - const protectedMemberModifier: string; - const exportedModifier: string; - const ambientModifier: string; - const staticModifier: string; - const abstractModifier: string; - } - class ClassificationTypeNames { - static comment: string; - static identifier: string; - static keyword: string; - static numericLiteral: string; - static operator: string; - static stringLiteral: string; - static whiteSpace: string; - static text: string; - static punctuation: string; - static className: string; - static enumName: string; - static interfaceName: string; - static moduleName: string; - static typeParameterName: string; - static typeAliasName: string; - static parameterName: string; - static docCommentTagName: string; - static jsxOpenTagName: string; - static jsxCloseTagName: string; - static jsxSelfClosingTagName: string; - static jsxAttribute: string; - static jsxText: string; - static jsxAttributeStringLiteralValue: string; - } - enum ClassificationType { - comment = 1, - identifier = 2, - keyword = 3, - numericLiteral = 4, - operator = 5, - stringLiteral = 6, - regularExpressionLiteral = 7, - whiteSpace = 8, - text = 9, - punctuation = 10, - className = 11, - enumName = 12, - interfaceName = 13, - moduleName = 14, - typeParameterName = 15, - typeAliasName = 16, - parameterName = 17, - docCommentTagName = 18, - jsxOpenTagName = 19, - jsxCloseTagName = 20, - jsxSelfClosingTagName = 21, - jsxAttribute = 22, - jsxText = 23, - jsxAttributeStringLiteralValue = 24, - } - interface DisplayPartsSymbolWriter extends SymbolWriter { - displayParts(): SymbolDisplayPart[]; - } - function displayPartsToString(displayParts: SymbolDisplayPart[]): string; - function getDefaultCompilerOptions(): CompilerOptions; + function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory?: string): DocumentRegistry; +} +declare namespace ts { + function preProcessFile(sourceText: string, readImportFiles?: boolean, detectJavaScriptImports?: boolean): PreProcessedFileInfo; +} +declare namespace ts { interface TranspileOptions { compilerOptions?: CompilerOptions; fileName?: string; @@ -2595,13 +3140,21 @@ declare namespace ts { } function transpileModule(input: string, transpileOptions: TranspileOptions): TranspileOutput; function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string; +} +declare namespace ts { + /** The version of the language service API */ + const servicesVersion = "0.5"; + interface DisplayPartsSymbolWriter extends SymbolWriter { + displayParts(): SymbolDisplayPart[]; + } + function toEditorSettings(options: EditorOptions | EditorSettings): EditorSettings; + function displayPartsToString(displayParts: SymbolDisplayPart[]): string; + function getDefaultCompilerOptions(): CompilerOptions; + function getSupportedCodeFixes(): string[]; function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean, scriptKind?: ScriptKind): SourceFile; let disableIncrementalParsing: boolean; function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; - function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory?: string): DocumentRegistry; - function preProcessFile(sourceText: string, readImportFiles?: boolean, detectJavaScriptImports?: boolean): PreProcessedFileInfo; function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; - function createClassifier(): Classifier; /** * Get the path of the default library files (lib.d.ts) as distributed with the typescript * node package. diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index 5a6e37bc..9d9b38e2 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -1,14 +1,14 @@ /*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. +Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - +License at http://www.apache.org/licenses/LICENSE-2.0 + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ @@ -22,6 +22,7 @@ var ts; (function (ts) { // token > SyntaxKind.Identifer => token is a keyword // Also, If you add a new SyntaxKind be sure to keep the `Markers` section at the bottom in sync + var SyntaxKind; (function (SyntaxKind) { SyntaxKind[SyntaxKind["Unknown"] = 0] = "Unknown"; SyntaxKind[SyntaxKind["EndOfFileToken"] = 1] = "EndOfFileToken"; @@ -37,388 +38,406 @@ var ts; // Literals SyntaxKind[SyntaxKind["NumericLiteral"] = 8] = "NumericLiteral"; SyntaxKind[SyntaxKind["StringLiteral"] = 9] = "StringLiteral"; - SyntaxKind[SyntaxKind["RegularExpressionLiteral"] = 10] = "RegularExpressionLiteral"; - SyntaxKind[SyntaxKind["NoSubstitutionTemplateLiteral"] = 11] = "NoSubstitutionTemplateLiteral"; + SyntaxKind[SyntaxKind["JsxText"] = 10] = "JsxText"; + SyntaxKind[SyntaxKind["RegularExpressionLiteral"] = 11] = "RegularExpressionLiteral"; + SyntaxKind[SyntaxKind["NoSubstitutionTemplateLiteral"] = 12] = "NoSubstitutionTemplateLiteral"; // Pseudo-literals - SyntaxKind[SyntaxKind["TemplateHead"] = 12] = "TemplateHead"; - SyntaxKind[SyntaxKind["TemplateMiddle"] = 13] = "TemplateMiddle"; - SyntaxKind[SyntaxKind["TemplateTail"] = 14] = "TemplateTail"; + SyntaxKind[SyntaxKind["TemplateHead"] = 13] = "TemplateHead"; + SyntaxKind[SyntaxKind["TemplateMiddle"] = 14] = "TemplateMiddle"; + SyntaxKind[SyntaxKind["TemplateTail"] = 15] = "TemplateTail"; // Punctuation - SyntaxKind[SyntaxKind["OpenBraceToken"] = 15] = "OpenBraceToken"; - SyntaxKind[SyntaxKind["CloseBraceToken"] = 16] = "CloseBraceToken"; - SyntaxKind[SyntaxKind["OpenParenToken"] = 17] = "OpenParenToken"; - SyntaxKind[SyntaxKind["CloseParenToken"] = 18] = "CloseParenToken"; - SyntaxKind[SyntaxKind["OpenBracketToken"] = 19] = "OpenBracketToken"; - SyntaxKind[SyntaxKind["CloseBracketToken"] = 20] = "CloseBracketToken"; - SyntaxKind[SyntaxKind["DotToken"] = 21] = "DotToken"; - SyntaxKind[SyntaxKind["DotDotDotToken"] = 22] = "DotDotDotToken"; - SyntaxKind[SyntaxKind["SemicolonToken"] = 23] = "SemicolonToken"; - SyntaxKind[SyntaxKind["CommaToken"] = 24] = "CommaToken"; - SyntaxKind[SyntaxKind["LessThanToken"] = 25] = "LessThanToken"; - SyntaxKind[SyntaxKind["LessThanSlashToken"] = 26] = "LessThanSlashToken"; - SyntaxKind[SyntaxKind["GreaterThanToken"] = 27] = "GreaterThanToken"; - SyntaxKind[SyntaxKind["LessThanEqualsToken"] = 28] = "LessThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanEqualsToken"] = 29] = "GreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["EqualsEqualsToken"] = 30] = "EqualsEqualsToken"; - SyntaxKind[SyntaxKind["ExclamationEqualsToken"] = 31] = "ExclamationEqualsToken"; - SyntaxKind[SyntaxKind["EqualsEqualsEqualsToken"] = 32] = "EqualsEqualsEqualsToken"; - SyntaxKind[SyntaxKind["ExclamationEqualsEqualsToken"] = 33] = "ExclamationEqualsEqualsToken"; - SyntaxKind[SyntaxKind["EqualsGreaterThanToken"] = 34] = "EqualsGreaterThanToken"; - SyntaxKind[SyntaxKind["PlusToken"] = 35] = "PlusToken"; - SyntaxKind[SyntaxKind["MinusToken"] = 36] = "MinusToken"; - SyntaxKind[SyntaxKind["AsteriskToken"] = 37] = "AsteriskToken"; - SyntaxKind[SyntaxKind["AsteriskAsteriskToken"] = 38] = "AsteriskAsteriskToken"; - SyntaxKind[SyntaxKind["SlashToken"] = 39] = "SlashToken"; - SyntaxKind[SyntaxKind["PercentToken"] = 40] = "PercentToken"; - SyntaxKind[SyntaxKind["PlusPlusToken"] = 41] = "PlusPlusToken"; - SyntaxKind[SyntaxKind["MinusMinusToken"] = 42] = "MinusMinusToken"; - SyntaxKind[SyntaxKind["LessThanLessThanToken"] = 43] = "LessThanLessThanToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanToken"] = 44] = "GreaterThanGreaterThanToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanToken"] = 45] = "GreaterThanGreaterThanGreaterThanToken"; - SyntaxKind[SyntaxKind["AmpersandToken"] = 46] = "AmpersandToken"; - SyntaxKind[SyntaxKind["BarToken"] = 47] = "BarToken"; - SyntaxKind[SyntaxKind["CaretToken"] = 48] = "CaretToken"; - SyntaxKind[SyntaxKind["ExclamationToken"] = 49] = "ExclamationToken"; - SyntaxKind[SyntaxKind["TildeToken"] = 50] = "TildeToken"; - SyntaxKind[SyntaxKind["AmpersandAmpersandToken"] = 51] = "AmpersandAmpersandToken"; - SyntaxKind[SyntaxKind["BarBarToken"] = 52] = "BarBarToken"; - SyntaxKind[SyntaxKind["QuestionToken"] = 53] = "QuestionToken"; - SyntaxKind[SyntaxKind["ColonToken"] = 54] = "ColonToken"; - SyntaxKind[SyntaxKind["AtToken"] = 55] = "AtToken"; + SyntaxKind[SyntaxKind["OpenBraceToken"] = 16] = "OpenBraceToken"; + SyntaxKind[SyntaxKind["CloseBraceToken"] = 17] = "CloseBraceToken"; + SyntaxKind[SyntaxKind["OpenParenToken"] = 18] = "OpenParenToken"; + SyntaxKind[SyntaxKind["CloseParenToken"] = 19] = "CloseParenToken"; + SyntaxKind[SyntaxKind["OpenBracketToken"] = 20] = "OpenBracketToken"; + SyntaxKind[SyntaxKind["CloseBracketToken"] = 21] = "CloseBracketToken"; + SyntaxKind[SyntaxKind["DotToken"] = 22] = "DotToken"; + SyntaxKind[SyntaxKind["DotDotDotToken"] = 23] = "DotDotDotToken"; + SyntaxKind[SyntaxKind["SemicolonToken"] = 24] = "SemicolonToken"; + SyntaxKind[SyntaxKind["CommaToken"] = 25] = "CommaToken"; + SyntaxKind[SyntaxKind["LessThanToken"] = 26] = "LessThanToken"; + SyntaxKind[SyntaxKind["LessThanSlashToken"] = 27] = "LessThanSlashToken"; + SyntaxKind[SyntaxKind["GreaterThanToken"] = 28] = "GreaterThanToken"; + SyntaxKind[SyntaxKind["LessThanEqualsToken"] = 29] = "LessThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanEqualsToken"] = 30] = "GreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["EqualsEqualsToken"] = 31] = "EqualsEqualsToken"; + SyntaxKind[SyntaxKind["ExclamationEqualsToken"] = 32] = "ExclamationEqualsToken"; + SyntaxKind[SyntaxKind["EqualsEqualsEqualsToken"] = 33] = "EqualsEqualsEqualsToken"; + SyntaxKind[SyntaxKind["ExclamationEqualsEqualsToken"] = 34] = "ExclamationEqualsEqualsToken"; + SyntaxKind[SyntaxKind["EqualsGreaterThanToken"] = 35] = "EqualsGreaterThanToken"; + SyntaxKind[SyntaxKind["PlusToken"] = 36] = "PlusToken"; + SyntaxKind[SyntaxKind["MinusToken"] = 37] = "MinusToken"; + SyntaxKind[SyntaxKind["AsteriskToken"] = 38] = "AsteriskToken"; + SyntaxKind[SyntaxKind["AsteriskAsteriskToken"] = 39] = "AsteriskAsteriskToken"; + SyntaxKind[SyntaxKind["SlashToken"] = 40] = "SlashToken"; + SyntaxKind[SyntaxKind["PercentToken"] = 41] = "PercentToken"; + SyntaxKind[SyntaxKind["PlusPlusToken"] = 42] = "PlusPlusToken"; + SyntaxKind[SyntaxKind["MinusMinusToken"] = 43] = "MinusMinusToken"; + SyntaxKind[SyntaxKind["LessThanLessThanToken"] = 44] = "LessThanLessThanToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanToken"] = 45] = "GreaterThanGreaterThanToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanToken"] = 46] = "GreaterThanGreaterThanGreaterThanToken"; + SyntaxKind[SyntaxKind["AmpersandToken"] = 47] = "AmpersandToken"; + SyntaxKind[SyntaxKind["BarToken"] = 48] = "BarToken"; + SyntaxKind[SyntaxKind["CaretToken"] = 49] = "CaretToken"; + SyntaxKind[SyntaxKind["ExclamationToken"] = 50] = "ExclamationToken"; + SyntaxKind[SyntaxKind["TildeToken"] = 51] = "TildeToken"; + SyntaxKind[SyntaxKind["AmpersandAmpersandToken"] = 52] = "AmpersandAmpersandToken"; + SyntaxKind[SyntaxKind["BarBarToken"] = 53] = "BarBarToken"; + SyntaxKind[SyntaxKind["QuestionToken"] = 54] = "QuestionToken"; + SyntaxKind[SyntaxKind["ColonToken"] = 55] = "ColonToken"; + SyntaxKind[SyntaxKind["AtToken"] = 56] = "AtToken"; // Assignments - SyntaxKind[SyntaxKind["EqualsToken"] = 56] = "EqualsToken"; - SyntaxKind[SyntaxKind["PlusEqualsToken"] = 57] = "PlusEqualsToken"; - SyntaxKind[SyntaxKind["MinusEqualsToken"] = 58] = "MinusEqualsToken"; - SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 59] = "AsteriskEqualsToken"; - SyntaxKind[SyntaxKind["AsteriskAsteriskEqualsToken"] = 60] = "AsteriskAsteriskEqualsToken"; - SyntaxKind[SyntaxKind["SlashEqualsToken"] = 61] = "SlashEqualsToken"; - SyntaxKind[SyntaxKind["PercentEqualsToken"] = 62] = "PercentEqualsToken"; - SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 63] = "LessThanLessThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 64] = "GreaterThanGreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 65] = "GreaterThanGreaterThanGreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 66] = "AmpersandEqualsToken"; - SyntaxKind[SyntaxKind["BarEqualsToken"] = 67] = "BarEqualsToken"; - SyntaxKind[SyntaxKind["CaretEqualsToken"] = 68] = "CaretEqualsToken"; + SyntaxKind[SyntaxKind["EqualsToken"] = 57] = "EqualsToken"; + SyntaxKind[SyntaxKind["PlusEqualsToken"] = 58] = "PlusEqualsToken"; + SyntaxKind[SyntaxKind["MinusEqualsToken"] = 59] = "MinusEqualsToken"; + SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 60] = "AsteriskEqualsToken"; + SyntaxKind[SyntaxKind["AsteriskAsteriskEqualsToken"] = 61] = "AsteriskAsteriskEqualsToken"; + SyntaxKind[SyntaxKind["SlashEqualsToken"] = 62] = "SlashEqualsToken"; + SyntaxKind[SyntaxKind["PercentEqualsToken"] = 63] = "PercentEqualsToken"; + SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 64] = "LessThanLessThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 65] = "GreaterThanGreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 66] = "GreaterThanGreaterThanGreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 67] = "AmpersandEqualsToken"; + SyntaxKind[SyntaxKind["BarEqualsToken"] = 68] = "BarEqualsToken"; + SyntaxKind[SyntaxKind["CaretEqualsToken"] = 69] = "CaretEqualsToken"; // Identifiers - SyntaxKind[SyntaxKind["Identifier"] = 69] = "Identifier"; + SyntaxKind[SyntaxKind["Identifier"] = 70] = "Identifier"; // Reserved words - SyntaxKind[SyntaxKind["BreakKeyword"] = 70] = "BreakKeyword"; - SyntaxKind[SyntaxKind["CaseKeyword"] = 71] = "CaseKeyword"; - SyntaxKind[SyntaxKind["CatchKeyword"] = 72] = "CatchKeyword"; - SyntaxKind[SyntaxKind["ClassKeyword"] = 73] = "ClassKeyword"; - SyntaxKind[SyntaxKind["ConstKeyword"] = 74] = "ConstKeyword"; - SyntaxKind[SyntaxKind["ContinueKeyword"] = 75] = "ContinueKeyword"; - SyntaxKind[SyntaxKind["DebuggerKeyword"] = 76] = "DebuggerKeyword"; - SyntaxKind[SyntaxKind["DefaultKeyword"] = 77] = "DefaultKeyword"; - SyntaxKind[SyntaxKind["DeleteKeyword"] = 78] = "DeleteKeyword"; - SyntaxKind[SyntaxKind["DoKeyword"] = 79] = "DoKeyword"; - SyntaxKind[SyntaxKind["ElseKeyword"] = 80] = "ElseKeyword"; - SyntaxKind[SyntaxKind["EnumKeyword"] = 81] = "EnumKeyword"; - SyntaxKind[SyntaxKind["ExportKeyword"] = 82] = "ExportKeyword"; - SyntaxKind[SyntaxKind["ExtendsKeyword"] = 83] = "ExtendsKeyword"; - SyntaxKind[SyntaxKind["FalseKeyword"] = 84] = "FalseKeyword"; - SyntaxKind[SyntaxKind["FinallyKeyword"] = 85] = "FinallyKeyword"; - SyntaxKind[SyntaxKind["ForKeyword"] = 86] = "ForKeyword"; - SyntaxKind[SyntaxKind["FunctionKeyword"] = 87] = "FunctionKeyword"; - SyntaxKind[SyntaxKind["IfKeyword"] = 88] = "IfKeyword"; - SyntaxKind[SyntaxKind["ImportKeyword"] = 89] = "ImportKeyword"; - SyntaxKind[SyntaxKind["InKeyword"] = 90] = "InKeyword"; - SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 91] = "InstanceOfKeyword"; - SyntaxKind[SyntaxKind["NewKeyword"] = 92] = "NewKeyword"; - SyntaxKind[SyntaxKind["NullKeyword"] = 93] = "NullKeyword"; - SyntaxKind[SyntaxKind["ReturnKeyword"] = 94] = "ReturnKeyword"; - SyntaxKind[SyntaxKind["SuperKeyword"] = 95] = "SuperKeyword"; - SyntaxKind[SyntaxKind["SwitchKeyword"] = 96] = "SwitchKeyword"; - SyntaxKind[SyntaxKind["ThisKeyword"] = 97] = "ThisKeyword"; - SyntaxKind[SyntaxKind["ThrowKeyword"] = 98] = "ThrowKeyword"; - SyntaxKind[SyntaxKind["TrueKeyword"] = 99] = "TrueKeyword"; - SyntaxKind[SyntaxKind["TryKeyword"] = 100] = "TryKeyword"; - SyntaxKind[SyntaxKind["TypeOfKeyword"] = 101] = "TypeOfKeyword"; - SyntaxKind[SyntaxKind["VarKeyword"] = 102] = "VarKeyword"; - SyntaxKind[SyntaxKind["VoidKeyword"] = 103] = "VoidKeyword"; - SyntaxKind[SyntaxKind["WhileKeyword"] = 104] = "WhileKeyword"; - SyntaxKind[SyntaxKind["WithKeyword"] = 105] = "WithKeyword"; + SyntaxKind[SyntaxKind["BreakKeyword"] = 71] = "BreakKeyword"; + SyntaxKind[SyntaxKind["CaseKeyword"] = 72] = "CaseKeyword"; + SyntaxKind[SyntaxKind["CatchKeyword"] = 73] = "CatchKeyword"; + SyntaxKind[SyntaxKind["ClassKeyword"] = 74] = "ClassKeyword"; + SyntaxKind[SyntaxKind["ConstKeyword"] = 75] = "ConstKeyword"; + SyntaxKind[SyntaxKind["ContinueKeyword"] = 76] = "ContinueKeyword"; + SyntaxKind[SyntaxKind["DebuggerKeyword"] = 77] = "DebuggerKeyword"; + SyntaxKind[SyntaxKind["DefaultKeyword"] = 78] = "DefaultKeyword"; + SyntaxKind[SyntaxKind["DeleteKeyword"] = 79] = "DeleteKeyword"; + SyntaxKind[SyntaxKind["DoKeyword"] = 80] = "DoKeyword"; + SyntaxKind[SyntaxKind["ElseKeyword"] = 81] = "ElseKeyword"; + SyntaxKind[SyntaxKind["EnumKeyword"] = 82] = "EnumKeyword"; + SyntaxKind[SyntaxKind["ExportKeyword"] = 83] = "ExportKeyword"; + SyntaxKind[SyntaxKind["ExtendsKeyword"] = 84] = "ExtendsKeyword"; + SyntaxKind[SyntaxKind["FalseKeyword"] = 85] = "FalseKeyword"; + SyntaxKind[SyntaxKind["FinallyKeyword"] = 86] = "FinallyKeyword"; + SyntaxKind[SyntaxKind["ForKeyword"] = 87] = "ForKeyword"; + SyntaxKind[SyntaxKind["FunctionKeyword"] = 88] = "FunctionKeyword"; + SyntaxKind[SyntaxKind["IfKeyword"] = 89] = "IfKeyword"; + SyntaxKind[SyntaxKind["ImportKeyword"] = 90] = "ImportKeyword"; + SyntaxKind[SyntaxKind["InKeyword"] = 91] = "InKeyword"; + SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 92] = "InstanceOfKeyword"; + SyntaxKind[SyntaxKind["NewKeyword"] = 93] = "NewKeyword"; + SyntaxKind[SyntaxKind["NullKeyword"] = 94] = "NullKeyword"; + SyntaxKind[SyntaxKind["ReturnKeyword"] = 95] = "ReturnKeyword"; + SyntaxKind[SyntaxKind["SuperKeyword"] = 96] = "SuperKeyword"; + SyntaxKind[SyntaxKind["SwitchKeyword"] = 97] = "SwitchKeyword"; + SyntaxKind[SyntaxKind["ThisKeyword"] = 98] = "ThisKeyword"; + SyntaxKind[SyntaxKind["ThrowKeyword"] = 99] = "ThrowKeyword"; + SyntaxKind[SyntaxKind["TrueKeyword"] = 100] = "TrueKeyword"; + SyntaxKind[SyntaxKind["TryKeyword"] = 101] = "TryKeyword"; + SyntaxKind[SyntaxKind["TypeOfKeyword"] = 102] = "TypeOfKeyword"; + SyntaxKind[SyntaxKind["VarKeyword"] = 103] = "VarKeyword"; + SyntaxKind[SyntaxKind["VoidKeyword"] = 104] = "VoidKeyword"; + SyntaxKind[SyntaxKind["WhileKeyword"] = 105] = "WhileKeyword"; + SyntaxKind[SyntaxKind["WithKeyword"] = 106] = "WithKeyword"; // Strict mode reserved words - SyntaxKind[SyntaxKind["ImplementsKeyword"] = 106] = "ImplementsKeyword"; - SyntaxKind[SyntaxKind["InterfaceKeyword"] = 107] = "InterfaceKeyword"; - SyntaxKind[SyntaxKind["LetKeyword"] = 108] = "LetKeyword"; - SyntaxKind[SyntaxKind["PackageKeyword"] = 109] = "PackageKeyword"; - SyntaxKind[SyntaxKind["PrivateKeyword"] = 110] = "PrivateKeyword"; - SyntaxKind[SyntaxKind["ProtectedKeyword"] = 111] = "ProtectedKeyword"; - SyntaxKind[SyntaxKind["PublicKeyword"] = 112] = "PublicKeyword"; - SyntaxKind[SyntaxKind["StaticKeyword"] = 113] = "StaticKeyword"; - SyntaxKind[SyntaxKind["YieldKeyword"] = 114] = "YieldKeyword"; + SyntaxKind[SyntaxKind["ImplementsKeyword"] = 107] = "ImplementsKeyword"; + SyntaxKind[SyntaxKind["InterfaceKeyword"] = 108] = "InterfaceKeyword"; + SyntaxKind[SyntaxKind["LetKeyword"] = 109] = "LetKeyword"; + SyntaxKind[SyntaxKind["PackageKeyword"] = 110] = "PackageKeyword"; + SyntaxKind[SyntaxKind["PrivateKeyword"] = 111] = "PrivateKeyword"; + SyntaxKind[SyntaxKind["ProtectedKeyword"] = 112] = "ProtectedKeyword"; + SyntaxKind[SyntaxKind["PublicKeyword"] = 113] = "PublicKeyword"; + SyntaxKind[SyntaxKind["StaticKeyword"] = 114] = "StaticKeyword"; + SyntaxKind[SyntaxKind["YieldKeyword"] = 115] = "YieldKeyword"; // Contextual keywords - SyntaxKind[SyntaxKind["AbstractKeyword"] = 115] = "AbstractKeyword"; - SyntaxKind[SyntaxKind["AsKeyword"] = 116] = "AsKeyword"; - SyntaxKind[SyntaxKind["AnyKeyword"] = 117] = "AnyKeyword"; - SyntaxKind[SyntaxKind["AsyncKeyword"] = 118] = "AsyncKeyword"; - SyntaxKind[SyntaxKind["AwaitKeyword"] = 119] = "AwaitKeyword"; - SyntaxKind[SyntaxKind["BooleanKeyword"] = 120] = "BooleanKeyword"; - SyntaxKind[SyntaxKind["ConstructorKeyword"] = 121] = "ConstructorKeyword"; - SyntaxKind[SyntaxKind["DeclareKeyword"] = 122] = "DeclareKeyword"; - SyntaxKind[SyntaxKind["GetKeyword"] = 123] = "GetKeyword"; - SyntaxKind[SyntaxKind["IsKeyword"] = 124] = "IsKeyword"; - SyntaxKind[SyntaxKind["ModuleKeyword"] = 125] = "ModuleKeyword"; - SyntaxKind[SyntaxKind["NamespaceKeyword"] = 126] = "NamespaceKeyword"; - SyntaxKind[SyntaxKind["NeverKeyword"] = 127] = "NeverKeyword"; - SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 128] = "ReadonlyKeyword"; - SyntaxKind[SyntaxKind["RequireKeyword"] = 129] = "RequireKeyword"; - SyntaxKind[SyntaxKind["NumberKeyword"] = 130] = "NumberKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 131] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 132] = "StringKeyword"; - SyntaxKind[SyntaxKind["SymbolKeyword"] = 133] = "SymbolKeyword"; - SyntaxKind[SyntaxKind["TypeKeyword"] = 134] = "TypeKeyword"; - SyntaxKind[SyntaxKind["UndefinedKeyword"] = 135] = "UndefinedKeyword"; - SyntaxKind[SyntaxKind["FromKeyword"] = 136] = "FromKeyword"; - SyntaxKind[SyntaxKind["GlobalKeyword"] = 137] = "GlobalKeyword"; - SyntaxKind[SyntaxKind["OfKeyword"] = 138] = "OfKeyword"; + SyntaxKind[SyntaxKind["AbstractKeyword"] = 116] = "AbstractKeyword"; + SyntaxKind[SyntaxKind["AsKeyword"] = 117] = "AsKeyword"; + SyntaxKind[SyntaxKind["AnyKeyword"] = 118] = "AnyKeyword"; + SyntaxKind[SyntaxKind["AsyncKeyword"] = 119] = "AsyncKeyword"; + SyntaxKind[SyntaxKind["AwaitKeyword"] = 120] = "AwaitKeyword"; + SyntaxKind[SyntaxKind["BooleanKeyword"] = 121] = "BooleanKeyword"; + SyntaxKind[SyntaxKind["ConstructorKeyword"] = 122] = "ConstructorKeyword"; + SyntaxKind[SyntaxKind["DeclareKeyword"] = 123] = "DeclareKeyword"; + SyntaxKind[SyntaxKind["GetKeyword"] = 124] = "GetKeyword"; + SyntaxKind[SyntaxKind["IsKeyword"] = 125] = "IsKeyword"; + SyntaxKind[SyntaxKind["KeyOfKeyword"] = 126] = "KeyOfKeyword"; + SyntaxKind[SyntaxKind["ModuleKeyword"] = 127] = "ModuleKeyword"; + SyntaxKind[SyntaxKind["NamespaceKeyword"] = 128] = "NamespaceKeyword"; + SyntaxKind[SyntaxKind["NeverKeyword"] = 129] = "NeverKeyword"; + SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 130] = "ReadonlyKeyword"; + SyntaxKind[SyntaxKind["RequireKeyword"] = 131] = "RequireKeyword"; + SyntaxKind[SyntaxKind["NumberKeyword"] = 132] = "NumberKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 133] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 134] = "StringKeyword"; + SyntaxKind[SyntaxKind["SymbolKeyword"] = 135] = "SymbolKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 136] = "TypeKeyword"; + SyntaxKind[SyntaxKind["UndefinedKeyword"] = 137] = "UndefinedKeyword"; + SyntaxKind[SyntaxKind["FromKeyword"] = 138] = "FromKeyword"; + SyntaxKind[SyntaxKind["GlobalKeyword"] = 139] = "GlobalKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 140] = "OfKeyword"; // Parse tree nodes // Names - SyntaxKind[SyntaxKind["QualifiedName"] = 139] = "QualifiedName"; - SyntaxKind[SyntaxKind["ComputedPropertyName"] = 140] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["QualifiedName"] = 141] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 142] = "ComputedPropertyName"; // Signature elements - SyntaxKind[SyntaxKind["TypeParameter"] = 141] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 142] = "Parameter"; - SyntaxKind[SyntaxKind["Decorator"] = 143] = "Decorator"; + SyntaxKind[SyntaxKind["TypeParameter"] = 143] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 144] = "Parameter"; + SyntaxKind[SyntaxKind["Decorator"] = 145] = "Decorator"; // TypeMember - SyntaxKind[SyntaxKind["PropertySignature"] = 144] = "PropertySignature"; - SyntaxKind[SyntaxKind["PropertyDeclaration"] = 145] = "PropertyDeclaration"; - SyntaxKind[SyntaxKind["MethodSignature"] = 146] = "MethodSignature"; - SyntaxKind[SyntaxKind["MethodDeclaration"] = 147] = "MethodDeclaration"; - SyntaxKind[SyntaxKind["Constructor"] = 148] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 149] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 150] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 151] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 152] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 153] = "IndexSignature"; + SyntaxKind[SyntaxKind["PropertySignature"] = 146] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 147] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 148] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 149] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 150] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 151] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 152] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 153] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 154] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 155] = "IndexSignature"; // Type - SyntaxKind[SyntaxKind["TypePredicate"] = 154] = "TypePredicate"; - SyntaxKind[SyntaxKind["TypeReference"] = 155] = "TypeReference"; - SyntaxKind[SyntaxKind["FunctionType"] = 156] = "FunctionType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 157] = "ConstructorType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 158] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 159] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 160] = "ArrayType"; - SyntaxKind[SyntaxKind["TupleType"] = 161] = "TupleType"; - SyntaxKind[SyntaxKind["UnionType"] = 162] = "UnionType"; - SyntaxKind[SyntaxKind["IntersectionType"] = 163] = "IntersectionType"; - SyntaxKind[SyntaxKind["ParenthesizedType"] = 164] = "ParenthesizedType"; - SyntaxKind[SyntaxKind["ThisType"] = 165] = "ThisType"; - SyntaxKind[SyntaxKind["LiteralType"] = 166] = "LiteralType"; + SyntaxKind[SyntaxKind["TypePredicate"] = 156] = "TypePredicate"; + SyntaxKind[SyntaxKind["TypeReference"] = 157] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 158] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 159] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 160] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 161] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 162] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 163] = "TupleType"; + SyntaxKind[SyntaxKind["UnionType"] = 164] = "UnionType"; + SyntaxKind[SyntaxKind["IntersectionType"] = 165] = "IntersectionType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 166] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["ThisType"] = 167] = "ThisType"; + SyntaxKind[SyntaxKind["TypeOperator"] = 168] = "TypeOperator"; + SyntaxKind[SyntaxKind["IndexedAccessType"] = 169] = "IndexedAccessType"; + SyntaxKind[SyntaxKind["MappedType"] = 170] = "MappedType"; + SyntaxKind[SyntaxKind["LiteralType"] = 171] = "LiteralType"; // Binding patterns - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 167] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 168] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 169] = "BindingElement"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 172] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 173] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 174] = "BindingElement"; // Expression - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 170] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 171] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 172] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 173] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 174] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 175] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 176] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 177] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 178] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 179] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 180] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 181] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 182] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 183] = "VoidExpression"; - SyntaxKind[SyntaxKind["AwaitExpression"] = 184] = "AwaitExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 185] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 186] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 187] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 188] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 189] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 190] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElementExpression"] = 191] = "SpreadElementExpression"; - SyntaxKind[SyntaxKind["ClassExpression"] = 192] = "ClassExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 193] = "OmittedExpression"; - SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 194] = "ExpressionWithTypeArguments"; - SyntaxKind[SyntaxKind["AsExpression"] = 195] = "AsExpression"; - SyntaxKind[SyntaxKind["NonNullExpression"] = 196] = "NonNullExpression"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 175] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 176] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 177] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 178] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 179] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 180] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 181] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 182] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 183] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 184] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 185] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 186] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 187] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 188] = "VoidExpression"; + SyntaxKind[SyntaxKind["AwaitExpression"] = 189] = "AwaitExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 190] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 191] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 192] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 193] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 194] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 195] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElement"] = 196] = "SpreadElement"; + SyntaxKind[SyntaxKind["ClassExpression"] = 197] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 198] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 199] = "ExpressionWithTypeArguments"; + SyntaxKind[SyntaxKind["AsExpression"] = 200] = "AsExpression"; + SyntaxKind[SyntaxKind["NonNullExpression"] = 201] = "NonNullExpression"; // Misc - SyntaxKind[SyntaxKind["TemplateSpan"] = 197] = "TemplateSpan"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 198] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 202] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 203] = "SemicolonClassElement"; // Element - SyntaxKind[SyntaxKind["Block"] = 199] = "Block"; - SyntaxKind[SyntaxKind["VariableStatement"] = 200] = "VariableStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 201] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 202] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 203] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 204] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 205] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 206] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 207] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 208] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 209] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 210] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 211] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 212] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 213] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 214] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 215] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 216] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 217] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 218] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 219] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 220] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 221] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 222] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 223] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 224] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 225] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 226] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 227] = "CaseBlock"; - SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 228] = "NamespaceExportDeclaration"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 229] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 230] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 231] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 232] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 233] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 234] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 235] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 236] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 237] = "NamedExports"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 238] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 239] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["Block"] = 204] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 205] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 206] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 207] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 208] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 209] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 210] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 211] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 212] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 213] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 214] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 215] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 216] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 217] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 218] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 219] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 220] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 221] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 222] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 223] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 224] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 225] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 226] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 227] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 228] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 229] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 230] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 231] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 232] = "CaseBlock"; + SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 233] = "NamespaceExportDeclaration"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 234] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 235] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 236] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 237] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 238] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 239] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 240] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 241] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 242] = "NamedExports"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 243] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 244] = "MissingDeclaration"; // Module references - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 240] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 245] = "ExternalModuleReference"; // JSX - SyntaxKind[SyntaxKind["JsxElement"] = 241] = "JsxElement"; - SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 242] = "JsxSelfClosingElement"; - SyntaxKind[SyntaxKind["JsxOpeningElement"] = 243] = "JsxOpeningElement"; - SyntaxKind[SyntaxKind["JsxText"] = 244] = "JsxText"; - SyntaxKind[SyntaxKind["JsxClosingElement"] = 245] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 246] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 247] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 248] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxElement"] = 246] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 247] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 248] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 249] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 250] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 251] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 252] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 249] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 250] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 251] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 252] = "CatchClause"; + SyntaxKind[SyntaxKind["CaseClause"] = 253] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 254] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 255] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 256] = "CatchClause"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 253] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 254] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 257] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 258] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["SpreadAssignment"] = 259] = "SpreadAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 255] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 260] = "EnumMember"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 256] = "SourceFile"; + SyntaxKind[SyntaxKind["SourceFile"] = 261] = "SourceFile"; // JSDoc nodes - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 257] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 262] = "JSDocTypeExpression"; // The * type - SyntaxKind[SyntaxKind["JSDocAllType"] = 258] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 263] = "JSDocAllType"; // The ? type - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 259] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocArrayType"] = 260] = "JSDocArrayType"; - SyntaxKind[SyntaxKind["JSDocUnionType"] = 261] = "JSDocUnionType"; - SyntaxKind[SyntaxKind["JSDocTupleType"] = 262] = "JSDocTupleType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 263] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 264] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocRecordType"] = 265] = "JSDocRecordType"; - SyntaxKind[SyntaxKind["JSDocRecordMember"] = 266] = "JSDocRecordMember"; - SyntaxKind[SyntaxKind["JSDocTypeReference"] = 267] = "JSDocTypeReference"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 268] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 269] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 270] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocConstructorType"] = 271] = "JSDocConstructorType"; - SyntaxKind[SyntaxKind["JSDocThisType"] = 272] = "JSDocThisType"; - SyntaxKind[SyntaxKind["JSDocComment"] = 273] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocTag"] = 274] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 275] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 276] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 277] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 278] = "JSDocTemplateTag"; - SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 279] = "JSDocTypedefTag"; - SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 280] = "JSDocPropertyTag"; - SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 281] = "JSDocTypeLiteral"; - SyntaxKind[SyntaxKind["JSDocLiteralType"] = 282] = "JSDocLiteralType"; - SyntaxKind[SyntaxKind["JSDocNullKeyword"] = 283] = "JSDocNullKeyword"; - SyntaxKind[SyntaxKind["JSDocUndefinedKeyword"] = 284] = "JSDocUndefinedKeyword"; - SyntaxKind[SyntaxKind["JSDocNeverKeyword"] = 285] = "JSDocNeverKeyword"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 264] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocArrayType"] = 265] = "JSDocArrayType"; + SyntaxKind[SyntaxKind["JSDocUnionType"] = 266] = "JSDocUnionType"; + SyntaxKind[SyntaxKind["JSDocTupleType"] = 267] = "JSDocTupleType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 268] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 269] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocRecordType"] = 270] = "JSDocRecordType"; + SyntaxKind[SyntaxKind["JSDocRecordMember"] = 271] = "JSDocRecordMember"; + SyntaxKind[SyntaxKind["JSDocTypeReference"] = 272] = "JSDocTypeReference"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 273] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 274] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 275] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocConstructorType"] = 276] = "JSDocConstructorType"; + SyntaxKind[SyntaxKind["JSDocThisType"] = 277] = "JSDocThisType"; + SyntaxKind[SyntaxKind["JSDocComment"] = 278] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocTag"] = 279] = "JSDocTag"; + 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"] = 286] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 292] = "SyntaxList"; + // Transformation nodes + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 293] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 294] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 295] = "MergeDeclarationMarker"; + SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 296] = "EndOfDeclarationMarker"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 287] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 297] = "Count"; // Markers - SyntaxKind[SyntaxKind["FirstAssignment"] = 56] = "FirstAssignment"; - SyntaxKind[SyntaxKind["LastAssignment"] = 68] = "LastAssignment"; - SyntaxKind[SyntaxKind["FirstReservedWord"] = 70] = "FirstReservedWord"; - SyntaxKind[SyntaxKind["LastReservedWord"] = 105] = "LastReservedWord"; - SyntaxKind[SyntaxKind["FirstKeyword"] = 70] = "FirstKeyword"; - SyntaxKind[SyntaxKind["LastKeyword"] = 138] = "LastKeyword"; - SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 106] = "FirstFutureReservedWord"; - SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 114] = "LastFutureReservedWord"; - SyntaxKind[SyntaxKind["FirstTypeNode"] = 154] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 166] = "LastTypeNode"; - SyntaxKind[SyntaxKind["FirstPunctuation"] = 15] = "FirstPunctuation"; - SyntaxKind[SyntaxKind["LastPunctuation"] = 68] = "LastPunctuation"; + SyntaxKind[SyntaxKind["FirstAssignment"] = 57] = "FirstAssignment"; + SyntaxKind[SyntaxKind["LastAssignment"] = 69] = "LastAssignment"; + SyntaxKind[SyntaxKind["FirstCompoundAssignment"] = 58] = "FirstCompoundAssignment"; + SyntaxKind[SyntaxKind["LastCompoundAssignment"] = 69] = "LastCompoundAssignment"; + SyntaxKind[SyntaxKind["FirstReservedWord"] = 71] = "FirstReservedWord"; + SyntaxKind[SyntaxKind["LastReservedWord"] = 106] = "LastReservedWord"; + SyntaxKind[SyntaxKind["FirstKeyword"] = 71] = "FirstKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 140] = "LastKeyword"; + SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 107] = "FirstFutureReservedWord"; + SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 115] = "LastFutureReservedWord"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 156] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 171] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstPunctuation"] = 16] = "FirstPunctuation"; + SyntaxKind[SyntaxKind["LastPunctuation"] = 69] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = 138] = "LastToken"; + SyntaxKind[SyntaxKind["LastToken"] = 140] = "LastToken"; SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken"; SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken"; - SyntaxKind[SyntaxKind["LastLiteralToken"] = 11] = "LastLiteralToken"; - SyntaxKind[SyntaxKind["FirstTemplateToken"] = 11] = "FirstTemplateToken"; - SyntaxKind[SyntaxKind["LastTemplateToken"] = 14] = "LastTemplateToken"; - SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 25] = "FirstBinaryOperator"; - SyntaxKind[SyntaxKind["LastBinaryOperator"] = 68] = "LastBinaryOperator"; - SyntaxKind[SyntaxKind["FirstNode"] = 139] = "FirstNode"; - SyntaxKind[SyntaxKind["FirstJSDocNode"] = 257] = "FirstJSDocNode"; - SyntaxKind[SyntaxKind["LastJSDocNode"] = 282] = "LastJSDocNode"; - SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 273] = "FirstJSDocTagNode"; - SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 285] = "LastJSDocTagNode"; - })(ts.SyntaxKind || (ts.SyntaxKind = {})); - var SyntaxKind = ts.SyntaxKind; + SyntaxKind[SyntaxKind["LastLiteralToken"] = 12] = "LastLiteralToken"; + SyntaxKind[SyntaxKind["FirstTemplateToken"] = 12] = "FirstTemplateToken"; + SyntaxKind[SyntaxKind["LastTemplateToken"] = 15] = "LastTemplateToken"; + SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 26] = "FirstBinaryOperator"; + SyntaxKind[SyntaxKind["LastBinaryOperator"] = 69] = "LastBinaryOperator"; + SyntaxKind[SyntaxKind["FirstNode"] = 141] = "FirstNode"; + SyntaxKind[SyntaxKind["FirstJSDocNode"] = 262] = "FirstJSDocNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 288] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 278] = "FirstJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 291] = "LastJSDocTagNode"; + })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); + var NodeFlags; (function (NodeFlags) { NodeFlags[NodeFlags["None"] = 0] = "None"; - NodeFlags[NodeFlags["Export"] = 1] = "Export"; - NodeFlags[NodeFlags["Ambient"] = 2] = "Ambient"; - NodeFlags[NodeFlags["Public"] = 4] = "Public"; - NodeFlags[NodeFlags["Private"] = 8] = "Private"; - NodeFlags[NodeFlags["Protected"] = 16] = "Protected"; - NodeFlags[NodeFlags["Static"] = 32] = "Static"; - NodeFlags[NodeFlags["Readonly"] = 64] = "Readonly"; - NodeFlags[NodeFlags["Abstract"] = 128] = "Abstract"; - NodeFlags[NodeFlags["Async"] = 256] = "Async"; - NodeFlags[NodeFlags["Default"] = 512] = "Default"; - NodeFlags[NodeFlags["Let"] = 1024] = "Let"; - NodeFlags[NodeFlags["Const"] = 2048] = "Const"; - NodeFlags[NodeFlags["Namespace"] = 4096] = "Namespace"; - NodeFlags[NodeFlags["ExportContext"] = 8192] = "ExportContext"; - NodeFlags[NodeFlags["ContainsThis"] = 16384] = "ContainsThis"; - NodeFlags[NodeFlags["HasImplicitReturn"] = 32768] = "HasImplicitReturn"; - NodeFlags[NodeFlags["HasExplicitReturn"] = 65536] = "HasExplicitReturn"; - NodeFlags[NodeFlags["GlobalAugmentation"] = 131072] = "GlobalAugmentation"; - NodeFlags[NodeFlags["HasClassExtends"] = 262144] = "HasClassExtends"; - NodeFlags[NodeFlags["HasDecorators"] = 524288] = "HasDecorators"; - NodeFlags[NodeFlags["HasParamDecorators"] = 1048576] = "HasParamDecorators"; - NodeFlags[NodeFlags["HasAsyncFunctions"] = 2097152] = "HasAsyncFunctions"; - NodeFlags[NodeFlags["DisallowInContext"] = 4194304] = "DisallowInContext"; - NodeFlags[NodeFlags["YieldContext"] = 8388608] = "YieldContext"; - NodeFlags[NodeFlags["DecoratorContext"] = 16777216] = "DecoratorContext"; - NodeFlags[NodeFlags["AwaitContext"] = 33554432] = "AwaitContext"; - NodeFlags[NodeFlags["ThisNodeHasError"] = 67108864] = "ThisNodeHasError"; - NodeFlags[NodeFlags["JavaScriptFile"] = 134217728] = "JavaScriptFile"; - NodeFlags[NodeFlags["ThisNodeOrAnySubNodesHasError"] = 268435456] = "ThisNodeOrAnySubNodesHasError"; - NodeFlags[NodeFlags["HasAggregatedChildData"] = 536870912] = "HasAggregatedChildData"; - NodeFlags[NodeFlags["HasJsxSpreadAttribute"] = 1073741824] = "HasJsxSpreadAttribute"; - NodeFlags[NodeFlags["Modifier"] = 1023] = "Modifier"; - NodeFlags[NodeFlags["AccessibilityModifier"] = 28] = "AccessibilityModifier"; - // Accessibility modifiers and 'readonly' can be attached to a parameter in a constructor to make it a property. - NodeFlags[NodeFlags["ParameterPropertyModifier"] = 92] = "ParameterPropertyModifier"; - NodeFlags[NodeFlags["BlockScoped"] = 3072] = "BlockScoped"; - NodeFlags[NodeFlags["ReachabilityCheckFlags"] = 98304] = "ReachabilityCheckFlags"; - NodeFlags[NodeFlags["EmitHelperFlags"] = 3932160] = "EmitHelperFlags"; - NodeFlags[NodeFlags["ReachabilityAndEmitFlags"] = 4030464] = "ReachabilityAndEmitFlags"; + NodeFlags[NodeFlags["Let"] = 1] = "Let"; + NodeFlags[NodeFlags["Const"] = 2] = "Const"; + NodeFlags[NodeFlags["NestedNamespace"] = 4] = "NestedNamespace"; + NodeFlags[NodeFlags["Synthesized"] = 8] = "Synthesized"; + NodeFlags[NodeFlags["Namespace"] = 16] = "Namespace"; + NodeFlags[NodeFlags["ExportContext"] = 32] = "ExportContext"; + NodeFlags[NodeFlags["ContainsThis"] = 64] = "ContainsThis"; + NodeFlags[NodeFlags["HasImplicitReturn"] = 128] = "HasImplicitReturn"; + NodeFlags[NodeFlags["HasExplicitReturn"] = 256] = "HasExplicitReturn"; + NodeFlags[NodeFlags["GlobalAugmentation"] = 512] = "GlobalAugmentation"; + NodeFlags[NodeFlags["HasAsyncFunctions"] = 1024] = "HasAsyncFunctions"; + NodeFlags[NodeFlags["DisallowInContext"] = 2048] = "DisallowInContext"; + NodeFlags[NodeFlags["YieldContext"] = 4096] = "YieldContext"; + NodeFlags[NodeFlags["DecoratorContext"] = 8192] = "DecoratorContext"; + NodeFlags[NodeFlags["AwaitContext"] = 16384] = "AwaitContext"; + NodeFlags[NodeFlags["ThisNodeHasError"] = 32768] = "ThisNodeHasError"; + NodeFlags[NodeFlags["JavaScriptFile"] = 65536] = "JavaScriptFile"; + NodeFlags[NodeFlags["ThisNodeOrAnySubNodesHasError"] = 131072] = "ThisNodeOrAnySubNodesHasError"; + NodeFlags[NodeFlags["HasAggregatedChildData"] = 262144] = "HasAggregatedChildData"; + NodeFlags[NodeFlags["BlockScoped"] = 3] = "BlockScoped"; + NodeFlags[NodeFlags["ReachabilityCheckFlags"] = 384] = "ReachabilityCheckFlags"; + NodeFlags[NodeFlags["ReachabilityAndEmitFlags"] = 1408] = "ReachabilityAndEmitFlags"; // Parsing context flags - NodeFlags[NodeFlags["ContextFlags"] = 197132288] = "ContextFlags"; + NodeFlags[NodeFlags["ContextFlags"] = 96256] = "ContextFlags"; // Exclude these flags when parsing a Type - NodeFlags[NodeFlags["TypeExcludesFlags"] = 41943040] = "TypeExcludesFlags"; - })(ts.NodeFlags || (ts.NodeFlags = {})); - var NodeFlags = ts.NodeFlags; + NodeFlags[NodeFlags["TypeExcludesFlags"] = 20480] = "TypeExcludesFlags"; + })(NodeFlags = ts.NodeFlags || (ts.NodeFlags = {})); + var ModifierFlags; + (function (ModifierFlags) { + ModifierFlags[ModifierFlags["None"] = 0] = "None"; + ModifierFlags[ModifierFlags["Export"] = 1] = "Export"; + ModifierFlags[ModifierFlags["Ambient"] = 2] = "Ambient"; + ModifierFlags[ModifierFlags["Public"] = 4] = "Public"; + ModifierFlags[ModifierFlags["Private"] = 8] = "Private"; + ModifierFlags[ModifierFlags["Protected"] = 16] = "Protected"; + ModifierFlags[ModifierFlags["Static"] = 32] = "Static"; + ModifierFlags[ModifierFlags["Readonly"] = 64] = "Readonly"; + ModifierFlags[ModifierFlags["Abstract"] = 128] = "Abstract"; + ModifierFlags[ModifierFlags["Async"] = 256] = "Async"; + ModifierFlags[ModifierFlags["Default"] = 512] = "Default"; + ModifierFlags[ModifierFlags["Const"] = 2048] = "Const"; + ModifierFlags[ModifierFlags["HasComputedFlags"] = 536870912] = "HasComputedFlags"; + ModifierFlags[ModifierFlags["AccessibilityModifier"] = 28] = "AccessibilityModifier"; + // Accessibility modifiers and 'readonly' can be attached to a parameter in a constructor to make it a property. + ModifierFlags[ModifierFlags["ParameterPropertyModifier"] = 92] = "ParameterPropertyModifier"; + ModifierFlags[ModifierFlags["NonPublicAccessibilityModifier"] = 24] = "NonPublicAccessibilityModifier"; + ModifierFlags[ModifierFlags["TypeScriptModifier"] = 2270] = "TypeScriptModifier"; + ModifierFlags[ModifierFlags["ExportDefault"] = 513] = "ExportDefault"; + })(ModifierFlags = ts.ModifierFlags || (ts.ModifierFlags = {})); + var JsxFlags; (function (JsxFlags) { JsxFlags[JsxFlags["None"] = 0] = "None"; /** An element from a named property of the JSX.IntrinsicElements interface */ @@ -426,15 +445,24 @@ var ts; /** An element inferred from the string index signature of the JSX.IntrinsicElements interface */ JsxFlags[JsxFlags["IntrinsicIndexedElement"] = 2] = "IntrinsicIndexedElement"; JsxFlags[JsxFlags["IntrinsicElement"] = 3] = "IntrinsicElement"; - })(ts.JsxFlags || (ts.JsxFlags = {})); - var JsxFlags = ts.JsxFlags; + })(JsxFlags = ts.JsxFlags || (ts.JsxFlags = {})); /* @internal */ + var RelationComparisonResult; (function (RelationComparisonResult) { RelationComparisonResult[RelationComparisonResult["Succeeded"] = 1] = "Succeeded"; RelationComparisonResult[RelationComparisonResult["Failed"] = 2] = "Failed"; RelationComparisonResult[RelationComparisonResult["FailedAndReported"] = 3] = "FailedAndReported"; - })(ts.RelationComparisonResult || (ts.RelationComparisonResult = {})); - var RelationComparisonResult = ts.RelationComparisonResult; + })(RelationComparisonResult = ts.RelationComparisonResult || (ts.RelationComparisonResult = {})); + /*@internal*/ + var GeneratedIdentifierKind; + (function (GeneratedIdentifierKind) { + GeneratedIdentifierKind[GeneratedIdentifierKind["None"] = 0] = "None"; + GeneratedIdentifierKind[GeneratedIdentifierKind["Auto"] = 1] = "Auto"; + GeneratedIdentifierKind[GeneratedIdentifierKind["Loop"] = 2] = "Loop"; + GeneratedIdentifierKind[GeneratedIdentifierKind["Unique"] = 3] = "Unique"; + GeneratedIdentifierKind[GeneratedIdentifierKind["Node"] = 4] = "Node"; + })(GeneratedIdentifierKind = ts.GeneratedIdentifierKind || (ts.GeneratedIdentifierKind = {})); + var FlowFlags; (function (FlowFlags) { FlowFlags[FlowFlags["Unreachable"] = 1] = "Unreachable"; FlowFlags[FlowFlags["Start"] = 2] = "Start"; @@ -444,12 +472,12 @@ var ts; FlowFlags[FlowFlags["TrueCondition"] = 32] = "TrueCondition"; FlowFlags[FlowFlags["FalseCondition"] = 64] = "FalseCondition"; FlowFlags[FlowFlags["SwitchClause"] = 128] = "SwitchClause"; - FlowFlags[FlowFlags["Referenced"] = 256] = "Referenced"; - FlowFlags[FlowFlags["Shared"] = 512] = "Shared"; + FlowFlags[FlowFlags["ArrayMutation"] = 256] = "ArrayMutation"; + FlowFlags[FlowFlags["Referenced"] = 512] = "Referenced"; + FlowFlags[FlowFlags["Shared"] = 1024] = "Shared"; FlowFlags[FlowFlags["Label"] = 12] = "Label"; FlowFlags[FlowFlags["Condition"] = 96] = "Condition"; - })(ts.FlowFlags || (ts.FlowFlags = {})); - var FlowFlags = ts.FlowFlags; + })(FlowFlags = ts.FlowFlags || (ts.FlowFlags = {})); var OperationCanceledException = (function () { function OperationCanceledException() { } @@ -457,6 +485,7 @@ var ts; }()); ts.OperationCanceledException = OperationCanceledException; /** Return code used by getEmitOutput function to indicate status of the function */ + var ExitStatus; (function (ExitStatus) { // Compiler ran successfully. Either this was a simple do-nothing compilation (for example, // when -version or -help was provided, or this was a normal compilation, no diagnostics @@ -466,8 +495,8 @@ var ts; ExitStatus[ExitStatus["DiagnosticsPresent_OutputsSkipped"] = 1] = "DiagnosticsPresent_OutputsSkipped"; // Diagnostics were produced and outputs were generated in spite of them. ExitStatus[ExitStatus["DiagnosticsPresent_OutputsGenerated"] = 2] = "DiagnosticsPresent_OutputsGenerated"; - })(ts.ExitStatus || (ts.ExitStatus = {})); - var ExitStatus = ts.ExitStatus; + })(ExitStatus = ts.ExitStatus || (ts.ExitStatus = {})); + var TypeFormatFlags; (function (TypeFormatFlags) { TypeFormatFlags[TypeFormatFlags["None"] = 0] = "None"; TypeFormatFlags[TypeFormatFlags["WriteArrayAsGenericType"] = 1] = "WriteArrayAsGenericType"; @@ -481,8 +510,8 @@ var ts; TypeFormatFlags[TypeFormatFlags["InFirstTypeArgument"] = 256] = "InFirstTypeArgument"; TypeFormatFlags[TypeFormatFlags["InTypeAlias"] = 512] = "InTypeAlias"; TypeFormatFlags[TypeFormatFlags["UseTypeAliasValue"] = 1024] = "UseTypeAliasValue"; - })(ts.TypeFormatFlags || (ts.TypeFormatFlags = {})); - var TypeFormatFlags = ts.TypeFormatFlags; + })(TypeFormatFlags = ts.TypeFormatFlags || (ts.TypeFormatFlags = {})); + var SymbolFormatFlags; (function (SymbolFormatFlags) { SymbolFormatFlags[SymbolFormatFlags["None"] = 0] = "None"; // Write symbols's type argument if it is instantiated symbol @@ -494,23 +523,29 @@ var ts; // eg. module m { export class c { } } import x = m.c; // When this flag is specified m.c will be used to refer to the class instead of alias symbol x SymbolFormatFlags[SymbolFormatFlags["UseOnlyExternalAliasing"] = 2] = "UseOnlyExternalAliasing"; - })(ts.SymbolFormatFlags || (ts.SymbolFormatFlags = {})); - var SymbolFormatFlags = ts.SymbolFormatFlags; + })(SymbolFormatFlags = ts.SymbolFormatFlags || (ts.SymbolFormatFlags = {})); /* @internal */ + var SymbolAccessibility; (function (SymbolAccessibility) { SymbolAccessibility[SymbolAccessibility["Accessible"] = 0] = "Accessible"; SymbolAccessibility[SymbolAccessibility["NotAccessible"] = 1] = "NotAccessible"; SymbolAccessibility[SymbolAccessibility["CannotBeNamed"] = 2] = "CannotBeNamed"; - })(ts.SymbolAccessibility || (ts.SymbolAccessibility = {})); - var SymbolAccessibility = ts.SymbolAccessibility; + })(SymbolAccessibility = ts.SymbolAccessibility || (ts.SymbolAccessibility = {})); + /* @internal */ + var SyntheticSymbolKind; + (function (SyntheticSymbolKind) { + SyntheticSymbolKind[SyntheticSymbolKind["UnionOrIntersection"] = 0] = "UnionOrIntersection"; + SyntheticSymbolKind[SyntheticSymbolKind["Spread"] = 1] = "Spread"; + })(SyntheticSymbolKind = ts.SyntheticSymbolKind || (ts.SyntheticSymbolKind = {})); + var TypePredicateKind; (function (TypePredicateKind) { TypePredicateKind[TypePredicateKind["This"] = 0] = "This"; TypePredicateKind[TypePredicateKind["Identifier"] = 1] = "Identifier"; - })(ts.TypePredicateKind || (ts.TypePredicateKind = {})); - var TypePredicateKind = ts.TypePredicateKind; + })(TypePredicateKind = ts.TypePredicateKind || (ts.TypePredicateKind = {})); /** Indicates how to serialize the name for a TypeReferenceNode when emitting decorator * metadata */ /* @internal */ + var TypeReferenceSerializationKind; (function (TypeReferenceSerializationKind) { TypeReferenceSerializationKind[TypeReferenceSerializationKind["Unknown"] = 0] = "Unknown"; // should be emitted using a safe fallback. @@ -518,17 +553,18 @@ var ts; // function that can be reached at runtime (e.g. a `class` // declaration or a `var` declaration for the static side // of a type, such as the global `Promise` type in lib.d.ts). - TypeReferenceSerializationKind[TypeReferenceSerializationKind["VoidType"] = 2] = "VoidType"; + TypeReferenceSerializationKind[TypeReferenceSerializationKind["VoidNullableOrNeverType"] = 2] = "VoidNullableOrNeverType"; TypeReferenceSerializationKind[TypeReferenceSerializationKind["NumberLikeType"] = 3] = "NumberLikeType"; TypeReferenceSerializationKind[TypeReferenceSerializationKind["StringLikeType"] = 4] = "StringLikeType"; TypeReferenceSerializationKind[TypeReferenceSerializationKind["BooleanType"] = 5] = "BooleanType"; TypeReferenceSerializationKind[TypeReferenceSerializationKind["ArrayLikeType"] = 6] = "ArrayLikeType"; TypeReferenceSerializationKind[TypeReferenceSerializationKind["ESSymbolType"] = 7] = "ESSymbolType"; - TypeReferenceSerializationKind[TypeReferenceSerializationKind["TypeWithCallSignature"] = 8] = "TypeWithCallSignature"; + TypeReferenceSerializationKind[TypeReferenceSerializationKind["Promise"] = 8] = "Promise"; + TypeReferenceSerializationKind[TypeReferenceSerializationKind["TypeWithCallSignature"] = 9] = "TypeWithCallSignature"; // with call signatures. - TypeReferenceSerializationKind[TypeReferenceSerializationKind["ObjectType"] = 9] = "ObjectType"; - })(ts.TypeReferenceSerializationKind || (ts.TypeReferenceSerializationKind = {})); - var TypeReferenceSerializationKind = ts.TypeReferenceSerializationKind; + TypeReferenceSerializationKind[TypeReferenceSerializationKind["ObjectType"] = 10] = "ObjectType"; + })(TypeReferenceSerializationKind = ts.TypeReferenceSerializationKind || (ts.TypeReferenceSerializationKind = {})); + var SymbolFlags; (function (SymbolFlags) { SymbolFlags[SymbolFlags["None"] = 0] = "None"; SymbolFlags[SymbolFlags["FunctionScopedVariable"] = 1] = "FunctionScopedVariable"; @@ -603,9 +639,9 @@ var ts; // The set of things we consider semantically classifiable. Used to speed up the LS during // classification. SymbolFlags[SymbolFlags["Classifiable"] = 788448] = "Classifiable"; - })(ts.SymbolFlags || (ts.SymbolFlags = {})); - var SymbolFlags = ts.SymbolFlags; + })(SymbolFlags = ts.SymbolFlags || (ts.SymbolFlags = {})); /* @internal */ + var NodeCheckFlags; (function (NodeCheckFlags) { NodeCheckFlags[NodeCheckFlags["TypeChecked"] = 1] = "TypeChecked"; NodeCheckFlags[NodeCheckFlags["LexicalThis"] = 2] = "LexicalThis"; @@ -625,8 +661,10 @@ var ts; NodeCheckFlags[NodeCheckFlags["BodyScopedClassBinding"] = 1048576] = "BodyScopedClassBinding"; NodeCheckFlags[NodeCheckFlags["NeedsLoopOutParameter"] = 2097152] = "NeedsLoopOutParameter"; NodeCheckFlags[NodeCheckFlags["AssignmentsMarked"] = 4194304] = "AssignmentsMarked"; - })(ts.NodeCheckFlags || (ts.NodeCheckFlags = {})); - var NodeCheckFlags = ts.NodeCheckFlags; + NodeCheckFlags[NodeCheckFlags["ClassWithConstructorReference"] = 8388608] = "ClassWithConstructorReference"; + NodeCheckFlags[NodeCheckFlags["ConstructorReferenceInClass"] = 16777216] = "ConstructorReferenceInClass"; + })(NodeCheckFlags = ts.NodeCheckFlags || (ts.NodeCheckFlags = {})); + var TypeFlags; (function (TypeFlags) { TypeFlags[TypeFlags["Any"] = 1] = "Any"; TypeFlags[TypeFlags["String"] = 2] = "String"; @@ -643,29 +681,23 @@ var ts; TypeFlags[TypeFlags["Null"] = 4096] = "Null"; TypeFlags[TypeFlags["Never"] = 8192] = "Never"; TypeFlags[TypeFlags["TypeParameter"] = 16384] = "TypeParameter"; - TypeFlags[TypeFlags["Class"] = 32768] = "Class"; - TypeFlags[TypeFlags["Interface"] = 65536] = "Interface"; - TypeFlags[TypeFlags["Reference"] = 131072] = "Reference"; - TypeFlags[TypeFlags["Tuple"] = 262144] = "Tuple"; - TypeFlags[TypeFlags["Union"] = 524288] = "Union"; - TypeFlags[TypeFlags["Intersection"] = 1048576] = "Intersection"; - TypeFlags[TypeFlags["Anonymous"] = 2097152] = "Anonymous"; - TypeFlags[TypeFlags["Instantiated"] = 4194304] = "Instantiated"; + TypeFlags[TypeFlags["Object"] = 32768] = "Object"; + TypeFlags[TypeFlags["Union"] = 65536] = "Union"; + TypeFlags[TypeFlags["Intersection"] = 131072] = "Intersection"; + TypeFlags[TypeFlags["Index"] = 262144] = "Index"; + TypeFlags[TypeFlags["IndexedAccess"] = 524288] = "IndexedAccess"; /* @internal */ - TypeFlags[TypeFlags["ObjectLiteral"] = 8388608] = "ObjectLiteral"; + TypeFlags[TypeFlags["FreshLiteral"] = 1048576] = "FreshLiteral"; /* @internal */ - TypeFlags[TypeFlags["FreshObjectLiteral"] = 16777216] = "FreshObjectLiteral"; + TypeFlags[TypeFlags["ContainsWideningType"] = 2097152] = "ContainsWideningType"; /* @internal */ - TypeFlags[TypeFlags["ContainsWideningType"] = 33554432] = "ContainsWideningType"; + TypeFlags[TypeFlags["ContainsObjectLiteral"] = 4194304] = "ContainsObjectLiteral"; /* @internal */ - TypeFlags[TypeFlags["ContainsObjectLiteral"] = 67108864] = "ContainsObjectLiteral"; - /* @internal */ - TypeFlags[TypeFlags["ContainsAnyFunctionType"] = 134217728] = "ContainsAnyFunctionType"; - TypeFlags[TypeFlags["ThisType"] = 268435456] = "ThisType"; - TypeFlags[TypeFlags["ObjectLiteralPatternWithComputedProperties"] = 536870912] = "ObjectLiteralPatternWithComputedProperties"; + TypeFlags[TypeFlags["ContainsAnyFunctionType"] = 8388608] = "ContainsAnyFunctionType"; /* @internal */ TypeFlags[TypeFlags["Nullable"] = 6144] = "Nullable"; TypeFlags[TypeFlags["Literal"] = 480] = "Literal"; + TypeFlags[TypeFlags["StringOrNumberLiteral"] = 96] = "StringOrNumberLiteral"; /* @internal */ TypeFlags[TypeFlags["DefinitelyFalsy"] = 7392] = "DefinitelyFalsy"; TypeFlags[TypeFlags["PossiblyFalsy"] = 7406] = "PossiblyFalsy"; @@ -673,35 +705,49 @@ 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"; - TypeFlags[TypeFlags["ObjectType"] = 2588672] = "ObjectType"; - TypeFlags[TypeFlags["UnionOrIntersection"] = 1572864] = "UnionOrIntersection"; - TypeFlags[TypeFlags["StructuredType"] = 4161536] = "StructuredType"; - TypeFlags[TypeFlags["StructuredOrTypeParameter"] = 4177920] = "StructuredOrTypeParameter"; + TypeFlags[TypeFlags["UnionOrIntersection"] = 196608] = "UnionOrIntersection"; + TypeFlags[TypeFlags["StructuredType"] = 229376] = "StructuredType"; + TypeFlags[TypeFlags["StructuredOrTypeParameter"] = 507904] = "StructuredOrTypeParameter"; + TypeFlags[TypeFlags["TypeVariable"] = 540672] = "TypeVariable"; // 'Narrowable' types are types where narrowing actually narrows. // This *should* be every type other than null, undefined, void, and never - TypeFlags[TypeFlags["Narrowable"] = 4178943] = "Narrowable"; - TypeFlags[TypeFlags["NotUnionOrUnit"] = 2589191] = "NotUnionOrUnit"; + TypeFlags[TypeFlags["Narrowable"] = 1033215] = "Narrowable"; + TypeFlags[TypeFlags["NotUnionOrUnit"] = 33281] = "NotUnionOrUnit"; /* @internal */ - TypeFlags[TypeFlags["RequiresWidening"] = 100663296] = "RequiresWidening"; + TypeFlags[TypeFlags["RequiresWidening"] = 6291456] = "RequiresWidening"; /* @internal */ - TypeFlags[TypeFlags["PropagatingFlags"] = 234881024] = "PropagatingFlags"; - })(ts.TypeFlags || (ts.TypeFlags = {})); - var TypeFlags = ts.TypeFlags; + TypeFlags[TypeFlags["PropagatingFlags"] = 14680064] = "PropagatingFlags"; + })(TypeFlags = ts.TypeFlags || (ts.TypeFlags = {})); + var ObjectFlags; + (function (ObjectFlags) { + ObjectFlags[ObjectFlags["Class"] = 1] = "Class"; + ObjectFlags[ObjectFlags["Interface"] = 2] = "Interface"; + ObjectFlags[ObjectFlags["Reference"] = 4] = "Reference"; + ObjectFlags[ObjectFlags["Tuple"] = 8] = "Tuple"; + ObjectFlags[ObjectFlags["Anonymous"] = 16] = "Anonymous"; + ObjectFlags[ObjectFlags["Mapped"] = 32] = "Mapped"; + ObjectFlags[ObjectFlags["Instantiated"] = 64] = "Instantiated"; + ObjectFlags[ObjectFlags["ObjectLiteral"] = 128] = "ObjectLiteral"; + ObjectFlags[ObjectFlags["EvolvingArray"] = 256] = "EvolvingArray"; + ObjectFlags[ObjectFlags["ObjectLiteralPatternWithComputedProperties"] = 512] = "ObjectLiteralPatternWithComputedProperties"; + ObjectFlags[ObjectFlags["ClassOrInterface"] = 3] = "ClassOrInterface"; + })(ObjectFlags = ts.ObjectFlags || (ts.ObjectFlags = {})); + var SignatureKind; (function (SignatureKind) { SignatureKind[SignatureKind["Call"] = 0] = "Call"; SignatureKind[SignatureKind["Construct"] = 1] = "Construct"; - })(ts.SignatureKind || (ts.SignatureKind = {})); - var SignatureKind = ts.SignatureKind; + })(SignatureKind = ts.SignatureKind || (ts.SignatureKind = {})); + var IndexKind; (function (IndexKind) { IndexKind[IndexKind["String"] = 0] = "String"; IndexKind[IndexKind["Number"] = 1] = "Number"; - })(ts.IndexKind || (ts.IndexKind = {})); - var IndexKind = ts.IndexKind; + })(IndexKind = ts.IndexKind || (ts.IndexKind = {})); /* @internal */ + var SpecialPropertyAssignmentKind; (function (SpecialPropertyAssignmentKind) { SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["None"] = 0] = "None"; /// exports.name = expr @@ -712,73 +758,74 @@ var ts; SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["PrototypeProperty"] = 3] = "PrototypeProperty"; /// this.name = expr SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["ThisProperty"] = 4] = "ThisProperty"; - })(ts.SpecialPropertyAssignmentKind || (ts.SpecialPropertyAssignmentKind = {})); - var SpecialPropertyAssignmentKind = ts.SpecialPropertyAssignmentKind; + })(SpecialPropertyAssignmentKind = ts.SpecialPropertyAssignmentKind || (ts.SpecialPropertyAssignmentKind = {})); + var DiagnosticCategory; (function (DiagnosticCategory) { DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning"; DiagnosticCategory[DiagnosticCategory["Error"] = 1] = "Error"; DiagnosticCategory[DiagnosticCategory["Message"] = 2] = "Message"; - })(ts.DiagnosticCategory || (ts.DiagnosticCategory = {})); - var DiagnosticCategory = ts.DiagnosticCategory; + })(DiagnosticCategory = ts.DiagnosticCategory || (ts.DiagnosticCategory = {})); + var ModuleResolutionKind; (function (ModuleResolutionKind) { ModuleResolutionKind[ModuleResolutionKind["Classic"] = 1] = "Classic"; ModuleResolutionKind[ModuleResolutionKind["NodeJs"] = 2] = "NodeJs"; - })(ts.ModuleResolutionKind || (ts.ModuleResolutionKind = {})); - var ModuleResolutionKind = ts.ModuleResolutionKind; + })(ModuleResolutionKind = ts.ModuleResolutionKind || (ts.ModuleResolutionKind = {})); + var ModuleKind; (function (ModuleKind) { ModuleKind[ModuleKind["None"] = 0] = "None"; ModuleKind[ModuleKind["CommonJS"] = 1] = "CommonJS"; ModuleKind[ModuleKind["AMD"] = 2] = "AMD"; ModuleKind[ModuleKind["UMD"] = 3] = "UMD"; ModuleKind[ModuleKind["System"] = 4] = "System"; - ModuleKind[ModuleKind["ES6"] = 5] = "ES6"; ModuleKind[ModuleKind["ES2015"] = 5] = "ES2015"; - })(ts.ModuleKind || (ts.ModuleKind = {})); - var ModuleKind = ts.ModuleKind; + })(ModuleKind = ts.ModuleKind || (ts.ModuleKind = {})); + var JsxEmit; (function (JsxEmit) { JsxEmit[JsxEmit["None"] = 0] = "None"; JsxEmit[JsxEmit["Preserve"] = 1] = "Preserve"; JsxEmit[JsxEmit["React"] = 2] = "React"; - })(ts.JsxEmit || (ts.JsxEmit = {})); - var JsxEmit = ts.JsxEmit; + })(JsxEmit = ts.JsxEmit || (ts.JsxEmit = {})); + var NewLineKind; (function (NewLineKind) { NewLineKind[NewLineKind["CarriageReturnLineFeed"] = 0] = "CarriageReturnLineFeed"; NewLineKind[NewLineKind["LineFeed"] = 1] = "LineFeed"; - })(ts.NewLineKind || (ts.NewLineKind = {})); - var NewLineKind = ts.NewLineKind; + })(NewLineKind = ts.NewLineKind || (ts.NewLineKind = {})); + var ScriptKind; (function (ScriptKind) { ScriptKind[ScriptKind["Unknown"] = 0] = "Unknown"; ScriptKind[ScriptKind["JS"] = 1] = "JS"; ScriptKind[ScriptKind["JSX"] = 2] = "JSX"; ScriptKind[ScriptKind["TS"] = 3] = "TS"; ScriptKind[ScriptKind["TSX"] = 4] = "TSX"; - })(ts.ScriptKind || (ts.ScriptKind = {})); - var ScriptKind = ts.ScriptKind; + })(ScriptKind = ts.ScriptKind || (ts.ScriptKind = {})); + var ScriptTarget; (function (ScriptTarget) { ScriptTarget[ScriptTarget["ES3"] = 0] = "ES3"; ScriptTarget[ScriptTarget["ES5"] = 1] = "ES5"; - ScriptTarget[ScriptTarget["ES6"] = 2] = "ES6"; ScriptTarget[ScriptTarget["ES2015"] = 2] = "ES2015"; - ScriptTarget[ScriptTarget["Latest"] = 2] = "Latest"; - })(ts.ScriptTarget || (ts.ScriptTarget = {})); - var ScriptTarget = ts.ScriptTarget; + ScriptTarget[ScriptTarget["ES2016"] = 3] = "ES2016"; + ScriptTarget[ScriptTarget["ES2017"] = 4] = "ES2017"; + ScriptTarget[ScriptTarget["ESNext"] = 5] = "ESNext"; + ScriptTarget[ScriptTarget["Latest"] = 5] = "Latest"; + })(ScriptTarget = ts.ScriptTarget || (ts.ScriptTarget = {})); + var LanguageVariant; (function (LanguageVariant) { LanguageVariant[LanguageVariant["Standard"] = 0] = "Standard"; LanguageVariant[LanguageVariant["JSX"] = 1] = "JSX"; - })(ts.LanguageVariant || (ts.LanguageVariant = {})); - var LanguageVariant = ts.LanguageVariant; + })(LanguageVariant = ts.LanguageVariant || (ts.LanguageVariant = {})); /* @internal */ + var DiagnosticStyle; (function (DiagnosticStyle) { DiagnosticStyle[DiagnosticStyle["Simple"] = 0] = "Simple"; DiagnosticStyle[DiagnosticStyle["Pretty"] = 1] = "Pretty"; - })(ts.DiagnosticStyle || (ts.DiagnosticStyle = {})); - var DiagnosticStyle = ts.DiagnosticStyle; + })(DiagnosticStyle = ts.DiagnosticStyle || (ts.DiagnosticStyle = {})); + var WatchDirectoryFlags; (function (WatchDirectoryFlags) { WatchDirectoryFlags[WatchDirectoryFlags["None"] = 0] = "None"; WatchDirectoryFlags[WatchDirectoryFlags["Recursive"] = 1] = "Recursive"; - })(ts.WatchDirectoryFlags || (ts.WatchDirectoryFlags = {})); - var WatchDirectoryFlags = ts.WatchDirectoryFlags; + })(WatchDirectoryFlags = ts.WatchDirectoryFlags || (ts.WatchDirectoryFlags = {})); /* @internal */ + var CharacterCodes; (function (CharacterCodes) { CharacterCodes[CharacterCodes["nullCharacter"] = 0] = "nullCharacter"; CharacterCodes[CharacterCodes["maxAsciiCharacter"] = 127] = "maxAsciiCharacter"; @@ -905,8 +952,140 @@ var ts; CharacterCodes[CharacterCodes["byteOrderMark"] = 65279] = "byteOrderMark"; CharacterCodes[CharacterCodes["tab"] = 9] = "tab"; CharacterCodes[CharacterCodes["verticalTab"] = 11] = "verticalTab"; - })(ts.CharacterCodes || (ts.CharacterCodes = {})); - var CharacterCodes = ts.CharacterCodes; + })(CharacterCodes = ts.CharacterCodes || (ts.CharacterCodes = {})); + var Extension; + (function (Extension) { + Extension[Extension["Ts"] = 0] = "Ts"; + Extension[Extension["Tsx"] = 1] = "Tsx"; + Extension[Extension["Dts"] = 2] = "Dts"; + Extension[Extension["Js"] = 3] = "Js"; + Extension[Extension["Jsx"] = 4] = "Jsx"; + Extension[Extension["LastTypeScriptExtension"] = 2] = "LastTypeScriptExtension"; + })(Extension = ts.Extension || (ts.Extension = {})); + /* @internal */ + var TransformFlags; + (function (TransformFlags) { + TransformFlags[TransformFlags["None"] = 0] = "None"; + // Facts + // - 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["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"] = 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"] = 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"] = 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"] = 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"] = 274432] = "TypeScriptClassSyntaxMask"; + TransformFlags[TransformFlags["ES2015FunctionSyntaxMask"] = 163840] = "ES2015FunctionSyntaxMask"; + })(TransformFlags = ts.TransformFlags || (ts.TransformFlags = {})); + /* @internal */ + var EmitFlags; + (function (EmitFlags) { + 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 = {})); + /** + * Used by the checker, this enum keeps track of external emit helpers that should be type + * checked. + */ + /* @internal */ + var ExternalEmitHelpers; + (function (ExternalEmitHelpers) { + ExternalEmitHelpers[ExternalEmitHelpers["Extends"] = 1] = "Extends"; + ExternalEmitHelpers[ExternalEmitHelpers["Assign"] = 2] = "Assign"; + ExternalEmitHelpers[ExternalEmitHelpers["Rest"] = 4] = "Rest"; + ExternalEmitHelpers[ExternalEmitHelpers["Decorate"] = 8] = "Decorate"; + ExternalEmitHelpers[ExternalEmitHelpers["Metadata"] = 16] = "Metadata"; + ExternalEmitHelpers[ExternalEmitHelpers["Param"] = 32] = "Param"; + ExternalEmitHelpers[ExternalEmitHelpers["Awaiter"] = 64] = "Awaiter"; + ExternalEmitHelpers[ExternalEmitHelpers["Generator"] = 128] = "Generator"; + ExternalEmitHelpers[ExternalEmitHelpers["FirstEmitHelper"] = 1] = "FirstEmitHelper"; + ExternalEmitHelpers[ExternalEmitHelpers["LastEmitHelper"] = 128] = "LastEmitHelper"; + })(ExternalEmitHelpers = ts.ExternalEmitHelpers || (ts.ExternalEmitHelpers = {})); + /* @internal */ + var EmitContext; + (function (EmitContext) { + EmitContext[EmitContext["SourceFile"] = 0] = "SourceFile"; + EmitContext[EmitContext["Expression"] = 1] = "Expression"; + EmitContext[EmitContext["IdentifierName"] = 2] = "IdentifierName"; + EmitContext[EmitContext["Unspecified"] = 3] = "Unspecified"; + })(EmitContext = ts.EmitContext || (ts.EmitContext = {})); })(ts || (ts = {})); /*@internal*/ var ts; @@ -916,13 +1095,12 @@ var ts; })(ts || (ts = {})); /*@internal*/ /** Performance measurements for the compiler. */ -var ts; (function (ts) { var performance; (function (performance) { var profilerEvent = typeof onProfilerEvent === "function" && onProfilerEvent.profiler === true ? onProfilerEvent - : function (markName) { }; + : function (_markName) { }; var enabled = false; var profilerStart = 0; var counts; @@ -1005,8 +1183,12 @@ var ts; })(ts || (ts = {})); /// /// -/* @internal */ var ts; +(function (ts) { + /** The version of the TypeScript compiler release */ + ts.version = "2.1.5"; +})(ts || (ts = {})); +/* @internal */ (function (ts) { /** * Ternary values are defined such that @@ -1017,13 +1199,15 @@ var ts; * x | y is Maybe if either x or y is Maybe, but neither x or y is True. * x | y is True if either x or y is True. */ + var Ternary; (function (Ternary) { Ternary[Ternary["False"] = 0] = "False"; Ternary[Ternary["Maybe"] = 1] = "Maybe"; Ternary[Ternary["True"] = -1] = "True"; - })(ts.Ternary || (ts.Ternary = {})); - var Ternary = ts.Ternary; + })(Ternary = ts.Ternary || (ts.Ternary = {})); var createObject = Object.create; + // More efficient to create a collator once and use its `compare` than to call `a.localeCompare(b)` many times. + ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined; function createMap(template) { var map = createObject(null); // tslint:disable-line:no-null-keyword // Using 'delete' on an object causes V8 to put the object in dictionary mode. @@ -1048,13 +1232,21 @@ var ts; contains: contains, remove: remove, forEachValue: forEachValueInMap, - clear: clear + getKeys: getKeys, + clear: clear, }; function forEachValueInMap(f) { for (var key in files) { f(key, files[key]); } } + function getKeys() { + var keys = []; + for (var key in files) { + keys.push(key); + } + return keys; + } // path should already be well-formed so it does not need to be normalized function get(path) { return files[toKey(path)]; @@ -1084,12 +1276,12 @@ var ts; return getCanonicalFileName(nonCanonicalizedPath); } ts.toPath = toPath; + var Comparison; (function (Comparison) { Comparison[Comparison["LessThan"] = -1] = "LessThan"; Comparison[Comparison["EqualTo"] = 0] = "EqualTo"; Comparison[Comparison["GreaterThan"] = 1] = "GreaterThan"; - })(ts.Comparison || (ts.Comparison = {})); - var Comparison = ts.Comparison; + })(Comparison = ts.Comparison || (ts.Comparison = {})); /** * Iterates through 'array' by index and performs the callback on each element of array until the callback * returns a truthy value, then returns that value. @@ -1107,6 +1299,29 @@ var ts; return undefined; } ts.forEach = forEach; + function zipWith(arrayA, arrayB, callback) { + Debug.assert(arrayA.length === arrayB.length); + for (var i = 0; i < arrayA.length; i++) { + callback(arrayA[i], arrayB[i], i); + } + } + ts.zipWith = zipWith; + /** + * Iterates through `array` by index and performs the callback on each element of array until the callback + * returns a falsey value, then returns false. + * If no such value is found, the callback is applied to each element of array and `true` is returned. + */ + function every(array, callback) { + if (array) { + for (var i = 0, len = array.length; i < len; i++) { + if (!callback(array[i], i)) { + return false; + } + } + } + return true; + } + ts.every = every; /** Works like Array.prototype.find, returning `undefined` if no element satisfying the predicate is found. */ function find(array, predicate) { for (var i = 0, len = array.length; i < len; i++) { @@ -1167,9 +1382,9 @@ var ts; function countWhere(array, predicate) { var count = 0; if (array) { - for (var _i = 0, array_2 = array; _i < array_2.length; _i++) { - var v = array_2[_i]; - if (predicate(v)) { + for (var i = 0; i < array.length; i++) { + var v = array[i]; + if (predicate(v, i)) { count++; } } @@ -1177,10 +1392,6 @@ var ts; return count; } ts.countWhere = countWhere; - /** - * Filters an array by a predicate function. Returns the same array instance if the predicate is - * true for all elements, otherwise returns a new array instance containing the filtered subset. - */ function filter(array, f) { if (array) { var len = array.length; @@ -1205,8 +1416,8 @@ var ts; ts.filter = filter; function removeWhere(array, f) { var outIndex = 0; - for (var _i = 0, array_3 = array; _i < array_3.length; _i++) { - var item = array_3[_i]; + for (var _i = 0, array_2 = array; _i < array_2.length; _i++) { + var item = array_2[_i]; if (!f(item)) { array[outIndex] = item; outIndex++; @@ -1221,8 +1432,8 @@ var ts; ts.removeWhere = removeWhere; function filterMutate(array, f) { var outIndex = 0; - for (var _i = 0, array_4 = array; _i < array_4.length; _i++) { - var item = array_4[_i]; + for (var _i = 0, array_3 = array; _i < array_3.length; _i++) { + var item = array_3[_i]; if (f(item)) { array[outIndex] = item; outIndex++; @@ -1235,22 +1446,182 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, array_5 = array; _i < array_5.length; _i++) { - var v = array_5[_i]; - result.push(f(v)); + for (var i = 0; i < array.length; i++) { + result.push(f(array[i], i)); } } return result; } ts.map = map; + // Maps from T to T and avoids allocation if all elements map to themselves + function sameMap(array, f) { + var result; + if (array) { + for (var i = 0; i < array.length; i++) { + if (result) { + result.push(f(array[i], i)); + } + else { + var item = array[i]; + var mapped = f(item, i); + if (item !== mapped) { + result = array.slice(0, i); + result.push(mapped); + } + } + } + } + return result || array; + } + ts.sameMap = sameMap; + /** + * Flattens an array containing a mix of array or non-array elements. + * + * @param array The array to flatten. + */ + function flatten(array) { + var result; + if (array) { + result = []; + for (var _i = 0, array_4 = array; _i < array_4.length; _i++) { + var v = array_4[_i]; + if (v) { + if (isArray(v)) { + addRange(result, v); + } + else { + result.push(v); + } + } + } + } + return result; + } + ts.flatten = flatten; + /** + * Maps an array. If the mapped value is an array, it is spread into the result. + * + * @param array The array to map. + * @param mapfn The callback used to map the result into one or more values. + */ + function flatMap(array, mapfn) { + var result; + if (array) { + result = []; + for (var i = 0; i < array.length; i++) { + var v = mapfn(array[i], i); + if (v) { + if (isArray(v)) { + addRange(result, v); + } + else { + result.push(v); + } + } + } + } + return result; + } + ts.flatMap = flatMap; + /** + * Computes the first matching span of elements and returns a tuple of the first span + * and the remaining elements. + */ + function span(array, f) { + if (array) { + for (var i = 0; i < array.length; i++) { + if (!f(array[i], i)) { + return [array.slice(0, i), array.slice(i)]; + } + } + return [array.slice(0), []]; + } + return undefined; + } + ts.span = span; + /** + * Maps contiguous spans of values with the same key. + * + * @param array The array to map. + * @param keyfn A callback used to select the key for an element. + * @param mapfn A callback used to map a contiguous chunk of values to a single value. + */ + function spanMap(array, keyfn, mapfn) { + var result; + if (array) { + result = []; + var len = array.length; + var previousKey = void 0; + var key = void 0; + var start = 0; + var pos = 0; + while (start < len) { + while (pos < len) { + var value = array[pos]; + key = keyfn(value, pos); + if (pos === 0) { + previousKey = key; + } + else if (key !== previousKey) { + break; + } + pos++; + } + if (start < pos) { + var v = mapfn(array.slice(start, pos), previousKey, start, pos); + if (v) { + result.push(v); + } + start = pos; + } + previousKey = key; + pos++; + } + } + return result; + } + ts.spanMap = spanMap; + function mapObject(object, f) { + var result; + if (object) { + result = {}; + for (var _i = 0, _a = getOwnKeys(object); _i < _a.length; _i++) { + var v = _a[_i]; + var _b = f(v, object[v]) || [undefined, undefined], key = _b[0], value = _b[1]; + if (key !== undefined) { + result[key] = value; + } + } + } + return result; + } + ts.mapObject = mapObject; + function some(array, predicate) { + if (array) { + if (predicate) { + for (var _i = 0, array_5 = array; _i < array_5.length; _i++) { + var v = array_5[_i]; + if (predicate(v)) { + return true; + } + } + } + else { + return array.length > 0; + } + } + return false; + } + ts.some = some; function concatenate(array1, array2) { - if (!array2 || !array2.length) + if (!some(array2)) return array1; - if (!array1 || !array1.length) + if (!some(array1)) return array2; return array1.concat(array2); } ts.concatenate = concatenate; + // TODO: fixme (N^2) - add optional comparer so collection can be sorted before deduplication. function deduplicate(array, areEqual) { var result; if (array) { @@ -1269,6 +1640,87 @@ var ts; return result; } ts.deduplicate = deduplicate; + function arrayIsEqualTo(array1, array2, equaler) { + if (!array1 || !array2) { + return array1 === array2; + } + if (array1.length !== array2.length) { + return false; + } + for (var i = 0; i < array1.length; i++) { + var equals = equaler ? equaler(array1[i], array2[i]) : array1[i] === array2[i]; + if (!equals) { + return false; + } + } + return true; + } + ts.arrayIsEqualTo = arrayIsEqualTo; + function changesAffectModuleResolution(oldOptions, newOptions) { + return !oldOptions || + (oldOptions.module !== newOptions.module) || + (oldOptions.moduleResolution !== newOptions.moduleResolution) || + (oldOptions.noResolve !== newOptions.noResolve) || + (oldOptions.target !== newOptions.target) || + (oldOptions.noLib !== newOptions.noLib) || + (oldOptions.jsx !== newOptions.jsx) || + (oldOptions.allowJs !== newOptions.allowJs) || + (oldOptions.rootDir !== newOptions.rootDir) || + (oldOptions.configFilePath !== newOptions.configFilePath) || + (oldOptions.baseUrl !== newOptions.baseUrl) || + (oldOptions.maxNodeModuleJsDepth !== newOptions.maxNodeModuleJsDepth) || + !arrayIsEqualTo(oldOptions.lib, newOptions.lib) || + !arrayIsEqualTo(oldOptions.typeRoots, newOptions.typeRoots) || + !arrayIsEqualTo(oldOptions.rootDirs, newOptions.rootDirs) || + !equalOwnProperties(oldOptions.paths, newOptions.paths); + } + ts.changesAffectModuleResolution = changesAffectModuleResolution; + /** + * Compacts an array, removing any falsey elements. + */ + function compact(array) { + var result; + if (array) { + for (var i = 0; i < array.length; i++) { + var v = array[i]; + if (result || !v) { + if (!result) { + result = array.slice(0, i); + } + if (v) { + result.push(v); + } + } + } + } + return result || array; + } + ts.compact = compact; + /** + * Gets the relative complement of `arrayA` with respect to `b`, returning the elements that + * are not present in `arrayA` but are present in `arrayB`. Assumes both arrays are sorted + * based on the provided comparer. + */ + function relativeComplement(arrayA, arrayB, comparer, offsetA, offsetB) { + if (comparer === void 0) { comparer = compareValues; } + if (offsetA === void 0) { offsetA = 0; } + if (offsetB === void 0) { offsetB = 0; } + if (!arrayB || !arrayA || arrayB.length === 0 || arrayA.length === 0) + return arrayB; + var result = []; + outer: for (; offsetB < arrayB.length; offsetB++) { + inner: for (; offsetA < arrayA.length; offsetA++) { + switch (comparer(arrayB[offsetB], arrayA[offsetA])) { + case -1 /* LessThan */: break inner; + case 0 /* EqualTo */: continue outer; + case 1 /* GreaterThan */: continue inner; + } + } + result.push(arrayB[offsetB]); + } + return result; + } + ts.relativeComplement = relativeComplement; function sum(array, prop) { var result = 0; for (var _i = 0, array_7 = array; _i < array_7.length; _i++) { @@ -1278,15 +1730,52 @@ var ts; return result; } ts.sum = sum; + /** + * Appends a value to an array, returning the array. + * + * @param to The array to which `value` is to be appended. If `to` is `undefined`, a new array + * is created if `value` was appended. + * @param value The value to append to the array. If `value` is `undefined`, nothing is + * appended. + */ + function append(to, value) { + if (value === undefined) + return to; + if (to === undefined) + return [value]; + to.push(value); + return to; + } + ts.append = append; + /** + * Appends a range of value to an array, returning the array. + * + * @param to The array to which `value` is to be appended. If `to` is `undefined`, a new array + * is created if `value` was appended. + * @param from The values to append to the array. If `from` is `undefined`, nothing is + * appended. If an element of `from` is `undefined`, that element is not appended. + */ function addRange(to, from) { - if (to && from) { - for (var _i = 0, from_1 = from; _i < from_1.length; _i++) { - var v = from_1[_i]; - to.push(v); - } + if (from === undefined) + return to; + for (var _i = 0, from_1 = from; _i < from_1.length; _i++) { + var v = from_1[_i]; + to = append(to, v); } + 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]) { @@ -1298,15 +1787,48 @@ var ts; } ts.rangeEquals = rangeEquals; /** - * Returns the last element of an array if non-empty, undefined otherwise. + * Returns the first element of an array if non-empty, `undefined` otherwise. + */ + function firstOrUndefined(array) { + return array && array.length > 0 + ? array[0] + : undefined; + } + ts.firstOrUndefined = firstOrUndefined; + /** + * Returns the last element of an array if non-empty, `undefined` otherwise. */ function lastOrUndefined(array) { - if (array.length === 0) { - return undefined; - } - return array[array.length - 1]; + return array && array.length > 0 + ? array[array.length - 1] + : undefined; } ts.lastOrUndefined = lastOrUndefined; + /** + * Returns the only element of an array if it contains only one element, `undefined` otherwise. + */ + function singleOrUndefined(array) { + return array && array.length === 1 + ? array[0] + : undefined; + } + ts.singleOrUndefined = singleOrUndefined; + /** + * Returns the only element of an array if it contains only one element; otheriwse, returns the + * array. + */ + function singleOrMany(array) { + return array && array.length === 1 + ? array[0] + : array; + } + ts.singleOrMany = singleOrMany; + function replaceElement(array, index, value) { + var result = array.slice(0); + result[index] = value; + return result; + } + ts.replaceElement = replaceElement; /** * Performs a binary search, finding the index at which 'value' occurs in 'array'. * If no such index is found, returns the 2's-complement of first index at which @@ -1314,16 +1836,22 @@ var ts; * @param array A sorted array whose first element must be no larger than number * @param number The value to be searched for in the array. */ - function binarySearch(array, value) { - var low = 0; + function binarySearch(array, value, comparer, offset) { + if (!array || array.length === 0) { + return -1; + } + var low = offset || 0; var high = array.length - 1; + comparer = comparer !== undefined + ? comparer + : function (v1, v2) { return (v1 < v2 ? -1 : (v1 > v2 ? 1 : 0)); }; while (low <= high) { var middle = low + ((high - low) >> 1); var midValue = array[middle]; - if (midValue === value) { + if (comparer(midValue, value) === 0) { return middle; } - else if (midValue > value) { + else if (comparer(midValue, value) > 0) { high = middle - 1; } else { @@ -1333,11 +1861,12 @@ var ts; return ~low; } ts.binarySearch = binarySearch; - function reduceLeft(array, f, initial) { - if (array) { - var count = array.length; - if (count > 0) { - var pos = 0; + function reduceLeft(array, f, initial, start, count) { + if (array && array.length > 0) { + var size = array.length; + if (size > 0) { + var pos = start === undefined || start < 0 ? 0 : start; + var end = count === undefined || pos + count > size - 1 ? size - 1 : pos + count; var result = void 0; if (arguments.length <= 2) { result = array[pos]; @@ -1346,8 +1875,8 @@ var ts; else { result = initial; } - while (pos < count) { - result = f(result, array[pos]); + while (pos <= end) { + result = f(result, array[pos], pos); pos++; } return result; @@ -1356,10 +1885,12 @@ var ts; return initial; } ts.reduceLeft = reduceLeft; - function reduceRight(array, f, initial) { + function reduceRight(array, f, initial, start, count) { if (array) { - var pos = array.length - 1; - if (pos >= 0) { + var size = array.length; + if (size > 0) { + var pos = start === undefined || start > size - 1 ? size - 1 : start; + var end = count === undefined || pos - count < 0 ? 0 : pos - count; var result = void 0; if (arguments.length <= 2) { result = array[pos]; @@ -1368,8 +1899,8 @@ var ts; else { result = initial; } - while (pos >= 0) { - result = f(result, array[pos]); + while (pos >= end) { + result = f(result, array[pos], pos); pos--; } return result; @@ -1463,6 +1994,30 @@ 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++) { + args[_i - 1] = arguments[_i]; + } + for (var _a = 0, args_1 = args; _a < args_1.length; _a++) { + var arg = args_1[_a]; + for (var _b = 0, _c = getOwnKeys(arg); _b < _c.length; _b++) { + var p = _c[_b]; + t[p] = arg[p]; + } + } + return t; + } + ts.assign = assign; /** * Reduce the properties of a map. * @@ -1481,25 +2036,6 @@ var ts; return result; } ts.reduceProperties = reduceProperties; - /** - * Reduce the properties defined on a map-like (but not from its prototype chain). - * - * NOTE: This is intended for use with MapLike objects. For Map objects, use - * reduceProperties instead as it offers better performance. - * - * @param map The map-like to reduce - * @param callback An aggregation function that is called for each entry in the map - * @param initial The initial value for the reduction. - */ - function reduceOwnProperties(map, callback, initial) { - var result = initial; - for (var key in map) - if (hasOwnProperty.call(map, key)) { - result = callback(result, map[key], String(key)); - } - return result; - } - ts.reduceOwnProperties = reduceOwnProperties; /** * Performs a shallow equality comparison of the contents of two map-likes. * @@ -1535,6 +2071,15 @@ var ts; return result; } ts.arrayToMap = arrayToMap; + function isEmpty(map) { + for (var id in map) { + if (hasProperty(map, id)) { + return false; + } + } + return true; + } + ts.isEmpty = isEmpty; function cloneMap(map) { var clone = createMap(); copyProperties(map, clone); @@ -1564,6 +2109,36 @@ var ts; return result; } ts.extend = extend; + /** + * Adds the value to an array of values associated with the key, and returns the array. + * Creates the array if it does not already exist. + */ + function multiMapAdd(map, key, value) { + var values = map[key]; + if (values) { + values.push(value); + return values; + } + else { + return map[key] = [value]; + } + } + ts.multiMapAdd = multiMapAdd; + /** + * Removes a value from an array of values associated with the key. + * Does not preserve the order of those values. + * Does nothing if `key` is not in `map`, or `value` is not in `map[key]`. + */ + function multiMapRemove(map, key, value) { + var values = map[key]; + if (values) { + unorderedRemoveItem(values, value); + if (!values.length) { + delete map[key]; + } + } + } + ts.multiMapRemove = multiMapRemove; /** * Tests whether a value is an array. */ @@ -1571,6 +2146,14 @@ var ts; return Array.isArray ? Array.isArray(value) : value instanceof Array; } ts.isArray = isArray; + /** Does nothing. */ + function noop() { } + ts.noop = noop; + /** Throws an error because a function is not implemented. */ + function notImplemented() { + throw new Error("Not implemented"); + } + ts.notImplemented = notImplemented; function memoize(callback) { var value; return function () { @@ -1582,9 +2165,59 @@ var ts; }; } ts.memoize = memoize; + function chain(a, b, c, d, e) { + if (e) { + var args_2 = []; + for (var i = 0; i < arguments.length; i++) { + args_2[i] = arguments[i]; + } + return function (t) { return compose.apply(void 0, map(args_2, function (f) { return f(t); })); }; + } + else if (d) { + return function (t) { return compose(a(t), b(t), c(t), d(t)); }; + } + else if (c) { + return function (t) { return compose(a(t), b(t), c(t)); }; + } + else if (b) { + return function (t) { return compose(a(t), b(t)); }; + } + else if (a) { + return function (t) { return compose(a(t)); }; + } + else { + return function (_) { return function (u) { return u; }; }; + } + } + ts.chain = chain; + function compose(a, b, c, d, e) { + if (e) { + var args_3 = []; + for (var i = 0; i < arguments.length; i++) { + args_3[i] = arguments[i]; + } + return function (t) { return reduceLeft(args_3, function (u, f) { return f(u); }, t); }; + } + else if (d) { + return function (t) { return d(c(b(a(t)))); }; + } + else if (c) { + return function (t) { return c(b(a(t))); }; + } + else if (b) { + return function (t) { return b(a(t)); }; + } + else if (a) { + return function (t) { return a(t); }; + } + else { + return function (t) { return t; }; + } + } + ts.compose = compose; function formatStringFromArgs(text, args, baseIndex) { baseIndex = baseIndex || 0; - return text.replace(/{(\d+)}/g, function (match, index) { return args[+index + baseIndex]; }); + return text.replace(/{(\d+)}/g, function (_match, index) { return args[+index + baseIndex]; }); } ts.localizedDiagnosticMessages = undefined; function getLocaleSpecificMessage(message) { @@ -1609,12 +2242,12 @@ var ts; length: length, messageText: text, category: message.category, - code: message.code + code: message.code, }; } ts.createFileDiagnostic = createFileDiagnostic; /* internal */ - function formatMessage(dummy, message) { + function formatMessage(_dummy, message) { var text = getLocaleSpecificMessage(message); if (arguments.length > 2) { text = formatStringFromArgs(text, arguments, 2); @@ -1637,6 +2270,17 @@ var ts; }; } ts.createCompilerDiagnostic = createCompilerDiagnostic; + function createCompilerDiagnosticFromMessageChain(chain) { + return { + file: undefined, + start: undefined, + length: undefined, + code: chain.code, + category: chain.category, + messageText: chain.next ? chain : chain.messageText + }; + } + ts.createCompilerDiagnosticFromMessageChain = createCompilerDiagnosticFromMessageChain; function chainDiagnosticMessages(details, message) { var text = getLocaleSpecificMessage(message); if (arguments.length > 2) { @@ -1677,7 +2321,8 @@ var ts; if (b === undefined) return 1 /* GreaterThan */; if (ignoreCase) { - if (String.prototype.localeCompare) { + if (ts.collator && String.prototype.localeCompare) { + // accent means a ? b, a ? a´, a = A var result = a.localeCompare(b, /*locales*/ undefined, { usage: "sort", sensitivity: "accent" }); return result < 0 ? -1 /* LessThan */ : result > 0 ? 1 /* GreaterThan */ : 0 /* EqualTo */; } @@ -1749,7 +2394,9 @@ var ts; return path.replace(/\\/g, "/"); } ts.normalizeSlashes = normalizeSlashes; - // Returns length of path root (i.e. length of "/", "x:/", "//server/share/, file:///user/files") + /** + * Returns length of path root (i.e. length of "/", "x:/", "//server/share/, file:///user/files") + */ function getRootLength(path) { if (path.charCodeAt(0) === 47 /* slash */) { if (path.charCodeAt(1) !== 47 /* slash */) @@ -1782,7 +2429,13 @@ var ts; return 0; } ts.getRootLength = getRootLength; + /** + * Internally, we represent paths as strings with '/' as the directory separator. + * When we make system calls (eg: LanguageServiceHost.getDirectory()), + * we expect the host to correctly handle paths in our specified format. + */ ts.directorySeparator = "/"; + var directorySeparatorCharCode = 47 /* slash */; function getNormalizedParts(normalizedSlashedPath, rootLength) { var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator); var normalized = []; @@ -1806,10 +2459,22 @@ var ts; function normalizePath(path) { path = normalizeSlashes(path); var rootLength = getRootLength(path); + var root = path.substr(0, rootLength); var normalized = getNormalizedParts(path, rootLength); - return path.substr(0, rootLength) + normalized.join(ts.directorySeparator); + if (normalized.length) { + var joinedParts = root + normalized.join(ts.directorySeparator); + return pathEndsWithDirectorySeparator(path) ? joinedParts + ts.directorySeparator : joinedParts; + } + else { + return root; + } } ts.normalizePath = normalizePath; + /** A path ending with '/' refers to a directory only, never a file. */ + function pathEndsWithDirectorySeparator(path) { + return path.charCodeAt(path.length - 1) === directorySeparatorCharCode; + } + ts.pathEndsWithDirectorySeparator = pathEndsWithDirectorySeparator; function getDirectoryPath(path) { return path.substr(0, Math.max(getRootLength(path), path.lastIndexOf(ts.directorySeparator))); } @@ -1818,10 +2483,57 @@ var ts; return path && !isRootedDiskPath(path) && path.indexOf("://") !== -1; } ts.isUrl = isUrl; + function isExternalModuleNameRelative(moduleName) { + // TypeScript 1.0 spec (April 2014): 11.2.1 + // An external module name is "relative" if the first term is "." or "..". + return /^\.\.?($|[\\/])/.test(moduleName); + } + ts.isExternalModuleNameRelative = isExternalModuleNameRelative; + function getEmitScriptTarget(compilerOptions) { + return compilerOptions.target || 0 /* ES3 */; + } + ts.getEmitScriptTarget = getEmitScriptTarget; + function getEmitModuleKind(compilerOptions) { + return typeof compilerOptions.module === "number" ? + compilerOptions.module : + 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; + for (var i = 0; i < str.length; i++) { + if (str.charCodeAt(i) === 42 /* asterisk */) { + if (!seenAsterisk) { + seenAsterisk = true; + } + else { + // have already seen asterisk + return false; + } + } + } + return true; + } + ts.hasZeroOrOneAsteriskCharacter = hasZeroOrOneAsteriskCharacter; function isRootedDiskPath(path) { return getRootLength(path) !== 0; } ts.isRootedDiskPath = isRootedDiskPath; + function convertToRelativePath(absoluteOrRelativePath, basePath, getCanonicalFileName) { + return !isRootedDiskPath(absoluteOrRelativePath) + ? absoluteOrRelativePath + : getRelativePathToDirectoryOrUrl(basePath, absoluteOrRelativePath, basePath, getCanonicalFileName, /*isAbsolutePathAnUrl*/ false); + } + ts.convertToRelativePath = convertToRelativePath; function normalizedPathComponents(path, rootLength) { var normalizedParts = getNormalizedParts(path, rootLength); return [path.substr(0, rootLength)].concat(normalizedParts); @@ -2024,6 +2736,10 @@ var ts; return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos; } ts.endsWith = endsWith; + function hasExtension(fileName) { + return getBaseFileName(fileName).indexOf(".") >= 0; + } + ts.hasExtension = hasExtension; function fileExtensionIs(path, extension) { return path.length > extension.length && endsWith(path, extension); } @@ -2064,73 +2780,93 @@ var ts; var doubleAsteriskRegexFragment = usage === "exclude" ? "(/.+?)?" : "(/[^/.][^/]*)*?"; var pattern = ""; var hasWrittenSubpattern = false; - spec: for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) { + for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) { var spec = specs_1[_i]; if (!spec) { continue; } - var subpattern = ""; - var hasRecursiveDirectoryWildcard = false; - var hasWrittenComponent = false; - var components = getNormalizedPathComponents(spec, basePath); - if (usage !== "exclude" && components[components.length - 1] === "**") { - continue spec; - } - // getNormalizedPathComponents includes the separator for the root component. - // We need to remove to create our regex correctly. - components[0] = removeTrailingDirectorySeparator(components[0]); - var optionalCount = 0; - for (var _a = 0, components_1 = components; _a < components_1.length; _a++) { - var component = components_1[_a]; - if (component === "**") { - if (hasRecursiveDirectoryWildcard) { - continue spec; - } - subpattern += doubleAsteriskRegexFragment; - hasRecursiveDirectoryWildcard = true; - hasWrittenComponent = true; - } - else { - if (usage === "directories") { - subpattern += "("; - optionalCount++; - } - if (hasWrittenComponent) { - subpattern += ts.directorySeparator; - } - if (usage !== "exclude") { - // The * and ? wildcards should not match directories or files that start with . if they - // appear first in a component. Dotted directories and files can be included explicitly - // like so: **/.*/.* - if (component.charCodeAt(0) === 42 /* asterisk */) { - subpattern += "([^./]" + singleAsteriskRegexFragment + ")?"; - component = component.substr(1); - } - else if (component.charCodeAt(0) === 63 /* question */) { - subpattern += "[^./]"; - component = component.substr(1); - } - } - subpattern += component.replace(reservedCharacterPattern, replaceWildcardCharacter); - hasWrittenComponent = true; - } - } - while (optionalCount > 0) { - subpattern += ")?"; - optionalCount--; + var subPattern = getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter); + if (subPattern === undefined) { + continue; } if (hasWrittenSubpattern) { pattern += "|"; } - pattern += "(" + subpattern + ")"; + pattern += "(" + subPattern + ")"; hasWrittenSubpattern = true; } if (!pattern) { return undefined; } - return "^(" + pattern + (usage === "exclude" ? ")($|/)" : ")$"); + // If excluding, match "foo/bar/baz...", but if including, only allow "foo". + var terminator = usage === "exclude" ? "($|/)" : "$"; + return "^(" + pattern + ")" + terminator; } ts.getRegularExpressionForWildcard = getRegularExpressionForWildcard; + /** + * An "includes" path "foo" is implicitly a glob "foo/** /*" (without the space) if its last component has no extension, + * and does not contain any glob characters itself. + */ + function isImplicitGlob(lastPathComponent) { + return !/[.*?]/.test(lastPathComponent); + } + ts.isImplicitGlob = isImplicitGlob; + function getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter) { + var subpattern = ""; + var hasRecursiveDirectoryWildcard = false; + var hasWrittenComponent = false; + var components = getNormalizedPathComponents(spec, basePath); + var lastComponent = lastOrUndefined(components); + if (usage !== "exclude" && lastComponent === "**") { + return undefined; + } + // getNormalizedPathComponents includes the separator for the root component. + // We need to remove to create our regex correctly. + components[0] = removeTrailingDirectorySeparator(components[0]); + if (isImplicitGlob(lastComponent)) { + components.push("**", "*"); + } + var optionalCount = 0; + for (var _i = 0, components_1 = components; _i < components_1.length; _i++) { + var component = components_1[_i]; + if (component === "**") { + if (hasRecursiveDirectoryWildcard) { + return undefined; + } + subpattern += doubleAsteriskRegexFragment; + hasRecursiveDirectoryWildcard = true; + } + else { + if (usage === "directories") { + subpattern += "("; + optionalCount++; + } + if (hasWrittenComponent) { + subpattern += ts.directorySeparator; + } + if (usage !== "exclude") { + // The * and ? wildcards should not match directories or files that start with . if they + // appear first in a component. Dotted directories and files can be included explicitly + // like so: **/.*/.* + if (component.charCodeAt(0) === 42 /* asterisk */) { + subpattern += "([^./]" + singleAsteriskRegexFragment + ")?"; + component = component.substr(1); + } + else if (component.charCodeAt(0) === 63 /* question */) { + subpattern += "[^./]"; + component = component.substr(1); + } + } + subpattern += component.replace(reservedCharacterPattern, replaceWildcardCharacter); + } + hasWrittenComponent = true; + } + while (optionalCount > 0) { + subpattern += ")?"; + optionalCount--; + } + return subpattern; + } function replaceWildCardCharacterFiles(match) { return replaceWildcardCharacter(match, singleAsteriskRegexFragmentFiles); } @@ -2140,7 +2876,7 @@ var ts; function replaceWildcardCharacter(match, singleAsteriskRegexFragment) { return match === "*" ? singleAsteriskRegexFragment : match === "?" ? "[^/]" : "\\" + match; } - function getFileMatcherPatterns(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory) { + function getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory) { path = normalizePath(path); currentDirectory = normalizePath(currentDirectory); var absolutePath = combinePaths(currentDirectory, path); @@ -2155,7 +2891,7 @@ var ts; function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, getFileSystemEntries) { path = normalizePath(path); currentDirectory = normalizePath(currentDirectory); - var patterns = getFileMatcherPatterns(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory); + var patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory); var regexFlag = useCaseSensitiveFileNames ? "" : "i"; var includeFileRegex = patterns.includeFilePattern && new RegExp(patterns.includeFilePattern, regexFlag); var includeDirectoryRegex = patterns.includeDirectoryPattern && new RegExp(patterns.includeDirectoryPattern, regexFlag); @@ -2204,29 +2940,35 @@ var ts; // We also need to check the relative paths by converting them to absolute and normalizing // in case they escape the base path (e.g "..\somedirectory") var absolute = isRootedDiskPath(include) ? include : normalizePath(combinePaths(path, include)); - var wildcardOffset = indexOfAnyCharCode(absolute, wildcardCharCodes); - var includeBasePath = wildcardOffset < 0 - ? removeTrailingDirectorySeparator(getDirectoryPath(absolute)) - : absolute.substring(0, absolute.lastIndexOf(ts.directorySeparator, wildcardOffset)); // Append the literal and canonical candidate base paths. - includeBasePaths.push(includeBasePath); + includeBasePaths.push(getIncludeBasePath(absolute)); } // Sort the offsets array using either the literal or canonical path representations. includeBasePaths.sort(useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive); + var _loop_1 = function (includeBasePath) { + if (ts.every(basePaths, function (basePath) { return !containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames); })) { + basePaths.push(includeBasePath); + } + }; // Iterate over each include base path and include unique base paths that are not a // subpath of an existing base path - include: for (var i = 0; i < includeBasePaths.length; i++) { - var includeBasePath = includeBasePaths[i]; - for (var j = 0; j < basePaths.length; j++) { - if (containsPath(basePaths[j], includeBasePath, path, !useCaseSensitiveFileNames)) { - continue include; - } - } - basePaths.push(includeBasePath); + for (var _a = 0, includeBasePaths_1 = includeBasePaths; _a < includeBasePaths_1.length; _a++) { + var includeBasePath = includeBasePaths_1[_a]; + _loop_1(includeBasePath); } } return basePaths; } + function getIncludeBasePath(absolute) { + var wildcardOffset = indexOfAnyCharCode(absolute, wildcardCharCodes); + if (wildcardOffset < 0) { + // No "*" or "?" in the path + return !hasExtension(absolute) + ? absolute + : removeTrailingDirectorySeparator(getDirectoryPath(absolute)); + } + return absolute.substring(0, absolute.lastIndexOf(ts.directorySeparator, wildcardOffset)); + } function ensureScriptKind(fileName, scriptKind) { // Using scriptKind as a condition handles both: // - 'scriptKind' is unspecified and thus it is `undefined` @@ -2261,15 +3003,34 @@ var ts; ts.supportedTypescriptExtensionsForExtractExtension = [".d.ts", ".ts", ".tsx"]; ts.supportedJavascriptExtensions = [".js", ".jsx"]; var allSupportedExtensions = ts.supportedTypeScriptExtensions.concat(ts.supportedJavascriptExtensions); - function getSupportedExtensions(options) { - return options && options.allowJs ? allSupportedExtensions : ts.supportedTypeScriptExtensions; + function getSupportedExtensions(options, extraFileExtensions) { + var needAllExtensions = options && options.allowJs; + if (!extraFileExtensions || extraFileExtensions.length === 0) { + return needAllExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions; + } + var extensions = (needAllExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions).slice(0); + for (var _i = 0, extraFileExtensions_1 = extraFileExtensions; _i < extraFileExtensions_1.length; _i++) { + var extInfo = extraFileExtensions_1[_i]; + if (needAllExtensions || extInfo.scriptKind === 3 /* TS */) { + extensions.push(extInfo.extension); + } + } + return extensions; } ts.getSupportedExtensions = getSupportedExtensions; - function isSupportedSourceFileName(fileName, compilerOptions) { + function hasJavaScriptFileExtension(fileName) { + return forEach(ts.supportedJavascriptExtensions, function (extension) { return fileExtensionIs(fileName, extension); }); + } + ts.hasJavaScriptFileExtension = hasJavaScriptFileExtension; + function hasTypeScriptFileExtension(fileName) { + return forEach(ts.supportedTypeScriptExtensions, function (extension) { return fileExtensionIs(fileName, extension); }); + } + ts.hasTypeScriptFileExtension = hasTypeScriptFileExtension; + function isSupportedSourceFileName(fileName, compilerOptions, extraFileExtensions) { if (!fileName) { return false; } - for (var _i = 0, _a = getSupportedExtensions(compilerOptions); _i < _a.length; _i++) { + for (var _i = 0, _a = getSupportedExtensions(compilerOptions, extraFileExtensions); _i < _a.length; _i++) { var extension = _a[_i]; if (fileExtensionIs(fileName, extension)) { return true; @@ -2283,14 +3044,14 @@ var ts; * aligned to the offset of the highest priority extension in the * allSupportedExtensions array. */ + var ExtensionPriority; (function (ExtensionPriority) { ExtensionPriority[ExtensionPriority["TypeScriptFiles"] = 0] = "TypeScriptFiles"; ExtensionPriority[ExtensionPriority["DeclarationAndJavaScriptFiles"] = 2] = "DeclarationAndJavaScriptFiles"; ExtensionPriority[ExtensionPriority["Limit"] = 5] = "Limit"; ExtensionPriority[ExtensionPriority["Highest"] = 0] = "Highest"; ExtensionPriority[ExtensionPriority["Lowest"] = 2] = "Lowest"; - })(ts.ExtensionPriority || (ts.ExtensionPriority = {})); - var ExtensionPriority = ts.ExtensionPriority; + })(ExtensionPriority = ts.ExtensionPriority || (ts.ExtensionPriority = {})); function getExtensionPriority(path, supportedExtensions) { for (var i = supportedExtensions.length - 1; i >= 0; i--) { if (fileExtensionIs(path, supportedExtensions[i])) { @@ -2349,10 +3110,6 @@ var ts; return path.substring(0, path.length - extension.length); } ts.removeExtension = removeExtension; - function isJsxOrTsxExtension(ext) { - return ext === ".jsx" || ext === ".tsx"; - } - ts.isJsxOrTsxExtension = isJsxOrTsxExtension; function changeExtension(path, newExtension) { return (removeFileExtension(path) + newExtension); } @@ -2362,17 +3119,21 @@ var ts; this.name = name; this.declarations = undefined; } - function Type(checker, flags) { + function Type(_checker, flags) { this.flags = flags; } - function Signature(checker) { + function Signature() { } function Node(kind, pos, end) { + this.id = 0; this.kind = kind; this.pos = pos; this.end = end; this.flags = 0 /* None */; + this.modifierFlagsCache = 0 /* None */; + this.transformFlags = 0 /* None */; this.parent = undefined; + this.original = undefined; } ts.objectAllocator = { getNodeConstructor: function () { return Node; }, @@ -2383,18 +3144,18 @@ var ts; getTypeConstructor: function () { return Type; }, getSignatureConstructor: function () { return Signature; } }; + var AssertionLevel; (function (AssertionLevel) { AssertionLevel[AssertionLevel["None"] = 0] = "None"; AssertionLevel[AssertionLevel["Normal"] = 1] = "Normal"; AssertionLevel[AssertionLevel["Aggressive"] = 2] = "Aggressive"; AssertionLevel[AssertionLevel["VeryAggressive"] = 3] = "VeryAggressive"; - })(ts.AssertionLevel || (ts.AssertionLevel = {})); - var AssertionLevel = ts.AssertionLevel; + })(AssertionLevel = ts.AssertionLevel || (ts.AssertionLevel = {})); var Debug; (function (Debug) { - var currentAssertionLevel = 0 /* None */; + Debug.currentAssertionLevel = 0 /* None */; function shouldAssert(level) { - return currentAssertionLevel >= level; + return Debug.currentAssertionLevel >= level; } Debug.shouldAssert = shouldAssert; function assert(expression, message, verboseDebugInfo) { @@ -2413,23 +3174,165 @@ var ts; } Debug.fail = fail; })(Debug = ts.Debug || (ts.Debug = {})); - function copyListRemovingItem(item, list) { - var copiedList = []; - for (var _i = 0, list_1 = list; _i < list_1.length; _i++) { - var e = list_1[_i]; - if (e !== item) { - copiedList.push(e); + /** 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 copiedList; + return false; } - ts.copyListRemovingItem = copyListRemovingItem; - function createGetCanonicalFileName(useCaseSensitivefileNames) { - return useCaseSensitivefileNames + 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++) { + array[i] = array[i + 1]; + } + array.pop(); + } + ts.orderedRemoveItemAt = orderedRemoveItemAt; + function unorderedRemoveItemAt(array, index) { + // Fill in the "hole" left at `index`. + array[index] = array[array.length - 1]; + array.pop(); + } + ts.unorderedRemoveItemAt = unorderedRemoveItemAt; + /** Remove the *first* occurrence of `item` from the array. */ + function unorderedRemoveItem(array, item) { + unorderedRemoveFirstItemWhere(array, function (element) { return element === item; }); + } + ts.unorderedRemoveItem = unorderedRemoveItem; + /** Remove the *first* element satisfying `predicate`. */ + function unorderedRemoveFirstItemWhere(array, predicate) { + for (var i = 0; i < array.length; i++) { + if (predicate(array[i])) { + unorderedRemoveItemAt(array, i); + break; + } + } + } + function createGetCanonicalFileName(useCaseSensitiveFileNames) { + return useCaseSensitiveFileNames ? (function (fileName) { return fileName; }) : (function (fileName) { return fileName.toLowerCase(); }); } ts.createGetCanonicalFileName = createGetCanonicalFileName; + /** + * patternStrings contains both pattern strings (containing "*") and regular strings. + * Return an exact match if possible, or a pattern match, or undefined. + * (These are verified by verifyCompilerOptions to have 0 or 1 "*" characters.) + */ + /* @internal */ + function matchPatternOrExact(patternStrings, candidate) { + var patterns = []; + for (var _i = 0, patternStrings_1 = patternStrings; _i < patternStrings_1.length; _i++) { + var patternString = patternStrings_1[_i]; + var pattern = tryParsePattern(patternString); + if (pattern) { + patterns.push(pattern); + } + else if (patternString === candidate) { + // pattern was matched as is - no need to search further + return patternString; + } + } + return findBestPatternMatch(patterns, function (_) { return _; }, candidate); + } + ts.matchPatternOrExact = matchPatternOrExact; + /* @internal */ + function patternText(_a) { + var prefix = _a.prefix, suffix = _a.suffix; + return prefix + "*" + suffix; + } + ts.patternText = patternText; + /** + * Given that candidate matches pattern, returns the text matching the '*'. + * E.g.: matchedText(tryParsePattern("foo*baz"), "foobarbaz") === "bar" + */ + /* @internal */ + function matchedText(pattern, candidate) { + Debug.assert(isPatternMatch(pattern, candidate)); + return candidate.substr(pattern.prefix.length, candidate.length - pattern.suffix.length); + } + ts.matchedText = matchedText; + /** Return the object corresponding to the best pattern to match `candidate`. */ + /* @internal */ + function findBestPatternMatch(values, getPattern, candidate) { + var matchedValue = undefined; + // use length of prefix as betterness criteria + var longestMatchPrefixLength = -1; + for (var _i = 0, values_1 = values; _i < values_1.length; _i++) { + var v = values_1[_i]; + var pattern = getPattern(v); + if (isPatternMatch(pattern, candidate) && pattern.prefix.length > longestMatchPrefixLength) { + longestMatchPrefixLength = pattern.prefix.length; + matchedValue = v; + } + } + return matchedValue; + } + ts.findBestPatternMatch = findBestPatternMatch; + function isPatternMatch(_a, candidate) { + var prefix = _a.prefix, suffix = _a.suffix; + return candidate.length >= prefix.length + suffix.length && + startsWith(candidate, prefix) && + endsWith(candidate, suffix); + } + /* @internal */ + function tryParsePattern(pattern) { + // This should be verified outside of here and a proper error thrown. + Debug.assert(hasZeroOrOneAsteriskCharacter(pattern)); + var indexOfStar = pattern.indexOf("*"); + return indexOfStar === -1 ? undefined : { + prefix: pattern.substr(0, indexOfStar), + suffix: pattern.substr(indexOfStar + 1) + }; + } + ts.tryParsePattern = tryParsePattern; + function positionIsSynthesized(pos) { + // This is a fast way of testing the following conditions: + // pos === undefined || pos === null || isNaN(pos) || pos < 0; + return !(pos >= 0); + } + ts.positionIsSynthesized = positionIsSynthesized; + /** True if an extension is one of the supported TypeScript extensions. */ + function extensionIsTypeScript(ext) { + return ext <= ts.Extension.LastTypeScriptExtension; + } + ts.extensionIsTypeScript = extensionIsTypeScript; + /** + * Gets the extension from a path. + * Path must have a valid extension. + */ + function extensionFromPath(path) { + var ext = tryGetExtensionFromPath(path); + if (ext !== undefined) { + return ext; + } + Debug.fail("File " + path + " has unknown extension."); + } + ts.extensionFromPath = extensionFromPath; + function tryGetExtensionFromPath(path) { + if (fileExtensionIs(path, ".d.ts")) { + return ts.Extension.Dts; + } + if (fileExtensionIs(path, ".ts")) { + return ts.Extension.Ts; + } + if (fileExtensionIs(path, ".tsx")) { + return ts.Extension.Tsx; + } + if (fileExtensionIs(path, ".js")) { + return ts.Extension.Js; + } + if (fileExtensionIs(path, ".jsx")) { + return ts.Extension.Jsx; + } + } + ts.tryGetExtensionFromPath = tryGetExtensionFromPath; })(ts || (ts = {})); /// var ts; @@ -2554,6 +3457,9 @@ var ts; return shell.CurrentDirectory; }, getDirectories: getDirectories, + getEnvironmentVariable: function (name) { + return new ActiveXObject("WScript.Shell").ExpandEnvironmentStrings("%" + name + "%"); + }, readDirectory: readDirectory, exit: function (exitCode) { try { @@ -2599,7 +3505,7 @@ var ts; return; } function addFileWatcherCallback(filePath, callback) { - (fileWatcherCallbacks[filePath] || (fileWatcherCallbacks[filePath] = [])).push(callback); + ts.multiMapAdd(fileWatcherCallbacks, filePath, callback); } function addFile(fileName, callback) { addFileWatcherCallback(fileName, callback); @@ -2611,16 +3517,7 @@ var ts; reduceDirWatcherRefCountForFile(watchedFile.fileName); } function removeFileWatcherCallback(filePath, callback) { - var callbacks = fileWatcherCallbacks[filePath]; - if (callbacks) { - var newCallbacks = ts.copyListRemovingItem(callback, callbacks); - if (newCallbacks.length === 0) { - delete fileWatcherCallbacks[filePath]; - } - else { - fileWatcherCallbacks[filePath] = newCallbacks; - } - } + ts.multiMapRemove(fileWatcherCallbacks, filePath, callback); } function fileEventHandler(eventName, relativeFileName, baseDirPath) { // When files are deleted from disk, the triggered "rename" event would have a relativefileName of "undefined" @@ -2640,10 +3537,18 @@ var ts; function isNode4OrLater() { return parseInt(process.version.charAt(1)) >= 4; } + function isFileSystemCaseSensitive() { + // win32\win64 are case insensitive platforms + if (platform === "win32" || platform === "win64") { + return false; + } + // convert current file name to upper case / lower case and check if file exists + // (guards against cases when name is already all uppercase or lowercase) + return !fileExists(__filename.toUpperCase()) || !fileExists(__filename.toLowerCase()); + } var platform = _os.platform(); - // win32\win64 are case insensitive platforms, MacOS (darwin) by default is also case insensitive - var useCaseSensitiveFileNames = platform !== "win32" && platform !== "win64" && platform !== "darwin"; - function readFile(fileName, encoding) { + var useCaseSensitiveFileNames = isFileSystemCaseSensitive(); + function readFile(fileName, _encoding) { if (!fileExists(fileName)) { return undefined; } @@ -2747,8 +3652,9 @@ var ts; return fileSystemEntryExists(path, 1 /* Directory */); } function getDirectories(path) { - return ts.filter(_fs.readdirSync(path), function (p) { return fileSystemEntryExists(ts.combinePaths(path, p), 1 /* Directory */); }); + return ts.filter(_fs.readdirSync(path), function (dir) { return fileSystemEntryExists(ts.combinePaths(path, dir), 1 /* Directory */); }); } + var noOpFileWatcher = { close: ts.noop }; var nodeSystem = { args: process.argv.slice(2), newLine: _os.EOL, @@ -2758,7 +3664,7 @@ var ts; }, readFile: readFile, writeFile: writeFile, - watchFile: function (fileName, callback) { + watchFile: function (fileName, callback, pollingInterval) { if (useNonPollingWatchers) { var watchedFile_1 = watchedFileSet.addFile(fileName, callback); return { @@ -2766,7 +3672,7 @@ var ts; }; } else { - _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged); + _fs.watchFile(fileName, { persistent: true, interval: pollingInterval || 250 }, fileChanged); return { close: function () { return _fs.unwatchFile(fileName, fileChanged); } }; @@ -2782,6 +3688,9 @@ var ts; // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643) var options; + if (!directoryExists(directoryName)) { + return noOpFileWatcher; + } if (isNode4OrLater() && (process.platform === "win32" || process.platform === "darwin")) { options = { persistent: true, recursive: !!recursive }; } @@ -2816,6 +3725,9 @@ var ts; return process.cwd(); }, getDirectories: getDirectories, + getEnvironmentVariable: function (name) { + return process.env[name] || ""; + }, readDirectory: readDirectory, getModifiedTime: function (path) { try { @@ -2851,7 +3763,16 @@ var ts; }, realpath: function (path) { return _fs.realpathSync(path); - } + }, + tryEnableSourceMapsForHost: function () { + try { + require("source-map-support").install(); + } + catch (e) { + } + }, + setTimeout: setTimeout, + clearTimeout: clearTimeout }; return nodeSystem; } @@ -2862,7 +3783,7 @@ var ts; args: ChakraHost.args, useCaseSensitiveFileNames: !!ChakraHost.useCaseSensitiveFileNames, write: ChakraHost.echo, - readFile: function (path, encoding) { + readFile: function (path, _encoding) { // encoding is automatically handled by the implementation in ChakraHost return ChakraHost.readFile(path); }, @@ -2880,29 +3801,55 @@ var ts; getExecutingFilePath: function () { return ChakraHost.executingFile; }, getCurrentDirectory: function () { return ChakraHost.currentDirectory; }, getDirectories: ChakraHost.getDirectories, + getEnvironmentVariable: ChakraHost.getEnvironmentVariable || (function () { return ""; }), readDirectory: function (path, extensions, excludes, includes) { - var pattern = ts.getFileMatcherPatterns(path, extensions, excludes, includes, !!ChakraHost.useCaseSensitiveFileNames, ChakraHost.currentDirectory); + var pattern = ts.getFileMatcherPatterns(path, excludes, includes, !!ChakraHost.useCaseSensitiveFileNames, ChakraHost.currentDirectory); return ChakraHost.readDirectory(path, extensions, pattern.basePaths, pattern.excludePattern, pattern.includeFilePattern, pattern.includeDirectoryPattern); }, exit: ChakraHost.quit, realpath: realpath }; } + function recursiveCreateDirectory(directoryPath, sys) { + var basePath = ts.getDirectoryPath(directoryPath); + var shouldCreateParent = directoryPath !== basePath && !sys.directoryExists(basePath); + if (shouldCreateParent) { + recursiveCreateDirectory(basePath, sys); + } + if (shouldCreateParent || !sys.directoryExists(directoryPath)) { + sys.createDirectory(directoryPath); + } + } + var sys; if (typeof ChakraHost !== "undefined") { - return getChakraSystem(); + sys = getChakraSystem(); } else if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { - return getWScriptSystem(); + sys = getWScriptSystem(); } else if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof require !== "undefined") { // process and process.nextTick checks if current environment is node-like // process.browser check excludes webpack and browserify - return getNodeSystem(); + sys = getNodeSystem(); } - else { - return undefined; // Unsupported host + if (sys) { + // patch writefile to create folder before writing the file + var originalWriteFile_1 = sys.writeFile; + sys.writeFile = function (path, data, writeBom) { + var directoryPath = ts.getDirectoryPath(ts.normalizeSlashes(path)); + if (directoryPath && !sys.directoryExists(directoryPath)) { + recursiveCreateDirectory(directoryPath, sys); + } + originalWriteFile_1.call(sys, path, data, writeBom); + }; } + return sys; })(); + if (ts.sys && ts.sys.getEnvironmentVariable) { + ts.Debug.currentAssertionLevel = /^development$/i.test(ts.sys.getEnvironmentVariable("NODE_ENV")) + ? 1 /* Normal */ + : 0 /* None */; + } })(ts || (ts = {})); // /// @@ -2951,7 +3898,7 @@ var ts; A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: ts.DiagnosticCategory.Error, key: "A_set_accessor_parameter_cannot_have_an_initializer_1052", message: "A 'set' accessor parameter cannot have an initializer." }, A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: ts.DiagnosticCategory.Error, key: "A_set_accessor_cannot_have_rest_parameter_1053", message: "A 'set' accessor cannot have rest parameter." }, A_get_accessor_cannot_have_parameters: { code: 1054, category: ts.DiagnosticCategory.Error, key: "A_get_accessor_cannot_have_parameters_1054", message: "A 'get' accessor cannot have parameters." }, - Type_0_is_not_a_valid_async_function_return_type: { code: 1055, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_a_valid_async_function_return_type_1055", message: "Type '{0}' is not a valid async function return type." }, + Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value: { code: 1055, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Prom_1055", message: "Type '{0}' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value." }, Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: ts.DiagnosticCategory.Error, key: "Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056", message: "Accessors are only available when targeting ECMAScript 5 and higher." }, An_async_function_or_method_must_have_a_valid_awaitable_return_type: { code: 1057, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_have_a_valid_awaitable_return_type_1057", message: "An async function or method must have a valid awaitable return type." }, Operand_for_await_does_not_have_a_valid_callable_then_member: { code: 1058, category: ts.DiagnosticCategory.Error, key: "Operand_for_await_does_not_have_a_valid_callable_then_member_1058", message: "Operand for 'await' does not have a valid callable 'then' member." }, @@ -2967,7 +3914,7 @@ var ts; _0_modifier_cannot_appear_on_an_index_signature: { code: 1071, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_an_index_signature_1071", message: "'{0}' modifier cannot appear on an index signature." }, A_0_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", message: "A '{0}' modifier cannot be used with an import declaration." }, Invalid_reference_directive_syntax: { code: 1084, category: ts.DiagnosticCategory.Error, key: "Invalid_reference_directive_syntax_1084", message: "Invalid 'reference' directive syntax." }, - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher." }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'." }, An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: ts.DiagnosticCategory.Error, key: "An_accessor_cannot_be_declared_in_an_ambient_context_1086", message: "An accessor cannot be declared in an ambient context." }, _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_constructor_declaration_1089", message: "'{0}' modifier cannot appear on a constructor declaration." }, _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_parameter_1090", message: "'{0}' modifier cannot appear on a parameter." }, @@ -3061,7 +4008,6 @@ var ts; Module_0_has_no_default_export: { code: 1192, category: ts.DiagnosticCategory.Error, key: "Module_0_has_no_default_export_1192", message: "Module '{0}' has no default export." }, An_export_declaration_cannot_have_modifiers: { code: 1193, category: ts.DiagnosticCategory.Error, key: "An_export_declaration_cannot_have_modifiers_1193", message: "An export declaration cannot have modifiers." }, Export_declarations_are_not_permitted_in_a_namespace: { code: 1194, category: ts.DiagnosticCategory.Error, key: "Export_declarations_are_not_permitted_in_a_namespace_1194", message: "Export declarations are not permitted in a namespace." }, - Catch_clause_variable_name_must_be_an_identifier: { code: 1195, category: ts.DiagnosticCategory.Error, key: "Catch_clause_variable_name_must_be_an_identifier_1195", message: "Catch clause variable name must be an identifier." }, Catch_clause_variable_cannot_have_a_type_annotation: { code: 1196, category: ts.DiagnosticCategory.Error, key: "Catch_clause_variable_cannot_have_a_type_annotation_1196", message: "Catch clause variable cannot have a type annotation." }, Catch_clause_variable_cannot_have_an_initializer: { code: 1197, category: ts.DiagnosticCategory.Error, key: "Catch_clause_variable_cannot_have_an_initializer_1197", message: "Catch clause variable cannot have an initializer." }, An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { code: 1198, category: ts.DiagnosticCategory.Error, key: "An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive_1198", message: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." }, @@ -3115,15 +4061,16 @@ var ts; Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode: { code: 1251, category: ts.DiagnosticCategory.Error, key: "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_d_1251", message: "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Class definitions are automatically in strict mode." }, Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode: { code: 1252, category: ts.DiagnosticCategory.Error, key: "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_1252", message: "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Modules are automatically in strict mode." }, _0_tag_cannot_be_used_independently_as_a_top_level_JSDoc_tag: { code: 1253, category: ts.DiagnosticCategory.Error, key: "_0_tag_cannot_be_used_independently_as_a_top_level_JSDoc_tag_1253", message: "'{0}' tag cannot be used independently as a top level JSDoc tag." }, + A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal: { code: 1254, category: ts.DiagnosticCategory.Error, key: "A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_1254", message: "A 'const' initializer in an ambient context must be a string or numeric literal." }, with_statements_are_not_allowed_in_an_async_function_block: { code: 1300, category: ts.DiagnosticCategory.Error, key: "with_statements_are_not_allowed_in_an_async_function_block_1300", message: "'with' statements are not allowed in an async function block." }, await_expression_is_only_allowed_within_an_async_function: { code: 1308, category: ts.DiagnosticCategory.Error, key: "await_expression_is_only_allowed_within_an_async_function_1308", message: "'await' expression is only allowed within an async function." }, - Async_functions_are_only_available_when_targeting_ECMAScript_2015_or_higher: { code: 1311, category: ts.DiagnosticCategory.Error, key: "Async_functions_are_only_available_when_targeting_ECMAScript_2015_or_higher_1311", message: "Async functions are only available when targeting ECMAScript 2015 or higher." }, can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: { code: 1312, category: ts.DiagnosticCategory.Error, key: "can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312", message: "'=' can only be used in an object literal property inside a destructuring assignment." }, The_body_of_an_if_statement_cannot_be_the_empty_statement: { code: 1313, category: ts.DiagnosticCategory.Error, key: "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313", message: "The body of an 'if' statement cannot be the empty statement." }, Global_module_exports_may_only_appear_in_module_files: { code: 1314, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_in_module_files_1314", message: "Global module exports may only appear in module files." }, Global_module_exports_may_only_appear_in_declaration_files: { code: 1315, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_in_declaration_files_1315", message: "Global module exports may only appear in declaration files." }, Global_module_exports_may_only_appear_at_top_level: { code: 1316, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_at_top_level_1316", message: "Global module exports may only appear at top level." }, A_parameter_property_cannot_be_declared_using_a_rest_parameter: { code: 1317, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317", message: "A parameter property cannot be declared using a rest parameter." }, + An_abstract_accessor_cannot_have_an_implementation: { code: 1318, category: ts.DiagnosticCategory.Error, key: "An_abstract_accessor_cannot_have_an_implementation_1318", message: "An abstract accessor cannot have an implementation." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." }, @@ -3167,27 +4114,28 @@ var ts; Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: ts.DiagnosticCategory.Error, key: "Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340", message: "Only public and protected methods of the base class are accessible via the 'super' keyword." }, Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: ts.DiagnosticCategory.Error, key: "Property_0_is_private_and_only_accessible_within_class_1_2341", message: "Property '{0}' is private and only accessible within class '{1}'." }, An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: ts.DiagnosticCategory.Error, key: "An_index_expression_argument_must_be_of_type_string_number_symbol_or_any_2342", message: "An index expression argument must be of type 'string', 'number', 'symbol', or 'any'." }, + This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1: { code: 2343, category: ts.DiagnosticCategory.Error, key: "This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343", message: "This syntax requires an imported helper named '{1}', but module '{0}' has no exported member '{1}'." }, Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: ts.DiagnosticCategory.Error, key: "Type_0_does_not_satisfy_the_constraint_1_2344", message: "Type '{0}' does not satisfy the constraint '{1}'." }, Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: ts.DiagnosticCategory.Error, key: "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_2345", message: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: ts.DiagnosticCategory.Error, key: "Supplied_parameters_do_not_match_any_signature_of_call_target_2346", message: "Supplied parameters do not match any signature of call target." }, Untyped_function_calls_may_not_accept_type_arguments: { code: 2347, category: ts.DiagnosticCategory.Error, key: "Untyped_function_calls_may_not_accept_type_arguments_2347", message: "Untyped function calls may not accept type arguments." }, Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { code: 2348, category: ts.DiagnosticCategory.Error, key: "Value_of_type_0_is_not_callable_Did_you_mean_to_include_new_2348", message: "Value of type '{0}' is not callable. Did you mean to include 'new'?" }, - Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { code: 2349, category: ts.DiagnosticCategory.Error, key: "Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_2349", message: "Cannot invoke an expression whose type lacks a call signature." }, + Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures: { code: 2349, category: ts.DiagnosticCategory.Error, key: "Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatur_2349", message: "Cannot invoke an expression whose type lacks a call signature. Type '{0}' has no compatible call signatures." }, Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: ts.DiagnosticCategory.Error, key: "Only_a_void_function_can_be_called_with_the_new_keyword_2350", message: "Only a void function can be called with the 'new' keyword." }, Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: ts.DiagnosticCategory.Error, key: "Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature_2351", message: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, Type_0_cannot_be_converted_to_type_1: { code: 2352, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_converted_to_type_1_2352", message: "Type '{0}' cannot be converted to type '{1}'." }, Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353", message: "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'." }, - No_best_common_type_exists_among_return_expressions: { code: 2354, category: ts.DiagnosticCategory.Error, key: "No_best_common_type_exists_among_return_expressions_2354", message: "No best common type exists among return expressions." }, + This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found: { code: 2354, category: ts.DiagnosticCategory.Error, key: "This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354", message: "This syntax requires an imported helper but module '{0}' cannot be found." }, A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { code: 2355, category: ts.DiagnosticCategory.Error, key: "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355", message: "A function whose declared type is neither 'void' nor 'any' must return a value." }, An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: ts.DiagnosticCategory.Error, key: "An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type_2356", message: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, - The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer_2357", message: "The operand of an increment or decrement operator must be a variable, property or indexer." }, + The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: { code: 2357, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", message: "The operand of an increment or decrement operator must be a variable or a property access." }, The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", message: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", message: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol_2360", message: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." }, The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter_2361", message: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2362", message: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2363", message: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, - Invalid_left_hand_side_of_assignment_expression: { code: 2364, category: ts.DiagnosticCategory.Error, key: "Invalid_left_hand_side_of_assignment_expression_2364", message: "Invalid left-hand side of assignment expression." }, + The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: { code: 2364, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", message: "The left-hand side of an assignment expression must be a variable or a property access." }, Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: ts.DiagnosticCategory.Error, key: "Operator_0_cannot_be_applied_to_types_1_and_2_2365", message: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: { code: 2366, category: ts.DiagnosticCategory.Error, key: "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", message: "Function lacks ending return statement and return type does not include 'undefined'." }, Type_parameter_name_cannot_be_0: { code: 2368, category: ts.DiagnosticCategory.Error, key: "Type_parameter_name_cannot_be_0_2368", message: "Type parameter name cannot be '{0}'" }, @@ -3227,11 +4175,11 @@ var ts; Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { code: 2403, category: ts.DiagnosticCategory.Error, key: "Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_t_2403", message: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." }, The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { code: 2404, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation_2404", message: "The left-hand side of a 'for...in' statement cannot use a type annotation." }, The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { code: 2405, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any_2405", message: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." }, - Invalid_left_hand_side_in_for_in_statement: { code: 2406, category: ts.DiagnosticCategory.Error, key: "Invalid_left_hand_side_in_for_in_statement_2406", message: "Invalid left-hand side in 'for...in' statement." }, + The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access: { code: 2406, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access_2406", message: "The left-hand side of a 'for...in' statement must be a variable or a property access." }, The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_2407", message: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." }, Setters_cannot_return_a_value: { code: 2408, category: ts.DiagnosticCategory.Error, key: "Setters_cannot_return_a_value_2408", message: "Setters cannot return a value." }, Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: ts.DiagnosticCategory.Error, key: "Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409", message: "Return type of constructor signature must be assignable to the instance type of the class" }, - All_symbols_within_a_with_block_will_be_resolved_to_any: { code: 2410, category: ts.DiagnosticCategory.Error, key: "All_symbols_within_a_with_block_will_be_resolved_to_any_2410", message: "All symbols within a 'with' block will be resolved to 'any'." }, + The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any: { code: 2410, category: ts.DiagnosticCategory.Error, key: "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410", message: "The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'." }, Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: ts.DiagnosticCategory.Error, key: "Property_0_of_type_1_is_not_assignable_to_string_index_type_2_2411", message: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." }, Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: ts.DiagnosticCategory.Error, key: "Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2_2412", message: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." }, Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: ts.DiagnosticCategory.Error, key: "Numeric_index_type_0_is_not_assignable_to_string_index_type_1_2413", message: "Numeric index type '{0}' is not assignable to string index type '{1}'." }, @@ -3265,8 +4213,6 @@ var ts; Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: ts.DiagnosticCategory.Error, key: "Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_2446", message: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: ts.DiagnosticCategory.Error, key: "The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead_2447", message: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: ts.DiagnosticCategory.Error, key: "Block_scoped_variable_0_used_before_its_declaration_2448", message: "Block-scoped variable '{0}' used before its declaration." }, - The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property: { code: 2449, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property_2449", message: "The operand of an increment or decrement operator cannot be a constant or a read-only property." }, - Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property: { code: 2450, category: ts.DiagnosticCategory.Error, key: "Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property_2450", message: "Left-hand side of assignment expression cannot be a constant or a read-only property." }, Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_block_scoped_variable_0_2451", message: "Cannot redeclare block-scoped variable '{0}'." }, An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: ts.DiagnosticCategory.Error, key: "An_enum_member_cannot_have_a_numeric_name_2452", message: "An enum member cannot have a numeric name." }, The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: ts.DiagnosticCategory.Error, key: "The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_typ_2453", message: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, @@ -3278,7 +4224,7 @@ var ts; Type_0_has_no_property_1_and_no_string_index_signature: { code: 2459, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_property_1_and_no_string_index_signature_2459", message: "Type '{0}' has no property '{1}' and no string index signature." }, Type_0_has_no_property_1: { code: 2460, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_property_1_2460", message: "Type '{0}' has no property '{1}'." }, Type_0_is_not_an_array_type: { code: 2461, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_2461", message: "Type '{0}' is not an array type." }, - A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: ts.DiagnosticCategory.Error, key: "A_rest_element_must_be_last_in_an_array_destructuring_pattern_2462", message: "A rest element must be last in an array destructuring pattern" }, + A_rest_element_must_be_last_in_a_destructuring_pattern: { code: 2462, category: ts.DiagnosticCategory.Error, key: "A_rest_element_must_be_last_in_a_destructuring_pattern_2462", message: "A rest element must be last in a destructuring pattern" }, A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: ts.DiagnosticCategory.Error, key: "A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature_2463", message: "A binding pattern parameter cannot be optional in an implementation signature." }, A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: ts.DiagnosticCategory.Error, key: "A_computed_property_name_must_be_of_type_string_number_symbol_or_any_2464", message: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." }, this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: ts.DiagnosticCategory.Error, key: "this_cannot_be_referenced_in_a_computed_property_name_2465", message: "'this' cannot be referenced in a computed property name." }, @@ -3300,9 +4246,7 @@ var ts; Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: ts.DiagnosticCategory.Error, key: "Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1_2481", message: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483", message: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: ts.DiagnosticCategory.Error, key: "Export_declaration_conflicts_with_exported_declaration_of_0_2484", message: "Export declaration conflicts with exported declaration of '{0}'" }, - The_left_hand_side_of_a_for_of_statement_cannot_be_a_constant_or_a_read_only_property: { code: 2485, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_cannot_be_a_constant_or_a_read_only_property_2485", message: "The left-hand side of a 'for...of' statement cannot be a constant or a read-only property." }, - The_left_hand_side_of_a_for_in_statement_cannot_be_a_constant_or_a_read_only_property: { code: 2486, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_cannot_be_a_constant_or_a_read_only_property_2486", message: "The left-hand side of a 'for...in' statement cannot be a constant or a read-only property." }, - Invalid_left_hand_side_in_for_of_statement: { code: 2487, category: ts.DiagnosticCategory.Error, key: "Invalid_left_hand_side_in_for_of_statement_2487", message: "Invalid left-hand side in 'for...of' statement." }, + The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access: { code: 2487, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access_2487", message: "The left-hand side of a 'for...of' statement must be a variable or a property access." }, Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: ts.DiagnosticCategory.Error, key: "Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488", message: "Type must have a '[Symbol.iterator]()' method that returns an iterator." }, An_iterator_must_have_a_next_method: { code: 2489, category: ts.DiagnosticCategory.Error, key: "An_iterator_must_have_a_next_method_2489", message: "An iterator must have a 'next()' method." }, The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { code: 2490, category: ts.DiagnosticCategory.Error, key: "The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property_2490", message: "The type returned by the 'next()' method of an iterator must have a 'value' property." }, @@ -3319,7 +4263,6 @@ var ts; A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: "A_rest_element_cannot_contain_a_binding_pattern_2501", message: "A rest element cannot contain a binding pattern." }, _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: ts.DiagnosticCategory.Error, key: "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502", message: "'{0}' is referenced directly or indirectly in its own type annotation." }, Cannot_find_namespace_0: { code: 2503, category: ts.DiagnosticCategory.Error, key: "Cannot_find_namespace_0_2503", message: "Cannot find namespace '{0}'." }, - No_best_common_type_exists_among_yield_expressions: { code: 2504, category: ts.DiagnosticCategory.Error, key: "No_best_common_type_exists_among_yield_expressions_2504", message: "No best common type exists among yield expressions." }, A_generator_cannot_have_a_void_type_annotation: { code: 2505, category: ts.DiagnosticCategory.Error, key: "A_generator_cannot_have_a_void_type_annotation_2505", message: "A generator cannot have a 'void' type annotation." }, _0_is_referenced_directly_or_indirectly_in_its_own_base_expression: { code: 2506, category: ts.DiagnosticCategory.Error, key: "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506", message: "'{0}' is referenced directly or indirectly in its own base expression." }, Type_0_is_not_a_constructor_function_type: { code: 2507, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_a_constructor_function_type_2507", message: "Type '{0}' is not a constructor function type." }, @@ -3336,7 +4279,7 @@ var ts; A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard: { code: 2518, category: ts.DiagnosticCategory.Error, key: "A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard_2518", message: "A 'this'-based type guard is not compatible with a parameter-based type guard." }, Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { code: 2520, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions_2520", message: "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions." }, Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: { code: 2521, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions_2521", message: "Expression resolves to variable declaration '{0}' that compiler uses to support async functions." }, - The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_function_expression: { code: 2522, category: ts.DiagnosticCategory.Error, key: "The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_2522", message: "The 'arguments' object cannot be referenced in an async arrow function. Consider using a standard async function expression." }, + The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method: { code: 2522, category: ts.DiagnosticCategory.Error, key: "The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_usi_2522", message: "The 'arguments' object cannot be referenced in an async function or method in ES3 and ES5. Consider using a standard function or method." }, yield_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2523, category: ts.DiagnosticCategory.Error, key: "yield_expressions_cannot_be_used_in_a_parameter_initializer_2523", message: "'yield' expressions cannot be used in a parameter initializer." }, await_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2524, category: ts.DiagnosticCategory.Error, key: "await_expressions_cannot_be_used_in_a_parameter_initializer_2524", message: "'await' expressions cannot be used in a parameter initializer." }, Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value: { code: 2525, category: ts.DiagnosticCategory.Error, key: "Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value_2525", message: "Initializer provides no value for this binding element and the binding element has no default value." }, @@ -3350,6 +4293,13 @@ 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_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." }, + Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property: { code: 2540, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property_2540", message: "Cannot assign to '{0}' because it is a constant or a read-only property." }, + The_target_of_an_assignment_must_be_a_variable_or_a_property_access: { code: 2541, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_assignment_must_be_a_variable_or_a_property_access_2541", message: "The target of an assignment must be a variable or a property access." }, + Index_signature_in_type_0_only_permits_reading: { code: 2542, category: ts.DiagnosticCategory.Error, key: "Index_signature_in_type_0_only_permits_reading_2542", message: "Index signature in type '{0}' only permits reading." }, JSX_element_attributes_type_0_may_not_be_a_union_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", message: "JSX element attributes type '{0}' may not be a union type." }, The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", message: "The return type of a JSX element constructor must return an object type." }, JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", message: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, @@ -3373,6 +4323,7 @@ var ts; Cannot_find_name_0_Did_you_mean_the_static_member_1_0: { code: 2662, category: ts.DiagnosticCategory.Error, key: "Cannot_find_name_0_Did_you_mean_the_static_member_1_0_2662", message: "Cannot find name '{0}'. Did you mean the static member '{1}.{0}'?" }, Cannot_find_name_0_Did_you_mean_the_instance_member_this_0: { code: 2663, category: ts.DiagnosticCategory.Error, key: "Cannot_find_name_0_Did_you_mean_the_instance_member_this_0_2663", message: "Cannot find name '{0}'. Did you mean the instance member 'this.{0}'?" }, Invalid_module_name_in_augmentation_module_0_cannot_be_found: { code: 2664, category: ts.DiagnosticCategory.Error, key: "Invalid_module_name_in_augmentation_module_0_cannot_be_found_2664", message: "Invalid module name in augmentation, module '{0}' cannot be found." }, + Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented: { code: 2665, category: ts.DiagnosticCategory.Error, key: "Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augm_2665", message: "Invalid module name in augmentation. Module '{0}' resolves to an untyped module at '{1}', which cannot be augmented." }, Exports_and_export_assignments_are_not_permitted_in_module_augmentations: { code: 2666, category: ts.DiagnosticCategory.Error, key: "Exports_and_export_assignments_are_not_permitted_in_module_augmentations_2666", message: "Exports and export assignments are not permitted in module augmentations." }, Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module: { code: 2667, category: ts.DiagnosticCategory.Error, key: "Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667", message: "Imports are not permitted in module augmentations. Consider moving them to the enclosing external module." }, export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible: { code: 2668, category: ts.DiagnosticCategory.Error, key: "export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always__2668", message: "'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible." }, @@ -3393,13 +4344,22 @@ var ts; this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation: { code: 2683, category: ts.DiagnosticCategory.Error, key: "this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_2683", message: "'this' implicitly has type 'any' because it does not have a type annotation." }, The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1: { code: 2684, category: ts.DiagnosticCategory.Error, key: "The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1_2684", message: "The 'this' context of type '{0}' is not assignable to method's 'this' of type '{1}'." }, The_this_types_of_each_signature_are_incompatible: { code: 2685, category: ts.DiagnosticCategory.Error, key: "The_this_types_of_each_signature_are_incompatible_2685", message: "The 'this' types of each signature are incompatible." }, - Identifier_0_must_be_imported_from_a_module: { code: 2686, category: ts.DiagnosticCategory.Error, key: "Identifier_0_must_be_imported_from_a_module_2686", message: "Identifier '{0}' must be imported from a module" }, + _0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead: { code: 2686, category: ts.DiagnosticCategory.Error, key: "_0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead_2686", message: "'{0}' refers to a UMD global, but the current file is a module. Consider adding an import instead." }, All_declarations_of_0_must_have_identical_modifiers: { code: 2687, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_0_must_have_identical_modifiers_2687", message: "All declarations of '{0}' must have identical modifiers." }, Cannot_find_type_definition_file_for_0: { code: 2688, category: ts.DiagnosticCategory.Error, key: "Cannot_find_type_definition_file_for_0_2688", message: "Cannot find type definition file for '{0}'." }, Cannot_extend_an_interface_0_Did_you_mean_implements: { code: 2689, category: ts.DiagnosticCategory.Error, key: "Cannot_extend_an_interface_0_Did_you_mean_implements_2689", message: "Cannot extend an interface '{0}'. Did you mean 'implements'?" }, A_class_must_be_declared_after_its_base_class: { code: 2690, category: ts.DiagnosticCategory.Error, key: "A_class_must_be_declared_after_its_base_class_2690", message: "A class must be declared after its base class." }, An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: { code: 2691, category: ts.DiagnosticCategory.Error, key: "An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691", message: "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead." }, _0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: { code: 2692, category: ts.DiagnosticCategory.Error, key: "_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692", message: "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible." }, + _0_only_refers_to_a_type_but_is_being_used_as_a_value_here: { code: 2693, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693", message: "'{0}' only refers to a type, but is being used as a value here." }, + Namespace_0_has_no_exported_member_1: { code: 2694, category: ts.DiagnosticCategory.Error, key: "Namespace_0_has_no_exported_member_1_2694", message: "Namespace '{0}' has no exported member '{1}'." }, + Left_side_of_comma_operator_is_unused_and_has_no_side_effects: { code: 2695, category: ts.DiagnosticCategory.Error, key: "Left_side_of_comma_operator_is_unused_and_has_no_side_effects_2695", message: "Left side of comma operator is unused and has no side effects." }, + The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead: { code: 2696, category: ts.DiagnosticCategory.Error, key: "The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead_2696", message: "The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?" }, + 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." }, + 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}'." }, @@ -3470,7 +4430,10 @@ 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." }, + Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4091, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091", message: "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4092, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092", message: "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'." }, 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." }, File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { code: 5010, category: ts.DiagnosticCategory.Error, key: "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", message: "File specification cannot end in a recursive directory wildcard ('**'): '{0}'." }, @@ -3499,6 +4462,7 @@ var ts; Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2: { code: 5064, category: ts.DiagnosticCategory.Error, key: "Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2_5064", message: "Substitution '{0}' for pattern '{1}' has incorrect type, expected 'string', got '{2}'." }, File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { code: 5065, category: ts.DiagnosticCategory.Error, key: "File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065", message: "File specification cannot contain a parent directory ('..') that appears after a recursive directory wildcard ('**'): '{0}'." }, Substitutions_for_pattern_0_shouldn_t_be_an_empty_array: { code: 5066, category: ts.DiagnosticCategory.Error, key: "Substitutions_for_pattern_0_shouldn_t_be_an_empty_array_5066", message: "Substitutions for pattern '{0}' shouldn't be an empty array." }, + Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name: { code: 5067, category: ts.DiagnosticCategory.Error, key: "Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name_5067", message: "Invalid value for 'jsxFactory'. '{0}' is not a valid identifier or qualified-name." }, Concatenate_and_emit_output_to_single_file: { code: 6001, category: ts.DiagnosticCategory.Message, key: "Concatenate_and_emit_output_to_single_file_6001", message: "Concatenate and emit output to single file." }, Generates_corresponding_d_ts_file: { code: 6002, category: ts.DiagnosticCategory.Message, key: "Generates_corresponding_d_ts_file_6002", message: "Generates corresponding '.d.ts' file." }, Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations_6003", message: "Specify the location where debugger should locate map files instead of generated locations." }, @@ -3511,7 +4475,7 @@ var ts; Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_outputs_6010", message: "Do not emit outputs." }, Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking: { code: 6011, category: ts.DiagnosticCategory.Message, key: "Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011", message: "Allow default imports from modules with no default export. This does not affect code emit, just typechecking." }, Skip_type_checking_of_declaration_files: { code: 6012, category: ts.DiagnosticCategory.Message, key: "Skip_type_checking_of_declaration_files_6012", message: "Skip type checking of declaration files." }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015'" }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'" }, Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016", message: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'" }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print_this_message_6017", message: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print_the_compiler_s_version_6019", message: "Print the compiler's version." }, @@ -3529,6 +4493,7 @@ var ts; VERSION: { code: 6036, category: ts.DiagnosticCategory.Message, key: "VERSION_6036", message: "VERSION" }, LOCATION: { code: 6037, category: ts.DiagnosticCategory.Message, key: "LOCATION_6037", message: "LOCATION" }, DIRECTORY: { code: 6038, category: ts.DiagnosticCategory.Message, key: "DIRECTORY_6038", message: "DIRECTORY" }, + STRATEGY: { code: 6039, category: ts.DiagnosticCategory.Message, key: "STRATEGY_6039", message: "STRATEGY" }, Compilation_complete_Watching_for_file_changes: { code: 6042, category: ts.DiagnosticCategory.Message, key: "Compilation_complete_Watching_for_file_changes_6042", message: "Compilation complete. Watching for file changes." }, Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates_corresponding_map_file_6043", message: "Generates corresponding '.map' file." }, Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler_option_0_expects_an_argument_6044", message: "Compiler option '{0}' expects an argument." }, @@ -3563,6 +4528,7 @@ var ts; Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, Specify_library_files_to_be_included_in_the_compilation_Colon: { code: 6079, category: ts.DiagnosticCategory.Message, key: "Specify_library_files_to_be_included_in_the_compilation_Colon_6079", message: "Specify library files to be included in the compilation: " }, Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_or_react_6080", message: "Specify JSX code generation: 'preserve' or 'react'" }, + File_0_has_an_unsupported_extension_so_skipping_it: { code: 6081, category: ts.DiagnosticCategory.Message, key: "File_0_has_an_unsupported_extension_so_skipping_it_6081", message: "File '{0}' has an unsupported extension, so skipping it." }, Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: "Only_amd_and_system_modules_are_supported_alongside_0_6082", message: "Only 'amd' and 'system' modules are supported alongside --{0}." }, Base_directory_to_resolve_non_absolute_module_names: { code: 6083, category: ts.DiagnosticCategory.Message, key: "Base_directory_to_resolve_non_absolute_module_names_6083", message: "Base directory to resolve non-absolute module names." }, Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: "Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit_6084", message: "Specify the object invoked for createElement and __spread when targeting 'react' JSX emit" }, @@ -3581,7 +4547,7 @@ var ts; File_0_exist_use_it_as_a_name_resolution_result: { code: 6097, category: ts.DiagnosticCategory.Message, key: "File_0_exist_use_it_as_a_name_resolution_result_6097", message: "File '{0}' exist - use it as a name resolution result." }, Loading_module_0_from_node_modules_folder: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_6098", message: "Loading module '{0}' from 'node_modules' folder." }, Found_package_json_at_0: { code: 6099, category: ts.DiagnosticCategory.Message, key: "Found_package_json_at_0_6099", message: "Found 'package.json' at '{0}'." }, - package_json_does_not_have_types_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_types_field_6100", message: "'package.json' does not have 'types' field." }, + package_json_does_not_have_a_types_or_main_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_a_types_or_main_field_6100", message: "'package.json' does not have a 'types' or 'main' field." }, package_json_has_0_field_1_that_references_2: { code: 6101, category: ts.DiagnosticCategory.Message, key: "package_json_has_0_field_1_that_references_2_6101", message: "'package.json' has '{0}' field '{1}' that references '{2}'." }, Allow_javascript_files_to_be_compiled: { code: 6102, category: ts.DiagnosticCategory.Message, key: "Allow_javascript_files_to_be_compiled_6102", message: "Allow javascript files to be compiled." }, Option_0_should_have_array_of_strings_as_a_value: { code: 6103, category: ts.DiagnosticCategory.Error, key: "Option_0_should_have_array_of_strings_as_a_value_6103", message: "Option '{0}' should have array of strings as a value." }, @@ -3618,8 +4584,17 @@ var ts; Report_errors_on_unused_locals: { code: 6134, category: ts.DiagnosticCategory.Message, key: "Report_errors_on_unused_locals_6134", message: "Report errors on unused locals." }, Report_errors_on_unused_parameters: { code: 6135, category: ts.DiagnosticCategory.Message, key: "Report_errors_on_unused_parameters_6135", message: "Report errors on unused parameters." }, The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: { code: 6136, category: ts.DiagnosticCategory.Message, key: "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136", message: "The maximum dependency depth to search under node_modules and load JavaScript files" }, - No_types_specified_in_package_json_but_allowJs_is_set_so_returning_main_value_of_0: { code: 6137, category: ts.DiagnosticCategory.Message, key: "No_types_specified_in_package_json_but_allowJs_is_set_so_returning_main_value_of_0_6137", message: "No types specified in 'package.json' but 'allowJs' is set, so returning 'main' value of '{0}'" }, + No_types_specified_in_package_json_so_returning_main_value_of_0: { code: 6137, category: ts.DiagnosticCategory.Message, key: "No_types_specified_in_package_json_so_returning_main_value_of_0_6137", message: "No types specified in 'package.json', so returning 'main' value of '{0}'" }, Property_0_is_declared_but_never_used: { code: 6138, category: ts.DiagnosticCategory.Error, key: "Property_0_is_declared_but_never_used_6138", message: "Property '{0}' is declared but never used." }, + Import_emit_helpers_from_tslib: { code: 6139, category: ts.DiagnosticCategory.Message, key: "Import_emit_helpers_from_tslib_6139", message: "Import emit helpers from 'tslib'." }, + Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2: { code: 6140, category: ts.DiagnosticCategory.Error, key: "Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using__6140", message: "Auto discovery for typings is enabled in project '{0}'. Running extra resolution pass for module '{1}' using cache location '{2}'." }, + Parse_in_strict_mode_and_emit_use_strict_for_each_source_file: { code: 6141, category: ts.DiagnosticCategory.Message, key: "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141", message: "Parse in strict mode and emit \"use strict\" for each source file" }, + Module_0_was_resolved_to_1_but_jsx_is_not_set: { code: 6142, category: ts.DiagnosticCategory.Error, key: "Module_0_was_resolved_to_1_but_jsx_is_not_set_6142", message: "Module '{0}' was resolved to '{1}', but '--jsx' is not set." }, + Module_0_was_resolved_to_1_but_allowJs_is_not_set: { code: 6143, category: ts.DiagnosticCategory.Error, key: "Module_0_was_resolved_to_1_but_allowJs_is_not_set_6143", message: "Module '{0}' was resolved to '{1}', but '--allowJs' is not set." }, + Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1: { code: 6144, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144", message: "Module '{0}' was resolved as locally declared ambient module in file '{1}'." }, + Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified: { code: 6145, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145", message: "Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified." }, + Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h: { code: 6146, category: ts.DiagnosticCategory.Message, key: "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146", message: "Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'." }, + Resolution_for_module_0_was_found_in_cache: { code: 6147, category: ts.DiagnosticCategory.Message, key: "Resolution_for_module_0_was_found_in_cache_6147", message: "Resolution for module '{0}' was found in cache" }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter_0_implicitly_has_an_1_type_7006", message: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member_0_implicitly_has_an_1_type_7008", message: "Member '{0}' implicitly has an '{1}' type." }, @@ -3628,8 +4603,8 @@ var ts; Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: ts.DiagnosticCategory.Error, key: "Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7011", message: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." }, Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: ts.DiagnosticCategory.Error, key: "Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7013", message: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." }, Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number: { code: 7015, category: ts.DiagnosticCategory.Error, key: "Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015", message: "Element implicitly has an 'any' type because index expression is not of type 'number'." }, - Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { code: 7016, category: ts.DiagnosticCategory.Error, key: "Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation_7016", message: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." }, - Index_signature_of_object_type_implicitly_has_an_any_type: { code: 7017, category: ts.DiagnosticCategory.Error, key: "Index_signature_of_object_type_implicitly_has_an_any_type_7017", message: "Index signature of object type implicitly has an 'any' type." }, + Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type: { code: 7016, category: ts.DiagnosticCategory.Error, key: "Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type_7016", message: "Could not find a declaration file for module '{0}'. '{1}' implicitly has an 'any' type." }, + Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature: { code: 7017, category: ts.DiagnosticCategory.Error, key: "Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_7017", message: "Element implicitly has an 'any' type because type '{0}' has no index signature." }, Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: ts.DiagnosticCategory.Error, key: "Object_literal_s_property_0_implicitly_has_an_1_type_7018", message: "Object literal's property '{0}' implicitly has an '{1}' type." }, Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: ts.DiagnosticCategory.Error, key: "Rest_parameter_0_implicitly_has_an_any_type_7019", message: "Rest parameter '{0}' implicitly has an 'any[]' type." }, Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: ts.DiagnosticCategory.Error, key: "Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7020", message: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, @@ -3643,6 +4618,9 @@ var ts; Fallthrough_case_in_switch: { code: 7029, category: ts.DiagnosticCategory.Error, key: "Fallthrough_case_in_switch_7029", message: "Fallthrough case in switch." }, Not_all_code_paths_return_a_value: { code: 7030, category: ts.DiagnosticCategory.Error, key: "Not_all_code_paths_return_a_value_7030", message: "Not all code paths return a value." }, Binding_element_0_implicitly_has_an_1_type: { code: 7031, category: ts.DiagnosticCategory.Error, key: "Binding_element_0_implicitly_has_an_1_type_7031", message: "Binding element '{0}' implicitly has an '{1}' type." }, + Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation: { code: 7032, category: ts.DiagnosticCategory.Error, key: "Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation_7032", message: "Property '{0}' implicitly has type 'any', because its set accessor lacks a parameter type annotation." }, + Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation: { code: 7033, category: ts.DiagnosticCategory.Error, key: "Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation_7033", message: "Property '{0}' implicitly has type 'any', because its get accessor lacks a return type annotation." }, + Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined: { code: 7034, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined_7034", message: "Variable '{0}' implicitly has type '{1}' in some locations where its type cannot be determined." }, You_cannot_rename_this_element: { code: 8000, category: ts.DiagnosticCategory.Error, key: "You_cannot_rename_this_element_8000", message: "You cannot rename this element." }, You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: ts.DiagnosticCategory.Error, key: "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", message: "You cannot rename elements that are defined in the standard TypeScript library." }, import_can_only_be_used_in_a_ts_file: { code: 8002, category: ts.DiagnosticCategory.Error, key: "import_can_only_be_used_in_a_ts_file_8002", message: "'import ... =' can only be used in a .ts file." }, @@ -3660,6 +4638,7 @@ var ts; type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: ts.DiagnosticCategory.Error, key: "type_assertion_expressions_can_only_be_used_in_a_ts_file_8016", message: "'type assertion expressions' can only be used in a .ts file." }, Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: ts.DiagnosticCategory.Error, key: "Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002", message: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." }, class_expressions_are_not_currently_supported: { code: 9003, category: ts.DiagnosticCategory.Error, key: "class_expressions_are_not_currently_supported_9003", message: "'class' expressions are not currently supported." }, + Language_service_is_disabled: { code: 9004, category: ts.DiagnosticCategory.Error, key: "Language_service_is_disabled_9004", message: "Language service is disabled." }, JSX_attributes_must_only_be_assigned_a_non_empty_expression: { code: 17000, category: ts.DiagnosticCategory.Error, key: "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", message: "JSX attributes must only be assigned a non-empty 'expression'." }, JSX_elements_cannot_have_multiple_attributes_with_the_same_name: { code: 17001, category: ts.DiagnosticCategory.Error, key: "JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001", message: "JSX elements cannot have multiple attributes with the same name." }, Expected_corresponding_JSX_closing_tag_for_0: { code: 17002, category: ts.DiagnosticCategory.Error, key: "Expected_corresponding_JSX_closing_tag_for_0_17002", message: "Expected corresponding JSX closing tag for '{0}'." }, @@ -3670,7 +4649,25 @@ 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}'." }, + super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: { code: 17011, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", message: "'super' must be called before accessing a property of 'super' in the constructor of a derived class." }, + 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}" }, + 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." }, + Make_super_call_the_first_statement_in_the_constructor: { code: 90002, category: ts.DiagnosticCategory.Message, key: "Make_super_call_the_first_statement_in_the_constructor_90002", message: "Make 'super()' call the first statement in the constructor." }, + Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'" }, + Remove_unused_identifiers: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_unused_identifiers_90004", message: "Remove unused identifiers" }, + Implement_interface_on_reference: { code: 90005, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_reference_90005", message: "Implement interface on reference" }, + Implement_interface_on_class: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_on_class_90006", message: "Implement interface on class" }, + 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}" }, + Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0: { code: 8017, category: ts.DiagnosticCategory.Error, key: "Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0_8017", message: "Octal literal types must use ES2015 syntax. Use the syntax '{0}'." }, }; })(ts || (ts = {})); /// @@ -3679,133 +4676,134 @@ var ts; (function (ts) { /* @internal */ function tokenIsIdentifierOrKeyword(token) { - return token >= 69 /* Identifier */; + return token >= 70 /* Identifier */; } ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; var textToToken = ts.createMap({ - "abstract": 115 /* AbstractKeyword */, - "any": 117 /* AnyKeyword */, - "as": 116 /* AsKeyword */, - "boolean": 120 /* BooleanKeyword */, - "break": 70 /* BreakKeyword */, - "case": 71 /* CaseKeyword */, - "catch": 72 /* CatchKeyword */, - "class": 73 /* ClassKeyword */, - "continue": 75 /* ContinueKeyword */, - "const": 74 /* ConstKeyword */, - "constructor": 121 /* ConstructorKeyword */, - "debugger": 76 /* DebuggerKeyword */, - "declare": 122 /* DeclareKeyword */, - "default": 77 /* DefaultKeyword */, - "delete": 78 /* DeleteKeyword */, - "do": 79 /* DoKeyword */, - "else": 80 /* ElseKeyword */, - "enum": 81 /* EnumKeyword */, - "export": 82 /* ExportKeyword */, - "extends": 83 /* ExtendsKeyword */, - "false": 84 /* FalseKeyword */, - "finally": 85 /* FinallyKeyword */, - "for": 86 /* ForKeyword */, - "from": 136 /* FromKeyword */, - "function": 87 /* FunctionKeyword */, - "get": 123 /* GetKeyword */, - "if": 88 /* IfKeyword */, - "implements": 106 /* ImplementsKeyword */, - "import": 89 /* ImportKeyword */, - "in": 90 /* InKeyword */, - "instanceof": 91 /* InstanceOfKeyword */, - "interface": 107 /* InterfaceKeyword */, - "is": 124 /* IsKeyword */, - "let": 108 /* LetKeyword */, - "module": 125 /* ModuleKeyword */, - "namespace": 126 /* NamespaceKeyword */, - "never": 127 /* NeverKeyword */, - "new": 92 /* NewKeyword */, - "null": 93 /* NullKeyword */, - "number": 130 /* NumberKeyword */, - "package": 109 /* PackageKeyword */, - "private": 110 /* PrivateKeyword */, - "protected": 111 /* ProtectedKeyword */, - "public": 112 /* PublicKeyword */, - "readonly": 128 /* ReadonlyKeyword */, - "require": 129 /* RequireKeyword */, - "global": 137 /* GlobalKeyword */, - "return": 94 /* ReturnKeyword */, - "set": 131 /* SetKeyword */, - "static": 113 /* StaticKeyword */, - "string": 132 /* StringKeyword */, - "super": 95 /* SuperKeyword */, - "switch": 96 /* SwitchKeyword */, - "symbol": 133 /* SymbolKeyword */, - "this": 97 /* ThisKeyword */, - "throw": 98 /* ThrowKeyword */, - "true": 99 /* TrueKeyword */, - "try": 100 /* TryKeyword */, - "type": 134 /* TypeKeyword */, - "typeof": 101 /* TypeOfKeyword */, - "undefined": 135 /* UndefinedKeyword */, - "var": 102 /* VarKeyword */, - "void": 103 /* VoidKeyword */, - "while": 104 /* WhileKeyword */, - "with": 105 /* WithKeyword */, - "yield": 114 /* YieldKeyword */, - "async": 118 /* AsyncKeyword */, - "await": 119 /* AwaitKeyword */, - "of": 138 /* OfKeyword */, - "{": 15 /* OpenBraceToken */, - "}": 16 /* CloseBraceToken */, - "(": 17 /* OpenParenToken */, - ")": 18 /* CloseParenToken */, - "[": 19 /* OpenBracketToken */, - "]": 20 /* CloseBracketToken */, - ".": 21 /* DotToken */, - "...": 22 /* DotDotDotToken */, - ";": 23 /* SemicolonToken */, - ",": 24 /* CommaToken */, - "<": 25 /* LessThanToken */, - ">": 27 /* GreaterThanToken */, - "<=": 28 /* LessThanEqualsToken */, - ">=": 29 /* GreaterThanEqualsToken */, - "==": 30 /* EqualsEqualsToken */, - "!=": 31 /* ExclamationEqualsToken */, - "===": 32 /* EqualsEqualsEqualsToken */, - "!==": 33 /* ExclamationEqualsEqualsToken */, - "=>": 34 /* EqualsGreaterThanToken */, - "+": 35 /* PlusToken */, - "-": 36 /* MinusToken */, - "**": 38 /* AsteriskAsteriskToken */, - "*": 37 /* AsteriskToken */, - "/": 39 /* SlashToken */, - "%": 40 /* PercentToken */, - "++": 41 /* PlusPlusToken */, - "--": 42 /* MinusMinusToken */, - "<<": 43 /* LessThanLessThanToken */, - ">": 44 /* GreaterThanGreaterThanToken */, - ">>>": 45 /* GreaterThanGreaterThanGreaterThanToken */, - "&": 46 /* AmpersandToken */, - "|": 47 /* BarToken */, - "^": 48 /* CaretToken */, - "!": 49 /* ExclamationToken */, - "~": 50 /* TildeToken */, - "&&": 51 /* AmpersandAmpersandToken */, - "||": 52 /* BarBarToken */, - "?": 53 /* QuestionToken */, - ":": 54 /* ColonToken */, - "=": 56 /* EqualsToken */, - "+=": 57 /* PlusEqualsToken */, - "-=": 58 /* MinusEqualsToken */, - "*=": 59 /* AsteriskEqualsToken */, - "**=": 60 /* AsteriskAsteriskEqualsToken */, - "/=": 61 /* SlashEqualsToken */, - "%=": 62 /* PercentEqualsToken */, - "<<=": 63 /* LessThanLessThanEqualsToken */, - ">>=": 64 /* GreaterThanGreaterThanEqualsToken */, - ">>>=": 65 /* GreaterThanGreaterThanGreaterThanEqualsToken */, - "&=": 66 /* AmpersandEqualsToken */, - "|=": 67 /* BarEqualsToken */, - "^=": 68 /* CaretEqualsToken */, - "@": 55 /* AtToken */ + "abstract": 116 /* AbstractKeyword */, + "any": 118 /* AnyKeyword */, + "as": 117 /* AsKeyword */, + "boolean": 121 /* BooleanKeyword */, + "break": 71 /* BreakKeyword */, + "case": 72 /* CaseKeyword */, + "catch": 73 /* CatchKeyword */, + "class": 74 /* ClassKeyword */, + "continue": 76 /* ContinueKeyword */, + "const": 75 /* ConstKeyword */, + "constructor": 122 /* ConstructorKeyword */, + "debugger": 77 /* DebuggerKeyword */, + "declare": 123 /* DeclareKeyword */, + "default": 78 /* DefaultKeyword */, + "delete": 79 /* DeleteKeyword */, + "do": 80 /* DoKeyword */, + "else": 81 /* ElseKeyword */, + "enum": 82 /* EnumKeyword */, + "export": 83 /* ExportKeyword */, + "extends": 84 /* ExtendsKeyword */, + "false": 85 /* FalseKeyword */, + "finally": 86 /* FinallyKeyword */, + "for": 87 /* ForKeyword */, + "from": 138 /* FromKeyword */, + "function": 88 /* FunctionKeyword */, + "get": 124 /* GetKeyword */, + "if": 89 /* IfKeyword */, + "implements": 107 /* ImplementsKeyword */, + "import": 90 /* ImportKeyword */, + "in": 91 /* InKeyword */, + "instanceof": 92 /* InstanceOfKeyword */, + "interface": 108 /* InterfaceKeyword */, + "is": 125 /* IsKeyword */, + "keyof": 126 /* KeyOfKeyword */, + "let": 109 /* LetKeyword */, + "module": 127 /* ModuleKeyword */, + "namespace": 128 /* NamespaceKeyword */, + "never": 129 /* NeverKeyword */, + "new": 93 /* NewKeyword */, + "null": 94 /* NullKeyword */, + "number": 132 /* NumberKeyword */, + "package": 110 /* PackageKeyword */, + "private": 111 /* PrivateKeyword */, + "protected": 112 /* ProtectedKeyword */, + "public": 113 /* PublicKeyword */, + "readonly": 130 /* ReadonlyKeyword */, + "require": 131 /* RequireKeyword */, + "global": 139 /* GlobalKeyword */, + "return": 95 /* ReturnKeyword */, + "set": 133 /* SetKeyword */, + "static": 114 /* StaticKeyword */, + "string": 134 /* StringKeyword */, + "super": 96 /* SuperKeyword */, + "switch": 97 /* SwitchKeyword */, + "symbol": 135 /* SymbolKeyword */, + "this": 98 /* ThisKeyword */, + "throw": 99 /* ThrowKeyword */, + "true": 100 /* TrueKeyword */, + "try": 101 /* TryKeyword */, + "type": 136 /* TypeKeyword */, + "typeof": 102 /* TypeOfKeyword */, + "undefined": 137 /* UndefinedKeyword */, + "var": 103 /* VarKeyword */, + "void": 104 /* VoidKeyword */, + "while": 105 /* WhileKeyword */, + "with": 106 /* WithKeyword */, + "yield": 115 /* YieldKeyword */, + "async": 119 /* AsyncKeyword */, + "await": 120 /* AwaitKeyword */, + "of": 140 /* OfKeyword */, + "{": 16 /* OpenBraceToken */, + "}": 17 /* CloseBraceToken */, + "(": 18 /* OpenParenToken */, + ")": 19 /* CloseParenToken */, + "[": 20 /* OpenBracketToken */, + "]": 21 /* CloseBracketToken */, + ".": 22 /* DotToken */, + "...": 23 /* DotDotDotToken */, + ";": 24 /* SemicolonToken */, + ",": 25 /* CommaToken */, + "<": 26 /* LessThanToken */, + ">": 28 /* GreaterThanToken */, + "<=": 29 /* LessThanEqualsToken */, + ">=": 30 /* GreaterThanEqualsToken */, + "==": 31 /* EqualsEqualsToken */, + "!=": 32 /* ExclamationEqualsToken */, + "===": 33 /* EqualsEqualsEqualsToken */, + "!==": 34 /* ExclamationEqualsEqualsToken */, + "=>": 35 /* EqualsGreaterThanToken */, + "+": 36 /* PlusToken */, + "-": 37 /* MinusToken */, + "**": 39 /* AsteriskAsteriskToken */, + "*": 38 /* AsteriskToken */, + "/": 40 /* SlashToken */, + "%": 41 /* PercentToken */, + "++": 42 /* PlusPlusToken */, + "--": 43 /* MinusMinusToken */, + "<<": 44 /* LessThanLessThanToken */, + ">": 45 /* GreaterThanGreaterThanToken */, + ">>>": 46 /* GreaterThanGreaterThanGreaterThanToken */, + "&": 47 /* AmpersandToken */, + "|": 48 /* BarToken */, + "^": 49 /* CaretToken */, + "!": 50 /* ExclamationToken */, + "~": 51 /* TildeToken */, + "&&": 52 /* AmpersandAmpersandToken */, + "||": 53 /* BarBarToken */, + "?": 54 /* QuestionToken */, + ":": 55 /* ColonToken */, + "=": 57 /* EqualsToken */, + "+=": 58 /* PlusEqualsToken */, + "-=": 59 /* MinusEqualsToken */, + "*=": 60 /* AsteriskEqualsToken */, + "**=": 61 /* AsteriskAsteriskEqualsToken */, + "/=": 62 /* SlashEqualsToken */, + "%=": 63 /* PercentEqualsToken */, + "<<=": 64 /* LessThanLessThanEqualsToken */, + ">>=": 65 /* GreaterThanGreaterThanEqualsToken */, + ">>>=": 66 /* GreaterThanGreaterThanGreaterThanEqualsToken */, + "&=": 67 /* AmpersandEqualsToken */, + "|=": 68 /* BarEqualsToken */, + "^=": 69 /* CaretEqualsToken */, + "@": 56 /* AtToken */, }); /* As per ECMAScript Language Specification 3th Edition, Section 7.6: Identifiers @@ -4053,9 +5051,7 @@ var ts; /* @internal */ function skipTrivia(text, pos, stopAfterLineBreak, stopAtComments) { if (stopAtComments === void 0) { stopAtComments = false; } - // Using ! with a greater than test is a fast way of testing the following conditions: - // pos === undefined || pos === null || isNaN(pos) || pos < 0; - if (!(pos >= 0)) { + if (ts.positionIsSynthesized(pos)) { return pos; } // Keep in sync with couldStartTrivia @@ -4186,20 +5182,34 @@ var ts; return pos; } /** - * Extract comments from text prefixing the token closest following `pos`. - * The return value is an array containing a TextRange for each comment. - * Single-line comment ranges include the beginning '//' characters but not the ending line break. - * Multi - line comment ranges include the beginning '/* and ending '/' characters. - * The return value is undefined if no comments were found. - * @param trailing - * If false, whitespace is skipped until the first line break and comments between that location - * and the next token are returned. - * If true, comments occurring between the given position and the next line break are returned. + * Invokes a callback for each comment range following the provided position. + * + * Single-line comment ranges include the leading double-slash characters but not the ending + * line break. Multi-line comment ranges include the leading slash-asterisk and trailing + * asterisk-slash characters. + * + * @param reduce If true, accumulates the result of calling the callback in a fashion similar + * to reduceLeft. If false, iteration stops when the callback returns a truthy value. + * @param text The source text to scan. + * @param pos The position at which to start scanning. + * @param trailing If false, whitespace is skipped until the first line break and comments + * between that location and the next token are returned. If true, comments occurring + * between the given position and the next line break are returned. + * @param cb The callback to execute as each comment range is encountered. + * @param state A state value to pass to each iteration of the callback. + * @param initial An initial value to pass when accumulating results (when "reduce" is true). + * @returns If "reduce" is true, the accumulated value. If "reduce" is false, the first truthy + * return value of the callback. */ - function getCommentRanges(text, pos, trailing) { - var result; + function iterateCommentRanges(reduce, text, pos, trailing, cb, state, initial) { + var pendingPos; + var pendingEnd; + var pendingKind; + var pendingHasTrailingNewLine; + var hasPendingCommentRange = false; var collecting = trailing || pos === 0; - while (pos < text.length) { + var accumulator = initial; + scan: while (pos >= 0 && pos < text.length) { var ch = text.charCodeAt(pos); switch (ch) { case 13 /* carriageReturn */: @@ -4209,11 +5219,11 @@ var ts; case 10 /* lineFeed */: pos++; if (trailing) { - return result; + break scan; } collecting = true; - if (result && result.length) { - ts.lastOrUndefined(result).hasTrailingNewLine = true; + if (hasPendingCommentRange) { + pendingHasTrailingNewLine = true; } continue; case 9 /* tab */: @@ -4248,34 +5258,68 @@ var ts; } } if (collecting) { - if (!result) { - result = []; + if (hasPendingCommentRange) { + accumulator = cb(pendingPos, pendingEnd, pendingKind, pendingHasTrailingNewLine, state, accumulator); + if (!reduce && accumulator) { + // If we are not reducing and we have a truthy result, return it. + return accumulator; + } + hasPendingCommentRange = false; } - result.push({ pos: startPos, end: pos, hasTrailingNewLine: hasTrailingNewLine, kind: kind }); + pendingPos = startPos; + pendingEnd = pos; + pendingKind = kind; + pendingHasTrailingNewLine = hasTrailingNewLine; + hasPendingCommentRange = true; } continue; } - break; + break scan; default: if (ch > 127 /* maxAsciiCharacter */ && (isWhiteSpace(ch))) { - if (result && result.length && isLineBreak(ch)) { - ts.lastOrUndefined(result).hasTrailingNewLine = true; + if (hasPendingCommentRange && isLineBreak(ch)) { + pendingHasTrailingNewLine = true; } pos++; continue; } - break; + break scan; } - return result; } - return result; + if (hasPendingCommentRange) { + accumulator = cb(pendingPos, pendingEnd, pendingKind, pendingHasTrailingNewLine, state, accumulator); + } + return accumulator; + } + function forEachLeadingCommentRange(text, pos, cb, state) { + return iterateCommentRanges(/*reduce*/ false, text, pos, /*trailing*/ false, cb, state); + } + ts.forEachLeadingCommentRange = forEachLeadingCommentRange; + function forEachTrailingCommentRange(text, pos, cb, state) { + return iterateCommentRanges(/*reduce*/ false, text, pos, /*trailing*/ true, cb, state); + } + ts.forEachTrailingCommentRange = forEachTrailingCommentRange; + function reduceEachLeadingCommentRange(text, pos, cb, state, initial) { + return iterateCommentRanges(/*reduce*/ true, text, pos, /*trailing*/ false, cb, state, initial); + } + ts.reduceEachLeadingCommentRange = reduceEachLeadingCommentRange; + function reduceEachTrailingCommentRange(text, pos, cb, state, initial) { + return iterateCommentRanges(/*reduce*/ true, text, pos, /*trailing*/ true, cb, state, initial); + } + ts.reduceEachTrailingCommentRange = reduceEachTrailingCommentRange; + function appendCommentRange(pos, end, kind, hasTrailingNewLine, _state, comments) { + if (!comments) { + comments = []; + } + comments.push({ pos: pos, end: end, hasTrailingNewLine: hasTrailingNewLine, kind: kind }); + return comments; } function getLeadingCommentRanges(text, pos) { - return getCommentRanges(text, pos, /*trailing*/ false); + return reduceEachLeadingCommentRange(text, pos, appendCommentRange, undefined, undefined); } ts.getLeadingCommentRanges = getLeadingCommentRanges; function getTrailingCommentRanges(text, pos) { - return getCommentRanges(text, pos, /*trailing*/ true); + return reduceEachTrailingCommentRange(text, pos, appendCommentRange, undefined, undefined); } ts.getTrailingCommentRanges = getTrailingCommentRanges; /** Optionally, get the shebang */ @@ -4298,7 +5342,7 @@ var ts; } ts.isIdentifierPart = isIdentifierPart; /* @internal */ - function isIdentifier(name, languageVersion) { + function isIdentifierText(name, languageVersion) { if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) { return false; } @@ -4309,7 +5353,7 @@ var ts; } return true; } - ts.isIdentifier = isIdentifier; + ts.isIdentifierText = isIdentifierText; // Creates a scanner over a (possibly unspecified) range of a piece of text. function createScanner(languageVersion, skipTrivia, languageVariant, text, onError, start, length) { if (languageVariant === void 0) { languageVariant = 0 /* Standard */; } @@ -4336,13 +5380,14 @@ var ts; getTokenValue: function () { return tokenValue; }, hasExtendedUnicodeEscape: function () { return hasExtendedUnicodeEscape; }, hasPrecedingLineBreak: function () { return precedingLineBreak; }, - isIdentifier: function () { return token === 69 /* Identifier */ || token > 105 /* LastReservedWord */; }, - isReservedWord: function () { return token >= 70 /* FirstReservedWord */ && token <= 105 /* LastReservedWord */; }, + isIdentifier: function () { return token === 70 /* Identifier */ || token > 106 /* LastReservedWord */; }, + isReservedWord: function () { return token >= 71 /* FirstReservedWord */ && token <= 106 /* LastReservedWord */; }, isUnterminated: function () { return tokenIsUnterminated; }, reScanGreaterToken: reScanGreaterToken, reScanSlashToken: reScanSlashToken, reScanTemplateToken: reScanTemplateToken, scanJsxIdentifier: scanJsxIdentifier, + scanJsxAttributeValue: scanJsxAttributeValue, reScanJsxToken: reScanJsxToken, scanJsxToken: scanJsxToken, scanJSDocToken: scanJSDocToken, @@ -4355,7 +5400,7 @@ var ts; setTextPos: setTextPos, tryScan: tryScan, lookAhead: lookAhead, - scanRange: scanRange + scanRange: scanRange, }; function error(message, length) { if (onError) { @@ -4434,7 +5479,8 @@ var ts; } return value; } - function scanString() { + function scanString(allowEscapes) { + if (allowEscapes === void 0) { allowEscapes = true; } var quote = text.charCodeAt(pos); pos++; var result = ""; @@ -4452,7 +5498,7 @@ var ts; pos++; break; } - if (ch === 92 /* backslash */) { + if (ch === 92 /* backslash */ && allowEscapes) { result += text.substring(start, pos); result += scanEscapeSequence(); start = pos; @@ -4483,7 +5529,7 @@ var ts; contents += text.substring(start, pos); tokenIsUnterminated = true; error(ts.Diagnostics.Unterminated_template_literal); - resultingToken = startedWithBacktick ? 11 /* NoSubstitutionTemplateLiteral */ : 14 /* TemplateTail */; + resultingToken = startedWithBacktick ? 12 /* NoSubstitutionTemplateLiteral */ : 15 /* TemplateTail */; break; } var currChar = text.charCodeAt(pos); @@ -4491,14 +5537,14 @@ var ts; if (currChar === 96 /* backtick */) { contents += text.substring(start, pos); pos++; - resultingToken = startedWithBacktick ? 11 /* NoSubstitutionTemplateLiteral */ : 14 /* TemplateTail */; + resultingToken = startedWithBacktick ? 12 /* NoSubstitutionTemplateLiteral */ : 15 /* TemplateTail */; break; } // '${' if (currChar === 36 /* $ */ && pos + 1 < end && text.charCodeAt(pos + 1) === 123 /* openBrace */) { contents += text.substring(start, pos); pos += 2; - resultingToken = startedWithBacktick ? 12 /* TemplateHead */ : 13 /* TemplateMiddle */; + resultingToken = startedWithBacktick ? 13 /* TemplateHead */ : 14 /* TemplateMiddle */; break; } // Escape character @@ -4676,10 +5722,10 @@ var ts; return token = textToToken[tokenValue]; } } - return token = 69 /* Identifier */; + return token = 70 /* Identifier */; } function scanBinaryOrOctalDigits(base) { - ts.Debug.assert(base !== 2 || base !== 8, "Expected either base 2 or base 8"); + ts.Debug.assert(base === 2 || base === 8, "Expected either base 2 or base 8"); var value = 0; // For counting number of digits; Valid binaryIntegerLiteral must have at least one binary digit following B or b. // Similarly valid octalIntegerLiteral must have at least one octal digit following o or O. @@ -4756,12 +5802,12 @@ var ts; case 33 /* exclamation */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 33 /* ExclamationEqualsEqualsToken */; + return pos += 3, token = 34 /* ExclamationEqualsEqualsToken */; } - return pos += 2, token = 31 /* ExclamationEqualsToken */; + return pos += 2, token = 32 /* ExclamationEqualsToken */; } pos++; - return token = 49 /* ExclamationToken */; + return token = 50 /* ExclamationToken */; case 34 /* doubleQuote */: case 39 /* singleQuote */: tokenValue = scanString(); @@ -4770,68 +5816,68 @@ var ts; return token = scanTemplateAndSetTokenValue(); case 37 /* percent */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 62 /* PercentEqualsToken */; + return pos += 2, token = 63 /* PercentEqualsToken */; } pos++; - return token = 40 /* PercentToken */; + return token = 41 /* PercentToken */; case 38 /* ampersand */: if (text.charCodeAt(pos + 1) === 38 /* ampersand */) { - return pos += 2, token = 51 /* AmpersandAmpersandToken */; + return pos += 2, token = 52 /* AmpersandAmpersandToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 66 /* AmpersandEqualsToken */; + return pos += 2, token = 67 /* AmpersandEqualsToken */; } pos++; - return token = 46 /* AmpersandToken */; + return token = 47 /* AmpersandToken */; case 40 /* openParen */: pos++; - return token = 17 /* OpenParenToken */; + return token = 18 /* OpenParenToken */; case 41 /* closeParen */: pos++; - return token = 18 /* CloseParenToken */; + return token = 19 /* CloseParenToken */; case 42 /* asterisk */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 59 /* AsteriskEqualsToken */; + return pos += 2, token = 60 /* AsteriskEqualsToken */; } if (text.charCodeAt(pos + 1) === 42 /* asterisk */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 60 /* AsteriskAsteriskEqualsToken */; + return pos += 3, token = 61 /* AsteriskAsteriskEqualsToken */; } - return pos += 2, token = 38 /* AsteriskAsteriskToken */; + return pos += 2, token = 39 /* AsteriskAsteriskToken */; } pos++; - return token = 37 /* AsteriskToken */; + return token = 38 /* AsteriskToken */; case 43 /* plus */: if (text.charCodeAt(pos + 1) === 43 /* plus */) { - return pos += 2, token = 41 /* PlusPlusToken */; + return pos += 2, token = 42 /* PlusPlusToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 57 /* PlusEqualsToken */; + return pos += 2, token = 58 /* PlusEqualsToken */; } pos++; - return token = 35 /* PlusToken */; + return token = 36 /* PlusToken */; case 44 /* comma */: pos++; - return token = 24 /* CommaToken */; + return token = 25 /* CommaToken */; case 45 /* minus */: if (text.charCodeAt(pos + 1) === 45 /* minus */) { - return pos += 2, token = 42 /* MinusMinusToken */; + return pos += 2, token = 43 /* MinusMinusToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 58 /* MinusEqualsToken */; + return pos += 2, token = 59 /* MinusEqualsToken */; } pos++; - return token = 36 /* MinusToken */; + return token = 37 /* MinusToken */; case 46 /* dot */: if (isDigit(text.charCodeAt(pos + 1))) { tokenValue = scanNumber(); return token = 8 /* NumericLiteral */; } if (text.charCodeAt(pos + 1) === 46 /* dot */ && text.charCodeAt(pos + 2) === 46 /* dot */) { - return pos += 3, token = 22 /* DotDotDotToken */; + return pos += 3, token = 23 /* DotDotDotToken */; } pos++; - return token = 21 /* DotToken */; + return token = 22 /* DotToken */; case 47 /* slash */: // Single-line comment if (text.charCodeAt(pos + 1) === 47 /* slash */) { @@ -4877,10 +5923,10 @@ var ts; } } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 61 /* SlashEqualsToken */; + return pos += 2, token = 62 /* SlashEqualsToken */; } pos++; - return token = 39 /* SlashToken */; + return token = 40 /* SlashToken */; case 48 /* _0 */: if (pos + 2 < end && (text.charCodeAt(pos + 1) === 88 /* X */ || text.charCodeAt(pos + 1) === 120 /* x */)) { pos += 2; @@ -4933,10 +5979,10 @@ var ts; return token = 8 /* NumericLiteral */; case 58 /* colon */: pos++; - return token = 54 /* ColonToken */; + return token = 55 /* ColonToken */; case 59 /* semicolon */: pos++; - return token = 23 /* SemicolonToken */; + return token = 24 /* SemicolonToken */; case 60 /* lessThan */: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -4949,20 +5995,20 @@ var ts; } if (text.charCodeAt(pos + 1) === 60 /* lessThan */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 63 /* LessThanLessThanEqualsToken */; + return pos += 3, token = 64 /* LessThanLessThanEqualsToken */; } - return pos += 2, token = 43 /* LessThanLessThanToken */; + return pos += 2, token = 44 /* LessThanLessThanToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 28 /* LessThanEqualsToken */; + return pos += 2, token = 29 /* LessThanEqualsToken */; } if (languageVariant === 1 /* JSX */ && text.charCodeAt(pos + 1) === 47 /* slash */ && text.charCodeAt(pos + 2) !== 42 /* asterisk */) { - return pos += 2, token = 26 /* LessThanSlashToken */; + return pos += 2, token = 27 /* LessThanSlashToken */; } pos++; - return token = 25 /* LessThanToken */; + return token = 26 /* LessThanToken */; case 61 /* equals */: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -4975,15 +6021,15 @@ var ts; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 32 /* EqualsEqualsEqualsToken */; + return pos += 3, token = 33 /* EqualsEqualsEqualsToken */; } - return pos += 2, token = 30 /* EqualsEqualsToken */; + return pos += 2, token = 31 /* EqualsEqualsToken */; } if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { - return pos += 2, token = 34 /* EqualsGreaterThanToken */; + return pos += 2, token = 35 /* EqualsGreaterThanToken */; } pos++; - return token = 56 /* EqualsToken */; + return token = 57 /* EqualsToken */; case 62 /* greaterThan */: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -4995,43 +6041,43 @@ var ts; } } pos++; - return token = 27 /* GreaterThanToken */; + return token = 28 /* GreaterThanToken */; case 63 /* question */: pos++; - return token = 53 /* QuestionToken */; + return token = 54 /* QuestionToken */; case 91 /* openBracket */: pos++; - return token = 19 /* OpenBracketToken */; + return token = 20 /* OpenBracketToken */; case 93 /* closeBracket */: pos++; - return token = 20 /* CloseBracketToken */; + return token = 21 /* CloseBracketToken */; case 94 /* caret */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 68 /* CaretEqualsToken */; + return pos += 2, token = 69 /* CaretEqualsToken */; } pos++; - return token = 48 /* CaretToken */; + return token = 49 /* CaretToken */; case 123 /* openBrace */: pos++; - return token = 15 /* OpenBraceToken */; + return token = 16 /* OpenBraceToken */; case 124 /* bar */: if (text.charCodeAt(pos + 1) === 124 /* bar */) { - return pos += 2, token = 52 /* BarBarToken */; + return pos += 2, token = 53 /* BarBarToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 67 /* BarEqualsToken */; + return pos += 2, token = 68 /* BarEqualsToken */; } pos++; - return token = 47 /* BarToken */; + return token = 48 /* BarToken */; case 125 /* closeBrace */: pos++; - return token = 16 /* CloseBraceToken */; + return token = 17 /* CloseBraceToken */; case 126 /* tilde */: pos++; - return token = 50 /* TildeToken */; + return token = 51 /* TildeToken */; case 64 /* at */: pos++; - return token = 55 /* AtToken */; + return token = 56 /* AtToken */; case 92 /* backslash */: var cookedChar = peekUnicodeEscape(); if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) { @@ -5069,29 +6115,29 @@ var ts; } } function reScanGreaterToken() { - if (token === 27 /* GreaterThanToken */) { + if (token === 28 /* GreaterThanToken */) { if (text.charCodeAt(pos) === 62 /* greaterThan */) { if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 65 /* GreaterThanGreaterThanGreaterThanEqualsToken */; + return pos += 3, token = 66 /* GreaterThanGreaterThanGreaterThanEqualsToken */; } - return pos += 2, token = 45 /* GreaterThanGreaterThanGreaterThanToken */; + return pos += 2, token = 46 /* GreaterThanGreaterThanGreaterThanToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 64 /* GreaterThanGreaterThanEqualsToken */; + return pos += 2, token = 65 /* GreaterThanGreaterThanEqualsToken */; } pos++; - return token = 44 /* GreaterThanGreaterThanToken */; + return token = 45 /* GreaterThanGreaterThanToken */; } if (text.charCodeAt(pos) === 61 /* equals */) { pos++; - return token = 29 /* GreaterThanEqualsToken */; + return token = 30 /* GreaterThanEqualsToken */; } } return token; } function reScanSlashToken() { - if (token === 39 /* SlashToken */ || token === 61 /* SlashEqualsToken */) { + if (token === 40 /* SlashToken */ || token === 62 /* SlashEqualsToken */) { var p = tokenPos + 1; var inEscape = false; var inCharacterClass = false; @@ -5136,7 +6182,7 @@ var ts; } pos = p; tokenValue = text.substring(tokenPos, pos); - token = 10 /* RegularExpressionLiteral */; + token = 11 /* RegularExpressionLiteral */; } return token; } @@ -5144,7 +6190,7 @@ var ts; * Unconditionally back up and scan a template expression portion. */ function reScanTemplateToken() { - ts.Debug.assert(token === 16 /* CloseBraceToken */, "'reScanTemplateToken' should only be called on a '}'"); + ts.Debug.assert(token === 17 /* CloseBraceToken */, "'reScanTemplateToken' should only be called on a '}'"); pos = tokenPos; return token = scanTemplateAndSetTokenValue(); } @@ -5161,14 +6207,14 @@ var ts; if (char === 60 /* lessThan */) { if (text.charCodeAt(pos + 1) === 47 /* slash */) { pos += 2; - return token = 26 /* LessThanSlashToken */; + return token = 27 /* LessThanSlashToken */; } pos++; - return token = 25 /* LessThanToken */; + return token = 26 /* LessThanToken */; } if (char === 123 /* openBrace */) { pos++; - return token = 15 /* OpenBraceToken */; + return token = 16 /* OpenBraceToken */; } while (pos < end) { pos++; @@ -5177,7 +6223,7 @@ var ts; break; } } - return token = 244 /* JsxText */; + return token = 10 /* JsxText */; } // Scans a JSX identifier; these differ from normal identifiers in that // they allow dashes @@ -5197,50 +6243,72 @@ var ts; } return token; } + function scanJsxAttributeValue() { + startPos = pos; + switch (text.charCodeAt(pos)) { + case 34 /* doubleQuote */: + case 39 /* singleQuote */: + tokenValue = scanString(/*allowEscapes*/ false); + return token = 9 /* StringLiteral */; + default: + // If this scans anything other than `{`, it's a parse error. + return scan(); + } + } function scanJSDocToken() { if (pos >= end) { return token = 1 /* EndOfFileToken */; } startPos = pos; - // Eat leading whitespace - var ch = text.charCodeAt(pos); - while (pos < end) { - ch = text.charCodeAt(pos); - if (isWhiteSpaceSingleLine(ch)) { - pos++; - } - else { - break; - } - } tokenPos = pos; + var ch = text.charCodeAt(pos); switch (ch) { + case 9 /* tab */: + case 11 /* verticalTab */: + case 12 /* formFeed */: + case 32 /* space */: + while (pos < end && isWhiteSpaceSingleLine(text.charCodeAt(pos))) { + pos++; + } + return token = 5 /* WhitespaceTrivia */; case 64 /* at */: - return pos += 1, token = 55 /* AtToken */; + pos++; + return token = 56 /* AtToken */; case 10 /* lineFeed */: case 13 /* carriageReturn */: - return pos += 1, token = 4 /* NewLineTrivia */; + pos++; + return token = 4 /* NewLineTrivia */; case 42 /* asterisk */: - return pos += 1, token = 37 /* AsteriskToken */; + pos++; + return token = 38 /* AsteriskToken */; case 123 /* openBrace */: - return pos += 1, token = 15 /* OpenBraceToken */; + pos++; + return token = 16 /* OpenBraceToken */; case 125 /* closeBrace */: - return pos += 1, token = 16 /* CloseBraceToken */; + pos++; + return token = 17 /* CloseBraceToken */; case 91 /* openBracket */: - return pos += 1, token = 19 /* OpenBracketToken */; + pos++; + return token = 20 /* OpenBracketToken */; case 93 /* closeBracket */: - return pos += 1, token = 20 /* CloseBracketToken */; + pos++; + return token = 21 /* CloseBracketToken */; case 61 /* equals */: - return pos += 1, token = 56 /* EqualsToken */; + pos++; + return token = 57 /* EqualsToken */; case 44 /* comma */: - return pos += 1, token = 24 /* CommaToken */; + pos++; + return token = 25 /* CommaToken */; + case 46 /* dot */: + pos++; + return token = 22 /* DotToken */; } - if (isIdentifierStart(ch, 2 /* Latest */)) { + if (isIdentifierStart(ch, 5 /* Latest */)) { pos++; - while (isIdentifierPart(text.charCodeAt(pos), 2 /* Latest */) && pos < end) { + while (isIdentifierPart(text.charCodeAt(pos), 5 /* Latest */) && pos < end) { pos++; } - return token = 69 /* Identifier */; + return token = 70 /* Identifier */; } else { return pos += 1, token = 0 /* Unknown */; @@ -5330,6 +6398,7 @@ var ts; /* @internal */ var ts; (function (ts) { + ts.externalHelpersModuleNameText = "tslib"; function getDeclarationOfKind(symbol, kind) { var declarations = symbol.declarations; if (declarations) { @@ -5357,15 +6426,16 @@ var ts; writeSpace: writeText, writeStringLiteral: writeText, writeParameter: writeText, + writeProperty: writeText, writeSymbol: writeText, // Completely ignore indentation for string writers. And map newlines to // a single space. writeLine: function () { return str_1 += " "; }, - increaseIndent: function () { }, - decreaseIndent: function () { }, + increaseIndent: ts.noop, + decreaseIndent: ts.noop, clear: function () { return str_1 = ""; }, - trackSymbol: function () { }, - reportInaccessibleThisError: function () { } + trackSymbol: ts.noop, + reportInaccessibleThisError: ts.noop }; } return stringWriters.pop(); @@ -5380,24 +6450,8 @@ var ts; return node.end - node.pos; } ts.getFullWidth = getFullWidth; - function arrayIsEqualTo(array1, array2, equaler) { - if (!array1 || !array2) { - return array1 === array2; - } - if (array1.length !== array2.length) { - return false; - } - for (var i = 0; i < array1.length; i++) { - var equals = equaler ? equaler(array1[i], array2[i]) : array1[i] === array2[i]; - if (!equals) { - return false; - } - } - return true; - } - ts.arrayIsEqualTo = arrayIsEqualTo; function hasResolvedModule(sourceFile, moduleNameText) { - return !!(sourceFile.resolvedModules && sourceFile.resolvedModules[moduleNameText]); + return !!(sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules[moduleNameText]); } ts.hasResolvedModule = hasResolvedModule; function getResolvedModule(sourceFile, moduleNameText) { @@ -5420,7 +6474,9 @@ var ts; ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective; /* @internal */ function moduleResolutionIsEqualTo(oldResolution, newResolution) { - return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.isExternalLibraryImport === newResolution.isExternalLibraryImport; + return oldResolution.isExternalLibraryImport === newResolution.isExternalLibraryImport && + oldResolution.extension === newResolution.extension && + oldResolution.resolvedFileName === newResolution.resolvedFileName; } ts.moduleResolutionIsEqualTo = moduleResolutionIsEqualTo; /* @internal */ @@ -5449,28 +6505,28 @@ var ts; // Returns true if this node contains a parse error anywhere underneath it. function containsParseError(node) { aggregateChildData(node); - return (node.flags & 268435456 /* ThisNodeOrAnySubNodesHasError */) !== 0; + return (node.flags & 131072 /* ThisNodeOrAnySubNodesHasError */) !== 0; } ts.containsParseError = containsParseError; function aggregateChildData(node) { - if (!(node.flags & 536870912 /* HasAggregatedChildData */)) { + if (!(node.flags & 262144 /* HasAggregatedChildData */)) { // A node is considered to contain a parse error if: // a) the parser explicitly marked that it had an error // b) any of it's children reported that it had an error. - var thisNodeOrAnySubNodesHasError = ((node.flags & 67108864 /* ThisNodeHasError */) !== 0) || + var thisNodeOrAnySubNodesHasError = ((node.flags & 32768 /* ThisNodeHasError */) !== 0) || ts.forEachChild(node, containsParseError); // If so, mark ourselves accordingly. if (thisNodeOrAnySubNodesHasError) { - node.flags |= 268435456 /* ThisNodeOrAnySubNodesHasError */; + node.flags |= 131072 /* ThisNodeOrAnySubNodesHasError */; } // Also mark that we've propagated the child information to this node. This way we can // always consult the bit directly on this node without needing to check its children // again. - node.flags |= 536870912 /* HasAggregatedChildData */; + node.flags |= 262144 /* HasAggregatedChildData */; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 256 /* SourceFile */) { + while (node && node.kind !== 261 /* SourceFile */) { node = node.parent; } return node; @@ -5478,11 +6534,11 @@ var ts; ts.getSourceFileOfNode = getSourceFileOfNode; function isStatementWithLocals(node) { switch (node.kind) { - case 199 /* Block */: - case 227 /* CaseBlock */: - case 206 /* ForStatement */: - case 207 /* ForInStatement */: - case 208 /* ForOfStatement */: + case 204 /* Block */: + case 232 /* CaseBlock */: + case 211 /* ForStatement */: + case 212 /* ForInStatement */: + case 213 /* ForOfStatement */: return true; } return false; @@ -5504,6 +6560,10 @@ var ts; return node.pos; } ts.getStartPosOfNode = getStartPosOfNode; + function isDefined(value) { + return value !== undefined; + } + ts.isDefined = isDefined; function getEndLinePosition(line, sourceFile) { ts.Debug.assert(line >= 0); var lineStarts = ts.getLineStarts(sourceFile); @@ -5543,7 +6603,7 @@ var ts; // However, this node will be 'missing' in the sense that no actual source-code/tokens are // contained within it. function nodeIsMissing(node) { - if (!node) { + if (node === undefined) { return true; } return node.pos === node.end && node.pos >= 0 && node.kind !== 1 /* EndOfFileToken */; @@ -5553,7 +6613,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)) { @@ -5562,25 +6622,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 === 286 /* 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 >= 257 /* FirstJSDocNode */ && node.kind <= 282 /* LastJSDocNode */; + return node.kind >= 262 /* FirstJSDocNode */ && node.kind <= 288 /* LastJSDocNode */; } ts.isJSDocNode = isJSDocNode; function isJSDocTag(node) { - return node.kind >= 273 /* FirstJSDocTagNode */ && node.kind <= 285 /* LastJSDocTagNode */; + return node.kind >= 278 /* FirstJSDocTagNode */ && node.kind <= 291 /* LastJSDocTagNode */; } ts.isJSDocTag = isJSDocTag; function getNonDecoratorTokenPosOfNode(node, sourceFile) { @@ -5611,6 +6671,56 @@ var ts; return getSourceTextOfNodeFromSourceFile(getSourceFileOfNode(node), node, includeTrivia); } ts.getTextOfNode = getTextOfNode; + function getLiteralText(node, sourceFile, languageVersion) { + // Any template literal or string literal with an extended escape + // (e.g. "\u{0067}") will need to be downleveled as a escaped string literal. + if (languageVersion < 2 /* ES2015 */ && (isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) { + return getQuotedEscapedLiteralText('"', node.text, '"'); + } + // If we don't need to downlevel and we can reach the original source text using + // the node's parent reference, then simply get the text as it was originally written. + if (!nodeIsSynthesized(node) && node.parent) { + var text = getSourceTextOfNodeFromSourceFile(sourceFile, node); + if (languageVersion < 2 /* ES2015 */ && isBinaryOrOctalIntegerLiteral(node, text)) { + return node.text; + } + return text; + } + // If we can't reach the original source text, use the canonical form if it's a number, + // or an escaped quoted form of the original text if it's string-like. + switch (node.kind) { + case 9 /* StringLiteral */: + return getQuotedEscapedLiteralText('"', node.text, '"'); + case 12 /* NoSubstitutionTemplateLiteral */: + return getQuotedEscapedLiteralText("`", node.text, "`"); + case 13 /* TemplateHead */: + return getQuotedEscapedLiteralText("`", node.text, "${"); + case 14 /* TemplateMiddle */: + return getQuotedEscapedLiteralText("}", node.text, "${"); + case 15 /* TemplateTail */: + return getQuotedEscapedLiteralText("}", node.text, "`"); + case 8 /* NumericLiteral */: + return node.text; + } + ts.Debug.fail("Literal kind '" + node.kind + "' not accounted for."); + } + ts.getLiteralText = getLiteralText; + function isBinaryOrOctalIntegerLiteral(node, text) { + if (node.kind === 8 /* NumericLiteral */ && text.length > 1) { + switch (text.charCodeAt(1)) { + case 98 /* b */: + case 66 /* B */: + case 111 /* o */: + case 79 /* O */: + return true; + } + } + return false; + } + ts.isBinaryOrOctalIntegerLiteral = isBinaryOrOctalIntegerLiteral; + function getQuotedEscapedLiteralText(leftQuote, text, rightQuote) { + return leftQuote + escapeNonAsciiCharacters(escapeString(text)) + rightQuote; + } // Add an extra underscore to identifiers that start with two underscores to avoid issues with magic names like '__proto__' function escapeIdentifier(identifier) { return identifier.length >= 2 && identifier.charCodeAt(0) === 95 /* _ */ && identifier.charCodeAt(1) === 95 /* _ */ ? "_" + identifier : identifier; @@ -5628,32 +6738,37 @@ var ts; } ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName; function isBlockOrCatchScoped(declaration) { - return (getCombinedNodeFlags(declaration) & 3072 /* BlockScoped */) !== 0 || - isCatchClauseVariableDeclaration(declaration); + return (ts.getCombinedNodeFlags(declaration) & 3 /* BlockScoped */) !== 0 || + isCatchClauseVariableDeclarationOrBindingElement(declaration); } ts.isBlockOrCatchScoped = isBlockOrCatchScoped; + function isCatchClauseVariableDeclarationOrBindingElement(declaration) { + var node = getRootDeclaration(declaration); + return node.kind === 223 /* VariableDeclaration */ && node.parent.kind === 256 /* CatchClause */; + } + ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { - return node && node.kind === 225 /* ModuleDeclaration */ && + return node && node.kind === 230 /* ModuleDeclaration */ && (node.name.kind === 9 /* StringLiteral */ || isGlobalScopeAugmentation(node)); } ts.isAmbientModule = isAmbientModule; + /** Given a symbol for a module, checks that it is either an untyped import or a shorthand ambient module. */ function isShorthandAmbientModuleSymbol(moduleSymbol) { return isShorthandAmbientModule(moduleSymbol.valueDeclaration); } ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; function isShorthandAmbientModule(node) { // The only kind of module that can be missing a body is a shorthand ambient module. - return node.kind === 225 /* ModuleDeclaration */ && (!node.body); + return node.kind === 230 /* ModuleDeclaration */ && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 256 /* SourceFile */ || - node.kind === 225 /* ModuleDeclaration */ || - isFunctionLike(node) || - isFunctionBlock(node); + return node.kind === 261 /* SourceFile */ || + node.kind === 230 /* ModuleDeclaration */ || + isFunctionLike(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; function isGlobalScopeAugmentation(module) { - return !!(module.flags & 131072 /* GlobalAugmentation */); + return !!(module.flags & 512 /* GlobalAugmentation */); } ts.isGlobalScopeAugmentation = isGlobalScopeAugmentation; function isExternalModuleAugmentation(node) { @@ -5664,49 +6779,55 @@ var ts; return false; } switch (node.parent.kind) { - case 256 /* SourceFile */: + case 261 /* SourceFile */: return ts.isExternalModule(node.parent); - case 226 /* ModuleBlock */: + case 231 /* ModuleBlock */: return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; } ts.isExternalModuleAugmentation = isExternalModuleAugmentation; + function isEffectiveExternalModule(node, compilerOptions) { + return ts.isExternalModule(node) || compilerOptions.isolatedModules; + } + ts.isEffectiveExternalModule = isEffectiveExternalModule; + function isBlockScope(node, parentNode) { + switch (node.kind) { + case 261 /* SourceFile */: + case 232 /* CaseBlock */: + case 256 /* CatchClause */: + case 230 /* ModuleDeclaration */: + case 211 /* ForStatement */: + case 212 /* ForInStatement */: + case 213 /* ForOfStatement */: + case 150 /* Constructor */: + case 149 /* MethodDeclaration */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + case 225 /* FunctionDeclaration */: + case 184 /* FunctionExpression */: + case 185 /* ArrowFunction */: + return true; + case 204 /* Block */: + // function block is not considered block-scope container + // see comment in binder.ts: bind(...), case for SyntaxKind.Block + return parentNode && !isFunctionLike(parentNode); + } + return false; + } + ts.isBlockScope = isBlockScope; // Gets the nearest enclosing block scope container that has the provided node // as a descendant, that is not the provided node. function getEnclosingBlockScopeContainer(node) { var current = node.parent; while (current) { - if (isFunctionLike(current)) { + if (isBlockScope(current, current.parent)) { return current; } - switch (current.kind) { - case 256 /* SourceFile */: - case 227 /* CaseBlock */: - case 252 /* CatchClause */: - case 225 /* ModuleDeclaration */: - case 206 /* ForStatement */: - case 207 /* ForInStatement */: - case 208 /* ForOfStatement */: - return current; - case 199 /* Block */: - // function block is not considered block-scope container - // see comment in binder.ts: bind(...), case for SyntaxKind.Block - if (!isFunctionLike(current.parent)) { - return current; - } - } current = current.parent; } } ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; - function isCatchClauseVariableDeclaration(declaration) { - return declaration && - declaration.kind === 218 /* VariableDeclaration */ && - declaration.parent && - declaration.parent.kind === 252 /* CatchClause */; - } - ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; // Return display name of an identifier // Computed property names will just be emitted as "[]", where is the source // text of the expression in the computed property. @@ -5714,12 +6835,42 @@ var ts; return getFullWidth(name) === 0 ? "(Missing)" : getTextOfNode(name); } ts.declarationNameToString = declarationNameToString; + function getTextOfPropertyName(name) { + switch (name.kind) { + case 70 /* Identifier */: + return name.text; + case 9 /* StringLiteral */: + case 8 /* NumericLiteral */: + return name.text; + case 142 /* ComputedPropertyName */: + if (isStringOrNumericLiteral(name.expression)) { + return name.expression.text; + } + } + return undefined; + } + ts.getTextOfPropertyName = getTextOfPropertyName; + function entityNameToString(name) { + switch (name.kind) { + case 70 /* Identifier */: + return getFullWidth(name) === 0 ? unescapeIdentifier(name.text) : getTextOfNode(name); + case 141 /* QualifiedName */: + return entityNameToString(name.left) + "." + entityNameToString(name.right); + case 177 /* PropertyAccessExpression */: + return entityNameToString(name.expression) + "." + entityNameToString(name.name); + } + } + ts.entityNameToString = entityNameToString; function createDiagnosticForNode(node, message, arg0, arg1, arg2) { var sourceFile = getSourceFileOfNode(node); + return createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2); + } + ts.createDiagnosticForNode = createDiagnosticForNode; + function createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2) { var span = getErrorSpanForNode(sourceFile, node); return ts.createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2); } - ts.createDiagnosticForNode = createDiagnosticForNode; + ts.createDiagnosticForNodeInSourceFile = createDiagnosticForNodeInSourceFile; function createDiagnosticForNodeFromMessageChain(node, messageChain) { var sourceFile = getSourceFileOfNode(node); var span = getErrorSpanForNode(sourceFile, node); @@ -5742,7 +6893,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 199 /* Block */) { + if (node.body && node.body.kind === 204 /* Block */) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -5756,7 +6907,7 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 256 /* SourceFile */: + case 261 /* SourceFile */: var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false); if (pos_1 === sourceFile.text.length) { // file is empty - return span for the beginning of the file @@ -5765,23 +6916,23 @@ var ts; return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. - case 218 /* VariableDeclaration */: - case 169 /* BindingElement */: - case 221 /* ClassDeclaration */: - case 192 /* ClassExpression */: - case 222 /* InterfaceDeclaration */: - case 225 /* ModuleDeclaration */: - case 224 /* EnumDeclaration */: - case 255 /* EnumMember */: - case 220 /* FunctionDeclaration */: - case 179 /* FunctionExpression */: - case 147 /* MethodDeclaration */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - case 223 /* TypeAliasDeclaration */: + case 223 /* VariableDeclaration */: + case 174 /* BindingElement */: + case 226 /* ClassDeclaration */: + case 197 /* ClassExpression */: + case 227 /* InterfaceDeclaration */: + case 230 /* ModuleDeclaration */: + case 229 /* EnumDeclaration */: + case 260 /* EnumMember */: + case 225 /* FunctionDeclaration */: + case 184 /* FunctionExpression */: + case 149 /* MethodDeclaration */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + case 228 /* TypeAliasDeclaration */: errorNode = node.name; break; - case 180 /* ArrowFunction */: + case 185 /* ArrowFunction */: return getErrorSpanForArrowFunction(sourceFile, node); } if (errorNode === undefined) { @@ -5804,52 +6955,25 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 224 /* EnumDeclaration */ && isConst(node); + return node.kind === 229 /* EnumDeclaration */ && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; - function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 169 /* BindingElement */ || isBindingPattern(node))) { - node = node.parent; - } - return node; - } - // Returns the node flags for this node and all relevant parent nodes. This is done so that - // nodes like variable declarations and binding elements can returned a view of their flags - // that includes the modifiers from their container. i.e. flags like export/declare aren't - // stored on the variable declaration directly, but on the containing variable statement - // (if it has one). Similarly, flags for let/const are store on the variable declaration - // list. By calling this function, all those flags are combined so that the client can treat - // the node as if it actually had those flags. - function getCombinedNodeFlags(node) { - node = walkUpBindingElementsAndPatterns(node); - var flags = node.flags; - if (node.kind === 218 /* VariableDeclaration */) { - node = node.parent; - } - if (node && node.kind === 219 /* VariableDeclarationList */) { - flags |= node.flags; - node = node.parent; - } - if (node && node.kind === 200 /* VariableStatement */) { - flags |= node.flags; - } - return flags; - } - ts.getCombinedNodeFlags = getCombinedNodeFlags; function isConst(node) { - return !!(getCombinedNodeFlags(node) & 2048 /* Const */); + return !!(ts.getCombinedNodeFlags(node) & 2 /* Const */) + || !!(ts.getCombinedModifierFlags(node) & 2048 /* Const */); } ts.isConst = isConst; function isLet(node) { - return !!(getCombinedNodeFlags(node) & 1024 /* Let */); + return !!(ts.getCombinedNodeFlags(node) & 1 /* Let */); } ts.isLet = isLet; - function isSuperCallExpression(n) { - return n.kind === 174 /* CallExpression */ && n.expression.kind === 95 /* SuperKeyword */; + function isSuperCall(n) { + return n.kind === 179 /* CallExpression */ && n.expression.kind === 96 /* SuperKeyword */; } - ts.isSuperCallExpression = isSuperCallExpression; + ts.isSuperCall = isSuperCall; function isPrologueDirective(node) { - return node.kind === 202 /* ExpressionStatement */ && node.expression.kind === 9 /* StringLiteral */; + return node.kind === 207 /* ExpressionStatement */ + && node.expression.kind === 9 /* StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { @@ -5860,133 +6984,142 @@ 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) { - var commentRanges = (node.kind === 142 /* Parameter */ || - node.kind === 141 /* TypeParameter */ || - node.kind === 179 /* FunctionExpression */ || - node.kind === 180 /* ArrowFunction */) ? + 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*/; ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; - function isTypeNode(node) { - if (154 /* FirstTypeNode */ <= node.kind && node.kind <= 166 /* LastTypeNode */) { + function isPartOfTypeNode(node) { + if (156 /* FirstTypeNode */ <= node.kind && node.kind <= 171 /* LastTypeNode */) { return true; } switch (node.kind) { - case 117 /* AnyKeyword */: - case 130 /* NumberKeyword */: - case 132 /* StringKeyword */: - case 120 /* BooleanKeyword */: - case 133 /* SymbolKeyword */: - case 135 /* UndefinedKeyword */: - case 127 /* NeverKeyword */: + case 118 /* AnyKeyword */: + case 132 /* NumberKeyword */: + case 134 /* StringKeyword */: + case 121 /* BooleanKeyword */: + case 135 /* SymbolKeyword */: + case 137 /* UndefinedKeyword */: + case 129 /* NeverKeyword */: return true; - case 103 /* VoidKeyword */: - return node.parent.kind !== 183 /* VoidExpression */; - case 194 /* ExpressionWithTypeArguments */: + case 104 /* VoidKeyword */: + return node.parent.kind !== 188 /* VoidExpression */; + case 199 /* ExpressionWithTypeArguments */: return !isExpressionWithTypeArgumentsInClassExtendsClause(node); // Identifiers and qualified names may be type nodes, depending on their context. Climb // above them to find the lowest container - case 69 /* Identifier */: + case 70 /* Identifier */: // If the identifier is the RHS of a qualified name, then it's a type iff its parent is. - if (node.parent.kind === 139 /* QualifiedName */ && node.parent.right === node) { + if (node.parent.kind === 141 /* QualifiedName */ && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 172 /* PropertyAccessExpression */ && node.parent.name === node) { + else if (node.parent.kind === 177 /* PropertyAccessExpression */ && node.parent.name === node) { node = node.parent; } // At this point, node is either a qualified name or an identifier - ts.Debug.assert(node.kind === 69 /* Identifier */ || node.kind === 139 /* QualifiedName */ || node.kind === 172 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); - case 139 /* QualifiedName */: - case 172 /* PropertyAccessExpression */: - case 97 /* ThisKeyword */: + ts.Debug.assert(node.kind === 70 /* Identifier */ || node.kind === 141 /* QualifiedName */ || node.kind === 177 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); + case 141 /* QualifiedName */: + case 177 /* PropertyAccessExpression */: + case 98 /* ThisKeyword */: var parent_1 = node.parent; - if (parent_1.kind === 158 /* TypeQuery */) { + if (parent_1.kind === 160 /* TypeQuery */) { return false; } - // Do not recursively call isTypeNode on the parent. In the example: + // Do not recursively call isPartOfTypeNode on the parent. In the example: // // let a: A.B.C; // - // Calling isTypeNode would consider the qualified name A.B a type node. Only C or + // Calling isPartOfTypeNode would consider the qualified name A.B a type node. Only C or // A.B.C is a type node. - if (154 /* FirstTypeNode */ <= parent_1.kind && parent_1.kind <= 166 /* LastTypeNode */) { + if (156 /* FirstTypeNode */ <= parent_1.kind && parent_1.kind <= 171 /* LastTypeNode */) { return true; } switch (parent_1.kind) { - case 194 /* ExpressionWithTypeArguments */: + case 199 /* ExpressionWithTypeArguments */: return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1); - case 141 /* TypeParameter */: + case 143 /* TypeParameter */: return node === parent_1.constraint; - case 145 /* PropertyDeclaration */: - case 144 /* PropertySignature */: - case 142 /* Parameter */: - case 218 /* VariableDeclaration */: + case 147 /* PropertyDeclaration */: + case 146 /* PropertySignature */: + case 144 /* Parameter */: + case 223 /* VariableDeclaration */: return node === parent_1.type; - case 220 /* FunctionDeclaration */: - case 179 /* FunctionExpression */: - case 180 /* ArrowFunction */: - case 148 /* Constructor */: - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: + case 225 /* FunctionDeclaration */: + case 184 /* FunctionExpression */: + case 185 /* ArrowFunction */: + case 150 /* Constructor */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: return node === parent_1.type; - case 151 /* CallSignature */: - case 152 /* ConstructSignature */: - case 153 /* IndexSignature */: + case 153 /* CallSignature */: + case 154 /* ConstructSignature */: + case 155 /* IndexSignature */: return node === parent_1.type; - case 177 /* TypeAssertionExpression */: + case 182 /* TypeAssertionExpression */: return node === parent_1.type; - case 174 /* CallExpression */: - case 175 /* NewExpression */: + case 179 /* CallExpression */: + case 180 /* NewExpression */: return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; - case 176 /* TaggedTemplateExpression */: + case 181 /* TaggedTemplateExpression */: // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments. return false; } } return false; } - ts.isTypeNode = isTypeNode; + ts.isPartOfTypeNode = isPartOfTypeNode; + function isChildOfLiteralType(node) { + while (node) { + if (node.kind === 171 /* LiteralType */) { + return true; + } + node = node.parent; + } + return false; + } + ts.isChildOfLiteralType = isChildOfLiteralType; + function isPrefixUnaryExpression(node) { + return node.kind === 190 /* PrefixUnaryExpression */; + } + ts.isPrefixUnaryExpression = isPrefixUnaryExpression; // Warning: This has the same semantics as the forEach family of functions, // in that traversal terminates in the event that 'visitor' supplies a truthy value. function forEachReturnStatement(body, visitor) { return traverse(body); function traverse(node) { switch (node.kind) { - case 211 /* ReturnStatement */: + case 216 /* ReturnStatement */: return visitor(node); - case 227 /* CaseBlock */: - case 199 /* Block */: - case 203 /* IfStatement */: - case 204 /* DoStatement */: - case 205 /* WhileStatement */: - case 206 /* ForStatement */: - case 207 /* ForInStatement */: - case 208 /* ForOfStatement */: - case 212 /* WithStatement */: - case 213 /* SwitchStatement */: - case 249 /* CaseClause */: - case 250 /* DefaultClause */: - case 214 /* LabeledStatement */: - case 216 /* TryStatement */: - case 252 /* CatchClause */: + case 232 /* CaseBlock */: + case 204 /* Block */: + case 208 /* IfStatement */: + case 209 /* DoStatement */: + case 210 /* WhileStatement */: + case 211 /* ForStatement */: + case 212 /* ForInStatement */: + case 213 /* ForOfStatement */: + case 217 /* WithStatement */: + case 218 /* SwitchStatement */: + case 253 /* CaseClause */: + case 254 /* DefaultClause */: + case 219 /* LabeledStatement */: + case 221 /* TryStatement */: + case 256 /* CatchClause */: return ts.forEachChild(node, traverse); } } @@ -5996,18 +7129,18 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 190 /* YieldExpression */: + case 195 /* YieldExpression */: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } - case 224 /* EnumDeclaration */: - case 222 /* InterfaceDeclaration */: - case 225 /* ModuleDeclaration */: - case 223 /* TypeAliasDeclaration */: - case 221 /* ClassDeclaration */: - case 192 /* ClassExpression */: + case 229 /* EnumDeclaration */: + case 227 /* InterfaceDeclaration */: + case 230 /* ModuleDeclaration */: + case 228 /* TypeAliasDeclaration */: + case 226 /* ClassDeclaration */: + case 197 /* ClassExpression */: // These are not allowed inside a generator now, but eventually they may be allowed // as local types. Regardless, any yield statements contained within them should be // skipped in this traversal. @@ -6015,14 +7148,14 @@ var ts; default: if (isFunctionLike(node)) { var name_5 = node.name; - if (name_5 && name_5.kind === 140 /* ComputedPropertyName */) { + if (name_5 && name_5.kind === 142 /* ComputedPropertyName */) { // Note that we will not include methods/accessors of a class because they would require // first descending into the class. This is by design. traverse(name_5.expression); return; } } - else if (!isTypeNode(node)) { + else if (!isPartOfTypeNode(node)) { // This is the general case, which should include mostly expressions and statements. // Also includes NodeArrays. ts.forEachChild(node, traverse); @@ -6031,17 +7164,35 @@ var ts; } } ts.forEachYieldExpression = forEachYieldExpression; + /** + * Gets the most likely element type for a TypeNode. This is not an exhaustive test + * as it assumes a rest argument can only be an array type (either T[], or Array). + * + * @param node The type node. + */ + function getRestParameterElementType(node) { + if (node && node.kind === 162 /* ArrayType */) { + return node.elementType; + } + else if (node && node.kind === 157 /* TypeReference */) { + return ts.singleOrUndefined(node.typeArguments); + } + else { + return undefined; + } + } + ts.getRestParameterElementType = getRestParameterElementType; function isVariableLike(node) { if (node) { switch (node.kind) { - case 169 /* BindingElement */: - case 255 /* EnumMember */: - case 142 /* Parameter */: - case 253 /* PropertyAssignment */: - case 145 /* PropertyDeclaration */: - case 144 /* PropertySignature */: - case 254 /* ShorthandPropertyAssignment */: - case 218 /* VariableDeclaration */: + case 174 /* BindingElement */: + case 260 /* EnumMember */: + case 144 /* Parameter */: + case 257 /* PropertyAssignment */: + case 147 /* PropertyDeclaration */: + case 146 /* PropertySignature */: + case 258 /* ShorthandPropertyAssignment */: + case 223 /* VariableDeclaration */: return true; } } @@ -6049,11 +7200,11 @@ var ts; } ts.isVariableLike = isVariableLike; function isAccessor(node) { - return node && (node.kind === 149 /* GetAccessor */ || node.kind === 150 /* SetAccessor */); + return node && (node.kind === 151 /* GetAccessor */ || node.kind === 152 /* SetAccessor */); } ts.isAccessor = isAccessor; function isClassLike(node) { - return node && (node.kind === 221 /* ClassDeclaration */ || node.kind === 192 /* ClassExpression */); + return node && (node.kind === 226 /* ClassDeclaration */ || node.kind === 197 /* ClassExpression */); } ts.isClassLike = isClassLike; function isFunctionLike(node) { @@ -6062,19 +7213,19 @@ var ts; ts.isFunctionLike = isFunctionLike; function isFunctionLikeKind(kind) { switch (kind) { - case 148 /* Constructor */: - case 179 /* FunctionExpression */: - case 220 /* FunctionDeclaration */: - case 180 /* ArrowFunction */: - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - case 151 /* CallSignature */: - case 152 /* ConstructSignature */: - case 153 /* IndexSignature */: - case 156 /* FunctionType */: - case 157 /* ConstructorType */: + case 150 /* Constructor */: + case 184 /* FunctionExpression */: + case 225 /* FunctionDeclaration */: + case 185 /* ArrowFunction */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + case 153 /* CallSignature */: + case 154 /* ConstructSignature */: + case 155 /* IndexSignature */: + case 158 /* FunctionType */: + case 159 /* ConstructorType */: return true; } return false; @@ -6082,13 +7233,13 @@ var ts; ts.isFunctionLikeKind = isFunctionLikeKind; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - case 148 /* Constructor */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - case 220 /* FunctionDeclaration */: - case 179 /* FunctionExpression */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + case 150 /* Constructor */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + case 225 /* FunctionDeclaration */: + case 184 /* FunctionExpression */: return true; } return false; @@ -6096,26 +7247,32 @@ var ts; ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 206 /* ForStatement */: - case 207 /* ForInStatement */: - case 208 /* ForOfStatement */: - case 204 /* DoStatement */: - case 205 /* WhileStatement */: + case 211 /* ForStatement */: + case 212 /* ForInStatement */: + case 213 /* ForOfStatement */: + case 209 /* DoStatement */: + case 210 /* WhileStatement */: return true; - case 214 /* LabeledStatement */: + case 219 /* LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; } ts.isIterationStatement = isIterationStatement; function isFunctionBlock(node) { - return node && node.kind === 199 /* Block */ && isFunctionLike(node.parent); + return node && node.kind === 204 /* Block */ && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 147 /* MethodDeclaration */ && node.parent.kind === 171 /* ObjectLiteralExpression */; + return node && node.kind === 149 /* MethodDeclaration */ && node.parent.kind === 176 /* ObjectLiteralExpression */; } ts.isObjectLiteralMethod = isObjectLiteralMethod; + function isObjectLiteralOrClassExpressionMethod(node) { + return node.kind === 149 /* MethodDeclaration */ && + (node.parent.kind === 176 /* ObjectLiteralExpression */ || + node.parent.kind === 197 /* ClassExpression */); + } + ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod; function isIdentifierTypePredicate(predicate) { return predicate && predicate.kind === 1 /* Identifier */; } @@ -6149,7 +7306,7 @@ var ts; return undefined; } switch (node.kind) { - case 140 /* ComputedPropertyName */: + case 142 /* ComputedPropertyName */: // If the grandparent node is an object literal (as opposed to a class), // then the computed property is not a 'this' container. // A computed property name in a class needs to be a this container @@ -6164,9 +7321,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 143 /* Decorator */: + case 145 /* Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 142 /* Parameter */ && isClassElement(node.parent.parent)) { + if (node.parent.kind === 144 /* Parameter */ && isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -6177,37 +7334,37 @@ var ts; node = node.parent; } break; - case 180 /* ArrowFunction */: + case 185 /* ArrowFunction */: if (!includeArrowFunctions) { continue; } // Fall through - case 220 /* FunctionDeclaration */: - case 179 /* FunctionExpression */: - case 225 /* ModuleDeclaration */: - case 145 /* PropertyDeclaration */: - case 144 /* PropertySignature */: - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - case 148 /* Constructor */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - case 151 /* CallSignature */: - case 152 /* ConstructSignature */: - case 153 /* IndexSignature */: - case 224 /* EnumDeclaration */: - case 256 /* SourceFile */: + case 225 /* FunctionDeclaration */: + case 184 /* FunctionExpression */: + case 230 /* ModuleDeclaration */: + case 147 /* PropertyDeclaration */: + case 146 /* PropertySignature */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + case 150 /* Constructor */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + case 153 /* CallSignature */: + case 154 /* ConstructSignature */: + case 155 /* IndexSignature */: + case 229 /* EnumDeclaration */: + case 261 /* SourceFile */: return node; } } } ts.getThisContainer = getThisContainer; /** - * Given an super call\property node returns a closest node where either - * - super call\property is legal in the node and not legal in the parent node the node. + * Given an super call/property node, returns the closest node where + * - a super call/property access is legal in the node and not legal in the parent node the node. * i.e. super call is legal in constructor but not legal in the class body. - * - node is arrow function (so caller might need to call getSuperContainer in case it needs to climb higher) - * - super call\property is definitely illegal in the node (but might be legal in some subnode) + * - the container is an arrow function (so caller might need to call getSuperContainer again in case it needs to climb higher) + * - a super call/property is definitely illegal in the container (but might be legal in some subnode) * i.e. super property access is illegal in function declaration but can be legal in the statement list */ function getSuperContainer(node, stopOnFunctions) { @@ -6217,26 +7374,26 @@ var ts; return node; } switch (node.kind) { - case 140 /* ComputedPropertyName */: + case 142 /* ComputedPropertyName */: node = node.parent; break; - case 220 /* FunctionDeclaration */: - case 179 /* FunctionExpression */: - case 180 /* ArrowFunction */: + case 225 /* FunctionDeclaration */: + case 184 /* FunctionExpression */: + case 185 /* ArrowFunction */: if (!stopOnFunctions) { continue; } - case 145 /* PropertyDeclaration */: - case 144 /* PropertySignature */: - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - case 148 /* Constructor */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: + case 147 /* PropertyDeclaration */: + case 146 /* PropertySignature */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + case 150 /* Constructor */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: return node; - case 143 /* Decorator */: + case 145 /* Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 142 /* Parameter */ && isClassElement(node.parent.parent)) { + if (node.parent.kind === 144 /* Parameter */ && isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -6252,14 +7409,14 @@ var ts; } ts.getSuperContainer = getSuperContainer; function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 179 /* FunctionExpression */ || func.kind === 180 /* ArrowFunction */) { + if (func.kind === 184 /* FunctionExpression */ || func.kind === 185 /* ArrowFunction */) { var prev = func; var parent_2 = func.parent; - while (parent_2.kind === 178 /* ParenthesizedExpression */) { + while (parent_2.kind === 183 /* ParenthesizedExpression */) { prev = parent_2; parent_2 = parent_2.parent; } - if (parent_2.kind === 174 /* CallExpression */ && parent_2.expression === prev) { + if (parent_2.kind === 179 /* CallExpression */ && parent_2.expression === prev) { return parent_2; } } @@ -6268,30 +7425,42 @@ var ts; /** * Determines whether a node is a property or element access expression for super. */ - function isSuperPropertyOrElementAccess(node) { - return (node.kind === 172 /* PropertyAccessExpression */ - || node.kind === 173 /* ElementAccessExpression */) - && node.expression.kind === 95 /* SuperKeyword */; + function isSuperProperty(node) { + var kind = node.kind; + return (kind === 177 /* PropertyAccessExpression */ || kind === 178 /* ElementAccessExpression */) + && node.expression.kind === 96 /* SuperKeyword */; } - ts.isSuperPropertyOrElementAccess = isSuperPropertyOrElementAccess; + ts.isSuperProperty = isSuperProperty; function getEntityNameFromTypeNode(node) { - if (node) { - switch (node.kind) { - case 155 /* TypeReference */: - return node.typeName; - case 194 /* ExpressionWithTypeArguments */: - ts.Debug.assert(isEntityNameExpression(node.expression)); - return node.expression; - case 69 /* Identifier */: - case 139 /* QualifiedName */: - return node; - } + switch (node.kind) { + case 157 /* TypeReference */: + case 272 /* JSDocTypeReference */: + return node.typeName; + case 199 /* ExpressionWithTypeArguments */: + return isEntityNameExpression(node.expression) + ? node.expression + : undefined; + case 70 /* Identifier */: + case 141 /* QualifiedName */: + return node; } return undefined; } ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; + function isCallLikeExpression(node) { + switch (node.kind) { + case 179 /* CallExpression */: + case 180 /* NewExpression */: + case 181 /* TaggedTemplateExpression */: + case 145 /* Decorator */: + return true; + default: + return false; + } + } + ts.isCallLikeExpression = isCallLikeExpression; function getInvokedExpression(node) { - if (node.kind === 176 /* TaggedTemplateExpression */) { + if (node.kind === 181 /* TaggedTemplateExpression */) { return node.tag; } // Will either be a CallExpression, NewExpression, or Decorator. @@ -6300,25 +7469,25 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 221 /* ClassDeclaration */: + case 226 /* ClassDeclaration */: // classes are valid targets return true; - case 145 /* PropertyDeclaration */: + case 147 /* PropertyDeclaration */: // property declarations are valid if their parent is a class declaration. - return node.parent.kind === 221 /* ClassDeclaration */; - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - case 147 /* MethodDeclaration */: + return node.parent.kind === 226 /* ClassDeclaration */; + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + case 149 /* MethodDeclaration */: // if this method has a body and its parent is a class declaration, this is a valid target. return node.body !== undefined - && node.parent.kind === 221 /* ClassDeclaration */; - case 142 /* Parameter */: + && node.parent.kind === 226 /* ClassDeclaration */; + case 144 /* Parameter */: // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target; return node.parent.body !== undefined - && (node.parent.kind === 148 /* Constructor */ - || node.parent.kind === 147 /* MethodDeclaration */ - || node.parent.kind === 150 /* SetAccessor */) - && node.parent.parent.kind === 221 /* ClassDeclaration */; + && (node.parent.kind === 150 /* Constructor */ + || node.parent.kind === 149 /* MethodDeclaration */ + || node.parent.kind === 152 /* SetAccessor */) + && node.parent.parent.kind === 226 /* ClassDeclaration */; } return false; } @@ -6328,134 +7497,135 @@ var ts; && nodeCanBeDecorated(node); } ts.nodeIsDecorated = nodeIsDecorated; - function isPropertyAccessExpression(node) { - return node.kind === 172 /* PropertyAccessExpression */; + function nodeOrChildIsDecorated(node) { + return nodeIsDecorated(node) || childIsDecorated(node); } - ts.isPropertyAccessExpression = isPropertyAccessExpression; - function isElementAccessExpression(node) { - return node.kind === 173 /* ElementAccessExpression */; + ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; + function childIsDecorated(node) { + switch (node.kind) { + case 226 /* ClassDeclaration */: + return ts.forEach(node.members, nodeOrChildIsDecorated); + case 149 /* MethodDeclaration */: + case 152 /* SetAccessor */: + return ts.forEach(node.parameters, nodeIsDecorated); + } } - ts.isElementAccessExpression = isElementAccessExpression; + ts.childIsDecorated = childIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 243 /* JsxOpeningElement */ || - parent.kind === 242 /* JsxSelfClosingElement */ || - parent.kind === 245 /* JsxClosingElement */) { + if (parent.kind === 248 /* JsxOpeningElement */ || + parent.kind === 247 /* JsxSelfClosingElement */ || + parent.kind === 249 /* JsxClosingElement */) { return parent.tagName === node; } return false; } ts.isJSXTagName = isJSXTagName; - function isExpression(node) { + function isPartOfExpression(node) { switch (node.kind) { - case 97 /* ThisKeyword */: - case 95 /* SuperKeyword */: - case 93 /* NullKeyword */: - case 99 /* TrueKeyword */: - case 84 /* FalseKeyword */: - case 10 /* RegularExpressionLiteral */: - case 170 /* ArrayLiteralExpression */: - case 171 /* ObjectLiteralExpression */: - case 172 /* PropertyAccessExpression */: - case 173 /* ElementAccessExpression */: - case 174 /* CallExpression */: - case 175 /* NewExpression */: - case 176 /* TaggedTemplateExpression */: - case 195 /* AsExpression */: - case 177 /* TypeAssertionExpression */: - case 196 /* NonNullExpression */: - case 178 /* ParenthesizedExpression */: - case 179 /* FunctionExpression */: - case 192 /* ClassExpression */: - case 180 /* ArrowFunction */: - case 183 /* VoidExpression */: - case 181 /* DeleteExpression */: - case 182 /* TypeOfExpression */: - case 185 /* PrefixUnaryExpression */: - case 186 /* PostfixUnaryExpression */: - case 187 /* BinaryExpression */: - case 188 /* ConditionalExpression */: - case 191 /* SpreadElementExpression */: - case 189 /* TemplateExpression */: - case 11 /* NoSubstitutionTemplateLiteral */: - case 193 /* OmittedExpression */: - case 241 /* JsxElement */: - case 242 /* JsxSelfClosingElement */: - case 190 /* YieldExpression */: - case 184 /* AwaitExpression */: + case 98 /* ThisKeyword */: + case 96 /* SuperKeyword */: + case 94 /* NullKeyword */: + case 100 /* TrueKeyword */: + case 85 /* FalseKeyword */: + case 11 /* RegularExpressionLiteral */: + case 175 /* ArrayLiteralExpression */: + case 176 /* ObjectLiteralExpression */: + case 177 /* PropertyAccessExpression */: + case 178 /* ElementAccessExpression */: + case 179 /* CallExpression */: + case 180 /* NewExpression */: + case 181 /* TaggedTemplateExpression */: + case 200 /* AsExpression */: + case 182 /* TypeAssertionExpression */: + case 201 /* NonNullExpression */: + case 183 /* ParenthesizedExpression */: + case 184 /* FunctionExpression */: + case 197 /* ClassExpression */: + case 185 /* ArrowFunction */: + case 188 /* VoidExpression */: + case 186 /* DeleteExpression */: + case 187 /* TypeOfExpression */: + case 190 /* PrefixUnaryExpression */: + case 191 /* PostfixUnaryExpression */: + case 192 /* BinaryExpression */: + case 193 /* ConditionalExpression */: + case 196 /* SpreadElement */: + case 194 /* TemplateExpression */: + case 12 /* NoSubstitutionTemplateLiteral */: + case 198 /* OmittedExpression */: + case 246 /* JsxElement */: + case 247 /* JsxSelfClosingElement */: + case 195 /* YieldExpression */: + case 189 /* AwaitExpression */: return true; - case 139 /* QualifiedName */: - while (node.parent.kind === 139 /* QualifiedName */) { + case 141 /* QualifiedName */: + while (node.parent.kind === 141 /* QualifiedName */) { node = node.parent; } - return node.parent.kind === 158 /* TypeQuery */ || isJSXTagName(node); - case 69 /* Identifier */: - if (node.parent.kind === 158 /* TypeQuery */ || isJSXTagName(node)) { + return node.parent.kind === 160 /* TypeQuery */ || isJSXTagName(node); + case 70 /* Identifier */: + if (node.parent.kind === 160 /* TypeQuery */ || isJSXTagName(node)) { return true; } // fall through case 8 /* NumericLiteral */: case 9 /* StringLiteral */: - case 97 /* ThisKeyword */: + case 98 /* ThisKeyword */: var parent_3 = node.parent; switch (parent_3.kind) { - case 218 /* VariableDeclaration */: - case 142 /* Parameter */: - case 145 /* PropertyDeclaration */: - case 144 /* PropertySignature */: - case 255 /* EnumMember */: - case 253 /* PropertyAssignment */: - case 169 /* BindingElement */: + case 223 /* VariableDeclaration */: + case 144 /* Parameter */: + case 147 /* PropertyDeclaration */: + case 146 /* PropertySignature */: + case 260 /* EnumMember */: + case 257 /* PropertyAssignment */: + case 174 /* BindingElement */: return parent_3.initializer === node; - case 202 /* ExpressionStatement */: - case 203 /* IfStatement */: - case 204 /* DoStatement */: - case 205 /* WhileStatement */: - case 211 /* ReturnStatement */: - case 212 /* WithStatement */: - case 213 /* SwitchStatement */: - case 249 /* CaseClause */: - case 215 /* ThrowStatement */: - case 213 /* SwitchStatement */: + case 207 /* ExpressionStatement */: + case 208 /* IfStatement */: + case 209 /* DoStatement */: + case 210 /* WhileStatement */: + case 216 /* ReturnStatement */: + case 217 /* WithStatement */: + case 218 /* SwitchStatement */: + case 253 /* CaseClause */: + case 220 /* ThrowStatement */: + case 218 /* SwitchStatement */: return parent_3.expression === node; - case 206 /* ForStatement */: + case 211 /* ForStatement */: var forStatement = parent_3; - return (forStatement.initializer === node && forStatement.initializer.kind !== 219 /* VariableDeclarationList */) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 224 /* VariableDeclarationList */) || forStatement.condition === node || forStatement.incrementor === node; - case 207 /* ForInStatement */: - case 208 /* ForOfStatement */: + case 212 /* ForInStatement */: + case 213 /* ForOfStatement */: var forInStatement = parent_3; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 219 /* VariableDeclarationList */) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 224 /* VariableDeclarationList */) || forInStatement.expression === node; - case 177 /* TypeAssertionExpression */: - case 195 /* AsExpression */: + case 182 /* TypeAssertionExpression */: + case 200 /* AsExpression */: return node === parent_3.expression; - case 197 /* TemplateSpan */: + case 202 /* TemplateSpan */: return node === parent_3.expression; - case 140 /* ComputedPropertyName */: + case 142 /* ComputedPropertyName */: return node === parent_3.expression; - case 143 /* Decorator */: - case 248 /* JsxExpression */: - case 247 /* JsxSpreadAttribute */: + case 145 /* Decorator */: + case 252 /* JsxExpression */: + case 251 /* JsxSpreadAttribute */: + case 259 /* SpreadAssignment */: return true; - case 194 /* ExpressionWithTypeArguments */: + case 199 /* ExpressionWithTypeArguments */: return parent_3.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_3); default: - if (isExpression(parent_3)) { + if (isPartOfExpression(parent_3)) { return true; } } } return false; } - ts.isExpression = isExpression; - function isExternalModuleNameRelative(moduleName) { - // TypeScript 1.0 spec (April 2014): 11.2.1 - // An external module name is "relative" if the first term is "." or "..". - return /^\.\.?($|[\\/])/.test(moduleName); - } - ts.isExternalModuleNameRelative = isExternalModuleNameRelative; + ts.isPartOfExpression = isPartOfExpression; function isInstantiatedModule(node, preserveConstEnums) { var moduleState = ts.getModuleInstanceState(node); return moduleState === 1 /* Instantiated */ || @@ -6463,7 +7633,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 229 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 240 /* ExternalModuleReference */; + return node.kind === 234 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 245 /* ExternalModuleReference */; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -6472,7 +7642,7 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 229 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 240 /* ExternalModuleReference */; + return node.kind === 234 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 245 /* ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJavaScript(file) { @@ -6480,7 +7650,7 @@ var ts; } ts.isSourceFileJavaScript = isSourceFileJavaScript; function isInJavaScriptFile(node) { - return node && !!(node.flags & 134217728 /* JavaScriptFile */); + return node && !!(node.flags & 65536 /* JavaScriptFile */); } ts.isInJavaScriptFile = isInJavaScriptFile; /** @@ -6490,8 +7660,8 @@ var ts; */ function isRequireCall(expression, checkArgumentIsStringLiteral) { // of the form 'require("name")' - var isRequire = expression.kind === 174 /* CallExpression */ && - expression.expression.kind === 69 /* Identifier */ && + var isRequire = expression.kind === 179 /* CallExpression */ && + expression.expression.kind === 70 /* Identifier */ && expression.expression.text === "require" && expression.arguments.length === 1; return isRequire && (!checkArgumentIsStringLiteral || expression.arguments[0].kind === 9 /* StringLiteral */); @@ -6506,9 +7676,9 @@ var ts; * This function does not test if the node is in a JavaScript file or not. */ function isDeclarationOfFunctionExpression(s) { - if (s.valueDeclaration && s.valueDeclaration.kind === 218 /* VariableDeclaration */) { + if (s.valueDeclaration && s.valueDeclaration.kind === 223 /* VariableDeclaration */) { var declaration = s.valueDeclaration; - return declaration.initializer && declaration.initializer.kind === 179 /* FunctionExpression */; + return declaration.initializer && declaration.initializer.kind === 184 /* FunctionExpression */; } return false; } @@ -6519,15 +7689,15 @@ var ts; if (!isInJavaScriptFile(expression)) { return 0 /* None */; } - if (expression.kind !== 187 /* BinaryExpression */) { + if (expression.kind !== 192 /* BinaryExpression */) { return 0 /* None */; } var expr = expression; - if (expr.operatorToken.kind !== 56 /* EqualsToken */ || expr.left.kind !== 172 /* PropertyAccessExpression */) { + if (expr.operatorToken.kind !== 57 /* EqualsToken */ || expr.left.kind !== 177 /* PropertyAccessExpression */) { return 0 /* None */; } var lhs = expr.left; - if (lhs.expression.kind === 69 /* Identifier */) { + if (lhs.expression.kind === 70 /* Identifier */) { var lhsId = lhs.expression; if (lhsId.text === "exports") { // exports.name = expr @@ -6538,13 +7708,13 @@ var ts; return 2 /* ModuleExports */; } } - else if (lhs.expression.kind === 97 /* ThisKeyword */) { + else if (lhs.expression.kind === 98 /* ThisKeyword */) { return 4 /* ThisProperty */; } - else if (lhs.expression.kind === 172 /* PropertyAccessExpression */) { + else if (lhs.expression.kind === 177 /* PropertyAccessExpression */) { // chained dot, e.g. x.y.z = expr; this var is the 'x.y' part var innerPropertyAccess = lhs.expression; - if (innerPropertyAccess.expression.kind === 69 /* Identifier */) { + if (innerPropertyAccess.expression.kind === 70 /* Identifier */) { // module.exports.name = expr var innerPropertyAccessIdentifier = innerPropertyAccess.expression; if (innerPropertyAccessIdentifier.text === "module" && innerPropertyAccess.name.text === "exports") { @@ -6559,33 +7729,49 @@ var ts; } ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind; function getExternalModuleName(node) { - if (node.kind === 230 /* ImportDeclaration */) { + if (node.kind === 235 /* ImportDeclaration */) { return node.moduleSpecifier; } - if (node.kind === 229 /* ImportEqualsDeclaration */) { + if (node.kind === 234 /* ImportEqualsDeclaration */) { var reference = node.moduleReference; - if (reference.kind === 240 /* ExternalModuleReference */) { + if (reference.kind === 245 /* ExternalModuleReference */) { return reference.expression; } } - if (node.kind === 236 /* ExportDeclaration */) { + if (node.kind === 241 /* ExportDeclaration */) { return node.moduleSpecifier; } - if (node.kind === 225 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) { + if (node.kind === 230 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) { return node.name; } } ts.getExternalModuleName = getExternalModuleName; + function getNamespaceDeclarationNode(node) { + if (node.kind === 234 /* ImportEqualsDeclaration */) { + return node; + } + var importClause = node.importClause; + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 237 /* NamespaceImport */) { + return importClause.namedBindings; + } + } + ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; + function isDefaultImport(node) { + return node.kind === 235 /* ImportDeclaration */ + && node.importClause + && !!node.importClause.name; + } + ts.isDefaultImport = isDefaultImport; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 142 /* Parameter */: - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - case 254 /* ShorthandPropertyAssignment */: - case 253 /* PropertyAssignment */: - case 145 /* PropertyDeclaration */: - case 144 /* PropertySignature */: + case 144 /* Parameter */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + case 258 /* ShorthandPropertyAssignment */: + case 257 /* PropertyAssignment */: + case 147 /* PropertyDeclaration */: + case 146 /* PropertySignature */: return node.questionToken !== undefined; } } @@ -6593,100 +7779,135 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 269 /* JSDocFunctionType */ && + return node.kind === 274 /* JSDocFunctionType */ && node.parameters.length > 0 && - node.parameters[0].type.kind === 271 /* JSDocConstructorType */; + node.parameters[0].type.kind === 276 /* JSDocConstructorType */; } ts.isJSDocConstructSignature = isJSDocConstructSignature; - function getJSDocTag(node, kind, checkParentVariableStatement) { - if (!node) { - return undefined; - } - var jsDocComments = getJSDocComments(node, checkParentVariableStatement); - if (!jsDocComments) { - return undefined; - } - for (var _i = 0, jsDocComments_1 = jsDocComments; _i < jsDocComments_1.length; _i++) { - var jsDocComment = jsDocComments_1[_i]; - for (var _a = 0, _b = jsDocComment.tags; _a < _b.length; _a++) { - var tag = _b[_a]; - if (tag.kind === kind) { - return tag; + function getCommentsFromJSDoc(node) { + return ts.map(getJSDocs(node), function (doc) { return doc.comment; }); + } + 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.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 getJSDocComments(node, checkParentVariableStatement) { - if (node.jsDocComments) { - return node.jsDocComments; + 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; } - // 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; } - if (checkParentVariableStatement) { - var isInitializerOfVariableDeclarationInStatement = node.parent.kind === 218 /* VariableDeclaration */ && - node.parent.initializer === node && - node.parent.parent.parent.kind === 200 /* VariableStatement */; - var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? node.parent.parent.parent : undefined; + 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(parent) && + parent.initializer === node && + parent.parent.parent.kind === 205 /* VariableStatement */; + var isVariableOfVariableDeclarationStatement = isVariableLike(node) && + parent.parent.kind === 205 /* VariableStatement */; + var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? parent.parent.parent : + isVariableOfVariableDeclarationStatement ? parent.parent : + undefined; if (variableStatementNode) { - return variableStatementNode.jsDocComments; + 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 === 187 /* BinaryExpression */ && - parent_4.operatorToken.kind === 56 /* EqualsToken */ && - parent_4.parent.kind === 202 /* ExpressionStatement */; + var isSourceOfAssignmentExpressionStatement = parent && parent.parent && + parent.kind === 192 /* BinaryExpression */ && + parent.operatorToken.kind === 57 /* EqualsToken */ && + parent.parent.kind === 207 /* ExpressionStatement */; if (isSourceOfAssignmentExpressionStatement) { - return parent_4.parent.jsDocComments; + getJSDocsWorker(parent.parent); } - var isPropertyAssignmentExpression = parent_4 && parent_4.kind === 253 /* PropertyAssignment */; - if (isPropertyAssignmentExpression) { - return parent_4.jsDocComments; + 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 */) { + cache = ts.concatenate(cache, getJSDocParameterTags(node)); + } + if (isVariableLike(node) && node.initializer) { + cache = ts.concatenate(cache, node.initializer.jsDoc); + } + cache = ts.concatenate(cache, node.jsDoc); + } + } + ts.getJSDocs = getJSDocs; + function getJSDocParameterTags(param) { + if (!isParameter(param)) { + return undefined; + } + var func = param.parent; + 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 === 281 /* JSDocParameterTag */; }); + if (paramTags && 0 <= i && i < paramTags.length) { + return [paramTags[i]]; } } - return undefined; + else if (param.name.kind === 70 /* Identifier */) { + var name_6 = param.name.text; + 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 + // But multi-line object types aren't supported yet either + return undefined; + } } - function getJSDocTypeTag(node) { - return getJSDocTag(node, 277 /* 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.getJSDocTypeTag = getJSDocTypeTag; + ts.getJSDocType = getJSDocType; + function getJSDocAugmentsTag(node) { + return getFirstJSDocTag(node, 280 /* JSDocAugmentsTag */); + } + ts.getJSDocAugmentsTag = getJSDocAugmentsTag; function getJSDocReturnTag(node) { - return getJSDocTag(node, 276 /* JSDocReturnTag */, /*checkParentVariableStatement*/ true); + return getFirstJSDocTag(node, 282 /* JSDocReturnTag */); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getJSDocTag(node, 278 /* JSDocTemplateTag */, /*checkParentVariableStatement*/ false); + return getFirstJSDocTag(node, 284 /* JSDocTemplateTag */); } ts.getJSDocTemplateTag = getJSDocTemplateTag; - function getCorrespondingJSDocParameterTag(parameter) { - if (parameter.name && parameter.name.kind === 69 /* Identifier */) { - // If it's a parameter, see if the parent has a jsdoc comment with an @param - // annotation. - var parameterName = parameter.name.text; - var jsDocComments = getJSDocComments(parameter.parent, /*checkParentVariableStatement*/ true); - if (jsDocComments) { - for (var _i = 0, jsDocComments_2 = jsDocComments; _i < jsDocComments_2.length; _i++) { - var jsDocComment = jsDocComments_2[_i]; - for (var _a = 0, _b = jsDocComment.tags; _a < _b.length; _a++) { - var tag = _b[_a]; - if (tag.kind === 275 /* JSDocParameterTag */) { - var parameterTag = tag; - var name_6 = parameterTag.preParameterName || parameterTag.postParameterName; - if (name_6.text === parameterName) { - return parameterTag; - } - } - } - } - } - } - return undefined; - } - ts.getCorrespondingJSDocParameterTag = getCorrespondingJSDocParameterTag; function hasRestParameter(s) { return isRestParameter(ts.lastOrUndefined(s.parameters)); } @@ -6696,14 +7917,11 @@ var ts; } ts.hasDeclaredRestParameter = hasDeclaredRestParameter; function isRestParameter(node) { - if (node && (node.flags & 134217728 /* JavaScriptFile */)) { - if (node.type && node.type.kind === 270 /* JSDocVariadicType */) { + if (node && (node.flags & 65536 /* JavaScriptFile */)) { + 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 === 270 /* JSDocVariadicType */; - } } return isDeclaredRestParam(node); } @@ -6712,48 +7930,56 @@ var ts; return node && node.dotDotDotToken !== undefined; } ts.isDeclaredRestParam = isDeclaredRestParam; - function isLiteralKind(kind) { - return 8 /* FirstLiteralToken */ <= kind && kind <= 11 /* LastLiteralToken */; + var AssignmentKind; + (function (AssignmentKind) { + AssignmentKind[AssignmentKind["None"] = 0] = "None"; + AssignmentKind[AssignmentKind["Definite"] = 1] = "Definite"; + AssignmentKind[AssignmentKind["Compound"] = 2] = "Compound"; + })(AssignmentKind = ts.AssignmentKind || (ts.AssignmentKind = {})); + function getAssignmentTargetKind(node) { + var parent = node.parent; + while (true) { + switch (parent.kind) { + case 192 /* BinaryExpression */: + var binaryOperator = parent.operatorToken.kind; + return isAssignmentOperator(binaryOperator) && parent.left === node ? + binaryOperator === 57 /* EqualsToken */ ? 1 /* Definite */ : 2 /* Compound */ : + 0 /* None */; + case 190 /* PrefixUnaryExpression */: + case 191 /* PostfixUnaryExpression */: + var unaryOperator = parent.operator; + return unaryOperator === 42 /* PlusPlusToken */ || unaryOperator === 43 /* MinusMinusToken */ ? 2 /* Compound */ : 0 /* None */; + case 212 /* ForInStatement */: + case 213 /* ForOfStatement */: + return parent.initializer === node ? 1 /* Definite */ : 0 /* None */; + case 183 /* ParenthesizedExpression */: + case 175 /* ArrayLiteralExpression */: + case 196 /* SpreadElement */: + node = parent; + break; + case 258 /* ShorthandPropertyAssignment */: + if (parent.name !== node) { + return 0 /* None */; + } + // Fall through + case 257 /* PropertyAssignment */: + node = parent.parent; + break; + default: + return 0 /* None */; + } + parent = node.parent; + } } - ts.isLiteralKind = isLiteralKind; - function isTextualLiteralKind(kind) { - return kind === 9 /* StringLiteral */ || kind === 11 /* NoSubstitutionTemplateLiteral */; - } - ts.isTextualLiteralKind = isTextualLiteralKind; - function isTemplateLiteralKind(kind) { - return 11 /* FirstTemplateToken */ <= kind && kind <= 14 /* LastTemplateToken */; - } - ts.isTemplateLiteralKind = isTemplateLiteralKind; - function isBindingPattern(node) { - return !!node && (node.kind === 168 /* ArrayBindingPattern */ || node.kind === 167 /* ObjectBindingPattern */); - } - ts.isBindingPattern = isBindingPattern; + ts.getAssignmentTargetKind = getAssignmentTargetKind; // A node is an assignment target if it is on the left hand side of an '=' token, if it is parented by a property // assignment in an object literal that is an assignment target, or if it is parented by an array literal that is // an assignment target. Examples include 'a = xxx', '{ p: a } = xxx', '[{ p: a}] = xxx'. function isAssignmentTarget(node) { - while (node.parent.kind === 178 /* ParenthesizedExpression */) { - node = node.parent; - } - while (true) { - var parent_5 = node.parent; - if (parent_5.kind === 170 /* ArrayLiteralExpression */ || parent_5.kind === 191 /* SpreadElementExpression */) { - node = parent_5; - continue; - } - if (parent_5.kind === 253 /* PropertyAssignment */ || parent_5.kind === 254 /* ShorthandPropertyAssignment */) { - node = parent_5.parent; - continue; - } - return parent_5.kind === 187 /* BinaryExpression */ && - isAssignmentOperator(parent_5.operatorToken.kind) && - parent_5.left === node || - (parent_5.kind === 207 /* ForInStatement */ || parent_5.kind === 208 /* ForOfStatement */) && - parent_5.initializer === node; - } + return getAssignmentTargetKind(node) !== 0 /* None */; } ts.isAssignmentTarget = isAssignmentTarget; - function isNodeDescendentOf(node, ancestor) { + function isNodeDescendantOf(node, ancestor) { while (node) { if (node === ancestor) return true; @@ -6761,10 +7987,10 @@ var ts; } return false; } - ts.isNodeDescendentOf = isNodeDescendentOf; + ts.isNodeDescendantOf = isNodeDescendantOf; function isInAmbientContext(node) { while (node) { - if (node.flags & 2 /* Ambient */ || (node.kind === 256 /* SourceFile */ && node.isDeclarationFile)) { + if (hasModifier(node, 2 /* Ambient */) || (node.kind === 261 /* SourceFile */ && node.isDeclarationFile)) { return true; } node = node.parent; @@ -6772,92 +7998,13 @@ var ts; return false; } ts.isInAmbientContext = isInAmbientContext; - function isDeclaration(node) { - switch (node.kind) { - case 180 /* ArrowFunction */: - case 169 /* BindingElement */: - case 221 /* ClassDeclaration */: - case 192 /* ClassExpression */: - case 148 /* Constructor */: - case 224 /* EnumDeclaration */: - case 255 /* EnumMember */: - case 238 /* ExportSpecifier */: - case 220 /* FunctionDeclaration */: - case 179 /* FunctionExpression */: - case 149 /* GetAccessor */: - case 231 /* ImportClause */: - case 229 /* ImportEqualsDeclaration */: - case 234 /* ImportSpecifier */: - case 222 /* InterfaceDeclaration */: - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - case 225 /* ModuleDeclaration */: - case 232 /* NamespaceImport */: - case 228 /* NamespaceExportDeclaration */: - case 142 /* Parameter */: - case 253 /* PropertyAssignment */: - case 145 /* PropertyDeclaration */: - case 144 /* PropertySignature */: - case 150 /* SetAccessor */: - case 254 /* ShorthandPropertyAssignment */: - case 223 /* TypeAliasDeclaration */: - case 141 /* TypeParameter */: - case 218 /* VariableDeclaration */: - case 279 /* JSDocTypedefTag */: - return true; - } - return false; - } - ts.isDeclaration = isDeclaration; - function isStatement(n) { - switch (n.kind) { - case 210 /* BreakStatement */: - case 209 /* ContinueStatement */: - case 217 /* DebuggerStatement */: - case 204 /* DoStatement */: - case 202 /* ExpressionStatement */: - case 201 /* EmptyStatement */: - case 207 /* ForInStatement */: - case 208 /* ForOfStatement */: - case 206 /* ForStatement */: - case 203 /* IfStatement */: - case 214 /* LabeledStatement */: - case 211 /* ReturnStatement */: - case 213 /* SwitchStatement */: - case 215 /* ThrowStatement */: - case 216 /* TryStatement */: - case 200 /* VariableStatement */: - case 205 /* WhileStatement */: - case 212 /* WithStatement */: - case 235 /* ExportAssignment */: - return true; - default: - return false; - } - } - ts.isStatement = isStatement; - function isClassElement(n) { - switch (n.kind) { - case 148 /* Constructor */: - case 145 /* PropertyDeclaration */: - case 147 /* MethodDeclaration */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - case 146 /* MethodSignature */: - case 153 /* IndexSignature */: - return true; - default: - return false; - } - } - ts.isClassElement = isClassElement; // True if the given identifier, string literal, or number literal is the name of a declaration node function isDeclarationName(name) { - if (name.kind !== 69 /* Identifier */ && name.kind !== 9 /* StringLiteral */ && name.kind !== 8 /* NumericLiteral */) { + if (name.kind !== 70 /* Identifier */ && name.kind !== 9 /* StringLiteral */ && name.kind !== 8 /* NumericLiteral */) { return false; } var parent = name.parent; - if (parent.kind === 234 /* ImportSpecifier */ || parent.kind === 238 /* ExportSpecifier */) { + if (parent.kind === 239 /* ImportSpecifier */ || parent.kind === 243 /* ExportSpecifier */) { if (parent.propertyName) { return true; } @@ -6870,7 +8017,7 @@ var ts; ts.isDeclarationName = isDeclarationName; function isLiteralComputedPropertyDeclarationName(node) { return (node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) && - node.parent.kind === 140 /* ComputedPropertyName */ && + node.parent.kind === 142 /* ComputedPropertyName */ && isDeclaration(node.parent.parent); } ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName; @@ -6878,31 +8025,31 @@ var ts; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { - case 145 /* PropertyDeclaration */: - case 144 /* PropertySignature */: - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - case 255 /* EnumMember */: - case 253 /* PropertyAssignment */: - case 172 /* PropertyAccessExpression */: + case 147 /* PropertyDeclaration */: + case 146 /* PropertySignature */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + case 260 /* EnumMember */: + case 257 /* PropertyAssignment */: + case 177 /* PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; - case 139 /* QualifiedName */: + case 141 /* QualifiedName */: // Name on right hand side of dot in a type query if (parent.right === node) { - while (parent.kind === 139 /* QualifiedName */) { + while (parent.kind === 141 /* QualifiedName */) { parent = parent.parent; } - return parent.kind === 158 /* TypeQuery */; + return parent.kind === 160 /* TypeQuery */; } return false; - case 169 /* BindingElement */: - case 234 /* ImportSpecifier */: + case 174 /* BindingElement */: + case 239 /* ImportSpecifier */: // Property name in binding element or import specifier return parent.propertyName === node; - case 238 /* ExportSpecifier */: + case 243 /* ExportSpecifier */: // Any name in an export specifier return true; } @@ -6918,13 +8065,13 @@ var ts; // export = // export default function isAliasSymbolDeclaration(node) { - return node.kind === 229 /* ImportEqualsDeclaration */ || - node.kind === 228 /* NamespaceExportDeclaration */ || - node.kind === 231 /* ImportClause */ && !!node.name || - node.kind === 232 /* NamespaceImport */ || - node.kind === 234 /* ImportSpecifier */ || - node.kind === 238 /* ExportSpecifier */ || - node.kind === 235 /* ExportAssignment */ && exportAssignmentIsAlias(node); + return node.kind === 234 /* ImportEqualsDeclaration */ || + node.kind === 233 /* NamespaceExportDeclaration */ || + node.kind === 236 /* ImportClause */ && !!node.name || + node.kind === 237 /* NamespaceImport */ || + node.kind === 239 /* ImportSpecifier */ || + node.kind === 243 /* ExportSpecifier */ || + node.kind === 240 /* ExportAssignment */ && exportAssignmentIsAlias(node); } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function exportAssignmentIsAlias(node) { @@ -6932,17 +8079,17 @@ var ts; } ts.exportAssignmentIsAlias = exportAssignmentIsAlias; function getClassExtendsHeritageClauseElement(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 83 /* ExtendsKeyword */); + var heritageClause = getHeritageClause(node.heritageClauses, 84 /* ExtendsKeyword */); return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined; } ts.getClassExtendsHeritageClauseElement = getClassExtendsHeritageClauseElement; function getClassImplementsHeritageClauseElements(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 106 /* ImplementsKeyword */); + var heritageClause = getHeritageClause(node.heritageClauses, 107 /* ImplementsKeyword */); return heritageClause ? heritageClause.types : undefined; } ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements; function getInterfaceBaseTypeNodes(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 83 /* ExtendsKeyword */); + var heritageClause = getHeritageClause(node.heritageClauses, 84 /* ExtendsKeyword */); return heritageClause ? heritageClause.types : undefined; } ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; @@ -7010,7 +8157,7 @@ var ts; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 70 /* FirstKeyword */ <= token && token <= 138 /* LastKeyword */; + return 71 /* FirstKeyword */ <= token && token <= 140 /* LastKeyword */; } ts.isKeyword = isKeyword; function isTrivia(token) { @@ -7018,11 +8165,13 @@ var ts; } ts.isTrivia = isTrivia; function isAsyncFunctionLike(node) { - return isFunctionLike(node) && (node.flags & 256 /* Async */) !== 0 && !isAccessor(node); + 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; /** @@ -7037,8 +8186,8 @@ var ts; } ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { - return name.kind === 140 /* ComputedPropertyName */ && - !isStringOrNumericLiteral(name.expression.kind) && + return name.kind === 142 /* ComputedPropertyName */ && + !isStringOrNumericLiteral(name.expression) && !isWellKnownSymbolSyntactically(name.expression); } ts.isDynamicName = isDynamicName; @@ -7052,10 +8201,10 @@ var ts; } ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; function getPropertyNameForPropertyNameNode(name) { - if (name.kind === 69 /* Identifier */ || name.kind === 9 /* StringLiteral */ || name.kind === 8 /* NumericLiteral */ || name.kind === 142 /* Parameter */) { + if (name.kind === 70 /* Identifier */ || name.kind === 9 /* StringLiteral */ || name.kind === 8 /* NumericLiteral */ || name.kind === 144 /* Parameter */) { return name.text; } - if (name.kind === 140 /* ComputedPropertyName */) { + if (name.kind === 142 /* ComputedPropertyName */) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { var rightHandSideName = nameExpression.name.text; @@ -7076,22 +8225,26 @@ var ts; * Includes the word "Symbol" with unicode escapes */ function isESSymbolIdentifier(node) { - return node.kind === 69 /* Identifier */ && node.text === "Symbol"; + return node.kind === 70 /* Identifier */ && node.text === "Symbol"; } ts.isESSymbolIdentifier = isESSymbolIdentifier; + function isPushOrUnshiftIdentifier(node) { + return node.text === "push" || node.text === "unshift"; + } + ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier; function isModifierKind(token) { switch (token) { - case 115 /* AbstractKeyword */: - case 118 /* AsyncKeyword */: - case 74 /* ConstKeyword */: - case 122 /* DeclareKeyword */: - case 77 /* DefaultKeyword */: - case 82 /* ExportKeyword */: - case 112 /* PublicKeyword */: - case 110 /* PrivateKeyword */: - case 111 /* ProtectedKeyword */: - case 128 /* ReadonlyKeyword */: - case 113 /* StaticKeyword */: + case 116 /* AbstractKeyword */: + case 119 /* AsyncKeyword */: + case 75 /* ConstKeyword */: + case 123 /* DeclareKeyword */: + case 78 /* DefaultKeyword */: + case 83 /* ExportKeyword */: + case 113 /* PublicKeyword */: + case 111 /* PrivateKeyword */: + case 112 /* ProtectedKeyword */: + case 130 /* ReadonlyKeyword */: + case 114 /* StaticKeyword */: return true; } return false; @@ -7099,87 +8252,251 @@ var ts; ts.isModifierKind = isModifierKind; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 142 /* Parameter */; + return root.kind === 144 /* Parameter */; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 169 /* BindingElement */) { + while (node.kind === 174 /* BindingElement */) { node = node.parent.parent; } return node; } ts.getRootDeclaration = getRootDeclaration; - function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 225 /* ModuleDeclaration */ || n.kind === 256 /* SourceFile */; + function nodeStartsNewLexicalEnvironment(node) { + var kind = node.kind; + return kind === 150 /* Constructor */ + || kind === 184 /* FunctionExpression */ + || kind === 225 /* FunctionDeclaration */ + || kind === 185 /* ArrowFunction */ + || kind === 149 /* MethodDeclaration */ + || kind === 151 /* GetAccessor */ + || kind === 152 /* SetAccessor */ + || kind === 230 /* ModuleDeclaration */ + || kind === 261 /* SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; - /** - * Creates a shallow, memberwise clone of a node. The "kind", "pos", "end", "flags", and "parent" - * properties are excluded by default, and can be provided via the "location", "flags", and - * "parent" parameters. - * @param node The node to clone. - * @param location An optional TextRange to use to supply the new position. - * @param flags The NodeFlags to use for the cloned node. - * @param parent The parent for the new node. - */ - function cloneNode(node, location, flags, parent) { - // We don't use "clone" from core.ts here, as we need to preserve the prototype chain of - // the original node. We also need to exclude specific properties and only include own- - // properties (to skip members already defined on the shared prototype). - var clone = location !== undefined - ? ts.createNode(node.kind, location.pos, location.end) - : createSynthesizedNode(node.kind); - for (var key in node) { - if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) { - continue; - } - clone[key] = node[key]; - } - if (flags !== undefined) { - clone.flags = flags; - } - if (parent !== undefined) { - clone.parent = parent; - } - return clone; - } - ts.cloneNode = cloneNode; - /** - * Creates a deep clone of an EntityName, with new parent pointers. - * @param node The EntityName to clone. - * @param parent The parent for the cloned node. - */ - function cloneEntityName(node, parent) { - var clone = cloneNode(node, node, node.flags, parent); - if (isQualifiedName(clone)) { - var left = clone.left, right = clone.right; - clone.left = cloneEntityName(left, clone); - clone.right = cloneNode(right, right, right.flags, parent); - } - return clone; - } - ts.cloneEntityName = cloneEntityName; - function isQualifiedName(node) { - return node.kind === 139 /* QualifiedName */; - } - ts.isQualifiedName = isQualifiedName; function nodeIsSynthesized(node) { - return node.pos === -1; + return ts.positionIsSynthesized(node.pos) + || ts.positionIsSynthesized(node.end); } ts.nodeIsSynthesized = nodeIsSynthesized; - function createSynthesizedNode(kind, startsOnNewLine) { - var node = ts.createNode(kind, /* pos */ -1, /* end */ -1); - node.startsOnNewLine = startsOnNewLine; - return node; + function getOriginalNode(node, nodeTest) { + if (node) { + while (node.original !== undefined) { + node = node.original; + } + } + return !nodeTest || nodeTest(node) ? node : undefined; } - ts.createSynthesizedNode = createSynthesizedNode; - function createSynthesizedNodeArray() { - var array = []; - array.pos = -1; - array.end = -1; - return array; + ts.getOriginalNode = getOriginalNode; + /** + * Gets a value indicating whether a node originated in the parse tree. + * + * @param node The node to test. + */ + function isParseTreeNode(node) { + return (node.flags & 8 /* Synthesized */) === 0; } - ts.createSynthesizedNodeArray = createSynthesizedNodeArray; + ts.isParseTreeNode = isParseTreeNode; + function getParseTreeNode(node, nodeTest) { + if (isParseTreeNode(node)) { + return node; + } + node = getOriginalNode(node); + if (isParseTreeNode(node) && (!nodeTest || nodeTest(node))) { + return node; + } + return undefined; + } + ts.getParseTreeNode = getParseTreeNode; + function getOriginalSourceFiles(sourceFiles) { + var originalSourceFiles = []; + for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { + var sourceFile = sourceFiles_1[_i]; + var originalSourceFile = getParseTreeNode(sourceFile, isSourceFile); + if (originalSourceFile) { + originalSourceFiles.push(originalSourceFile); + } + } + return originalSourceFiles; + } + ts.getOriginalSourceFiles = getOriginalSourceFiles; + function getOriginalNodeId(node) { + node = getOriginalNode(node); + return node ? ts.getNodeId(node) : 0; + } + ts.getOriginalNodeId = getOriginalNodeId; + var Associativity; + (function (Associativity) { + Associativity[Associativity["Left"] = 0] = "Left"; + Associativity[Associativity["Right"] = 1] = "Right"; + })(Associativity = ts.Associativity || (ts.Associativity = {})); + function getExpressionAssociativity(expression) { + var operator = getOperator(expression); + var hasArguments = expression.kind === 180 /* NewExpression */ && expression.arguments !== undefined; + return getOperatorAssociativity(expression.kind, operator, hasArguments); + } + ts.getExpressionAssociativity = getExpressionAssociativity; + function getOperatorAssociativity(kind, operator, hasArguments) { + switch (kind) { + case 180 /* NewExpression */: + return hasArguments ? 0 /* Left */ : 1 /* Right */; + case 190 /* PrefixUnaryExpression */: + case 187 /* TypeOfExpression */: + case 188 /* VoidExpression */: + case 186 /* DeleteExpression */: + case 189 /* AwaitExpression */: + case 193 /* ConditionalExpression */: + case 195 /* YieldExpression */: + return 1 /* Right */; + case 192 /* BinaryExpression */: + switch (operator) { + case 39 /* AsteriskAsteriskToken */: + case 57 /* EqualsToken */: + case 58 /* PlusEqualsToken */: + case 59 /* MinusEqualsToken */: + case 61 /* AsteriskAsteriskEqualsToken */: + case 60 /* AsteriskEqualsToken */: + case 62 /* SlashEqualsToken */: + case 63 /* PercentEqualsToken */: + case 64 /* LessThanLessThanEqualsToken */: + case 65 /* GreaterThanGreaterThanEqualsToken */: + case 66 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 67 /* AmpersandEqualsToken */: + case 69 /* CaretEqualsToken */: + case 68 /* BarEqualsToken */: + return 1 /* Right */; + } + } + return 0 /* Left */; + } + ts.getOperatorAssociativity = getOperatorAssociativity; + function getExpressionPrecedence(expression) { + var operator = getOperator(expression); + var hasArguments = expression.kind === 180 /* NewExpression */ && expression.arguments !== undefined; + return getOperatorPrecedence(expression.kind, operator, hasArguments); + } + ts.getExpressionPrecedence = getExpressionPrecedence; + function getOperator(expression) { + if (expression.kind === 192 /* BinaryExpression */) { + return expression.operatorToken.kind; + } + else if (expression.kind === 190 /* PrefixUnaryExpression */ || expression.kind === 191 /* PostfixUnaryExpression */) { + return expression.operator; + } + else { + return expression.kind; + } + } + ts.getOperator = getOperator; + function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) { + switch (nodeKind) { + case 98 /* ThisKeyword */: + case 96 /* SuperKeyword */: + case 70 /* Identifier */: + case 94 /* NullKeyword */: + case 100 /* TrueKeyword */: + case 85 /* FalseKeyword */: + case 8 /* NumericLiteral */: + case 9 /* StringLiteral */: + case 175 /* ArrayLiteralExpression */: + case 176 /* ObjectLiteralExpression */: + case 184 /* FunctionExpression */: + case 185 /* ArrowFunction */: + case 197 /* ClassExpression */: + case 246 /* JsxElement */: + case 247 /* JsxSelfClosingElement */: + case 11 /* RegularExpressionLiteral */: + case 12 /* NoSubstitutionTemplateLiteral */: + case 194 /* TemplateExpression */: + case 183 /* ParenthesizedExpression */: + case 198 /* OmittedExpression */: + return 19; + case 181 /* TaggedTemplateExpression */: + case 177 /* PropertyAccessExpression */: + case 178 /* ElementAccessExpression */: + return 18; + case 180 /* NewExpression */: + return hasArguments ? 18 : 17; + case 179 /* CallExpression */: + return 17; + case 191 /* PostfixUnaryExpression */: + return 16; + case 190 /* PrefixUnaryExpression */: + case 187 /* TypeOfExpression */: + case 188 /* VoidExpression */: + case 186 /* DeleteExpression */: + case 189 /* AwaitExpression */: + return 15; + case 192 /* BinaryExpression */: + switch (operatorKind) { + case 50 /* ExclamationToken */: + case 51 /* TildeToken */: + return 15; + case 39 /* AsteriskAsteriskToken */: + case 38 /* AsteriskToken */: + case 40 /* SlashToken */: + case 41 /* PercentToken */: + return 14; + case 36 /* PlusToken */: + case 37 /* MinusToken */: + return 13; + case 44 /* LessThanLessThanToken */: + case 45 /* GreaterThanGreaterThanToken */: + case 46 /* GreaterThanGreaterThanGreaterThanToken */: + return 12; + case 26 /* LessThanToken */: + case 29 /* LessThanEqualsToken */: + case 28 /* GreaterThanToken */: + case 30 /* GreaterThanEqualsToken */: + case 91 /* InKeyword */: + case 92 /* InstanceOfKeyword */: + return 11; + case 31 /* EqualsEqualsToken */: + case 33 /* EqualsEqualsEqualsToken */: + case 32 /* ExclamationEqualsToken */: + case 34 /* ExclamationEqualsEqualsToken */: + return 10; + case 47 /* AmpersandToken */: + return 9; + case 49 /* CaretToken */: + return 8; + case 48 /* BarToken */: + return 7; + case 52 /* AmpersandAmpersandToken */: + return 6; + case 53 /* BarBarToken */: + return 5; + case 57 /* EqualsToken */: + case 58 /* PlusEqualsToken */: + case 59 /* MinusEqualsToken */: + case 61 /* AsteriskAsteriskEqualsToken */: + case 60 /* AsteriskEqualsToken */: + case 62 /* SlashEqualsToken */: + case 63 /* PercentEqualsToken */: + case 64 /* LessThanLessThanEqualsToken */: + case 65 /* GreaterThanGreaterThanEqualsToken */: + case 66 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 67 /* AmpersandEqualsToken */: + case 69 /* CaretEqualsToken */: + case 68 /* BarEqualsToken */: + return 3; + case 25 /* CommaToken */: + return 0; + default: + return -1; + } + case 193 /* ConditionalExpression */: + return 4; + case 195 /* YieldExpression */: + return 2; + case 196 /* SpreadElement */: + return 1; + default: + return -1; + } + } + ts.getOperatorPrecedence = getOperatorPrecedence; function createDiagnosticCollection() { var nonFileDiagnostics = []; var fileDiagnostics = ts.createMap(); @@ -7196,12 +8513,12 @@ var ts; return modificationCount; } function reattachFileDiagnostics(newFile) { - var diagnostics = fileDiagnostics[newFile.fileName]; - if (diagnostics) { - for (var _i = 0, diagnostics_1 = diagnostics; _i < diagnostics_1.length; _i++) { - var diagnostic = diagnostics_1[_i]; - diagnostic.file = newFile; - } + if (!ts.hasProperty(fileDiagnostics, newFile.fileName)) { + return; + } + for (var _i = 0, _a = fileDiagnostics[newFile.fileName]; _i < _a.length; _i++) { + var diagnostic = _a[_i]; + diagnostic.file = newFile; } } function add(diagnostic) { @@ -7277,13 +8594,12 @@ var ts; * Note that this doesn't actually wrap the input in double quotes. */ function escapeString(s) { - s = escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, getReplacement) : s; - return s; - function getReplacement(c) { - return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); - } + return s.replace(escapedCharsRegExp, getReplacement); } ts.escapeString = escapeString; + function getReplacement(c) { + return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0)); + } function isIntrinsicJsxName(name) { var ch = name.substr(0, 1); return ch.toLowerCase() === ch; @@ -7380,10 +8696,23 @@ var ts; getLine: function () { return lineCount + 1; }, getColumn: function () { return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; }, getText: function () { return output; }, + isAtStartOfLine: function () { return lineStart; }, reset: reset }; } ts.createTextWriter = createTextWriter; + function getResolvedExternalModuleName(host, file) { + return file.moduleName || getExternalModuleNameFromPath(host, file.fileName); + } + ts.getResolvedExternalModuleName = getResolvedExternalModuleName; + function getExternalModuleNameFromDeclaration(host, resolver, declaration) { + var file = resolver.getExternalModuleFileFromDeclaration(declaration); + if (!file || isDeclarationFile(file)) { + return undefined; + } + return getResolvedExternalModuleName(host, file); + } + ts.getExternalModuleNameFromDeclaration = getExternalModuleNameFromDeclaration; /** * Resolves a local path to a path which is absolute to the base of the emit */ @@ -7410,34 +8739,77 @@ var ts; function getDeclarationEmitOutputFilePath(sourceFile, host) { var options = host.getCompilerOptions(); var outputDir = options.declarationDir || options.outDir; // Prefer declaration folder if specified - if (options.declaration) { - var path = outputDir - ? getSourceFilePathInNewDir(sourceFile, host, outputDir) - : sourceFile.fileName; - return ts.removeFileExtension(path) + ".d.ts"; - } + var path = outputDir + ? getSourceFilePathInNewDir(sourceFile, host, outputDir) + : sourceFile.fileName; + return ts.removeFileExtension(path) + ".d.ts"; } ts.getDeclarationEmitOutputFilePath = getDeclarationEmitOutputFilePath; - function getEmitScriptTarget(compilerOptions) { - return compilerOptions.target || 0 /* ES3 */; + /** + * Gets the source files that are expected to have an emit output. + * + * Originally part of `forEachExpectedEmitFile`, this functionality was extracted to support + * transformations. + * + * @param host An EmitHost. + * @param targetSourceFile An optional target source file to emit. + */ + function getSourceFilesToEmit(host, targetSourceFile) { + var options = host.getCompilerOptions(); + if (options.outFile || options.out) { + var moduleKind = ts.getEmitModuleKind(options); + var moduleEmitEnabled = moduleKind === ts.ModuleKind.AMD || moduleKind === ts.ModuleKind.System; + var sourceFiles = getAllEmittableSourceFiles(); + // Can emit only sources that are not declaration file and are either non module code or module with --module or --target es6 specified + return ts.filter(sourceFiles, moduleEmitEnabled ? isNonDeclarationFile : isBundleEmitNonExternalModule); + } + else { + var sourceFiles = targetSourceFile === undefined ? getAllEmittableSourceFiles() : [targetSourceFile]; + return filterSourceFilesInDirectory(sourceFiles, function (file) { return host.isSourceFileFromExternalLibrary(file); }); + } + function getAllEmittableSourceFiles() { + return options.noEmitForJsFiles ? ts.filter(host.getSourceFiles(), function (sourceFile) { return !isSourceFileJavaScript(sourceFile); }) : host.getSourceFiles(); + } } - ts.getEmitScriptTarget = getEmitScriptTarget; - function getEmitModuleKind(compilerOptions) { - return typeof compilerOptions.module === "number" ? - compilerOptions.module : - getEmitScriptTarget(compilerOptions) === 2 /* ES6 */ ? ts.ModuleKind.ES6 : ts.ModuleKind.CommonJS; + ts.getSourceFilesToEmit = getSourceFilesToEmit; + /** Don't call this for `--outFile`, just for `--outDir` or plain emit. */ + function filterSourceFilesInDirectory(sourceFiles, isSourceFileFromExternalLibrary) { + return ts.filter(sourceFiles, function (file) { return shouldEmitInDirectory(file, isSourceFileFromExternalLibrary); }); } - ts.getEmitModuleKind = getEmitModuleKind; - function forEachExpectedEmitFile(host, action, targetSourceFile) { + ts.filterSourceFilesInDirectory = filterSourceFilesInDirectory; + function isNonDeclarationFile(sourceFile) { + return !isDeclarationFile(sourceFile); + } + /** + * Whether a file should be emitted in a non-`--outFile` case. + * Don't emit if source file is a declaration file, or was located under node_modules + */ + function shouldEmitInDirectory(sourceFile, isSourceFileFromExternalLibrary) { + return isNonDeclarationFile(sourceFile) && !isSourceFileFromExternalLibrary(sourceFile); + } + function isBundleEmitNonExternalModule(sourceFile) { + return isNonDeclarationFile(sourceFile) && !ts.isExternalModule(sourceFile); + } + /** + * Iterates over each source file to emit. The source files are expected to have been + * transformed for use by the pretty printer. + * + * Originally part of `forEachExpectedEmitFile`, this functionality was extracted to support + * transformations. + * + * @param host An EmitHost. + * @param sourceFiles The transformed source files to emit. + * @param action The action to execute. + */ + function forEachTransformedEmitFile(host, sourceFiles, action, emitOnlyDtsFiles) { var options = host.getCompilerOptions(); // Emit on each source file if (options.outFile || options.out) { - onBundledEmit(host); + onBundledEmit(sourceFiles); } else { - var sourceFiles = targetSourceFile === undefined ? host.getSourceFiles() : [targetSourceFile]; - for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { - var sourceFile = sourceFiles_1[_i]; + for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { + var sourceFile = sourceFiles_2[_i]; // Don't emit if source file is a declaration file, or was located under node_modules if (!isDeclarationFile(sourceFile) && !host.isSourceFileFromExternalLibrary(sourceFile)) { onSingleFileEmit(host, sourceFile); @@ -7461,20 +8833,79 @@ var ts; } } var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension); + var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); + var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (options.declaration || emitOnlyDtsFiles) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; + action(jsFilePath, sourceMapFilePath, declarationFilePath, [sourceFile], /*isBundledEmit*/ false); + } + function onBundledEmit(sourceFiles) { + if (sourceFiles.length) { + var jsFilePath = options.outFile || options.out; + var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); + var declarationFilePath = options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined; + action(jsFilePath, sourceMapFilePath, declarationFilePath, sourceFiles, /*isBundledEmit*/ true); + } + } + } + ts.forEachTransformedEmitFile = forEachTransformedEmitFile; + function getSourceMapFilePath(jsFilePath, options) { + return options.sourceMap ? jsFilePath + ".map" : undefined; + } + /** + * Iterates over the source files that are expected to have an emit output. This function + * is used by the legacy emitter and the declaration emitter and should not be used by + * the tree transforming emitter. + * + * @param host An EmitHost. + * @param action The action to execute. + * @param targetSourceFile An optional target source file to emit. + */ + function forEachExpectedEmitFile(host, action, targetSourceFile, emitOnlyDtsFiles) { + var options = host.getCompilerOptions(); + // Emit on each source file + if (options.outFile || options.out) { + onBundledEmit(host); + } + else { + var sourceFiles = targetSourceFile === undefined ? getSourceFilesToEmit(host) : [targetSourceFile]; + for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) { + var sourceFile = sourceFiles_3[_i]; + if (shouldEmitInDirectory(sourceFile, function (file) { return host.isSourceFileFromExternalLibrary(file); })) { + onSingleFileEmit(host, sourceFile); + } + } + } + function onSingleFileEmit(host, sourceFile) { + // JavaScript files are always LanguageVariant.JSX, as JSX syntax is allowed in .js files also. + // So for JavaScript files, '.jsx' is only emitted if the input was '.jsx', and JsxEmit.Preserve. + // For TypeScript, the only time to emit with a '.jsx' extension, is on JSX input, and JsxEmit.Preserve + var extension = ".js"; + if (options.jsx === 1 /* Preserve */) { + if (isSourceFileJavaScript(sourceFile)) { + if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { + extension = ".jsx"; + } + } + else if (sourceFile.languageVariant === 1 /* JSX */) { + // TypeScript source file preserving JSX syntax + extension = ".jsx"; + } + } + var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, extension); + var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (emitOnlyDtsFiles || options.declaration) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; var emitFileNames = { jsFilePath: jsFilePath, sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), - declarationFilePath: !isSourceFileJavaScript(sourceFile) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined + declarationFilePath: declarationFilePath }; - action(emitFileNames, [sourceFile], /*isBundledEmit*/ false); + action(emitFileNames, [sourceFile], /*isBundledEmit*/ false, emitOnlyDtsFiles); } function onBundledEmit(host) { // Can emit only sources that are not declaration file and are either non module code or module with // --module or --target es6 specified. Files included by searching under node_modules are also not emitted. - var bundledSources = ts.filter(host.getSourceFiles(), function (sourceFile) { return !isDeclarationFile(sourceFile) && + var bundledSources = ts.filter(getSourceFilesToEmit(host), function (sourceFile) { return !isDeclarationFile(sourceFile) && !host.isSourceFileFromExternalLibrary(sourceFile) && (!ts.isExternalModule(sourceFile) || - !!getEmitModuleKind(options)); }); + !!ts.getEmitModuleKind(options)); }); if (bundledSources.length) { var jsFilePath = options.outFile || options.out; var emitFileNames = { @@ -7482,12 +8913,9 @@ var ts; sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), declarationFilePath: options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined }; - action(emitFileNames, bundledSources, /*isBundledEmit*/ true); + action(emitFileNames, bundledSources, /*isBundledEmit*/ true, emitOnlyDtsFiles); } } - function getSourceMapFilePath(jsFilePath, options) { - return options.sourceMap ? jsFilePath + ".map" : undefined; - } } ts.forEachExpectedEmitFile = forEachExpectedEmitFile; function getSourceFilePathInNewDir(sourceFile, host, newDirPath) { @@ -7514,21 +8942,41 @@ var ts; ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 148 /* Constructor */ && nodeIsPresent(member.body)) { + if (member.kind === 150 /* Constructor */ && nodeIsPresent(member.body)) { return member; } }); } ts.getFirstConstructorWithBody = getFirstConstructorWithBody; + /** Get the type annotaion for the value parameter. */ function getSetAccessorTypeAnnotationNode(accessor) { if (accessor && accessor.parameters.length > 0) { - var hasThis = accessor.parameters.length === 2 && - accessor.parameters[0].name.kind === 69 /* Identifier */ && - accessor.parameters[0].name.originalKeywordKind === 97 /* ThisKeyword */; + var hasThis = accessor.parameters.length === 2 && parameterIsThisKeyword(accessor.parameters[0]); return accessor.parameters[hasThis ? 1 : 0].type; } } ts.getSetAccessorTypeAnnotationNode = getSetAccessorTypeAnnotationNode; + function getThisParameter(signature) { + if (signature.parameters.length) { + var thisParameter = signature.parameters[0]; + if (parameterIsThisKeyword(thisParameter)) { + return thisParameter; + } + } + } + ts.getThisParameter = getThisParameter; + function parameterIsThisKeyword(parameter) { + return isThisIdentifier(parameter.name); + } + ts.parameterIsThisKeyword = parameterIsThisKeyword; + function isThisIdentifier(node) { + return node && node.kind === 70 /* Identifier */ && identifierIsThisKeyword(node); + } + ts.isThisIdentifier = isThisIdentifier; + function identifierIsThisKeyword(id) { + return id.originalKeywordKind === 98 /* ThisKeyword */; + } + ts.identifierIsThisKeyword = identifierIsThisKeyword; function getAllAccessorDeclarations(declarations, accessor) { var firstAccessor; var secondAccessor; @@ -7536,10 +8984,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 149 /* GetAccessor */) { + if (accessor.kind === 151 /* GetAccessor */) { getAccessor = accessor; } - else if (accessor.kind === 150 /* SetAccessor */) { + else if (accessor.kind === 152 /* SetAccessor */) { setAccessor = accessor; } else { @@ -7548,8 +8996,8 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 149 /* GetAccessor */ || member.kind === 150 /* SetAccessor */) - && (member.flags & 32 /* Static */) === (accessor.flags & 32 /* Static */)) { + if ((member.kind === 151 /* GetAccessor */ || member.kind === 152 /* SetAccessor */) + && hasModifier(member, 32 /* Static */) === hasModifier(accessor, 32 /* Static */)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); if (memberName === accessorName) { @@ -7559,10 +9007,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 149 /* GetAccessor */ && !getAccessor) { + if (member.kind === 151 /* GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 150 /* SetAccessor */ && !setAccessor) { + if (member.kind === 152 /* SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -7578,32 +9026,49 @@ var ts; } ts.getAllAccessorDeclarations = getAllAccessorDeclarations; function emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments) { + emitNewLineBeforeLeadingCommentsOfPosition(lineMap, writer, node.pos, leadingComments); + } + ts.emitNewLineBeforeLeadingComments = emitNewLineBeforeLeadingComments; + function emitNewLineBeforeLeadingCommentsOfPosition(lineMap, writer, pos, leadingComments) { // If the leading comments start on different line than the start of node, write new line - if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && - getLineOfLocalPositionFromLineMap(lineMap, node.pos) !== getLineOfLocalPositionFromLineMap(lineMap, leadingComments[0].pos)) { + if (leadingComments && leadingComments.length && pos !== leadingComments[0].pos && + getLineOfLocalPositionFromLineMap(lineMap, pos) !== getLineOfLocalPositionFromLineMap(lineMap, leadingComments[0].pos)) { writer.writeLine(); } } - ts.emitNewLineBeforeLeadingComments = emitNewLineBeforeLeadingComments; - function emitComments(text, lineMap, writer, comments, trailingSeparator, newLine, writeComment) { - var emitLeadingSpace = !trailingSeparator; - ts.forEach(comments, function (comment) { - if (emitLeadingSpace) { - writer.write(" "); - emitLeadingSpace = false; - } - writeComment(text, lineMap, writer, comment, newLine); - if (comment.hasTrailingNewLine) { - writer.writeLine(); - } - else if (trailingSeparator) { + ts.emitNewLineBeforeLeadingCommentsOfPosition = emitNewLineBeforeLeadingCommentsOfPosition; + function emitNewLineBeforeLeadingCommentOfPosition(lineMap, writer, pos, commentPos) { + // If the leading comments start on different line than the start of node, write new line + if (pos !== commentPos && + getLineOfLocalPositionFromLineMap(lineMap, pos) !== getLineOfLocalPositionFromLineMap(lineMap, commentPos)) { + writer.writeLine(); + } + } + ts.emitNewLineBeforeLeadingCommentOfPosition = emitNewLineBeforeLeadingCommentOfPosition; + function emitComments(text, lineMap, writer, comments, leadingSeparator, trailingSeparator, newLine, writeComment) { + if (comments && comments.length > 0) { + if (leadingSeparator) { writer.write(" "); } - else { - // Emit leading space to separate comment during next comment emit - emitLeadingSpace = true; + var emitInterveningSeparator = false; + for (var _i = 0, comments_1 = comments; _i < comments_1.length; _i++) { + var comment = comments_1[_i]; + if (emitInterveningSeparator) { + writer.write(" "); + emitInterveningSeparator = false; + } + writeComment(text, lineMap, writer, comment.pos, comment.end, newLine); + if (comment.hasTrailingNewLine) { + writer.writeLine(); + } + else { + emitInterveningSeparator = true; + } } - }); + if (emitInterveningSeparator && trailingSeparator) { + writer.write(" "); + } + } } ts.emitComments = emitComments; /** @@ -7654,7 +9119,7 @@ var ts; if (nodeLine >= lastCommentLine + 2) { // Valid detachedComments emitNewLineBeforeLeadingComments(lineMap, writer, node, leadingComments); - emitComments(text, lineMap, writer, detachedComments, /*trailingSeparator*/ true, newLine, writeComment); + emitComments(text, lineMap, writer, detachedComments, /*leadingSeparator*/ false, /*trailingSeparator*/ true, newLine, writeComment); currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end }; } } @@ -7666,19 +9131,19 @@ var ts; } } ts.emitDetachedComments = emitDetachedComments; - function writeCommentRange(text, lineMap, writer, comment, newLine) { - if (text.charCodeAt(comment.pos + 1) === 42 /* asterisk */) { - var firstCommentLineAndCharacter = ts.computeLineAndCharacterOfPosition(lineMap, comment.pos); + function writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine) { + if (text.charCodeAt(commentPos + 1) === 42 /* asterisk */) { + var firstCommentLineAndCharacter = ts.computeLineAndCharacterOfPosition(lineMap, commentPos); var lineCount = lineMap.length; var firstCommentLineIndent = void 0; - for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { + for (var pos = commentPos, currentLine = firstCommentLineAndCharacter.line; pos < commentEnd; currentLine++) { var nextLineStart = (currentLine + 1) === lineCount ? text.length + 1 : lineMap[currentLine + 1]; - if (pos !== comment.pos) { + if (pos !== commentPos) { // If we are not emitting first line, we need to write the spaces to adjust the alignment if (firstCommentLineIndent === undefined) { - firstCommentLineIndent = calculateIndent(text, lineMap[firstCommentLineAndCharacter.line], comment.pos); + firstCommentLineIndent = calculateIndent(text, lineMap[firstCommentLineAndCharacter.line], commentPos); } // These are number of spaces writer is going to write at current indent var currentWriterIndentSpacing = writer.getIndent() * getIndentSize(); @@ -7714,23 +9179,23 @@ var ts; } } // Write the comment line text - writeTrimmedCurrentLine(text, comment, writer, newLine, pos, nextLineStart); + writeTrimmedCurrentLine(text, commentEnd, writer, newLine, pos, nextLineStart); pos = nextLineStart; } } else { // Single line comment of style //.... - writer.write(text.substring(comment.pos, comment.end)); + writer.write(text.substring(commentPos, commentEnd)); } } ts.writeCommentRange = writeCommentRange; - function writeTrimmedCurrentLine(text, comment, writer, newLine, pos, nextLineStart) { - var end = Math.min(comment.end, nextLineStart - 1); + function writeTrimmedCurrentLine(text, commentEnd, writer, newLine, pos, nextLineStart) { + var end = Math.min(commentEnd, nextLineStart - 1); var currentLineText = text.substring(pos, end).replace(/^\s+|\s+$/g, ""); if (currentLineText) { // trimmed forward and ending spaces text writer.write(currentLineText); - if (end !== comment.end) { + if (end !== commentEnd) { writer.writeLine(); } } @@ -7753,99 +9218,131 @@ var ts; } return currentLineIndent; } + function hasModifiers(node) { + return getModifierFlags(node) !== 0 /* None */; + } + ts.hasModifiers = hasModifiers; + function hasModifier(node, flags) { + return (getModifierFlags(node) & flags) !== 0; + } + ts.hasModifier = hasModifier; + function getModifierFlags(node) { + if (node.modifierFlagsCache & 536870912 /* HasComputedFlags */) { + return node.modifierFlagsCache & ~536870912 /* HasComputedFlags */; + } + var flags = 0 /* None */; + if (node.modifiers) { + for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { + var modifier = _a[_i]; + flags |= modifierToFlag(modifier.kind); + } + } + if (node.flags & 4 /* NestedNamespace */ || (node.kind === 70 /* Identifier */ && node.isInJSDocNamespace)) { + flags |= 1 /* Export */; + } + node.modifierFlagsCache = flags | 536870912 /* HasComputedFlags */; + return flags; + } + ts.getModifierFlags = getModifierFlags; function modifierToFlag(token) { switch (token) { - case 113 /* StaticKeyword */: return 32 /* Static */; - case 112 /* PublicKeyword */: return 4 /* Public */; - case 111 /* ProtectedKeyword */: return 16 /* Protected */; - case 110 /* PrivateKeyword */: return 8 /* Private */; - case 115 /* AbstractKeyword */: return 128 /* Abstract */; - case 82 /* ExportKeyword */: return 1 /* Export */; - case 122 /* DeclareKeyword */: return 2 /* Ambient */; - case 74 /* ConstKeyword */: return 2048 /* Const */; - case 77 /* DefaultKeyword */: return 512 /* Default */; - case 118 /* AsyncKeyword */: return 256 /* Async */; - case 128 /* ReadonlyKeyword */: return 64 /* Readonly */; + case 114 /* StaticKeyword */: return 32 /* Static */; + case 113 /* PublicKeyword */: return 4 /* Public */; + case 112 /* ProtectedKeyword */: return 16 /* Protected */; + case 111 /* PrivateKeyword */: return 8 /* Private */; + case 116 /* AbstractKeyword */: return 128 /* Abstract */; + case 83 /* ExportKeyword */: return 1 /* Export */; + case 123 /* DeclareKeyword */: return 2 /* Ambient */; + case 75 /* ConstKeyword */: return 2048 /* Const */; + case 78 /* DefaultKeyword */: return 512 /* Default */; + case 119 /* AsyncKeyword */: return 256 /* Async */; + case 130 /* ReadonlyKeyword */: return 64 /* Readonly */; } - return 0; + return 0 /* None */; } ts.modifierToFlag = modifierToFlag; - function isLeftHandSideExpression(expr) { - if (expr) { - switch (expr.kind) { - case 172 /* PropertyAccessExpression */: - case 173 /* ElementAccessExpression */: - case 175 /* NewExpression */: - case 174 /* CallExpression */: - case 196 /* NonNullExpression */: - case 241 /* JsxElement */: - case 242 /* JsxSelfClosingElement */: - case 176 /* TaggedTemplateExpression */: - case 170 /* ArrayLiteralExpression */: - case 178 /* ParenthesizedExpression */: - case 171 /* ObjectLiteralExpression */: - case 192 /* ClassExpression */: - case 179 /* FunctionExpression */: - case 69 /* Identifier */: - case 10 /* RegularExpressionLiteral */: - case 8 /* NumericLiteral */: - case 9 /* StringLiteral */: - case 11 /* NoSubstitutionTemplateLiteral */: - case 189 /* TemplateExpression */: - case 84 /* FalseKeyword */: - case 93 /* NullKeyword */: - case 97 /* ThisKeyword */: - case 99 /* TrueKeyword */: - case 95 /* SuperKeyword */: - return true; - } + function isLogicalOperator(token) { + return token === 53 /* BarBarToken */ + || token === 52 /* AmpersandAmpersandToken */ + || token === 50 /* ExclamationToken */; + } + ts.isLogicalOperator = isLogicalOperator; + function isAssignmentOperator(token) { + return token >= 57 /* FirstAssignment */ && token <= 69 /* LastAssignment */; + } + ts.isAssignmentOperator = isAssignmentOperator; + /** Get `C` given `N` if `N` is in the position `class C extends N` where `N` is an ExpressionWithTypeArguments. */ + function tryGetClassExtendingExpressionWithTypeArguments(node) { + if (node.kind === 199 /* ExpressionWithTypeArguments */ && + node.parent.token === 84 /* ExtendsKeyword */ && + isClassLike(node.parent.parent)) { + return node.parent.parent; + } + } + ts.tryGetClassExtendingExpressionWithTypeArguments = tryGetClassExtendingExpressionWithTypeArguments; + function isAssignmentExpression(node, excludeCompoundAssignment) { + return isBinaryExpression(node) + && (excludeCompoundAssignment + ? node.operatorToken.kind === 57 /* EqualsToken */ + : isAssignmentOperator(node.operatorToken.kind)) + && isLeftHandSideExpression(node.left); + } + ts.isAssignmentExpression = isAssignmentExpression; + function isDestructuringAssignment(node) { + if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) { + var kind = node.left.kind; + return kind === 176 /* ObjectLiteralExpression */ + || kind === 175 /* ArrayLiteralExpression */; } return false; } - ts.isLeftHandSideExpression = isLeftHandSideExpression; - function isAssignmentOperator(token) { - return token >= 56 /* FirstAssignment */ && token <= 68 /* LastAssignment */; + ts.isDestructuringAssignment = isDestructuringAssignment; + // Returns false if this heritage clause element's expression contains something unsupported + // (i.e. not a name or dotted name). + function isSupportedExpressionWithTypeArguments(node) { + return isSupportedExpressionWithTypeArgumentsRest(node.expression); + } + ts.isSupportedExpressionWithTypeArguments = isSupportedExpressionWithTypeArguments; + function isSupportedExpressionWithTypeArgumentsRest(node) { + if (node.kind === 70 /* Identifier */) { + return true; + } + else if (isPropertyAccessExpression(node)) { + return isSupportedExpressionWithTypeArgumentsRest(node.expression); + } + else { + return false; + } } - ts.isAssignmentOperator = isAssignmentOperator; function isExpressionWithTypeArgumentsInClassExtendsClause(node) { - return node.kind === 194 /* ExpressionWithTypeArguments */ && - node.parent.token === 83 /* ExtendsKeyword */ && - isClassLike(node.parent.parent); + return tryGetClassExtendingExpressionWithTypeArguments(node) !== undefined; } ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause; function isEntityNameExpression(node) { - return node.kind === 69 /* Identifier */ || - node.kind === 172 /* PropertyAccessExpression */ && isEntityNameExpression(node.expression); + return node.kind === 70 /* Identifier */ || + node.kind === 177 /* PropertyAccessExpression */ && isEntityNameExpression(node.expression); } ts.isEntityNameExpression = isEntityNameExpression; function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 139 /* QualifiedName */ && node.parent.right === node) || - (node.parent.kind === 172 /* PropertyAccessExpression */ && node.parent.name === node); + return (node.parent.kind === 141 /* QualifiedName */ && node.parent.right === node) || + (node.parent.kind === 177 /* PropertyAccessExpression */ && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isEmptyObjectLiteralOrArrayLiteral(expression) { var kind = expression.kind; - if (kind === 171 /* ObjectLiteralExpression */) { + if (kind === 176 /* ObjectLiteralExpression */) { return expression.properties.length === 0; } - if (kind === 170 /* ArrayLiteralExpression */) { + if (kind === 175 /* ArrayLiteralExpression */) { return expression.elements.length === 0; } return false; } ts.isEmptyObjectLiteralOrArrayLiteral = isEmptyObjectLiteralOrArrayLiteral; function getLocalSymbolForExportDefault(symbol) { - return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 512 /* Default */) ? symbol.valueDeclaration.localSymbol : undefined; + return symbol && symbol.valueDeclaration && hasModifier(symbol.valueDeclaration, 512 /* Default */) ? symbol.valueDeclaration.localSymbol : undefined; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; - function hasJavaScriptFileExtension(fileName) { - return ts.forEach(ts.supportedJavascriptExtensions, function (extension) { return ts.fileExtensionIs(fileName, extension); }); - } - ts.hasJavaScriptFileExtension = hasJavaScriptFileExtension; - function hasTypeScriptFileExtension(fileName) { - return ts.forEach(ts.supportedTypeScriptExtensions, function (extension) { return ts.fileExtensionIs(fileName, extension); }); - } - ts.hasTypeScriptFileExtension = hasTypeScriptFileExtension; /** Return ".ts", ".d.ts", or ".tsx", if that is the extension. */ function tryExtractTypeScriptExtension(fileName) { return ts.find(ts.supportedTypescriptExtensionsForExtractExtension, function (extension) { return ts.fileExtensionIs(fileName, extension); }); @@ -7885,47 +9382,6 @@ var ts; } return output; } - /** - * Serialize an object graph into a JSON string. This is intended only for use on an acyclic graph - * as the fallback implementation does not check for circular references by default. - */ - ts.stringify = typeof JSON !== "undefined" && JSON.stringify - ? JSON.stringify - : stringifyFallback; - /** - * Serialize an object graph into a JSON string. - */ - function stringifyFallback(value) { - // JSON.stringify returns `undefined` here, instead of the string "undefined". - return value === undefined ? undefined : stringifyValue(value); - } - function stringifyValue(value) { - return typeof value === "string" ? "\"" + escapeString(value) + "\"" - : typeof value === "number" ? isFinite(value) ? String(value) : "null" - : typeof value === "boolean" ? value ? "true" : "false" - : typeof value === "object" && value ? ts.isArray(value) ? cycleCheck(stringifyArray, value) : cycleCheck(stringifyObject, value) - : "null"; - } - function cycleCheck(cb, value) { - ts.Debug.assert(!value.hasOwnProperty("__cycle"), "Converting circular structure to JSON"); - value.__cycle = true; - var result = cb(value); - delete value.__cycle; - return result; - } - function stringifyArray(value) { - return "[" + ts.reduceLeft(value, stringifyElement, "") + "]"; - } - function stringifyElement(memo, value) { - return (memo ? memo + "," : memo) + stringifyValue(value); - } - function stringifyObject(value) { - return "{" + ts.reduceOwnProperties(value, stringifyProperty, "") + "}"; - } - function stringifyProperty(memo, value, key) { - return value === undefined || typeof value === "function" || key === "__cycle" ? memo - : (memo ? memo + "," : memo) + ("\"" + escapeString(key) + "\":" + stringifyValue(value)); - } var base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; /** * Converts a string to a base-64 encoded ASCII string. @@ -7958,12 +9414,6 @@ var ts; return result; } ts.convertToBase64 = convertToBase64; - function convertToRelativePath(absoluteOrRelativePath, basePath, getCanonicalFileName) { - return !ts.isRootedDiskPath(absoluteOrRelativePath) - ? absoluteOrRelativePath - : ts.getRelativePathToDirectoryOrUrl(basePath, absoluteOrRelativePath, basePath, getCanonicalFileName, /* isAbsolutePathAnUrl */ false); - } - ts.convertToRelativePath = convertToRelativePath; var carriageReturnLineFeed = "\r\n"; var lineFeed = "\n"; function getNewLineCharacter(options) { @@ -7979,16 +9429,899 @@ var ts; return carriageReturnLineFeed; } ts.getNewLineCharacter = getNewLineCharacter; + /** + * Tests whether a node and its subtree is simple enough to have its position + * information ignored when emitting source maps in a destructuring assignment. + * + * @param node The expression to test. + */ + function isSimpleExpression(node) { + return isSimpleExpressionWorker(node, 0); + } + ts.isSimpleExpression = isSimpleExpression; + function isSimpleExpressionWorker(node, depth) { + if (depth <= 5) { + var kind = node.kind; + if (kind === 9 /* StringLiteral */ + || kind === 8 /* NumericLiteral */ + || kind === 11 /* RegularExpressionLiteral */ + || kind === 12 /* NoSubstitutionTemplateLiteral */ + || kind === 70 /* Identifier */ + || kind === 98 /* ThisKeyword */ + || kind === 96 /* SuperKeyword */ + || kind === 100 /* TrueKeyword */ + || kind === 85 /* FalseKeyword */ + || kind === 94 /* NullKeyword */) { + return true; + } + else if (kind === 177 /* PropertyAccessExpression */) { + return isSimpleExpressionWorker(node.expression, depth + 1); + } + else if (kind === 178 /* ElementAccessExpression */) { + return isSimpleExpressionWorker(node.expression, depth + 1) + && isSimpleExpressionWorker(node.argumentExpression, depth + 1); + } + else if (kind === 190 /* PrefixUnaryExpression */ + || kind === 191 /* PostfixUnaryExpression */) { + return isSimpleExpressionWorker(node.operand, depth + 1); + } + else if (kind === 192 /* BinaryExpression */) { + return node.operatorToken.kind !== 39 /* AsteriskAsteriskToken */ + && isSimpleExpressionWorker(node.left, depth + 1) + && isSimpleExpressionWorker(node.right, depth + 1); + } + else if (kind === 193 /* ConditionalExpression */) { + return isSimpleExpressionWorker(node.condition, depth + 1) + && isSimpleExpressionWorker(node.whenTrue, depth + 1) + && isSimpleExpressionWorker(node.whenFalse, depth + 1); + } + else if (kind === 188 /* VoidExpression */ + || kind === 187 /* TypeOfExpression */ + || kind === 186 /* DeleteExpression */) { + return isSimpleExpressionWorker(node.expression, depth + 1); + } + else if (kind === 175 /* ArrayLiteralExpression */) { + return node.elements.length === 0; + } + else if (kind === 176 /* ObjectLiteralExpression */) { + return node.properties.length === 0; + } + else if (kind === 179 /* CallExpression */) { + if (!isSimpleExpressionWorker(node.expression, depth + 1)) { + return false; + } + for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { + var argument = _a[_i]; + if (!isSimpleExpressionWorker(argument, depth + 1)) { + return false; + } + } + return true; + } + } + return false; + } + var syntaxKindCache = ts.createMap(); + function formatSyntaxKind(kind) { + var syntaxKindEnum = ts.SyntaxKind; + if (syntaxKindEnum) { + if (syntaxKindCache[kind]) { + return syntaxKindCache[kind]; + } + for (var name_7 in syntaxKindEnum) { + if (syntaxKindEnum[name_7] === kind) { + return syntaxKindCache[kind] = kind.toString() + " (" + name_7 + ")"; + } + } + } + else { + return kind.toString(); + } + } + ts.formatSyntaxKind = formatSyntaxKind; + /** + * Increases (or decreases) a position by the provided amount. + * + * @param pos The position. + * @param value The delta. + */ + function movePos(pos, value) { + return ts.positionIsSynthesized(pos) ? -1 : pos + value; + } + ts.movePos = movePos; + /** + * Creates a new TextRange from the provided pos and end. + * + * @param pos The start position. + * @param end The end position. + */ + function createRange(pos, end) { + return { pos: pos, end: end }; + } + ts.createRange = createRange; + /** + * Creates a new TextRange from a provided range with a new end position. + * + * @param range A TextRange. + * @param end The new end position. + */ + function moveRangeEnd(range, end) { + return createRange(range.pos, end); + } + ts.moveRangeEnd = moveRangeEnd; + /** + * Creates a new TextRange from a provided range with a new start position. + * + * @param range A TextRange. + * @param pos The new Start position. + */ + function moveRangePos(range, pos) { + return createRange(pos, range.end); + } + ts.moveRangePos = moveRangePos; + /** + * Moves the start position of a range past any decorators. + */ + function moveRangePastDecorators(node) { + return node.decorators && node.decorators.length > 0 + ? moveRangePos(node, node.decorators.end) + : node; + } + ts.moveRangePastDecorators = moveRangePastDecorators; + /** + * Moves the start position of a range past any decorators or modifiers. + */ + function moveRangePastModifiers(node) { + return node.modifiers && node.modifiers.length > 0 + ? moveRangePos(node, node.modifiers.end) + : moveRangePastDecorators(node); + } + ts.moveRangePastModifiers = moveRangePastModifiers; + /** + * Determines whether a TextRange has the same start and end positions. + * + * @param range A TextRange. + */ + function isCollapsedRange(range) { + return range.pos === range.end; + } + ts.isCollapsedRange = isCollapsedRange; + /** + * Creates a new TextRange from a provided range with its end position collapsed to its + * start position. + * + * @param range A TextRange. + */ + function collapseRangeToStart(range) { + return isCollapsedRange(range) ? range : moveRangeEnd(range, range.pos); + } + ts.collapseRangeToStart = collapseRangeToStart; + /** + * Creates a new TextRange from a provided range with its start position collapsed to its + * end position. + * + * @param range A TextRange. + */ + function collapseRangeToEnd(range) { + return isCollapsedRange(range) ? range : moveRangePos(range, range.end); + } + ts.collapseRangeToEnd = collapseRangeToEnd; + /** + * Creates a new TextRange for a token at the provides start position. + * + * @param pos The start position. + * @param token The token. + */ + function createTokenRange(pos, token) { + return createRange(pos, pos + ts.tokenToString(token).length); + } + ts.createTokenRange = createTokenRange; + function rangeIsOnSingleLine(range, sourceFile) { + return rangeStartIsOnSameLineAsRangeEnd(range, range, sourceFile); + } + ts.rangeIsOnSingleLine = rangeIsOnSingleLine; + function rangeStartPositionsAreOnSameLine(range1, range2, sourceFile) { + return positionsAreOnSameLine(getStartPositionOfRange(range1, sourceFile), getStartPositionOfRange(range2, sourceFile), sourceFile); + } + ts.rangeStartPositionsAreOnSameLine = rangeStartPositionsAreOnSameLine; + function rangeEndPositionsAreOnSameLine(range1, range2, sourceFile) { + return positionsAreOnSameLine(range1.end, range2.end, sourceFile); + } + ts.rangeEndPositionsAreOnSameLine = rangeEndPositionsAreOnSameLine; + function rangeStartIsOnSameLineAsRangeEnd(range1, range2, sourceFile) { + return positionsAreOnSameLine(getStartPositionOfRange(range1, sourceFile), range2.end, sourceFile); + } + ts.rangeStartIsOnSameLineAsRangeEnd = rangeStartIsOnSameLineAsRangeEnd; + function rangeEndIsOnSameLineAsRangeStart(range1, range2, sourceFile) { + return positionsAreOnSameLine(range1.end, getStartPositionOfRange(range2, sourceFile), sourceFile); + } + ts.rangeEndIsOnSameLineAsRangeStart = rangeEndIsOnSameLineAsRangeStart; + function positionsAreOnSameLine(pos1, pos2, sourceFile) { + return pos1 === pos2 || + getLineOfLocalPosition(sourceFile, pos1) === getLineOfLocalPosition(sourceFile, pos2); + } + ts.positionsAreOnSameLine = positionsAreOnSameLine; + function getStartPositionOfRange(range, sourceFile) { + return ts.positionIsSynthesized(range.pos) ? -1 : ts.skipTrivia(sourceFile.text, range.pos); + } + ts.getStartPositionOfRange = getStartPositionOfRange; + /** + * Determines whether a name was originally the declaration name of an enum or namespace + * declaration. + */ + function isDeclarationNameOfEnumOrNamespace(node) { + var parseNode = getParseTreeNode(node); + if (parseNode) { + switch (parseNode.parent.kind) { + case 229 /* EnumDeclaration */: + case 230 /* ModuleDeclaration */: + return parseNode === parseNode.parent.name; + } + } + return false; + } + ts.isDeclarationNameOfEnumOrNamespace = isDeclarationNameOfEnumOrNamespace; + function getInitializedVariables(node) { + return ts.filter(node.declarations, isInitializedVariable); + } + ts.getInitializedVariables = getInitializedVariables; + function isInitializedVariable(node) { + return node.initializer !== undefined; + } + /** + * Gets a value indicating whether a node is merged with a class declaration in the same scope. + */ + function isMergedWithClass(node) { + if (node.symbol) { + for (var _i = 0, _a = node.symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + if (declaration.kind === 226 /* ClassDeclaration */ && declaration !== node) { + return true; + } + } + } + return false; + } + ts.isMergedWithClass = isMergedWithClass; + /** + * Gets a value indicating whether a node is the first declaration of its kind. + * + * @param node A Declaration node. + * @param kind The SyntaxKind to find among related declarations. + */ + function isFirstDeclarationOfKind(node, kind) { + return node.symbol && getDeclarationOfKind(node.symbol, kind) === node; + } + ts.isFirstDeclarationOfKind = isFirstDeclarationOfKind; + // Node tests + // + // All node tests in the following list should *not* reference parent pointers so that + // they may be used with transformations. + // Node Arrays + function isNodeArray(array) { + return array.hasOwnProperty("pos") + && array.hasOwnProperty("end"); + } + ts.isNodeArray = isNodeArray; + // Literals + function isNoSubstitutionTemplateLiteral(node) { + return node.kind === 12 /* NoSubstitutionTemplateLiteral */; + } + ts.isNoSubstitutionTemplateLiteral = isNoSubstitutionTemplateLiteral; + function isLiteralKind(kind) { + return 8 /* FirstLiteralToken */ <= kind && kind <= 12 /* LastLiteralToken */; + } + ts.isLiteralKind = isLiteralKind; + function isTextualLiteralKind(kind) { + return kind === 9 /* StringLiteral */ || kind === 12 /* NoSubstitutionTemplateLiteral */; + } + ts.isTextualLiteralKind = isTextualLiteralKind; + function isLiteralExpression(node) { + return isLiteralKind(node.kind); + } + ts.isLiteralExpression = isLiteralExpression; + // Pseudo-literals + function isTemplateLiteralKind(kind) { + return 12 /* FirstTemplateToken */ <= kind && kind <= 15 /* LastTemplateToken */; + } + ts.isTemplateLiteralKind = isTemplateLiteralKind; + function isTemplateHead(node) { + return node.kind === 13 /* TemplateHead */; + } + ts.isTemplateHead = isTemplateHead; + function isTemplateMiddleOrTemplateTail(node) { + var kind = node.kind; + return kind === 14 /* TemplateMiddle */ + || kind === 15 /* TemplateTail */; + } + ts.isTemplateMiddleOrTemplateTail = isTemplateMiddleOrTemplateTail; + // Identifiers + function isIdentifier(node) { + return node.kind === 70 /* Identifier */; + } + ts.isIdentifier = isIdentifier; + function isVoidExpression(node) { + return node.kind === 188 /* VoidExpression */; + } + ts.isVoidExpression = isVoidExpression; + function isGeneratedIdentifier(node) { + // Using `>` here catches both `GeneratedIdentifierKind.None` and `undefined`. + return isIdentifier(node) && node.autoGenerateKind > 0 /* None */; + } + ts.isGeneratedIdentifier = isGeneratedIdentifier; + // Keywords + function isModifier(node) { + return isModifierKind(node.kind); + } + ts.isModifier = isModifier; + // Names + function isQualifiedName(node) { + return node.kind === 141 /* QualifiedName */; + } + ts.isQualifiedName = isQualifiedName; + function isComputedPropertyName(node) { + return node.kind === 142 /* ComputedPropertyName */; + } + ts.isComputedPropertyName = isComputedPropertyName; + function isEntityName(node) { + var kind = node.kind; + return kind === 141 /* QualifiedName */ + || kind === 70 /* Identifier */; + } + ts.isEntityName = isEntityName; + function isPropertyName(node) { + var kind = node.kind; + return kind === 70 /* Identifier */ + || kind === 9 /* StringLiteral */ + || kind === 8 /* NumericLiteral */ + || kind === 142 /* ComputedPropertyName */; + } + ts.isPropertyName = isPropertyName; + function isModuleName(node) { + var kind = node.kind; + return kind === 70 /* Identifier */ + || kind === 9 /* StringLiteral */; + } + ts.isModuleName = isModuleName; + function isBindingName(node) { + var kind = node.kind; + return kind === 70 /* Identifier */ + || kind === 172 /* ObjectBindingPattern */ + || kind === 173 /* ArrayBindingPattern */; + } + ts.isBindingName = isBindingName; + // Signature elements + function isTypeParameter(node) { + return node.kind === 143 /* TypeParameter */; + } + ts.isTypeParameter = isTypeParameter; + function isParameter(node) { + return node.kind === 144 /* Parameter */; + } + ts.isParameter = isParameter; + function isDecorator(node) { + return node.kind === 145 /* Decorator */; + } + ts.isDecorator = isDecorator; + // Type members + function isMethodDeclaration(node) { + return node.kind === 149 /* MethodDeclaration */; + } + ts.isMethodDeclaration = isMethodDeclaration; + function isClassElement(node) { + var kind = node.kind; + return kind === 150 /* Constructor */ + || kind === 147 /* PropertyDeclaration */ + || kind === 149 /* MethodDeclaration */ + || kind === 151 /* GetAccessor */ + || kind === 152 /* SetAccessor */ + || kind === 155 /* IndexSignature */ + || kind === 203 /* SemicolonClassElement */; + } + ts.isClassElement = isClassElement; + function isObjectLiteralElementLike(node) { + var kind = node.kind; + return kind === 257 /* PropertyAssignment */ + || kind === 258 /* ShorthandPropertyAssignment */ + || kind === 259 /* SpreadAssignment */ + || kind === 149 /* MethodDeclaration */ + || kind === 151 /* GetAccessor */ + || kind === 152 /* SetAccessor */ + || kind === 244 /* MissingDeclaration */; + } + ts.isObjectLiteralElementLike = isObjectLiteralElementLike; + // Type + function isTypeNodeKind(kind) { + return (kind >= 156 /* FirstTypeNode */ && kind <= 171 /* LastTypeNode */) + || kind === 118 /* AnyKeyword */ + || kind === 132 /* NumberKeyword */ + || kind === 121 /* BooleanKeyword */ + || kind === 134 /* StringKeyword */ + || kind === 135 /* SymbolKeyword */ + || kind === 104 /* VoidKeyword */ + || kind === 129 /* NeverKeyword */ + || kind === 199 /* ExpressionWithTypeArguments */; + } + /** + * Node test that determines whether a node is a valid type node. + * This differs from the `isPartOfTypeNode` function which determines whether a node is *part* + * of a TypeNode. + */ + function isTypeNode(node) { + return isTypeNodeKind(node.kind); + } + 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; + return kind === 173 /* ArrayBindingPattern */ + || kind === 172 /* ObjectBindingPattern */; + } + 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 */; + } + ts.isBindingElement = isBindingElement; + function isArrayBindingElement(node) { + var kind = node.kind; + return kind === 174 /* BindingElement */ + || 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 */; + } + ts.isArrayLiteralExpression = isArrayLiteralExpression; + function isObjectLiteralExpression(node) { + return node.kind === 176 /* ObjectLiteralExpression */; + } + ts.isObjectLiteralExpression = isObjectLiteralExpression; + function isPropertyAccessExpression(node) { + return node.kind === 177 /* PropertyAccessExpression */; + } + ts.isPropertyAccessExpression = isPropertyAccessExpression; + function isElementAccessExpression(node) { + return node.kind === 178 /* ElementAccessExpression */; + } + ts.isElementAccessExpression = isElementAccessExpression; + function isBinaryExpression(node) { + return node.kind === 192 /* BinaryExpression */; + } + ts.isBinaryExpression = isBinaryExpression; + function isConditionalExpression(node) { + return node.kind === 193 /* ConditionalExpression */; + } + ts.isConditionalExpression = isConditionalExpression; + function isCallExpression(node) { + return node.kind === 179 /* CallExpression */; + } + ts.isCallExpression = isCallExpression; + function isTemplateLiteral(node) { + var kind = node.kind; + return kind === 194 /* TemplateExpression */ + || kind === 12 /* NoSubstitutionTemplateLiteral */; + } + ts.isTemplateLiteral = isTemplateLiteral; + function isSpreadExpression(node) { + return node.kind === 196 /* SpreadElement */; + } + ts.isSpreadExpression = isSpreadExpression; + function isExpressionWithTypeArguments(node) { + return node.kind === 199 /* ExpressionWithTypeArguments */; + } + ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments; + function isLeftHandSideExpressionKind(kind) { + return kind === 177 /* PropertyAccessExpression */ + || kind === 178 /* ElementAccessExpression */ + || kind === 180 /* NewExpression */ + || kind === 179 /* CallExpression */ + || kind === 246 /* JsxElement */ + || kind === 247 /* JsxSelfClosingElement */ + || kind === 181 /* TaggedTemplateExpression */ + || kind === 175 /* ArrayLiteralExpression */ + || kind === 183 /* ParenthesizedExpression */ + || kind === 176 /* ObjectLiteralExpression */ + || kind === 197 /* ClassExpression */ + || kind === 184 /* FunctionExpression */ + || kind === 70 /* Identifier */ + || kind === 11 /* RegularExpressionLiteral */ + || kind === 8 /* NumericLiteral */ + || kind === 9 /* StringLiteral */ + || kind === 12 /* NoSubstitutionTemplateLiteral */ + || kind === 194 /* TemplateExpression */ + || kind === 85 /* FalseKeyword */ + || kind === 94 /* NullKeyword */ + || kind === 98 /* ThisKeyword */ + || kind === 100 /* TrueKeyword */ + || kind === 96 /* SuperKeyword */ + || kind === 201 /* NonNullExpression */; + } + function isLeftHandSideExpression(node) { + return isLeftHandSideExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind); + } + ts.isLeftHandSideExpression = isLeftHandSideExpression; + function isUnaryExpressionKind(kind) { + return kind === 190 /* PrefixUnaryExpression */ + || kind === 191 /* PostfixUnaryExpression */ + || kind === 186 /* DeleteExpression */ + || kind === 187 /* TypeOfExpression */ + || kind === 188 /* VoidExpression */ + || kind === 189 /* AwaitExpression */ + || kind === 182 /* TypeAssertionExpression */ + || isLeftHandSideExpressionKind(kind); + } + function isUnaryExpression(node) { + return isUnaryExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind); + } + ts.isUnaryExpression = isUnaryExpression; + function isExpressionKind(kind) { + return kind === 193 /* ConditionalExpression */ + || kind === 195 /* YieldExpression */ + || kind === 185 /* ArrowFunction */ + || kind === 192 /* BinaryExpression */ + || kind === 196 /* SpreadElement */ + || kind === 200 /* AsExpression */ + || kind === 198 /* OmittedExpression */ + || isUnaryExpressionKind(kind); + } + function isExpression(node) { + return isExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind); + } + ts.isExpression = isExpression; + function isAssertionExpression(node) { + var kind = node.kind; + return kind === 182 /* TypeAssertionExpression */ + || kind === 200 /* AsExpression */; + } + ts.isAssertionExpression = isAssertionExpression; + function isPartiallyEmittedExpression(node) { + return node.kind === 294 /* PartiallyEmittedExpression */; + } + ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; + function isNotEmittedStatement(node) { + return node.kind === 293 /* NotEmittedStatement */; + } + ts.isNotEmittedStatement = isNotEmittedStatement; + function isNotEmittedOrPartiallyEmittedNode(node) { + return isNotEmittedStatement(node) + || isPartiallyEmittedExpression(node); + } + ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; + function isOmittedExpression(node) { + return node.kind === 198 /* OmittedExpression */; + } + ts.isOmittedExpression = isOmittedExpression; + // Misc + function isTemplateSpan(node) { + return node.kind === 202 /* TemplateSpan */; + } + ts.isTemplateSpan = isTemplateSpan; + // Element + function isBlock(node) { + return node.kind === 204 /* Block */; + } + ts.isBlock = isBlock; + function isConciseBody(node) { + return isBlock(node) + || isExpression(node); + } + ts.isConciseBody = isConciseBody; + function isFunctionBody(node) { + return isBlock(node); + } + ts.isFunctionBody = isFunctionBody; + function isForInitializer(node) { + return isVariableDeclarationList(node) + || isExpression(node); + } + ts.isForInitializer = isForInitializer; + function isVariableDeclaration(node) { + return node.kind === 223 /* VariableDeclaration */; + } + ts.isVariableDeclaration = isVariableDeclaration; + function isVariableDeclarationList(node) { + return node.kind === 224 /* VariableDeclarationList */; + } + ts.isVariableDeclarationList = isVariableDeclarationList; + function isCaseBlock(node) { + return node.kind === 232 /* CaseBlock */; + } + ts.isCaseBlock = isCaseBlock; + function isModuleBody(node) { + var kind = node.kind; + return kind === 231 /* ModuleBlock */ + || kind === 230 /* ModuleDeclaration */; + } + ts.isModuleBody = isModuleBody; + function isImportEqualsDeclaration(node) { + return node.kind === 234 /* ImportEqualsDeclaration */; + } + ts.isImportEqualsDeclaration = isImportEqualsDeclaration; + function isImportClause(node) { + return node.kind === 236 /* ImportClause */; + } + ts.isImportClause = isImportClause; + function isNamedImportBindings(node) { + var kind = node.kind; + return kind === 238 /* NamedImports */ + || kind === 237 /* NamespaceImport */; + } + ts.isNamedImportBindings = isNamedImportBindings; + function isImportSpecifier(node) { + return node.kind === 239 /* ImportSpecifier */; + } + ts.isImportSpecifier = isImportSpecifier; + function isNamedExports(node) { + return node.kind === 242 /* NamedExports */; + } + ts.isNamedExports = isNamedExports; + function isExportSpecifier(node) { + return node.kind === 243 /* ExportSpecifier */; + } + ts.isExportSpecifier = isExportSpecifier; + function isModuleOrEnumDeclaration(node) { + return node.kind === 230 /* ModuleDeclaration */ || node.kind === 229 /* EnumDeclaration */; + } + ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; + function isDeclarationKind(kind) { + return kind === 185 /* ArrowFunction */ + || kind === 174 /* BindingElement */ + || kind === 226 /* ClassDeclaration */ + || kind === 197 /* ClassExpression */ + || kind === 150 /* Constructor */ + || kind === 229 /* EnumDeclaration */ + || kind === 260 /* EnumMember */ + || kind === 243 /* ExportSpecifier */ + || kind === 225 /* FunctionDeclaration */ + || kind === 184 /* FunctionExpression */ + || kind === 151 /* GetAccessor */ + || kind === 236 /* ImportClause */ + || kind === 234 /* ImportEqualsDeclaration */ + || kind === 239 /* ImportSpecifier */ + || kind === 227 /* InterfaceDeclaration */ + || kind === 149 /* MethodDeclaration */ + || kind === 148 /* MethodSignature */ + || kind === 230 /* ModuleDeclaration */ + || kind === 233 /* NamespaceExportDeclaration */ + || kind === 237 /* NamespaceImport */ + || kind === 144 /* Parameter */ + || kind === 257 /* PropertyAssignment */ + || kind === 147 /* PropertyDeclaration */ + || kind === 146 /* PropertySignature */ + || kind === 152 /* SetAccessor */ + || kind === 258 /* ShorthandPropertyAssignment */ + || kind === 228 /* TypeAliasDeclaration */ + || kind === 143 /* TypeParameter */ + || kind === 223 /* VariableDeclaration */ + || kind === 285 /* JSDocTypedefTag */; + } + function isDeclarationStatementKind(kind) { + return kind === 225 /* FunctionDeclaration */ + || kind === 244 /* MissingDeclaration */ + || kind === 226 /* ClassDeclaration */ + || kind === 227 /* InterfaceDeclaration */ + || kind === 228 /* TypeAliasDeclaration */ + || kind === 229 /* EnumDeclaration */ + || kind === 230 /* ModuleDeclaration */ + || kind === 235 /* ImportDeclaration */ + || kind === 234 /* ImportEqualsDeclaration */ + || kind === 241 /* ExportDeclaration */ + || kind === 240 /* ExportAssignment */ + || kind === 233 /* NamespaceExportDeclaration */; + } + function isStatementKindButNotDeclarationKind(kind) { + return kind === 215 /* BreakStatement */ + || kind === 214 /* ContinueStatement */ + || kind === 222 /* DebuggerStatement */ + || kind === 209 /* DoStatement */ + || kind === 207 /* ExpressionStatement */ + || kind === 206 /* EmptyStatement */ + || kind === 212 /* ForInStatement */ + || kind === 213 /* ForOfStatement */ + || kind === 211 /* ForStatement */ + || kind === 208 /* IfStatement */ + || kind === 219 /* LabeledStatement */ + || kind === 216 /* ReturnStatement */ + || kind === 218 /* SwitchStatement */ + || kind === 220 /* ThrowStatement */ + || kind === 221 /* TryStatement */ + || kind === 205 /* VariableStatement */ + || kind === 210 /* WhileStatement */ + || kind === 217 /* WithStatement */ + || kind === 293 /* NotEmittedStatement */ + || kind === 296 /* EndOfDeclarationMarker */ + || kind === 295 /* MergeDeclarationMarker */; + } + function isDeclaration(node) { + return isDeclarationKind(node.kind); + } + ts.isDeclaration = isDeclaration; + function isDeclarationStatement(node) { + return isDeclarationStatementKind(node.kind); + } + ts.isDeclarationStatement = isDeclarationStatement; + /** + * Determines whether the node is a statement that is not also a declaration + */ + function isStatementButNotDeclaration(node) { + return isStatementKindButNotDeclarationKind(node.kind); + } + ts.isStatementButNotDeclaration = isStatementButNotDeclaration; + function isStatement(node) { + var kind = node.kind; + return isStatementKindButNotDeclarationKind(kind) + || isDeclarationStatementKind(kind) + || kind === 204 /* Block */; + } + ts.isStatement = isStatement; + // Module references + function isModuleReference(node) { + var kind = node.kind; + return kind === 245 /* ExternalModuleReference */ + || kind === 141 /* QualifiedName */ + || kind === 70 /* Identifier */; + } + ts.isModuleReference = isModuleReference; + // JSX + function isJsxOpeningElement(node) { + return node.kind === 248 /* JsxOpeningElement */; + } + ts.isJsxOpeningElement = isJsxOpeningElement; + function isJsxClosingElement(node) { + return node.kind === 249 /* JsxClosingElement */; + } + ts.isJsxClosingElement = isJsxClosingElement; + function isJsxTagNameExpression(node) { + var kind = node.kind; + return kind === 98 /* ThisKeyword */ + || kind === 70 /* Identifier */ + || kind === 177 /* PropertyAccessExpression */; + } + ts.isJsxTagNameExpression = isJsxTagNameExpression; + function isJsxChild(node) { + var kind = node.kind; + return kind === 246 /* JsxElement */ + || kind === 252 /* JsxExpression */ + || kind === 247 /* JsxSelfClosingElement */ + || kind === 10 /* JsxText */; + } + ts.isJsxChild = isJsxChild; + function isJsxAttributeLike(node) { + var kind = node.kind; + return kind === 250 /* JsxAttribute */ + || kind === 251 /* JsxSpreadAttribute */; + } + ts.isJsxAttributeLike = isJsxAttributeLike; + function isJsxSpreadAttribute(node) { + return node.kind === 251 /* JsxSpreadAttribute */; + } + ts.isJsxSpreadAttribute = isJsxSpreadAttribute; + function isJsxAttribute(node) { + return node.kind === 250 /* JsxAttribute */; + } + ts.isJsxAttribute = isJsxAttribute; + function isStringLiteralOrJsxExpression(node) { + var kind = node.kind; + return kind === 9 /* StringLiteral */ + || kind === 252 /* JsxExpression */; + } + ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; + // Clauses + function isCaseOrDefaultClause(node) { + var kind = node.kind; + return kind === 253 /* CaseClause */ + || kind === 254 /* DefaultClause */; + } + ts.isCaseOrDefaultClause = isCaseOrDefaultClause; + function isHeritageClause(node) { + return node.kind === 255 /* HeritageClause */; + } + ts.isHeritageClause = isHeritageClause; + function isCatchClause(node) { + return node.kind === 256 /* CatchClause */; + } + ts.isCatchClause = isCatchClause; + // Property assignments + function isPropertyAssignment(node) { + return node.kind === 257 /* PropertyAssignment */; + } + ts.isPropertyAssignment = isPropertyAssignment; + function isShorthandPropertyAssignment(node) { + return node.kind === 258 /* ShorthandPropertyAssignment */; + } + ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; + // Enum + function isEnumMember(node) { + return node.kind === 260 /* EnumMember */; + } + ts.isEnumMember = isEnumMember; + // Top-level nodes + function isSourceFile(node) { + return node.kind === 261 /* SourceFile */; + } + ts.isSourceFile = isSourceFile; function isWatchSet(options) { // Firefox has Object.prototype.watch return options.watch && options.hasOwnProperty("watch"); } ts.isWatchSet = isWatchSet; })(ts || (ts = {})); -var ts; (function (ts) { function getDefaultLibFileName(options) { - return options.target === 2 /* ES6 */ ? "lib.es6.d.ts" : "lib.d.ts"; + switch (options.target) { + case 5 /* ESNext */: + case 4 /* ES2017 */: + return "lib.es2017.d.ts"; + case 3 /* ES2016 */: + return "lib.es2016.d.ts"; + case 2 /* ES2015 */: + return "lib.es6.d.ts"; + default: + return "lib.d.ts"; + } } ts.getDefaultLibFileName = getDefaultLibFileName; function textSpanEnd(span) { @@ -8197,9 +10530,9 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 141 /* TypeParameter */) { + if (d && d.kind === 143 /* TypeParameter */) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 222 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 227 /* InterfaceDeclaration */) { return current; } } @@ -8207,12 +10540,3310 @@ var ts; } ts.getTypeParameterOwner = getTypeParameterOwner; function isParameterPropertyDeclaration(node) { - return node.flags & 92 /* ParameterPropertyModifier */ && node.parent.kind === 148 /* Constructor */ && ts.isClassLike(node.parent.parent); + return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) && node.parent.kind === 150 /* Constructor */ && ts.isClassLike(node.parent.parent); } ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; + function walkUpBindingElementsAndPatterns(node) { + while (node && (node.kind === 174 /* BindingElement */ || ts.isBindingPattern(node))) { + node = node.parent; + } + return node; + } + function getCombinedModifierFlags(node) { + node = walkUpBindingElementsAndPatterns(node); + var flags = ts.getModifierFlags(node); + if (node.kind === 223 /* VariableDeclaration */) { + node = node.parent; + } + if (node && node.kind === 224 /* VariableDeclarationList */) { + flags |= ts.getModifierFlags(node); + node = node.parent; + } + if (node && node.kind === 205 /* VariableStatement */) { + flags |= ts.getModifierFlags(node); + } + return flags; + } + ts.getCombinedModifierFlags = getCombinedModifierFlags; + // Returns the node flags for this node and all relevant parent nodes. This is done so that + // nodes like variable declarations and binding elements can returned a view of their flags + // that includes the modifiers from their container. i.e. flags like export/declare aren't + // stored on the variable declaration directly, but on the containing variable statement + // (if it has one). Similarly, flags for let/const are store on the variable declaration + // list. By calling this function, all those flags are combined so that the client can treat + // the node as if it actually had those flags. + function getCombinedNodeFlags(node) { + node = walkUpBindingElementsAndPatterns(node); + var flags = node.flags; + if (node.kind === 223 /* VariableDeclaration */) { + node = node.parent; + } + if (node && node.kind === 224 /* VariableDeclarationList */) { + flags |= node.flags; + node = node.parent; + } + if (node && node.kind === 205 /* VariableStatement */) { + flags |= node.flags; + } + 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 = {})); +/// +/// +/* @internal */ +var ts; +(function (ts) { + var NodeConstructor; + var SourceFileConstructor; + function createNode(kind, location, flags) { + var ConstructorForKind = kind === 261 /* SourceFile */ + ? (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor())) + : (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor())); + var node = location + ? new ConstructorForKind(kind, location.pos, location.end) + : new ConstructorForKind(kind, /*pos*/ -1, /*end*/ -1); + node.flags = flags | 8 /* Synthesized */; + return node; + } + function updateNode(updated, original) { + if (updated !== original) { + setOriginalNode(updated, original); + if (original.startsOnNewLine) { + updated.startsOnNewLine = true; + } + ts.aggregateTransformFlags(updated); + } + return updated; + } + ts.updateNode = updateNode; + function createNodeArray(elements, location, hasTrailingComma) { + if (elements) { + if (ts.isNodeArray(elements)) { + return elements; + } + } + else { + elements = []; + } + var array = elements; + if (location) { + array.pos = location.pos; + array.end = location.end; + } + else { + array.pos = -1; + array.end = -1; + } + if (hasTrailingComma) { + array.hasTrailingComma = true; + } + return array; + } + ts.createNodeArray = createNodeArray; + function createSynthesizedNode(kind, startsOnNewLine) { + var node = createNode(kind, /*location*/ undefined); + node.startsOnNewLine = startsOnNewLine; + return node; + } + ts.createSynthesizedNode = createSynthesizedNode; + function createSynthesizedNodeArray(elements) { + return createNodeArray(elements, /*location*/ undefined); + } + ts.createSynthesizedNodeArray = createSynthesizedNodeArray; + /** + * Creates a shallow, memberwise clone of a node with no source map location. + */ + function getSynthesizedClone(node) { + // We don't use "clone" from core.ts here, as we need to preserve the prototype chain of + // the original node. We also need to exclude specific properties and only include own- + // properties (to skip members already defined on the shared prototype). + var clone = createNode(node.kind, /*location*/ undefined, node.flags); + setOriginalNode(clone, node); + for (var key in node) { + if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) { + continue; + } + clone[key] = node[key]; + } + return clone; + } + ts.getSynthesizedClone = getSynthesizedClone; + /** + * Creates a shallow, memberwise clone of a node for mutation. + */ + function getMutableClone(node) { + var clone = getSynthesizedClone(node); + clone.pos = node.pos; + clone.end = node.end; + clone.parent = node.parent; + return clone; + } + ts.getMutableClone = getMutableClone; + function createLiteral(value, location) { + if (typeof value === "number") { + var node = createNode(8 /* NumericLiteral */, location, /*flags*/ undefined); + node.text = value.toString(); + return node; + } + else if (typeof value === "boolean") { + return createNode(value ? 100 /* TrueKeyword */ : 85 /* FalseKeyword */, location, /*flags*/ undefined); + } + else if (typeof value === "string") { + var node = createNode(9 /* StringLiteral */, location, /*flags*/ undefined); + node.text = value; + return node; + } + else if (value) { + var node = createNode(9 /* StringLiteral */, location, /*flags*/ undefined); + node.textSourceNode = value; + node.text = value.text; + return node; + } + } + ts.createLiteral = createLiteral; + // Identifiers + var nextAutoGenerateId = 0; + function createIdentifier(text, location) { + var node = createNode(70 /* Identifier */, location); + node.text = ts.escapeIdentifier(text); + node.originalKeywordKind = ts.stringToToken(text); + node.autoGenerateKind = 0 /* None */; + node.autoGenerateId = 0; + return node; + } + ts.createIdentifier = createIdentifier; + function createTempVariable(recordTempVariable, location) { + var name = createNode(70 /* Identifier */, location); + name.text = ""; + name.originalKeywordKind = 0 /* Unknown */; + name.autoGenerateKind = 1 /* Auto */; + name.autoGenerateId = nextAutoGenerateId; + nextAutoGenerateId++; + if (recordTempVariable) { + recordTempVariable(name); + } + return name; + } + ts.createTempVariable = createTempVariable; + function createLoopVariable(location) { + var name = createNode(70 /* Identifier */, location); + name.text = ""; + name.originalKeywordKind = 0 /* Unknown */; + name.autoGenerateKind = 2 /* Loop */; + name.autoGenerateId = nextAutoGenerateId; + nextAutoGenerateId++; + return name; + } + ts.createLoopVariable = createLoopVariable; + function createUniqueName(text, location) { + var name = createNode(70 /* Identifier */, location); + name.text = text; + name.originalKeywordKind = 0 /* Unknown */; + name.autoGenerateKind = 3 /* Unique */; + name.autoGenerateId = nextAutoGenerateId; + nextAutoGenerateId++; + return name; + } + ts.createUniqueName = createUniqueName; + function getGeneratedNameForNode(node, location) { + var name = createNode(70 /* Identifier */, location); + name.original = node; + name.text = ""; + name.originalKeywordKind = 0 /* Unknown */; + name.autoGenerateKind = 4 /* Node */; + name.autoGenerateId = nextAutoGenerateId; + nextAutoGenerateId++; + return name; + } + ts.getGeneratedNameForNode = getGeneratedNameForNode; + // Punctuation + function createToken(token) { + return createNode(token); + } + ts.createToken = createToken; + // Reserved words + function createSuper() { + var node = createNode(96 /* SuperKeyword */); + return node; + } + ts.createSuper = createSuper; + function createThis(location) { + var node = createNode(98 /* ThisKeyword */, location); + return node; + } + ts.createThis = createThis; + function createNull() { + var node = createNode(94 /* NullKeyword */); + return node; + } + ts.createNull = createNull; + // Names + function createComputedPropertyName(expression, location) { + var node = createNode(142 /* ComputedPropertyName */, location); + node.expression = expression; + return node; + } + ts.createComputedPropertyName = createComputedPropertyName; + function updateComputedPropertyName(node, expression) { + if (node.expression !== expression) { + return updateNode(createComputedPropertyName(expression, node), node); + } + return node; + } + ts.updateComputedPropertyName = updateComputedPropertyName; + // Signature elements + function createParameter(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer, location, flags) { + var node = createNode(144 /* Parameter */, location, flags); + node.decorators = decorators ? createNodeArray(decorators) : undefined; + node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + node.dotDotDotToken = dotDotDotToken; + node.name = typeof name === "string" ? createIdentifier(name) : name; + node.questionToken = questionToken; + node.type = type; + node.initializer = initializer ? parenthesizeExpressionForList(initializer) : undefined; + return node; + } + ts.createParameter = createParameter; + 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; + } + ts.updateParameter = updateParameter; + // Type members + function createProperty(decorators, modifiers, name, questionToken, type, initializer, location) { + var node = createNode(147 /* PropertyDeclaration */, location); + node.decorators = decorators ? createNodeArray(decorators) : undefined; + node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + node.name = typeof name === "string" ? createIdentifier(name) : name; + node.questionToken = questionToken; + node.type = type; + node.initializer = initializer; + return node; + } + ts.createProperty = createProperty; + function updateProperty(node, decorators, modifiers, name, type, initializer) { + if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.type !== type || node.initializer !== initializer) { + return updateNode(createProperty(decorators, modifiers, name, node.questionToken, type, initializer, node), node); + } + return node; + } + ts.updateProperty = updateProperty; + function createMethod(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { + var node = createNode(149 /* MethodDeclaration */, location, flags); + node.decorators = decorators ? createNodeArray(decorators) : undefined; + node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + node.asteriskToken = asteriskToken; + node.name = typeof name === "string" ? createIdentifier(name) : name; + node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; + node.parameters = createNodeArray(parameters); + node.type = type; + node.body = body; + return node; + } + ts.createMethod = createMethod; + function updateMethod(node, decorators, modifiers, name, typeParameters, parameters, type, body) { + if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) { + return updateNode(createMethod(decorators, modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, /*location*/ node, node.flags), node); + } + return node; + } + ts.updateMethod = updateMethod; + function createConstructor(decorators, modifiers, parameters, body, location, flags) { + var node = createNode(150 /* Constructor */, location, flags); + node.decorators = decorators ? createNodeArray(decorators) : undefined; + node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + node.typeParameters = undefined; + node.parameters = createNodeArray(parameters); + node.type = undefined; + node.body = body; + return node; + } + ts.createConstructor = createConstructor; + function updateConstructor(node, decorators, modifiers, parameters, body) { + if (node.decorators !== decorators || node.modifiers !== modifiers || node.parameters !== parameters || node.body !== body) { + return updateNode(createConstructor(decorators, modifiers, parameters, body, /*location*/ node, node.flags), node); + } + return node; + } + ts.updateConstructor = updateConstructor; + function createGetAccessor(decorators, modifiers, name, parameters, type, body, location, flags) { + var node = createNode(151 /* GetAccessor */, location, flags); + node.decorators = decorators ? createNodeArray(decorators) : undefined; + node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + node.name = typeof name === "string" ? createIdentifier(name) : name; + node.typeParameters = undefined; + node.parameters = createNodeArray(parameters); + node.type = type; + node.body = body; + return node; + } + ts.createGetAccessor = createGetAccessor; + function updateGetAccessor(node, decorators, modifiers, name, parameters, type, body) { + if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.parameters !== parameters || node.type !== type || node.body !== body) { + return updateNode(createGetAccessor(decorators, modifiers, name, parameters, type, body, /*location*/ node, node.flags), node); + } + return node; + } + ts.updateGetAccessor = updateGetAccessor; + function createSetAccessor(decorators, modifiers, name, parameters, body, location, flags) { + var node = createNode(152 /* SetAccessor */, location, flags); + node.decorators = decorators ? createNodeArray(decorators) : undefined; + node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + node.name = typeof name === "string" ? createIdentifier(name) : name; + node.typeParameters = undefined; + node.parameters = createNodeArray(parameters); + node.body = body; + return node; + } + ts.createSetAccessor = createSetAccessor; + function updateSetAccessor(node, decorators, modifiers, name, parameters, body) { + if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.parameters !== parameters || node.body !== body) { + return updateNode(createSetAccessor(decorators, modifiers, name, parameters, body, /*location*/ node, node.flags), node); + } + return node; + } + ts.updateSetAccessor = updateSetAccessor; + // Binding Patterns + function createObjectBindingPattern(elements, location) { + var node = createNode(172 /* ObjectBindingPattern */, location); + node.elements = createNodeArray(elements); + return node; + } + ts.createObjectBindingPattern = createObjectBindingPattern; + function updateObjectBindingPattern(node, elements) { + if (node.elements !== elements) { + return updateNode(createObjectBindingPattern(elements, node), node); + } + return node; + } + ts.updateObjectBindingPattern = updateObjectBindingPattern; + function createArrayBindingPattern(elements, location) { + var node = createNode(173 /* ArrayBindingPattern */, location); + node.elements = createNodeArray(elements); + return node; + } + ts.createArrayBindingPattern = createArrayBindingPattern; + function updateArrayBindingPattern(node, elements) { + if (node.elements !== elements) { + return updateNode(createArrayBindingPattern(elements, node), node); + } + return node; + } + ts.updateArrayBindingPattern = updateArrayBindingPattern; + function createBindingElement(propertyName, dotDotDotToken, name, initializer, location) { + var node = createNode(174 /* BindingElement */, location); + node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName; + node.dotDotDotToken = dotDotDotToken; + node.name = typeof name === "string" ? createIdentifier(name) : name; + node.initializer = initializer; + return node; + } + ts.createBindingElement = createBindingElement; + 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; + } + ts.updateBindingElement = updateBindingElement; + // Expression + function createArrayLiteral(elements, location, multiLine) { + var node = createNode(175 /* ArrayLiteralExpression */, location); + node.elements = parenthesizeListElements(createNodeArray(elements)); + if (multiLine) { + node.multiLine = true; + } + return node; + } + ts.createArrayLiteral = createArrayLiteral; + function updateArrayLiteral(node, elements) { + if (node.elements !== elements) { + return updateNode(createArrayLiteral(elements, node, node.multiLine), node); + } + return node; + } + ts.updateArrayLiteral = updateArrayLiteral; + function createObjectLiteral(properties, location, multiLine) { + var node = createNode(176 /* ObjectLiteralExpression */, location); + node.properties = createNodeArray(properties); + if (multiLine) { + node.multiLine = true; + } + return node; + } + ts.createObjectLiteral = createObjectLiteral; + function updateObjectLiteral(node, properties) { + if (node.properties !== properties) { + return updateNode(createObjectLiteral(properties, node, node.multiLine), node); + } + return node; + } + ts.updateObjectLiteral = updateObjectLiteral; + function createPropertyAccess(expression, name, location, flags) { + var node = createNode(177 /* PropertyAccessExpression */, location, flags); + node.expression = parenthesizeForAccess(expression); + (node.emitNode || (node.emitNode = {})).flags |= 65536 /* NoIndentation */; + node.name = typeof name === "string" ? createIdentifier(name) : name; + return node; + } + ts.createPropertyAccess = createPropertyAccess; + function updatePropertyAccess(node, expression, name) { + if (node.expression !== expression || node.name !== name) { + var propertyAccess = createPropertyAccess(expression, name, /*location*/ node, node.flags); + // Because we are updating existed propertyAccess we want to inherit its emitFlags instead of using default from createPropertyAccess + (propertyAccess.emitNode || (propertyAccess.emitNode = {})).flags = getEmitFlags(node); + return updateNode(propertyAccess, node); + } + return node; + } + ts.updatePropertyAccess = updatePropertyAccess; + function createElementAccess(expression, index, location) { + var node = createNode(178 /* ElementAccessExpression */, location); + node.expression = parenthesizeForAccess(expression); + node.argumentExpression = typeof index === "number" ? createLiteral(index) : index; + return node; + } + ts.createElementAccess = createElementAccess; + function updateElementAccess(node, expression, argumentExpression) { + if (node.expression !== expression || node.argumentExpression !== argumentExpression) { + return updateNode(createElementAccess(expression, argumentExpression, node), node); + } + return node; + } + ts.updateElementAccess = updateElementAccess; + function createCall(expression, typeArguments, argumentsArray, location, flags) { + var node = createNode(179 /* CallExpression */, location, flags); + node.expression = parenthesizeForAccess(expression); + if (typeArguments) { + node.typeArguments = createNodeArray(typeArguments); + } + node.arguments = parenthesizeListElements(createNodeArray(argumentsArray)); + return node; + } + ts.createCall = createCall; + function updateCall(node, expression, typeArguments, argumentsArray) { + if (expression !== node.expression || typeArguments !== node.typeArguments || argumentsArray !== node.arguments) { + return updateNode(createCall(expression, typeArguments, argumentsArray, /*location*/ node, node.flags), node); + } + return node; + } + ts.updateCall = updateCall; + function createNew(expression, typeArguments, argumentsArray, location, flags) { + var node = createNode(180 /* NewExpression */, location, flags); + node.expression = parenthesizeForNew(expression); + node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined; + node.arguments = argumentsArray ? parenthesizeListElements(createNodeArray(argumentsArray)) : undefined; + return node; + } + ts.createNew = createNew; + function updateNew(node, expression, typeArguments, argumentsArray) { + if (node.expression !== expression || node.typeArguments !== typeArguments || node.arguments !== argumentsArray) { + return updateNode(createNew(expression, typeArguments, argumentsArray, /*location*/ node, node.flags), node); + } + return node; + } + ts.updateNew = updateNew; + function createTaggedTemplate(tag, template, location) { + var node = createNode(181 /* TaggedTemplateExpression */, location); + node.tag = parenthesizeForAccess(tag); + node.template = template; + return node; + } + ts.createTaggedTemplate = createTaggedTemplate; + function updateTaggedTemplate(node, tag, template) { + if (node.tag !== tag || node.template !== template) { + return updateNode(createTaggedTemplate(tag, template, node), node); + } + return node; + } + ts.updateTaggedTemplate = updateTaggedTemplate; + function createParen(expression, location) { + var node = createNode(183 /* ParenthesizedExpression */, location); + node.expression = expression; + return node; + } + ts.createParen = createParen; + function updateParen(node, expression) { + if (node.expression !== expression) { + return updateNode(createParen(expression, node), node); + } + return node; + } + ts.updateParen = updateParen; + function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { + var node = createNode(184 /* FunctionExpression */, location, flags); + node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + node.asteriskToken = asteriskToken; + node.name = typeof name === "string" ? createIdentifier(name) : name; + node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; + node.parameters = createNodeArray(parameters); + node.type = type; + node.body = body; + return node; + } + ts.createFunctionExpression = createFunctionExpression; + function updateFunctionExpression(node, modifiers, name, typeParameters, parameters, type, body) { + if (node.name !== name || node.modifiers !== modifiers || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) { + return updateNode(createFunctionExpression(modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, /*location*/ node, node.flags), node); + } + return node; + } + ts.updateFunctionExpression = updateFunctionExpression; + function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body, location, flags) { + var node = createNode(185 /* ArrowFunction */, location, flags); + node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; + node.parameters = createNodeArray(parameters); + node.type = type; + node.equalsGreaterThanToken = equalsGreaterThanToken || createToken(35 /* EqualsGreaterThanToken */); + node.body = parenthesizeConciseBody(body); + return node; + } + ts.createArrowFunction = createArrowFunction; + function updateArrowFunction(node, modifiers, typeParameters, parameters, type, body) { + if (node.modifiers !== modifiers || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) { + return updateNode(createArrowFunction(modifiers, typeParameters, parameters, type, node.equalsGreaterThanToken, body, /*location*/ node, node.flags), node); + } + return node; + } + ts.updateArrowFunction = updateArrowFunction; + function createDelete(expression, location) { + var node = createNode(186 /* DeleteExpression */, location); + node.expression = parenthesizePrefixOperand(expression); + return node; + } + ts.createDelete = createDelete; + function updateDelete(node, expression) { + if (node.expression !== expression) { + return updateNode(createDelete(expression, node), expression); + } + return node; + } + ts.updateDelete = updateDelete; + function createTypeOf(expression, location) { + var node = createNode(187 /* TypeOfExpression */, location); + node.expression = parenthesizePrefixOperand(expression); + return node; + } + ts.createTypeOf = createTypeOf; + function updateTypeOf(node, expression) { + if (node.expression !== expression) { + return updateNode(createTypeOf(expression, node), expression); + } + return node; + } + ts.updateTypeOf = updateTypeOf; + function createVoid(expression, location) { + var node = createNode(188 /* VoidExpression */, location); + node.expression = parenthesizePrefixOperand(expression); + return node; + } + ts.createVoid = createVoid; + function updateVoid(node, expression) { + if (node.expression !== expression) { + return updateNode(createVoid(expression, node), node); + } + return node; + } + ts.updateVoid = updateVoid; + function createAwait(expression, location) { + var node = createNode(189 /* AwaitExpression */, location); + node.expression = parenthesizePrefixOperand(expression); + return node; + } + ts.createAwait = createAwait; + function updateAwait(node, expression) { + if (node.expression !== expression) { + return updateNode(createAwait(expression, node), node); + } + return node; + } + ts.updateAwait = updateAwait; + function createPrefix(operator, operand, location) { + var node = createNode(190 /* PrefixUnaryExpression */, location); + node.operator = operator; + node.operand = parenthesizePrefixOperand(operand); + return node; + } + ts.createPrefix = createPrefix; + function updatePrefix(node, operand) { + if (node.operand !== operand) { + return updateNode(createPrefix(node.operator, operand, node), node); + } + return node; + } + ts.updatePrefix = updatePrefix; + function createPostfix(operand, operator, location) { + var node = createNode(191 /* PostfixUnaryExpression */, location); + node.operand = parenthesizePostfixOperand(operand); + node.operator = operator; + return node; + } + ts.createPostfix = createPostfix; + function updatePostfix(node, operand) { + if (node.operand !== operand) { + return updateNode(createPostfix(operand, node.operator, node), node); + } + return node; + } + ts.updatePostfix = updatePostfix; + function createBinary(left, operator, right, location) { + var operatorToken = typeof operator === "number" ? createToken(operator) : operator; + var operatorKind = operatorToken.kind; + var node = createNode(192 /* BinaryExpression */, location); + node.left = parenthesizeBinaryOperand(operatorKind, left, /*isLeftSideOfBinary*/ true, /*leftOperand*/ undefined); + node.operatorToken = operatorToken; + node.right = parenthesizeBinaryOperand(operatorKind, right, /*isLeftSideOfBinary*/ false, node.left); + return node; + } + ts.createBinary = createBinary; + function updateBinary(node, left, right) { + if (node.left !== left || node.right !== right) { + return updateNode(createBinary(left, node.operatorToken, right, /*location*/ node), node); + } + return node; + } + ts.updateBinary = updateBinary; + 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; + function updateConditional(node, condition, whenTrue, whenFalse) { + if (node.condition !== condition || node.whenTrue !== whenTrue || node.whenFalse !== whenFalse) { + return updateNode(createConditional(condition, node.questionToken, whenTrue, node.colonToken, whenFalse, node), node); + } + return node; + } + ts.updateConditional = updateConditional; + function createTemplateExpression(head, templateSpans, location) { + var node = createNode(194 /* TemplateExpression */, location); + node.head = head; + node.templateSpans = createNodeArray(templateSpans); + return node; + } + ts.createTemplateExpression = createTemplateExpression; + function updateTemplateExpression(node, head, templateSpans) { + if (node.head !== head || node.templateSpans !== templateSpans) { + return updateNode(createTemplateExpression(head, templateSpans, node), node); + } + return node; + } + ts.updateTemplateExpression = updateTemplateExpression; + function createYield(asteriskToken, expression, location) { + var node = createNode(195 /* YieldExpression */, location); + node.asteriskToken = asteriskToken; + node.expression = expression; + return node; + } + ts.createYield = createYield; + function updateYield(node, expression) { + if (node.expression !== expression) { + return updateNode(createYield(node.asteriskToken, expression, node), node); + } + return node; + } + ts.updateYield = updateYield; + function createSpread(expression, location) { + var node = createNode(196 /* SpreadElement */, location); + node.expression = parenthesizeExpressionForList(expression); + return node; + } + ts.createSpread = createSpread; + function updateSpread(node, expression) { + if (node.expression !== expression) { + return updateNode(createSpread(expression, node), node); + } + return node; + } + ts.updateSpread = updateSpread; + function createClassExpression(modifiers, name, typeParameters, heritageClauses, members, location) { + var node = createNode(197 /* ClassExpression */, location); + node.decorators = undefined; + node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + node.name = name; + node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; + node.heritageClauses = createNodeArray(heritageClauses); + node.members = createNodeArray(members); + return node; + } + ts.createClassExpression = createClassExpression; + function updateClassExpression(node, modifiers, name, typeParameters, heritageClauses, members) { + if (node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members) { + return updateNode(createClassExpression(modifiers, name, typeParameters, heritageClauses, members, node), node); + } + return node; + } + ts.updateClassExpression = updateClassExpression; + function createOmittedExpression(location) { + var node = createNode(198 /* OmittedExpression */, location); + return node; + } + ts.createOmittedExpression = createOmittedExpression; + function createExpressionWithTypeArguments(typeArguments, expression, location) { + var node = createNode(199 /* ExpressionWithTypeArguments */, location); + node.typeArguments = typeArguments ? createNodeArray(typeArguments) : undefined; + node.expression = parenthesizeForAccess(expression); + return node; + } + ts.createExpressionWithTypeArguments = createExpressionWithTypeArguments; + function updateExpressionWithTypeArguments(node, typeArguments, expression) { + if (node.typeArguments !== typeArguments || node.expression !== expression) { + return updateNode(createExpressionWithTypeArguments(typeArguments, expression, node), node); + } + return node; + } + ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments; + // Misc + function createTemplateSpan(expression, literal, location) { + var node = createNode(202 /* TemplateSpan */, location); + node.expression = expression; + node.literal = literal; + return node; + } + ts.createTemplateSpan = createTemplateSpan; + function updateTemplateSpan(node, expression, literal) { + if (node.expression !== expression || node.literal !== literal) { + return updateNode(createTemplateSpan(expression, literal, node), node); + } + return node; + } + ts.updateTemplateSpan = updateTemplateSpan; + // Element + function createBlock(statements, location, multiLine, flags) { + var block = createNode(204 /* Block */, location, flags); + block.statements = createNodeArray(statements); + if (multiLine) { + block.multiLine = true; + } + return block; + } + ts.createBlock = createBlock; + function updateBlock(node, statements) { + if (statements !== node.statements) { + return updateNode(createBlock(statements, /*location*/ node, node.multiLine, node.flags), node); + } + return node; + } + ts.updateBlock = updateBlock; + function createVariableStatement(modifiers, declarationList, location, flags) { + var node = createNode(205 /* VariableStatement */, location, flags); + node.decorators = undefined; + node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; + return node; + } + ts.createVariableStatement = createVariableStatement; + function updateVariableStatement(node, modifiers, declarationList) { + if (node.modifiers !== modifiers || node.declarationList !== declarationList) { + return updateNode(createVariableStatement(modifiers, declarationList, /*location*/ node, node.flags), node); + } + return node; + } + ts.updateVariableStatement = updateVariableStatement; + function createVariableDeclarationList(declarations, location, flags) { + var node = createNode(224 /* VariableDeclarationList */, location, flags); + node.declarations = createNodeArray(declarations); + return node; + } + ts.createVariableDeclarationList = createVariableDeclarationList; + function updateVariableDeclarationList(node, declarations) { + if (node.declarations !== declarations) { + return updateNode(createVariableDeclarationList(declarations, /*location*/ node, node.flags), node); + } + return node; + } + ts.updateVariableDeclarationList = updateVariableDeclarationList; + function createVariableDeclaration(name, type, initializer, location, flags) { + var node = createNode(223 /* VariableDeclaration */, location, flags); + node.name = typeof name === "string" ? createIdentifier(name) : name; + node.type = type; + node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined; + return node; + } + ts.createVariableDeclaration = createVariableDeclaration; + function updateVariableDeclaration(node, name, type, initializer) { + if (node.name !== name || node.type !== type || node.initializer !== initializer) { + return updateNode(createVariableDeclaration(name, type, initializer, /*location*/ node, node.flags), node); + } + return node; + } + ts.updateVariableDeclaration = updateVariableDeclaration; + function createEmptyStatement(location) { + return createNode(206 /* EmptyStatement */, location); + } + ts.createEmptyStatement = createEmptyStatement; + function createStatement(expression, location, flags) { + var node = createNode(207 /* ExpressionStatement */, location, flags); + node.expression = parenthesizeExpressionForExpressionStatement(expression); + return node; + } + ts.createStatement = createStatement; + function updateStatement(node, expression) { + if (node.expression !== expression) { + return updateNode(createStatement(expression, /*location*/ node, node.flags), node); + } + return node; + } + ts.updateStatement = updateStatement; + function createIf(expression, thenStatement, elseStatement, location) { + var node = createNode(208 /* IfStatement */, location); + node.expression = expression; + node.thenStatement = thenStatement; + node.elseStatement = elseStatement; + return node; + } + ts.createIf = createIf; + function updateIf(node, expression, thenStatement, elseStatement) { + if (node.expression !== expression || node.thenStatement !== thenStatement || node.elseStatement !== elseStatement) { + return updateNode(createIf(expression, thenStatement, elseStatement, /*location*/ node), node); + } + return node; + } + ts.updateIf = updateIf; + function createDo(statement, expression, location) { + var node = createNode(209 /* DoStatement */, location); + node.statement = statement; + node.expression = expression; + return node; + } + ts.createDo = createDo; + function updateDo(node, statement, expression) { + if (node.statement !== statement || node.expression !== expression) { + return updateNode(createDo(statement, expression, node), node); + } + return node; + } + ts.updateDo = updateDo; + function createWhile(expression, statement, location) { + var node = createNode(210 /* WhileStatement */, location); + node.expression = expression; + node.statement = statement; + return node; + } + ts.createWhile = createWhile; + function updateWhile(node, expression, statement) { + if (node.expression !== expression || node.statement !== statement) { + return updateNode(createWhile(expression, statement, node), node); + } + return node; + } + ts.updateWhile = updateWhile; + function createFor(initializer, condition, incrementor, statement, location) { + var node = createNode(211 /* ForStatement */, location, /*flags*/ undefined); + node.initializer = initializer; + node.condition = condition; + node.incrementor = incrementor; + node.statement = statement; + return node; + } + ts.createFor = createFor; + function updateFor(node, initializer, condition, incrementor, statement) { + if (node.initializer !== initializer || node.condition !== condition || node.incrementor !== incrementor || node.statement !== statement) { + return updateNode(createFor(initializer, condition, incrementor, statement, node), node); + } + return node; + } + ts.updateFor = updateFor; + function createForIn(initializer, expression, statement, location) { + var node = createNode(212 /* ForInStatement */, location); + node.initializer = initializer; + node.expression = expression; + node.statement = statement; + return node; + } + ts.createForIn = createForIn; + function updateForIn(node, initializer, expression, statement) { + if (node.initializer !== initializer || node.expression !== expression || node.statement !== statement) { + return updateNode(createForIn(initializer, expression, statement, node), node); + } + return node; + } + ts.updateForIn = updateForIn; + function createForOf(initializer, expression, statement, location) { + var node = createNode(213 /* ForOfStatement */, location); + node.initializer = initializer; + node.expression = expression; + node.statement = statement; + return node; + } + ts.createForOf = createForOf; + function updateForOf(node, initializer, expression, statement) { + if (node.initializer !== initializer || node.expression !== expression || node.statement !== statement) { + return updateNode(createForOf(initializer, expression, statement, node), node); + } + return node; + } + ts.updateForOf = updateForOf; + function createContinue(label, location) { + var node = createNode(214 /* ContinueStatement */, location); + if (label) { + node.label = label; + } + return node; + } + ts.createContinue = createContinue; + function updateContinue(node, label) { + if (node.label !== label) { + return updateNode(createContinue(label, node), node); + } + return node; + } + ts.updateContinue = updateContinue; + function createBreak(label, location) { + var node = createNode(215 /* BreakStatement */, location); + if (label) { + node.label = label; + } + return node; + } + ts.createBreak = createBreak; + function updateBreak(node, label) { + if (node.label !== label) { + return updateNode(createBreak(label, node), node); + } + return node; + } + ts.updateBreak = updateBreak; + function createReturn(expression, location) { + var node = createNode(216 /* ReturnStatement */, location); + node.expression = expression; + return node; + } + ts.createReturn = createReturn; + function updateReturn(node, expression) { + if (node.expression !== expression) { + return updateNode(createReturn(expression, /*location*/ node), node); + } + return node; + } + ts.updateReturn = updateReturn; + function createWith(expression, statement, location) { + var node = createNode(217 /* WithStatement */, location); + node.expression = expression; + node.statement = statement; + return node; + } + ts.createWith = createWith; + function updateWith(node, expression, statement) { + if (node.expression !== expression || node.statement !== statement) { + return updateNode(createWith(expression, statement, node), node); + } + return node; + } + ts.updateWith = updateWith; + function createSwitch(expression, caseBlock, location) { + var node = createNode(218 /* SwitchStatement */, location); + node.expression = parenthesizeExpressionForList(expression); + node.caseBlock = caseBlock; + return node; + } + ts.createSwitch = createSwitch; + function updateSwitch(node, expression, caseBlock) { + if (node.expression !== expression || node.caseBlock !== caseBlock) { + return updateNode(createSwitch(expression, caseBlock, node), node); + } + return node; + } + ts.updateSwitch = updateSwitch; + function createLabel(label, statement, location) { + var node = createNode(219 /* LabeledStatement */, location); + node.label = typeof label === "string" ? createIdentifier(label) : label; + node.statement = statement; + return node; + } + ts.createLabel = createLabel; + function updateLabel(node, label, statement) { + if (node.label !== label || node.statement !== statement) { + return updateNode(createLabel(label, statement, node), node); + } + return node; + } + ts.updateLabel = updateLabel; + function createThrow(expression, location) { + var node = createNode(220 /* ThrowStatement */, location); + node.expression = expression; + return node; + } + ts.createThrow = createThrow; + function updateThrow(node, expression) { + if (node.expression !== expression) { + return updateNode(createThrow(expression, node), node); + } + return node; + } + ts.updateThrow = updateThrow; + function createTry(tryBlock, catchClause, finallyBlock, location) { + var node = createNode(221 /* TryStatement */, location); + node.tryBlock = tryBlock; + node.catchClause = catchClause; + node.finallyBlock = finallyBlock; + return node; + } + ts.createTry = createTry; + function updateTry(node, tryBlock, catchClause, finallyBlock) { + if (node.tryBlock !== tryBlock || node.catchClause !== catchClause || node.finallyBlock !== finallyBlock) { + return updateNode(createTry(tryBlock, catchClause, finallyBlock, node), node); + } + return node; + } + ts.updateTry = updateTry; + function createCaseBlock(clauses, location) { + var node = createNode(232 /* CaseBlock */, location); + node.clauses = createNodeArray(clauses); + return node; + } + ts.createCaseBlock = createCaseBlock; + function updateCaseBlock(node, clauses) { + if (node.clauses !== clauses) { + return updateNode(createCaseBlock(clauses, node), node); + } + return node; + } + ts.updateCaseBlock = updateCaseBlock; + function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body, location, flags) { + var node = createNode(225 /* FunctionDeclaration */, location, flags); + node.decorators = decorators ? createNodeArray(decorators) : undefined; + node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + node.asteriskToken = asteriskToken; + node.name = typeof name === "string" ? createIdentifier(name) : name; + node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; + node.parameters = createNodeArray(parameters); + node.type = type; + node.body = body; + return node; + } + ts.createFunctionDeclaration = createFunctionDeclaration; + function updateFunctionDeclaration(node, decorators, modifiers, name, typeParameters, parameters, type, body) { + if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body) { + return updateNode(createFunctionDeclaration(decorators, modifiers, node.asteriskToken, name, typeParameters, parameters, type, body, /*location*/ node, node.flags), node); + } + return node; + } + ts.updateFunctionDeclaration = updateFunctionDeclaration; + function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, location) { + var node = createNode(226 /* ClassDeclaration */, location); + node.decorators = decorators ? createNodeArray(decorators) : undefined; + node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + node.name = name; + node.typeParameters = typeParameters ? createNodeArray(typeParameters) : undefined; + node.heritageClauses = createNodeArray(heritageClauses); + node.members = createNodeArray(members); + return node; + } + ts.createClassDeclaration = createClassDeclaration; + function updateClassDeclaration(node, decorators, modifiers, name, typeParameters, heritageClauses, members) { + if (node.decorators !== decorators || node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members) { + return updateNode(createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members, node), node); + } + return node; + } + ts.updateClassDeclaration = updateClassDeclaration; + function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, location) { + var node = createNode(235 /* ImportDeclaration */, location); + node.decorators = decorators ? createNodeArray(decorators) : undefined; + node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + node.importClause = importClause; + node.moduleSpecifier = moduleSpecifier; + return node; + } + ts.createImportDeclaration = createImportDeclaration; + function updateImportDeclaration(node, decorators, modifiers, importClause, moduleSpecifier) { + if (node.decorators !== decorators || node.modifiers !== modifiers || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier) { + return updateNode(createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier, node), node); + } + return node; + } + ts.updateImportDeclaration = updateImportDeclaration; + function createImportClause(name, namedBindings, location) { + var node = createNode(236 /* ImportClause */, location); + node.name = name; + node.namedBindings = namedBindings; + return node; + } + ts.createImportClause = createImportClause; + function updateImportClause(node, name, namedBindings) { + if (node.name !== name || node.namedBindings !== namedBindings) { + return updateNode(createImportClause(name, namedBindings, node), node); + } + return node; + } + ts.updateImportClause = updateImportClause; + function createNamespaceImport(name, location) { + var node = createNode(237 /* NamespaceImport */, location); + node.name = name; + return node; + } + ts.createNamespaceImport = createNamespaceImport; + function updateNamespaceImport(node, name) { + if (node.name !== name) { + return updateNode(createNamespaceImport(name, node), node); + } + return node; + } + ts.updateNamespaceImport = updateNamespaceImport; + function createNamedImports(elements, location) { + var node = createNode(238 /* NamedImports */, location); + node.elements = createNodeArray(elements); + return node; + } + ts.createNamedImports = createNamedImports; + function updateNamedImports(node, elements) { + if (node.elements !== elements) { + return updateNode(createNamedImports(elements, node), node); + } + return node; + } + ts.updateNamedImports = updateNamedImports; + function createImportSpecifier(propertyName, name, location) { + var node = createNode(239 /* ImportSpecifier */, location); + node.propertyName = propertyName; + node.name = name; + return node; + } + ts.createImportSpecifier = createImportSpecifier; + function updateImportSpecifier(node, propertyName, name) { + if (node.propertyName !== propertyName || node.name !== name) { + return updateNode(createImportSpecifier(propertyName, name, node), node); + } + return node; + } + ts.updateImportSpecifier = updateImportSpecifier; + function createExportAssignment(decorators, modifiers, isExportEquals, expression, location) { + var node = createNode(240 /* ExportAssignment */, location); + node.decorators = decorators ? createNodeArray(decorators) : undefined; + node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + node.isExportEquals = isExportEquals; + node.expression = expression; + return node; + } + ts.createExportAssignment = createExportAssignment; + function updateExportAssignment(node, decorators, modifiers, expression) { + if (node.decorators !== decorators || node.modifiers !== modifiers || node.expression !== expression) { + return updateNode(createExportAssignment(decorators, modifiers, node.isExportEquals, expression, node), node); + } + return node; + } + ts.updateExportAssignment = updateExportAssignment; + function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, location) { + var node = createNode(241 /* ExportDeclaration */, location); + node.decorators = decorators ? createNodeArray(decorators) : undefined; + node.modifiers = modifiers ? createNodeArray(modifiers) : undefined; + node.exportClause = exportClause; + node.moduleSpecifier = moduleSpecifier; + return node; + } + ts.createExportDeclaration = createExportDeclaration; + function updateExportDeclaration(node, decorators, modifiers, exportClause, moduleSpecifier) { + if (node.decorators !== decorators || node.modifiers !== modifiers || node.exportClause !== exportClause || node.moduleSpecifier !== moduleSpecifier) { + return updateNode(createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, node), node); + } + return node; + } + ts.updateExportDeclaration = updateExportDeclaration; + function createNamedExports(elements, location) { + var node = createNode(242 /* NamedExports */, location); + node.elements = createNodeArray(elements); + return node; + } + ts.createNamedExports = createNamedExports; + function updateNamedExports(node, elements) { + if (node.elements !== elements) { + return updateNode(createNamedExports(elements, node), node); + } + return node; + } + ts.updateNamedExports = updateNamedExports; + function createExportSpecifier(name, propertyName, location) { + var node = createNode(243 /* ExportSpecifier */, location); + node.name = typeof name === "string" ? createIdentifier(name) : name; + node.propertyName = typeof propertyName === "string" ? createIdentifier(propertyName) : propertyName; + return node; + } + ts.createExportSpecifier = createExportSpecifier; + function updateExportSpecifier(node, name, propertyName) { + if (node.name !== name || node.propertyName !== propertyName) { + return updateNode(createExportSpecifier(name, propertyName, node), node); + } + return node; + } + ts.updateExportSpecifier = updateExportSpecifier; + // JSX + function createJsxElement(openingElement, children, closingElement, location) { + var node = createNode(246 /* JsxElement */, location); + node.openingElement = openingElement; + node.children = createNodeArray(children); + node.closingElement = closingElement; + return node; + } + ts.createJsxElement = createJsxElement; + function updateJsxElement(node, openingElement, children, closingElement) { + if (node.openingElement !== openingElement || node.children !== children || node.closingElement !== closingElement) { + return updateNode(createJsxElement(openingElement, children, closingElement, node), node); + } + return node; + } + ts.updateJsxElement = updateJsxElement; + function createJsxSelfClosingElement(tagName, attributes, location) { + var node = createNode(247 /* JsxSelfClosingElement */, location); + node.tagName = tagName; + node.attributes = createNodeArray(attributes); + return node; + } + ts.createJsxSelfClosingElement = createJsxSelfClosingElement; + function updateJsxSelfClosingElement(node, tagName, attributes) { + if (node.tagName !== tagName || node.attributes !== attributes) { + return updateNode(createJsxSelfClosingElement(tagName, attributes, node), node); + } + return node; + } + ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement; + function createJsxOpeningElement(tagName, attributes, location) { + var node = createNode(248 /* JsxOpeningElement */, location); + node.tagName = tagName; + node.attributes = createNodeArray(attributes); + return node; + } + ts.createJsxOpeningElement = createJsxOpeningElement; + function updateJsxOpeningElement(node, tagName, attributes) { + if (node.tagName !== tagName || node.attributes !== attributes) { + return updateNode(createJsxOpeningElement(tagName, attributes, node), node); + } + return node; + } + ts.updateJsxOpeningElement = updateJsxOpeningElement; + function createJsxClosingElement(tagName, location) { + var node = createNode(249 /* JsxClosingElement */, location); + node.tagName = tagName; + return node; + } + ts.createJsxClosingElement = createJsxClosingElement; + function updateJsxClosingElement(node, tagName) { + if (node.tagName !== tagName) { + return updateNode(createJsxClosingElement(tagName, node), node); + } + return node; + } + ts.updateJsxClosingElement = updateJsxClosingElement; + function createJsxAttribute(name, initializer, location) { + var node = createNode(250 /* JsxAttribute */, location); + node.name = name; + node.initializer = initializer; + return node; + } + ts.createJsxAttribute = createJsxAttribute; + function updateJsxAttribute(node, name, initializer) { + if (node.name !== name || node.initializer !== initializer) { + return updateNode(createJsxAttribute(name, initializer, node), node); + } + return node; + } + ts.updateJsxAttribute = updateJsxAttribute; + function createJsxSpreadAttribute(expression, location) { + var node = createNode(251 /* JsxSpreadAttribute */, location); + node.expression = expression; + return node; + } + ts.createJsxSpreadAttribute = createJsxSpreadAttribute; + function updateJsxSpreadAttribute(node, expression) { + if (node.expression !== expression) { + return updateNode(createJsxSpreadAttribute(expression, node), node); + } + return node; + } + ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute; + function createJsxExpression(expression, location) { + var node = createNode(252 /* JsxExpression */, location); + node.expression = expression; + return node; + } + ts.createJsxExpression = createJsxExpression; + function updateJsxExpression(node, expression) { + if (node.expression !== expression) { + return updateNode(createJsxExpression(expression, node), node); + } + return node; + } + ts.updateJsxExpression = updateJsxExpression; + // Clauses + function createHeritageClause(token, types, location) { + var node = createNode(255 /* HeritageClause */, location); + node.token = token; + node.types = createNodeArray(types); + return node; + } + ts.createHeritageClause = createHeritageClause; + function updateHeritageClause(node, types) { + if (node.types !== types) { + return updateNode(createHeritageClause(node.token, types, node), node); + } + return node; + } + ts.updateHeritageClause = updateHeritageClause; + function createCaseClause(expression, statements, location) { + var node = createNode(253 /* CaseClause */, location); + node.expression = parenthesizeExpressionForList(expression); + node.statements = createNodeArray(statements); + return node; + } + ts.createCaseClause = createCaseClause; + function updateCaseClause(node, expression, statements) { + if (node.expression !== expression || node.statements !== statements) { + return updateNode(createCaseClause(expression, statements, node), node); + } + return node; + } + ts.updateCaseClause = updateCaseClause; + function createDefaultClause(statements, location) { + var node = createNode(254 /* DefaultClause */, location); + node.statements = createNodeArray(statements); + return node; + } + ts.createDefaultClause = createDefaultClause; + function updateDefaultClause(node, statements) { + if (node.statements !== statements) { + return updateNode(createDefaultClause(statements, node), node); + } + return node; + } + ts.updateDefaultClause = updateDefaultClause; + function createCatchClause(variableDeclaration, block, location) { + var node = createNode(256 /* CatchClause */, location); + node.variableDeclaration = typeof variableDeclaration === "string" ? createVariableDeclaration(variableDeclaration) : variableDeclaration; + node.block = block; + return node; + } + ts.createCatchClause = createCatchClause; + function updateCatchClause(node, variableDeclaration, block) { + if (node.variableDeclaration !== variableDeclaration || node.block !== block) { + return updateNode(createCatchClause(variableDeclaration, block, node), node); + } + return node; + } + ts.updateCatchClause = updateCatchClause; + // Property assignments + function createPropertyAssignment(name, initializer, location) { + var node = createNode(257 /* PropertyAssignment */, location); + node.name = typeof name === "string" ? createIdentifier(name) : name; + node.questionToken = undefined; + node.initializer = initializer !== undefined ? parenthesizeExpressionForList(initializer) : undefined; + return node; + } + ts.createPropertyAssignment = createPropertyAssignment; + function updatePropertyAssignment(node, name, initializer) { + if (node.name !== name || node.initializer !== initializer) { + return updateNode(createPropertyAssignment(name, initializer, node), node); + } + return node; + } + ts.updatePropertyAssignment = updatePropertyAssignment; + function createShorthandPropertyAssignment(name, objectAssignmentInitializer, location) { + var node = createNode(258 /* ShorthandPropertyAssignment */, location); + node.name = typeof name === "string" ? createIdentifier(name) : name; + node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; + return node; + } + ts.createShorthandPropertyAssignment = createShorthandPropertyAssignment; + function createSpreadAssignment(expression, location) { + var node = createNode(259 /* SpreadAssignment */, location); + node.expression = expression !== undefined ? parenthesizeExpressionForList(expression) : undefined; + return node; + } + ts.createSpreadAssignment = createSpreadAssignment; + function updateShorthandPropertyAssignment(node, name, objectAssignmentInitializer) { + if (node.name !== name || node.objectAssignmentInitializer !== objectAssignmentInitializer) { + return updateNode(createShorthandPropertyAssignment(name, objectAssignmentInitializer, node), node); + } + return node; + } + ts.updateShorthandPropertyAssignment = updateShorthandPropertyAssignment; + function updateSpreadAssignment(node, expression) { + if (node.expression !== expression) { + return updateNode(createSpreadAssignment(expression, node), node); + } + return node; + } + ts.updateSpreadAssignment = updateSpreadAssignment; + // Top-level nodes + function updateSourceFileNode(node, statements) { + if (node.statements !== statements) { + var updated = createNode(261 /* SourceFile */, /*location*/ node, node.flags); + updated.statements = createNodeArray(statements); + updated.endOfFileToken = node.endOfFileToken; + updated.fileName = node.fileName; + updated.path = node.path; + updated.text = node.text; + if (node.amdDependencies !== undefined) + updated.amdDependencies = node.amdDependencies; + if (node.moduleName !== undefined) + updated.moduleName = node.moduleName; + if (node.referencedFiles !== undefined) + updated.referencedFiles = node.referencedFiles; + if (node.typeReferenceDirectives !== undefined) + updated.typeReferenceDirectives = node.typeReferenceDirectives; + if (node.languageVariant !== undefined) + updated.languageVariant = node.languageVariant; + if (node.isDeclarationFile !== undefined) + updated.isDeclarationFile = node.isDeclarationFile; + if (node.renamedDependencies !== undefined) + updated.renamedDependencies = node.renamedDependencies; + if (node.hasNoDefaultLib !== undefined) + updated.hasNoDefaultLib = node.hasNoDefaultLib; + if (node.languageVersion !== undefined) + updated.languageVersion = node.languageVersion; + if (node.scriptKind !== undefined) + updated.scriptKind = node.scriptKind; + if (node.externalModuleIndicator !== undefined) + updated.externalModuleIndicator = node.externalModuleIndicator; + if (node.commonJsModuleIndicator !== undefined) + updated.commonJsModuleIndicator = node.commonJsModuleIndicator; + if (node.identifiers !== undefined) + updated.identifiers = node.identifiers; + if (node.nodeCount !== undefined) + updated.nodeCount = node.nodeCount; + if (node.identifierCount !== undefined) + updated.identifierCount = node.identifierCount; + if (node.symbolCount !== undefined) + updated.symbolCount = node.symbolCount; + if (node.parseDiagnostics !== undefined) + updated.parseDiagnostics = node.parseDiagnostics; + if (node.bindDiagnostics !== undefined) + updated.bindDiagnostics = node.bindDiagnostics; + if (node.lineMap !== undefined) + updated.lineMap = node.lineMap; + if (node.classifiableNames !== undefined) + updated.classifiableNames = node.classifiableNames; + if (node.resolvedModules !== undefined) + updated.resolvedModules = node.resolvedModules; + if (node.resolvedTypeReferenceDirectiveNames !== undefined) + updated.resolvedTypeReferenceDirectiveNames = node.resolvedTypeReferenceDirectiveNames; + if (node.imports !== undefined) + updated.imports = node.imports; + if (node.moduleAugmentations !== undefined) + updated.moduleAugmentations = node.moduleAugmentations; + return updateNode(updated, node); + } + return node; + } + ts.updateSourceFileNode = updateSourceFileNode; + // Transformation nodes + /** + * Creates a synthetic statement to act as a placeholder for a not-emitted statement in + * order to preserve comments. + * + * @param original The original statement. + */ + function createNotEmittedStatement(original) { + var node = createNode(293 /* NotEmittedStatement */, /*location*/ original); + node.original = original; + return node; + } + ts.createNotEmittedStatement = createNotEmittedStatement; + /** + * Creates a synthetic element to act as a placeholder for the end of an emitted declaration in + * order to properly emit exports. + */ + function createEndOfDeclarationMarker(original) { + var node = createNode(296 /* EndOfDeclarationMarker */); + node.emitNode = {}; + node.original = original; + return node; + } + ts.createEndOfDeclarationMarker = createEndOfDeclarationMarker; + /** + * Creates a synthetic element to act as a placeholder for the beginning of a merged declaration in + * order to properly emit exports. + */ + function createMergeDeclarationMarker(original) { + var node = createNode(295 /* MergeDeclarationMarker */); + node.emitNode = {}; + node.original = original; + return node; + } + ts.createMergeDeclarationMarker = createMergeDeclarationMarker; + /** + * Creates a synthetic expression to act as a placeholder for a not-emitted expression in + * order to preserve comments or sourcemap positions. + * + * @param expression The inner expression to emit. + * @param original The original outer expression. + * @param location The location for the expression. Defaults to the positions from "original" if provided. + */ + function createPartiallyEmittedExpression(expression, original, location) { + var node = createNode(294 /* PartiallyEmittedExpression */, /*location*/ location || original); + node.expression = expression; + node.original = original; + return node; + } + ts.createPartiallyEmittedExpression = createPartiallyEmittedExpression; + function updatePartiallyEmittedExpression(node, expression) { + if (node.expression !== expression) { + return updateNode(createPartiallyEmittedExpression(expression, node.original, node), node); + } + return node; + } + ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression; + // Compound nodes + function createComma(left, right) { + return createBinary(left, 25 /* CommaToken */, right); + } + ts.createComma = createComma; + function createLessThan(left, right, location) { + return createBinary(left, 26 /* LessThanToken */, right, location); + } + ts.createLessThan = createLessThan; + function createAssignment(left, right, location) { + return createBinary(left, 57 /* EqualsToken */, right, location); + } + ts.createAssignment = createAssignment; + function createStrictEquality(left, right) { + return createBinary(left, 33 /* EqualsEqualsEqualsToken */, right); + } + ts.createStrictEquality = createStrictEquality; + function createStrictInequality(left, right) { + return createBinary(left, 34 /* ExclamationEqualsEqualsToken */, right); + } + ts.createStrictInequality = createStrictInequality; + function createAdd(left, right) { + return createBinary(left, 36 /* PlusToken */, right); + } + ts.createAdd = createAdd; + function createSubtract(left, right) { + return createBinary(left, 37 /* MinusToken */, right); + } + ts.createSubtract = createSubtract; + function createPostfixIncrement(operand, location) { + return createPostfix(operand, 42 /* PlusPlusToken */, location); + } + ts.createPostfixIncrement = createPostfixIncrement; + function createLogicalAnd(left, right) { + return createBinary(left, 52 /* AmpersandAmpersandToken */, right); + } + ts.createLogicalAnd = createLogicalAnd; + function createLogicalOr(left, right) { + return createBinary(left, 53 /* BarBarToken */, right); + } + ts.createLogicalOr = createLogicalOr; + function createLogicalNot(operand) { + return createPrefix(50 /* ExclamationToken */, operand); + } + ts.createLogicalNot = createLogicalNot; + function createVoidZero() { + 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 |= 64 /* NoNestedSourceMaps */; + return expression; + } + } + ts.createMemberAccessForPropertyName = createMemberAccessForPropertyName; + function createFunctionCall(func, thisArg, argumentsList, location) { + return createCall(createPropertyAccess(func, "call"), + /*typeArguments*/ undefined, [ + thisArg + ].concat(argumentsList), location); + } + ts.createFunctionCall = createFunctionCall; + function createFunctionApply(func, thisArg, argumentsExpression, location) { + return createCall(createPropertyAccess(func, "apply"), + /*typeArguments*/ undefined, [ + thisArg, + argumentsExpression + ], location); + } + ts.createFunctionApply = createFunctionApply; + function createArraySlice(array, start) { + var argumentsList = []; + if (start !== undefined) { + argumentsList.push(typeof start === "number" ? createLiteral(start) : start); + } + return createCall(createPropertyAccess(array, "slice"), /*typeArguments*/ undefined, argumentsList); + } + ts.createArraySlice = createArraySlice; + function createArrayConcat(array, values) { + return createCall(createPropertyAccess(array, "concat"), + /*typeArguments*/ undefined, values); + } + ts.createArrayConcat = createArrayConcat; + function createMathPow(left, right, location) { + return createCall(createPropertyAccess(createIdentifier("Math"), "pow"), + /*typeArguments*/ undefined, [left, right], location); + } + ts.createMathPow = createMathPow; + function createReactNamespace(reactNamespace, parent) { + // To ensure the emit resolver can properly resolve the namespace, we need to + // treat this identifier as if it were a source tree node by clearing the `Synthesized` + // flag and setting a parent node. + var react = createIdentifier(reactNamespace || "React"); + react.flags &= ~8 /* Synthesized */; + // 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)) { + 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); + } + } + function createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parent) { + return jsxFactoryEntity ? + createJsxFactoryExpressionFromEntityName(jsxFactoryEntity, parent) : + createPropertyAccess(createReactNamespace(reactNamespace, parent), "createElement"); + } + function createExpressionForJsxElement(jsxFactoryEntity, reactNamespace, tagName, props, children, parentElement, location) { + var argumentsList = [tagName]; + if (props) { + argumentsList.push(props); + } + if (children && children.length > 0) { + if (!props) { + argumentsList.push(createNull()); + } + if (children.length > 1) { + for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { + var child = children_1[_i]; + child.startsOnNewLine = true; + argumentsList.push(child); + } + } + else { + argumentsList.push(children[0]); + } + } + return createCall(createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parentElement), + /*typeArguments*/ undefined, argumentsList, location); + } + ts.createExpressionForJsxElement = createExpressionForJsxElement; + function createExportDefault(expression) { + return createExportAssignment(/*decorators*/ undefined, /*modifiers*/ undefined, /*isExportEquals*/ false, expression); + } + ts.createExportDefault = createExportDefault; + function createExternalModuleExport(exportName) { + return createExportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, createNamedExports([createExportSpecifier(exportName)])); + } + ts.createExternalModuleExport = createExternalModuleExport; + function createLetStatement(name, initializer, location) { + return createVariableStatement(/*modifiers*/ undefined, createLetDeclarationList([createVariableDeclaration(name, /*type*/ undefined, initializer)]), location); + } + ts.createLetStatement = createLetStatement; + function createLetDeclarationList(declarations, location) { + return createVariableDeclarationList(declarations, location, 1 /* Let */); + } + ts.createLetDeclarationList = createLetDeclarationList; + function createConstDeclarationList(declarations, location) { + return createVariableDeclarationList(declarations, location, 2 /* Const */); + } + ts.createConstDeclarationList = createConstDeclarationList; + // Helpers + function getHelperName(name) { + return setEmitFlags(createIdentifier(name), 4096 /* HelperName */ | 2 /* AdviseOnEmitNode */); + } + ts.getHelperName = getHelperName; + function shouldBeCapturedInTempVariable(node, cacheIdentifiers) { + var target = skipParentheses(node); + switch (target.kind) { + case 70 /* Identifier */: + return cacheIdentifiers; + case 98 /* ThisKeyword */: + case 8 /* NumericLiteral */: + case 9 /* StringLiteral */: + return false; + case 175 /* ArrayLiteralExpression */: + var elements = target.elements; + if (elements.length === 0) { + return false; + } + return true; + case 176 /* ObjectLiteralExpression */: + return target.properties.length > 0; + default: + return true; + } + } + function createCallBinding(expression, recordTempVariable, languageVersion, cacheIdentifiers) { + var callee = skipOuterExpressions(expression, 7 /* All */); + var thisArg; + var target; + if (ts.isSuperProperty(callee)) { + thisArg = createThis(); + target = callee; + } + else if (callee.kind === 96 /* SuperKeyword */) { + thisArg = createThis(); + target = languageVersion < 2 /* ES2015 */ ? createIdentifier("_super", /*location*/ callee) : callee; + } + else { + switch (callee.kind) { + case 177 /* PropertyAccessExpression */: { + if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { + // for `a.b()` target is `(_a = a).b` and thisArg is `_a` + thisArg = createTempVariable(recordTempVariable); + target = createPropertyAccess(createAssignment(thisArg, callee.expression, + /*location*/ callee.expression), callee.name, + /*location*/ callee); + } + else { + thisArg = callee.expression; + target = callee; + } + break; + } + case 178 /* ElementAccessExpression */: { + if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { + // for `a[b]()` target is `(_a = a)[b]` and thisArg is `_a` + thisArg = createTempVariable(recordTempVariable); + target = createElementAccess(createAssignment(thisArg, callee.expression, + /*location*/ callee.expression), callee.argumentExpression, + /*location*/ callee); + } + else { + thisArg = callee.expression; + target = callee; + } + break; + } + default: { + // for `a()` target is `a` and thisArg is `void 0` + thisArg = createVoidZero(); + target = parenthesizeForAccess(expression); + break; + } + } + } + return { target: target, thisArg: thisArg }; + } + ts.createCallBinding = createCallBinding; + function inlineExpressions(expressions) { + return ts.reduceLeft(expressions, createComma); + } + ts.inlineExpressions = inlineExpressions; + function createExpressionFromEntityName(node) { + if (ts.isQualifiedName(node)) { + var left = createExpressionFromEntityName(node.left); + var right = getMutableClone(node.right); + return createPropertyAccess(left, right, /*location*/ node); + } + else { + return getMutableClone(node); + } + } + ts.createExpressionFromEntityName = createExpressionFromEntityName; + function createExpressionForPropertyName(memberName) { + if (ts.isIdentifier(memberName)) { + return createLiteral(memberName, /*location*/ undefined); + } + else if (ts.isComputedPropertyName(memberName)) { + return getMutableClone(memberName.expression); + } + else { + return getMutableClone(memberName); + } + } + ts.createExpressionForPropertyName = createExpressionForPropertyName; + function createExpressionForObjectLiteralElementLike(node, property, receiver) { + switch (property.kind) { + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine); + case 257 /* PropertyAssignment */: + return createExpressionForPropertyAssignment(property, receiver); + case 258 /* ShorthandPropertyAssignment */: + return createExpressionForShorthandPropertyAssignment(property, receiver); + case 149 /* MethodDeclaration */: + return createExpressionForMethodDeclaration(property, receiver); + } + } + ts.createExpressionForObjectLiteralElementLike = createExpressionForObjectLiteralElementLike; + function createExpressionForAccessorDeclaration(properties, property, receiver, multiLine) { + var _a = ts.getAllAccessorDeclarations(properties, property), firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor; + if (property === firstAccessor) { + var properties_1 = []; + if (getAccessor) { + var getterFunction = createFunctionExpression(getAccessor.modifiers, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, getAccessor.parameters, + /*type*/ undefined, getAccessor.body, + /*location*/ getAccessor); + setOriginalNode(getterFunction, getAccessor); + var getter = createPropertyAssignment("get", getterFunction); + properties_1.push(getter); + } + if (setAccessor) { + var setterFunction = createFunctionExpression(setAccessor.modifiers, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, setAccessor.parameters, + /*type*/ undefined, setAccessor.body, + /*location*/ setAccessor); + setOriginalNode(setterFunction, setAccessor); + var setter = createPropertyAssignment("set", setterFunction); + properties_1.push(setter); + } + properties_1.push(createPropertyAssignment("enumerable", createLiteral(true))); + properties_1.push(createPropertyAssignment("configurable", createLiteral(true))); + var expression = createCall(createPropertyAccess(createIdentifier("Object"), "defineProperty"), + /*typeArguments*/ undefined, [ + receiver, + createExpressionForPropertyName(property.name), + createObjectLiteral(properties_1, /*location*/ undefined, multiLine) + ], + /*location*/ firstAccessor); + return ts.aggregateTransformFlags(expression); + } + return undefined; + } + function createExpressionForPropertyAssignment(property, receiver) { + return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, property.name, /*location*/ property.name), property.initializer, + /*location*/ property), + /*original*/ property)); + } + function createExpressionForShorthandPropertyAssignment(property, receiver) { + return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, property.name, /*location*/ property.name), getSynthesizedClone(property.name), + /*location*/ property), + /*original*/ property)); + } + function createExpressionForMethodDeclaration(method, receiver) { + return ts.aggregateTransformFlags(setOriginalNode(createAssignment(createMemberAccessForPropertyName(receiver, method.name, /*location*/ method.name), setOriginalNode(createFunctionExpression(method.modifiers, method.asteriskToken, + /*name*/ undefined, + /*typeParameters*/ undefined, method.parameters, + /*type*/ undefined, method.body, + /*location*/ method), + /*original*/ method), + /*location*/ method), + /*original*/ method)); + } + /** + * Gets the local name of a declaration. This is primarily used for declarations that can be + * referred to by name in the declaration's immediate scope (classes, enums, namespaces). A + * local name will *never* be prefixed with an module or namespace export modifier like + * "exports." when emitted as an expression. + * + * @param node The declaration. + * @param allowComments A value indicating whether comments may be emitted for the name. + * @param allowSourceMaps A value indicating whether source maps may be emitted for the name. + */ + function getLocalName(node, allowComments, allowSourceMaps) { + 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) & 16384 /* LocalName */) !== 0; + } + ts.isLocalName = isLocalName; + /** + * Gets the export name of a declaration. This is primarily used for declarations that can be + * referred to by name in the declaration's immediate scope (classes, enums, namespaces). An + * export name will *always* be prefixed with an module or namespace export modifier like + * `"exports."` when emitted as an expression if the name points to an exported symbol. + * + * @param node The declaration. + * @param allowComments A value indicating whether comments may be emitted for the name. + * @param allowSourceMaps A value indicating whether source maps may be emitted for the name. + */ + function getExportName(node, allowComments, allowSourceMaps) { + return getName(node, allowComments, allowSourceMaps, 8192 /* ExportName */); + } + ts.getExportName = getExportName; + /** + * Gets whether an identifier should only be referred to by its export representation if the + * name points to an exported symbol. + */ + function isExportName(node) { + return (getEmitFlags(node) & 8192 /* ExportName */) !== 0; + } + ts.isExportName = isExportName; + /** + * Gets the name of a declaration for use in declarations. + * + * @param node The declaration. + * @param allowComments A value indicating whether comments may be emitted for the name. + * @param allowSourceMaps A value indicating whether source maps may be emitted for the name. + */ + function getDeclarationName(node, allowComments, allowSourceMaps) { + return getName(node, allowComments, allowSourceMaps); + } + ts.getDeclarationName = getDeclarationName; + function getName(node, allowComments, allowSourceMaps, emitFlags) { + if (node.name && ts.isIdentifier(node.name) && !ts.isGeneratedIdentifier(node.name)) { + var name_8 = getMutableClone(node.name); + emitFlags |= getEmitFlags(node.name); + if (!allowSourceMaps) + emitFlags |= 48 /* NoSourceMap */; + if (!allowComments) + emitFlags |= 1536 /* NoComments */; + if (emitFlags) + setEmitFlags(name_8, emitFlags); + return name_8; + } + return getGeneratedNameForNode(node); + } + /** + * Gets the exported name of a declaration for use in expressions. + * + * An exported name will *always* be prefixed with an module or namespace export modifier like + * "exports." if the name points to an exported symbol. + * + * @param ns The namespace identifier. + * @param node The declaration. + * @param allowComments A value indicating whether comments may be emitted for the name. + * @param allowSourceMaps A value indicating whether source maps may be emitted for the name. + */ + function getExternalModuleOrNamespaceExportName(ns, node, allowComments, allowSourceMaps) { + if (ns && ts.hasModifier(node, 1 /* Export */)) { + return getNamespaceMemberName(ns, getName(node), allowComments, allowSourceMaps); + } + return getExportName(node, allowComments, allowSourceMaps); + } + ts.getExternalModuleOrNamespaceExportName = getExternalModuleOrNamespaceExportName; + /** + * Gets a namespace-qualified name for use in expressions. + * + * @param ns The namespace identifier. + * @param name The name. + * @param allowComments A value indicating whether comments may be emitted for the name. + * @param allowSourceMaps A value indicating whether source maps may be emitted for the name. + */ + function getNamespaceMemberName(ns, name, allowComments, allowSourceMaps) { + var qualifiedName = createPropertyAccess(ns, ts.nodeIsSynthesized(name) ? name : getSynthesizedClone(name), /*location*/ name); + var emitFlags; + if (!allowSourceMaps) + emitFlags |= 48 /* NoSourceMap */; + if (!allowComments) + emitFlags |= 1536 /* NoComments */; + if (emitFlags) + setEmitFlags(qualifiedName, emitFlags); + return qualifiedName; + } + ts.getNamespaceMemberName = getNamespaceMemberName; + 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"; + } + /** + * Add any necessary prologue-directives into target statement-array. + * The function needs to be called during each transformation step. + * This function needs to be called whenever we transform the statement + * list of a source file, namespace, or function-like body. + * + * @param target: result statements array + * @param source: origin statements array + * @param ensureUseStrict: boolean determining whether the function need to add prologue-directives + * @param visitor: Optional callback used to visit any custom prologue directives. + */ + function addPrologueDirectives(target, source, ensureUseStrict, visitor) { + ts.Debug.assert(target.length === 0, "Prologue directives should be at the first statement in the target statements array"); + var foundUseStrict = false; + var statementOffset = 0; + var numStatements = source.length; + while (statementOffset < numStatements) { + var statement = source[statementOffset]; + if (ts.isPrologueDirective(statement)) { + if (isUseStrictPrologue(statement)) { + foundUseStrict = true; + } + target.push(statement); + } + else { + break; + } + statementOffset++; + } + if (ensureUseStrict && !foundUseStrict) { + target.push(startOnNewLine(createStatement(createLiteral("use strict")))); + } + while (statementOffset < numStatements) { + var statement = source[statementOffset]; + if (getEmitFlags(statement) & 524288 /* CustomPrologue */) { + target.push(visitor ? ts.visitNode(statement, visitor, ts.isStatement) : statement); + } + else { + break; + } + statementOffset++; + } + 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 statements An array of statements + */ + function ensureUseStrict(statements) { + var foundUseStrict = false; + 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; + break; + } + } + else { + break; + } + } + if (!foundUseStrict) { + return createNodeArray([ + startOnNewLine(createStatement(createLiteral("use strict"))) + ].concat(statements), statements); + } + return statements; + } + ts.ensureUseStrict = ensureUseStrict; + /** + * Wraps the operand to a BinaryExpression in parentheses if they are needed to preserve the intended + * order of operations. + * + * @param binaryOperator The operator for the BinaryExpression. + * @param operand The operand for the BinaryExpression. + * @param isLeftSideOfBinary A value indicating whether the operand is the left side of the + * BinaryExpression. + */ + function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { + var skipped = skipPartiallyEmittedExpressions(operand); + // If the resulting expression is already parenthesized, we do not need to do any further processing. + if (skipped.kind === 183 /* ParenthesizedExpression */) { + return operand; + } + return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) + ? createParen(operand) + : operand; + } + ts.parenthesizeBinaryOperand = parenthesizeBinaryOperand; + /** + * Determines whether the operand to a BinaryExpression needs to be parenthesized. + * + * @param binaryOperator The operator for the BinaryExpression. + * @param operand The operand for the BinaryExpression. + * @param isLeftSideOfBinary A value indicating whether the operand is the left side of the + * BinaryExpression. + */ + function binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { + // If the operand has lower precedence, then it needs to be parenthesized to preserve the + // intent of the expression. For example, if the operand is `a + b` and the operator is + // `*`, then we need to parenthesize the operand to preserve the intended order of + // operations: `(a + b) * x`. + // + // If the operand has higher precedence, then it does not need to be parenthesized. For + // example, if the operand is `a * b` and the operator is `+`, then we do not need to + // parenthesize to preserve the intended order of operations: `a * b + x`. + // + // If the operand has the same precedence, then we need to check the associativity of + // the operator based on whether this is the left or right operand of the expression. + // + // For example, if `a / d` is on the right of operator `*`, we need to parenthesize + // to preserve the intended order of operations: `x * (a / d)` + // + // If `a ** d` is on the left of operator `**`, we need to parenthesize to preserve + // the intended order of operations: `(a ** b) ** c` + var binaryOperatorPrecedence = ts.getOperatorPrecedence(192 /* BinaryExpression */, binaryOperator); + var binaryOperatorAssociativity = ts.getOperatorAssociativity(192 /* BinaryExpression */, binaryOperator); + var emittedOperand = skipPartiallyEmittedExpressions(operand); + var operandPrecedence = ts.getExpressionPrecedence(emittedOperand); + switch (ts.compareValues(operandPrecedence, binaryOperatorPrecedence)) { + case -1 /* LessThan */: + // If the operand is the right side of a right-associative binary operation + // and is a yield expression, then we do not need parentheses. + if (!isLeftSideOfBinary + && binaryOperatorAssociativity === 1 /* Right */ + && operand.kind === 195 /* YieldExpression */) { + return false; + } + return true; + case 1 /* GreaterThan */: + return false; + case 0 /* EqualTo */: + if (isLeftSideOfBinary) { + // No need to parenthesize the left operand when the binary operator is + // left associative: + // (a*b)/x -> a*b/x + // (a**b)/x -> a**b/x + // + // Parentheses are needed for the left operand when the binary operator is + // right associative: + // (a/b)**x -> (a/b)**x + // (a**b)**x -> (a**b)**x + return binaryOperatorAssociativity === 1 /* Right */; + } + else { + if (ts.isBinaryExpression(emittedOperand) + && emittedOperand.operatorToken.kind === binaryOperator) { + // No need to parenthesize the right operand when the binary operator and + // operand are the same and one of the following: + // x*(a*b) => x*a*b + // x|(a|b) => x|a|b + // x&(a&b) => x&a&b + // x^(a^b) => x^a^b + if (operatorHasAssociativeProperty(binaryOperator)) { + return false; + } + // No need to parenthesize the right operand when the binary operator + // is plus (+) if both the left and right operands consist solely of either + // literals of the same kind or binary plus (+) expressions for literals of + // the same kind (recursively). + // "a"+(1+2) => "a"+(1+2) + // "a"+("b"+"c") => "a"+"b"+"c" + if (binaryOperator === 36 /* PlusToken */) { + var leftKind = leftOperand ? getLiteralKindOfBinaryPlusOperand(leftOperand) : 0 /* Unknown */; + if (ts.isLiteralKind(leftKind) && leftKind === getLiteralKindOfBinaryPlusOperand(emittedOperand)) { + return false; + } + } + } + // No need to parenthesize the right operand when the operand is right + // associative: + // x/(a**b) -> x/a**b + // x**(a**b) -> x**a**b + // + // Parentheses are needed for the right operand when the operand is left + // associative: + // x/(a*b) -> x/(a*b) + // x**(a/b) -> x**(a/b) + var operandAssociativity = ts.getExpressionAssociativity(emittedOperand); + return operandAssociativity === 0 /* Left */; + } + } + } + /** + * Determines whether a binary operator is mathematically associative. + * + * @param binaryOperator The binary operator. + */ + function operatorHasAssociativeProperty(binaryOperator) { + // The following operators are associative in JavaScript: + // (a*b)*c -> a*(b*c) -> a*b*c + // (a|b)|c -> a|(b|c) -> a|b|c + // (a&b)&c -> a&(b&c) -> a&b&c + // (a^b)^c -> a^(b^c) -> a^b^c + // + // While addition is associative in mathematics, JavaScript's `+` is not + // guaranteed to be associative as it is overloaded with string concatenation. + return binaryOperator === 38 /* AsteriskToken */ + || binaryOperator === 48 /* BarToken */ + || binaryOperator === 47 /* AmpersandToken */ + || binaryOperator === 49 /* CaretToken */; + } + /** + * This function determines whether an expression consists of a homogeneous set of + * literal expressions or binary plus expressions that all share the same literal kind. + * It is used to determine whether the right-hand operand of a binary plus expression can be + * emitted without parentheses. + */ + function getLiteralKindOfBinaryPlusOperand(node) { + node = skipPartiallyEmittedExpressions(node); + if (ts.isLiteralKind(node.kind)) { + return node.kind; + } + if (node.kind === 192 /* BinaryExpression */ && node.operatorToken.kind === 36 /* PlusToken */) { + if (node.cachedLiteralKind !== undefined) { + return node.cachedLiteralKind; + } + var leftKind = getLiteralKindOfBinaryPlusOperand(node.left); + var literalKind = ts.isLiteralKind(leftKind) + && leftKind === getLiteralKindOfBinaryPlusOperand(node.right) + ? leftKind + : 0 /* Unknown */; + node.cachedLiteralKind = literalKind; + return literalKind; + } + 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. + * + * @param expression The Expression node. + */ + function parenthesizeForNew(expression) { + var emittedExpression = skipPartiallyEmittedExpressions(expression); + switch (emittedExpression.kind) { + case 179 /* CallExpression */: + return createParen(expression); + case 180 /* NewExpression */: + return emittedExpression.arguments + ? expression + : createParen(expression); + } + return parenthesizeForAccess(expression); + } + ts.parenthesizeForNew = parenthesizeForNew; + /** + * Wraps an expression in parentheses if it is needed in order to use the expression for + * property or element access. + * + * @param expr The expression node. + */ + function parenthesizeForAccess(expression) { + // isLeftHandSideExpression is almost the correct criterion for when it is not necessary + // to parenthesize the expression before a dot. The known exceptions are: + // + // NewExpression: + // new C.x -> not the same as (new C).x + // NumericLiteral + // 1.x -> not the same as (1).x + // + var emittedExpression = skipPartiallyEmittedExpressions(expression); + if (ts.isLeftHandSideExpression(emittedExpression) + && (emittedExpression.kind !== 180 /* NewExpression */ || emittedExpression.arguments) + && emittedExpression.kind !== 8 /* NumericLiteral */) { + return expression; + } + return createParen(expression, /*location*/ expression); + } + ts.parenthesizeForAccess = parenthesizeForAccess; + function parenthesizePostfixOperand(operand) { + return ts.isLeftHandSideExpression(operand) + ? operand + : createParen(operand, /*location*/ operand); + } + ts.parenthesizePostfixOperand = parenthesizePostfixOperand; + function parenthesizePrefixOperand(operand) { + return ts.isUnaryExpression(operand) + ? operand + : createParen(operand, /*location*/ operand); + } + ts.parenthesizePrefixOperand = parenthesizePrefixOperand; + function parenthesizeListElements(elements) { + var result; + for (var i = 0; i < elements.length; i++) { + var element = parenthesizeExpressionForList(elements[i]); + if (result !== undefined || element !== elements[i]) { + if (result === undefined) { + result = elements.slice(0, i); + } + result.push(element); + } + } + if (result !== undefined) { + return createNodeArray(result, elements, elements.hasTrailingComma); + } + return elements; + } + function parenthesizeExpressionForList(expression) { + var emittedExpression = skipPartiallyEmittedExpressions(expression); + var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression); + var commaPrecedence = ts.getOperatorPrecedence(192 /* BinaryExpression */, 25 /* CommaToken */); + return expressionPrecedence > commaPrecedence + ? expression + : createParen(expression, /*location*/ expression); + } + ts.parenthesizeExpressionForList = parenthesizeExpressionForList; + function parenthesizeExpressionForExpressionStatement(expression) { + var emittedExpression = skipPartiallyEmittedExpressions(expression); + if (ts.isCallExpression(emittedExpression)) { + var callee = emittedExpression.expression; + var kind = skipPartiallyEmittedExpressions(callee).kind; + if (kind === 184 /* FunctionExpression */ || kind === 185 /* ArrowFunction */) { + var mutableCall = getMutableClone(emittedExpression); + mutableCall.expression = createParen(callee, /*location*/ callee); + return recreatePartiallyEmittedExpressions(expression, mutableCall); + } + } + else { + var leftmostExpressionKind = getLeftmostExpression(emittedExpression).kind; + if (leftmostExpressionKind === 176 /* ObjectLiteralExpression */ || leftmostExpressionKind === 184 /* FunctionExpression */) { + return createParen(expression, /*location*/ expression); + } + } + return expression; + } + ts.parenthesizeExpressionForExpressionStatement = parenthesizeExpressionForExpressionStatement; + /** + * Clones a series of not-emitted expressions with a new inner expression. + * + * @param originalOuterExpression The original outer expression. + * @param newInnerExpression The new inner expression. + */ + function recreatePartiallyEmittedExpressions(originalOuterExpression, newInnerExpression) { + if (ts.isPartiallyEmittedExpression(originalOuterExpression)) { + var clone_1 = getMutableClone(originalOuterExpression); + clone_1.expression = recreatePartiallyEmittedExpressions(clone_1.expression, newInnerExpression); + return clone_1; + } + return newInnerExpression; + } + function getLeftmostExpression(node) { + while (true) { + switch (node.kind) { + case 191 /* PostfixUnaryExpression */: + node = node.operand; + continue; + case 192 /* BinaryExpression */: + node = node.left; + continue; + case 193 /* ConditionalExpression */: + node = node.condition; + continue; + case 179 /* CallExpression */: + case 178 /* ElementAccessExpression */: + case 177 /* PropertyAccessExpression */: + node = node.expression; + continue; + case 294 /* PartiallyEmittedExpression */: + node = node.expression; + continue; + } + return node; + } + } + function parenthesizeConciseBody(body) { + var emittedBody = skipPartiallyEmittedExpressions(body); + if (emittedBody.kind === 176 /* ObjectLiteralExpression */) { + return createParen(body, /*location*/ body); + } + return body; + } + ts.parenthesizeConciseBody = parenthesizeConciseBody; + var OuterExpressionKinds; + (function (OuterExpressionKinds) { + OuterExpressionKinds[OuterExpressionKinds["Parentheses"] = 1] = "Parentheses"; + OuterExpressionKinds[OuterExpressionKinds["Assertions"] = 2] = "Assertions"; + OuterExpressionKinds[OuterExpressionKinds["PartiallyEmittedExpressions"] = 4] = "PartiallyEmittedExpressions"; + OuterExpressionKinds[OuterExpressionKinds["All"] = 7] = "All"; + })(OuterExpressionKinds = ts.OuterExpressionKinds || (ts.OuterExpressionKinds = {})); + function skipOuterExpressions(node, kinds) { + if (kinds === void 0) { kinds = 7 /* All */; } + var previousNode; + do { + previousNode = node; + if (kinds & 1 /* Parentheses */) { + node = skipParentheses(node); + } + if (kinds & 2 /* Assertions */) { + node = skipAssertions(node); + } + if (kinds & 4 /* PartiallyEmittedExpressions */) { + node = skipPartiallyEmittedExpressions(node); + } + } while (previousNode !== node); + return node; + } + ts.skipOuterExpressions = skipOuterExpressions; + function skipParentheses(node) { + while (node.kind === 183 /* ParenthesizedExpression */) { + node = node.expression; + } + return node; + } + ts.skipParentheses = skipParentheses; + function skipAssertions(node) { + while (ts.isAssertionExpression(node)) { + node = node.expression; + } + return node; + } + ts.skipAssertions = skipAssertions; + function skipPartiallyEmittedExpressions(node) { + while (node.kind === 294 /* PartiallyEmittedExpression */) { + node = node.expression; + } + return node; + } + ts.skipPartiallyEmittedExpressions = skipPartiallyEmittedExpressions; + function startOnNewLine(node) { + node.startsOnNewLine = true; + return node; + } + ts.startOnNewLine = startOnNewLine; + function setOriginalNode(node, original) { + node.original = original; + if (original) { + var emitNode = original.emitNode; + if (emitNode) + node.emitNode = mergeEmitNode(emitNode, node.emitNode); + } + return node; + } + ts.setOriginalNode = setOriginalNode; + function mergeEmitNode(sourceEmitNode, destEmitNode) { + 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; + if (commentRange) + destEmitNode.commentRange = commentRange; + if (sourceMapRange) + 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) { + if (!destRanges) + destRanges = ts.createMap(); + ts.copyProperties(sourceRanges, destRanges); + return destRanges; + } + /** + * Clears any EmitNode entries from parse-tree nodes. + * @param sourceFile A source file. + */ + function disposeEmitNodes(sourceFile) { + // During transformation we may need to annotate a parse tree node with transient + // transformation properties. As parse tree nodes live longer than transformation + // nodes, we need to make sure we reclaim any memory allocated for custom ranges + // from these nodes to ensure we do not hold onto entire subtrees just for position + // information. We also need to reset these nodes to a pre-transformation state + // for incremental parsing scenarios so that we do not impact later emit. + sourceFile = ts.getSourceFileOfNode(ts.getParseTreeNode(sourceFile)); + var emitNode = sourceFile && sourceFile.emitNode; + var annotatedNodes = emitNode && emitNode.annotatedNodes; + if (annotatedNodes) { + for (var _i = 0, annotatedNodes_1 = annotatedNodes; _i < annotatedNodes_1.length; _i++) { + var node = annotatedNodes_1[_i]; + node.emitNode = undefined; + } + } + } + ts.disposeEmitNodes = disposeEmitNodes; + /** + * Associates a node with the current transformation, initializing + * various transient transformation properties. + * + * @param node The node. + */ + function getOrCreateEmitNode(node) { + if (!node.emitNode) { + if (ts.isParseTreeNode(node)) { + // To avoid holding onto transformation artifacts, we keep track of any + // parse tree node we are annotating. This allows us to clean them up after + // all transformations have completed. + if (node.kind === 261 /* SourceFile */) { + return node.emitNode = { annotatedNodes: [node] }; + } + var sourceFile = ts.getSourceFileOfNode(node); + getOrCreateEmitNode(sourceFile).annotatedNodes.push(node); + } + node.emitNode = {}; + } + return node.emitNode; + } + ts.getOrCreateEmitNode = getOrCreateEmitNode; + /** + * Gets flags that control emit behavior of a node. + * + * @param node The node. + */ + function getEmitFlags(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.flags; + } + ts.getEmitFlags = getEmitFlags; + /** + * Sets flags that control emit behavior of a node. + * + * @param node The node. + * @param emitFlags The NodeEmitFlags for the node. + */ + function setEmitFlags(node, emitFlags) { + getOrCreateEmitNode(node).flags = emitFlags; + return node; + } + 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. + * @param range The text range. + */ + function setSourceMapRange(node, range) { + getOrCreateEmitNode(node).sourceMapRange = range; + return node; + } + 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. + * @param token The token. + * @param range The text range. + */ + function setTokenSourceMapRange(node, token, range) { + var emitNode = getOrCreateEmitNode(node); + var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = ts.createMap()); + tokenSourceMapRanges[token] = range; + return node; + } + ts.setTokenSourceMapRange = setTokenSourceMapRange; + /** + * Gets a custom text range to use when emitting comments. + * + * @param node The node. + */ + function getCommentRange(node) { + var emitNode = node.emitNode; + return (emitNode && emitNode.commentRange) || node; + } + ts.getCommentRange = getCommentRange; + /** + * Sets a custom text range to use when emitting comments. + */ + function setCommentRange(node, range) { + getOrCreateEmitNode(node).commentRange = range; + return node; + } + ts.setCommentRange = setCommentRange; + /** + * Gets the constant value to emit for an expression. + */ + function getConstantValue(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.constantValue; + } + ts.getConstantValue = getConstantValue; + /** + * Sets the constant value to emit for an expression. + */ + function setConstantValue(node, value) { + var emitNode = getOrCreateEmitNode(node); + emitNode.constantValue = value; + 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; + node.end = location.end; + } + return node; + } + ts.setTextRange = setTextRange; + function setNodeFlags(node, flags) { + node.flags = flags; + return node; + } + ts.setNodeFlags = setNodeFlags; + function setMultiLine(node, multiLine) { + node.multiLine = multiLine; + return node; + } + ts.setMultiLine = setMultiLine; + function setHasTrailingComma(nodes, hasTrailingComma) { + nodes.hasTrailingComma = hasTrailingComma; + return nodes; + } + ts.setHasTrailingComma = setHasTrailingComma; + /** + * Get the name of that target module from an import or export declaration + */ + function getLocalNameForExternalImport(node, sourceFile) { + var namespaceDeclaration = ts.getNamespaceDeclarationNode(node); + if (namespaceDeclaration && !ts.isDefaultImport(node)) { + 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); + } + if (node.kind === 241 /* ExportDeclaration */ && node.moduleSpecifier) { + return getGeneratedNameForNode(node); + } + return undefined; + } + ts.getLocalNameForExternalImport = getLocalNameForExternalImport; + /** + * Get the name of a target module from an import/export declaration as should be written in the emitted output. + * The emitted output name can be different from the input if: + * 1. The module has a /// + * 2. --out or --outFile is used, making the name relative to the rootDir + * 3- The containing SourceFile has an entry in renamedDependencies for the import as requested by some module loaders (e.g. System). + * Otherwise, a new StringLiteral node representing the module name will be returned. + */ + function getExternalModuleNameLiteral(importNode, sourceFile, host, resolver, compilerOptions) { + var moduleName = ts.getExternalModuleName(importNode); + if (moduleName.kind === 9 /* StringLiteral */) { + return tryGetModuleNameFromDeclaration(importNode, host, resolver, compilerOptions) + || tryRenameExternalModule(moduleName, sourceFile) + || getSynthesizedClone(moduleName); + } + return undefined; + } + ts.getExternalModuleNameLiteral = getExternalModuleNameLiteral; + /** + * Some bundlers (SystemJS builder) sometimes want to rename dependencies. + * Here we check if alternative name was provided for a given moduleName and return it if possible. + */ + function tryRenameExternalModule(moduleName, sourceFile) { + if (sourceFile.renamedDependencies && ts.hasProperty(sourceFile.renamedDependencies, moduleName.text)) { + return createLiteral(sourceFile.renamedDependencies[moduleName.text]); + } + return undefined; + } + /** + * Get the name of a module as should be written in the emitted output. + * The emitted output name can be different from the input if: + * 1. The module has a /// + * 2. --out or --outFile is used, making the name relative to the rootDir + * Otherwise, a new StringLiteral node representing the module name will be returned. + */ + function tryGetModuleNameFromFile(file, host, options) { + if (!file) { + return undefined; + } + if (file.moduleName) { + return createLiteral(file.moduleName); + } + if (!ts.isDeclarationFile(file) && (options.out || options.outFile)) { + return createLiteral(ts.getExternalModuleNameFromPath(host, file.fileName)); + } + return undefined; + } + ts.tryGetModuleNameFromFile = tryGetModuleNameFromFile; + function tryGetModuleNameFromDeclaration(declaration, host, resolver, compilerOptions) { + return tryGetModuleNameFromFile(resolver.getExternalModuleFileFromDeclaration(declaration), host, compilerOptions); + } + /** + * Gets the initializer of an BindingOrAssignmentElement. + */ + 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; + } + if (ts.isShorthandPropertyAssignment(bindingElement)) { + // `1` in `({ a = 1 } = ...)` + return bindingElement.objectAssignmentInitializer; + } + if (ts.isAssignmentExpression(bindingElement, /*excludeCompoundAssignment*/ true)) { + // `1` in `[a = 1] = ...` + // `1` in `[{a} = 1] = ...` + // `1` in `[[a] = 1] = ...` + return bindingElement.right; + } + if (ts.isSpreadExpression(bindingElement)) { + // Recovery consistent with existing emit. + return getInitializerOfBindingOrAssignmentElement(bindingElement.expression); + } + } + ts.getInitializerOfBindingOrAssignmentElement = getInitializerOfBindingOrAssignmentElement; + /** + * Gets the name of an BindingOrAssignmentElement. + */ + 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; + /** + * Determines whether an BindingOrAssignmentElement is a rest element. + */ + 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; + /** + * Gets the property name of a BindingOrAssignmentElement + */ + 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; + } + 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.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement; + /** + * Gets the elements of a BindingOrAssignmentPattern + */ + 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; + } + } + 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; + } + 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; + } + 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); + } + } + 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; + } + 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; + } + ts.convertToArrayAssignmentPattern = convertToArrayAssignmentPattern; + function convertToAssignmentElementTarget(node) { + if (ts.isBindingPattern(node)) { + return convertToAssignmentPattern(node); + } + 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); + } + 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; + } + } + 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 if (!ts.isGeneratedIdentifier(decl.name)) { + if (!uniqueExports[decl.name.text]) { + uniqueExports[decl.name.text] = true; + exportedNames = ts.append(exportedNames, decl.name); + } + } + return exportedNames; + } })(ts || (ts = {})); /// /// +/// var ts; (function (ts) { var NodeConstructor; @@ -8220,13 +13851,13 @@ var ts; var IdentifierConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 256 /* SourceFile */) { + if (kind === 261 /* SourceFile */) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } - else if (kind === 69 /* Identifier */) { + else if (kind === 70 /* Identifier */) { return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end); } - else if (kind < 139 /* FirstNode */) { + else if (kind < 141 /* FirstNode */) { return new (TokenConstructor || (TokenConstructor = ts.objectAllocator.getTokenConstructor()))(kind, pos, end); } else { @@ -8269,26 +13900,28 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 139 /* QualifiedName */: + case 141 /* QualifiedName */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 141 /* TypeParameter */: + case 143 /* TypeParameter */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 254 /* ShorthandPropertyAssignment */: + case 258 /* ShorthandPropertyAssignment */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || visitNode(cbNode, node.objectAssignmentInitializer); - case 142 /* Parameter */: - case 145 /* PropertyDeclaration */: - case 144 /* PropertySignature */: - case 253 /* PropertyAssignment */: - case 218 /* VariableDeclaration */: - case 169 /* BindingElement */: + case 259 /* SpreadAssignment */: + return visitNode(cbNode, node.expression); + case 144 /* Parameter */: + case 147 /* PropertyDeclaration */: + case 146 /* PropertySignature */: + case 257 /* PropertyAssignment */: + case 223 /* VariableDeclaration */: + case 174 /* BindingElement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || @@ -8297,24 +13930,24 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 156 /* FunctionType */: - case 157 /* ConstructorType */: - case 151 /* CallSignature */: - case 152 /* ConstructSignature */: - case 153 /* IndexSignature */: + case 158 /* FunctionType */: + case 159 /* ConstructorType */: + case 153 /* CallSignature */: + case 154 /* ConstructSignature */: + case 155 /* IndexSignature */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - case 148 /* Constructor */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - case 179 /* FunctionExpression */: - case 220 /* FunctionDeclaration */: - case 180 /* ArrowFunction */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + case 150 /* Constructor */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + case 184 /* FunctionExpression */: + case 225 /* FunctionDeclaration */: + case 185 /* ArrowFunction */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -8325,306 +13958,320 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 155 /* TypeReference */: + case 157 /* TypeReference */: return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 154 /* TypePredicate */: + case 156 /* TypePredicate */: return visitNode(cbNode, node.parameterName) || visitNode(cbNode, node.type); - case 158 /* TypeQuery */: + case 160 /* TypeQuery */: return visitNode(cbNode, node.exprName); - case 159 /* TypeLiteral */: + case 161 /* TypeLiteral */: return visitNodes(cbNodes, node.members); - case 160 /* ArrayType */: + case 162 /* ArrayType */: return visitNode(cbNode, node.elementType); - case 161 /* TupleType */: + case 163 /* TupleType */: return visitNodes(cbNodes, node.elementTypes); - case 162 /* UnionType */: - case 163 /* IntersectionType */: + case 164 /* UnionType */: + case 165 /* IntersectionType */: return visitNodes(cbNodes, node.types); - case 164 /* ParenthesizedType */: + case 166 /* ParenthesizedType */: + case 168 /* TypeOperator */: return visitNode(cbNode, node.type); - case 166 /* LiteralType */: + case 169 /* IndexedAccessType */: + return visitNode(cbNode, node.objectType) || + visitNode(cbNode, node.indexType); + case 170 /* MappedType */: + return visitNode(cbNode, node.readonlyToken) || + visitNode(cbNode, node.typeParameter) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type); + case 171 /* LiteralType */: return visitNode(cbNode, node.literal); - case 167 /* ObjectBindingPattern */: - case 168 /* ArrayBindingPattern */: + case 172 /* ObjectBindingPattern */: + case 173 /* ArrayBindingPattern */: return visitNodes(cbNodes, node.elements); - case 170 /* ArrayLiteralExpression */: + case 175 /* ArrayLiteralExpression */: return visitNodes(cbNodes, node.elements); - case 171 /* ObjectLiteralExpression */: + case 176 /* ObjectLiteralExpression */: return visitNodes(cbNodes, node.properties); - case 172 /* PropertyAccessExpression */: + case 177 /* PropertyAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.name); - case 173 /* ElementAccessExpression */: + case 178 /* ElementAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 174 /* CallExpression */: - case 175 /* NewExpression */: + case 179 /* CallExpression */: + case 180 /* NewExpression */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 176 /* TaggedTemplateExpression */: + case 181 /* TaggedTemplateExpression */: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 177 /* TypeAssertionExpression */: + case 182 /* TypeAssertionExpression */: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 178 /* ParenthesizedExpression */: + case 183 /* ParenthesizedExpression */: return visitNode(cbNode, node.expression); - case 181 /* DeleteExpression */: + case 186 /* DeleteExpression */: return visitNode(cbNode, node.expression); - case 182 /* TypeOfExpression */: + case 187 /* TypeOfExpression */: return visitNode(cbNode, node.expression); - case 183 /* VoidExpression */: + case 188 /* VoidExpression */: return visitNode(cbNode, node.expression); - case 185 /* PrefixUnaryExpression */: + case 190 /* PrefixUnaryExpression */: return visitNode(cbNode, node.operand); - case 190 /* YieldExpression */: + case 195 /* YieldExpression */: return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); - case 184 /* AwaitExpression */: + case 189 /* AwaitExpression */: return visitNode(cbNode, node.expression); - case 186 /* PostfixUnaryExpression */: + case 191 /* PostfixUnaryExpression */: return visitNode(cbNode, node.operand); - case 187 /* BinaryExpression */: + case 192 /* BinaryExpression */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 195 /* AsExpression */: + case 200 /* AsExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 196 /* NonNullExpression */: + case 201 /* NonNullExpression */: return visitNode(cbNode, node.expression); - case 188 /* ConditionalExpression */: + case 193 /* ConditionalExpression */: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 191 /* SpreadElementExpression */: + case 196 /* SpreadElement */: return visitNode(cbNode, node.expression); - case 199 /* Block */: - case 226 /* ModuleBlock */: + case 204 /* Block */: + case 231 /* ModuleBlock */: return visitNodes(cbNodes, node.statements); - case 256 /* SourceFile */: + case 261 /* SourceFile */: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 200 /* VariableStatement */: + case 205 /* VariableStatement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 219 /* VariableDeclarationList */: + case 224 /* VariableDeclarationList */: return visitNodes(cbNodes, node.declarations); - case 202 /* ExpressionStatement */: + case 207 /* ExpressionStatement */: return visitNode(cbNode, node.expression); - case 203 /* IfStatement */: + case 208 /* IfStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 204 /* DoStatement */: + case 209 /* DoStatement */: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 205 /* WhileStatement */: + case 210 /* WhileStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 206 /* ForStatement */: + case 211 /* ForStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 207 /* ForInStatement */: + case 212 /* ForInStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 208 /* ForOfStatement */: + case 213 /* ForOfStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 209 /* ContinueStatement */: - case 210 /* BreakStatement */: + case 214 /* ContinueStatement */: + case 215 /* BreakStatement */: return visitNode(cbNode, node.label); - case 211 /* ReturnStatement */: + case 216 /* ReturnStatement */: return visitNode(cbNode, node.expression); - case 212 /* WithStatement */: + case 217 /* WithStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 213 /* SwitchStatement */: + case 218 /* SwitchStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 227 /* CaseBlock */: + case 232 /* CaseBlock */: return visitNodes(cbNodes, node.clauses); - case 249 /* CaseClause */: + case 253 /* CaseClause */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 250 /* DefaultClause */: + case 254 /* DefaultClause */: return visitNodes(cbNodes, node.statements); - case 214 /* LabeledStatement */: + case 219 /* LabeledStatement */: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 215 /* ThrowStatement */: + case 220 /* ThrowStatement */: return visitNode(cbNode, node.expression); - case 216 /* TryStatement */: + case 221 /* TryStatement */: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 252 /* CatchClause */: + case 256 /* CatchClause */: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 143 /* Decorator */: + case 145 /* Decorator */: return visitNode(cbNode, node.expression); - case 221 /* ClassDeclaration */: - case 192 /* ClassExpression */: + case 226 /* ClassDeclaration */: + case 197 /* ClassExpression */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 222 /* InterfaceDeclaration */: + case 227 /* InterfaceDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 223 /* TypeAliasDeclaration */: + case 228 /* TypeAliasDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNode(cbNode, node.type); - case 224 /* EnumDeclaration */: + case 229 /* EnumDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); - case 255 /* EnumMember */: + case 260 /* EnumMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 225 /* ModuleDeclaration */: + case 230 /* ModuleDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 229 /* ImportEqualsDeclaration */: + case 234 /* ImportEqualsDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 230 /* ImportDeclaration */: + case 235 /* ImportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 231 /* ImportClause */: + case 236 /* ImportClause */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 228 /* NamespaceExportDeclaration */: + case 233 /* NamespaceExportDeclaration */: return visitNode(cbNode, node.name); - case 232 /* NamespaceImport */: + case 237 /* NamespaceImport */: return visitNode(cbNode, node.name); - case 233 /* NamedImports */: - case 237 /* NamedExports */: + case 238 /* NamedImports */: + case 242 /* NamedExports */: return visitNodes(cbNodes, node.elements); - case 236 /* ExportDeclaration */: + case 241 /* ExportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 234 /* ImportSpecifier */: - case 238 /* ExportSpecifier */: + case 239 /* ImportSpecifier */: + case 243 /* ExportSpecifier */: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 235 /* ExportAssignment */: + case 240 /* ExportAssignment */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 189 /* TemplateExpression */: + case 194 /* TemplateExpression */: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 197 /* TemplateSpan */: + case 202 /* TemplateSpan */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 140 /* ComputedPropertyName */: + case 142 /* ComputedPropertyName */: return visitNode(cbNode, node.expression); - case 251 /* HeritageClause */: + case 255 /* HeritageClause */: return visitNodes(cbNodes, node.types); - case 194 /* ExpressionWithTypeArguments */: + case 199 /* ExpressionWithTypeArguments */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 240 /* ExternalModuleReference */: + case 245 /* ExternalModuleReference */: return visitNode(cbNode, node.expression); - case 239 /* MissingDeclaration */: + case 244 /* MissingDeclaration */: return visitNodes(cbNodes, node.decorators); - case 241 /* JsxElement */: + case 246 /* JsxElement */: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 242 /* JsxSelfClosingElement */: - case 243 /* JsxOpeningElement */: + case 247 /* JsxSelfClosingElement */: + case 248 /* JsxOpeningElement */: return visitNode(cbNode, node.tagName) || visitNodes(cbNodes, node.attributes); - case 246 /* JsxAttribute */: + case 250 /* JsxAttribute */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 247 /* JsxSpreadAttribute */: + case 251 /* JsxSpreadAttribute */: return visitNode(cbNode, node.expression); - case 248 /* JsxExpression */: + case 252 /* JsxExpression */: return visitNode(cbNode, node.expression); - case 245 /* JsxClosingElement */: + case 249 /* JsxClosingElement */: return visitNode(cbNode, node.tagName); - case 257 /* JSDocTypeExpression */: + case 262 /* JSDocTypeExpression */: return visitNode(cbNode, node.type); - case 261 /* JSDocUnionType */: + case 266 /* JSDocUnionType */: return visitNodes(cbNodes, node.types); - case 262 /* JSDocTupleType */: + case 267 /* JSDocTupleType */: return visitNodes(cbNodes, node.types); - case 260 /* JSDocArrayType */: + case 265 /* JSDocArrayType */: return visitNode(cbNode, node.elementType); - case 264 /* JSDocNonNullableType */: + case 269 /* JSDocNonNullableType */: return visitNode(cbNode, node.type); - case 263 /* JSDocNullableType */: + case 268 /* JSDocNullableType */: return visitNode(cbNode, node.type); - case 265 /* JSDocRecordType */: - return visitNodes(cbNodes, node.members); - case 267 /* JSDocTypeReference */: + case 270 /* JSDocRecordType */: + return visitNode(cbNode, node.literal); + case 272 /* JSDocTypeReference */: return visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeArguments); - case 268 /* JSDocOptionalType */: + case 273 /* JSDocOptionalType */: return visitNode(cbNode, node.type); - case 269 /* JSDocFunctionType */: + case 274 /* JSDocFunctionType */: return visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 270 /* JSDocVariadicType */: + case 275 /* JSDocVariadicType */: return visitNode(cbNode, node.type); - case 271 /* JSDocConstructorType */: + case 276 /* JSDocConstructorType */: return visitNode(cbNode, node.type); - case 272 /* JSDocThisType */: + case 277 /* JSDocThisType */: return visitNode(cbNode, node.type); - case 266 /* JSDocRecordMember */: + case 271 /* JSDocRecordMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 273 /* JSDocComment */: + case 278 /* JSDocComment */: return visitNodes(cbNodes, node.tags); - case 275 /* JSDocParameterTag */: + case 281 /* JSDocParameterTag */: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 276 /* JSDocReturnTag */: + case 282 /* JSDocReturnTag */: return visitNode(cbNode, node.typeExpression); - case 277 /* JSDocTypeTag */: + case 283 /* JSDocTypeTag */: return visitNode(cbNode, node.typeExpression); - case 278 /* JSDocTemplateTag */: + case 280 /* JSDocAugmentsTag */: + return visitNode(cbNode, node.typeExpression); + case 284 /* JSDocTemplateTag */: return visitNodes(cbNodes, node.typeParameters); - case 279 /* JSDocTypedefTag */: + case 285 /* JSDocTypedefTag */: return visitNode(cbNode, node.typeExpression) || + visitNode(cbNode, node.fullName) || visitNode(cbNode, node.name) || visitNode(cbNode, node.jsDocTypeLiteral); - case 281 /* JSDocTypeLiteral */: + case 287 /* JSDocTypeLiteral */: return visitNodes(cbNodes, node.jsDocPropertyTags); - case 280 /* JSDocPropertyTag */: + case 286 /* JSDocPropertyTag */: return visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name); - case 282 /* JSDocLiteralType */: + case 294 /* PartiallyEmittedExpression */: + return visitNode(cbNode, node.expression); + case 288 /* JSDocLiteralType */: return visitNode(cbNode, node.literal); } } @@ -8638,6 +14285,10 @@ var ts; return result; } ts.createSourceFile = createSourceFile; + function parseIsolatedEntityName(text, languageVersion) { + return Parser.parseIsolatedEntityName(text, languageVersion); + } + ts.parseIsolatedEntityName = parseIsolatedEntityName; function isExternalModule(file) { return file.externalModuleIndicator !== undefined; } @@ -8658,10 +14309,10 @@ var ts; /* @internal */ function parseIsolatedJSDocComment(content, start, length) { var result = Parser.JSDocParser.parseIsolatedJSDocComment(content, start, length); - if (result && result.jsDocComment) { + if (result && result.jsDoc) { // because the jsDocComment was parsed out of the source file, it might // not be covered by the fixupParentReferences. - Parser.fixupParentReferences(result.jsDocComment); + Parser.fixupParentReferences(result.jsDoc); } return result; } @@ -8679,8 +14330,8 @@ var ts; (function (Parser) { // Share a single scanner across all calls to parse a source file. This helps speed things // up by avoiding the cost of creating/compiling scanners over and over again. - var scanner = ts.createScanner(2 /* Latest */, /*skipTrivia*/ true); - var disallowInAndDecoratorContext = 4194304 /* DisallowInContext */ | 16777216 /* DecoratorContext */; + var scanner = ts.createScanner(5 /* Latest */, /*skipTrivia*/ true); + var disallowInAndDecoratorContext = 2048 /* DisallowInContext */ | 8192 /* DecoratorContext */; // capture constructors in 'initializeState' to avoid null checks var NodeConstructor; var TokenConstructor; @@ -8770,19 +14421,29 @@ var ts; // Note: any errors at the end of the file that do not precede a regular node, should get // attached to the EOF token. var parseErrorBeforeNextFinishedNode = false; - function parseSourceFile(fileName, _sourceText, languageVersion, _syntaxCursor, setParentNodes, scriptKind) { + function parseSourceFile(fileName, sourceText, languageVersion, syntaxCursor, setParentNodes, scriptKind) { scriptKind = ts.ensureScriptKind(fileName, scriptKind); - initializeState(fileName, _sourceText, languageVersion, _syntaxCursor, scriptKind); + initializeState(sourceText, languageVersion, syntaxCursor, scriptKind); var result = parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind); clearState(); return result; } Parser.parseSourceFile = parseSourceFile; + function parseIsolatedEntityName(content, languageVersion) { + initializeState(content, languageVersion, /*syntaxCursor*/ undefined, 1 /* JS */); + // Prime the scanner. + nextToken(); + var entityName = parseEntityName(/*allowReservedWords*/ true); + var isInvalid = token() === 1 /* EndOfFileToken */ && !parseDiagnostics.length; + clearState(); + return isInvalid ? entityName : undefined; + } + Parser.parseIsolatedEntityName = parseIsolatedEntityName; function getLanguageVariant(scriptKind) { // .tsx and .jsx files are treated as jsx language variant. return scriptKind === 4 /* TSX */ || scriptKind === 2 /* JSX */ || scriptKind === 1 /* JS */ ? 1 /* JSX */ : 0 /* Standard */; } - function initializeState(fileName, _sourceText, languageVersion, _syntaxCursor, scriptKind) { + function initializeState(_sourceText, languageVersion, _syntaxCursor, scriptKind) { NodeConstructor = ts.objectAllocator.getNodeConstructor(); TokenConstructor = ts.objectAllocator.getTokenConstructor(); IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor(); @@ -8794,7 +14455,7 @@ var ts; identifiers = ts.createMap(); identifierCount = 0; nodeCount = 0; - contextFlags = scriptKind === 1 /* JS */ || scriptKind === 2 /* JSX */ ? 134217728 /* JavaScriptFile */ : 0 /* None */; + contextFlags = scriptKind === 1 /* JS */ || scriptKind === 2 /* JSX */ ? 65536 /* JavaScriptFile */ : 0 /* None */; parseErrorBeforeNextFinishedNode = false; // Initialize and prime the scanner before parsing the source elements. scanner.setText(sourceText); @@ -8833,20 +14494,18 @@ var ts; return sourceFile; } function addJSDocComment(node) { - if (contextFlags & 134217728 /* JavaScriptFile */) { - var comments = ts.getLeadingCommentRangesOfNode(node, sourceFile); - if (comments) { - for (var _i = 0, comments_1 = comments; _i < comments_1.length; _i++) { - var comment = comments_1[_i]; - var jsDocComment = JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos); - if (!jsDocComment) { - continue; - } - if (!node.jsDocComments) { - node.jsDocComments = []; - } - node.jsDocComments.push(jsDocComment); + 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]; + var jsDoc = JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos); + if (!jsDoc) { + continue; } + if (!node.jsDoc) { + node.jsDoc = []; + } + node.jsDoc.push(jsDoc); } } return node; @@ -8868,12 +14527,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; @@ -8884,7 +14543,7 @@ var ts; function createSourceFile(fileName, languageVersion, scriptKind) { // code from createNode is inlined here so createNode won't have to deal with special case of creating source files // this is quite rare comparing to other nodes and createNode should be as fast as possible - var sourceFile = new SourceFileConstructor(256 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); + var sourceFile = new SourceFileConstructor(261 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -8904,16 +14563,16 @@ var ts; } } function setDisallowInContext(val) { - setContextFlag(val, 4194304 /* DisallowInContext */); + setContextFlag(val, 2048 /* DisallowInContext */); } function setYieldContext(val) { - setContextFlag(val, 8388608 /* YieldContext */); + setContextFlag(val, 4096 /* YieldContext */); } function setDecoratorContext(val) { - setContextFlag(val, 16777216 /* DecoratorContext */); + setContextFlag(val, 8192 /* DecoratorContext */); } function setAwaitContext(val) { - setContextFlag(val, 33554432 /* AwaitContext */); + setContextFlag(val, 16384 /* AwaitContext */); } function doOutsideOfContext(context, func) { // contextFlagsToClear will contain only the context flags that are @@ -8954,40 +14613,40 @@ var ts; return func(); } function allowInAnd(func) { - return doOutsideOfContext(4194304 /* DisallowInContext */, func); + return doOutsideOfContext(2048 /* DisallowInContext */, func); } function disallowInAnd(func) { - return doInsideOfContext(4194304 /* DisallowInContext */, func); + return doInsideOfContext(2048 /* DisallowInContext */, func); } function doInYieldContext(func) { - return doInsideOfContext(8388608 /* YieldContext */, func); + return doInsideOfContext(4096 /* YieldContext */, func); } function doInDecoratorContext(func) { - return doInsideOfContext(16777216 /* DecoratorContext */, func); + return doInsideOfContext(8192 /* DecoratorContext */, func); } function doInAwaitContext(func) { - return doInsideOfContext(33554432 /* AwaitContext */, func); + return doInsideOfContext(16384 /* AwaitContext */, func); } function doOutsideOfAwaitContext(func) { - return doOutsideOfContext(33554432 /* AwaitContext */, func); + return doOutsideOfContext(16384 /* AwaitContext */, func); } function doInYieldAndAwaitContext(func) { - return doInsideOfContext(8388608 /* YieldContext */ | 33554432 /* AwaitContext */, func); + return doInsideOfContext(4096 /* YieldContext */ | 16384 /* AwaitContext */, func); } function inContext(flags) { return (contextFlags & flags) !== 0; } function inYieldContext() { - return inContext(8388608 /* YieldContext */); + return inContext(4096 /* YieldContext */); } function inDisallowInContext() { - return inContext(4194304 /* DisallowInContext */); + return inContext(2048 /* DisallowInContext */); } function inDecoratorContext() { - return inContext(16777216 /* DecoratorContext */); + return inContext(8192 /* DecoratorContext */); } function inAwaitContext() { - return inContext(33554432 /* AwaitContext */); + return inContext(16384 /* AwaitContext */); } function parseErrorAtCurrentToken(message, arg0) { var start = scanner.getTokenPos(); @@ -9041,6 +14700,9 @@ var ts; function scanJsxText() { return currentToken = scanner.scanJsxToken(); } + function scanJsxAttributeValue() { + return currentToken = scanner.scanJsxAttributeValue(); + } function speculationHelper(callback, isLookAhead) { // Keep track of the state we'll need to rollback to if lookahead fails (or if the // caller asked us to always reset our state). @@ -9085,20 +14747,20 @@ var ts; } // Ignore strict mode flag because we will report an error in type checker instead. function isIdentifier() { - if (token() === 69 /* Identifier */) { + if (token() === 70 /* Identifier */) { return true; } // If we have a 'yield' keyword, and we're in the [yield] context, then 'yield' is // considered a keyword and is not an identifier. - if (token() === 114 /* YieldKeyword */ && inYieldContext()) { + if (token() === 115 /* YieldKeyword */ && inYieldContext()) { return false; } // If we have a 'await' keyword, and we're in the [Await] context, then 'await' is // considered a keyword and is not an identifier. - if (token() === 119 /* AwaitKeyword */ && inAwaitContext()) { + if (token() === 120 /* AwaitKeyword */ && inAwaitContext()) { return false; } - return token() > 105 /* LastReservedWord */; + return token() > 106 /* LastReservedWord */; } function parseExpected(kind, diagnosticMessage, shouldAdvance) { if (shouldAdvance === void 0) { shouldAdvance = true; } @@ -9141,22 +14803,22 @@ var ts; } function canParseSemicolon() { // If there's a real semicolon, then we can always parse it out. - if (token() === 23 /* SemicolonToken */) { + if (token() === 24 /* SemicolonToken */) { return true; } // We can parse out an optional semicolon in ASI cases in the following cases. - return token() === 16 /* CloseBraceToken */ || token() === 1 /* EndOfFileToken */ || scanner.hasPrecedingLineBreak(); + return token() === 17 /* CloseBraceToken */ || token() === 1 /* EndOfFileToken */ || scanner.hasPrecedingLineBreak(); } function parseSemicolon() { if (canParseSemicolon()) { - if (token() === 23 /* SemicolonToken */) { + if (token() === 24 /* SemicolonToken */) { // consume the semicolon if it was explicitly provided. nextToken(); } return true; } else { - return parseExpected(23 /* SemicolonToken */); + return parseExpected(24 /* SemicolonToken */); } } // note: this function creates only node @@ -9165,10 +14827,19 @@ var ts; if (!(pos >= 0)) { pos = scanner.getStartPos(); } - return kind >= 139 /* FirstNode */ ? new NodeConstructor(kind, pos, pos) : - kind === 69 /* Identifier */ ? new IdentifierConstructor(kind, pos, pos) : + return kind >= 141 /* FirstNode */ ? new NodeConstructor(kind, pos, pos) : + kind === 70 /* Identifier */ ? new IdentifierConstructor(kind, pos, pos) : new TokenConstructor(kind, pos, pos); } + function createNodeArray(elements, pos) { + var array = (elements || []); + if (!(pos >= 0)) { + pos = getNodePos(); + } + array.pos = pos; + array.end = pos; + return array; + } function finishNode(node, end) { node.end = end === undefined ? scanner.getStartPos() : end; if (contextFlags) { @@ -9179,7 +14850,7 @@ var ts; // flag so that we don't mark any subsequent nodes. if (parseErrorBeforeNextFinishedNode) { parseErrorBeforeNextFinishedNode = false; - node.flags |= 67108864 /* ThisNodeHasError */; + node.flags |= 32768 /* ThisNodeHasError */; } return node; } @@ -9204,16 +14875,16 @@ var ts; function createIdentifier(isIdentifier, diagnosticMessage) { identifierCount++; if (isIdentifier) { - var node = createNode(69 /* Identifier */); + var node = createNode(70 /* Identifier */); // Store original token kind if it is not just an Identifier so we can report appropriate error later in type checker - if (token() !== 69 /* Identifier */) { + if (token() !== 70 /* Identifier */) { node.originalKeywordKind = token(); } node.text = internIdentifier(scanner.getTokenValue()); nextToken(); return finishNode(node); } - return createMissingNode(69 /* Identifier */, /*reportAtCurrentPosition*/ false, diagnosticMessage || ts.Diagnostics.Identifier_expected); + return createMissingNode(70 /* Identifier */, /*reportAtCurrentPosition*/ false, diagnosticMessage || ts.Diagnostics.Identifier_expected); } function parseIdentifier(diagnosticMessage) { return createIdentifier(isIdentifier(), diagnosticMessage); @@ -9230,7 +14901,7 @@ var ts; if (token() === 9 /* StringLiteral */ || token() === 8 /* NumericLiteral */) { return parseLiteralNode(/*internName*/ true); } - if (allowComputedPropertyNames && token() === 19 /* OpenBracketToken */) { + if (allowComputedPropertyNames && token() === 20 /* OpenBracketToken */) { return parseComputedPropertyName(); } return parseIdentifierName(); @@ -9248,13 +14919,13 @@ var ts; // PropertyName [Yield]: // LiteralPropertyName // ComputedPropertyName[?Yield] - var node = createNode(140 /* ComputedPropertyName */); - parseExpected(19 /* OpenBracketToken */); + var node = createNode(142 /* ComputedPropertyName */); + parseExpected(20 /* OpenBracketToken */); // We parse any expression (including a comma expression). But the grammar // says that only an assignment expression is allowed, so the grammar checker // will error if it sees a comma expression. node.expression = allowInAnd(parseExpression); - parseExpected(20 /* CloseBracketToken */); + parseExpected(21 /* CloseBracketToken */); return finishNode(node); } function parseContextualModifier(t) { @@ -9268,21 +14939,21 @@ var ts; return canFollowModifier(); } function nextTokenCanFollowModifier() { - if (token() === 74 /* ConstKeyword */) { + if (token() === 75 /* ConstKeyword */) { // 'const' is only a modifier if followed by 'enum'. - return nextToken() === 81 /* EnumKeyword */; + return nextToken() === 82 /* EnumKeyword */; } - if (token() === 82 /* ExportKeyword */) { + if (token() === 83 /* ExportKeyword */) { nextToken(); - if (token() === 77 /* DefaultKeyword */) { + if (token() === 78 /* DefaultKeyword */) { return lookAhead(nextTokenIsClassOrFunctionOrAsync); } - return token() !== 37 /* AsteriskToken */ && token() !== 116 /* AsKeyword */ && token() !== 15 /* OpenBraceToken */ && canFollowModifier(); + return token() !== 38 /* AsteriskToken */ && token() !== 117 /* AsKeyword */ && token() !== 16 /* OpenBraceToken */ && canFollowModifier(); } - if (token() === 77 /* DefaultKeyword */) { + if (token() === 78 /* DefaultKeyword */) { return nextTokenIsClassOrFunctionOrAsync(); } - if (token() === 113 /* StaticKeyword */) { + if (token() === 114 /* StaticKeyword */) { nextToken(); return canFollowModifier(); } @@ -9292,16 +14963,16 @@ var ts; return ts.isModifierKind(token()) && tryParse(nextTokenCanFollowModifier); } function canFollowModifier() { - return token() === 19 /* OpenBracketToken */ - || token() === 15 /* OpenBraceToken */ - || token() === 37 /* AsteriskToken */ - || token() === 22 /* DotDotDotToken */ + return token() === 20 /* OpenBracketToken */ + || token() === 16 /* OpenBraceToken */ + || token() === 38 /* AsteriskToken */ + || token() === 23 /* DotDotDotToken */ || isLiteralPropertyName(); } function nextTokenIsClassOrFunctionOrAsync() { nextToken(); - return token() === 73 /* ClassKeyword */ || token() === 87 /* FunctionKeyword */ || - (token() === 118 /* AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); + return token() === 74 /* ClassKeyword */ || token() === 88 /* FunctionKeyword */ || + (token() === 119 /* AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); } // True if positioned at the start of a list element function isListElement(parsingContext, inErrorRecovery) { @@ -9319,9 +14990,9 @@ var ts; // we're parsing. For example, if we have a semicolon in the middle of a class, then // we really don't want to assume the class is over and we're on a statement in the // outer module. We just want to consume and move on. - return !(token() === 23 /* SemicolonToken */ && inErrorRecovery) && isStartOfStatement(); + return !(token() === 24 /* SemicolonToken */ && inErrorRecovery) && isStartOfStatement(); case 2 /* SwitchClauses */: - return token() === 71 /* CaseKeyword */ || token() === 77 /* DefaultKeyword */; + return token() === 72 /* CaseKeyword */ || token() === 78 /* DefaultKeyword */; case 4 /* TypeMembers */: return lookAhead(isTypeMemberStart); case 5 /* ClassMembers */: @@ -9329,19 +15000,21 @@ var ts; // not in error recovery. If we're in error recovery, we don't want an errant // semicolon to be treated as a class member (since they're almost always used // for statements. - return lookAhead(isClassMemberStart) || (token() === 23 /* SemicolonToken */ && !inErrorRecovery); + return lookAhead(isClassMemberStart) || (token() === 24 /* SemicolonToken */ && !inErrorRecovery); case 6 /* EnumMembers */: // Include open bracket computed properties. This technically also lets in indexers, // which would be a candidate for improved error reporting. - return token() === 19 /* OpenBracketToken */ || isLiteralPropertyName(); + return token() === 20 /* OpenBracketToken */ || isLiteralPropertyName(); case 12 /* ObjectLiteralMembers */: - return token() === 19 /* OpenBracketToken */ || token() === 37 /* AsteriskToken */ || isLiteralPropertyName(); + return token() === 20 /* OpenBracketToken */ || token() === 38 /* AsteriskToken */ || token() === 23 /* DotDotDotToken */ || isLiteralPropertyName(); + case 17 /* RestProperties */: + return isLiteralPropertyName(); case 9 /* ObjectBindingElements */: - return token() === 19 /* OpenBracketToken */ || isLiteralPropertyName(); + return token() === 20 /* OpenBracketToken */ || token() === 23 /* DotDotDotToken */ || isLiteralPropertyName(); case 7 /* HeritageClauseElement */: // If we see { } then only consume it as an expression if it is followed by , or { // That way we won't consume the body of a class in its heritage clause. - if (token() === 15 /* OpenBraceToken */) { + if (token() === 16 /* OpenBraceToken */) { return lookAhead(isValidHeritageClauseObjectLiteral); } if (!inErrorRecovery) { @@ -9356,37 +15029,37 @@ var ts; case 8 /* VariableDeclarations */: return isIdentifierOrPattern(); case 10 /* ArrayBindingElements */: - return token() === 24 /* CommaToken */ || token() === 22 /* DotDotDotToken */ || isIdentifierOrPattern(); - case 17 /* TypeParameters */: + return token() === 25 /* CommaToken */ || token() === 23 /* DotDotDotToken */ || isIdentifierOrPattern(); + case 18 /* TypeParameters */: return isIdentifier(); case 11 /* ArgumentExpressions */: case 15 /* ArrayLiteralMembers */: - return token() === 24 /* CommaToken */ || token() === 22 /* DotDotDotToken */ || isStartOfExpression(); + return token() === 25 /* CommaToken */ || token() === 23 /* DotDotDotToken */ || isStartOfExpression(); case 16 /* Parameters */: return isStartOfParameter(); - case 18 /* TypeArguments */: - case 19 /* TupleElementTypes */: - return token() === 24 /* CommaToken */ || isStartOfType(); - case 20 /* HeritageClauses */: + case 19 /* TypeArguments */: + case 20 /* TupleElementTypes */: + return token() === 25 /* CommaToken */ || isStartOfType(); + case 21 /* HeritageClauses */: return isHeritageClause(); - case 21 /* ImportOrExportSpecifiers */: + case 22 /* ImportOrExportSpecifiers */: return ts.tokenIsIdentifierOrKeyword(token()); case 13 /* JsxAttributes */: - return ts.tokenIsIdentifierOrKeyword(token()) || token() === 15 /* OpenBraceToken */; + return ts.tokenIsIdentifierOrKeyword(token()) || token() === 16 /* OpenBraceToken */; case 14 /* JsxChildren */: return true; - case 22 /* JSDocFunctionParameters */: - case 23 /* JSDocTypeArguments */: - case 25 /* JSDocTupleTypes */: + case 23 /* JSDocFunctionParameters */: + case 24 /* JSDocTypeArguments */: + case 26 /* JSDocTupleTypes */: return JSDocParser.isJSDocType(); - case 24 /* JSDocRecordMembers */: + case 25 /* JSDocRecordMembers */: return isSimplePropertyName(); } ts.Debug.fail("Non-exhaustive case in 'isListElement'."); } function isValidHeritageClauseObjectLiteral() { - ts.Debug.assert(token() === 15 /* OpenBraceToken */); - if (nextToken() === 16 /* CloseBraceToken */) { + ts.Debug.assert(token() === 16 /* OpenBraceToken */); + if (nextToken() === 17 /* CloseBraceToken */) { // if we see "extends {}" then only treat the {} as what we're extending (and not // the class body) if we have: // @@ -9395,7 +15068,7 @@ var ts; // extends {} extends // extends {} implements var next = nextToken(); - return next === 24 /* CommaToken */ || next === 15 /* OpenBraceToken */ || next === 83 /* ExtendsKeyword */ || next === 106 /* ImplementsKeyword */; + return next === 25 /* CommaToken */ || next === 16 /* OpenBraceToken */ || next === 84 /* ExtendsKeyword */ || next === 107 /* ImplementsKeyword */; } return true; } @@ -9408,8 +15081,8 @@ var ts; return ts.tokenIsIdentifierOrKeyword(token()); } function isHeritageClauseExtendsOrImplementsKeyword() { - if (token() === 106 /* ImplementsKeyword */ || - token() === 83 /* ExtendsKeyword */) { + if (token() === 107 /* ImplementsKeyword */ || + token() === 84 /* ExtendsKeyword */) { return lookAhead(nextTokenIsStartOfExpression); } return false; @@ -9432,44 +15105,45 @@ var ts; case 6 /* EnumMembers */: case 12 /* ObjectLiteralMembers */: case 9 /* ObjectBindingElements */: - case 21 /* ImportOrExportSpecifiers */: - return token() === 16 /* CloseBraceToken */; + case 22 /* ImportOrExportSpecifiers */: + return token() === 17 /* CloseBraceToken */; case 3 /* SwitchClauseStatements */: - return token() === 16 /* CloseBraceToken */ || token() === 71 /* CaseKeyword */ || token() === 77 /* DefaultKeyword */; + return token() === 17 /* CloseBraceToken */ || token() === 72 /* CaseKeyword */ || token() === 78 /* DefaultKeyword */; case 7 /* HeritageClauseElement */: - return token() === 15 /* OpenBraceToken */ || token() === 83 /* ExtendsKeyword */ || token() === 106 /* ImplementsKeyword */; + return token() === 16 /* OpenBraceToken */ || token() === 84 /* ExtendsKeyword */ || token() === 107 /* ImplementsKeyword */; case 8 /* VariableDeclarations */: return isVariableDeclaratorListTerminator(); - case 17 /* TypeParameters */: + case 18 /* TypeParameters */: // Tokens other than '>' are here for better error recovery - return token() === 27 /* GreaterThanToken */ || token() === 17 /* OpenParenToken */ || token() === 15 /* OpenBraceToken */ || token() === 83 /* ExtendsKeyword */ || token() === 106 /* ImplementsKeyword */; + return token() === 28 /* GreaterThanToken */ || token() === 18 /* OpenParenToken */ || token() === 16 /* OpenBraceToken */ || token() === 84 /* ExtendsKeyword */ || token() === 107 /* ImplementsKeyword */; case 11 /* ArgumentExpressions */: // Tokens other than ')' are here for better error recovery - return token() === 18 /* CloseParenToken */ || token() === 23 /* SemicolonToken */; + return token() === 19 /* CloseParenToken */ || token() === 24 /* SemicolonToken */; case 15 /* ArrayLiteralMembers */: - case 19 /* TupleElementTypes */: + case 20 /* TupleElementTypes */: case 10 /* ArrayBindingElements */: - return token() === 20 /* CloseBracketToken */; + return token() === 21 /* CloseBracketToken */; case 16 /* Parameters */: + case 17 /* RestProperties */: // Tokens other than ')' and ']' (the latter for index signatures) are here for better error recovery - return token() === 18 /* CloseParenToken */ || token() === 20 /* CloseBracketToken */ /*|| token === SyntaxKind.OpenBraceToken*/; - case 18 /* TypeArguments */: - // Tokens other than '>' are here for better error recovery - return token() === 27 /* GreaterThanToken */ || token() === 17 /* OpenParenToken */; - case 20 /* HeritageClauses */: - return token() === 15 /* OpenBraceToken */ || token() === 16 /* CloseBraceToken */; + return token() === 19 /* CloseParenToken */ || token() === 21 /* CloseBracketToken */ /*|| token === SyntaxKind.OpenBraceToken*/; + case 19 /* TypeArguments */: + // All other tokens should cause the type-argument to terminate except comma token + return token() !== 25 /* CommaToken */; + case 21 /* HeritageClauses */: + return token() === 16 /* OpenBraceToken */ || token() === 17 /* CloseBraceToken */; case 13 /* JsxAttributes */: - return token() === 27 /* GreaterThanToken */ || token() === 39 /* SlashToken */; + return token() === 28 /* GreaterThanToken */ || token() === 40 /* SlashToken */; case 14 /* JsxChildren */: - return token() === 25 /* LessThanToken */ && lookAhead(nextTokenIsSlash); - case 22 /* JSDocFunctionParameters */: - return token() === 18 /* CloseParenToken */ || token() === 54 /* ColonToken */ || token() === 16 /* CloseBraceToken */; - case 23 /* JSDocTypeArguments */: - return token() === 27 /* GreaterThanToken */ || token() === 16 /* CloseBraceToken */; - case 25 /* JSDocTupleTypes */: - return token() === 20 /* CloseBracketToken */ || token() === 16 /* CloseBraceToken */; - case 24 /* JSDocRecordMembers */: - return token() === 16 /* CloseBraceToken */; + return token() === 26 /* LessThanToken */ && lookAhead(nextTokenIsSlash); + case 23 /* JSDocFunctionParameters */: + return token() === 19 /* CloseParenToken */ || token() === 55 /* ColonToken */ || token() === 17 /* CloseBraceToken */; + case 24 /* JSDocTypeArguments */: + return token() === 28 /* GreaterThanToken */ || token() === 17 /* CloseBraceToken */; + case 26 /* JSDocTupleTypes */: + return token() === 21 /* CloseBracketToken */ || token() === 17 /* CloseBraceToken */; + case 25 /* JSDocRecordMembers */: + return token() === 17 /* CloseBraceToken */; } } function isVariableDeclaratorListTerminator() { @@ -9487,7 +15161,7 @@ var ts; // For better error recovery, if we see an '=>' then we just stop immediately. We've got an // arrow function here and it's going to be very unlikely that we'll resynchronize and get // another variable declaration. - if (token() === 34 /* EqualsGreaterThanToken */) { + if (token() === 35 /* EqualsGreaterThanToken */) { return true; } // Keep trying to parse out variable declarators. @@ -9495,7 +15169,7 @@ var ts; } // True if positioned at element or terminator of the current list or any enclosing list function isInSomeParsingContext() { - for (var kind = 0; kind < 26 /* Count */; kind++) { + for (var kind = 0; kind < 27 /* Count */; kind++) { if (parsingContext & (1 << kind)) { if (isListElement(kind, /*inErrorRecovery*/ true) || isListTerminator(kind)) { return true; @@ -9508,8 +15182,7 @@ var ts; function parseList(kind, parseElement) { var saveParsingContext = parsingContext; parsingContext |= 1 << kind; - var result = []; - result.pos = getNodePos(); + var result = createNodeArray(); while (!isListTerminator(kind)) { if (isListElement(kind, /*inErrorRecovery*/ false)) { var element = parseListElement(kind, parseElement); @@ -9571,7 +15244,7 @@ var ts; // differently depending on what mode it is in. // // This also applies to all our other context flags as well. - var nodeContextFlags = node.flags & 197132288 /* ContextFlags */; + var nodeContextFlags = node.flags & 96256 /* ContextFlags */; if (nodeContextFlags !== contextFlags) { return undefined; } @@ -9606,20 +15279,22 @@ var ts; return isReusableVariableDeclaration(node); case 16 /* Parameters */: return isReusableParameter(node); + case 17 /* RestProperties */: + return false; // Any other lists we do not care about reusing nodes in. But feel free to add if // you can do so safely. Danger areas involve nodes that may involve speculative // parsing. If speculative parsing is involved with the node, then the range the // parser reached while looking ahead might be in the edited range (see the example // in canReuseVariableDeclaratorNode for a good case of this). - case 20 /* HeritageClauses */: + case 21 /* HeritageClauses */: // This would probably be safe to reuse. There is no speculative parsing with // heritage clauses. - case 17 /* TypeParameters */: + case 18 /* TypeParameters */: // This would probably be safe to reuse. There is no speculative parsing with // type parameters. Note that that's because type *parameters* only occur in // unambiguous *type* contexts. While type *arguments* occur in very ambiguous // *expression* contexts. - case 19 /* TupleElementTypes */: + case 20 /* TupleElementTypes */: // This would probably be safe to reuse. There is no speculative parsing with // tuple types. // Technically, type argument list types are probably safe to reuse. While @@ -9627,7 +15302,7 @@ var ts; // produced from speculative parsing a < as a type argument list), we only have // the types because speculative parsing succeeded. Thus, the lookahead never // went past the end of the list and rewound. - case 18 /* TypeArguments */: + case 19 /* TypeArguments */: // Note: these are almost certainly not safe to ever reuse. Expressions commonly // need a large amount of lookahead, and we should not reuse them as they may // have actually intersected the edit. @@ -9651,20 +15326,20 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 148 /* Constructor */: - case 153 /* IndexSignature */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - case 145 /* PropertyDeclaration */: - case 198 /* SemicolonClassElement */: + case 150 /* Constructor */: + case 155 /* IndexSignature */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + case 147 /* PropertyDeclaration */: + case 203 /* SemicolonClassElement */: return true; - case 147 /* MethodDeclaration */: + case 149 /* MethodDeclaration */: // Method declarations are not necessarily reusable. An object-literal // may have a method calls "constructor(...)" and we must reparse that // into an actual .ConstructorDeclaration. var methodDeclaration = node; - var nameIsConstructor = methodDeclaration.name.kind === 69 /* Identifier */ && - methodDeclaration.name.originalKeywordKind === 121 /* ConstructorKeyword */; + var nameIsConstructor = methodDeclaration.name.kind === 70 /* Identifier */ && + methodDeclaration.name.originalKeywordKind === 122 /* ConstructorKeyword */; return !nameIsConstructor; } } @@ -9673,8 +15348,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 249 /* CaseClause */: - case 250 /* DefaultClause */: + case 253 /* CaseClause */: + case 254 /* DefaultClause */: return true; } } @@ -9683,58 +15358,58 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 220 /* FunctionDeclaration */: - case 200 /* VariableStatement */: - case 199 /* Block */: - case 203 /* IfStatement */: - case 202 /* ExpressionStatement */: - case 215 /* ThrowStatement */: - case 211 /* ReturnStatement */: - case 213 /* SwitchStatement */: - case 210 /* BreakStatement */: - case 209 /* ContinueStatement */: - case 207 /* ForInStatement */: - case 208 /* ForOfStatement */: - case 206 /* ForStatement */: - case 205 /* WhileStatement */: - case 212 /* WithStatement */: - case 201 /* EmptyStatement */: - case 216 /* TryStatement */: - case 214 /* LabeledStatement */: - case 204 /* DoStatement */: - case 217 /* DebuggerStatement */: - case 230 /* ImportDeclaration */: - case 229 /* ImportEqualsDeclaration */: - case 236 /* ExportDeclaration */: - case 235 /* ExportAssignment */: - case 225 /* ModuleDeclaration */: - case 221 /* ClassDeclaration */: - case 222 /* InterfaceDeclaration */: - case 224 /* EnumDeclaration */: - case 223 /* TypeAliasDeclaration */: + case 225 /* FunctionDeclaration */: + case 205 /* VariableStatement */: + case 204 /* Block */: + case 208 /* IfStatement */: + case 207 /* ExpressionStatement */: + case 220 /* ThrowStatement */: + case 216 /* ReturnStatement */: + case 218 /* SwitchStatement */: + case 215 /* BreakStatement */: + case 214 /* ContinueStatement */: + case 212 /* ForInStatement */: + case 213 /* ForOfStatement */: + case 211 /* ForStatement */: + case 210 /* WhileStatement */: + case 217 /* WithStatement */: + case 206 /* EmptyStatement */: + case 221 /* TryStatement */: + case 219 /* LabeledStatement */: + case 209 /* DoStatement */: + case 222 /* DebuggerStatement */: + case 235 /* ImportDeclaration */: + case 234 /* ImportEqualsDeclaration */: + case 241 /* ExportDeclaration */: + case 240 /* ExportAssignment */: + case 230 /* ModuleDeclaration */: + case 226 /* ClassDeclaration */: + case 227 /* InterfaceDeclaration */: + case 229 /* EnumDeclaration */: + case 228 /* TypeAliasDeclaration */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 255 /* EnumMember */; + return node.kind === 260 /* EnumMember */; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 152 /* ConstructSignature */: - case 146 /* MethodSignature */: - case 153 /* IndexSignature */: - case 144 /* PropertySignature */: - case 151 /* CallSignature */: + case 154 /* ConstructSignature */: + case 148 /* MethodSignature */: + case 155 /* IndexSignature */: + case 146 /* PropertySignature */: + case 153 /* CallSignature */: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 218 /* VariableDeclaration */) { + if (node.kind !== 223 /* VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: @@ -9755,7 +15430,7 @@ var ts; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 142 /* Parameter */) { + if (node.kind !== 144 /* Parameter */) { return false; } // See the comment in isReusableVariableDeclaration for why we do this. @@ -9777,6 +15452,7 @@ var ts; case 1 /* BlockStatements */: return ts.Diagnostics.Declaration_or_statement_expected; case 2 /* SwitchClauses */: return ts.Diagnostics.case_or_default_expected; case 3 /* SwitchClauseStatements */: return ts.Diagnostics.Statement_expected; + case 17 /* RestProperties */: // fallthrough case 4 /* TypeMembers */: return ts.Diagnostics.Property_or_signature_expected; case 5 /* ClassMembers */: return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; case 6 /* EnumMembers */: return ts.Diagnostics.Enum_member_expected; @@ -9788,17 +15464,17 @@ var ts; case 12 /* ObjectLiteralMembers */: return ts.Diagnostics.Property_assignment_expected; case 15 /* ArrayLiteralMembers */: return ts.Diagnostics.Expression_or_comma_expected; case 16 /* Parameters */: return ts.Diagnostics.Parameter_declaration_expected; - case 17 /* TypeParameters */: return ts.Diagnostics.Type_parameter_declaration_expected; - case 18 /* TypeArguments */: return ts.Diagnostics.Type_argument_expected; - case 19 /* TupleElementTypes */: return ts.Diagnostics.Type_expected; - case 20 /* HeritageClauses */: return ts.Diagnostics.Unexpected_token_expected; - case 21 /* ImportOrExportSpecifiers */: return ts.Diagnostics.Identifier_expected; + case 18 /* TypeParameters */: return ts.Diagnostics.Type_parameter_declaration_expected; + case 19 /* TypeArguments */: return ts.Diagnostics.Type_argument_expected; + case 20 /* TupleElementTypes */: return ts.Diagnostics.Type_expected; + case 21 /* HeritageClauses */: return ts.Diagnostics.Unexpected_token_expected; + case 22 /* ImportOrExportSpecifiers */: return ts.Diagnostics.Identifier_expected; case 13 /* JsxAttributes */: return ts.Diagnostics.Identifier_expected; case 14 /* JsxChildren */: return ts.Diagnostics.Identifier_expected; - case 22 /* JSDocFunctionParameters */: return ts.Diagnostics.Parameter_declaration_expected; - case 23 /* JSDocTypeArguments */: return ts.Diagnostics.Type_argument_expected; - case 25 /* JSDocTupleTypes */: return ts.Diagnostics.Type_expected; - case 24 /* JSDocRecordMembers */: return ts.Diagnostics.Property_assignment_expected; + case 23 /* JSDocFunctionParameters */: return ts.Diagnostics.Parameter_declaration_expected; + case 24 /* JSDocTypeArguments */: return ts.Diagnostics.Type_argument_expected; + case 26 /* JSDocTupleTypes */: return ts.Diagnostics.Type_expected; + case 25 /* JSDocRecordMembers */: return ts.Diagnostics.Property_assignment_expected; } } ; @@ -9806,14 +15482,13 @@ var ts; function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimiter) { var saveParsingContext = parsingContext; parsingContext |= 1 << kind; - var result = []; - result.pos = getNodePos(); + var result = createNodeArray(); var commaStart = -1; // Meaning the previous token was not a comma while (true) { if (isListElement(kind, /*inErrorRecovery*/ false)) { result.push(parseListElement(kind, parseElement)); commaStart = scanner.getTokenPos(); - if (parseOptional(24 /* CommaToken */)) { + if (parseOptional(25 /* CommaToken */)) { continue; } commaStart = -1; // Back to the state where the last token was not a comma @@ -9822,13 +15497,13 @@ var ts; } // We didn't get a comma, and the list wasn't terminated, explicitly parse // out a comma so we give a good error message. - parseExpected(24 /* CommaToken */); + parseExpected(25 /* CommaToken */); // If the token was a semicolon, and the caller allows that, then skip it and // continue. This ensures we get back on track and don't result in tons of // parse errors. For example, this can happen when people do things like use // a semicolon to delimit object literal members. Note: we'll have already // reported an error when we called parseExpected above. - if (considerSemicolonAsDelimiter && token() === 23 /* SemicolonToken */ && !scanner.hasPrecedingLineBreak()) { + if (considerSemicolonAsDelimiter && token() === 24 /* SemicolonToken */ && !scanner.hasPrecedingLineBreak()) { nextToken(); } continue; @@ -9854,11 +15529,7 @@ var ts; return result; } function createMissingList() { - var pos = getNodePos(); - var result = []; - result.pos = pos; - result.end = pos; - return result; + return createNodeArray(); } function parseBracketedList(kind, parseElement, open, close) { if (parseExpected(open)) { @@ -9871,8 +15542,8 @@ var ts; // The allowReservedWords parameter controls whether reserved words are permitted after the first dot function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); - while (parseOptional(21 /* DotToken */)) { - var node = createNode(139 /* QualifiedName */, entity.pos); // !!! + while (parseOptional(22 /* DotToken */)) { + var node = createNode(141 /* QualifiedName */, entity.pos); // !!! node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -9905,34 +15576,33 @@ var ts; // Report that we need an identifier. However, report it right after the dot, // and not on the next token. This is because the next token might actually // be an identifier and the error would be quite confusing. - return createMissingNode(69 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Identifier_expected); + return createMissingNode(70 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Identifier_expected); } } return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(189 /* TemplateExpression */); - template.head = parseTemplateLiteralFragment(); - ts.Debug.assert(template.head.kind === 12 /* TemplateHead */, "Template head has wrong token kind"); - var templateSpans = []; - templateSpans.pos = getNodePos(); + var template = createNode(194 /* TemplateExpression */); + template.head = parseTemplateHead(); + ts.Debug.assert(template.head.kind === 13 /* TemplateHead */, "Template head has wrong token kind"); + var templateSpans = createNodeArray(); do { templateSpans.push(parseTemplateSpan()); - } while (ts.lastOrUndefined(templateSpans).literal.kind === 13 /* TemplateMiddle */); + } while (ts.lastOrUndefined(templateSpans).literal.kind === 14 /* TemplateMiddle */); templateSpans.end = getNodeEnd(); template.templateSpans = templateSpans; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(197 /* TemplateSpan */); + var span = createNode(202 /* TemplateSpan */); span.expression = allowInAnd(parseExpression); var literal; - if (token() === 16 /* CloseBraceToken */) { + if (token() === 17 /* CloseBraceToken */) { reScanTemplateToken(); - literal = parseTemplateLiteralFragment(); + literal = parseTemplateMiddleOrTemplateTail(); } else { - literal = parseExpectedToken(14 /* TemplateTail */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(16 /* CloseBraceToken */)); + literal = parseExpectedToken(15 /* TemplateTail */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(17 /* CloseBraceToken */)); } span.literal = literal; return finishNode(span); @@ -9940,8 +15610,15 @@ var ts; function parseLiteralNode(internName) { return parseLiteralLikeNode(token(), internName); } - function parseTemplateLiteralFragment() { - return parseLiteralLikeNode(token(), /*internName*/ false); + function parseTemplateHead() { + var fragment = parseLiteralLikeNode(token(), /*internName*/ false); + ts.Debug.assert(fragment.kind === 13 /* TemplateHead */, "Template head has wrong token kind"); + return fragment; + } + function parseTemplateMiddleOrTemplateTail() { + var fragment = parseLiteralLikeNode(token(), /*internName*/ false); + ts.Debug.assert(fragment.kind === 14 /* TemplateMiddle */ || fragment.kind === 15 /* TemplateTail */, "Template fragment has wrong token kind"); + return fragment; } function parseLiteralLikeNode(kind, internName) { var node = createNode(kind); @@ -9972,35 +15649,35 @@ var ts; // TYPES function parseTypeReference() { var typeName = parseEntityName(/*allowReservedWords*/ false, ts.Diagnostics.Type_expected); - var node = createNode(155 /* TypeReference */, typeName.pos); + var node = createNode(157 /* TypeReference */, typeName.pos); node.typeName = typeName; - if (!scanner.hasPrecedingLineBreak() && token() === 25 /* LessThanToken */) { - node.typeArguments = parseBracketedList(18 /* TypeArguments */, parseType, 25 /* LessThanToken */, 27 /* GreaterThanToken */); + if (!scanner.hasPrecedingLineBreak() && token() === 26 /* LessThanToken */) { + node.typeArguments = parseBracketedList(19 /* TypeArguments */, parseType, 26 /* LessThanToken */, 28 /* GreaterThanToken */); } return finishNode(node); } function parseThisTypePredicate(lhs) { nextToken(); - var node = createNode(154 /* TypePredicate */, lhs.pos); + var node = createNode(156 /* TypePredicate */, lhs.pos); node.parameterName = lhs; node.type = parseType(); return finishNode(node); } function parseThisTypeNode() { - var node = createNode(165 /* ThisType */); + var node = createNode(167 /* ThisType */); nextToken(); return finishNode(node); } function parseTypeQuery() { - var node = createNode(158 /* TypeQuery */); - parseExpected(101 /* TypeOfKeyword */); + var node = createNode(160 /* TypeQuery */); + parseExpected(102 /* TypeOfKeyword */); node.exprName = parseEntityName(/*allowReservedWords*/ true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(141 /* TypeParameter */); + var node = createNode(143 /* TypeParameter */); node.name = parseIdentifier(); - if (parseOptional(83 /* ExtendsKeyword */)) { + if (parseOptional(84 /* ExtendsKeyword */)) { // It's not uncommon for people to write improper constraints to a generic. If the // user writes a constraint that is an expression and not an actual type, then parse // it out as an expression (so we can recover well), but report that a type is needed @@ -10022,39 +15699,33 @@ var ts; return finishNode(node); } function parseTypeParameters() { - if (token() === 25 /* LessThanToken */) { - return parseBracketedList(17 /* TypeParameters */, parseTypeParameter, 25 /* LessThanToken */, 27 /* GreaterThanToken */); + if (token() === 26 /* LessThanToken */) { + return parseBracketedList(18 /* TypeParameters */, parseTypeParameter, 26 /* LessThanToken */, 28 /* GreaterThanToken */); } } function parseParameterType() { - if (parseOptional(54 /* ColonToken */)) { + if (parseOptional(55 /* ColonToken */)) { return parseType(); } return undefined; } function isStartOfParameter() { - return token() === 22 /* DotDotDotToken */ || isIdentifierOrPattern() || ts.isModifierKind(token()) || token() === 55 /* AtToken */ || token() === 97 /* ThisKeyword */; - } - function setModifiers(node, modifiers) { - if (modifiers) { - node.flags |= modifiers.flags; - node.modifiers = modifiers; - } + return token() === 23 /* DotDotDotToken */ || isIdentifierOrPattern() || ts.isModifierKind(token()) || token() === 56 /* AtToken */ || token() === 98 /* ThisKeyword */; } function parseParameter() { - var node = createNode(142 /* Parameter */); - if (token() === 97 /* ThisKeyword */) { + var node = createNode(144 /* Parameter */); + if (token() === 98 /* ThisKeyword */) { node.name = createIdentifier(/*isIdentifier*/ true, undefined); node.type = parseParameterType(); return finishNode(node); } node.decorators = parseDecorators(); - setModifiers(node, parseModifiers()); - node.dotDotDotToken = parseOptionalToken(22 /* DotDotDotToken */); + node.modifiers = parseModifiers(); + node.dotDotDotToken = parseOptionalToken(23 /* DotDotDotToken */); // FormalParameter [Yield,Await]: // BindingElement[?Yield,?Await] node.name = parseIdentifierOrPattern(); - if (ts.getFullWidth(node.name) === 0 && node.flags === 0 && ts.isModifierKind(token())) { + if (ts.getFullWidth(node.name) === 0 && !ts.hasModifiers(node) && ts.isModifierKind(token())) { // in cases like // 'use strict' // function foo(static) @@ -10065,7 +15736,7 @@ var ts; // to avoid this we'll advance cursor to the next token. nextToken(); } - node.questionToken = parseOptionalToken(53 /* QuestionToken */); + node.questionToken = parseOptionalToken(54 /* QuestionToken */); node.type = parseParameterType(); node.initializer = parseBindingElementInitializer(/*inParameter*/ true); // Do not check for initializers in an ambient context for parameters. This is not @@ -10085,7 +15756,7 @@ var ts; return parseInitializer(/*inParameter*/ true); } function fillSignature(returnToken, yieldContext, awaitContext, requireCompleteParameterList, signature) { - var returnTokenRequired = returnToken === 34 /* EqualsGreaterThanToken */; + var returnTokenRequired = returnToken === 35 /* EqualsGreaterThanToken */; signature.typeParameters = parseTypeParameters(); signature.parameters = parseParameterList(yieldContext, awaitContext, requireCompleteParameterList); if (returnTokenRequired) { @@ -10110,7 +15781,7 @@ var ts; // // SingleNameBinding [Yield,Await]: // BindingIdentifier[?Yield,?Await]Initializer [In, ?Yield,?Await] opt - if (parseExpected(17 /* OpenParenToken */)) { + if (parseExpected(18 /* OpenParenToken */)) { var savedYieldContext = inYieldContext(); var savedAwaitContext = inAwaitContext(); setYieldContext(yieldContext); @@ -10118,7 +15789,7 @@ var ts; var result = parseDelimitedList(16 /* Parameters */, parseParameter); setYieldContext(savedYieldContext); setAwaitContext(savedAwaitContext); - if (!parseExpected(18 /* CloseParenToken */) && requireCompleteParameterList) { + if (!parseExpected(19 /* CloseParenToken */) && requireCompleteParameterList) { // Caller insisted that we had to end with a ) We didn't. So just return // undefined here. return undefined; @@ -10133,7 +15804,7 @@ var ts; function parseTypeMemberSemicolon() { // We allow type members to be separated by commas or (possibly ASI) semicolons. // First check if it was a comma. If so, we're done with the member. - if (parseOptional(24 /* CommaToken */)) { + if (parseOptional(25 /* CommaToken */)) { return; } // Didn't have a comma. We must have a (possible ASI) semicolon. @@ -10141,15 +15812,15 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 152 /* ConstructSignature */) { - parseExpected(92 /* NewKeyword */); + if (kind === 154 /* ConstructSignature */) { + parseExpected(93 /* NewKeyword */); } - fillSignature(54 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); + fillSignature(55 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); parseTypeMemberSemicolon(); - return finishNode(node); + return addJSDocComment(finishNode(node)); } function isIndexSignature() { - if (token() !== 19 /* OpenBracketToken */) { + if (token() !== 20 /* OpenBracketToken */) { return false; } return lookAhead(isUnambiguouslyIndexSignature); @@ -10172,7 +15843,7 @@ var ts; // [] // nextToken(); - if (token() === 22 /* DotDotDotToken */ || token() === 20 /* CloseBracketToken */) { + if (token() === 23 /* DotDotDotToken */ || token() === 21 /* CloseBracketToken */) { return true; } if (ts.isModifierKind(token())) { @@ -10191,62 +15862,62 @@ var ts; // A colon signifies a well formed indexer // A comma should be a badly formed indexer because comma expressions are not allowed // in computed properties. - if (token() === 54 /* ColonToken */ || token() === 24 /* CommaToken */) { + if (token() === 55 /* ColonToken */ || token() === 25 /* CommaToken */) { return true; } // Question mark could be an indexer with an optional property, // or it could be a conditional expression in a computed property. - if (token() !== 53 /* QuestionToken */) { + if (token() !== 54 /* QuestionToken */) { return false; } // If any of the following tokens are after the question mark, it cannot // be a conditional expression, so treat it as an indexer. nextToken(); - return token() === 54 /* ColonToken */ || token() === 24 /* CommaToken */ || token() === 20 /* CloseBracketToken */; + return token() === 55 /* ColonToken */ || token() === 25 /* CommaToken */ || token() === 21 /* CloseBracketToken */; } function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { - var node = createNode(153 /* IndexSignature */, fullStart); + var node = createNode(155 /* IndexSignature */, fullStart); node.decorators = decorators; - setModifiers(node, modifiers); - node.parameters = parseBracketedList(16 /* Parameters */, parseParameter, 19 /* OpenBracketToken */, 20 /* CloseBracketToken */); + node.modifiers = modifiers; + node.parameters = parseBracketedList(16 /* Parameters */, parseParameter, 20 /* OpenBracketToken */, 21 /* CloseBracketToken */); node.type = parseTypeAnnotation(); parseTypeMemberSemicolon(); return finishNode(node); } function parsePropertyOrMethodSignature(fullStart, modifiers) { var name = parsePropertyName(); - var questionToken = parseOptionalToken(53 /* QuestionToken */); - if (token() === 17 /* OpenParenToken */ || token() === 25 /* LessThanToken */) { - var method = createNode(146 /* MethodSignature */, fullStart); - setModifiers(method, modifiers); + var questionToken = parseOptionalToken(54 /* QuestionToken */); + if (token() === 18 /* OpenParenToken */ || token() === 26 /* LessThanToken */) { + var method = createNode(148 /* MethodSignature */, fullStart); + method.modifiers = modifiers; method.name = name; method.questionToken = questionToken; // Method signatures don't exist in expression contexts. So they have neither // [Yield] nor [Await] - fillSignature(54 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, method); + fillSignature(55 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, method); parseTypeMemberSemicolon(); - return finishNode(method); + return addJSDocComment(finishNode(method)); } else { - var property = createNode(144 /* PropertySignature */, fullStart); - setModifiers(property, modifiers); + var property = createNode(146 /* PropertySignature */, fullStart); + property.modifiers = modifiers; property.name = name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); - if (token() === 56 /* EqualsToken */) { + if (token() === 57 /* EqualsToken */) { // Although type literal properties cannot not have initializers, we attempt // to parse an initializer so we can report in the checker that an interface // property or type literal property cannot have an initializer. property.initializer = parseNonParameterInitializer(); } parseTypeMemberSemicolon(); - return finishNode(property); + return addJSDocComment(finishNode(property)); } } function isTypeMemberStart() { var idToken; // Return true if we have the start of a signature member - if (token() === 17 /* OpenParenToken */ || token() === 25 /* LessThanToken */) { + if (token() === 18 /* OpenParenToken */ || token() === 26 /* LessThanToken */) { return true; } // Eat up all modifiers, but hold on to the last one in case it is actually an identifier @@ -10255,7 +15926,7 @@ var ts; nextToken(); } // Index signatures and computed property names are type members - if (token() === 19 /* OpenBracketToken */) { + if (token() === 20 /* OpenBracketToken */) { return true; } // Try to get the first property-like token following all modifiers @@ -10266,20 +15937,21 @@ var ts; // If we were able to get any potential identifier, check that it is // the start of a member declaration if (idToken) { - return token() === 17 /* OpenParenToken */ || - token() === 25 /* LessThanToken */ || - token() === 53 /* QuestionToken */ || - token() === 54 /* ColonToken */ || + return token() === 18 /* OpenParenToken */ || + token() === 26 /* LessThanToken */ || + token() === 54 /* QuestionToken */ || + token() === 55 /* ColonToken */ || + token() === 25 /* CommaToken */ || canParseSemicolon(); } return false; } function parseTypeMember() { - if (token() === 17 /* OpenParenToken */ || token() === 25 /* LessThanToken */) { - return parseSignatureMember(151 /* CallSignature */); + if (token() === 18 /* OpenParenToken */ || token() === 26 /* LessThanToken */) { + return parseSignatureMember(153 /* CallSignature */); } - if (token() === 92 /* NewKeyword */ && lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(152 /* ConstructSignature */); + if (token() === 93 /* NewKeyword */ && lookAhead(isStartOfConstructSignature)) { + return parseSignatureMember(154 /* ConstructSignature */); } var fullStart = getNodePos(); var modifiers = parseModifiers(); @@ -10290,50 +15962,77 @@ var ts; } function isStartOfConstructSignature() { nextToken(); - return token() === 17 /* OpenParenToken */ || token() === 25 /* LessThanToken */; + return token() === 18 /* OpenParenToken */ || token() === 26 /* LessThanToken */; } function parseTypeLiteral() { - var node = createNode(159 /* TypeLiteral */); + var node = createNode(161 /* TypeLiteral */); node.members = parseObjectTypeMembers(); return finishNode(node); } function parseObjectTypeMembers() { var members; - if (parseExpected(15 /* OpenBraceToken */)) { + if (parseExpected(16 /* OpenBraceToken */)) { members = parseList(4 /* TypeMembers */, parseTypeMember); - parseExpected(16 /* CloseBraceToken */); + parseExpected(17 /* CloseBraceToken */); } else { members = createMissingList(); } return members; } + function isStartOfMappedType() { + nextToken(); + if (token() === 130 /* ReadonlyKeyword */) { + nextToken(); + } + return token() === 20 /* OpenBracketToken */ && nextTokenIsIdentifier() && nextToken() === 91 /* InKeyword */; + } + function parseMappedTypeParameter() { + var node = createNode(143 /* TypeParameter */); + node.name = parseIdentifier(); + parseExpected(91 /* InKeyword */); + node.constraint = parseType(); + return finishNode(node); + } + function parseMappedType() { + var node = createNode(170 /* MappedType */); + parseExpected(16 /* OpenBraceToken */); + node.readonlyToken = parseOptionalToken(130 /* ReadonlyKeyword */); + parseExpected(20 /* OpenBracketToken */); + node.typeParameter = parseMappedTypeParameter(); + parseExpected(21 /* CloseBracketToken */); + node.questionToken = parseOptionalToken(54 /* QuestionToken */); + node.type = parseTypeAnnotation(); + parseSemicolon(); + parseExpected(17 /* CloseBraceToken */); + return finishNode(node); + } function parseTupleType() { - var node = createNode(161 /* TupleType */); - node.elementTypes = parseBracketedList(19 /* TupleElementTypes */, parseType, 19 /* OpenBracketToken */, 20 /* CloseBracketToken */); + var node = createNode(163 /* TupleType */); + node.elementTypes = parseBracketedList(20 /* TupleElementTypes */, parseType, 20 /* OpenBracketToken */, 21 /* CloseBracketToken */); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(164 /* ParenthesizedType */); - parseExpected(17 /* OpenParenToken */); + var node = createNode(166 /* ParenthesizedType */); + parseExpected(18 /* OpenParenToken */); node.type = parseType(); - parseExpected(18 /* CloseParenToken */); + parseExpected(19 /* CloseParenToken */); return finishNode(node); } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 157 /* ConstructorType */) { - parseExpected(92 /* NewKeyword */); + if (kind === 159 /* ConstructorType */) { + parseExpected(93 /* NewKeyword */); } - fillSignature(34 /* EqualsGreaterThanToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); + fillSignature(35 /* EqualsGreaterThanToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); return finishNode(node); } function parseKeywordAndNoDot() { var node = parseTokenNode(); - return token() === 21 /* DotToken */ ? undefined : node; + return token() === 22 /* DotToken */ ? undefined : node; } function parseLiteralTypeNode() { - var node = createNode(166 /* LiteralType */); + var node = createNode(171 /* LiteralType */); node.literal = parseSimpleUnaryExpression(); finishNode(node); return node; @@ -10343,42 +16042,42 @@ var ts; } function parseNonArrayType() { switch (token()) { - case 117 /* AnyKeyword */: - case 132 /* StringKeyword */: - case 130 /* NumberKeyword */: - case 120 /* BooleanKeyword */: - case 133 /* SymbolKeyword */: - case 135 /* UndefinedKeyword */: - case 127 /* NeverKeyword */: + case 118 /* AnyKeyword */: + case 134 /* StringKeyword */: + case 132 /* NumberKeyword */: + case 121 /* BooleanKeyword */: + case 135 /* SymbolKeyword */: + case 137 /* UndefinedKeyword */: + case 129 /* NeverKeyword */: // If these are followed by a dot, then parse these out as a dotted type reference instead. var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReference(); case 9 /* StringLiteral */: case 8 /* NumericLiteral */: - case 99 /* TrueKeyword */: - case 84 /* FalseKeyword */: + case 100 /* TrueKeyword */: + case 85 /* FalseKeyword */: return parseLiteralTypeNode(); - case 36 /* MinusToken */: + case 37 /* MinusToken */: return lookAhead(nextTokenIsNumericLiteral) ? parseLiteralTypeNode() : parseTypeReference(); - case 103 /* VoidKeyword */: - case 93 /* NullKeyword */: + case 104 /* VoidKeyword */: + case 94 /* NullKeyword */: return parseTokenNode(); - case 97 /* ThisKeyword */: { + case 98 /* ThisKeyword */: { var thisKeyword = parseThisTypeNode(); - if (token() === 124 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 125 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) { return parseThisTypePredicate(thisKeyword); } else { return thisKeyword; } } - case 101 /* TypeOfKeyword */: + case 102 /* TypeOfKeyword */: return parseTypeQuery(); - case 15 /* OpenBraceToken */: - return parseTypeLiteral(); - case 19 /* OpenBracketToken */: + case 16 /* OpenBraceToken */: + return lookAhead(isStartOfMappedType) ? parseMappedType() : parseTypeLiteral(); + case 20 /* OpenBracketToken */: return parseTupleType(); - case 17 /* OpenParenToken */: + case 18 /* OpenParenToken */: return parseParenthesizedType(); default: return parseTypeReference(); @@ -10386,29 +16085,31 @@ var ts; } function isStartOfType() { switch (token()) { - case 117 /* AnyKeyword */: - case 132 /* StringKeyword */: - case 130 /* NumberKeyword */: - case 120 /* BooleanKeyword */: - case 133 /* SymbolKeyword */: - case 103 /* VoidKeyword */: - case 135 /* UndefinedKeyword */: - case 93 /* NullKeyword */: - case 97 /* ThisKeyword */: - case 101 /* TypeOfKeyword */: - case 127 /* NeverKeyword */: - case 15 /* OpenBraceToken */: - case 19 /* OpenBracketToken */: - case 25 /* LessThanToken */: - case 92 /* NewKeyword */: + case 118 /* AnyKeyword */: + case 134 /* StringKeyword */: + case 132 /* NumberKeyword */: + case 121 /* BooleanKeyword */: + case 135 /* SymbolKeyword */: + case 104 /* VoidKeyword */: + case 137 /* UndefinedKeyword */: + case 94 /* NullKeyword */: + case 98 /* ThisKeyword */: + case 102 /* TypeOfKeyword */: + case 129 /* NeverKeyword */: + case 16 /* OpenBraceToken */: + case 20 /* OpenBracketToken */: + case 26 /* LessThanToken */: + case 48 /* BarToken */: + case 47 /* AmpersandToken */: + case 93 /* NewKeyword */: case 9 /* StringLiteral */: case 8 /* NumericLiteral */: - case 99 /* TrueKeyword */: - case 84 /* FalseKeyword */: + case 100 /* TrueKeyword */: + case 85 /* FalseKeyword */: return true; - case 36 /* MinusToken */: + case 37 /* MinusToken */: return lookAhead(nextTokenIsNumericLiteral); - case 17 /* OpenParenToken */: + case 18 /* OpenParenToken */: // Only consider '(' the start of a type if followed by ')', '...', an identifier, a modifier, // or something that starts a type. We don't want to consider things like '(1)' a type. return lookAhead(isStartOfParenthesizedOrFunctionType); @@ -10418,23 +16119,46 @@ var ts; } function isStartOfParenthesizedOrFunctionType() { nextToken(); - return token() === 18 /* CloseParenToken */ || isStartOfParameter() || isStartOfType(); + return token() === 19 /* CloseParenToken */ || isStartOfParameter() || isStartOfType(); } function parseArrayTypeOrHigher() { var type = parseNonArrayType(); - while (!scanner.hasPrecedingLineBreak() && parseOptional(19 /* OpenBracketToken */)) { - parseExpected(20 /* CloseBracketToken */); - var node = createNode(160 /* ArrayType */, type.pos); - node.elementType = type; - type = finishNode(node); + while (!scanner.hasPrecedingLineBreak() && parseOptional(20 /* OpenBracketToken */)) { + if (isStartOfType()) { + var node = createNode(169 /* IndexedAccessType */, type.pos); + node.objectType = type; + node.indexType = parseType(); + parseExpected(21 /* CloseBracketToken */); + type = finishNode(node); + } + else { + var node = createNode(162 /* ArrayType */, type.pos); + node.elementType = type; + parseExpected(21 /* CloseBracketToken */); + type = finishNode(node); + } } return type; } + function parseTypeOperator(operator) { + var node = createNode(168 /* TypeOperator */); + parseExpected(operator); + node.operator = operator; + node.type = parseTypeOperatorOrHigher(); + return finishNode(node); + } + function parseTypeOperatorOrHigher() { + switch (token()) { + case 126 /* KeyOfKeyword */: + return parseTypeOperator(126 /* KeyOfKeyword */); + } + return parseArrayTypeOrHigher(); + } function parseUnionOrIntersectionType(kind, parseConstituentType, operator) { + parseOptional(operator); var type = parseConstituentType(); if (token() === operator) { - var types = [type]; - types.pos = type.pos; + var types = createNodeArray([type], type.pos); while (parseOptional(operator)) { types.push(parseConstituentType()); } @@ -10446,27 +16170,27 @@ var ts; return type; } function parseIntersectionTypeOrHigher() { - return parseUnionOrIntersectionType(163 /* IntersectionType */, parseArrayTypeOrHigher, 46 /* AmpersandToken */); + return parseUnionOrIntersectionType(165 /* IntersectionType */, parseTypeOperatorOrHigher, 47 /* AmpersandToken */); } function parseUnionTypeOrHigher() { - return parseUnionOrIntersectionType(162 /* UnionType */, parseIntersectionTypeOrHigher, 47 /* BarToken */); + return parseUnionOrIntersectionType(164 /* UnionType */, parseIntersectionTypeOrHigher, 48 /* BarToken */); } function isStartOfFunctionType() { - if (token() === 25 /* LessThanToken */) { + if (token() === 26 /* LessThanToken */) { return true; } - return token() === 17 /* OpenParenToken */ && lookAhead(isUnambiguouslyStartOfFunctionType); + return token() === 18 /* OpenParenToken */ && lookAhead(isUnambiguouslyStartOfFunctionType); } function skipParameterStart() { if (ts.isModifierKind(token())) { // Skip modifiers parseModifiers(); } - if (isIdentifier() || token() === 97 /* ThisKeyword */) { + if (isIdentifier() || token() === 98 /* ThisKeyword */) { nextToken(); return true; } - if (token() === 19 /* OpenBracketToken */ || token() === 15 /* OpenBraceToken */) { + if (token() === 20 /* OpenBracketToken */ || token() === 16 /* OpenBraceToken */) { // Return true if we can parse an array or object binding pattern with no errors var previousErrorCount = parseDiagnostics.length; parseIdentifierOrPattern(); @@ -10476,7 +16200,7 @@ var ts; } function isUnambiguouslyStartOfFunctionType() { nextToken(); - if (token() === 18 /* CloseParenToken */ || token() === 22 /* DotDotDotToken */) { + if (token() === 19 /* CloseParenToken */ || token() === 23 /* DotDotDotToken */) { // ( ) // ( ... return true; @@ -10484,17 +16208,17 @@ var ts; if (skipParameterStart()) { // We successfully skipped modifiers (if any) and an identifier or binding pattern, // now see if we have something that indicates a parameter declaration - if (token() === 54 /* ColonToken */ || token() === 24 /* CommaToken */ || - token() === 53 /* QuestionToken */ || token() === 56 /* EqualsToken */) { + if (token() === 55 /* ColonToken */ || token() === 25 /* CommaToken */ || + token() === 54 /* QuestionToken */ || token() === 57 /* EqualsToken */) { // ( xxx : // ( xxx , // ( xxx ? // ( xxx = return true; } - if (token() === 18 /* CloseParenToken */) { + if (token() === 19 /* CloseParenToken */) { nextToken(); - if (token() === 34 /* EqualsGreaterThanToken */) { + if (token() === 35 /* EqualsGreaterThanToken */) { // ( xxx ) => return true; } @@ -10506,7 +16230,7 @@ var ts; var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix); var type = parseType(); if (typePredicateVariable) { - var node = createNode(154 /* TypePredicate */, typePredicateVariable.pos); + var node = createNode(156 /* TypePredicate */, typePredicateVariable.pos); node.parameterName = typePredicateVariable; node.type = type; return finishNode(node); @@ -10517,7 +16241,7 @@ var ts; } function parseTypePredicatePrefix() { var id = parseIdentifier(); - if (token() === 124 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 125 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) { nextToken(); return id; } @@ -10525,41 +16249,41 @@ var ts; function parseType() { // The rules about 'yield' only apply to actual code/expression contexts. They don't // apply to 'type' contexts. So we disable these parameters here before moving on. - return doOutsideOfContext(41943040 /* TypeExcludesFlags */, parseTypeWorker); + return doOutsideOfContext(20480 /* TypeExcludesFlags */, parseTypeWorker); } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(156 /* FunctionType */); + return parseFunctionOrConstructorType(158 /* FunctionType */); } - if (token() === 92 /* NewKeyword */) { - return parseFunctionOrConstructorType(157 /* ConstructorType */); + if (token() === 93 /* NewKeyword */) { + return parseFunctionOrConstructorType(159 /* ConstructorType */); } return parseUnionTypeOrHigher(); } function parseTypeAnnotation() { - return parseOptional(54 /* ColonToken */) ? parseType() : undefined; + return parseOptional(55 /* ColonToken */) ? parseType() : undefined; } // EXPRESSIONS function isStartOfLeftHandSideExpression() { switch (token()) { - case 97 /* ThisKeyword */: - case 95 /* SuperKeyword */: - case 93 /* NullKeyword */: - case 99 /* TrueKeyword */: - case 84 /* FalseKeyword */: + case 98 /* ThisKeyword */: + case 96 /* SuperKeyword */: + case 94 /* NullKeyword */: + case 100 /* TrueKeyword */: + case 85 /* FalseKeyword */: case 8 /* NumericLiteral */: case 9 /* StringLiteral */: - case 11 /* NoSubstitutionTemplateLiteral */: - case 12 /* TemplateHead */: - case 17 /* OpenParenToken */: - case 19 /* OpenBracketToken */: - case 15 /* OpenBraceToken */: - case 87 /* FunctionKeyword */: - case 73 /* ClassKeyword */: - case 92 /* NewKeyword */: - case 39 /* SlashToken */: - case 61 /* SlashEqualsToken */: - case 69 /* Identifier */: + case 12 /* NoSubstitutionTemplateLiteral */: + case 13 /* TemplateHead */: + case 18 /* OpenParenToken */: + case 20 /* OpenBracketToken */: + case 16 /* OpenBraceToken */: + case 88 /* FunctionKeyword */: + case 74 /* ClassKeyword */: + case 93 /* NewKeyword */: + case 40 /* SlashToken */: + case 62 /* SlashEqualsToken */: + case 70 /* Identifier */: return true; default: return isIdentifier(); @@ -10570,18 +16294,18 @@ var ts; return true; } switch (token()) { - case 35 /* PlusToken */: - case 36 /* MinusToken */: - case 50 /* TildeToken */: - case 49 /* ExclamationToken */: - case 78 /* DeleteKeyword */: - case 101 /* TypeOfKeyword */: - case 103 /* VoidKeyword */: - case 41 /* PlusPlusToken */: - case 42 /* MinusMinusToken */: - case 25 /* LessThanToken */: - case 119 /* AwaitKeyword */: - case 114 /* YieldKeyword */: + case 36 /* PlusToken */: + case 37 /* MinusToken */: + case 51 /* TildeToken */: + case 50 /* ExclamationToken */: + case 79 /* DeleteKeyword */: + case 102 /* TypeOfKeyword */: + case 104 /* VoidKeyword */: + case 42 /* PlusPlusToken */: + case 43 /* MinusMinusToken */: + case 26 /* LessThanToken */: + case 120 /* AwaitKeyword */: + case 115 /* YieldKeyword */: // Yield/await always starts an expression. Either it is an identifier (in which case // it is definitely an expression). Or it's a keyword (either because we're in // a generator or async function, or in strict mode (or both)) and it started a yield or await expression. @@ -10599,10 +16323,10 @@ var ts; } function isStartOfExpressionStatement() { // As per the grammar, none of '{' or 'function' or 'class' can start an expression statement. - return token() !== 15 /* OpenBraceToken */ && - token() !== 87 /* FunctionKeyword */ && - token() !== 73 /* ClassKeyword */ && - token() !== 55 /* AtToken */ && + return token() !== 16 /* OpenBraceToken */ && + token() !== 88 /* FunctionKeyword */ && + token() !== 74 /* ClassKeyword */ && + token() !== 56 /* AtToken */ && isStartOfExpression(); } function parseExpression() { @@ -10616,7 +16340,7 @@ var ts; } var expr = parseAssignmentExpressionOrHigher(); var operatorToken; - while ((operatorToken = parseOptionalToken(24 /* CommaToken */))) { + while ((operatorToken = parseOptionalToken(25 /* CommaToken */))) { expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher()); } if (saveDecoratorContext) { @@ -10625,7 +16349,7 @@ var ts; return expr; } function parseInitializer(inParameter) { - if (token() !== 56 /* EqualsToken */) { + if (token() !== 57 /* EqualsToken */) { // It's not uncommon during typing for the user to miss writing the '=' token. Check if // there is no newline after the last token and if we're on an expression. If so, parse // this as an equals-value clause with a missing equals. @@ -10634,7 +16358,7 @@ var ts; // it's more likely that a { would be a allowed (as an object literal). While this // is also allowed for parameters, the risk is that we consume the { as an object // literal when it really will be for the block following the parameter. - if (scanner.hasPrecedingLineBreak() || (inParameter && token() === 15 /* OpenBraceToken */) || !isStartOfExpression()) { + if (scanner.hasPrecedingLineBreak() || (inParameter && token() === 16 /* OpenBraceToken */) || !isStartOfExpression()) { // preceding line break, open brace in a parameter (likely a function body) or current token is not an expression - // do not try to parse initializer return undefined; @@ -10642,7 +16366,7 @@ var ts; } // Initializer[In, Yield] : // = AssignmentExpression[?In, ?Yield] - parseExpected(56 /* EqualsToken */); + parseExpected(57 /* EqualsToken */); return parseAssignmentExpressionOrHigher(); } function parseAssignmentExpressionOrHigher() { @@ -10688,7 +16412,7 @@ var ts; // To avoid a look-ahead, we did not handle the case of an arrow function with a single un-parenthesized // parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single // identifier and the current token is an arrow. - if (expr.kind === 69 /* Identifier */ && token() === 34 /* EqualsGreaterThanToken */) { + if (expr.kind === 70 /* Identifier */ && token() === 35 /* EqualsGreaterThanToken */) { return parseSimpleArrowFunctionExpression(expr); } // Now see if we might be in cases '2' or '3'. @@ -10704,7 +16428,7 @@ var ts; return parseConditionalExpressionRest(expr); } function isYieldExpression() { - if (token() === 114 /* YieldKeyword */) { + if (token() === 115 /* YieldKeyword */) { // If we have a 'yield' keyword, and this is a context where yield expressions are // allowed, then definitely parse out a yield expression. if (inYieldContext()) { @@ -10733,15 +16457,15 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(190 /* YieldExpression */); + var node = createNode(195 /* YieldExpression */); // YieldExpression[In] : // yield // yield [no LineTerminator here] [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield] // yield [no LineTerminator here] * [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield] nextToken(); if (!scanner.hasPrecedingLineBreak() && - (token() === 37 /* AsteriskToken */ || isStartOfExpression())) { - node.asteriskToken = parseOptionalToken(37 /* AsteriskToken */); + (token() === 38 /* AsteriskToken */ || isStartOfExpression())) { + node.asteriskToken = parseOptionalToken(38 /* AsteriskToken */); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } @@ -10752,24 +16476,23 @@ var ts; } } function parseSimpleArrowFunctionExpression(identifier, asyncModifier) { - ts.Debug.assert(token() === 34 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); + ts.Debug.assert(token() === 35 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); var node; if (asyncModifier) { - node = createNode(180 /* ArrowFunction */, asyncModifier.pos); - setModifiers(node, asyncModifier); + node = createNode(185 /* ArrowFunction */, asyncModifier.pos); + node.modifiers = asyncModifier; } else { - node = createNode(180 /* ArrowFunction */, identifier.pos); + node = createNode(185 /* ArrowFunction */, identifier.pos); } - var parameter = createNode(142 /* Parameter */, identifier.pos); + var parameter = createNode(144 /* Parameter */, identifier.pos); parameter.name = identifier; finishNode(parameter); - node.parameters = [parameter]; - node.parameters.pos = parameter.pos; + node.parameters = createNodeArray([parameter], parameter.pos); node.parameters.end = parameter.end; - node.equalsGreaterThanToken = parseExpectedToken(34 /* EqualsGreaterThanToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, "=>"); + node.equalsGreaterThanToken = parseExpectedToken(35 /* EqualsGreaterThanToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, "=>"); node.body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier); - return finishNode(node); + return addJSDocComment(finishNode(node)); } function tryParseParenthesizedArrowFunctionExpression() { var triState = isParenthesizedArrowFunctionExpression(); @@ -10788,25 +16511,25 @@ var ts; // Didn't appear to actually be a parenthesized arrow function. Just bail out. return undefined; } - var isAsync = !!(arrowFunction.flags & 256 /* Async */); + var isAsync = !!(ts.getModifierFlags(arrowFunction) & 256 /* Async */); // If we have an arrow, then try to parse the body. Even if not, try to parse if we // have an opening brace, just in case we're in an error state. var lastToken = token(); - arrowFunction.equalsGreaterThanToken = parseExpectedToken(34 /* EqualsGreaterThanToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, "=>"); - arrowFunction.body = (lastToken === 34 /* EqualsGreaterThanToken */ || lastToken === 15 /* OpenBraceToken */) + arrowFunction.equalsGreaterThanToken = parseExpectedToken(35 /* EqualsGreaterThanToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, "=>"); + arrowFunction.body = (lastToken === 35 /* EqualsGreaterThanToken */ || lastToken === 16 /* OpenBraceToken */) ? parseArrowFunctionExpressionBody(isAsync) : parseIdentifier(); - return finishNode(arrowFunction); + return addJSDocComment(finishNode(arrowFunction)); } // True -> We definitely expect a parenthesized arrow function here. // False -> There *cannot* be a parenthesized arrow function here. // Unknown -> There *might* be a parenthesized arrow function here. // Speculatively look ahead to be sure, and rollback if not. function isParenthesizedArrowFunctionExpression() { - if (token() === 17 /* OpenParenToken */ || token() === 25 /* LessThanToken */ || token() === 118 /* AsyncKeyword */) { + if (token() === 18 /* OpenParenToken */ || token() === 26 /* LessThanToken */ || token() === 119 /* AsyncKeyword */) { return lookAhead(isParenthesizedArrowFunctionExpressionWorker); } - if (token() === 34 /* EqualsGreaterThanToken */) { + if (token() === 35 /* EqualsGreaterThanToken */) { // ERROR RECOVERY TWEAK: // If we see a standalone => try to parse it as an arrow function expression as that's // likely what the user intended to write. @@ -10816,28 +16539,28 @@ var ts; return 0 /* False */; } function isParenthesizedArrowFunctionExpressionWorker() { - if (token() === 118 /* AsyncKeyword */) { + if (token() === 119 /* AsyncKeyword */) { nextToken(); if (scanner.hasPrecedingLineBreak()) { return 0 /* False */; } - if (token() !== 17 /* OpenParenToken */ && token() !== 25 /* LessThanToken */) { + if (token() !== 18 /* OpenParenToken */ && token() !== 26 /* LessThanToken */) { return 0 /* False */; } } var first = token(); var second = nextToken(); - if (first === 17 /* OpenParenToken */) { - if (second === 18 /* CloseParenToken */) { + if (first === 18 /* OpenParenToken */) { + if (second === 19 /* CloseParenToken */) { // Simple cases: "() =>", "(): ", and "() {". // This is an arrow function with no parameters. // The last one is not actually an arrow function, // but this is probably what the user intended. var third = nextToken(); switch (third) { - case 34 /* EqualsGreaterThanToken */: - case 54 /* ColonToken */: - case 15 /* OpenBraceToken */: + case 35 /* EqualsGreaterThanToken */: + case 55 /* ColonToken */: + case 16 /* OpenBraceToken */: return 1 /* True */; default: return 0 /* False */; @@ -10849,12 +16572,12 @@ var ts; // ({ x }) => { } // ([ x ]) // ({ x }) - if (second === 19 /* OpenBracketToken */ || second === 15 /* OpenBraceToken */) { + if (second === 20 /* OpenBracketToken */ || second === 16 /* OpenBraceToken */) { return 2 /* Unknown */; } // Simple case: "(..." // This is an arrow function with a rest parameter. - if (second === 22 /* DotDotDotToken */) { + if (second === 23 /* DotDotDotToken */) { return 1 /* True */; } // If we had "(" followed by something that's not an identifier, @@ -10867,7 +16590,7 @@ var ts; } // If we have something like "(a:", then we must have a // type-annotated parameter in an arrow function expression. - if (nextToken() === 54 /* ColonToken */) { + if (nextToken() === 55 /* ColonToken */) { return 1 /* True */; } // This *could* be a parenthesized arrow function. @@ -10875,7 +16598,7 @@ var ts; return 2 /* Unknown */; } else { - ts.Debug.assert(first === 25 /* LessThanToken */); + ts.Debug.assert(first === 26 /* LessThanToken */); // If we have "<" not followed by an identifier, // then this definitely is not an arrow function. if (!isIdentifier()) { @@ -10885,17 +16608,17 @@ var ts; if (sourceFile.languageVariant === 1 /* JSX */) { var isArrowFunctionInJsx = lookAhead(function () { var third = nextToken(); - if (third === 83 /* ExtendsKeyword */) { + if (third === 84 /* ExtendsKeyword */) { var fourth = nextToken(); switch (fourth) { - case 56 /* EqualsToken */: - case 27 /* GreaterThanToken */: + case 57 /* EqualsToken */: + case 28 /* GreaterThanToken */: return false; default: return true; } } - else if (third === 24 /* CommaToken */) { + else if (third === 25 /* CommaToken */) { return true; } return false; @@ -10914,7 +16637,7 @@ var ts; } function tryParseAsyncSimpleArrowFunctionExpression() { // We do a check here so that we won't be doing unnecessarily call to "lookAhead" - if (token() === 118 /* AsyncKeyword */) { + if (token() === 119 /* AsyncKeyword */) { var isUnParenthesizedAsyncArrowFunction = lookAhead(isUnParenthesizedAsyncArrowFunctionWorker); if (isUnParenthesizedAsyncArrowFunction === 1 /* True */) { var asyncModifier = parseModifiersForArrowFunction(); @@ -10928,25 +16651,25 @@ var ts; // AsyncArrowFunctionExpression: // 1) async[no LineTerminator here]AsyncArrowBindingIdentifier[?Yield][no LineTerminator here]=>AsyncConciseBody[?In] // 2) CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await][no LineTerminator here]=>AsyncConciseBody[?In] - if (token() === 118 /* AsyncKeyword */) { + if (token() === 119 /* AsyncKeyword */) { nextToken(); // If the "async" is followed by "=>" token then it is not a begining of an async arrow-function // but instead a simple arrow-function which will be parsed inside "parseAssignmentExpressionOrHigher" - if (scanner.hasPrecedingLineBreak() || token() === 34 /* EqualsGreaterThanToken */) { + if (scanner.hasPrecedingLineBreak() || token() === 35 /* EqualsGreaterThanToken */) { return 0 /* False */; } // Check for un-parenthesized AsyncArrowFunction var expr = parseBinaryExpressionOrHigher(/*precedence*/ 0); - if (!scanner.hasPrecedingLineBreak() && expr.kind === 69 /* Identifier */ && token() === 34 /* EqualsGreaterThanToken */) { + if (!scanner.hasPrecedingLineBreak() && expr.kind === 70 /* Identifier */ && token() === 35 /* EqualsGreaterThanToken */) { return 1 /* True */; } } return 0 /* False */; } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(180 /* ArrowFunction */); - setModifiers(node, parseModifiersForArrowFunction()); - var isAsync = !!(node.flags & 256 /* Async */); + var node = createNode(185 /* ArrowFunction */); + node.modifiers = parseModifiersForArrowFunction(); + var isAsync = !!(ts.getModifierFlags(node) & 256 /* Async */); // Arrow functions are never generators. // // If we're speculatively parsing a signature for a parenthesized arrow function, then @@ -10954,7 +16677,7 @@ var ts; // a => (b => c) // And think that "(b =>" was actually a parenthesized arrow function with a missing // close paren. - fillSignature(54 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ !allowAmbiguity, node); + fillSignature(55 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ !allowAmbiguity, node); // If we couldn't get parameters, we definitely could not parse out an arrow function. if (!node.parameters) { return undefined; @@ -10967,19 +16690,19 @@ var ts; // - "a ? (b): c" will have "(b):" parsed as a signature with a return type annotation. // // So we need just a bit of lookahead to ensure that it can only be a signature. - if (!allowAmbiguity && token() !== 34 /* EqualsGreaterThanToken */ && token() !== 15 /* OpenBraceToken */) { + if (!allowAmbiguity && token() !== 35 /* EqualsGreaterThanToken */ && token() !== 16 /* OpenBraceToken */) { // Returning undefined here will cause our caller to rewind to where we started from. return undefined; } return node; } function parseArrowFunctionExpressionBody(isAsync) { - if (token() === 15 /* OpenBraceToken */) { + if (token() === 16 /* OpenBraceToken */) { return parseFunctionBlock(/*allowYield*/ false, /*allowAwait*/ isAsync, /*ignoreMissingOpenBrace*/ false); } - if (token() !== 23 /* SemicolonToken */ && - token() !== 87 /* FunctionKeyword */ && - token() !== 73 /* ClassKeyword */ && + if (token() !== 24 /* SemicolonToken */ && + token() !== 88 /* FunctionKeyword */ && + token() !== 74 /* ClassKeyword */ && isStartOfStatement() && !isStartOfExpressionStatement()) { // Check if we got a plain statement (i.e. no expression-statements, no function/class expressions/declarations) @@ -11004,17 +16727,17 @@ var ts; } function parseConditionalExpressionRest(leftOperand) { // Note: we are passed in an expression which was produced from parseBinaryExpressionOrHigher. - var questionToken = parseOptionalToken(53 /* QuestionToken */); + var questionToken = parseOptionalToken(54 /* QuestionToken */); if (!questionToken) { return leftOperand; } // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and // we do not that for the 'whenFalse' part. - var node = createNode(188 /* ConditionalExpression */, leftOperand.pos); + var node = createNode(193 /* ConditionalExpression */, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); - node.colonToken = parseExpectedToken(54 /* ColonToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(54 /* ColonToken */)); + node.colonToken = parseExpectedToken(55 /* ColonToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(55 /* ColonToken */)); node.whenFalse = parseAssignmentExpressionOrHigher(); return finishNode(node); } @@ -11023,7 +16746,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 90 /* InKeyword */ || t === 138 /* OfKeyword */; + return t === 91 /* InKeyword */ || t === 140 /* OfKeyword */; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { @@ -11052,16 +16775,16 @@ var ts; // ^^token; leftOperand = b. Return b ** c to the caller as a rightOperand // a ** b - c // ^token; leftOperand = b. Return b to the caller as a rightOperand - var consumeCurrentOperator = token() === 38 /* AsteriskAsteriskToken */ ? + var consumeCurrentOperator = token() === 39 /* AsteriskAsteriskToken */ ? newPrecedence >= precedence : newPrecedence > precedence; if (!consumeCurrentOperator) { break; } - if (token() === 90 /* InKeyword */ && inDisallowInContext()) { + if (token() === 91 /* InKeyword */ && inDisallowInContext()) { break; } - if (token() === 116 /* AsKeyword */) { + if (token() === 117 /* AsKeyword */) { // Make sure we *do* perform ASI for constructs like this: // var x = foo // as (Bar) @@ -11082,48 +16805,48 @@ var ts; return leftOperand; } function isBinaryOperator() { - if (inDisallowInContext() && token() === 90 /* InKeyword */) { + if (inDisallowInContext() && token() === 91 /* InKeyword */) { return false; } return getBinaryOperatorPrecedence() > 0; } function getBinaryOperatorPrecedence() { switch (token()) { - case 52 /* BarBarToken */: + case 53 /* BarBarToken */: return 1; - case 51 /* AmpersandAmpersandToken */: + case 52 /* AmpersandAmpersandToken */: return 2; - case 47 /* BarToken */: + case 48 /* BarToken */: return 3; - case 48 /* CaretToken */: + case 49 /* CaretToken */: return 4; - case 46 /* AmpersandToken */: + case 47 /* AmpersandToken */: return 5; - case 30 /* EqualsEqualsToken */: - case 31 /* ExclamationEqualsToken */: - case 32 /* EqualsEqualsEqualsToken */: - case 33 /* ExclamationEqualsEqualsToken */: + case 31 /* EqualsEqualsToken */: + case 32 /* ExclamationEqualsToken */: + case 33 /* EqualsEqualsEqualsToken */: + case 34 /* ExclamationEqualsEqualsToken */: return 6; - case 25 /* LessThanToken */: - case 27 /* GreaterThanToken */: - case 28 /* LessThanEqualsToken */: - case 29 /* GreaterThanEqualsToken */: - case 91 /* InstanceOfKeyword */: - case 90 /* InKeyword */: - case 116 /* AsKeyword */: + case 26 /* LessThanToken */: + case 28 /* GreaterThanToken */: + case 29 /* LessThanEqualsToken */: + case 30 /* GreaterThanEqualsToken */: + case 92 /* InstanceOfKeyword */: + case 91 /* InKeyword */: + case 117 /* AsKeyword */: return 7; - case 43 /* LessThanLessThanToken */: - case 44 /* GreaterThanGreaterThanToken */: - case 45 /* GreaterThanGreaterThanGreaterThanToken */: + case 44 /* LessThanLessThanToken */: + case 45 /* GreaterThanGreaterThanToken */: + case 46 /* GreaterThanGreaterThanGreaterThanToken */: return 8; - case 35 /* PlusToken */: - case 36 /* MinusToken */: + case 36 /* PlusToken */: + case 37 /* MinusToken */: return 9; - case 37 /* AsteriskToken */: - case 39 /* SlashToken */: - case 40 /* PercentToken */: + case 38 /* AsteriskToken */: + case 40 /* SlashToken */: + case 41 /* PercentToken */: return 10; - case 38 /* AsteriskAsteriskToken */: + case 39 /* AsteriskAsteriskToken */: return 11; } // -1 is lower than all other precedences. Returning it will cause binary expression @@ -11131,45 +16854,45 @@ var ts; return -1; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(187 /* BinaryExpression */, left.pos); + var node = createNode(192 /* BinaryExpression */, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(195 /* AsExpression */, left.pos); + var node = createNode(200 /* AsExpression */, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(185 /* PrefixUnaryExpression */); + var node = createNode(190 /* PrefixUnaryExpression */); node.operator = token(); nextToken(); node.operand = parseSimpleUnaryExpression(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(181 /* DeleteExpression */); + var node = createNode(186 /* DeleteExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(182 /* TypeOfExpression */); + var node = createNode(187 /* TypeOfExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(183 /* VoidExpression */); + var node = createNode(188 /* VoidExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function isAwaitExpression() { - if (token() === 119 /* AwaitKeyword */) { + if (token() === 120 /* AwaitKeyword */) { if (inAwaitContext()) { return true; } @@ -11179,7 +16902,7 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(184 /* AwaitExpression */); + var node = createNode(189 /* AwaitExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -11203,7 +16926,7 @@ var ts; */ if (isUpdateExpression()) { var incrementExpression = parseIncrementExpression(); - return token() === 38 /* AsteriskAsteriskToken */ ? + return token() === 39 /* AsteriskAsteriskToken */ ? parseBinaryExpressionRest(getBinaryOperatorPrecedence(), incrementExpression) : incrementExpression; } @@ -11220,9 +16943,9 @@ var ts; */ var unaryOperator = token(); var simpleUnaryExpression = parseSimpleUnaryExpression(); - if (token() === 38 /* AsteriskAsteriskToken */) { + if (token() === 39 /* AsteriskAsteriskToken */) { var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); - if (simpleUnaryExpression.kind === 177 /* TypeAssertionExpression */) { + if (simpleUnaryExpression.kind === 182 /* TypeAssertionExpression */) { parseErrorAtPosition(start, simpleUnaryExpression.end - start, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); } else { @@ -11247,23 +16970,23 @@ var ts; */ function parseSimpleUnaryExpression() { switch (token()) { - case 35 /* PlusToken */: - case 36 /* MinusToken */: - case 50 /* TildeToken */: - case 49 /* ExclamationToken */: + case 36 /* PlusToken */: + case 37 /* MinusToken */: + case 51 /* TildeToken */: + case 50 /* ExclamationToken */: return parsePrefixUnaryExpression(); - case 78 /* DeleteKeyword */: + case 79 /* DeleteKeyword */: return parseDeleteExpression(); - case 101 /* TypeOfKeyword */: + case 102 /* TypeOfKeyword */: return parseTypeOfExpression(); - case 103 /* VoidKeyword */: + case 104 /* VoidKeyword */: return parseVoidExpression(); - case 25 /* LessThanToken */: + case 26 /* LessThanToken */: // This is modified UnaryExpression grammar in TypeScript // UnaryExpression (modified): // < type > UnaryExpression return parseTypeAssertion(); - case 119 /* AwaitKeyword */: + case 120 /* AwaitKeyword */: if (isAwaitExpression()) { return parseAwaitExpression(); } @@ -11285,16 +17008,16 @@ var ts; // This function is called inside parseUnaryExpression to decide // whether to call parseSimpleUnaryExpression or call parseIncrementExpression directly switch (token()) { - case 35 /* PlusToken */: - case 36 /* MinusToken */: - case 50 /* TildeToken */: - case 49 /* ExclamationToken */: - case 78 /* DeleteKeyword */: - case 101 /* TypeOfKeyword */: - case 103 /* VoidKeyword */: - case 119 /* AwaitKeyword */: + case 36 /* PlusToken */: + case 37 /* MinusToken */: + case 51 /* TildeToken */: + case 50 /* ExclamationToken */: + case 79 /* DeleteKeyword */: + case 102 /* TypeOfKeyword */: + case 104 /* VoidKeyword */: + case 120 /* AwaitKeyword */: return false; - case 25 /* LessThanToken */: + case 26 /* LessThanToken */: // If we are not in JSX context, we are parsing TypeAssertion which is an UnaryExpression if (sourceFile.languageVariant !== 1 /* JSX */) { return false; @@ -11317,21 +17040,21 @@ var ts; * In TypeScript (2), (3) are parsed as PostfixUnaryExpression. (4), (5) are parsed as PrefixUnaryExpression */ function parseIncrementExpression() { - if (token() === 41 /* PlusPlusToken */ || token() === 42 /* MinusMinusToken */) { - var node = createNode(185 /* PrefixUnaryExpression */); + if (token() === 42 /* PlusPlusToken */ || token() === 43 /* MinusMinusToken */) { + var node = createNode(190 /* PrefixUnaryExpression */); node.operator = token(); nextToken(); node.operand = parseLeftHandSideExpressionOrHigher(); return finishNode(node); } - else if (sourceFile.languageVariant === 1 /* JSX */ && token() === 25 /* LessThanToken */ && lookAhead(nextTokenIsIdentifierOrKeyword)) { + else if (sourceFile.languageVariant === 1 /* JSX */ && token() === 26 /* LessThanToken */ && lookAhead(nextTokenIsIdentifierOrKeyword)) { // JSXElement is part of primaryExpression return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ true); } var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); - if ((token() === 41 /* PlusPlusToken */ || token() === 42 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(186 /* PostfixUnaryExpression */, expression.pos); + if ((token() === 42 /* PlusPlusToken */ || token() === 43 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { + var node = createNode(191 /* PostfixUnaryExpression */, expression.pos); node.operand = expression; node.operator = token(); nextToken(); @@ -11370,7 +17093,7 @@ var ts; // the last two CallExpression productions. Or we have a MemberExpression which either // completes the LeftHandSideExpression, or starts the beginning of the first four // CallExpression productions. - var expression = token() === 95 /* SuperKeyword */ + var expression = token() === 96 /* SuperKeyword */ ? parseSuperExpression() : parseMemberExpressionOrHigher(); // Now, we *may* be complete. However, we might have consumed the start of a @@ -11430,14 +17153,14 @@ var ts; } function parseSuperExpression() { var expression = parseTokenNode(); - if (token() === 17 /* OpenParenToken */ || token() === 21 /* DotToken */ || token() === 19 /* OpenBracketToken */) { + if (token() === 18 /* OpenParenToken */ || token() === 22 /* DotToken */ || token() === 20 /* OpenBracketToken */) { return expression; } // If we have seen "super" it must be followed by '(' or '.'. // If it wasn't then just try to parse out a '.' and report an error. - var node = createNode(172 /* PropertyAccessExpression */, expression.pos); + var node = createNode(177 /* PropertyAccessExpression */, expression.pos); node.expression = expression; - parseExpectedToken(21 /* DotToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); + parseExpectedToken(22 /* DotToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); return finishNode(node); } @@ -11445,10 +17168,10 @@ var ts; if (lhs.kind !== rhs.kind) { return false; } - if (lhs.kind === 69 /* Identifier */) { + if (lhs.kind === 70 /* Identifier */) { return lhs.text === rhs.text; } - if (lhs.kind === 97 /* ThisKeyword */) { + if (lhs.kind === 98 /* ThisKeyword */) { return true; } // If we are at this statement then we must have PropertyAccessExpression and because tag name in Jsx element can only @@ -11460,8 +17183,8 @@ var ts; function parseJsxElementOrSelfClosingElement(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); var result; - if (opening.kind === 243 /* JsxOpeningElement */) { - var node = createNode(241 /* JsxElement */, opening.pos); + if (opening.kind === 248 /* JsxOpeningElement */) { + var node = createNode(246 /* JsxElement */, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); node.closingElement = parseJsxClosingElement(inExpressionContext); @@ -11471,7 +17194,7 @@ var ts; result = finishNode(node); } else { - ts.Debug.assert(opening.kind === 242 /* JsxSelfClosingElement */); + ts.Debug.assert(opening.kind === 247 /* JsxSelfClosingElement */); // Nothing else to do for self-closing elements result = opening; } @@ -11482,15 +17205,15 @@ var ts; // does less damage and we can report a better error. // Since JSX elements are invalid < operands anyway, this lookahead parse will only occur in error scenarios // of one sort or another. - if (inExpressionContext && token() === 25 /* LessThanToken */) { + if (inExpressionContext && token() === 26 /* LessThanToken */) { var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ true); }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); - var badNode = createNode(187 /* BinaryExpression */, result.pos); + var badNode = createNode(192 /* BinaryExpression */, result.pos); badNode.end = invalidElement.end; badNode.left = result; badNode.right = invalidElement; - badNode.operatorToken = createMissingNode(24 /* CommaToken */, /*reportAtCurrentPosition*/ false, /*diagnosticMessage*/ undefined); + badNode.operatorToken = createMissingNode(25 /* CommaToken */, /*reportAtCurrentPosition*/ false, /*diagnosticMessage*/ undefined); badNode.operatorToken.pos = badNode.operatorToken.end = badNode.right.pos; return badNode; } @@ -11498,29 +17221,28 @@ var ts; return result; } function parseJsxText() { - var node = createNode(244 /* JsxText */, scanner.getStartPos()); + var node = createNode(10 /* JsxText */, scanner.getStartPos()); currentToken = scanner.scanJsxToken(); return finishNode(node); } function parseJsxChild() { switch (token()) { - case 244 /* JsxText */: + case 10 /* JsxText */: return parseJsxText(); - case 15 /* OpenBraceToken */: + case 16 /* OpenBraceToken */: return parseJsxExpression(/*inExpressionContext*/ false); - case 25 /* LessThanToken */: + case 26 /* LessThanToken */: return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ false); } ts.Debug.fail("Unknown JSX child kind " + token()); } function parseJsxChildren(openingTagName) { - var result = []; - result.pos = scanner.getStartPos(); + var result = createNodeArray(); var saveParsingContext = parsingContext; parsingContext |= 1 << 14 /* JsxChildren */; while (true) { currentToken = scanner.reScanJsxToken(); - if (token() === 26 /* LessThanSlashToken */) { + if (token() === 27 /* LessThanSlashToken */) { // Closing tag break; } @@ -11538,27 +17260,27 @@ var ts; } function parseJsxOpeningOrSelfClosingElement(inExpressionContext) { var fullStart = scanner.getStartPos(); - parseExpected(25 /* LessThanToken */); + parseExpected(26 /* LessThanToken */); var tagName = parseJsxElementName(); var attributes = parseList(13 /* JsxAttributes */, parseJsxAttribute); var node; - if (token() === 27 /* GreaterThanToken */) { + if (token() === 28 /* GreaterThanToken */) { // Closing tag, so scan the immediately-following text with the JSX scanning instead // of regular scanning to avoid treating illegal characters (e.g. '#') as immediate // scanning errors - node = createNode(243 /* JsxOpeningElement */, fullStart); + node = createNode(248 /* JsxOpeningElement */, fullStart); scanJsxText(); } else { - parseExpected(39 /* SlashToken */); + parseExpected(40 /* SlashToken */); if (inExpressionContext) { - parseExpected(27 /* GreaterThanToken */); + parseExpected(28 /* GreaterThanToken */); } else { - parseExpected(27 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false); + parseExpected(28 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false); scanJsxText(); } - node = createNode(242 /* JsxSelfClosingElement */, fullStart); + node = createNode(247 /* JsxSelfClosingElement */, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -11571,10 +17293,10 @@ var ts; // primaryExpression in the form of an identifier and "this" keyword // We can't just simply use parseLeftHandSideExpressionOrHigher because then we will start consider class,function etc as a keyword // We only want to consider "this" as a primaryExpression - var expression = token() === 97 /* ThisKeyword */ ? + var expression = token() === 98 /* ThisKeyword */ ? parseTokenNode() : parseIdentifierName(); - while (parseOptional(21 /* DotToken */)) { - var propertyAccess = createNode(172 /* PropertyAccessExpression */, expression.pos); + while (parseOptional(22 /* DotToken */)) { + var propertyAccess = createNode(177 /* PropertyAccessExpression */, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); expression = finishNode(propertyAccess); @@ -11582,29 +17304,29 @@ var ts; return expression; } function parseJsxExpression(inExpressionContext) { - var node = createNode(248 /* JsxExpression */); - parseExpected(15 /* OpenBraceToken */); - if (token() !== 16 /* CloseBraceToken */) { + var node = createNode(252 /* JsxExpression */); + parseExpected(16 /* OpenBraceToken */); + if (token() !== 17 /* CloseBraceToken */) { node.expression = parseAssignmentExpressionOrHigher(); } if (inExpressionContext) { - parseExpected(16 /* CloseBraceToken */); + parseExpected(17 /* CloseBraceToken */); } else { - parseExpected(16 /* CloseBraceToken */, /*message*/ undefined, /*shouldAdvance*/ false); + parseExpected(17 /* CloseBraceToken */, /*message*/ undefined, /*shouldAdvance*/ false); scanJsxText(); } return finishNode(node); } function parseJsxAttribute() { - if (token() === 15 /* OpenBraceToken */) { + if (token() === 16 /* OpenBraceToken */) { return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(246 /* JsxAttribute */); + var node = createNode(250 /* JsxAttribute */); node.name = parseIdentifierName(); - if (parseOptional(56 /* EqualsToken */)) { - switch (token()) { + if (token() === 57 /* EqualsToken */) { + switch (scanJsxAttributeValue()) { case 9 /* StringLiteral */: node.initializer = parseLiteralNode(); break; @@ -11616,72 +17338,72 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(247 /* JsxSpreadAttribute */); - parseExpected(15 /* OpenBraceToken */); - parseExpected(22 /* DotDotDotToken */); + var node = createNode(251 /* JsxSpreadAttribute */); + parseExpected(16 /* OpenBraceToken */); + parseExpected(23 /* DotDotDotToken */); node.expression = parseExpression(); - parseExpected(16 /* CloseBraceToken */); + parseExpected(17 /* CloseBraceToken */); return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(245 /* JsxClosingElement */); - parseExpected(26 /* LessThanSlashToken */); + var node = createNode(249 /* JsxClosingElement */); + parseExpected(27 /* LessThanSlashToken */); node.tagName = parseJsxElementName(); if (inExpressionContext) { - parseExpected(27 /* GreaterThanToken */); + parseExpected(28 /* GreaterThanToken */); } else { - parseExpected(27 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false); + parseExpected(28 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false); scanJsxText(); } return finishNode(node); } function parseTypeAssertion() { - var node = createNode(177 /* TypeAssertionExpression */); - parseExpected(25 /* LessThanToken */); + var node = createNode(182 /* TypeAssertionExpression */); + parseExpected(26 /* LessThanToken */); node.type = parseType(); - parseExpected(27 /* GreaterThanToken */); + parseExpected(28 /* GreaterThanToken */); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseMemberExpressionRest(expression) { while (true) { - var dotToken = parseOptionalToken(21 /* DotToken */); + var dotToken = parseOptionalToken(22 /* DotToken */); if (dotToken) { - var propertyAccess = createNode(172 /* PropertyAccessExpression */, expression.pos); + var propertyAccess = createNode(177 /* PropertyAccessExpression */, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); expression = finishNode(propertyAccess); continue; } - if (token() === 49 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 50 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) { nextToken(); - var nonNullExpression = createNode(196 /* NonNullExpression */, expression.pos); + var nonNullExpression = createNode(201 /* NonNullExpression */, expression.pos); nonNullExpression.expression = expression; expression = finishNode(nonNullExpression); continue; } // when in the [Decorator] context, we do not parse ElementAccess as it could be part of a ComputedPropertyName - if (!inDecoratorContext() && parseOptional(19 /* OpenBracketToken */)) { - var indexedAccess = createNode(173 /* ElementAccessExpression */, expression.pos); + if (!inDecoratorContext() && parseOptional(20 /* OpenBracketToken */)) { + var indexedAccess = createNode(178 /* ElementAccessExpression */, expression.pos); indexedAccess.expression = expression; // It's not uncommon for a user to write: "new Type[]". // Check for that common pattern and report a better error message. - if (token() !== 20 /* CloseBracketToken */) { + if (token() !== 21 /* CloseBracketToken */) { indexedAccess.argumentExpression = allowInAnd(parseExpression); if (indexedAccess.argumentExpression.kind === 9 /* StringLiteral */ || indexedAccess.argumentExpression.kind === 8 /* NumericLiteral */) { var literal = indexedAccess.argumentExpression; literal.text = internIdentifier(literal.text); } } - parseExpected(20 /* CloseBracketToken */); + parseExpected(21 /* CloseBracketToken */); expression = finishNode(indexedAccess); continue; } - if (token() === 11 /* NoSubstitutionTemplateLiteral */ || token() === 12 /* TemplateHead */) { - var tagExpression = createNode(176 /* TaggedTemplateExpression */, expression.pos); + if (token() === 12 /* NoSubstitutionTemplateLiteral */ || token() === 13 /* TemplateHead */) { + var tagExpression = createNode(181 /* TaggedTemplateExpression */, expression.pos); tagExpression.tag = expression; - tagExpression.template = token() === 11 /* NoSubstitutionTemplateLiteral */ + tagExpression.template = token() === 12 /* NoSubstitutionTemplateLiteral */ ? parseLiteralNode() : parseTemplateExpression(); expression = finishNode(tagExpression); @@ -11693,7 +17415,7 @@ var ts; function parseCallExpressionRest(expression) { while (true) { expression = parseMemberExpressionRest(expression); - if (token() === 25 /* LessThanToken */) { + if (token() === 26 /* LessThanToken */) { // See if this is the start of a generic invocation. If so, consume it and // keep checking for postfix expressions. Otherwise, it's just a '<' that's // part of an arithmetic expression. Break out so we consume it higher in the @@ -11702,15 +17424,15 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(174 /* CallExpression */, expression.pos); + var callExpr = createNode(179 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); continue; } - else if (token() === 17 /* OpenParenToken */) { - var callExpr = createNode(174 /* CallExpression */, expression.pos); + else if (token() === 18 /* OpenParenToken */) { + var callExpr = createNode(179 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -11720,17 +17442,17 @@ var ts; } } function parseArgumentList() { - parseExpected(17 /* OpenParenToken */); + parseExpected(18 /* OpenParenToken */); var result = parseDelimitedList(11 /* ArgumentExpressions */, parseArgumentExpression); - parseExpected(18 /* CloseParenToken */); + parseExpected(19 /* CloseParenToken */); return result; } function parseTypeArgumentsInExpression() { - if (!parseOptional(25 /* LessThanToken */)) { + if (!parseOptional(26 /* LessThanToken */)) { return undefined; } - var typeArguments = parseDelimitedList(18 /* TypeArguments */, parseType); - if (!parseExpected(27 /* GreaterThanToken */)) { + var typeArguments = parseDelimitedList(19 /* TypeArguments */, parseType); + if (!parseExpected(28 /* GreaterThanToken */)) { // If it doesn't have the closing > then it's definitely not an type argument list. return undefined; } @@ -11742,32 +17464,32 @@ var ts; } function canFollowTypeArgumentsInExpression() { switch (token()) { - case 17 /* OpenParenToken */: // foo( + case 18 /* OpenParenToken */: // foo( // this case are the only case where this token can legally follow a type argument // list. So we definitely want to treat this as a type arg list. - case 21 /* DotToken */: // foo. - case 18 /* CloseParenToken */: // foo) - case 20 /* CloseBracketToken */: // foo] - case 54 /* ColonToken */: // foo: - case 23 /* SemicolonToken */: // foo; - case 53 /* QuestionToken */: // foo? - case 30 /* EqualsEqualsToken */: // foo == - case 32 /* EqualsEqualsEqualsToken */: // foo === - case 31 /* ExclamationEqualsToken */: // foo != - case 33 /* ExclamationEqualsEqualsToken */: // foo !== - case 51 /* AmpersandAmpersandToken */: // foo && - case 52 /* BarBarToken */: // foo || - case 48 /* CaretToken */: // foo ^ - case 46 /* AmpersandToken */: // foo & - case 47 /* BarToken */: // foo | - case 16 /* CloseBraceToken */: // foo } + case 22 /* DotToken */: // foo. + case 19 /* CloseParenToken */: // foo) + case 21 /* CloseBracketToken */: // foo] + case 55 /* ColonToken */: // foo: + case 24 /* SemicolonToken */: // foo; + case 54 /* QuestionToken */: // foo? + case 31 /* EqualsEqualsToken */: // foo == + case 33 /* EqualsEqualsEqualsToken */: // foo === + case 32 /* ExclamationEqualsToken */: // foo != + case 34 /* ExclamationEqualsEqualsToken */: // foo !== + case 52 /* AmpersandAmpersandToken */: // foo && + case 53 /* BarBarToken */: // foo || + case 49 /* CaretToken */: // foo ^ + case 47 /* AmpersandToken */: // foo & + case 48 /* BarToken */: // foo | + case 17 /* CloseBraceToken */: // foo } case 1 /* EndOfFileToken */: // these cases can't legally follow a type arg list. However, they're not legal // expressions either. The user is probably in the middle of a generic type. So // treat it as such. return true; - case 24 /* CommaToken */: // foo, - case 15 /* OpenBraceToken */: // foo { + case 25 /* CommaToken */: // foo, + case 16 /* OpenBraceToken */: // foo { // We don't want to treat these as type arguments. Otherwise we'll parse this // as an invocation expression. Instead, we want to parse out the expression // in isolation from the type arguments. @@ -11780,21 +17502,21 @@ var ts; switch (token()) { case 8 /* NumericLiteral */: case 9 /* StringLiteral */: - case 11 /* NoSubstitutionTemplateLiteral */: + case 12 /* NoSubstitutionTemplateLiteral */: return parseLiteralNode(); - case 97 /* ThisKeyword */: - case 95 /* SuperKeyword */: - case 93 /* NullKeyword */: - case 99 /* TrueKeyword */: - case 84 /* FalseKeyword */: + case 98 /* ThisKeyword */: + case 96 /* SuperKeyword */: + case 94 /* NullKeyword */: + case 100 /* TrueKeyword */: + case 85 /* FalseKeyword */: return parseTokenNode(); - case 17 /* OpenParenToken */: + case 18 /* OpenParenToken */: return parseParenthesizedExpression(); - case 19 /* OpenBracketToken */: + case 20 /* OpenBracketToken */: return parseArrayLiteralExpression(); - case 15 /* OpenBraceToken */: + case 16 /* OpenBraceToken */: return parseObjectLiteralExpression(); - case 118 /* AsyncKeyword */: + case 119 /* AsyncKeyword */: // Async arrow functions are parsed earlier in parseAssignmentExpressionOrHigher. // If we encounter `async [no LineTerminator here] function` then this is an async // function; otherwise, its an identifier. @@ -11802,77 +17524,83 @@ var ts; break; } return parseFunctionExpression(); - case 73 /* ClassKeyword */: + case 74 /* ClassKeyword */: return parseClassExpression(); - case 87 /* FunctionKeyword */: + case 88 /* FunctionKeyword */: return parseFunctionExpression(); - case 92 /* NewKeyword */: + case 93 /* NewKeyword */: return parseNewExpression(); - case 39 /* SlashToken */: - case 61 /* SlashEqualsToken */: - if (reScanSlashToken() === 10 /* RegularExpressionLiteral */) { + case 40 /* SlashToken */: + case 62 /* SlashEqualsToken */: + if (reScanSlashToken() === 11 /* RegularExpressionLiteral */) { return parseLiteralNode(); } break; - case 12 /* TemplateHead */: + case 13 /* TemplateHead */: return parseTemplateExpression(); } return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(178 /* ParenthesizedExpression */); - parseExpected(17 /* OpenParenToken */); + var node = createNode(183 /* ParenthesizedExpression */); + parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); - parseExpected(18 /* CloseParenToken */); + parseExpected(19 /* CloseParenToken */); return finishNode(node); } function parseSpreadElement() { - var node = createNode(191 /* SpreadElementExpression */); - parseExpected(22 /* DotDotDotToken */); + var node = createNode(196 /* SpreadElement */); + parseExpected(23 /* DotDotDotToken */); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { - return token() === 22 /* DotDotDotToken */ ? parseSpreadElement() : - token() === 24 /* CommaToken */ ? createNode(193 /* OmittedExpression */) : + return token() === 23 /* DotDotDotToken */ ? parseSpreadElement() : + token() === 25 /* CommaToken */ ? createNode(198 /* OmittedExpression */) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(170 /* ArrayLiteralExpression */); - parseExpected(19 /* OpenBracketToken */); + var node = createNode(175 /* ArrayLiteralExpression */); + parseExpected(20 /* OpenBracketToken */); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; } node.elements = parseDelimitedList(15 /* ArrayLiteralMembers */, parseArgumentOrArrayLiteralElement); - parseExpected(20 /* CloseBracketToken */); + parseExpected(21 /* CloseBracketToken */); return finishNode(node); } function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { - if (parseContextualModifier(123 /* GetKeyword */)) { - return addJSDocComment(parseAccessorDeclaration(149 /* GetAccessor */, fullStart, decorators, modifiers)); + if (parseContextualModifier(124 /* GetKeyword */)) { + return parseAccessorDeclaration(151 /* GetAccessor */, fullStart, decorators, modifiers); } - else if (parseContextualModifier(131 /* SetKeyword */)) { - return parseAccessorDeclaration(150 /* SetAccessor */, fullStart, decorators, modifiers); + else if (parseContextualModifier(133 /* SetKeyword */)) { + return parseAccessorDeclaration(152 /* SetAccessor */, fullStart, decorators, modifiers); } return undefined; } function parseObjectLiteralElement() { var fullStart = scanner.getStartPos(); + var dotDotDotToken = parseOptionalToken(23 /* DotDotDotToken */); + if (dotDotDotToken) { + var spreadElement = createNode(259 /* SpreadAssignment */, fullStart); + spreadElement.expression = parseAssignmentExpressionOrHigher(); + return addJSDocComment(finishNode(spreadElement)); + } var decorators = parseDecorators(); var modifiers = parseModifiers(); var accessor = tryParseAccessorDeclaration(fullStart, decorators, modifiers); if (accessor) { return accessor; } - var asteriskToken = parseOptionalToken(37 /* AsteriskToken */); + var asteriskToken = parseOptionalToken(38 /* AsteriskToken */); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); // Disallowing of optional property assignments happens in the grammar checker. - var questionToken = parseOptionalToken(53 /* QuestionToken */); - if (asteriskToken || token() === 17 /* OpenParenToken */ || token() === 25 /* LessThanToken */) { + var questionToken = parseOptionalToken(54 /* QuestionToken */); + if (asteriskToken || token() === 18 /* OpenParenToken */ || token() === 26 /* LessThanToken */) { return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, propertyName, questionToken); } // check if it is short-hand property assignment or normal property assignment @@ -11880,12 +17608,12 @@ var ts; // CoverInitializedName[Yield] : // IdentifierReference[?Yield] Initializer[In, ?Yield] // this is necessary because ObjectLiteral productions are also used to cover grammar for ObjectAssignmentPattern - var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 24 /* CommaToken */ || token() === 16 /* CloseBraceToken */ || token() === 56 /* EqualsToken */); + var isShorthandPropertyAssignment = tokenIsIdentifier && (token() === 25 /* CommaToken */ || token() === 17 /* CloseBraceToken */ || token() === 57 /* EqualsToken */); if (isShorthandPropertyAssignment) { - var shorthandDeclaration = createNode(254 /* ShorthandPropertyAssignment */, fullStart); + var shorthandDeclaration = createNode(258 /* ShorthandPropertyAssignment */, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; - var equalsToken = parseOptionalToken(56 /* EqualsToken */); + var equalsToken = parseOptionalToken(57 /* EqualsToken */); if (equalsToken) { shorthandDeclaration.equalsToken = equalsToken; shorthandDeclaration.objectAssignmentInitializer = allowInAnd(parseAssignmentExpressionOrHigher); @@ -11893,23 +17621,23 @@ var ts; return addJSDocComment(finishNode(shorthandDeclaration)); } else { - var propertyAssignment = createNode(253 /* PropertyAssignment */, fullStart); + var propertyAssignment = createNode(257 /* PropertyAssignment */, fullStart); propertyAssignment.modifiers = modifiers; propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; - parseExpected(54 /* ColonToken */); + parseExpected(55 /* ColonToken */); propertyAssignment.initializer = allowInAnd(parseAssignmentExpressionOrHigher); return addJSDocComment(finishNode(propertyAssignment)); } } function parseObjectLiteralExpression() { - var node = createNode(171 /* ObjectLiteralExpression */); - parseExpected(15 /* OpenBraceToken */); + var node = createNode(176 /* ObjectLiteralExpression */); + parseExpected(16 /* OpenBraceToken */); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; } node.properties = parseDelimitedList(12 /* ObjectLiteralMembers */, parseObjectLiteralElement, /*considerSemicolonAsDelimiter*/ true); - parseExpected(16 /* CloseBraceToken */); + parseExpected(17 /* CloseBraceToken */); return finishNode(node); } function parseFunctionExpression() { @@ -11922,18 +17650,18 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(/*val*/ false); } - var node = createNode(179 /* FunctionExpression */); - setModifiers(node, parseModifiers()); - parseExpected(87 /* FunctionKeyword */); - node.asteriskToken = parseOptionalToken(37 /* AsteriskToken */); + var node = createNode(184 /* FunctionExpression */); + node.modifiers = parseModifiers(); + parseExpected(88 /* FunctionKeyword */); + node.asteriskToken = parseOptionalToken(38 /* AsteriskToken */); var isGenerator = !!node.asteriskToken; - var isAsync = !!(node.flags & 256 /* Async */); + var isAsync = !!(ts.getModifierFlags(node) & 256 /* Async */); node.name = isGenerator && isAsync ? doInYieldAndAwaitContext(parseOptionalIdentifier) : isGenerator ? doInYieldContext(parseOptionalIdentifier) : isAsync ? doInAwaitContext(parseOptionalIdentifier) : parseOptionalIdentifier(); - fillSignature(54 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, node); + fillSignature(55 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, node); node.body = parseFunctionBlock(/*allowYield*/ isGenerator, /*allowAwait*/ isAsync, /*ignoreMissingOpenBrace*/ false); if (saveDecoratorContext) { setDecoratorContext(/*val*/ true); @@ -11944,21 +17672,24 @@ var ts; return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(175 /* NewExpression */); - parseExpected(92 /* NewKeyword */); + var node = createNode(180 /* NewExpression */); + parseExpected(93 /* NewKeyword */); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); - if (node.typeArguments || token() === 17 /* OpenParenToken */) { + if (node.typeArguments || token() === 18 /* OpenParenToken */) { node.arguments = parseArgumentList(); } return finishNode(node); } // STATEMENTS function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(199 /* Block */); - if (parseExpected(15 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) { + var node = createNode(204 /* Block */); + if (parseExpected(16 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) { + if (scanner.hasPrecedingLineBreak()) { + node.multiLine = true; + } node.statements = parseList(1 /* BlockStatements */, parseStatement); - parseExpected(16 /* CloseBraceToken */); + parseExpected(17 /* CloseBraceToken */); } else { node.statements = createMissingList(); @@ -11985,51 +17716,51 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(201 /* EmptyStatement */); - parseExpected(23 /* SemicolonToken */); + var node = createNode(206 /* EmptyStatement */); + parseExpected(24 /* SemicolonToken */); return finishNode(node); } function parseIfStatement() { - var node = createNode(203 /* IfStatement */); - parseExpected(88 /* IfKeyword */); - parseExpected(17 /* OpenParenToken */); + var node = createNode(208 /* IfStatement */); + parseExpected(89 /* IfKeyword */); + parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); - parseExpected(18 /* CloseParenToken */); + parseExpected(19 /* CloseParenToken */); node.thenStatement = parseStatement(); - node.elseStatement = parseOptional(80 /* ElseKeyword */) ? parseStatement() : undefined; + node.elseStatement = parseOptional(81 /* ElseKeyword */) ? parseStatement() : undefined; return finishNode(node); } function parseDoStatement() { - var node = createNode(204 /* DoStatement */); - parseExpected(79 /* DoKeyword */); + var node = createNode(209 /* DoStatement */); + parseExpected(80 /* DoKeyword */); node.statement = parseStatement(); - parseExpected(104 /* WhileKeyword */); - parseExpected(17 /* OpenParenToken */); + parseExpected(105 /* WhileKeyword */); + parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); - parseExpected(18 /* CloseParenToken */); + parseExpected(19 /* CloseParenToken */); // From: https://mail.mozilla.org/pipermail/es-discuss/2011-August/016188.html // 157 min --- All allen at wirfs-brock.com CONF --- "do{;}while(false)false" prohibited in // spec but allowed in consensus reality. Approved -- this is the de-facto standard whereby // do;while(0)x will have a semicolon inserted before x. - parseOptional(23 /* SemicolonToken */); + parseOptional(24 /* SemicolonToken */); return finishNode(node); } function parseWhileStatement() { - var node = createNode(205 /* WhileStatement */); - parseExpected(104 /* WhileKeyword */); - parseExpected(17 /* OpenParenToken */); + var node = createNode(210 /* WhileStatement */); + parseExpected(105 /* WhileKeyword */); + parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); - parseExpected(18 /* CloseParenToken */); + parseExpected(19 /* CloseParenToken */); node.statement = parseStatement(); return finishNode(node); } function parseForOrForInOrForOfStatement() { var pos = getNodePos(); - parseExpected(86 /* ForKeyword */); - parseExpected(17 /* OpenParenToken */); + parseExpected(87 /* ForKeyword */); + parseExpected(18 /* OpenParenToken */); var initializer = undefined; - if (token() !== 23 /* SemicolonToken */) { - if (token() === 102 /* VarKeyword */ || token() === 108 /* LetKeyword */ || token() === 74 /* ConstKeyword */) { + if (token() !== 24 /* SemicolonToken */) { + if (token() === 103 /* VarKeyword */ || token() === 109 /* LetKeyword */ || token() === 75 /* ConstKeyword */) { initializer = parseVariableDeclarationList(/*inForStatementInitializer*/ true); } else { @@ -12037,32 +17768,32 @@ var ts; } } var forOrForInOrForOfStatement; - if (parseOptional(90 /* InKeyword */)) { - var forInStatement = createNode(207 /* ForInStatement */, pos); + if (parseOptional(91 /* InKeyword */)) { + var forInStatement = createNode(212 /* ForInStatement */, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); - parseExpected(18 /* CloseParenToken */); + parseExpected(19 /* CloseParenToken */); forOrForInOrForOfStatement = forInStatement; } - else if (parseOptional(138 /* OfKeyword */)) { - var forOfStatement = createNode(208 /* ForOfStatement */, pos); + else if (parseOptional(140 /* OfKeyword */)) { + var forOfStatement = createNode(213 /* ForOfStatement */, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); - parseExpected(18 /* CloseParenToken */); + parseExpected(19 /* CloseParenToken */); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(206 /* ForStatement */, pos); + var forStatement = createNode(211 /* ForStatement */, pos); forStatement.initializer = initializer; - parseExpected(23 /* SemicolonToken */); - if (token() !== 23 /* SemicolonToken */ && token() !== 18 /* CloseParenToken */) { + parseExpected(24 /* SemicolonToken */); + if (token() !== 24 /* SemicolonToken */ && token() !== 19 /* CloseParenToken */) { forStatement.condition = allowInAnd(parseExpression); } - parseExpected(23 /* SemicolonToken */); - if (token() !== 18 /* CloseParenToken */) { + parseExpected(24 /* SemicolonToken */); + if (token() !== 19 /* CloseParenToken */) { forStatement.incrementor = allowInAnd(parseExpression); } - parseExpected(18 /* CloseParenToken */); + parseExpected(19 /* CloseParenToken */); forOrForInOrForOfStatement = forStatement; } forOrForInOrForOfStatement.statement = parseStatement(); @@ -12070,7 +17801,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 210 /* BreakStatement */ ? 70 /* BreakKeyword */ : 75 /* ContinueKeyword */); + parseExpected(kind === 215 /* BreakStatement */ ? 71 /* BreakKeyword */ : 76 /* ContinueKeyword */); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -12078,8 +17809,8 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(211 /* ReturnStatement */); - parseExpected(94 /* ReturnKeyword */); + var node = createNode(216 /* ReturnStatement */); + parseExpected(95 /* ReturnKeyword */); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); } @@ -12087,42 +17818,42 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(212 /* WithStatement */); - parseExpected(105 /* WithKeyword */); - parseExpected(17 /* OpenParenToken */); + var node = createNode(217 /* WithStatement */); + parseExpected(106 /* WithKeyword */); + parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); - parseExpected(18 /* CloseParenToken */); + parseExpected(19 /* CloseParenToken */); node.statement = parseStatement(); return finishNode(node); } function parseCaseClause() { - var node = createNode(249 /* CaseClause */); - parseExpected(71 /* CaseKeyword */); + var node = createNode(253 /* CaseClause */); + parseExpected(72 /* CaseKeyword */); node.expression = allowInAnd(parseExpression); - parseExpected(54 /* ColonToken */); + parseExpected(55 /* ColonToken */); node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement); return finishNode(node); } function parseDefaultClause() { - var node = createNode(250 /* DefaultClause */); - parseExpected(77 /* DefaultKeyword */); - parseExpected(54 /* ColonToken */); + var node = createNode(254 /* DefaultClause */); + parseExpected(78 /* DefaultKeyword */); + parseExpected(55 /* ColonToken */); node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement); return finishNode(node); } function parseCaseOrDefaultClause() { - return token() === 71 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); + return token() === 72 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(213 /* SwitchStatement */); - parseExpected(96 /* SwitchKeyword */); - parseExpected(17 /* OpenParenToken */); + var node = createNode(218 /* SwitchStatement */); + parseExpected(97 /* SwitchKeyword */); + parseExpected(18 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); - parseExpected(18 /* CloseParenToken */); - var caseBlock = createNode(227 /* CaseBlock */, scanner.getStartPos()); - parseExpected(15 /* OpenBraceToken */); + parseExpected(19 /* CloseParenToken */); + var caseBlock = createNode(232 /* CaseBlock */, scanner.getStartPos()); + parseExpected(16 /* OpenBraceToken */); caseBlock.clauses = parseList(2 /* SwitchClauses */, parseCaseOrDefaultClause); - parseExpected(16 /* CloseBraceToken */); + parseExpected(17 /* CloseBraceToken */); node.caseBlock = finishNode(caseBlock); return finishNode(node); } @@ -12134,39 +17865,39 @@ var ts; // directly as that might consume an expression on the following line. // We just return 'undefined' in that case. The actual error will be reported in the // grammar walker. - var node = createNode(215 /* ThrowStatement */); - parseExpected(98 /* ThrowKeyword */); + var node = createNode(220 /* ThrowStatement */); + parseExpected(99 /* ThrowKeyword */); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } // TODO: Review for error recovery function parseTryStatement() { - var node = createNode(216 /* TryStatement */); - parseExpected(100 /* TryKeyword */); + var node = createNode(221 /* TryStatement */); + parseExpected(101 /* TryKeyword */); node.tryBlock = parseBlock(/*ignoreMissingOpenBrace*/ false); - node.catchClause = token() === 72 /* CatchKeyword */ ? parseCatchClause() : undefined; + node.catchClause = token() === 73 /* CatchKeyword */ ? parseCatchClause() : undefined; // If we don't have a catch clause, then we must have a finally clause. Try to parse // one out no matter what. - if (!node.catchClause || token() === 85 /* FinallyKeyword */) { - parseExpected(85 /* FinallyKeyword */); + if (!node.catchClause || token() === 86 /* FinallyKeyword */) { + parseExpected(86 /* FinallyKeyword */); node.finallyBlock = parseBlock(/*ignoreMissingOpenBrace*/ false); } return finishNode(node); } function parseCatchClause() { - var result = createNode(252 /* CatchClause */); - parseExpected(72 /* CatchKeyword */); - if (parseExpected(17 /* OpenParenToken */)) { + var result = createNode(256 /* CatchClause */); + parseExpected(73 /* CatchKeyword */); + if (parseExpected(18 /* OpenParenToken */)) { result.variableDeclaration = parseVariableDeclaration(); } - parseExpected(18 /* CloseParenToken */); + parseExpected(19 /* CloseParenToken */); result.block = parseBlock(/*ignoreMissingOpenBrace*/ false); return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(217 /* DebuggerStatement */); - parseExpected(76 /* DebuggerKeyword */); + var node = createNode(222 /* DebuggerStatement */); + parseExpected(77 /* DebuggerKeyword */); parseSemicolon(); return finishNode(node); } @@ -12176,14 +17907,14 @@ var ts; // a colon. var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); - if (expression.kind === 69 /* Identifier */ && parseOptional(54 /* ColonToken */)) { - var labeledStatement = createNode(214 /* LabeledStatement */, fullStart); + if (expression.kind === 70 /* Identifier */ && parseOptional(55 /* ColonToken */)) { + var labeledStatement = createNode(219 /* LabeledStatement */, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return addJSDocComment(finishNode(labeledStatement)); } else { - var expressionStatement = createNode(202 /* ExpressionStatement */, fullStart); + var expressionStatement = createNode(207 /* ExpressionStatement */, fullStart); expressionStatement.expression = expression; parseSemicolon(); return addJSDocComment(finishNode(expressionStatement)); @@ -12195,7 +17926,7 @@ var ts; } function nextTokenIsFunctionKeywordOnSameLine() { nextToken(); - return token() === 87 /* FunctionKeyword */ && !scanner.hasPrecedingLineBreak(); + return token() === 88 /* FunctionKeyword */ && !scanner.hasPrecedingLineBreak(); } function nextTokenIsIdentifierOrKeywordOrNumberOnSameLine() { nextToken(); @@ -12204,12 +17935,12 @@ var ts; function isDeclaration() { while (true) { switch (token()) { - case 102 /* VarKeyword */: - case 108 /* LetKeyword */: - case 74 /* ConstKeyword */: - case 87 /* FunctionKeyword */: - case 73 /* ClassKeyword */: - case 81 /* EnumKeyword */: + case 103 /* VarKeyword */: + case 109 /* LetKeyword */: + case 75 /* ConstKeyword */: + case 88 /* FunctionKeyword */: + case 74 /* ClassKeyword */: + case 82 /* EnumKeyword */: return true; // 'declare', 'module', 'namespace', 'interface'* and 'type' are all legal JavaScript identifiers; // however, an identifier cannot be followed by another identifier on the same line. This is what we @@ -12232,41 +17963,41 @@ var ts; // I {} // // could be legal, it would add complexity for very little gain. - case 107 /* InterfaceKeyword */: - case 134 /* TypeKeyword */: + case 108 /* InterfaceKeyword */: + case 136 /* TypeKeyword */: return nextTokenIsIdentifierOnSameLine(); - case 125 /* ModuleKeyword */: - case 126 /* NamespaceKeyword */: + case 127 /* ModuleKeyword */: + case 128 /* NamespaceKeyword */: return nextTokenIsIdentifierOrStringLiteralOnSameLine(); - case 115 /* AbstractKeyword */: - case 118 /* AsyncKeyword */: - case 122 /* DeclareKeyword */: - case 110 /* PrivateKeyword */: - case 111 /* ProtectedKeyword */: - case 112 /* PublicKeyword */: - case 128 /* ReadonlyKeyword */: + case 116 /* AbstractKeyword */: + case 119 /* AsyncKeyword */: + case 123 /* DeclareKeyword */: + case 111 /* PrivateKeyword */: + case 112 /* ProtectedKeyword */: + case 113 /* PublicKeyword */: + case 130 /* ReadonlyKeyword */: nextToken(); // ASI takes effect for this modifier. if (scanner.hasPrecedingLineBreak()) { return false; } continue; - case 137 /* GlobalKeyword */: + case 139 /* GlobalKeyword */: nextToken(); - return token() === 15 /* OpenBraceToken */ || token() === 69 /* Identifier */ || token() === 82 /* ExportKeyword */; - case 89 /* ImportKeyword */: + return token() === 16 /* OpenBraceToken */ || token() === 70 /* Identifier */ || token() === 83 /* ExportKeyword */; + case 90 /* ImportKeyword */: nextToken(); - return token() === 9 /* StringLiteral */ || token() === 37 /* AsteriskToken */ || - token() === 15 /* OpenBraceToken */ || ts.tokenIsIdentifierOrKeyword(token()); - case 82 /* ExportKeyword */: + return token() === 9 /* StringLiteral */ || token() === 38 /* AsteriskToken */ || + token() === 16 /* OpenBraceToken */ || ts.tokenIsIdentifierOrKeyword(token()); + case 83 /* ExportKeyword */: nextToken(); - if (token() === 56 /* EqualsToken */ || token() === 37 /* AsteriskToken */ || - token() === 15 /* OpenBraceToken */ || token() === 77 /* DefaultKeyword */ || - token() === 116 /* AsKeyword */) { + if (token() === 57 /* EqualsToken */ || token() === 38 /* AsteriskToken */ || + token() === 16 /* OpenBraceToken */ || token() === 78 /* DefaultKeyword */ || + token() === 117 /* AsKeyword */) { return true; } continue; - case 113 /* StaticKeyword */: + case 114 /* StaticKeyword */: nextToken(); continue; default: @@ -12279,49 +18010,49 @@ var ts; } function isStartOfStatement() { switch (token()) { - case 55 /* AtToken */: - case 23 /* SemicolonToken */: - case 15 /* OpenBraceToken */: - case 102 /* VarKeyword */: - case 108 /* LetKeyword */: - case 87 /* FunctionKeyword */: - case 73 /* ClassKeyword */: - case 81 /* EnumKeyword */: - case 88 /* IfKeyword */: - case 79 /* DoKeyword */: - case 104 /* WhileKeyword */: - case 86 /* ForKeyword */: - case 75 /* ContinueKeyword */: - case 70 /* BreakKeyword */: - case 94 /* ReturnKeyword */: - case 105 /* WithKeyword */: - case 96 /* SwitchKeyword */: - case 98 /* ThrowKeyword */: - case 100 /* TryKeyword */: - case 76 /* DebuggerKeyword */: + case 56 /* AtToken */: + case 24 /* SemicolonToken */: + case 16 /* OpenBraceToken */: + case 103 /* VarKeyword */: + case 109 /* LetKeyword */: + case 88 /* FunctionKeyword */: + case 74 /* ClassKeyword */: + case 82 /* EnumKeyword */: + case 89 /* IfKeyword */: + case 80 /* DoKeyword */: + case 105 /* WhileKeyword */: + case 87 /* ForKeyword */: + case 76 /* ContinueKeyword */: + case 71 /* BreakKeyword */: + case 95 /* ReturnKeyword */: + case 106 /* WithKeyword */: + case 97 /* SwitchKeyword */: + case 99 /* ThrowKeyword */: + case 101 /* TryKeyword */: + case 77 /* DebuggerKeyword */: // 'catch' and 'finally' do not actually indicate that the code is part of a statement, // however, we say they are here so that we may gracefully parse them and error later. - case 72 /* CatchKeyword */: - case 85 /* FinallyKeyword */: + case 73 /* CatchKeyword */: + case 86 /* FinallyKeyword */: return true; - case 74 /* ConstKeyword */: - case 82 /* ExportKeyword */: - case 89 /* ImportKeyword */: + case 75 /* ConstKeyword */: + case 83 /* ExportKeyword */: + case 90 /* ImportKeyword */: return isStartOfDeclaration(); - case 118 /* AsyncKeyword */: - case 122 /* DeclareKeyword */: - case 107 /* InterfaceKeyword */: - case 125 /* ModuleKeyword */: - case 126 /* NamespaceKeyword */: - case 134 /* TypeKeyword */: - case 137 /* GlobalKeyword */: + case 119 /* AsyncKeyword */: + case 123 /* DeclareKeyword */: + case 108 /* InterfaceKeyword */: + case 127 /* ModuleKeyword */: + case 128 /* NamespaceKeyword */: + case 136 /* TypeKeyword */: + case 139 /* GlobalKeyword */: // When these don't start a declaration, they're an identifier in an expression statement return true; - case 112 /* PublicKeyword */: - case 110 /* PrivateKeyword */: - case 111 /* ProtectedKeyword */: - case 113 /* StaticKeyword */: - case 128 /* ReadonlyKeyword */: + case 113 /* PublicKeyword */: + case 111 /* PrivateKeyword */: + case 112 /* ProtectedKeyword */: + case 114 /* StaticKeyword */: + case 130 /* ReadonlyKeyword */: // When these don't start a declaration, they may be the start of a class member if an identifier // immediately follows. Otherwise they're an identifier in an expression statement. return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); @@ -12331,7 +18062,7 @@ var ts; } function nextTokenIsIdentifierOrStartOfDestructuring() { nextToken(); - return isIdentifier() || token() === 15 /* OpenBraceToken */ || token() === 19 /* OpenBracketToken */; + return isIdentifier() || token() === 16 /* OpenBraceToken */ || token() === 20 /* OpenBracketToken */; } function isLetDeclaration() { // In ES6 'let' always starts a lexical declaration if followed by an identifier or { @@ -12340,67 +18071,67 @@ var ts; } function parseStatement() { switch (token()) { - case 23 /* SemicolonToken */: + case 24 /* SemicolonToken */: return parseEmptyStatement(); - case 15 /* OpenBraceToken */: + case 16 /* OpenBraceToken */: return parseBlock(/*ignoreMissingOpenBrace*/ false); - case 102 /* VarKeyword */: + case 103 /* VarKeyword */: return parseVariableStatement(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined); - case 108 /* LetKeyword */: + case 109 /* LetKeyword */: if (isLetDeclaration()) { return parseVariableStatement(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined); } break; - case 87 /* FunctionKeyword */: + case 88 /* FunctionKeyword */: return parseFunctionDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined); - case 73 /* ClassKeyword */: + case 74 /* ClassKeyword */: return parseClassDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined); - case 88 /* IfKeyword */: + case 89 /* IfKeyword */: return parseIfStatement(); - case 79 /* DoKeyword */: + case 80 /* DoKeyword */: return parseDoStatement(); - case 104 /* WhileKeyword */: + case 105 /* WhileKeyword */: return parseWhileStatement(); - case 86 /* ForKeyword */: + case 87 /* ForKeyword */: return parseForOrForInOrForOfStatement(); - case 75 /* ContinueKeyword */: - return parseBreakOrContinueStatement(209 /* ContinueStatement */); - case 70 /* BreakKeyword */: - return parseBreakOrContinueStatement(210 /* BreakStatement */); - case 94 /* ReturnKeyword */: + case 76 /* ContinueKeyword */: + return parseBreakOrContinueStatement(214 /* ContinueStatement */); + case 71 /* BreakKeyword */: + return parseBreakOrContinueStatement(215 /* BreakStatement */); + case 95 /* ReturnKeyword */: return parseReturnStatement(); - case 105 /* WithKeyword */: + case 106 /* WithKeyword */: return parseWithStatement(); - case 96 /* SwitchKeyword */: + case 97 /* SwitchKeyword */: return parseSwitchStatement(); - case 98 /* ThrowKeyword */: + case 99 /* ThrowKeyword */: return parseThrowStatement(); - case 100 /* TryKeyword */: + case 101 /* TryKeyword */: // Include 'catch' and 'finally' for error recovery. - case 72 /* CatchKeyword */: - case 85 /* FinallyKeyword */: + case 73 /* CatchKeyword */: + case 86 /* FinallyKeyword */: return parseTryStatement(); - case 76 /* DebuggerKeyword */: + case 77 /* DebuggerKeyword */: return parseDebuggerStatement(); - case 55 /* AtToken */: + case 56 /* AtToken */: return parseDeclaration(); - case 118 /* AsyncKeyword */: - case 107 /* InterfaceKeyword */: - case 134 /* TypeKeyword */: - case 125 /* ModuleKeyword */: - case 126 /* NamespaceKeyword */: - case 122 /* DeclareKeyword */: - case 74 /* ConstKeyword */: - case 81 /* EnumKeyword */: - case 82 /* ExportKeyword */: - case 89 /* ImportKeyword */: - case 110 /* PrivateKeyword */: - case 111 /* ProtectedKeyword */: - case 112 /* PublicKeyword */: - case 115 /* AbstractKeyword */: - case 113 /* StaticKeyword */: - case 128 /* ReadonlyKeyword */: - case 137 /* GlobalKeyword */: + case 119 /* AsyncKeyword */: + case 108 /* InterfaceKeyword */: + case 136 /* TypeKeyword */: + case 127 /* ModuleKeyword */: + case 128 /* NamespaceKeyword */: + case 123 /* DeclareKeyword */: + case 75 /* ConstKeyword */: + case 82 /* EnumKeyword */: + case 83 /* ExportKeyword */: + case 90 /* ImportKeyword */: + case 111 /* PrivateKeyword */: + case 112 /* ProtectedKeyword */: + case 113 /* PublicKeyword */: + case 116 /* AbstractKeyword */: + case 114 /* StaticKeyword */: + case 130 /* ReadonlyKeyword */: + case 139 /* GlobalKeyword */: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -12413,33 +18144,33 @@ var ts; var decorators = parseDecorators(); var modifiers = parseModifiers(); switch (token()) { - case 102 /* VarKeyword */: - case 108 /* LetKeyword */: - case 74 /* ConstKeyword */: + case 103 /* VarKeyword */: + case 109 /* LetKeyword */: + case 75 /* ConstKeyword */: return parseVariableStatement(fullStart, decorators, modifiers); - case 87 /* FunctionKeyword */: + case 88 /* FunctionKeyword */: return parseFunctionDeclaration(fullStart, decorators, modifiers); - case 73 /* ClassKeyword */: + case 74 /* ClassKeyword */: return parseClassDeclaration(fullStart, decorators, modifiers); - case 107 /* InterfaceKeyword */: + case 108 /* InterfaceKeyword */: return parseInterfaceDeclaration(fullStart, decorators, modifiers); - case 134 /* TypeKeyword */: + case 136 /* TypeKeyword */: return parseTypeAliasDeclaration(fullStart, decorators, modifiers); - case 81 /* EnumKeyword */: + case 82 /* EnumKeyword */: return parseEnumDeclaration(fullStart, decorators, modifiers); - case 137 /* GlobalKeyword */: - case 125 /* ModuleKeyword */: - case 126 /* NamespaceKeyword */: + case 139 /* GlobalKeyword */: + case 127 /* ModuleKeyword */: + case 128 /* NamespaceKeyword */: return parseModuleDeclaration(fullStart, decorators, modifiers); - case 89 /* ImportKeyword */: + case 90 /* ImportKeyword */: return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers); - case 82 /* ExportKeyword */: + case 83 /* ExportKeyword */: nextToken(); switch (token()) { - case 77 /* DefaultKeyword */: - case 56 /* EqualsToken */: + case 78 /* DefaultKeyword */: + case 57 /* EqualsToken */: return parseExportAssignment(fullStart, decorators, modifiers); - case 116 /* AsKeyword */: + case 117 /* AsKeyword */: return parseNamespaceExportDeclaration(fullStart, decorators, modifiers); default: return parseExportDeclaration(fullStart, decorators, modifiers); @@ -12448,10 +18179,10 @@ var ts; if (decorators || modifiers) { // We reached this point because we encountered decorators and/or modifiers and assumed a declaration // would follow. For recovery and error reporting purposes, return an incomplete declaration. - var node = createMissingNode(239 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(244 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; - setModifiers(node, modifiers); + node.modifiers = modifiers; return finishNode(node); } } @@ -12461,7 +18192,7 @@ var ts; return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token() === 9 /* StringLiteral */); } function parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage) { - if (token() !== 15 /* OpenBraceToken */ && canParseSemicolon()) { + if (token() !== 16 /* OpenBraceToken */ && canParseSemicolon()) { parseSemicolon(); return; } @@ -12469,24 +18200,25 @@ var ts; } // DECLARATIONS function parseArrayBindingElement() { - if (token() === 24 /* CommaToken */) { - return createNode(193 /* OmittedExpression */); + if (token() === 25 /* CommaToken */) { + return createNode(198 /* OmittedExpression */); } - var node = createNode(169 /* BindingElement */); - node.dotDotDotToken = parseOptionalToken(22 /* DotDotDotToken */); + var node = createNode(174 /* BindingElement */); + node.dotDotDotToken = parseOptionalToken(23 /* DotDotDotToken */); node.name = parseIdentifierOrPattern(); node.initializer = parseBindingElementInitializer(/*inParameter*/ false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(169 /* BindingElement */); + var node = createNode(174 /* BindingElement */); + node.dotDotDotToken = parseOptionalToken(23 /* DotDotDotToken */); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); - if (tokenIsIdentifier && token() !== 54 /* ColonToken */) { + if (tokenIsIdentifier && token() !== 55 /* ColonToken */) { node.name = propertyName; } else { - parseExpected(54 /* ColonToken */); + parseExpected(55 /* ColonToken */); node.propertyName = propertyName; node.name = parseIdentifierOrPattern(); } @@ -12494,33 +18226,33 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(167 /* ObjectBindingPattern */); - parseExpected(15 /* OpenBraceToken */); + var node = createNode(172 /* ObjectBindingPattern */); + parseExpected(16 /* OpenBraceToken */); node.elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement); - parseExpected(16 /* CloseBraceToken */); + parseExpected(17 /* CloseBraceToken */); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(168 /* ArrayBindingPattern */); - parseExpected(19 /* OpenBracketToken */); + var node = createNode(173 /* ArrayBindingPattern */); + parseExpected(20 /* OpenBracketToken */); node.elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement); - parseExpected(20 /* CloseBracketToken */); + parseExpected(21 /* CloseBracketToken */); return finishNode(node); } function isIdentifierOrPattern() { - return token() === 15 /* OpenBraceToken */ || token() === 19 /* OpenBracketToken */ || isIdentifier(); + return token() === 16 /* OpenBraceToken */ || token() === 20 /* OpenBracketToken */ || isIdentifier(); } function parseIdentifierOrPattern() { - if (token() === 19 /* OpenBracketToken */) { + if (token() === 20 /* OpenBracketToken */) { return parseArrayBindingPattern(); } - if (token() === 15 /* OpenBraceToken */) { + if (token() === 16 /* OpenBraceToken */) { return parseObjectBindingPattern(); } return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(218 /* VariableDeclaration */); + var node = createNode(223 /* VariableDeclaration */); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token())) { @@ -12529,15 +18261,15 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(219 /* VariableDeclarationList */); + var node = createNode(224 /* VariableDeclarationList */); switch (token()) { - case 102 /* VarKeyword */: + case 103 /* VarKeyword */: break; - case 108 /* LetKeyword */: - node.flags |= 1024 /* Let */; + case 109 /* LetKeyword */: + node.flags |= 1 /* Let */; break; - case 74 /* ConstKeyword */: - node.flags |= 2048 /* Const */; + case 75 /* ConstKeyword */: + node.flags |= 2 /* Const */; break; default: ts.Debug.fail(); @@ -12552,7 +18284,7 @@ var ts; // So we need to look ahead to determine if 'of' should be treated as a keyword in // this context. // The checker will then give an error that there is an empty declaration list. - if (token() === 138 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { + if (token() === 140 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -12564,55 +18296,55 @@ var ts; return finishNode(node); } function canFollowContextualOfKeyword() { - return nextTokenIsIdentifier() && nextToken() === 18 /* CloseParenToken */; + return nextTokenIsIdentifier() && nextToken() === 19 /* CloseParenToken */; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(200 /* VariableStatement */, fullStart); + var node = createNode(205 /* VariableStatement */, fullStart); node.decorators = decorators; - setModifiers(node, modifiers); + node.modifiers = modifiers; node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false); parseSemicolon(); return addJSDocComment(finishNode(node)); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(220 /* FunctionDeclaration */, fullStart); + var node = createNode(225 /* FunctionDeclaration */, fullStart); node.decorators = decorators; - setModifiers(node, modifiers); - parseExpected(87 /* FunctionKeyword */); - node.asteriskToken = parseOptionalToken(37 /* AsteriskToken */); - node.name = node.flags & 512 /* Default */ ? parseOptionalIdentifier() : parseIdentifier(); + node.modifiers = modifiers; + parseExpected(88 /* FunctionKeyword */); + node.asteriskToken = parseOptionalToken(38 /* AsteriskToken */); + node.name = ts.hasModifier(node, 512 /* Default */) ? parseOptionalIdentifier() : parseIdentifier(); var isGenerator = !!node.asteriskToken; - var isAsync = !!(node.flags & 256 /* Async */); - fillSignature(54 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, node); + var isAsync = ts.hasModifier(node, 256 /* Async */); + fillSignature(55 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, node); node.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, ts.Diagnostics.or_expected); return addJSDocComment(finishNode(node)); } function parseConstructorDeclaration(pos, decorators, modifiers) { - var node = createNode(148 /* Constructor */, pos); + var node = createNode(150 /* Constructor */, pos); node.decorators = decorators; - setModifiers(node, modifiers); - parseExpected(121 /* ConstructorKeyword */); - fillSignature(54 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); + node.modifiers = modifiers; + parseExpected(122 /* ConstructorKeyword */); + fillSignature(55 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); node.body = parseFunctionBlockOrSemicolon(/*isGenerator*/ false, /*isAsync*/ false, ts.Diagnostics.or_expected); return addJSDocComment(finishNode(node)); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(147 /* MethodDeclaration */, fullStart); + var method = createNode(149 /* MethodDeclaration */, fullStart); method.decorators = decorators; - setModifiers(method, modifiers); + method.modifiers = modifiers; method.asteriskToken = asteriskToken; method.name = name; method.questionToken = questionToken; var isGenerator = !!asteriskToken; - var isAsync = !!(method.flags & 256 /* Async */); - fillSignature(54 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, method); + var isAsync = ts.hasModifier(method, 256 /* Async */); + fillSignature(55 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, method); method.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage); return addJSDocComment(finishNode(method)); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { - var property = createNode(145 /* PropertyDeclaration */, fullStart); + var property = createNode(147 /* PropertyDeclaration */, fullStart); property.decorators = decorators; - setModifiers(property, modifiers); + property.modifiers = modifiers; property.name = name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); @@ -12625,19 +18357,19 @@ var ts; // AccessibilityModifier_opt static_opt PropertyName TypeAnnotation_opt Initializer_opt[In, ?Yield]; // // The checker may still error in the static case to explicitly disallow the yield expression. - property.initializer = modifiers && modifiers.flags & 32 /* Static */ + property.initializer = ts.hasModifier(property, 32 /* Static */) ? allowInAnd(parseNonParameterInitializer) - : doOutsideOfContext(8388608 /* YieldContext */ | 4194304 /* DisallowInContext */, parseNonParameterInitializer); + : doOutsideOfContext(4096 /* YieldContext */ | 2048 /* DisallowInContext */, parseNonParameterInitializer); parseSemicolon(); - return finishNode(property); + return addJSDocComment(finishNode(property)); } function parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers) { - var asteriskToken = parseOptionalToken(37 /* AsteriskToken */); + var asteriskToken = parseOptionalToken(38 /* AsteriskToken */); var name = parsePropertyName(); // Note: this is not legal as per the grammar. But we allow it in the parser and // report an error in the grammar checker. - var questionToken = parseOptionalToken(53 /* QuestionToken */); - if (asteriskToken || token() === 17 /* OpenParenToken */ || token() === 25 /* LessThanToken */) { + var questionToken = parseOptionalToken(54 /* QuestionToken */); + if (asteriskToken || token() === 18 /* OpenParenToken */ || token() === 26 /* LessThanToken */) { return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, ts.Diagnostics.or_expected); } else { @@ -12650,19 +18382,19 @@ var ts; function parseAccessorDeclaration(kind, fullStart, decorators, modifiers) { var node = createNode(kind, fullStart); node.decorators = decorators; - setModifiers(node, modifiers); + node.modifiers = modifiers; node.name = parsePropertyName(); - fillSignature(54 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); + fillSignature(55 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); node.body = parseFunctionBlockOrSemicolon(/*isGenerator*/ false, /*isAsync*/ false); - return finishNode(node); + return addJSDocComment(finishNode(node)); } function isClassMemberModifier(idToken) { switch (idToken) { - case 112 /* PublicKeyword */: - case 110 /* PrivateKeyword */: - case 111 /* ProtectedKeyword */: - case 113 /* StaticKeyword */: - case 128 /* ReadonlyKeyword */: + case 113 /* PublicKeyword */: + case 111 /* PrivateKeyword */: + case 112 /* ProtectedKeyword */: + case 114 /* StaticKeyword */: + case 130 /* ReadonlyKeyword */: return true; default: return false; @@ -12670,7 +18402,7 @@ var ts; } function isClassMemberStart() { var idToken; - if (token() === 55 /* AtToken */) { + if (token() === 56 /* AtToken */) { return true; } // Eat up all modifiers, but hold on to the last one in case it is actually an identifier. @@ -12687,7 +18419,7 @@ var ts; } nextToken(); } - if (token() === 37 /* AsteriskToken */) { + if (token() === 38 /* AsteriskToken */) { return true; } // Try to get the first property-like token following all modifiers. @@ -12697,23 +18429,23 @@ var ts; nextToken(); } // Index signatures and computed properties are class members; we can parse. - if (token() === 19 /* OpenBracketToken */) { + if (token() === 20 /* OpenBracketToken */) { return true; } // If we were able to get any potential identifier... if (idToken !== undefined) { // If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse. - if (!ts.isKeyword(idToken) || idToken === 131 /* SetKeyword */ || idToken === 123 /* GetKeyword */) { + if (!ts.isKeyword(idToken) || idToken === 133 /* SetKeyword */ || idToken === 124 /* GetKeyword */) { return true; } // If it *is* a keyword, but not an accessor, check a little farther along // to see if it should actually be parsed as a class member. switch (token()) { - case 17 /* OpenParenToken */: // Method declaration - case 25 /* LessThanToken */: // Generic Method declaration - case 54 /* ColonToken */: // Type Annotation for declaration - case 56 /* EqualsToken */: // Initializer for declaration - case 53 /* QuestionToken */: + case 18 /* OpenParenToken */: // Method declaration + case 26 /* LessThanToken */: // Generic Method declaration + case 55 /* ColonToken */: // Type Annotation for declaration + case 57 /* EqualsToken */: // Initializer for declaration + case 54 /* QuestionToken */: return true; default: // Covers @@ -12730,16 +18462,18 @@ var ts; var decorators; while (true) { var decoratorStart = getNodePos(); - if (!parseOptional(55 /* AtToken */)) { + if (!parseOptional(56 /* AtToken */)) { break; } - if (!decorators) { - decorators = []; - decorators.pos = decoratorStart; - } - var decorator = createNode(143 /* Decorator */, decoratorStart); + var decorator = createNode(145 /* Decorator */, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); - decorators.push(finishNode(decorator)); + finishNode(decorator); + if (!decorators) { + decorators = createNodeArray([decorator], decoratorStart); + } + else { + decorators.push(decorator); + } } if (decorators) { decorators.end = getNodeEnd(); @@ -12754,12 +18488,11 @@ var ts; * In such situations, 'permitInvalidConstAsModifier' should be set to true. */ function parseModifiers(permitInvalidConstAsModifier) { - var flags = 0; var modifiers; while (true) { var modifierStart = scanner.getStartPos(); var modifierKind = token(); - if (token() === 74 /* ConstKeyword */ && permitInvalidConstAsModifier) { + if (token() === 75 /* ConstKeyword */ && permitInvalidConstAsModifier) { // We need to ensure that any subsequent modifiers appear on the same line // so that when 'const' is a standalone declaration, we don't issue an error. if (!tryParse(nextTokenIsOnSameLineAndCanFollowModifier)) { @@ -12771,38 +18504,34 @@ var ts; break; } } + var modifier = finishNode(createNode(modifierKind, modifierStart)); if (!modifiers) { - modifiers = []; - modifiers.pos = modifierStart; + modifiers = createNodeArray([modifier], modifierStart); + } + else { + modifiers.push(modifier); } - flags |= ts.modifierToFlag(modifierKind); - modifiers.push(finishNode(createNode(modifierKind, modifierStart))); } if (modifiers) { - modifiers.flags = flags; modifiers.end = scanner.getStartPos(); } return modifiers; } function parseModifiersForArrowFunction() { - var flags = 0; var modifiers; - if (token() === 118 /* AsyncKeyword */) { + if (token() === 119 /* AsyncKeyword */) { var modifierStart = scanner.getStartPos(); var modifierKind = token(); nextToken(); - modifiers = []; - modifiers.pos = modifierStart; - flags |= ts.modifierToFlag(modifierKind); - modifiers.push(finishNode(createNode(modifierKind, modifierStart))); - modifiers.flags = flags; + var modifier = finishNode(createNode(modifierKind, modifierStart)); + modifiers = createNodeArray([modifier], modifierStart); modifiers.end = scanner.getStartPos(); } return modifiers; } function parseClassElement() { - if (token() === 23 /* SemicolonToken */) { - var result = createNode(198 /* SemicolonClassElement */); + if (token() === 24 /* SemicolonToken */) { + var result = createNode(203 /* SemicolonClassElement */); nextToken(); return finishNode(result); } @@ -12813,7 +18542,7 @@ var ts; if (accessor) { return accessor; } - if (token() === 121 /* ConstructorKeyword */) { + if (token() === 122 /* ConstructorKeyword */) { return parseConstructorDeclaration(fullStart, decorators, modifiers); } if (isIndexSignature()) { @@ -12824,45 +18553,45 @@ var ts; if (ts.tokenIsIdentifierOrKeyword(token()) || token() === 9 /* StringLiteral */ || token() === 8 /* NumericLiteral */ || - token() === 37 /* AsteriskToken */ || - token() === 19 /* OpenBracketToken */) { + token() === 38 /* AsteriskToken */ || + token() === 20 /* OpenBracketToken */) { return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers); } if (decorators || modifiers) { // treat this as a property declaration with a missing name. - var name_7 = createMissingNode(69 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); - return parsePropertyDeclaration(fullStart, decorators, modifiers, name_7, /*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."); } function parseClassExpression() { return parseClassDeclarationOrExpression( - /*fullStart*/ scanner.getStartPos(), - /*decorators*/ undefined, - /*modifiers*/ undefined, 192 /* ClassExpression */); + /*fullStart*/ scanner.getStartPos(), + /*decorators*/ undefined, + /*modifiers*/ undefined, 197 /* ClassExpression */); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 221 /* ClassDeclaration */); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 226 /* ClassDeclaration */); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); node.decorators = decorators; - setModifiers(node, modifiers); - parseExpected(73 /* ClassKeyword */); + node.modifiers = modifiers; + parseExpected(74 /* ClassKeyword */); node.name = parseNameOfClassDeclarationOrExpression(); node.typeParameters = parseTypeParameters(); - node.heritageClauses = parseHeritageClauses(/*isClassHeritageClause*/ true); - if (parseExpected(15 /* OpenBraceToken */)) { + node.heritageClauses = parseHeritageClauses(); + if (parseExpected(16 /* OpenBraceToken */)) { // ClassTail[Yield,Await] : (Modified) See 14.5 // ClassHeritage[?Yield,?Await]opt { ClassBody[?Yield,?Await]opt } node.members = parseClassMembers(); - parseExpected(16 /* CloseBraceToken */); + parseExpected(17 /* CloseBraceToken */); } else { node.members = createMissingList(); } - return finishNode(node); + return addJSDocComment(finishNode(node)); } function parseNameOfClassDeclarationOrExpression() { // implements is a future reserved word so @@ -12875,19 +18604,19 @@ var ts; : undefined; } function isImplementsClause() { - return token() === 106 /* ImplementsKeyword */ && lookAhead(nextTokenIsIdentifierOrKeyword); + return token() === 107 /* ImplementsKeyword */ && lookAhead(nextTokenIsIdentifierOrKeyword); } - function parseHeritageClauses(isClassHeritageClause) { + function parseHeritageClauses() { // ClassTail[Yield,Await] : (Modified) See 14.5 // ClassHeritage[?Yield,?Await]opt { ClassBody[?Yield,?Await]opt } if (isHeritageClause()) { - return parseList(20 /* HeritageClauses */, parseHeritageClause); + return parseList(21 /* HeritageClauses */, parseHeritageClause); } return undefined; } function parseHeritageClause() { - if (token() === 83 /* ExtendsKeyword */ || token() === 106 /* ImplementsKeyword */) { - var node = createNode(251 /* HeritageClause */); + if (token() === 84 /* ExtendsKeyword */ || token() === 107 /* ImplementsKeyword */) { + var node = createNode(255 /* HeritageClause */); node.token = token(); nextToken(); node.types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments); @@ -12896,72 +18625,72 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(194 /* ExpressionWithTypeArguments */); + var node = createNode(199 /* ExpressionWithTypeArguments */); node.expression = parseLeftHandSideExpressionOrHigher(); - if (token() === 25 /* LessThanToken */) { - node.typeArguments = parseBracketedList(18 /* TypeArguments */, parseType, 25 /* LessThanToken */, 27 /* GreaterThanToken */); + if (token() === 26 /* LessThanToken */) { + node.typeArguments = parseBracketedList(19 /* TypeArguments */, parseType, 26 /* LessThanToken */, 28 /* GreaterThanToken */); } return finishNode(node); } function isHeritageClause() { - return token() === 83 /* ExtendsKeyword */ || token() === 106 /* ImplementsKeyword */; + return token() === 84 /* ExtendsKeyword */ || token() === 107 /* ImplementsKeyword */; } function parseClassMembers() { return parseList(5 /* ClassMembers */, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(222 /* InterfaceDeclaration */, fullStart); + var node = createNode(227 /* InterfaceDeclaration */, fullStart); node.decorators = decorators; - setModifiers(node, modifiers); - parseExpected(107 /* InterfaceKeyword */); + node.modifiers = modifiers; + parseExpected(108 /* InterfaceKeyword */); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); - node.heritageClauses = parseHeritageClauses(/*isClassHeritageClause*/ false); + node.heritageClauses = parseHeritageClauses(); node.members = parseObjectTypeMembers(); - return finishNode(node); + return addJSDocComment(finishNode(node)); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(223 /* TypeAliasDeclaration */, fullStart); + var node = createNode(228 /* TypeAliasDeclaration */, fullStart); node.decorators = decorators; - setModifiers(node, modifiers); - parseExpected(134 /* TypeKeyword */); + node.modifiers = modifiers; + parseExpected(136 /* TypeKeyword */); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); - parseExpected(56 /* EqualsToken */); + parseExpected(57 /* EqualsToken */); node.type = parseType(); parseSemicolon(); - return finishNode(node); + return addJSDocComment(finishNode(node)); } // In an ambient declaration, the grammar only allows integer literals as initializers. // In a non-ambient declaration, the grammar allows uninitialized members only in a // ConstantEnumMemberSection, which starts at the beginning of an enum declaration // or any time an integer literal initializer is encountered. function parseEnumMember() { - var node = createNode(255 /* EnumMember */, scanner.getStartPos()); + var node = createNode(260 /* EnumMember */, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); - return finishNode(node); + return addJSDocComment(finishNode(node)); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(224 /* EnumDeclaration */, fullStart); + var node = createNode(229 /* EnumDeclaration */, fullStart); node.decorators = decorators; - setModifiers(node, modifiers); - parseExpected(81 /* EnumKeyword */); + node.modifiers = modifiers; + parseExpected(82 /* EnumKeyword */); node.name = parseIdentifier(); - if (parseExpected(15 /* OpenBraceToken */)) { + if (parseExpected(16 /* OpenBraceToken */)) { node.members = parseDelimitedList(6 /* EnumMembers */, parseEnumMember); - parseExpected(16 /* CloseBraceToken */); + parseExpected(17 /* CloseBraceToken */); } else { node.members = createMissingList(); } - return finishNode(node); + return addJSDocComment(finishNode(node)); } function parseModuleBlock() { - var node = createNode(226 /* ModuleBlock */, scanner.getStartPos()); - if (parseExpected(15 /* OpenBraceToken */)) { + var node = createNode(231 /* ModuleBlock */, scanner.getStartPos()); + if (parseExpected(16 /* OpenBraceToken */)) { node.statements = parseList(1 /* BlockStatements */, parseStatement); - parseExpected(16 /* CloseBraceToken */); + parseExpected(17 /* CloseBraceToken */); } else { node.statements = createMissingList(); @@ -12969,32 +18698,32 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(225 /* ModuleDeclaration */, fullStart); + var node = createNode(230 /* ModuleDeclaration */, fullStart); // If we are parsing a dotted namespace name, we want to // propagate the 'Namespace' flag across the names if set. - var namespaceFlag = flags & 4096 /* Namespace */; + var namespaceFlag = flags & 16 /* Namespace */; node.decorators = decorators; - setModifiers(node, modifiers); + node.modifiers = modifiers; node.flags |= flags; node.name = parseIdentifier(); - node.body = parseOptional(21 /* DotToken */) - ? parseModuleOrNamespaceDeclaration(getNodePos(), /*decorators*/ undefined, /*modifiers*/ undefined, 1 /* Export */ | namespaceFlag) + node.body = parseOptional(22 /* DotToken */) + ? parseModuleOrNamespaceDeclaration(getNodePos(), /*decorators*/ undefined, /*modifiers*/ undefined, 4 /* NestedNamespace */ | namespaceFlag) : parseModuleBlock(); - return finishNode(node); + return addJSDocComment(finishNode(node)); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(225 /* ModuleDeclaration */, fullStart); + var node = createNode(230 /* ModuleDeclaration */, fullStart); node.decorators = decorators; - setModifiers(node, modifiers); - if (token() === 137 /* GlobalKeyword */) { + node.modifiers = modifiers; + if (token() === 139 /* GlobalKeyword */) { // parse 'global' as name of global scope augmentation node.name = parseIdentifier(); - node.flags |= 131072 /* GlobalAugmentation */; + node.flags |= 512 /* GlobalAugmentation */; } else { node.name = parseLiteralNode(/*internName*/ true); } - if (token() === 15 /* OpenBraceToken */) { + if (token() === 16 /* OpenBraceToken */) { node.body = parseModuleBlock(); } else { @@ -13003,16 +18732,16 @@ var ts; return finishNode(node); } function parseModuleDeclaration(fullStart, decorators, modifiers) { - var flags = modifiers ? modifiers.flags : 0; - if (token() === 137 /* GlobalKeyword */) { + var flags = 0; + if (token() === 139 /* GlobalKeyword */) { // global augmentation return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); } - else if (parseOptional(126 /* NamespaceKeyword */)) { - flags |= 4096 /* Namespace */; + else if (parseOptional(128 /* NamespaceKeyword */)) { + flags |= 16 /* Namespace */; } else { - parseExpected(125 /* ModuleKeyword */); + parseExpected(127 /* ModuleKeyword */); if (token() === 9 /* StringLiteral */) { return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); } @@ -13020,57 +18749,57 @@ var ts; return parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags); } function isExternalModuleReference() { - return token() === 129 /* RequireKeyword */ && + return token() === 131 /* RequireKeyword */ && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { - return nextToken() === 17 /* OpenParenToken */; + return nextToken() === 18 /* OpenParenToken */; } function nextTokenIsSlash() { - return nextToken() === 39 /* SlashToken */; + return nextToken() === 40 /* SlashToken */; } function parseNamespaceExportDeclaration(fullStart, decorators, modifiers) { - var exportDeclaration = createNode(228 /* NamespaceExportDeclaration */, fullStart); + var exportDeclaration = createNode(233 /* NamespaceExportDeclaration */, fullStart); exportDeclaration.decorators = decorators; exportDeclaration.modifiers = modifiers; - parseExpected(116 /* AsKeyword */); - parseExpected(126 /* NamespaceKeyword */); + parseExpected(117 /* AsKeyword */); + parseExpected(128 /* NamespaceKeyword */); exportDeclaration.name = parseIdentifier(); - parseExpected(23 /* SemicolonToken */); + parseSemicolon(); return finishNode(exportDeclaration); } function parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers) { - parseExpected(89 /* ImportKeyword */); + parseExpected(90 /* ImportKeyword */); var afterImportPos = scanner.getStartPos(); var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token() !== 24 /* CommaToken */ && token() !== 136 /* FromKeyword */) { + if (token() !== 25 /* CommaToken */ && token() !== 138 /* FromKeyword */) { // ImportEquals declaration of type: // import x = require("mod"); or // import x = M.x; - var importEqualsDeclaration = createNode(229 /* ImportEqualsDeclaration */, fullStart); + var importEqualsDeclaration = createNode(234 /* ImportEqualsDeclaration */, fullStart); importEqualsDeclaration.decorators = decorators; - setModifiers(importEqualsDeclaration, modifiers); + importEqualsDeclaration.modifiers = modifiers; importEqualsDeclaration.name = identifier; - parseExpected(56 /* EqualsToken */); + parseExpected(57 /* EqualsToken */); importEqualsDeclaration.moduleReference = parseModuleReference(); parseSemicolon(); - return finishNode(importEqualsDeclaration); + return addJSDocComment(finishNode(importEqualsDeclaration)); } } // Import statement - var importDeclaration = createNode(230 /* ImportDeclaration */, fullStart); + var importDeclaration = createNode(235 /* ImportDeclaration */, fullStart); importDeclaration.decorators = decorators; - setModifiers(importDeclaration, modifiers); + importDeclaration.modifiers = modifiers; // ImportDeclaration: // import ImportClause from ModuleSpecifier ; // import ModuleSpecifier; if (identifier || - token() === 37 /* AsteriskToken */ || - token() === 15 /* OpenBraceToken */) { + token() === 38 /* AsteriskToken */ || + token() === 16 /* OpenBraceToken */) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(136 /* FromKeyword */); + parseExpected(138 /* FromKeyword */); } importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); @@ -13083,7 +18812,7 @@ var ts; // NamedImports // ImportedDefaultBinding, NameSpaceImport // ImportedDefaultBinding, NamedImports - var importClause = createNode(231 /* ImportClause */, fullStart); + var importClause = createNode(236 /* ImportClause */, fullStart); if (identifier) { // ImportedDefaultBinding: // ImportedBinding @@ -13092,8 +18821,8 @@ var ts; // If there was no default import or if there is comma token after default import // parse namespace or named imports if (!importClause.name || - parseOptional(24 /* CommaToken */)) { - importClause.namedBindings = token() === 37 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(233 /* NamedImports */); + parseOptional(25 /* CommaToken */)) { + importClause.namedBindings = token() === 38 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(238 /* NamedImports */); } return finishNode(importClause); } @@ -13103,11 +18832,11 @@ var ts; : parseEntityName(/*allowReservedWords*/ false); } function parseExternalModuleReference() { - var node = createNode(240 /* ExternalModuleReference */); - parseExpected(129 /* RequireKeyword */); - parseExpected(17 /* OpenParenToken */); + var node = createNode(245 /* ExternalModuleReference */); + parseExpected(131 /* RequireKeyword */); + parseExpected(18 /* OpenParenToken */); node.expression = parseModuleSpecifier(); - parseExpected(18 /* CloseParenToken */); + parseExpected(19 /* CloseParenToken */); return finishNode(node); } function parseModuleSpecifier() { @@ -13126,9 +18855,9 @@ var ts; function parseNamespaceImport() { // NameSpaceImport: // * as ImportedBinding - var namespaceImport = createNode(232 /* NamespaceImport */); - parseExpected(37 /* AsteriskToken */); - parseExpected(116 /* AsKeyword */); + var namespaceImport = createNode(237 /* NamespaceImport */); + parseExpected(38 /* AsteriskToken */); + parseExpected(117 /* AsKeyword */); namespaceImport.name = parseIdentifier(); return finishNode(namespaceImport); } @@ -13141,14 +18870,14 @@ var ts; // ImportsList: // ImportSpecifier // ImportsList, ImportSpecifier - node.elements = parseBracketedList(21 /* ImportOrExportSpecifiers */, kind === 233 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 15 /* OpenBraceToken */, 16 /* CloseBraceToken */); + node.elements = parseBracketedList(22 /* ImportOrExportSpecifiers */, kind === 238 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 16 /* OpenBraceToken */, 17 /* CloseBraceToken */); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(238 /* ExportSpecifier */); + return parseImportOrExportSpecifier(243 /* ExportSpecifier */); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(234 /* ImportSpecifier */); + return parseImportOrExportSpecifier(239 /* ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -13162,9 +18891,9 @@ var ts; var checkIdentifierStart = scanner.getTokenPos(); var checkIdentifierEnd = scanner.getTextPos(); var identifierName = parseIdentifierName(); - if (token() === 116 /* AsKeyword */) { + if (token() === 117 /* AsKeyword */) { node.propertyName = identifierName; - parseExpected(116 /* AsKeyword */); + parseExpected(117 /* AsKeyword */); checkIdentifierIsKeyword = ts.isKeyword(token()) && !isIdentifier(); checkIdentifierStart = scanner.getTokenPos(); checkIdentifierEnd = scanner.getTextPos(); @@ -13173,27 +18902,27 @@ var ts; else { node.name = identifierName; } - if (kind === 234 /* ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 239 /* ImportSpecifier */ && checkIdentifierIsKeyword) { // Report error identifier expected parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(236 /* ExportDeclaration */, fullStart); + var node = createNode(241 /* ExportDeclaration */, fullStart); node.decorators = decorators; - setModifiers(node, modifiers); - if (parseOptional(37 /* AsteriskToken */)) { - parseExpected(136 /* FromKeyword */); + node.modifiers = modifiers; + if (parseOptional(38 /* AsteriskToken */)) { + parseExpected(138 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(237 /* NamedExports */); + node.exportClause = parseNamedImportsOrExports(242 /* NamedExports */); // It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios, // the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`) // If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect. - if (token() === 136 /* FromKeyword */ || (token() === 9 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) { - parseExpected(136 /* FromKeyword */); + if (token() === 138 /* FromKeyword */ || (token() === 9 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) { + parseExpected(138 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } } @@ -13201,14 +18930,14 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(235 /* ExportAssignment */, fullStart); + var node = createNode(240 /* ExportAssignment */, fullStart); node.decorators = decorators; - setModifiers(node, modifiers); - if (parseOptional(56 /* EqualsToken */)) { + node.modifiers = modifiers; + if (parseOptional(57 /* EqualsToken */)) { node.isExportEquals = true; } else { - parseExpected(77 /* DefaultKeyword */); + parseExpected(78 /* DefaultKeyword */); } node.expression = parseAssignmentExpressionOrHigher(); parseSemicolon(); @@ -13282,11 +19011,11 @@ var ts; } function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { - return node.flags & 1 /* Export */ - || node.kind === 229 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 240 /* ExternalModuleReference */ - || node.kind === 230 /* ImportDeclaration */ - || node.kind === 235 /* ExportAssignment */ - || node.kind === 236 /* ExportDeclaration */ + return ts.hasModifier(node, 1 /* Export */) + || node.kind === 234 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 245 /* ExternalModuleReference */ + || node.kind === 235 /* ImportDeclaration */ + || node.kind === 240 /* ExportAssignment */ + || node.kind === 241 /* ExportDeclaration */ ? node : undefined; }); @@ -13310,16 +19039,17 @@ var ts; ParsingContext[ParsingContext["JsxChildren"] = 14] = "JsxChildren"; ParsingContext[ParsingContext["ArrayLiteralMembers"] = 15] = "ArrayLiteralMembers"; ParsingContext[ParsingContext["Parameters"] = 16] = "Parameters"; - ParsingContext[ParsingContext["TypeParameters"] = 17] = "TypeParameters"; - ParsingContext[ParsingContext["TypeArguments"] = 18] = "TypeArguments"; - ParsingContext[ParsingContext["TupleElementTypes"] = 19] = "TupleElementTypes"; - ParsingContext[ParsingContext["HeritageClauses"] = 20] = "HeritageClauses"; - ParsingContext[ParsingContext["ImportOrExportSpecifiers"] = 21] = "ImportOrExportSpecifiers"; - ParsingContext[ParsingContext["JSDocFunctionParameters"] = 22] = "JSDocFunctionParameters"; - ParsingContext[ParsingContext["JSDocTypeArguments"] = 23] = "JSDocTypeArguments"; - ParsingContext[ParsingContext["JSDocRecordMembers"] = 24] = "JSDocRecordMembers"; - ParsingContext[ParsingContext["JSDocTupleTypes"] = 25] = "JSDocTupleTypes"; - ParsingContext[ParsingContext["Count"] = 26] = "Count"; // Number of parsing contexts + ParsingContext[ParsingContext["RestProperties"] = 17] = "RestProperties"; + ParsingContext[ParsingContext["TypeParameters"] = 18] = "TypeParameters"; + ParsingContext[ParsingContext["TypeArguments"] = 19] = "TypeArguments"; + ParsingContext[ParsingContext["TupleElementTypes"] = 20] = "TupleElementTypes"; + ParsingContext[ParsingContext["HeritageClauses"] = 21] = "HeritageClauses"; + ParsingContext[ParsingContext["ImportOrExportSpecifiers"] = 22] = "ImportOrExportSpecifiers"; + ParsingContext[ParsingContext["JSDocFunctionParameters"] = 23] = "JSDocFunctionParameters"; + ParsingContext[ParsingContext["JSDocTypeArguments"] = 24] = "JSDocTypeArguments"; + ParsingContext[ParsingContext["JSDocRecordMembers"] = 25] = "JSDocRecordMembers"; + ParsingContext[ParsingContext["JSDocTupleTypes"] = 26] = "JSDocTupleTypes"; + ParsingContext[ParsingContext["Count"] = 27] = "Count"; // Number of parsing contexts })(ParsingContext || (ParsingContext = {})); var Tristate; (function (Tristate) { @@ -13331,23 +19061,24 @@ var ts; (function (JSDocParser) { function isJSDocType() { switch (token()) { - case 37 /* AsteriskToken */: - case 53 /* QuestionToken */: - case 17 /* OpenParenToken */: - case 19 /* OpenBracketToken */: - case 49 /* ExclamationToken */: - case 15 /* OpenBraceToken */: - case 87 /* FunctionKeyword */: - case 22 /* DotDotDotToken */: - case 92 /* NewKeyword */: - case 97 /* ThisKeyword */: + case 38 /* AsteriskToken */: + case 54 /* QuestionToken */: + case 18 /* OpenParenToken */: + case 20 /* OpenBracketToken */: + case 50 /* ExclamationToken */: + case 16 /* OpenBraceToken */: + case 88 /* FunctionKeyword */: + case 23 /* DotDotDotToken */: + case 93 /* NewKeyword */: + case 98 /* ThisKeyword */: return true; } return ts.tokenIsIdentifierOrKeyword(token()); } JSDocParser.isJSDocType = isJSDocType; function parseJSDocTypeExpressionForTests(content, start, length) { - initializeState("file.js", content, 2 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */); + initializeState(content, 5 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */); + sourceFile = createSourceFile("file.js", 5 /* Latest */, 1 /* JS */); scanner.setText(content, start, length); currentToken = scanner.scan(); var jsDocTypeExpression = parseJSDocTypeExpression(); @@ -13359,23 +19090,23 @@ var ts; // Parses out a JSDoc type expression. /* @internal */ function parseJSDocTypeExpression() { - var result = createNode(257 /* JSDocTypeExpression */, scanner.getTokenPos()); - parseExpected(15 /* OpenBraceToken */); + var result = createNode(262 /* JSDocTypeExpression */, scanner.getTokenPos()); + parseExpected(16 /* OpenBraceToken */); result.type = parseJSDocTopLevelType(); - parseExpected(16 /* CloseBraceToken */); + parseExpected(17 /* CloseBraceToken */); fixupParentReferences(result); return finishNode(result); } JSDocParser.parseJSDocTypeExpression = parseJSDocTypeExpression; function parseJSDocTopLevelType() { var type = parseJSDocType(); - if (token() === 47 /* BarToken */) { - var unionType = createNode(261 /* JSDocUnionType */, type.pos); + if (token() === 48 /* BarToken */) { + var unionType = createNode(266 /* JSDocUnionType */, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } - if (token() === 56 /* EqualsToken */) { - var optionalType = createNode(268 /* JSDocOptionalType */, type.pos); + if (token() === 57 /* EqualsToken */) { + var optionalType = createNode(273 /* JSDocOptionalType */, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -13385,21 +19116,21 @@ var ts; function parseJSDocType() { var type = parseBasicTypeExpression(); while (true) { - if (token() === 19 /* OpenBracketToken */) { - var arrayType = createNode(260 /* JSDocArrayType */, type.pos); + if (token() === 20 /* OpenBracketToken */) { + var arrayType = createNode(265 /* JSDocArrayType */, type.pos); arrayType.elementType = type; nextToken(); - parseExpected(20 /* CloseBracketToken */); + parseExpected(21 /* CloseBracketToken */); type = finishNode(arrayType); } - else if (token() === 53 /* QuestionToken */) { - var nullableType = createNode(263 /* JSDocNullableType */, type.pos); + else if (token() === 54 /* QuestionToken */) { + var nullableType = createNode(268 /* JSDocNullableType */, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } - else if (token() === 49 /* ExclamationToken */) { - var nonNullableType = createNode(264 /* JSDocNonNullableType */, type.pos); + else if (token() === 50 /* ExclamationToken */) { + var nonNullableType = createNode(269 /* JSDocNonNullableType */, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -13412,94 +19143,95 @@ var ts; } function parseBasicTypeExpression() { switch (token()) { - case 37 /* AsteriskToken */: + case 38 /* AsteriskToken */: return parseJSDocAllType(); - case 53 /* QuestionToken */: + case 54 /* QuestionToken */: return parseJSDocUnknownOrNullableType(); - case 17 /* OpenParenToken */: + case 18 /* OpenParenToken */: return parseJSDocUnionType(); - case 19 /* OpenBracketToken */: + case 20 /* OpenBracketToken */: return parseJSDocTupleType(); - case 49 /* ExclamationToken */: + case 50 /* ExclamationToken */: return parseJSDocNonNullableType(); - case 15 /* OpenBraceToken */: + case 16 /* OpenBraceToken */: return parseJSDocRecordType(); - case 87 /* FunctionKeyword */: + case 88 /* FunctionKeyword */: return parseJSDocFunctionType(); - case 22 /* DotDotDotToken */: + case 23 /* DotDotDotToken */: return parseJSDocVariadicType(); - case 92 /* NewKeyword */: + case 93 /* NewKeyword */: return parseJSDocConstructorType(); - case 97 /* ThisKeyword */: + case 98 /* ThisKeyword */: return parseJSDocThisType(); - case 117 /* AnyKeyword */: - case 132 /* StringKeyword */: - case 130 /* NumberKeyword */: - case 120 /* BooleanKeyword */: - case 133 /* SymbolKeyword */: - case 103 /* VoidKeyword */: - case 93 /* NullKeyword */: - case 135 /* UndefinedKeyword */: - case 127 /* NeverKeyword */: + case 118 /* AnyKeyword */: + case 134 /* StringKeyword */: + case 132 /* NumberKeyword */: + case 121 /* BooleanKeyword */: + case 135 /* SymbolKeyword */: + case 104 /* VoidKeyword */: + case 94 /* NullKeyword */: + case 137 /* UndefinedKeyword */: + case 129 /* NeverKeyword */: return parseTokenNode(); case 9 /* StringLiteral */: case 8 /* NumericLiteral */: - case 99 /* TrueKeyword */: - case 84 /* FalseKeyword */: + case 100 /* TrueKeyword */: + case 85 /* FalseKeyword */: return parseJSDocLiteralType(); } return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(272 /* JSDocThisType */); + var result = createNode(277 /* JSDocThisType */); nextToken(); - parseExpected(54 /* ColonToken */); + parseExpected(55 /* ColonToken */); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(271 /* JSDocConstructorType */); + var result = createNode(276 /* JSDocConstructorType */); nextToken(); - parseExpected(54 /* ColonToken */); + parseExpected(55 /* ColonToken */); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(270 /* JSDocVariadicType */); + var result = createNode(275 /* JSDocVariadicType */); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(269 /* JSDocFunctionType */); + var result = createNode(274 /* JSDocFunctionType */); nextToken(); - parseExpected(17 /* OpenParenToken */); - result.parameters = parseDelimitedList(22 /* JSDocFunctionParameters */, parseJSDocParameter); + parseExpected(18 /* OpenParenToken */); + result.parameters = parseDelimitedList(23 /* JSDocFunctionParameters */, parseJSDocParameter); checkForTrailingComma(result.parameters); - parseExpected(18 /* CloseParenToken */); - if (token() === 54 /* ColonToken */) { + parseExpected(19 /* CloseParenToken */); + if (token() === 55 /* ColonToken */) { nextToken(); result.type = parseJSDocType(); } return finishNode(result); } function parseJSDocParameter() { - var parameter = createNode(142 /* Parameter */); + var parameter = createNode(144 /* Parameter */); parameter.type = parseJSDocType(); - if (parseOptional(56 /* EqualsToken */)) { - parameter.questionToken = createNode(56 /* EqualsToken */); + if (parseOptional(57 /* EqualsToken */)) { + // TODO(rbuckton): Can this be changed to SyntaxKind.QuestionToken? + parameter.questionToken = createNode(57 /* EqualsToken */); } return finishNode(parameter); } function parseJSDocTypeReference() { - var result = createNode(267 /* JSDocTypeReference */); + var result = createNode(272 /* JSDocTypeReference */); result.name = parseSimplePropertyName(); - if (token() === 25 /* LessThanToken */) { + if (token() === 26 /* LessThanToken */) { result.typeArguments = parseTypeArguments(); } else { - while (parseOptional(21 /* DotToken */)) { - if (token() === 25 /* LessThanToken */) { + while (parseOptional(22 /* DotToken */)) { + if (token() === 26 /* LessThanToken */) { result.typeArguments = parseTypeArguments(); break; } @@ -13513,10 +19245,10 @@ var ts; function parseTypeArguments() { // Move past the < nextToken(); - var typeArguments = parseDelimitedList(23 /* JSDocTypeArguments */, parseJSDocType); + var typeArguments = parseDelimitedList(24 /* JSDocTypeArguments */, parseJSDocType); checkForTrailingComma(typeArguments); checkForEmptyTypeArgumentList(typeArguments); - parseExpected(27 /* GreaterThanToken */); + parseExpected(28 /* GreaterThanToken */); return typeArguments; } function checkForEmptyTypeArgumentList(typeArguments) { @@ -13527,40 +19259,28 @@ var ts; } } function parseQualifiedName(left) { - var result = createNode(139 /* QualifiedName */, left.pos); + var result = createNode(141 /* QualifiedName */, left.pos); result.left = left; result.right = parseIdentifierName(); return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(265 /* JSDocRecordType */); - nextToken(); - result.members = parseDelimitedList(24 /* JSDocRecordMembers */, parseJSDocRecordMember); - checkForTrailingComma(result.members); - parseExpected(16 /* CloseBraceToken */); - return finishNode(result); - } - function parseJSDocRecordMember() { - var result = createNode(266 /* JSDocRecordMember */); - result.name = parseSimplePropertyName(); - if (token() === 54 /* ColonToken */) { - nextToken(); - result.type = parseJSDocType(); - } + var result = createNode(270 /* JSDocRecordType */); + result.literal = parseTypeLiteral(); return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(264 /* JSDocNonNullableType */); + var result = createNode(269 /* JSDocNonNullableType */); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(262 /* JSDocTupleType */); + var result = createNode(267 /* JSDocTupleType */); nextToken(); - result.types = parseDelimitedList(25 /* JSDocTupleTypes */, parseJSDocType); + result.types = parseDelimitedList(26 /* JSDocTupleTypes */, parseJSDocType); checkForTrailingComma(result.types); - parseExpected(20 /* CloseBracketToken */); + parseExpected(21 /* CloseBracketToken */); return finishNode(result); } function checkForTrailingComma(list) { @@ -13570,30 +19290,28 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(261 /* JSDocUnionType */); + var result = createNode(266 /* JSDocUnionType */); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); - parseExpected(18 /* CloseParenToken */); + parseExpected(19 /* CloseParenToken */); return finishNode(result); } function parseJSDocTypeList(firstType) { ts.Debug.assert(!!firstType); - var types = []; - types.pos = firstType.pos; - types.push(firstType); - while (parseOptional(47 /* BarToken */)) { + var types = createNodeArray([firstType], firstType.pos); + while (parseOptional(48 /* BarToken */)) { types.push(parseJSDocType()); } types.end = scanner.getStartPos(); return types; } function parseJSDocAllType() { - var result = createNode(258 /* JSDocAllType */); + var result = createNode(263 /* JSDocAllType */); nextToken(); return finishNode(result); } function parseJSDocLiteralType() { - var result = createNode(282 /* JSDocLiteralType */); + var result = createNode(288 /* JSDocLiteralType */); result.literal = parseLiteralTypeNode(); return finishNode(result); } @@ -13610,28 +19328,28 @@ var ts; // Foo // Foo(?= // (?| - if (token() === 24 /* CommaToken */ || - token() === 16 /* CloseBraceToken */ || - token() === 18 /* CloseParenToken */ || - token() === 27 /* GreaterThanToken */ || - token() === 56 /* EqualsToken */ || - token() === 47 /* BarToken */) { - var result = createNode(259 /* JSDocUnknownType */, pos); + if (token() === 25 /* CommaToken */ || + token() === 17 /* CloseBraceToken */ || + token() === 19 /* CloseParenToken */ || + token() === 28 /* GreaterThanToken */ || + token() === 57 /* EqualsToken */ || + token() === 48 /* BarToken */) { + var result = createNode(264 /* JSDocUnknownType */, pos); return finishNode(result); } else { - var result = createNode(263 /* JSDocNullableType */, pos); + var result = createNode(268 /* JSDocNullableType */, pos); result.type = parseJSDocType(); return finishNode(result); } } function parseIsolatedJSDocComment(content, start, length) { - initializeState("file.js", content, 2 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */); + initializeState(content, 5 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */); sourceFile = { languageVariant: 0 /* Standard */, text: content }; - var jsDocComment = parseJSDocCommentWorker(start, length); + var jsDoc = parseJSDocCommentWorker(start, length); var diagnostics = parseDiagnostics; clearState(); - return jsDocComment ? { jsDocComment: jsDocComment, diagnostics: diagnostics } : undefined; + return jsDoc ? { jsDoc: jsDoc, diagnostics: diagnostics } : undefined; } JSDocParser.parseIsolatedJSDocComment = parseIsolatedJSDocComment; function parseJSDocComment(parent, start, length) { @@ -13648,6 +19366,12 @@ var ts; return comment; } JSDocParser.parseJSDocComment = parseJSDocComment; + var JSDocState; + (function (JSDocState) { + JSDocState[JSDocState["BeginningOfLine"] = 0] = "BeginningOfLine"; + JSDocState[JSDocState["SawAsterisk"] = 1] = "SawAsterisk"; + JSDocState[JSDocState["SavingComments"] = 2] = "SavingComments"; + })(JSDocState || (JSDocState = {})); function parseJSDocCommentWorker(start, length) { var content = sourceText; start = start || 0; @@ -13657,62 +19381,131 @@ var ts; ts.Debug.assert(start <= end); ts.Debug.assert(end <= content.length); var tags; + var comments = []; var result; // Check for /** (JSDoc opening part) - if (content.charCodeAt(start) === 47 /* slash */ && - content.charCodeAt(start + 1) === 42 /* asterisk */ && - content.charCodeAt(start + 2) === 42 /* asterisk */ && - content.charCodeAt(start + 3) !== 42 /* asterisk */) { - // + 3 for leading /**, - 5 in total for /** */ - scanner.scanRange(start + 3, length - 5, function () { - // Initially we can parse out a tag. We also have seen a starting asterisk. - // This is so that /** * @type */ doesn't parse. - var canParseTag = true; - var seenAsterisk = true; + if (!isJsDocStart(content, start)) { + return result; + } + // + 3 for leading /**, - 5 in total for /** */ + scanner.scanRange(start + 3, length - 5, function () { + // Initially we can parse out a tag. We also have seen a starting asterisk. + // This is so that /** * @type */ doesn't parse. + var advanceToken = true; + var state = 1 /* SawAsterisk */; + var margin = undefined; + // + 4 for leading '/** ' + var indent = start - Math.max(content.lastIndexOf("\n", start), 0) + 4; + function pushComment(text) { + if (!margin) { + margin = indent; + } + comments.push(text); + indent += text.length; + } + nextJSDocToken(); + while (token() === 5 /* WhitespaceTrivia */) { nextJSDocToken(); - while (token() !== 1 /* EndOfFileToken */) { - switch (token()) { - case 55 /* AtToken */: - if (canParseTag) { - parseTag(); - } - // This will take us to the end of the line, so it's OK to parse a tag on the next pass through the loop - seenAsterisk = false; - break; - case 4 /* NewLineTrivia */: - // After a line break, we can parse a tag, and we haven't seen an asterisk on the next line yet - canParseTag = true; - seenAsterisk = false; - break; - case 37 /* AsteriskToken */: - if (seenAsterisk) { - // If we've already seen an asterisk, then we can no longer parse a tag on this line - canParseTag = false; - } + } + if (token() === 4 /* NewLineTrivia */) { + state = 0 /* BeginningOfLine */; + indent = 0; + nextJSDocToken(); + } + while (token() !== 1 /* EndOfFileToken */) { + switch (token()) { + case 56 /* AtToken */: + if (state === 0 /* BeginningOfLine */ || state === 1 /* SawAsterisk */) { + removeTrailingNewlines(comments); + parseTag(indent); + // NOTE: According to usejsdoc.org, a tag goes to end of line, except the last tag. + // Real-world comments may break this rule, so "BeginningOfLine" will not be a real line beginning + // for malformed examples like `/** @param {string} x @returns {number} the length */` + state = 0 /* BeginningOfLine */; + advanceToken = false; + margin = undefined; + indent++; + } + else { + pushComment(scanner.getTokenText()); + } + break; + case 4 /* NewLineTrivia */: + comments.push(scanner.getTokenText()); + state = 0 /* BeginningOfLine */; + indent = 0; + break; + case 38 /* AsteriskToken */: + var asterisk = scanner.getTokenText(); + if (state === 1 /* SawAsterisk */ || state === 2 /* SavingComments */) { + // If we've already seen an asterisk, then we can no longer parse a tag on this line + state = 2 /* SavingComments */; + pushComment(asterisk); + } + else { // Ignore the first asterisk on a line - seenAsterisk = true; - break; - case 69 /* Identifier */: - // Anything else is doc comment text. We can't do anything with it. Because it - // wasn't a tag, we can no longer parse a tag on this line until we hit the next - // line break. - canParseTag = false; - break; - case 1 /* EndOfFileToken */: - break; - } + state = 1 /* SawAsterisk */; + indent += asterisk.length; + } + break; + case 70 /* Identifier */: + // Anything else is doc comment text. We just save it. Because it + // wasn't a tag, we can no longer parse a tag on this line until we hit the next + // line break. + pushComment(scanner.getTokenText()); + state = 2 /* SavingComments */; + break; + case 5 /* WhitespaceTrivia */: + // only collect whitespace if we're already saving comments or have just crossed the comment indent margin + var whitespace = scanner.getTokenText(); + if (state === 2 /* SavingComments */) { + comments.push(whitespace); + } + else if (margin !== undefined && indent + whitespace.length > margin) { + comments.push(whitespace.slice(margin - indent - 1)); + } + indent += whitespace.length; + break; + case 1 /* EndOfFileToken */: + break; + default: + // anything other than whitespace or asterisk at the beginning of the line starts the comment text + state = 2 /* SavingComments */; + pushComment(scanner.getTokenText()); + break; + } + if (advanceToken) { nextJSDocToken(); } - result = createJSDocComment(); - }); - } - return result; - function createJSDocComment() { - if (!tags) { - return undefined; + else { + advanceToken = true; + } } - var result = createNode(273 /* JSDocComment */, start); + removeLeadingNewlines(comments); + removeTrailingNewlines(comments); + result = createJSDocComment(); + }); + return result; + function removeLeadingNewlines(comments) { + while (comments.length && (comments[0] === "\n" || comments[0] === "\r")) { + comments.shift(); + } + } + function removeTrailingNewlines(comments) { + while (comments.length && (comments[comments.length - 1] === "\n" || comments[comments.length - 1] === "\r")) { + comments.pop(); + } + } + function isJsDocStart(content, start) { + return content.charCodeAt(start) === 47 /* slash */ && + content.charCodeAt(start + 1) === 42 /* asterisk */ && + content.charCodeAt(start + 2) === 42 /* asterisk */ && + content.charCodeAt(start + 3) !== 42 /* asterisk */; + } + function createJSDocComment() { + var result = createNode(278 /* JSDocComment */, start); result.tags = tags; + result.comment = comments.length ? comments.join("") : undefined; return finishNode(result, end); } function skipWhitespace() { @@ -13720,73 +19513,151 @@ var ts; nextJSDocToken(); } } - function parseTag() { - ts.Debug.assert(token() === 55 /* AtToken */); - var atToken = createNode(55 /* AtToken */, scanner.getTokenPos()); + function parseTag(indent) { + ts.Debug.assert(token() === 56 /* AtToken */); + var atToken = createNode(56 /* AtToken */, scanner.getTokenPos()); atToken.end = scanner.getTextPos(); nextJSDocToken(); var tagName = parseJSDocIdentifierName(); + skipWhitespace(); if (!tagName) { return; } - var tag = handleTag(atToken, tagName) || handleUnknownTag(atToken, tagName); - addTag(tag); - } - function handleTag(atToken, tagName) { + var tag; if (tagName) { switch (tagName.text) { + case "augments": + tag = parseAugmentsTag(atToken, tagName); + break; case "param": - return handleParamTag(atToken, tagName); + tag = parseParamTag(atToken, tagName); + break; case "return": case "returns": - return handleReturnTag(atToken, tagName); + tag = parseReturnTag(atToken, tagName); + break; case "template": - return handleTemplateTag(atToken, tagName); + tag = parseTemplateTag(atToken, tagName); + break; case "type": - return handleTypeTag(atToken, tagName); + tag = parseTypeTag(atToken, tagName); + break; case "typedef": - return handleTypedefTag(atToken, tagName); + tag = parseTypedefTag(atToken, tagName); + break; + default: + tag = parseUnknownTag(atToken, tagName); + break; } } - return undefined; + else { + tag = parseUnknownTag(atToken, tagName); + } + if (!tag) { + // a badly malformed tag should not be added to the list of tags + return; + } + addTag(tag, parseTagComments(indent + tag.end - tag.pos)); } - function handleUnknownTag(atToken, tagName) { - var result = createNode(274 /* JSDocTag */, atToken.pos); + function parseTagComments(indent) { + var comments = []; + var state = 0 /* BeginningOfLine */; + var margin; + function pushComment(text) { + if (!margin) { + margin = indent; + } + comments.push(text); + indent += text.length; + } + while (token() !== 56 /* AtToken */ && token() !== 1 /* EndOfFileToken */) { + switch (token()) { + case 4 /* NewLineTrivia */: + if (state >= 1 /* SawAsterisk */) { + state = 0 /* BeginningOfLine */; + comments.push(scanner.getTokenText()); + } + indent = 0; + break; + case 56 /* AtToken */: + // Done + break; + case 5 /* WhitespaceTrivia */: + if (state === 2 /* SavingComments */) { + pushComment(scanner.getTokenText()); + } + else { + var whitespace = scanner.getTokenText(); + // if the whitespace crosses the margin, take only the whitespace that passes the margin + if (margin !== undefined && indent + whitespace.length > margin) { + comments.push(whitespace.slice(margin - indent - 1)); + } + indent += whitespace.length; + } + break; + case 38 /* AsteriskToken */: + if (state === 0 /* BeginningOfLine */) { + // leading asterisks start recording on the *next* (non-whitespace) token + state = 1 /* SawAsterisk */; + indent += scanner.getTokenText().length; + break; + } + // FALLTHROUGH otherwise to record the * as a comment + default: + state = 2 /* SavingComments */; // leading identifiers start recording as well + pushComment(scanner.getTokenText()); + break; + } + if (token() === 56 /* AtToken */) { + // Done + break; + } + nextJSDocToken(); + } + removeLeadingNewlines(comments); + removeTrailingNewlines(comments); + return comments; + } + function parseUnknownTag(atToken, tagName) { + var result = createNode(279 /* JSDocTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); } - function addTag(tag) { - if (tag) { - if (!tags) { - tags = []; - tags.pos = tag.pos; - } - tags.push(tag); - tags.end = tag.end; + function addTag(tag, comments) { + tag.comment = comments.join(""); + if (!tags) { + tags = createNodeArray([tag], tag.pos); } + else { + tags.push(tag); + } + tags.end = tag.end; } function tryParseTypeExpression() { - if (token() !== 15 /* OpenBraceToken */) { - return undefined; - } - var typeExpression = parseJSDocTypeExpression(); - return typeExpression; + return tryParse(function () { + skipWhitespace(); + if (token() !== 16 /* OpenBraceToken */) { + return undefined; + } + return parseJSDocTypeExpression(); + }); } - function handleParamTag(atToken, tagName) { + function parseParamTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); var name; var isBracketed; // Looking for something like '[foo]' or 'foo' - if (parseOptionalToken(19 /* OpenBracketToken */)) { + if (parseOptionalToken(20 /* OpenBracketToken */)) { name = parseJSDocIdentifierName(); + skipWhitespace(); isBracketed = true; // May have an optional default, e.g. '[foo = 42]' - if (parseOptionalToken(56 /* EqualsToken */)) { + if (parseOptionalToken(57 /* EqualsToken */)) { parseExpression(); } - parseExpected(20 /* CloseBracketToken */); + parseExpected(21 /* CloseBracketToken */); } else if (ts.tokenIsIdentifierOrKeyword(token())) { name = parseJSDocIdentifierName(); @@ -13805,64 +19676,82 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(275 /* JSDocParameterTag */, atToken.pos); + var result = createNode(281 /* JSDocParameterTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; result.typeExpression = typeExpression; result.postParameterName = postName; + result.parameterName = postName || preName; result.isBracketed = isBracketed; return finishNode(result); } - function handleReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 276 /* JSDocReturnTag */; })) { + function parseReturnTag(atToken, tagName) { + 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(276 /* JSDocReturnTag */, atToken.pos); + var result = createNode(282 /* JSDocReturnTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } - function handleTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 277 /* JSDocTypeTag */; })) { + function parseTypeTag(atToken, tagName) { + 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(277 /* JSDocTypeTag */, atToken.pos); + var result = createNode(283 /* JSDocTypeTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } - function handlePropertyTag(atToken, tagName) { + function parsePropertyTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); var name = parseJSDocIdentifierName(); + skipWhitespace(); if (!name) { parseErrorAtPosition(scanner.getStartPos(), /*length*/ 0, ts.Diagnostics.Identifier_expected); return undefined; } - var result = createNode(280 /* 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 handleTypedefTag(atToken, tagName) { + 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(279 /* JSDocTypedefTag */, atToken.pos); + var typedefTag = createNode(285 /* JSDocTypedefTag */, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; - typedefTag.name = parseJSDocIdentifierName(); + typedefTag.fullName = parseJSDocTypeNameWithNamespace(/*flags*/ 0); + if (typedefTag.fullName) { + var rightNode = typedefTag.fullName; + while (rightNode.kind !== 70 /* Identifier */) { + rightNode = rightNode.body; + } + typedefTag.name = rightNode; + } typedefTag.typeExpression = typeExpression; + skipWhitespace(); if (typeExpression) { - if (typeExpression.type.kind === 267 /* JSDocTypeReference */) { + if (typeExpression.type.kind === 272 /* JSDocTypeReference */) { var jsDocTypeReference = typeExpression.type; - if (jsDocTypeReference.name.kind === 69 /* Identifier */) { - var name_8 = jsDocTypeReference.name; - if (name_8.text === "Object") { + if (jsDocTypeReference.name.kind === 70 /* Identifier */) { + var name_14 = jsDocTypeReference.name; + if (name_14.text === "Object") { typedefTag.jsDocTypeLiteral = scanChildTags(); } } @@ -13876,7 +19765,7 @@ var ts; } return finishNode(typedefTag); function scanChildTags() { - var jsDocTypeLiteral = createNode(281 /* JSDocTypeLiteral */, scanner.getStartPos()); + var jsDocTypeLiteral = createNode(287 /* JSDocTypeLiteral */, scanner.getStartPos()); var resumePos = scanner.getStartPos(); var canParseTag = true; var seenAsterisk = false; @@ -13884,7 +19773,7 @@ var ts; while (token() !== 1 /* EndOfFileToken */ && !parentTagTerminated) { nextJSDocToken(); switch (token()) { - case 55 /* AtToken */: + case 56 /* AtToken */: if (canParseTag) { parentTagTerminated = !tryParseChildTag(jsDocTypeLiteral); if (!parentTagTerminated) { @@ -13898,13 +19787,13 @@ var ts; canParseTag = true; seenAsterisk = false; break; - case 37 /* AsteriskToken */: + case 38 /* AsteriskToken */: if (seenAsterisk) { canParseTag = false; } seenAsterisk = true; break; - case 69 /* Identifier */: + case 70 /* Identifier */: canParseTag = false; case 1 /* EndOfFileToken */: break; @@ -13913,13 +19802,29 @@ var ts; scanner.setTextPos(resumePos); return finishNode(jsDocTypeLiteral); } + function parseJSDocTypeNameWithNamespace(flags) { + var pos = scanner.getTokenPos(); + var typeNameOrNamespaceName = parseJSDocIdentifierName(); + if (typeNameOrNamespaceName && parseOptional(22 /* DotToken */)) { + var jsDocNamespaceNode = createNode(230 /* ModuleDeclaration */, pos); + jsDocNamespaceNode.flags |= flags; + jsDocNamespaceNode.name = typeNameOrNamespaceName; + jsDocNamespaceNode.body = parseJSDocTypeNameWithNamespace(4 /* NestedNamespace */); + return jsDocNamespaceNode; + } + if (typeNameOrNamespaceName && flags & 4 /* NestedNamespace */) { + typeNameOrNamespaceName.isInJSDocNamespace = true; + } + return typeNameOrNamespaceName; + } } function tryParseChildTag(parentTag) { - ts.Debug.assert(token() === 55 /* AtToken */); - var atToken = createNode(55 /* AtToken */, scanner.getStartPos()); + ts.Debug.assert(token() === 56 /* AtToken */); + var atToken = createNode(56 /* AtToken */, scanner.getStartPos()); atToken.end = scanner.getTextPos(); nextJSDocToken(); var tagName = parseJSDocIdentifierName(); + skipWhitespace(); if (!tagName) { return false; } @@ -13929,44 +19834,49 @@ var ts; // already has a @type tag, terminate the parent tag now. return false; } - parentTag.jsDocTypeTag = handleTypeTag(atToken, tagName); + parentTag.jsDocTypeTag = parseTypeTag(atToken, tagName); return true; case "prop": case "property": - if (!parentTag.jsDocPropertyTags) { - parentTag.jsDocPropertyTags = []; + var propertyTag = parsePropertyTag(atToken, tagName); + if (propertyTag) { + if (!parentTag.jsDocPropertyTags) { + parentTag.jsDocPropertyTags = []; + } + parentTag.jsDocPropertyTags.push(propertyTag); + return true; } - var propertyTag = handlePropertyTag(atToken, tagName); - parentTag.jsDocPropertyTags.push(propertyTag); - return true; + // Error parsing property tag + return false; } return false; } - function handleTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 278 /* JSDocTemplateTag */; })) { + function parseTemplateTag(atToken, tagName) { + 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 = []; - typeParameters.pos = scanner.getStartPos(); + var typeParameters = createNodeArray(); while (true) { - var name_9 = parseJSDocIdentifierName(); - if (!name_9) { + var name_15 = parseJSDocIdentifierName(); + skipWhitespace(); + if (!name_15) { parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(141 /* TypeParameter */, name_9.pos); - typeParameter.name = name_9; + var typeParameter = createNode(143 /* TypeParameter */, name_15.pos); + typeParameter.name = name_15; finishNode(typeParameter); typeParameters.push(typeParameter); - if (token() === 24 /* CommaToken */) { + if (token() === 25 /* CommaToken */) { nextJSDocToken(); + skipWhitespace(); } else { break; } } - var result = createNode(278 /* JSDocTemplateTag */, atToken.pos); + var result = createNode(284 /* JSDocTemplateTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -13987,7 +19897,7 @@ var ts; } var pos = scanner.getTokenPos(); var end = scanner.getTextPos(); - var result = createNode(69 /* Identifier */, pos); + var result = createNode(70 /* Identifier */, pos); result.text = content.substring(pos, end); finishNode(result, end); nextJSDocToken(); @@ -14093,8 +20003,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); } @@ -14115,7 +20025,7 @@ var ts; switch (node.kind) { case 9 /* StringLiteral */: case 8 /* NumericLiteral */: - case 69 /* Identifier */: + case 70 /* Identifier */: return true; } return false; @@ -14477,25 +20387,25 @@ var ts; /* @internal */ var ts; (function (ts) { + var ModuleInstanceState; (function (ModuleInstanceState) { ModuleInstanceState[ModuleInstanceState["NonInstantiated"] = 0] = "NonInstantiated"; ModuleInstanceState[ModuleInstanceState["Instantiated"] = 1] = "Instantiated"; ModuleInstanceState[ModuleInstanceState["ConstEnumOnly"] = 2] = "ConstEnumOnly"; - })(ts.ModuleInstanceState || (ts.ModuleInstanceState = {})); - var ModuleInstanceState = ts.ModuleInstanceState; + })(ModuleInstanceState = ts.ModuleInstanceState || (ts.ModuleInstanceState = {})); function getModuleInstanceState(node) { // A module is uninstantiated if it contains only // 1. interface declarations, type alias declarations - if (node.kind === 222 /* InterfaceDeclaration */ || node.kind === 223 /* TypeAliasDeclaration */) { + if (node.kind === 227 /* InterfaceDeclaration */ || node.kind === 228 /* TypeAliasDeclaration */) { return 0 /* NonInstantiated */; } else if (ts.isConstEnumDeclaration(node)) { return 2 /* ConstEnumOnly */; } - else if ((node.kind === 230 /* ImportDeclaration */ || node.kind === 229 /* ImportEqualsDeclaration */) && !(node.flags & 1 /* Export */)) { + else if ((node.kind === 235 /* ImportDeclaration */ || node.kind === 234 /* ImportEqualsDeclaration */) && !(ts.hasModifier(node, 1 /* Export */))) { return 0 /* NonInstantiated */; } - else if (node.kind === 226 /* ModuleBlock */) { + else if (node.kind === 231 /* ModuleBlock */) { var state_1 = 0 /* NonInstantiated */; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -14514,10 +20424,13 @@ var ts; }); return state_1; } - else if (node.kind === 225 /* ModuleDeclaration */) { + else if (node.kind === 230 /* ModuleDeclaration */) { var body = node.body; return body ? getModuleInstanceState(body) : 1 /* Instantiated */; } + else if (node.kind === 70 /* Identifier */ && node.isInJSDocNamespace) { + return 0 /* NonInstantiated */; + } else { return 1 /* Instantiated */; } @@ -14545,6 +20458,7 @@ var ts; ContainerFlags[ContainerFlags["IsFunctionExpression"] = 16] = "IsFunctionExpression"; ContainerFlags[ContainerFlags["HasLocals"] = 32] = "HasLocals"; ContainerFlags[ContainerFlags["IsInterface"] = 64] = "IsInterface"; + ContainerFlags[ContainerFlags["IsObjectLiteralOrClassExpressionMethod"] = 128] = "IsObjectLiteralOrClassExpressionMethod"; })(ContainerFlags || (ContainerFlags = {})); var binder = createBinder(); function bindSourceFile(file, options) { @@ -14577,20 +20491,25 @@ var ts; var emitFlags; // If this file is an external module, then it is automatically in strict-mode according to // ES6. If it is not an external module, then we'll determine if it is in strict mode or - // not depending on if we see "use strict" in certain places (or if we hit a class/namespace). + // not depending on if we see "use strict" in certain places or if we hit a class/namespace + // or if compiler options contain alwaysStrict. var inStrictMode; var symbolCount = 0; var Symbol; var classifiableNames; var unreachableFlow = { flags: 1 /* Unreachable */ }; var reportedUnreachableFlow = { flags: 1 /* Unreachable */ }; + // state used to aggregate transform flags during bind. + var subtreeTransformFlags = 0 /* None */; + var skipTransformFlagAggregation; function bindSourceFile(f, opts) { file = f; options = opts; languageVersion = ts.getEmitScriptTarget(options); - inStrictMode = !!file.externalModuleIndicator; + inStrictMode = bindInStrictMode(file, opts); classifiableNames = ts.createMap(); symbolCount = 0; + skipTransformFlagAggregation = ts.isDeclarationFile(file); Symbol = ts.objectAllocator.getSymbolConstructor(); if (!file.locals) { bind(file); @@ -14614,8 +20533,18 @@ var ts; activeLabels = undefined; hasExplicitReturn = false; emitFlags = 0 /* None */; + subtreeTransformFlags = 0 /* None */; } return bindSourceFile; + function bindInStrictMode(file, opts) { + if (opts.alwaysStrict && !ts.isDeclarationFile(file)) { + // bind in strict mode source files with alwaysStrict option + return true; + } + else { + return !!file.externalModuleIndicator; + } + } function createSymbol(flags, name) { symbolCount++; return new Symbol(flags, name); @@ -14636,7 +20565,7 @@ var ts; if (symbolFlags & 107455 /* Value */) { var valueDeclaration = symbol.valueDeclaration; if (!valueDeclaration || - (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 225 /* ModuleDeclaration */)) { + (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 230 /* ModuleDeclaration */)) { // other kinds of value declarations take precedence over modules symbol.valueDeclaration = node; } @@ -14649,10 +20578,10 @@ var ts; if (ts.isAmbientModule(node)) { return ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + node.name.text + "\""; } - if (node.name.kind === 140 /* ComputedPropertyName */) { + 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)); @@ -14661,21 +20590,21 @@ var ts; return node.name.text; } switch (node.kind) { - case 148 /* Constructor */: + case 150 /* Constructor */: return "__constructor"; - case 156 /* FunctionType */: - case 151 /* CallSignature */: + case 158 /* FunctionType */: + case 153 /* CallSignature */: return "__call"; - case 157 /* ConstructorType */: - case 152 /* ConstructSignature */: + case 159 /* ConstructorType */: + case 154 /* ConstructSignature */: return "__new"; - case 153 /* IndexSignature */: + case 155 /* IndexSignature */: return "__index"; - case 236 /* ExportDeclaration */: + case 241 /* ExportDeclaration */: return "__export"; - case 235 /* ExportAssignment */: + case 240 /* ExportAssignment */: return node.isExportEquals ? "export=" : "default"; - case 187 /* BinaryExpression */: + case 192 /* BinaryExpression */: switch (ts.getSpecialPropertyAssignmentKind(node)) { case 2 /* ModuleExports */: // module.exports = ... @@ -14690,25 +20619,25 @@ var ts; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 220 /* FunctionDeclaration */: - case 221 /* ClassDeclaration */: - return node.flags & 512 /* Default */ ? "default" : undefined; - case 269 /* JSDocFunctionType */: + case 225 /* FunctionDeclaration */: + case 226 /* ClassDeclaration */: + return ts.hasModifier(node, 512 /* Default */) ? "default" : undefined; + case 274 /* JSDocFunctionType */: return ts.isJSDocConstructSignature(node) ? "__new" : "__call"; - case 142 /* Parameter */: + case 144 /* Parameter */: // Parameters with names are handled at the top of this function. Parameters // without names can only come from JSDocFunctionTypes. - ts.Debug.assert(node.parent.kind === 269 /* JSDocFunctionType */); + ts.Debug.assert(node.parent.kind === 274 /* JSDocFunctionType */); var functionType = node.parent; var index = ts.indexOf(functionType.parameters, node); - return "p" + index; - case 279 /* JSDocTypedefTag */: + return "arg" + index; + case 285 /* JSDocTypedefTag */: var parentNode = node.parent && node.parent.parent; var nameFromParentNode = void 0; - if (parentNode && parentNode.kind === 200 /* VariableStatement */) { + if (parentNode && parentNode.kind === 205 /* VariableStatement */) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; - if (nameIdentifier.kind === 69 /* Identifier */) { + if (nameIdentifier.kind === 70 /* Identifier */) { nameFromParentNode = nameIdentifier.text; } } @@ -14729,7 +20658,7 @@ var ts; */ function declareSymbol(symbolTable, parent, node, includes, excludes) { ts.Debug.assert(!ts.hasDynamicName(node)); - var isDefaultExport = node.flags & 512 /* Default */; + var isDefaultExport = ts.hasModifier(node, 512 /* Default */); // The exported symbol for an export default function/class node is always named "default" var name = isDefaultExport && parent ? "default" : getDeclarationName(node); var symbol; @@ -14779,11 +20708,24 @@ var ts; var message_1 = symbol.flags & 2 /* BlockScopedVariable */ ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; - ts.forEach(symbol.declarations, function (declaration) { - if (declaration.flags & 512 /* Default */) { + if (symbol.declarations && symbol.declarations.length) { + // If the current node is a default export of some sort, then check if + // there are any other default exports that we need to error on. + // We'll know whether we have other default exports depending on if `symbol` already has a declaration list set. + if (isDefaultExport) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; } - }); + else { + // This is to properly report an error in the case "export default { }" is after export default of class declaration or function declaration. + // Error on multiple export default in the following case: + // 1. multiple export default of class declaration or function declaration by checking NodeFlags.Default + // 2. multiple export default of export assignment. This one doesn't have NodeFlags.Default on (as export default doesn't considered as modifiers) + if (symbol.declarations && symbol.declarations.length && + (isDefaultExport || (node.kind === 240 /* ExportAssignment */ && !node.isExportEquals))) { + message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; + } + } + } ts.forEach(symbol.declarations, function (declaration) { file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message_1, getDisplayName(declaration))); }); @@ -14797,9 +20739,9 @@ var ts; return symbol; } function declareModuleMember(node, symbolFlags, symbolExcludes) { - var hasExportModifier = ts.getCombinedNodeFlags(node) & 1 /* Export */; + var hasExportModifier = ts.getCombinedModifierFlags(node) & 1 /* Export */; if (symbolFlags & 8388608 /* Alias */) { - if (node.kind === 238 /* ExportSpecifier */ || (node.kind === 229 /* ImportEqualsDeclaration */ && hasExportModifier)) { + if (node.kind === 243 /* ExportSpecifier */ || (node.kind === 234 /* ImportEqualsDeclaration */ && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -14822,7 +20764,11 @@ 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. - if (!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 8192 /* ExportContext */)) { + var isJSDocTypedefInJSDocNamespace = node.kind === 285 /* JSDocTypedefTag */ && + node.name && + node.name.kind === 70 /* Identifier */ && + node.name.isInJSDocNamespace; + if ((!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 32 /* ExportContext */)) || isJSDocTypedefInJSDocNamespace) { var exportKind = (symbolFlags & 107455 /* Value */ ? 1048576 /* ExportValue */ : 0) | (symbolFlags & 793064 /* Type */ ? 2097152 /* ExportType */ : 0) | (symbolFlags & 1920 /* Namespace */ ? 4194304 /* ExportNamespace */ : 0); @@ -14880,15 +20826,15 @@ var ts; var saveReturnTarget = currentReturnTarget; var saveActiveLabels = activeLabels; var saveHasExplicitReturn = hasExplicitReturn; - var isIIFE = containerFlags & 16 /* IsFunctionExpression */ && !!ts.getImmediatelyInvokedFunctionExpression(node); - // An IIFE is considered part of the containing control flow. Return statements behave + var isIIFE = containerFlags & 16 /* IsFunctionExpression */ && !ts.hasModifier(node, 256 /* Async */) && !!ts.getImmediatelyInvokedFunctionExpression(node); + // A non-async IIFE is considered part of the containing control flow. Return statements behave // similarly to break statements that exit to a label just past the statement body. if (isIIFE) { currentReturnTarget = createBranchLabel(); } else { currentFlow = { flags: 2 /* Start */ }; - if (containerFlags & 16 /* IsFunctionExpression */) { + if (containerFlags & (16 /* IsFunctionExpression */ | 128 /* IsObjectLiteralOrClassExpressionMethod */)) { currentFlow.container = node; } currentReturnTarget = undefined; @@ -14899,14 +20845,13 @@ var ts; hasExplicitReturn = false; bindChildren(node); // Reset all reachability check related flags on node (for incremental scenarios) - // Reset all emit helper flags on node (for incremental scenarios) - node.flags &= ~4030464 /* ReachabilityAndEmitFlags */; + node.flags &= ~1408 /* ReachabilityAndEmitFlags */; if (!(currentFlow.flags & 1 /* Unreachable */) && containerFlags & 8 /* IsFunctionLike */ && ts.nodeIsPresent(node.body)) { - node.flags |= 32768 /* HasImplicitReturn */; + node.flags |= 128 /* HasImplicitReturn */; if (hasExplicitReturn) - node.flags |= 65536 /* HasExplicitReturn */; + node.flags |= 256 /* HasExplicitReturn */; } - if (node.kind === 256 /* SourceFile */) { + if (node.kind === 261 /* SourceFile */) { node.flags |= emitFlags; } if (isIIFE) { @@ -14925,7 +20870,7 @@ var ts; else if (containerFlags & 64 /* IsInterface */) { seenThisKeyword = false; bindChildren(node); - node.flags = seenThisKeyword ? node.flags | 16384 /* ContainsThis */ : node.flags & ~16384 /* ContainsThis */; + node.flags = seenThisKeyword ? node.flags | 64 /* ContainsThis */ : node.flags & ~64 /* ContainsThis */; } else { bindChildren(node); @@ -14934,103 +20879,143 @@ var ts; blockScopeContainer = savedBlockScopeContainer; } function bindChildren(node) { + if (skipTransformFlagAggregation) { + bindChildrenWorker(node); + } + else if (node.transformFlags & 536870912 /* HasComputedFlags */) { + skipTransformFlagAggregation = true; + bindChildrenWorker(node); + skipTransformFlagAggregation = false; + subtreeTransformFlags |= node.transformFlags & ~getTransformFlagsSubtreeExclusions(node.kind); + } + else { + var savedSubtreeTransformFlags = subtreeTransformFlags; + subtreeTransformFlags = 0; + bindChildrenWorker(node); + 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) { - for (var _i = 0, _a = node.jsDocComments; _i < _a.length; _i++) { - var jsDocComment = _a[_i]; - bind(jsDocComment); - } + if (ts.isInJavaScriptFile(node) && node.jsDoc) { + ts.forEach(node.jsDoc, bind); } if (checkUnreachable(node)) { - ts.forEachChild(node, bind); + bindEachChild(node); return; } switch (node.kind) { - case 205 /* WhileStatement */: + case 210 /* WhileStatement */: bindWhileStatement(node); break; - case 204 /* DoStatement */: + case 209 /* DoStatement */: bindDoStatement(node); break; - case 206 /* ForStatement */: + case 211 /* ForStatement */: bindForStatement(node); break; - case 207 /* ForInStatement */: - case 208 /* ForOfStatement */: + case 212 /* ForInStatement */: + case 213 /* ForOfStatement */: bindForInOrForOfStatement(node); break; - case 203 /* IfStatement */: + case 208 /* IfStatement */: bindIfStatement(node); break; - case 211 /* ReturnStatement */: - case 215 /* ThrowStatement */: + case 216 /* ReturnStatement */: + case 220 /* ThrowStatement */: bindReturnOrThrow(node); break; - case 210 /* BreakStatement */: - case 209 /* ContinueStatement */: + case 215 /* BreakStatement */: + case 214 /* ContinueStatement */: bindBreakOrContinueStatement(node); break; - case 216 /* TryStatement */: + case 221 /* TryStatement */: bindTryStatement(node); break; - case 213 /* SwitchStatement */: + case 218 /* SwitchStatement */: bindSwitchStatement(node); break; - case 227 /* CaseBlock */: + case 232 /* CaseBlock */: bindCaseBlock(node); break; - case 249 /* CaseClause */: + case 253 /* CaseClause */: bindCaseClause(node); break; - case 214 /* LabeledStatement */: + case 219 /* LabeledStatement */: bindLabeledStatement(node); break; - case 185 /* PrefixUnaryExpression */: + case 190 /* PrefixUnaryExpression */: bindPrefixUnaryExpressionFlow(node); break; - case 187 /* BinaryExpression */: + case 191 /* PostfixUnaryExpression */: + bindPostfixUnaryExpressionFlow(node); + break; + case 192 /* BinaryExpression */: bindBinaryExpressionFlow(node); break; - case 181 /* DeleteExpression */: + case 186 /* DeleteExpression */: bindDeleteExpressionFlow(node); break; - case 188 /* ConditionalExpression */: + case 193 /* ConditionalExpression */: bindConditionalExpressionFlow(node); break; - case 218 /* VariableDeclaration */: + case 223 /* VariableDeclaration */: bindVariableDeclarationFlow(node); break; - case 174 /* CallExpression */: + case 179 /* CallExpression */: bindCallExpressionFlow(node); break; default: - ts.forEachChild(node, bind); + bindEachChild(node); break; } } function isNarrowingExpression(expr) { switch (expr.kind) { - case 69 /* Identifier */: - case 97 /* ThisKeyword */: - case 172 /* PropertyAccessExpression */: + case 70 /* Identifier */: + case 98 /* ThisKeyword */: + case 177 /* PropertyAccessExpression */: return isNarrowableReference(expr); - case 174 /* CallExpression */: + case 179 /* CallExpression */: return hasNarrowableArgument(expr); - case 178 /* ParenthesizedExpression */: + case 183 /* ParenthesizedExpression */: return isNarrowingExpression(expr.expression); - case 187 /* BinaryExpression */: + case 192 /* BinaryExpression */: return isNarrowingBinaryExpression(expr); - case 185 /* PrefixUnaryExpression */: - return expr.operator === 49 /* ExclamationToken */ && isNarrowingExpression(expr.operand); + case 190 /* PrefixUnaryExpression */: + return expr.operator === 50 /* ExclamationToken */ && isNarrowingExpression(expr.operand); } return false; } function isNarrowableReference(expr) { - return expr.kind === 69 /* Identifier */ || - expr.kind === 97 /* ThisKeyword */ || - expr.kind === 172 /* PropertyAccessExpression */ && isNarrowableReference(expr.expression); + return expr.kind === 70 /* Identifier */ || + expr.kind === 98 /* ThisKeyword */ || + expr.kind === 177 /* PropertyAccessExpression */ && isNarrowableReference(expr.expression); } function hasNarrowableArgument(expr) { if (expr.arguments) { @@ -15041,41 +21026,41 @@ var ts; } } } - if (expr.expression.kind === 172 /* PropertyAccessExpression */ && + if (expr.expression.kind === 177 /* PropertyAccessExpression */ && isNarrowableReference(expr.expression.expression)) { return true; } return false; } function isNarrowingTypeofOperands(expr1, expr2) { - return expr1.kind === 182 /* TypeOfExpression */ && isNarrowableOperand(expr1.expression) && expr2.kind === 9 /* StringLiteral */; + return expr1.kind === 187 /* TypeOfExpression */ && isNarrowableOperand(expr1.expression) && expr2.kind === 9 /* StringLiteral */; } function isNarrowingBinaryExpression(expr) { switch (expr.operatorToken.kind) { - case 56 /* EqualsToken */: + case 57 /* EqualsToken */: return isNarrowableReference(expr.left); - case 30 /* EqualsEqualsToken */: - case 31 /* ExclamationEqualsToken */: - case 32 /* EqualsEqualsEqualsToken */: - case 33 /* ExclamationEqualsEqualsToken */: + case 31 /* EqualsEqualsToken */: + case 32 /* ExclamationEqualsToken */: + case 33 /* EqualsEqualsEqualsToken */: + case 34 /* ExclamationEqualsEqualsToken */: return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) || isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right); - case 91 /* InstanceOfKeyword */: + case 92 /* InstanceOfKeyword */: return isNarrowableOperand(expr.left); - case 24 /* CommaToken */: + case 25 /* CommaToken */: return isNarrowingExpression(expr.right); } return false; } function isNarrowableOperand(expr) { switch (expr.kind) { - case 178 /* ParenthesizedExpression */: + case 183 /* ParenthesizedExpression */: return isNarrowableOperand(expr.expression); - case 187 /* BinaryExpression */: + case 192 /* BinaryExpression */: switch (expr.operatorToken.kind) { - case 56 /* EqualsToken */: + case 57 /* EqualsToken */: return isNarrowableOperand(expr.left); - case 24 /* CommaToken */: + case 25 /* CommaToken */: return isNarrowableOperand(expr.right); } } @@ -15095,7 +21080,7 @@ var ts; } function setFlowNodeReferenced(flow) { // On first reference we set the Referenced flag, thereafter we set the Shared flag - flow.flags |= flow.flags & 256 /* Referenced */ ? 512 /* Shared */ : 256 /* Referenced */; + flow.flags |= flow.flags & 512 /* Referenced */ ? 1024 /* Shared */ : 512 /* Referenced */; } function addAntecedent(label, antecedent) { if (!(antecedent.flags & 1 /* Unreachable */) && !ts.contains(label.antecedents, antecedent)) { @@ -15110,8 +21095,8 @@ var ts; if (!expression) { return flags & 32 /* TrueCondition */ ? antecedent : unreachableFlow; } - if (expression.kind === 99 /* TrueKeyword */ && flags & 64 /* FalseCondition */ || - expression.kind === 84 /* FalseKeyword */ && flags & 32 /* TrueCondition */) { + if (expression.kind === 100 /* TrueKeyword */ && flags & 64 /* FalseCondition */ || + expression.kind === 85 /* FalseKeyword */ && flags & 32 /* TrueCondition */) { return unreachableFlow; } if (!isNarrowingExpression(expression)) { @@ -15145,6 +21130,14 @@ var ts; node: node }; } + function createFlowArrayMutation(antecedent, node) { + setFlowNodeReferenced(antecedent); + return { + flags: 256 /* ArrayMutation */, + antecedent: antecedent, + node: node + }; + } function finishFlowLabel(flow) { var antecedents = flow.antecedents; if (!antecedents) { @@ -15158,34 +21151,34 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 203 /* IfStatement */: - case 205 /* WhileStatement */: - case 204 /* DoStatement */: + case 208 /* IfStatement */: + case 210 /* WhileStatement */: + case 209 /* DoStatement */: return parent.expression === node; - case 206 /* ForStatement */: - case 188 /* ConditionalExpression */: + case 211 /* ForStatement */: + case 193 /* ConditionalExpression */: return parent.condition === node; } return false; } function isLogicalExpression(node) { while (true) { - if (node.kind === 178 /* ParenthesizedExpression */) { + if (node.kind === 183 /* ParenthesizedExpression */) { node = node.expression; } - else if (node.kind === 185 /* PrefixUnaryExpression */ && node.operator === 49 /* ExclamationToken */) { + else if (node.kind === 190 /* PrefixUnaryExpression */ && node.operator === 50 /* ExclamationToken */) { node = node.operand; } else { - return node.kind === 187 /* BinaryExpression */ && (node.operatorToken.kind === 51 /* AmpersandAmpersandToken */ || - node.operatorToken.kind === 52 /* BarBarToken */); + return node.kind === 192 /* BinaryExpression */ && (node.operatorToken.kind === 52 /* AmpersandAmpersandToken */ || + node.operatorToken.kind === 53 /* BarBarToken */); } } } function isTopLevelLogicalExpression(node) { - while (node.parent.kind === 178 /* ParenthesizedExpression */ || - node.parent.kind === 185 /* PrefixUnaryExpression */ && - node.parent.operator === 49 /* ExclamationToken */) { + while (node.parent.kind === 183 /* ParenthesizedExpression */ || + node.parent.kind === 190 /* PrefixUnaryExpression */ && + node.parent.operator === 50 /* ExclamationToken */) { node = node.parent; } return !isStatementCondition(node) && !isLogicalExpression(node.parent); @@ -15226,8 +21219,13 @@ var ts; } function bindDoStatement(node) { var preDoLabel = createLoopLabel(); - var preConditionLabel = createBranchLabel(); - var postDoLabel = createBranchLabel(); + var enclosingLabeledStatement = node.parent.kind === 219 /* LabeledStatement */ + ? ts.lastOrUndefined(activeLabels) + : undefined; + // if do statement is wrapped in labeled statement then target labels for break/continue with or without + // label should be the same + var preConditionLabel = enclosingLabeledStatement ? enclosingLabeledStatement.continueTarget : createBranchLabel(); + var postDoLabel = enclosingLabeledStatement ? enclosingLabeledStatement.breakTarget : createBranchLabel(); addAntecedent(preDoLabel, currentFlow); currentFlow = preDoLabel; bindIterativeStatement(node.statement, postDoLabel, preConditionLabel); @@ -15258,7 +21256,7 @@ var ts; bind(node.expression); addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 219 /* VariableDeclarationList */) { + if (node.initializer.kind !== 224 /* VariableDeclarationList */) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -15280,7 +21278,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 211 /* ReturnStatement */) { + if (node.kind === 216 /* ReturnStatement */) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -15299,8 +21297,8 @@ var ts; } return undefined; } - function bindbreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 210 /* BreakStatement */ ? breakTarget : continueTarget; + function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { + var flowLabel = node.kind === 215 /* BreakStatement */ ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -15312,29 +21310,50 @@ 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) { - var postFinallyLabel = createBranchLabel(); + var preFinallyLabel = createBranchLabel(); var preTryFlow = currentFlow; // TODO: Every statement in try block is potentially an exit point! bind(node.tryBlock); - addAntecedent(postFinallyLabel, currentFlow); + addAntecedent(preFinallyLabel, currentFlow); + var flowAfterTry = currentFlow; + var flowAfterCatch = unreachableFlow; if (node.catchClause) { currentFlow = preTryFlow; bind(node.catchClause); - addAntecedent(postFinallyLabel, currentFlow); + addAntecedent(preFinallyLabel, currentFlow); + flowAfterCatch = currentFlow; } if (node.finallyBlock) { - currentFlow = preTryFlow; + // in finally flow is combined from pre-try/flow from try/flow from catch + // pre-flow is necessary to make sure that finally is reachable even if finally flows in both try and finally blocks are unreachable + addAntecedent(preFinallyLabel, preTryFlow); + currentFlow = finishFlowLabel(preFinallyLabel); bind(node.finallyBlock); + // if flow after finally is unreachable - keep it + // otherwise check if flows after try and after catch are unreachable + // if yes - convert current flow to unreachable + // i.e. + // try { return "1" } finally { console.log(1); } + // console.log(2); // this line should be unreachable even if flow falls out of finally block + if (!(currentFlow.flags & 1 /* Unreachable */)) { + if ((flowAfterTry.flags & 1 /* Unreachable */) && (flowAfterCatch.flags & 1 /* Unreachable */)) { + currentFlow = flowAfterTry === reportedUnreachableFlow || flowAfterCatch === reportedUnreachableFlow + ? reportedUnreachableFlow + : unreachableFlow; + } + } + } + else { + currentFlow = finishFlowLabel(preFinallyLabel); } - currentFlow = finishFlowLabel(postFinallyLabel); } function bindSwitchStatement(node) { var postSwitchLabel = createBranchLabel(); @@ -15345,7 +21364,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 250 /* DefaultClause */; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 254 /* DefaultClause */; }); // We mark a switch statement as possibly exhaustive if it has no default clause and if all // case clauses have unreachable end points (e.g. they all return). node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; @@ -15357,6 +21376,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++) { @@ -15376,13 +21397,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 = { @@ -15408,11 +21431,14 @@ var ts; if (!activeLabel.referenced && !options.allowUnusedLabels) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node.label, ts.Diagnostics.Unused_label)); } - addAntecedent(postStatementLabel, currentFlow); - currentFlow = finishFlowLabel(postStatementLabel); + if (!node.statement || node.statement.kind !== 209 /* DoStatement */) { + // do statement sets current flow inside bindDoStatement + addAntecedent(postStatementLabel, currentFlow); + currentFlow = finishFlowLabel(postStatementLabel); + } } function bindDestructuringTargetFlow(node) { - if (node.kind === 187 /* BinaryExpression */ && node.operatorToken.kind === 56 /* EqualsToken */) { + if (node.kind === 192 /* BinaryExpression */ && node.operatorToken.kind === 57 /* EqualsToken */) { bindAssignmentTargetFlow(node.left); } else { @@ -15423,10 +21449,10 @@ var ts; if (isNarrowableReference(node)) { currentFlow = createFlowAssignment(currentFlow, node); } - else if (node.kind === 170 /* ArrayLiteralExpression */) { + else if (node.kind === 175 /* ArrayLiteralExpression */) { for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { var e = _a[_i]; - if (e.kind === 191 /* SpreadElementExpression */) { + if (e.kind === 196 /* SpreadElement */) { bindAssignmentTargetFlow(e.expression); } else { @@ -15434,21 +21460,24 @@ var ts; } } } - else if (node.kind === 171 /* ObjectLiteralExpression */) { + else if (node.kind === 176 /* ObjectLiteralExpression */) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 253 /* PropertyAssignment */) { + if (p.kind === 257 /* PropertyAssignment */) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 254 /* ShorthandPropertyAssignment */) { + else if (p.kind === 258 /* ShorthandPropertyAssignment */) { bindAssignmentTargetFlow(p.name); } + else if (p.kind === 259 /* SpreadAssignment */) { + bindAssignmentTargetFlow(p.expression); + } } } } function bindLogicalExpression(node, trueTarget, falseTarget) { var preRightLabel = createBranchLabel(); - if (node.operatorToken.kind === 51 /* AmpersandAmpersandToken */) { + if (node.operatorToken.kind === 52 /* AmpersandAmpersandToken */) { bindCondition(node.left, preRightLabel, falseTarget); } else { @@ -15459,21 +21488,30 @@ var ts; bindCondition(node.right, trueTarget, falseTarget); } function bindPrefixUnaryExpressionFlow(node) { - if (node.operator === 49 /* ExclamationToken */) { + if (node.operator === 50 /* ExclamationToken */) { 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) { + bindEachChild(node); + if (node.operator === 42 /* PlusPlusToken */ || node.operator === 43 /* MinusMinusToken */) { + bindAssignmentTargetFlow(node.operand); } } function bindBinaryExpressionFlow(node) { var operator = node.operatorToken.kind; - if (operator === 51 /* AmpersandAmpersandToken */ || operator === 52 /* BarBarToken */) { + if (operator === 52 /* AmpersandAmpersandToken */ || operator === 53 /* BarBarToken */) { if (isTopLevelLogicalExpression(node)) { var postExpressionLabel = createBranchLabel(); bindLogicalExpression(node, postExpressionLabel, postExpressionLabel); @@ -15484,15 +21522,21 @@ var ts; } } else { - ts.forEachChild(node, bind); - if (operator === 56 /* EqualsToken */ && !ts.isAssignmentTarget(node)) { + bindEachChild(node); + if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); + if (operator === 57 /* EqualsToken */ && node.left.kind === 178 /* ElementAccessExpression */) { + var elementAccess = node.left; + if (isNarrowableOperand(elementAccess.expression)) { + currentFlow = createFlowArrayMutation(currentFlow, node); + } + } } } } function bindDeleteExpressionFlow(node) { - ts.forEachChild(node, bind); - if (node.expression.kind === 172 /* PropertyAccessExpression */) { + bindEachChild(node); + if (node.expression.kind === 177 /* PropertyAccessExpression */) { bindAssignmentTargetFlow(node.expression); } } @@ -15502,15 +21546,17 @@ var ts; var postExpressionLabel = createBranchLabel(); bindCondition(node.condition, trueLabel, falseLabel); currentFlow = finishFlowLabel(trueLabel); + bind(node.questionToken); bind(node.whenTrue); addAntecedent(postExpressionLabel, currentFlow); currentFlow = finishFlowLabel(falseLabel); + bind(node.colonToken); bind(node.whenFalse); addAntecedent(postExpressionLabel, currentFlow); currentFlow = finishFlowLabel(postExpressionLabel); } function bindInitializedVariableFlow(node) { - var name = node.name; + var name = !ts.isOmittedExpression(node) ? node.name : undefined; if (ts.isBindingPattern(name)) { for (var _i = 0, _a = name.elements; _i < _a.length; _i++) { var child = _a[_i]; @@ -15522,8 +21568,8 @@ var ts; } } function bindVariableDeclarationFlow(node) { - ts.forEachChild(node, bind); - if (node.initializer || node.parent.parent.kind === 207 /* ForInStatement */ || node.parent.parent.kind === 208 /* ForOfStatement */) { + bindEachChild(node); + if (node.initializer || node.parent.parent.kind === 212 /* ForInStatement */ || node.parent.parent.kind === 213 /* ForOfStatement */) { bindInitializedVariableFlow(node); } } @@ -15532,62 +21578,72 @@ var ts; // an immediately invoked function expression (IIFE). Initialize the flowNode property to // the current control flow (which includes evaluation of the IIFE arguments). var expr = node.expression; - while (expr.kind === 178 /* ParenthesizedExpression */) { + while (expr.kind === 183 /* ParenthesizedExpression */) { expr = expr.expression; } - if (expr.kind === 179 /* FunctionExpression */ || expr.kind === 180 /* ArrowFunction */) { - ts.forEach(node.typeArguments, bind); - ts.forEach(node.arguments, bind); + if (expr.kind === 184 /* FunctionExpression */ || expr.kind === 185 /* ArrowFunction */) { + 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; + if (isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) { + currentFlow = createFlowArrayMutation(currentFlow, node); + } } } function getContainerFlags(node) { switch (node.kind) { - case 192 /* ClassExpression */: - case 221 /* ClassDeclaration */: - case 224 /* EnumDeclaration */: - case 171 /* ObjectLiteralExpression */: - case 159 /* TypeLiteral */: - case 281 /* JSDocTypeLiteral */: - case 265 /* JSDocRecordType */: + case 197 /* ClassExpression */: + case 226 /* ClassDeclaration */: + case 229 /* EnumDeclaration */: + case 176 /* ObjectLiteralExpression */: + case 161 /* TypeLiteral */: + case 287 /* JSDocTypeLiteral */: + case 270 /* JSDocRecordType */: return 1 /* IsContainer */; - case 222 /* InterfaceDeclaration */: + case 227 /* InterfaceDeclaration */: return 1 /* IsContainer */ | 64 /* IsInterface */; - case 269 /* JSDocFunctionType */: - case 225 /* ModuleDeclaration */: - case 223 /* TypeAliasDeclaration */: + case 274 /* JSDocFunctionType */: + case 230 /* ModuleDeclaration */: + case 228 /* TypeAliasDeclaration */: + case 170 /* MappedType */: return 1 /* IsContainer */ | 32 /* HasLocals */; - case 256 /* SourceFile */: + case 261 /* SourceFile */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */; - case 148 /* Constructor */: - case 220 /* FunctionDeclaration */: - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - case 151 /* CallSignature */: - case 152 /* ConstructSignature */: - case 153 /* IndexSignature */: - case 156 /* FunctionType */: - case 157 /* ConstructorType */: + case 149 /* MethodDeclaration */: + if (ts.isObjectLiteralOrClassExpressionMethod(node)) { + return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 128 /* IsObjectLiteralOrClassExpressionMethod */; + } + case 150 /* Constructor */: + case 225 /* FunctionDeclaration */: + case 148 /* MethodSignature */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + case 153 /* CallSignature */: + case 154 /* ConstructSignature */: + case 155 /* IndexSignature */: + case 158 /* FunctionType */: + case 159 /* ConstructorType */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */; - case 179 /* FunctionExpression */: - case 180 /* ArrowFunction */: + case 184 /* FunctionExpression */: + case 185 /* ArrowFunction */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 16 /* IsFunctionExpression */; - case 226 /* ModuleBlock */: + case 231 /* ModuleBlock */: return 4 /* IsControlFlowContainer */; - case 145 /* PropertyDeclaration */: + case 147 /* PropertyDeclaration */: return node.initializer ? 4 /* IsControlFlowContainer */ : 0; - case 252 /* CatchClause */: - case 206 /* ForStatement */: - case 207 /* ForInStatement */: - case 208 /* ForOfStatement */: - case 227 /* CaseBlock */: + case 256 /* CatchClause */: + case 211 /* ForStatement */: + case 212 /* ForInStatement */: + case 213 /* ForOfStatement */: + case 232 /* CaseBlock */: return 2 /* IsBlockScopedContainer */; - case 199 /* Block */: + case 204 /* Block */: // do not treat blocks directly inside a function as a block-scoped-container. // Locals that reside in this block should go to the function locals. Otherwise 'x' // would not appear to be a redeclaration of a block scoped local in the following @@ -15624,41 +21680,42 @@ var ts; // members are declared (for example, a member of a class will go into a specific // symbol table depending on if it is static or not). We defer to specialized // handlers to take care of declaring these child members. - case 225 /* ModuleDeclaration */: + case 230 /* ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 256 /* SourceFile */: + case 261 /* SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 192 /* ClassExpression */: - case 221 /* ClassDeclaration */: + case 197 /* ClassExpression */: + case 226 /* ClassDeclaration */: return declareClassMember(node, symbolFlags, symbolExcludes); - case 224 /* EnumDeclaration */: + case 229 /* EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 159 /* TypeLiteral */: - case 171 /* ObjectLiteralExpression */: - case 222 /* InterfaceDeclaration */: - case 265 /* JSDocRecordType */: - case 281 /* JSDocTypeLiteral */: + case 161 /* TypeLiteral */: + case 176 /* ObjectLiteralExpression */: + case 227 /* InterfaceDeclaration */: + case 270 /* JSDocRecordType */: + 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 // object / type / interface declaring them). An exception is type parameters, // which are in scope without qualification (similar to 'locals'). return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 156 /* FunctionType */: - case 157 /* ConstructorType */: - case 151 /* CallSignature */: - case 152 /* ConstructSignature */: - case 153 /* IndexSignature */: - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - case 148 /* Constructor */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - case 220 /* FunctionDeclaration */: - case 179 /* FunctionExpression */: - case 180 /* ArrowFunction */: - case 269 /* JSDocFunctionType */: - case 223 /* TypeAliasDeclaration */: + case 158 /* FunctionType */: + case 159 /* ConstructorType */: + case 153 /* CallSignature */: + case 154 /* ConstructSignature */: + case 155 /* IndexSignature */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + case 150 /* Constructor */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + case 225 /* FunctionDeclaration */: + case 184 /* FunctionExpression */: + case 185 /* ArrowFunction */: + case 274 /* JSDocFunctionType */: + case 228 /* TypeAliasDeclaration */: + case 170 /* MappedType */: // All the children of these container types are never visible through another // symbol (i.e. through another symbol's 'exports' or 'members'). Instead, // they're only accessed 'lexically' (i.e. from code that exists underneath @@ -15669,7 +21726,7 @@ var ts; } } function declareClassMember(node, symbolFlags, symbolExcludes) { - return node.flags & 32 /* Static */ + return ts.hasModifier(node, 32 /* Static */) ? declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes) : declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); } @@ -15679,11 +21736,11 @@ var ts; : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 256 /* SourceFile */ ? node : node.body; - if (body && (body.kind === 256 /* SourceFile */ || body.kind === 226 /* ModuleBlock */)) { + var body = node.kind === 261 /* SourceFile */ ? node : node.body; + if (body && (body.kind === 261 /* SourceFile */ || body.kind === 231 /* ModuleBlock */)) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 236 /* ExportDeclaration */ || stat.kind === 235 /* ExportAssignment */) { + if (stat.kind === 241 /* ExportDeclaration */ || stat.kind === 240 /* ExportAssignment */) { return true; } } @@ -15694,16 +21751,16 @@ var ts; // A declaration source file or ambient module declaration that contains no export declarations (but possibly regular // declarations with export modifiers) is an export context in which declarations are implicitly exported. if (ts.isInAmbientContext(node) && !hasExportDeclarations(node)) { - node.flags |= 8192 /* ExportContext */; + node.flags |= 32 /* ExportContext */; } else { - node.flags &= ~8192 /* ExportContext */; + node.flags &= ~32 /* ExportContext */; } } function bindModuleDeclaration(node) { setExportContextFlag(node); if (ts.isAmbientModule(node)) { - if (node.flags & 1 /* Export */) { + if (ts.hasModifier(node, 1 /* Export */)) { errorOnFirstToken(node, ts.Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible); } if (ts.isExternalModuleAugmentation(node)) { @@ -15776,7 +21833,7 @@ var ts; var seen = ts.createMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.name.kind !== 69 /* Identifier */) { + if (prop.kind === 259 /* SpreadAssignment */ || prop.name.kind !== 70 /* Identifier */) { continue; } var identifier = prop.name; @@ -15788,7 +21845,7 @@ var ts; // c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true. // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields - var currentKind = prop.kind === 253 /* PropertyAssignment */ || prop.kind === 254 /* ShorthandPropertyAssignment */ || prop.kind === 147 /* MethodDeclaration */ + var currentKind = prop.kind === 257 /* PropertyAssignment */ || prop.kind === 258 /* ShorthandPropertyAssignment */ || prop.kind === 149 /* MethodDeclaration */ ? 1 /* Property */ : 2 /* Accessor */; var existingKind = seen[identifier.text]; @@ -15797,8 +21854,8 @@ var ts; continue; } if (currentKind === 1 /* Property */ && existingKind === 1 /* Property */) { - var span = ts.getErrorSpanForNode(file, identifier); - file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode)); + var span_1 = ts.getErrorSpanForNode(file, identifier); + file.bindDiagnostics.push(ts.createFileDiagnostic(file, span_1.start, span_1.length, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode)); } } } @@ -15810,10 +21867,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 225 /* ModuleDeclaration */: + case 230 /* ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 256 /* SourceFile */: + case 261 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -15834,8 +21891,8 @@ var ts; // check for reserved words used as identifiers in strict mode code. function checkStrictModeIdentifier(node) { if (inStrictMode && - node.originalKeywordKind >= 106 /* FirstFutureReservedWord */ && - node.originalKeywordKind <= 114 /* LastFutureReservedWord */ && + node.originalKeywordKind >= 107 /* FirstFutureReservedWord */ && + node.originalKeywordKind <= 115 /* LastFutureReservedWord */ && !ts.isIdentifierName(node) && !ts.isInAmbientContext(node)) { // Report error only if there are no parse errors in file @@ -15871,25 +21928,25 @@ var ts; } function checkStrictModeDeleteExpression(node) { // Grammar checking - if (inStrictMode && node.expression.kind === 69 /* Identifier */) { + if (inStrictMode && node.expression.kind === 70 /* Identifier */) { // When a delete operator occurs within strict mode code, a SyntaxError is thrown if its // UnaryExpression is a direct reference to a variable, function argument, or function name - var span = ts.getErrorSpanForNode(file, node.expression); - file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode)); + var span_2 = ts.getErrorSpanForNode(file, node.expression); + file.bindDiagnostics.push(ts.createFileDiagnostic(file, span_2.start, span_2.length, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode)); } } function isEvalOrArgumentsIdentifier(node) { - return node.kind === 69 /* Identifier */ && + return node.kind === 70 /* Identifier */ && (node.text === "eval" || node.text === "arguments"); } function checkStrictModeEvalOrArguments(contextNode, name) { - if (name && name.kind === 69 /* Identifier */) { + if (name && name.kind === 70 /* Identifier */) { var identifier = name; if (isEvalOrArgumentsIdentifier(identifier)) { // We check first if the name is inside class declaration or class expression; if so give explicit message // otherwise report generic error message. - var span = ts.getErrorSpanForNode(file, name); - file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, getStrictModeEvalOrArgumentsMessage(contextNode), identifier.text)); + var span_3 = ts.getErrorSpanForNode(file, name); + file.bindDiagnostics.push(ts.createFileDiagnostic(file, span_3.start, span_3.length, getStrictModeEvalOrArgumentsMessage(contextNode), identifier.text)); } } } @@ -15922,10 +21979,10 @@ var ts; return ts.Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5; } function checkStrictModeFunctionDeclaration(node) { - if (languageVersion < 2 /* ES6 */) { + if (languageVersion < 2 /* ES2015 */) { // Report error if function is not top level function declaration - if (blockScopeContainer.kind !== 256 /* SourceFile */ && - blockScopeContainer.kind !== 225 /* ModuleDeclaration */ && + if (blockScopeContainer.kind !== 261 /* SourceFile */ && + blockScopeContainer.kind !== 230 /* ModuleDeclaration */ && !ts.isFunctionLike(blockScopeContainer)) { // We check first if the name is inside class declaration or class expression; if so give explicit message // otherwise report generic error message. @@ -15951,7 +22008,7 @@ var ts; function checkStrictModePrefixUnaryExpression(node) { // Grammar checking if (inStrictMode) { - if (node.operator === 41 /* PlusPlusToken */ || node.operator === 42 /* MinusMinusToken */) { + if (node.operator === 42 /* PlusPlusToken */ || node.operator === 43 /* MinusMinusToken */) { checkStrictModeEvalOrArguments(node, node.operand); } } @@ -15991,7 +22048,7 @@ var ts; // the current 'container' node when it changes. This helps us know which symbol table // a local should go into for example. Since terminal nodes are known not to have // children, as an optimization we don't process those. - if (node.kind > 138 /* LastToken */) { + if (node.kind > 140 /* LastToken */) { var saveParent = parent; parent = node; var containerFlags = getContainerFlags(node); @@ -16003,12 +22060,15 @@ var ts; } parent = saveParent; } + else if (!skipTransformFlagAggregation && (node.transformFlags & 536870912 /* HasComputedFlags */) === 0) { + subtreeTransformFlags |= computeTransformFlagsForNode(node, 0); + } inStrictMode = saveInStrictMode; } 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; } @@ -16029,18 +22089,29 @@ var ts; function bindWorker(node) { switch (node.kind) { /* Strict mode checks */ - case 69 /* Identifier */: - case 97 /* ThisKeyword */: - if (currentFlow && (ts.isExpression(node) || parent.kind === 254 /* ShorthandPropertyAssignment */)) { + case 70 /* Identifier */: + // for typedef type names with namespaces, bind the new jsdoc type symbol here + // because it requires all containing namespaces to be in effect, namely the + // current "blockScopeContainer" needs to be set to its immediate namespace parent. + if (node.isInJSDocNamespace) { + var parentNode = node.parent; + while (parentNode && parentNode.kind !== 285 /* JSDocTypedefTag */) { + parentNode = parentNode.parent; + } + bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */); + break; + } + case 98 /* ThisKeyword */: + if (currentFlow && (ts.isExpression(node) || parent.kind === 258 /* ShorthandPropertyAssignment */)) { node.flowNode = currentFlow; } return checkStrictModeIdentifier(node); - case 172 /* PropertyAccessExpression */: + case 177 /* PropertyAccessExpression */: if (currentFlow && isNarrowableReference(node)) { node.flowNode = currentFlow; } break; - case 187 /* BinaryExpression */: + case 192 /* BinaryExpression */: if (ts.isInJavaScriptFile(node)) { var specialKind = ts.getSpecialPropertyAssignmentKind(node); switch (specialKind) { @@ -16064,128 +22135,145 @@ var ts; } } return checkStrictModeBinaryExpression(node); - case 252 /* CatchClause */: + case 256 /* CatchClause */: return checkStrictModeCatchClause(node); - case 181 /* DeleteExpression */: + case 186 /* DeleteExpression */: return checkStrictModeDeleteExpression(node); case 8 /* NumericLiteral */: return checkStrictModeNumericLiteral(node); - case 186 /* PostfixUnaryExpression */: + case 191 /* PostfixUnaryExpression */: return checkStrictModePostfixUnaryExpression(node); - case 185 /* PrefixUnaryExpression */: + case 190 /* PrefixUnaryExpression */: return checkStrictModePrefixUnaryExpression(node); - case 212 /* WithStatement */: + case 217 /* WithStatement */: return checkStrictModeWithStatement(node); - case 165 /* ThisType */: + case 167 /* ThisType */: seenThisKeyword = true; return; - case 154 /* TypePredicate */: + case 156 /* TypePredicate */: return checkTypePredicate(node); - case 141 /* TypeParameter */: + case 143 /* TypeParameter */: return declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 530920 /* TypeParameterExcludes */); - case 142 /* Parameter */: + case 144 /* Parameter */: return bindParameter(node); - case 218 /* VariableDeclaration */: - case 169 /* BindingElement */: + case 223 /* VariableDeclaration */: + case 174 /* BindingElement */: return bindVariableDeclarationOrBindingElement(node); - case 145 /* PropertyDeclaration */: - case 144 /* PropertySignature */: - case 266 /* JSDocRecordMember */: + case 147 /* PropertyDeclaration */: + case 146 /* PropertySignature */: + case 271 /* JSDocRecordMember */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), 0 /* PropertyExcludes */); - case 280 /* JSDocPropertyTag */: + case 286 /* JSDocPropertyTag */: return bindJSDocProperty(node); - case 253 /* PropertyAssignment */: - case 254 /* ShorthandPropertyAssignment */: + case 257 /* PropertyAssignment */: + case 258 /* ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* PropertyExcludes */); - case 255 /* EnumMember */: + case 260 /* EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 900095 /* EnumMemberExcludes */); - case 247 /* JsxSpreadAttribute */: - emitFlags |= 1073741824 /* HasJsxSpreadAttribute */; + case 259 /* SpreadAssignment */: + case 251 /* JsxSpreadAttribute */: + var root = container; + var hasRest = false; + while (root.parent) { + if (root.kind === 176 /* ObjectLiteralExpression */ && + root.parent.kind === 192 /* BinaryExpression */ && + root.parent.operatorToken.kind === 57 /* EqualsToken */ && + root.parent.left === root) { + hasRest = true; + break; + } + root = root.parent; + } return; - case 151 /* CallSignature */: - case 152 /* ConstructSignature */: - case 153 /* IndexSignature */: + case 153 /* CallSignature */: + case 154 /* ConstructSignature */: + case 155 /* IndexSignature */: return declareSymbolAndAddToSymbolTable(node, 131072 /* Signature */, 0 /* None */); - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: // If this is an ObjectLiteralExpression method, then it sits in the same space // as other properties in the object literal. So we use SymbolFlags.PropertyExcludes // so that it will conflict with any other object literal members with the same // name. return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 99263 /* MethodExcludes */); - case 220 /* FunctionDeclaration */: + case 225 /* FunctionDeclaration */: return bindFunctionDeclaration(node); - case 148 /* Constructor */: + case 150 /* Constructor */: return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */); - case 149 /* GetAccessor */: + case 151 /* GetAccessor */: return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 41919 /* GetAccessorExcludes */); - case 150 /* SetAccessor */: + case 152 /* SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */); - case 156 /* FunctionType */: - case 157 /* ConstructorType */: - case 269 /* JSDocFunctionType */: + case 158 /* FunctionType */: + case 159 /* ConstructorType */: + case 274 /* JSDocFunctionType */: return bindFunctionOrConstructorType(node); - case 159 /* TypeLiteral */: - case 281 /* JSDocTypeLiteral */: - case 265 /* JSDocRecordType */: + case 161 /* TypeLiteral */: + case 170 /* MappedType */: + case 287 /* JSDocTypeLiteral */: + case 270 /* JSDocRecordType */: return bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type"); - case 171 /* ObjectLiteralExpression */: + case 176 /* ObjectLiteralExpression */: return bindObjectLiteralExpression(node); - case 179 /* FunctionExpression */: - case 180 /* ArrowFunction */: + case 184 /* FunctionExpression */: + case 185 /* ArrowFunction */: return bindFunctionExpression(node); - case 174 /* CallExpression */: + case 179 /* CallExpression */: if (ts.isInJavaScriptFile(node)) { bindCallExpression(node); } break; // Members of classes, interfaces, and modules - case 192 /* ClassExpression */: - case 221 /* ClassDeclaration */: + case 197 /* ClassExpression */: + case 226 /* ClassDeclaration */: // All classes are automatically in strict mode in ES6. inStrictMode = true; return bindClassLikeDeclaration(node); - case 222 /* InterfaceDeclaration */: + case 227 /* InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* Interface */, 792968 /* InterfaceExcludes */); - case 279 /* JSDocTypedefTag */: - case 223 /* TypeAliasDeclaration */: + case 285 /* JSDocTypedefTag */: + if (!node.fullName || node.fullName.kind === 70 /* Identifier */) { + return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */); + } + break; + case 228 /* TypeAliasDeclaration */: return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793064 /* TypeAliasExcludes */); - case 224 /* EnumDeclaration */: + case 229 /* EnumDeclaration */: return bindEnumDeclaration(node); - case 225 /* ModuleDeclaration */: + case 230 /* ModuleDeclaration */: return bindModuleDeclaration(node); // Imports and exports - case 229 /* ImportEqualsDeclaration */: - case 232 /* NamespaceImport */: - case 234 /* ImportSpecifier */: - case 238 /* ExportSpecifier */: + case 234 /* ImportEqualsDeclaration */: + case 237 /* NamespaceImport */: + case 239 /* ImportSpecifier */: + case 243 /* ExportSpecifier */: return declareSymbolAndAddToSymbolTable(node, 8388608 /* Alias */, 8388608 /* AliasExcludes */); - case 228 /* NamespaceExportDeclaration */: + case 233 /* NamespaceExportDeclaration */: return bindNamespaceExportDeclaration(node); - case 231 /* ImportClause */: + case 236 /* ImportClause */: return bindImportClause(node); - case 236 /* ExportDeclaration */: + case 241 /* ExportDeclaration */: return bindExportDeclaration(node); - case 235 /* ExportAssignment */: + case 240 /* ExportAssignment */: return bindExportAssignment(node); - case 256 /* SourceFile */: + case 261 /* SourceFile */: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 199 /* Block */: + case 204 /* Block */: if (!ts.isFunctionLike(node.parent)) { return; } // Fall through - case 226 /* ModuleBlock */: + case 231 /* ModuleBlock */: return updateStrictModeStatementList(node.statements); } } function checkTypePredicate(node) { var parameterName = node.parameterName, type = node.type; - if (parameterName && parameterName.kind === 69 /* Identifier */) { + if (parameterName && parameterName.kind === 70 /* Identifier */) { checkStrictModeIdentifier(parameterName); } - if (parameterName && parameterName.kind === 165 /* ThisType */) { + if (parameterName && parameterName.kind === 167 /* ThisType */) { seenThisKeyword = true; } bind(type); @@ -16205,27 +22293,30 @@ var ts; bindAnonymousDeclaration(node, 8388608 /* Alias */, getDeclarationName(node)); } else { - var flags = node.kind === 235 /* ExportAssignment */ && ts.exportAssignmentIsAlias(node) + // An export default clause with an expression exports a value + // We want to exclude both class and function here, this is necessary to issue an error when there are both + // default export-assignment and default export function and class declaration. + var flags = node.kind === 240 /* ExportAssignment */ && ts.exportAssignmentIsAlias(node) ? 8388608 /* Alias */ : 4 /* Property */; - declareSymbol(container.symbol.exports, container.symbol, node, flags, 0 /* PropertyExcludes */ | 8388608 /* AliasExcludes */); + declareSymbol(container.symbol.exports, container.symbol, node, flags, 4 /* Property */ | 8388608 /* AliasExcludes */ | 32 /* Class */ | 16 /* Function */); } } function bindNamespaceExportDeclaration(node) { if (node.modifiers && node.modifiers.length) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); } - if (node.parent.kind !== 256 /* SourceFile */) { + if (node.parent.kind !== 261 /* SourceFile */) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); return; } else { - var parent_6 = node.parent; - if (!ts.isExternalModule(parent_6)) { + 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_6.isDeclarationFile) { + if (!parent_4.isDeclarationFile) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files)); return; } @@ -16251,7 +22342,9 @@ var ts; function setCommonJsModuleIndicator(node) { if (!file.commonJsModuleIndicator) { file.commonJsModuleIndicator = node; - bindSourceFileAsExternalModule(); + if (!file.externalModuleIndicator) { + bindSourceFileAsExternalModule(); + } } } function bindExportsPropertyAssignment(node) { @@ -16268,12 +22361,12 @@ var ts; function bindThisPropertyAssignment(node) { ts.Debug.assert(ts.isInJavaScriptFile(node)); // Declare a 'member' if the container is an ES5 class or ES6 constructor - if (container.kind === 220 /* FunctionDeclaration */ || container.kind === 179 /* FunctionExpression */) { + if (container.kind === 225 /* FunctionDeclaration */ || container.kind === 184 /* FunctionExpression */) { container.symbol.members = container.symbol.members || ts.createMap(); // It's acceptable for multiple 'this' assignments of the same identifier to occur declareSymbol(container.symbol.members, container.symbol, node, 4 /* Property */, 0 /* PropertyExcludes */ & ~4 /* Property */); } - else if (container.kind === 148 /* Constructor */) { + else if (container.kind === 150 /* Constructor */) { // this.foo assignment in a JavaScript class // Bind this property to the containing class var saveContainer = container; @@ -16316,15 +22409,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { - if (ts.getClassExtendsHeritageClauseElement(node) !== undefined) { - emitFlags |= 262144 /* HasClassExtends */; - } - if (ts.nodeIsDecorated(node)) { - emitFlags |= 524288 /* HasDecorators */; - } - } - if (node.kind === 221 /* ClassDeclaration */) { + if (node.kind === 226 /* ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* Class */, 899519 /* ClassExcludes */); } else { @@ -16386,11 +22471,6 @@ var ts; } } function bindParameter(node) { - if (!ts.isDeclarationFile(file) && - !ts.isInAmbientContext(node) && - ts.nodeIsDecorated(node)) { - emitFlags |= (524288 /* HasDecorators */ | 1048576 /* HasParamDecorators */); - } if (inStrictMode) { // It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a // strict mode FunctionLikeDeclaration or FunctionExpression(13.1) @@ -16412,7 +22492,7 @@ var ts; function bindFunctionDeclaration(node) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 2097152 /* HasAsyncFunctions */; + emitFlags |= 1024 /* HasAsyncFunctions */; } } checkStrictModeFunctionName(node); @@ -16427,7 +22507,7 @@ var ts; function bindFunctionExpression(node) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 2097152 /* HasAsyncFunctions */; + emitFlags |= 1024 /* HasAsyncFunctions */; } } if (currentFlow) { @@ -16440,12 +22520,12 @@ var ts; function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) { if (!ts.isDeclarationFile(file) && !ts.isInAmbientContext(node)) { if (ts.isAsyncFunctionLike(node)) { - emitFlags |= 2097152 /* HasAsyncFunctions */; - } - if (ts.nodeIsDecorated(node)) { - emitFlags |= 524288 /* HasDecorators */; + emitFlags |= 1024 /* HasAsyncFunctions */; } } + if (currentFlow && ts.isObjectLiteralOrClassExpressionMethod(node)) { + node.flowNode = currentFlow; + } return ts.hasDynamicName(node) ? bindAnonymousDeclaration(node, symbolFlags, "__computed") : declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes); @@ -16463,15 +22543,15 @@ var ts; return false; } if (currentFlow === unreachableFlow) { - var reportError = + var reportError = // report error on all statements except empty ones - (ts.isStatement(node) && node.kind !== 201 /* EmptyStatement */) || + (ts.isStatementButNotDeclaration(node) && node.kind !== 206 /* EmptyStatement */) || // report error on class declarations - node.kind === 221 /* ClassDeclaration */ || + node.kind === 226 /* ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set - (node.kind === 225 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || + (node.kind === 230 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || // report error on regular enums and const enums if preserveConstEnums is set - (node.kind === 224 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + (node.kind === 229 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); if (reportError) { currentFlow = reportedUnreachableFlow; // unreachable code is reported if @@ -16485,8 +22565,8 @@ var ts; // On the other side we do want to report errors on non-initialized 'lets' because of TDZ var reportUnreachableCode = !options.allowUnreachableCode && !ts.isInAmbientContext(node) && - (node.kind !== 200 /* VariableStatement */ || - ts.getCombinedNodeFlags(node.declarationList) & 3072 /* BlockScoped */ || + (node.kind !== 205 /* VariableStatement */ || + ts.getCombinedNodeFlags(node.declarationList) & 3 /* BlockScoped */ || ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); if (reportUnreachableCode) { errorOnFirstToken(node, ts.Diagnostics.Unreachable_code_detected); @@ -16496,11 +22576,1663 @@ var ts; return true; } } + /** + * Computes the transform flags for a node, given the transform flags of its subtree + * + * @param node The node to analyze + * @param subtreeFlags Transform flags computed for this node's subtree + */ + function computeTransformFlagsForNode(node, subtreeFlags) { + var kind = node.kind; + switch (kind) { + case 179 /* CallExpression */: + return computeCallExpression(node, subtreeFlags); + case 180 /* NewExpression */: + return computeNewExpression(node, subtreeFlags); + case 230 /* ModuleDeclaration */: + return computeModuleDeclaration(node, subtreeFlags); + case 183 /* ParenthesizedExpression */: + return computeParenthesizedExpression(node, subtreeFlags); + case 192 /* BinaryExpression */: + return computeBinaryExpression(node, subtreeFlags); + case 207 /* ExpressionStatement */: + return computeExpressionStatement(node, subtreeFlags); + case 144 /* Parameter */: + return computeParameter(node, subtreeFlags); + case 185 /* ArrowFunction */: + return computeArrowFunction(node, subtreeFlags); + case 184 /* FunctionExpression */: + return computeFunctionExpression(node, subtreeFlags); + case 225 /* FunctionDeclaration */: + return computeFunctionDeclaration(node, subtreeFlags); + case 223 /* VariableDeclaration */: + return computeVariableDeclaration(node, subtreeFlags); + case 224 /* VariableDeclarationList */: + return computeVariableDeclarationList(node, subtreeFlags); + case 205 /* VariableStatement */: + return computeVariableStatement(node, subtreeFlags); + case 219 /* LabeledStatement */: + return computeLabeledStatement(node, subtreeFlags); + case 226 /* ClassDeclaration */: + return computeClassDeclaration(node, subtreeFlags); + case 197 /* ClassExpression */: + return computeClassExpression(node, subtreeFlags); + case 255 /* HeritageClause */: + return computeHeritageClause(node, subtreeFlags); + case 256 /* CatchClause */: + return computeCatchClause(node, subtreeFlags); + case 199 /* ExpressionWithTypeArguments */: + return computeExpressionWithTypeArguments(node, subtreeFlags); + case 150 /* Constructor */: + return computeConstructor(node, subtreeFlags); + case 147 /* PropertyDeclaration */: + return computePropertyDeclaration(node, subtreeFlags); + case 149 /* MethodDeclaration */: + return computeMethod(node, subtreeFlags); + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + return computeAccessor(node, subtreeFlags); + case 234 /* ImportEqualsDeclaration */: + return computeImportEquals(node, subtreeFlags); + case 177 /* PropertyAccessExpression */: + return computePropertyAccess(node, subtreeFlags); + default: + return computeOther(node, kind, subtreeFlags); + } + } + ts.computeTransformFlagsForNode = computeTransformFlagsForNode; + function computeCallExpression(node, subtreeFlags) { + var transformFlags = subtreeFlags; + var expression = node.expression; + var expressionKind = expression.kind; + if (node.typeArguments) { + transformFlags |= 3 /* AssertTypeScript */; + } + 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 |= 192 /* AssertES2015 */; + } + node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; + return transformFlags & ~537396545 /* ArrayLiteralOrCallOrNewExcludes */; + } + function isSuperOrSuperProperty(node, kind) { + switch (kind) { + case 96 /* SuperKeyword */: + return true; + case 177 /* PropertyAccessExpression */: + case 178 /* ElementAccessExpression */: + var expression = node.expression; + var expressionKind = expression.kind; + return expressionKind === 96 /* SuperKeyword */; + } + return false; + } + function computeNewExpression(node, subtreeFlags) { + var transformFlags = subtreeFlags; + if (node.typeArguments) { + transformFlags |= 3 /* AssertTypeScript */; + } + if (subtreeFlags & 524288 /* ContainsSpread */) { + // If the this node contains a SpreadElementExpression then it is an ES6 + // node. + transformFlags |= 192 /* AssertES2015 */; + } + node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; + return transformFlags & ~537396545 /* ArrayLiteralOrCallOrNewExcludes */; + } + function computeBinaryExpression(node, subtreeFlags) { + var transformFlags = subtreeFlags; + var operatorTokenKind = node.operatorToken.kind; + var leftKind = node.left.kind; + if (operatorTokenKind === 57 /* EqualsToken */ && leftKind === 176 /* ObjectLiteralExpression */) { + // Destructuring object assignments with are ES2015 syntax + // and possibly ESNext if they contain rest + transformFlags |= 8 /* AssertESNext */ | 192 /* AssertES2015 */ | 3072 /* AssertDestructuringAssignment */; + } + else if (operatorTokenKind === 57 /* EqualsToken */ && leftKind === 175 /* ArrayLiteralExpression */) { + // Destructuring assignments are ES2015 syntax. + transformFlags |= 192 /* AssertES2015 */ | 3072 /* AssertDestructuringAssignment */; + } + else if (operatorTokenKind === 39 /* AsteriskAsteriskToken */ + || operatorTokenKind === 61 /* AsteriskAsteriskEqualsToken */) { + // Exponentiation is ES2016 syntax. + transformFlags |= 32 /* AssertES2016 */; + } + node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; + return transformFlags & ~536872257 /* NodeExcludes */; + } + function computeParameter(node, subtreeFlags) { + var transformFlags = subtreeFlags; + var modifierFlags = ts.getModifierFlags(node); + var name = node.name; + var initializer = node.initializer; + var dotDotDotToken = node.dotDotDotToken; + // The '?' token, type annotations, decorators, and 'this' parameters are TypeSCript + // syntax. + if (node.questionToken + || node.type + || 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 */ | 262144 /* ContainsParameterPropertyAssignments */; + } + // parameters with object rest destructuring are ES Next syntax + 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 & 8388608 /* ContainsBindingPattern */ || initializer || dotDotDotToken) { + transformFlags |= 192 /* AssertES2015 */ | 131072 /* ContainsDefaultValueAssignments */; + } + node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; + return transformFlags & ~536872257 /* ParameterExcludes */; + } + function computeParenthesizedExpression(node, subtreeFlags) { + var transformFlags = subtreeFlags; + var expression = node.expression; + var expressionKind = expression.kind; + var expressionTransformFlags = expression.transformFlags; + // If the node is synthesized, it means the emitter put the parentheses there, + // not the user. If we didn't want them, the emitter would not have put them + // there. + if (expressionKind === 200 /* AsExpression */ + || expressionKind === 182 /* TypeAssertionExpression */) { + transformFlags |= 3 /* AssertTypeScript */; + } + // If the expression of a ParenthesizedExpression is a destructuring assignment, + // then the ParenthesizedExpression is a destructuring assignment. + if (expressionTransformFlags & 1024 /* DestructuringAssignment */) { + transformFlags |= 1024 /* DestructuringAssignment */; + } + node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; + return transformFlags & ~536872257 /* NodeExcludes */; + } + function computeClassDeclaration(node, subtreeFlags) { + var transformFlags; + var modifierFlags = ts.getModifierFlags(node); + if (modifierFlags & 2 /* Ambient */) { + // An ambient declaration is TypeScript syntax. + transformFlags = 3 /* AssertTypeScript */; + } + else { + // A ClassDeclaration is ES6 syntax. + 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 & 274432 /* TypeScriptClassSyntaxMask */) + || node.typeParameters) { + transformFlags |= 3 /* AssertTypeScript */; + } + if (subtreeFlags & 65536 /* ContainsLexicalThisInComputedPropertyName */) { + // A computed property name containing `this` might need to be rewritten, + // so propagate the ContainsLexicalThis flag upward. + transformFlags |= 16384 /* ContainsLexicalThis */; + } + } + node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; + return transformFlags & ~539358529 /* ClassExcludes */; + } + function computeClassExpression(node, subtreeFlags) { + // A ClassExpression is ES6 syntax. + var transformFlags = subtreeFlags | 192 /* AssertES2015 */; + // A class with a parameter property assignment, property initializer, or decorator is + // TypeScript syntax. + if (subtreeFlags & 274432 /* TypeScriptClassSyntaxMask */ + || node.typeParameters) { + transformFlags |= 3 /* AssertTypeScript */; + } + if (subtreeFlags & 65536 /* ContainsLexicalThisInComputedPropertyName */) { + // A computed property name containing `this` might need to be rewritten, + // so propagate the ContainsLexicalThis flag upward. + transformFlags |= 16384 /* ContainsLexicalThis */; + } + node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; + return transformFlags & ~539358529 /* ClassExcludes */; + } + function computeHeritageClause(node, subtreeFlags) { + var transformFlags = subtreeFlags; + switch (node.token) { + case 84 /* ExtendsKeyword */: + // An `extends` HeritageClause is ES6 syntax. + transformFlags |= 192 /* AssertES2015 */; + break; + case 107 /* ImplementsKeyword */: + // An `implements` HeritageClause is TypeScript syntax. + transformFlags |= 3 /* AssertTypeScript */; + break; + default: + ts.Debug.fail("Unexpected token for heritage clause"); + break; + } + node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; + return transformFlags & ~536872257 /* NodeExcludes */; + } + function computeCatchClause(node, subtreeFlags) { + var transformFlags = subtreeFlags; + if (node.variableDeclaration && ts.isBindingPattern(node.variableDeclaration.name)) { + transformFlags |= 192 /* AssertES2015 */; + } + node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; + 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 | 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 & ~536872257 /* NodeExcludes */; + } + function computeConstructor(node, subtreeFlags) { + var transformFlags = subtreeFlags; + // TypeScript-specific modifiers and overloads are TypeScript syntax + if (ts.hasModifier(node, 2270 /* TypeScriptModifier */) + || !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 & ~601015617 /* ConstructorExcludes */; + } + function computeMethod(node, subtreeFlags) { + // A MethodDeclaration is ES6 syntax. + var transformFlags = subtreeFlags | 192 /* AssertES2015 */; + // Decorators, TypeScript-specific modifiers, type parameters, type annotations, and + // overloads are TypeScript syntax. + if (node.decorators + || ts.hasModifier(node, 2270 /* TypeScriptModifier */) + || node.typeParameters + || node.type + || !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 |= 16 /* AssertES2017 */; + } + // Currently, we only support generators that were originally async function bodies. + if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) { + transformFlags |= 768 /* AssertGenerator */; + } + node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; + return transformFlags & ~601015617 /* MethodOrAccessorExcludes */; + } + function computeAccessor(node, subtreeFlags) { + var transformFlags = subtreeFlags; + // Decorators, TypeScript-specific modifiers, type annotations, and overloads are + // TypeScript syntax. + if (node.decorators + || ts.hasModifier(node, 2270 /* TypeScriptModifier */) + || node.type + || !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 & ~601015617 /* MethodOrAccessorExcludes */; + } + function computePropertyDeclaration(node, subtreeFlags) { + // A PropertyDeclaration is TypeScript syntax. + var transformFlags = subtreeFlags | 3 /* AssertTypeScript */; + // If the PropertyDeclaration has an initializer, we need to inform its ancestor + // so that it handle the transformation. + if (node.initializer) { + transformFlags |= 8192 /* ContainsPropertyInitializer */; + } + node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; + return transformFlags & ~536872257 /* NodeExcludes */; + } + function computeFunctionDeclaration(node, subtreeFlags) { + var transformFlags; + var modifierFlags = ts.getModifierFlags(node); + var body = node.body; + if (!body || (modifierFlags & 2 /* Ambient */)) { + // An ambient declaration is TypeScript syntax. + // A FunctionDeclaration without a body is an overload and is TypeScript syntax. + transformFlags = 3 /* AssertTypeScript */; + } + else { + transformFlags = subtreeFlags | 33554432 /* ContainsHoistedDeclarationOrCompletion */; + // TypeScript-specific modifiers, type parameters, and type annotations are TypeScript + // syntax. + if (modifierFlags & 2270 /* TypeScriptModifier */ + || node.typeParameters + || node.type) { + transformFlags |= 3 /* AssertTypeScript */; + } + // An async function declaration is ES2017 syntax. + if (modifierFlags & 256 /* Async */) { + transformFlags |= 16 /* AssertES2017 */; + } + // function declarations with object rest destructuring are ES Next syntax + 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 & 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) & 131072 /* AsyncFunctionBody */) { + transformFlags |= 768 /* AssertGenerator */; + } + } + node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; + return transformFlags & ~601281857 /* FunctionExcludes */; + } + function computeFunctionExpression(node, subtreeFlags) { + var transformFlags = subtreeFlags; + // TypeScript-specific modifiers, type parameters, and type annotations are TypeScript + // syntax. + if (ts.hasModifier(node, 2270 /* TypeScriptModifier */) + || node.typeParameters + || node.type) { + transformFlags |= 3 /* AssertTypeScript */; + } + // An async function expression is ES2017 syntax. + if (ts.hasModifier(node, 256 /* Async */)) { + transformFlags |= 16 /* AssertES2017 */; + } + // function expressions with object rest destructuring are ES Next syntax + 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 & 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) & 131072 /* AsyncFunctionBody */) { + transformFlags |= 768 /* AssertGenerator */; + } + node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; + 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 | 192 /* AssertES2015 */; + // TypeScript-specific modifiers, type parameters, and type annotations are TypeScript + // syntax. + if (ts.hasModifier(node, 2270 /* TypeScriptModifier */) + || node.typeParameters + || node.type) { + transformFlags |= 3 /* AssertTypeScript */; + } + // An async arrow function is ES2017 syntax. + if (ts.hasModifier(node, 256 /* Async */)) { + transformFlags |= 16 /* AssertES2017 */; + } + // arrow functions with object rest destructuring are ES Next syntax + if (subtreeFlags & 1048576 /* ContainsObjectRest */) { + transformFlags |= 8 /* AssertESNext */; + } + // If an ArrowFunction contains a lexical this, its container must capture the lexical this. + if (subtreeFlags & 16384 /* ContainsLexicalThis */) { + transformFlags |= 32768 /* ContainsCapturedLexicalThis */; + } + node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; + return transformFlags & ~601249089 /* ArrowFunctionExcludes */; + } + function computePropertyAccess(node, subtreeFlags) { + var transformFlags = subtreeFlags; + var expression = node.expression; + var expressionKind = expression.kind; + // If a PropertyAccessExpression starts with a super keyword, then it is + // ES6 syntax, and requires a lexical `this` binding. + if (expressionKind === 96 /* SuperKeyword */) { + transformFlags |= 16384 /* ContainsLexicalThis */; + } + node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; + return transformFlags & ~536872257 /* NodeExcludes */; + } + function computeVariableDeclaration(node, subtreeFlags) { + var transformFlags = subtreeFlags; + 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 & ~536872257 /* NodeExcludes */; + } + function computeVariableStatement(node, subtreeFlags) { + var transformFlags; + var modifierFlags = ts.getModifierFlags(node); + var declarationListTransformFlags = node.declarationList.transformFlags; + // An ambient declaration is TypeScript syntax. + if (modifierFlags & 2 /* Ambient */) { + transformFlags = 3 /* AssertTypeScript */; + } + else { + transformFlags = subtreeFlags; + if (declarationListTransformFlags & 8388608 /* ContainsBindingPattern */) { + transformFlags |= 192 /* AssertES2015 */; + } + } + node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; + 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 & 4194304 /* ContainsBlockScopedBinding */ + && ts.isIterationStatement(node, /*lookInLabeledStatements*/ true)) { + transformFlags |= 192 /* AssertES2015 */; + } + node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; + return transformFlags & ~536872257 /* NodeExcludes */; + } + function computeImportEquals(node, subtreeFlags) { + var transformFlags = subtreeFlags; + // An ImportEqualsDeclaration with a namespace reference is TypeScript. + if (!ts.isExternalModuleImportEqualsDeclaration(node)) { + transformFlags |= 3 /* AssertTypeScript */; + } + node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; + 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 & 1024 /* DestructuringAssignment */) { + transformFlags |= 192 /* AssertES2015 */; + } + node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; + return transformFlags & ~536872257 /* NodeExcludes */; + } + function computeModuleDeclaration(node, subtreeFlags) { + var transformFlags = 3 /* AssertTypeScript */; + var modifierFlags = ts.getModifierFlags(node); + if ((modifierFlags & 2 /* Ambient */) === 0) { + transformFlags |= subtreeFlags; + } + node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; + return transformFlags & ~574674241 /* ModuleExcludes */; + } + function computeVariableDeclarationList(node, subtreeFlags) { + 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 |= 192 /* AssertES2015 */ | 4194304 /* ContainsBlockScopedBinding */; + } + node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; + return transformFlags & ~546309441 /* VariableDeclarationListExcludes */; + } + function computeOther(node, kind, subtreeFlags) { + // Mark transformations needed for each node + var transformFlags = subtreeFlags; + var excludeFlags = 536872257 /* NodeExcludes */; + switch (kind) { + case 119 /* AsyncKeyword */: + case 189 /* AwaitExpression */: + // async/await is ES2017 syntax + transformFlags |= 16 /* AssertES2017 */; + break; + case 113 /* PublicKeyword */: + case 111 /* PrivateKeyword */: + case 112 /* ProtectedKeyword */: + case 116 /* AbstractKeyword */: + case 123 /* DeclareKeyword */: + case 75 /* ConstKeyword */: + case 229 /* EnumDeclaration */: + case 260 /* EnumMember */: + case 182 /* TypeAssertionExpression */: + case 200 /* AsExpression */: + case 201 /* NonNullExpression */: + case 130 /* ReadonlyKeyword */: + // These nodes are TypeScript syntax. + transformFlags |= 3 /* AssertTypeScript */; + break; + case 246 /* JsxElement */: + case 247 /* JsxSelfClosingElement */: + case 248 /* JsxOpeningElement */: + case 10 /* JsxText */: + case 249 /* JsxClosingElement */: + case 250 /* JsxAttribute */: + case 251 /* JsxSpreadAttribute */: + case 252 /* JsxExpression */: + // These nodes are Jsx syntax. + transformFlags |= 4 /* AssertJsx */; + break; + case 213 /* ForOfStatement */: + // for-of might be ESNext if it has a rest destructuring + transformFlags |= 8 /* AssertESNext */; + // FALLTHROUGH + case 12 /* NoSubstitutionTemplateLiteral */: + case 13 /* TemplateHead */: + case 14 /* TemplateMiddle */: + case 15 /* TemplateTail */: + case 194 /* TemplateExpression */: + case 181 /* TaggedTemplateExpression */: + case 258 /* ShorthandPropertyAssignment */: + case 114 /* StaticKeyword */: + // These nodes are ES6 syntax. + transformFlags |= 192 /* AssertES2015 */; + break; + case 195 /* YieldExpression */: + // This node is ES6 syntax. + transformFlags |= 192 /* AssertES2015 */ | 16777216 /* ContainsYield */; + break; + case 118 /* AnyKeyword */: + case 132 /* NumberKeyword */: + case 129 /* NeverKeyword */: + case 134 /* StringKeyword */: + case 121 /* BooleanKeyword */: + case 135 /* SymbolKeyword */: + case 104 /* VoidKeyword */: + case 143 /* TypeParameter */: + case 146 /* PropertySignature */: + case 148 /* MethodSignature */: + case 153 /* CallSignature */: + case 154 /* ConstructSignature */: + case 155 /* IndexSignature */: + case 156 /* TypePredicate */: + case 157 /* TypeReference */: + case 158 /* FunctionType */: + case 159 /* ConstructorType */: + case 160 /* TypeQuery */: + case 161 /* TypeLiteral */: + case 162 /* ArrayType */: + case 163 /* TupleType */: + case 164 /* UnionType */: + case 165 /* IntersectionType */: + case 166 /* ParenthesizedType */: + case 227 /* InterfaceDeclaration */: + case 228 /* TypeAliasDeclaration */: + case 167 /* ThisType */: + case 168 /* TypeOperator */: + case 169 /* IndexedAccessType */: + case 170 /* MappedType */: + case 171 /* LiteralType */: + // Types and signatures are TypeScript syntax, and exclude all other facts. + transformFlags = 3 /* AssertTypeScript */; + excludeFlags = -3 /* TypeExcludes */; + break; + case 142 /* ComputedPropertyName */: + // 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 |= 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`), + // whereas `this` inside a computed name *might* need to be rewritten if the class/object + // is inside an arrow function: + // `_this = this; () => class K { [_this.getName()]() { ... } }` + // To make this distinction, use ContainsLexicalThisInComputedPropertyName + // instead of ContainsLexicalThis for computed property names + transformFlags |= 65536 /* ContainsLexicalThisInComputedPropertyName */; + } + break; + case 196 /* SpreadElement */: + transformFlags |= 192 /* AssertES2015 */ | 524288 /* ContainsSpread */; + break; + case 259 /* SpreadAssignment */: + transformFlags |= 8 /* AssertESNext */ | 1048576 /* ContainsObjectSpread */; + break; + case 96 /* SuperKeyword */: + // This node is ES6 syntax. + transformFlags |= 192 /* AssertES2015 */; + break; + case 98 /* ThisKeyword */: + // Mark this node and its ancestors as containing a lexical `this` keyword. + transformFlags |= 16384 /* ContainsLexicalThis */; + break; + case 172 /* ObjectBindingPattern */: + transformFlags |= 192 /* AssertES2015 */ | 8388608 /* ContainsBindingPattern */; + if (subtreeFlags & 524288 /* ContainsRest */) { + transformFlags |= 8 /* AssertESNext */ | 1048576 /* ContainsObjectRest */; + } + 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 */ | 4096 /* ContainsDecorators */; + break; + case 176 /* ObjectLiteralExpression */: + excludeFlags = 540087617 /* ObjectLiteralExcludes */; + if (subtreeFlags & 2097152 /* ContainsComputedPropertyName */) { + // If an ObjectLiteralExpression contains a ComputedPropertyName, then it + // is an ES6 node. + transformFlags |= 192 /* AssertES2015 */; + } + if (subtreeFlags & 65536 /* ContainsLexicalThisInComputedPropertyName */) { + // A computed property name containing `this` might need to be rewritten, + // so propagate the ContainsLexicalThis flag upward. + transformFlags |= 16384 /* ContainsLexicalThis */; + } + if (subtreeFlags & 1048576 /* ContainsObjectSpread */) { + // If an ObjectLiteralExpression contains a spread element, then it + // is an ES next node. + transformFlags |= 8 /* AssertESNext */; + } + break; + case 175 /* ArrayLiteralExpression */: + case 180 /* NewExpression */: + excludeFlags = 537396545 /* ArrayLiteralOrCallOrNewExcludes */; + if (subtreeFlags & 524288 /* ContainsSpread */) { + // If the this node contains a SpreadExpression, then it is an ES6 + // node. + transformFlags |= 192 /* AssertES2015 */; + } + break; + case 209 /* DoStatement */: + case 210 /* WhileStatement */: + case 211 /* ForStatement */: + case 212 /* ForInStatement */: + // A loop containing a block scoped binding *may* need to be transformed from ES6. + if (subtreeFlags & 4194304 /* ContainsBlockScopedBinding */) { + transformFlags |= 192 /* AssertES2015 */; + } + break; + case 261 /* SourceFile */: + if (subtreeFlags & 32768 /* ContainsCapturedLexicalThis */) { + transformFlags |= 192 /* AssertES2015 */; + } + break; + case 216 /* ReturnStatement */: + case 214 /* ContinueStatement */: + case 215 /* BreakStatement */: + transformFlags |= 33554432 /* ContainsHoistedDeclarationOrCompletion */; + break; + } + node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */; + return transformFlags & ~excludeFlags; + } + /** + * Gets the transform flags to exclude when unioning the transform flags of a subtree. + * + * NOTE: This needs to be kept up-to-date with the exclusions used in `computeTransformFlagsForNode`. + * For performance reasons, `computeTransformFlagsForNode` uses local constant values rather + * than calling this function. + */ + /* @internal */ + function getTransformFlagsSubtreeExclusions(kind) { + if (kind >= 156 /* FirstTypeNode */ && kind <= 171 /* LastTypeNode */) { + return -3 /* TypeExcludes */; + } + switch (kind) { + case 179 /* CallExpression */: + case 180 /* NewExpression */: + case 175 /* ArrayLiteralExpression */: + return 537396545 /* ArrayLiteralOrCallOrNewExcludes */; + case 230 /* ModuleDeclaration */: + return 574674241 /* ModuleExcludes */; + case 144 /* Parameter */: + return 536872257 /* ParameterExcludes */; + case 185 /* ArrowFunction */: + return 601249089 /* ArrowFunctionExcludes */; + case 184 /* FunctionExpression */: + case 225 /* FunctionDeclaration */: + return 601281857 /* FunctionExcludes */; + case 224 /* VariableDeclarationList */: + return 546309441 /* VariableDeclarationListExcludes */; + case 226 /* ClassDeclaration */: + case 197 /* ClassExpression */: + return 539358529 /* ClassExcludes */; + case 150 /* Constructor */: + return 601015617 /* ConstructorExcludes */; + case 149 /* MethodDeclaration */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + return 601015617 /* MethodOrAccessorExcludes */; + case 118 /* AnyKeyword */: + case 132 /* NumberKeyword */: + case 129 /* NeverKeyword */: + case 134 /* StringKeyword */: + case 121 /* BooleanKeyword */: + case 135 /* SymbolKeyword */: + case 104 /* VoidKeyword */: + case 143 /* TypeParameter */: + case 146 /* PropertySignature */: + case 148 /* MethodSignature */: + case 153 /* CallSignature */: + case 154 /* ConstructSignature */: + case 155 /* IndexSignature */: + case 227 /* InterfaceDeclaration */: + case 228 /* TypeAliasDeclaration */: + return -3 /* TypeExcludes */; + case 176 /* ObjectLiteralExpression */: + return 540087617 /* ObjectLiteralExcludes */; + case 256 /* CatchClause */: + return 537920833 /* CatchClauseExcludes */; + case 172 /* ObjectBindingPattern */: + case 173 /* ArrayBindingPattern */: + return 537396545 /* BindingPatternExcludes */; + default: + return 536872257 /* NodeExcludes */; + } + } + ts.getTransformFlagsSubtreeExclusions = getTransformFlagsSubtreeExclusions; })(ts || (ts = {})); +/// +/// +var ts; +(function (ts) { + function trace(host) { + host.trace(ts.formatMessage.apply(undefined, arguments)); + } + ts.trace = trace; + /* @internal */ + function isTraceEnabled(compilerOptions, host) { + return compilerOptions.traceResolution && host.trace !== undefined; + } + ts.isTraceEnabled = isTraceEnabled; + /** + * Kinds of file that we are currently looking for. + * Typically there is one pass with Extensions.TypeScript, then a second pass with Extensions.JavaScript. + */ + var Extensions; + (function (Extensions) { + Extensions[Extensions["TypeScript"] = 0] = "TypeScript"; + Extensions[Extensions["JavaScript"] = 1] = "JavaScript"; + Extensions[Extensions["DtsOnly"] = 2] = "DtsOnly"; /** Only '.d.ts' */ + })(Extensions || (Extensions = {})); + /** Used with `Extensions.DtsOnly` to extract the path from TypeScript results. */ + function resolvedTypeScriptOnly(resolved) { + if (!resolved) { + return undefined; + } + ts.Debug.assert(ts.extensionIsTypeScript(resolved.extension)); + return resolved.path; + } + /** Adds `isExernalLibraryImport` to a Resolved to get a ResolvedModule. */ + function resolvedModuleFromResolved(_a, isExternalLibraryImport) { + var path = _a.path, extension = _a.extension; + return { resolvedFileName: path, extension: extension, isExternalLibraryImport: isExternalLibraryImport }; + } + function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations) { + return { resolvedModule: resolved && resolvedModuleFromResolved(resolved, isExternalLibraryImport), failedLookupLocations: failedLookupLocations }; + } + function moduleHasNonRelativeName(moduleName) { + return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName)); + } + ts.moduleHasNonRelativeName = moduleHasNonRelativeName; + /** Reads from "main" or "types"/"typings" depending on `extensions`. */ + function tryReadPackageJsonMainOrTypes(extensions, packageJsonPath, baseDirectory, state) { + var jsonContent = readJson(packageJsonPath, state.host); + switch (extensions) { + case 2 /* DtsOnly */: + case 0 /* TypeScript */: + return tryReadFromField("typings") || tryReadFromField("types"); + case 1 /* JavaScript */: + return tryReadFromField("main"); + } + function tryReadFromField(fieldName) { + if (ts.hasProperty(jsonContent, fieldName)) { + var typesFile = jsonContent[fieldName]; + if (typeof typesFile === "string") { + var typesFilePath = ts.normalizePath(ts.combinePaths(baseDirectory, typesFile)); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, typesFile, typesFilePath); + } + return typesFilePath; + } + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, fieldName, typeof typesFile); + } + } + } + } + } + function readJson(path, host) { + try { + var jsonText = host.readFile(path); + return jsonText ? JSON.parse(jsonText) : {}; + } + catch (e) { + // gracefully handle if readFile fails or returns not JSON + return {}; + } + } + function getEffectiveTypeRoots(options, host) { + if (options.typeRoots) { + return options.typeRoots; + } + var currentDirectory; + if (options.configFilePath) { + currentDirectory = ts.getDirectoryPath(options.configFilePath); + } + else if (host.getCurrentDirectory) { + currentDirectory = host.getCurrentDirectory(); + } + if (currentDirectory !== undefined) { + return getDefaultTypeRoots(currentDirectory, host); + } + } + ts.getEffectiveTypeRoots = getEffectiveTypeRoots; + /** + * Returns the path to every node_modules/@types directory from some ancestor directory. + * Returns undefined if there are none. + */ + function getDefaultTypeRoots(currentDirectory, host) { + if (!host.directoryExists) { + return [ts.combinePaths(currentDirectory, nodeModulesAtTypes)]; + } + var typeRoots; + forEachAncestorDirectory(currentDirectory, function (directory) { + var atTypes = ts.combinePaths(directory, nodeModulesAtTypes); + if (host.directoryExists(atTypes)) { + (typeRoots || (typeRoots = [])).push(atTypes); + } + return undefined; + }); + return typeRoots; + } + var nodeModulesAtTypes = ts.combinePaths("node_modules", "@types"); + /** + * @param {string | undefined} containingFile - file that contains type reference directive, can be undefined if containing file is unknown. + * This is possible in case if resolution is performed for directives specified via 'types' parameter. In this case initial path for secondary lookups + * is assumed to be the same as root directory of the project. + */ + function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host) { + var traceEnabled = isTraceEnabled(options, host); + var moduleResolutionState = { + compilerOptions: options, + host: host, + traceEnabled: traceEnabled + }; + var typeRoots = getEffectiveTypeRoots(options, host); + if (traceEnabled) { + if (containingFile === undefined) { + if (typeRoots === undefined) { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set, typeReferenceDirectiveName); + } + else { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1, typeReferenceDirectiveName, typeRoots); + } + } + else { + if (typeRoots === undefined) { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set, typeReferenceDirectiveName, containingFile); + } + else { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_2, typeReferenceDirectiveName, containingFile, typeRoots); + } + } + } + var failedLookupLocations = []; + var resolved = primaryLookup(); + var primary = true; + if (!resolved) { + resolved = secondaryLookup(); + primary = false; + } + var resolvedTypeReferenceDirective; + if (resolved) { + resolved = realpath(resolved, host, traceEnabled); + if (traceEnabled) { + trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolved, primary); + } + resolvedTypeReferenceDirective = { primary: primary, resolvedFileName: resolved }; + } + return { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations }; + function primaryLookup() { + // Check primary library paths + if (typeRoots && typeRoots.length) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolving_with_primary_search_path_0, typeRoots.join(", ")); + } + return ts.forEach(typeRoots, function (typeRoot) { + var candidate = ts.combinePaths(typeRoot, typeReferenceDirectiveName); + var candidateDirectory = ts.getDirectoryPath(candidate); + return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(2 /* DtsOnly */, candidate, failedLookupLocations, !directoryProbablyExists(candidateDirectory, host), moduleResolutionState)); + }); + } + else { + if (traceEnabled) { + trace(host, ts.Diagnostics.Root_directory_cannot_be_determined_skipping_primary_search_paths); + } + } + } + function secondaryLookup() { + var resolvedFile; + var initialLocationForSecondaryLookup = containingFile && ts.getDirectoryPath(containingFile); + if (initialLocationForSecondaryLookup !== undefined) { + // check secondary locations + if (traceEnabled) { + trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup); + } + var result = loadModuleFromNodeModules(2 /* DtsOnly */, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState, /*cache*/ undefined); + resolvedFile = resolvedTypeScriptOnly(result && result.value); + if (!resolvedFile && traceEnabled) { + trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName); + } + return resolvedFile; + } + else { + if (traceEnabled) { + trace(host, ts.Diagnostics.Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder); + } + } + } + } + ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective; + /** + * Given a set of options, returns the set of type directive names + * that should be included for this program automatically. + * This list could either come from the config file, + * or from enumerating the types root + initial secondary types lookup location. + * More type directives might appear in the program later as a result of loading actual source files; + * this list is only the set of defaults that are implicitly included. + */ + function getAutomaticTypeDirectiveNames(options, host) { + // Use explicit type list from tsconfig.json + if (options.types) { + return options.types; + } + // Walk the primary type lookup locations + var result = []; + if (host.directoryExists && host.getDirectories) { + var typeRoots = getEffectiveTypeRoots(options, host); + if (typeRoots) { + for (var _i = 0, typeRoots_1 = typeRoots; _i < typeRoots_1.length; _i++) { + var root = typeRoots_1[_i]; + if (host.directoryExists(root)) { + for (var _a = 0, _b = host.getDirectories(root); _a < _b.length; _a++) { + var typeDirectivePath = _b[_a]; + var normalized = ts.normalizePath(typeDirectivePath); + var packageJsonPath = pathToPackageJson(ts.combinePaths(root, normalized)); + // tslint:disable-next-line:no-null-keyword + var isNotNeededPackage = host.fileExists(packageJsonPath) && readJson(packageJsonPath, host).typings === null; + if (!isNotNeededPackage) { + // Return just the type directive names + result.push(ts.getBaseFileName(normalized)); + } + } + } + } + } + } + return result; + } + ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames; + function createModuleResolutionCache(currentDirectory, getCanonicalFileName) { + var directoryToModuleNameMap = ts.createFileMap(); + var moduleNameToDirectoryMap = ts.createMap(); + return { getOrCreateCacheForDirectory: getOrCreateCacheForDirectory, getOrCreateCacheForModuleName: getOrCreateCacheForModuleName }; + function getOrCreateCacheForDirectory(directoryName) { + var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName); + var perFolderCache = directoryToModuleNameMap.get(path); + if (!perFolderCache) { + perFolderCache = ts.createMap(); + directoryToModuleNameMap.set(path, perFolderCache); + } + return perFolderCache; + } + function getOrCreateCacheForModuleName(nonRelativeModuleName) { + if (!moduleHasNonRelativeName(nonRelativeModuleName)) { + return undefined; + } + var perModuleNameCache = moduleNameToDirectoryMap[nonRelativeModuleName]; + if (!perModuleNameCache) { + moduleNameToDirectoryMap[nonRelativeModuleName] = perModuleNameCache = createPerModuleNameCache(); + } + return perModuleNameCache; + } + function createPerModuleNameCache() { + var directoryPathMap = ts.createFileMap(); + return { get: get, set: set }; + function get(directory) { + return directoryPathMap.get(ts.toPath(directory, currentDirectory, getCanonicalFileName)); + } + /** + * At first this function add entry directory -> module resolution result to the table. + * Then it computes the set of parent folders for 'directory' that should have the same module resolution result + * and for every parent folder in set it adds entry: parent -> module resolution. . + * Lets say we first directory name: /a/b/c/d/e and resolution result is: /a/b/bar.ts. + * Set of parent folders that should have the same result will be: + * [ + * /a/b/c/d, /a/b/c, /a/b + * ] + * this means that request for module resolution from file in any of these folder will be immediately found in cache. + */ + function set(directory, result) { + var path = ts.toPath(directory, currentDirectory, getCanonicalFileName); + // if entry is already in cache do nothing + if (directoryPathMap.contains(path)) { + return; + } + directoryPathMap.set(path, result); + var resolvedFileName = result.resolvedModule && result.resolvedModule.resolvedFileName; + // find common prefix between directory and resolved file name + // this common prefix should be the shorted path that has the same resolution + // directory: /a/b/c/d/e + // resolvedFileName: /a/b/foo.d.ts + var commonPrefix = getCommonPrefix(path, resolvedFileName); + var current = path; + while (true) { + var parent_5 = ts.getDirectoryPath(current); + if (parent_5 === current || directoryPathMap.contains(parent_5)) { + break; + } + directoryPathMap.set(parent_5, result); + current = parent_5; + if (current == commonPrefix) { + break; + } + } + } + function getCommonPrefix(directory, resolution) { + if (resolution === undefined) { + return undefined; + } + var resolutionDirectory = ts.toPath(ts.getDirectoryPath(resolution), currentDirectory, getCanonicalFileName); + // find first position where directory and resolution differs + var i = 0; + while (i < Math.min(directory.length, resolutionDirectory.length) && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) { + i++; + } + // find last directory separator before position i + var sep = directory.lastIndexOf(ts.directorySeparator, i); + if (sep < 0) { + return undefined; + } + return directory.substr(0, sep); + } + } + } + ts.createModuleResolutionCache = createModuleResolutionCache; + function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache) { + var traceEnabled = isTraceEnabled(compilerOptions, host); + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolving_module_0_from_1, moduleName, containingFile); + } + var containingDirectory = ts.getDirectoryPath(containingFile); + var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory); + var result = perFolderCache && perFolderCache[moduleName]; + if (result) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); + } + } + else { + var moduleResolution = compilerOptions.moduleResolution; + if (moduleResolution === undefined) { + moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + if (traceEnabled) { + trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + else { + if (traceEnabled) { + trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + switch (moduleResolution) { + case ts.ModuleResolutionKind.NodeJs: + result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache); + break; + case ts.ModuleResolutionKind.Classic: + result = classicNameResolver(moduleName, containingFile, compilerOptions, host, cache); + break; + } + if (perFolderCache) { + perFolderCache[moduleName] = result; + // put result in per-module name cache + var perModuleNameCache = cache.getOrCreateCacheForModuleName(moduleName); + if (perModuleNameCache) { + perModuleNameCache.set(containingDirectory, result); + } + } + } + if (traceEnabled) { + if (result.resolvedModule) { + trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1, moduleName, result.resolvedModule.resolvedFileName); + } + else { + trace(host, ts.Diagnostics.Module_name_0_was_not_resolved, moduleName); + } + } + return result; + } + ts.resolveModuleName = resolveModuleName; + /** + * Any module resolution kind can be augmented with optional settings: 'baseUrl', 'paths' and 'rootDirs' - they are used to + * mitigate differences between design time structure of the project and its runtime counterpart so the same import name + * can be resolved successfully by TypeScript compiler and runtime module loader. + * If these settings are set then loading procedure will try to use them to resolve module name and it can of failure it will + * fallback to standard resolution routine. + * + * - baseUrl - this setting controls how non-relative module names are resolved. If this setting is specified then non-relative + * names will be resolved relative to baseUrl: i.e. if baseUrl is '/a/b' then candidate location to resolve module name 'c/d' will + * be '/a/b/c/d' + * - paths - this setting can only be used when baseUrl is specified. allows to tune how non-relative module names + * will be resolved based on the content of the module name. + * Structure of 'paths' compiler options + * 'paths': { + * pattern-1: [...substitutions], + * pattern-2: [...substitutions], + * ... + * pattern-n: [...substitutions] + * } + * Pattern here is a string that can contain zero or one '*' character. During module resolution module name will be matched against + * all patterns in the list. Matching for patterns that don't contain '*' means that module name must be equal to pattern respecting the case. + * If pattern contains '*' then to match pattern "*" module name must start with the and end with . + * denotes part of the module name between and . + * If module name can be matches with multiple patterns then pattern with the longest prefix will be picked. + * After selecting pattern we'll use list of substitutions to get candidate locations of the module and the try to load module + * from the candidate location. + * Substitution is a string that can contain zero or one '*'. To get candidate location from substitution we'll pick every + * substitution in the list and replace '*' with string. If candidate location is not rooted it + * will be converted to absolute using baseUrl. + * For example: + * baseUrl: /a/b/c + * "paths": { + * // match all module names + * "*": [ + * "*", // use matched name as is, + * // will be looked as /a/b/c/ + * + * "folder1/*" // substitution will convert matched name to 'folder1/', + * // since it is not rooted then final candidate location will be /a/b/c/folder1/ + * ], + * // match module names that start with 'components/' + * "components/*": [ "/root/components/*" ] // substitution will convert /components/folder1/ to '/root/components/folder1/', + * // it is rooted so it will be final candidate location + * } + * + * 'rootDirs' allows the project to be spreaded across multiple locations and resolve modules with relative names as if + * they were in the same location. For example lets say there are two files + * '/local/src/content/file1.ts' + * '/shared/components/contracts/src/content/protocols/file2.ts' + * After bundling content of '/shared/components/contracts/src' will be merged with '/local/src' so + * if file1 has the following import 'import {x} from "./protocols/file2"' it will be resolved successfully in runtime. + * 'rootDirs' provides the way to tell compiler that in order to get the whole project it should behave as if content of all + * root dirs were merged together. + * I.e. for the example above 'rootDirs' will have two entries: [ '/local/src', '/shared/components/contracts/src' ]. + * Compiler will first convert './protocols/file2' into absolute path relative to the location of containing file: + * '/local/src/content/protocols/file2' and try to load it - failure. + * Then it will search 'rootDirs' looking for a longest matching prefix of this absolute path and if such prefix is found - absolute path will + * be converted to a path relative to found rootDir entry './content/protocols/file2' (*). As a last step compiler will check all remaining + * entries in 'rootDirs', use them to build absolute path out of (*) and try to resolve module from this location. + */ + function tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state) { + if (moduleHasNonRelativeName(moduleName)) { + return tryLoadModuleUsingBaseUrl(extensions, moduleName, loader, failedLookupLocations, state); + } + else { + return tryLoadModuleUsingRootDirs(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state); + } + } + function tryLoadModuleUsingRootDirs(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state) { + if (!state.compilerOptions.rootDirs) { + return undefined; + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0, moduleName); + } + var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); + var matchedRootDir; + var matchedNormalizedPrefix; + for (var _i = 0, _a = state.compilerOptions.rootDirs; _i < _a.length; _i++) { + var rootDir = _a[_i]; + // rootDirs are expected to be absolute + // in case of tsconfig.json this will happen automatically - compiler will expand relative names + // using location of tsconfig.json as base location + var normalizedRoot = ts.normalizePath(rootDir); + if (!ts.endsWith(normalizedRoot, ts.directorySeparator)) { + normalizedRoot += ts.directorySeparator; + } + var isLongestMatchingPrefix = ts.startsWith(candidate, normalizedRoot) && + (matchedNormalizedPrefix === undefined || matchedNormalizedPrefix.length < normalizedRoot.length); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Checking_if_0_is_the_longest_matching_prefix_for_1_2, normalizedRoot, candidate, isLongestMatchingPrefix); + } + if (isLongestMatchingPrefix) { + matchedNormalizedPrefix = normalizedRoot; + matchedRootDir = rootDir; + } + } + if (matchedNormalizedPrefix) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Longest_matching_prefix_for_0_is_1, candidate, matchedNormalizedPrefix); + } + var suffix = candidate.substr(matchedNormalizedPrefix.length); + // first - try to load from a initial location + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, matchedNormalizedPrefix, candidate); + } + var resolvedFileName = loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(containingDirectory, state.host), state); + if (resolvedFileName) { + return resolvedFileName; + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Trying_other_entries_in_rootDirs); + } + // then try to resolve using remaining entries in rootDirs + for (var _b = 0, _c = state.compilerOptions.rootDirs; _b < _c.length; _b++) { + var rootDir = _c[_b]; + if (rootDir === matchedRootDir) { + // skip the initially matched entry + continue; + } + var candidate_1 = ts.combinePaths(ts.normalizePath(rootDir), suffix); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, rootDir, candidate_1); + } + var baseDirectory = ts.getDirectoryPath(candidate_1); + var resolvedFileName_1 = loader(extensions, candidate_1, failedLookupLocations, !directoryProbablyExists(baseDirectory, state.host), state); + if (resolvedFileName_1) { + return resolvedFileName_1; + } + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Module_resolution_using_rootDirs_has_failed); + } + } + return undefined; + } + function tryLoadModuleUsingBaseUrl(extensions, moduleName, loader, failedLookupLocations, state) { + if (!state.compilerOptions.baseUrl) { + return undefined; + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1, state.compilerOptions.baseUrl, moduleName); + } + // string is for exact match + var matchedPattern = undefined; + if (state.compilerOptions.paths) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0, moduleName); + } + matchedPattern = ts.matchPatternOrExact(ts.getOwnKeys(state.compilerOptions.paths), moduleName); + } + if (matchedPattern) { + var matchedStar_1 = typeof matchedPattern === "string" ? undefined : ts.matchedText(matchedPattern, moduleName); + var matchedPatternText = typeof matchedPattern === "string" ? matchedPattern : ts.patternText(matchedPattern); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Module_name_0_matched_pattern_1, moduleName, matchedPatternText); + } + return ts.forEach(state.compilerOptions.paths[matchedPatternText], function (subst) { + var path = matchedStar_1 ? subst.replace("*", matchedStar_1) : subst; + var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, path)); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Trying_substitution_0_candidate_module_location_Colon_1, subst, path); + } + // A path mapping may have a ".ts" extension; in contrast to an import, which should omit it. + var tsExtension = ts.tryGetExtensionFromPath(candidate); + if (tsExtension !== undefined) { + var path_1 = tryFile(candidate, failedLookupLocations, /*onlyRecordFailures*/ false, state); + return path_1 && { path: path_1, extension: tsExtension }; + } + return loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); + }); + } + else { + var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, moduleName)); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Resolving_module_name_0_relative_to_base_url_1_2, moduleName, state.compilerOptions.baseUrl, candidate); + } + return loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); + } + } + function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache) { + var containingDirectory = ts.getDirectoryPath(containingFile); + var traceEnabled = isTraceEnabled(compilerOptions, host); + var failedLookupLocations = []; + var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; + var result = tryResolve(0 /* TypeScript */) || tryResolve(1 /* JavaScript */); + if (result && result.value) { + var _a = result.value, resolved = _a.resolved, isExternalLibraryImport = _a.isExternalLibraryImport; + return createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations); + } + return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; + function tryResolve(extensions) { + var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, state); + if (resolved) { + return toSearchResult({ resolved: resolved, isExternalLibraryImport: false }); + } + if (moduleHasNonRelativeName(moduleName)) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder, moduleName); + } + var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state, cache); + // For node_modules lookups, get the real path so that multiple accesses to an `npm link`-ed module do not create duplicate files. + return resolved_1 && { value: resolved_1.value && { resolved: { path: realpath(resolved_1.value.path, host, traceEnabled), extension: resolved_1.value.extension }, isExternalLibraryImport: true } }; + } + else { + var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); + var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, /*onlyRecordFailures*/ false, state); + return resolved_2 && toSearchResult({ resolved: resolved_2, isExternalLibraryImport: false }); + } + } + } + ts.nodeModuleNameResolver = nodeModuleNameResolver; + function realpath(path, host, traceEnabled) { + if (!host.realpath) { + return path; + } + var real = ts.normalizePath(host.realpath(path)); + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolving_real_path_for_0_result_1, path, real); + } + return real; + } + function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0, candidate); + } + var resolvedFromFile = !ts.pathEndsWithDirectorySeparator(candidate) && loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); + return resolvedFromFile || loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); + } + /* @internal */ + function directoryProbablyExists(directoryName, host) { + // if host does not support 'directoryExists' assume that directory will exist + return !host.directoryExists || host.directoryExists(directoryName); + } + ts.directoryProbablyExists = directoryProbablyExists; + /** + * @param {boolean} onlyRecordFailures - if true then function won't try to actually load files but instead record all attempts as failures. This flag is necessary + * in cases when we know upfront that all load attempts will fail (because containing folder does not exists) however we still need to record all failed lookup locations. + */ + function loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { + // First, try adding an extension. An import of "foo" could be matched by a file "foo.ts", or "foo.js" by "foo.js.ts" + var resolvedByAddingExtension = tryAddingExtensions(candidate, extensions, failedLookupLocations, onlyRecordFailures, state); + if (resolvedByAddingExtension) { + return resolvedByAddingExtension; + } + // If that didn't work, try stripping a ".js" or ".jsx" extension and replacing it with a TypeScript one; + // e.g. "./foo.js" can be matched by "./foo.ts" or "./foo.d.ts" + if (ts.hasJavaScriptFileExtension(candidate)) { + var extensionless = ts.removeFileExtension(candidate); + if (state.traceEnabled) { + var extension = candidate.substring(extensionless.length); + trace(state.host, ts.Diagnostics.File_name_0_has_a_1_extension_stripping_it, candidate, extension); + } + return tryAddingExtensions(extensionless, extensions, failedLookupLocations, onlyRecordFailures, state); + } + } + /** Try to return an existing file that adds one of the `extensions` to `candidate`. */ + function tryAddingExtensions(candidate, extensions, failedLookupLocations, onlyRecordFailures, state) { + if (!onlyRecordFailures) { + // check if containing folder exists - if it doesn't then just record failures for all supported extensions without disk probing + var directory = ts.getDirectoryPath(candidate); + if (directory) { + onlyRecordFailures = !directoryProbablyExists(directory, state.host); + } + } + switch (extensions) { + case 2 /* DtsOnly */: + return tryExtension(".d.ts", ts.Extension.Dts); + case 0 /* TypeScript */: + return tryExtension(".ts", ts.Extension.Ts) || tryExtension(".tsx", ts.Extension.Tsx) || tryExtension(".d.ts", ts.Extension.Dts); + case 1 /* JavaScript */: + return tryExtension(".js", ts.Extension.Js) || tryExtension(".jsx", ts.Extension.Jsx); + } + function tryExtension(ext, extension) { + var path = tryFile(candidate + ext, failedLookupLocations, onlyRecordFailures, state); + return path && { path: path, extension: extension }; + } + } + /** Return the file if it exists. */ + function tryFile(fileName, failedLookupLocations, onlyRecordFailures, state) { + if (!onlyRecordFailures && state.host.fileExists(fileName)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + } + return fileName; + } + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); + } + failedLookupLocations.push(fileName); + return undefined; + } + } + function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { + var packageJsonPath = pathToPackageJson(candidate); + var directoryExists = !onlyRecordFailures && directoryProbablyExists(candidate, state.host); + if (directoryExists && state.host.fileExists(packageJsonPath)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); + } + var mainOrTypesFile = tryReadPackageJsonMainOrTypes(extensions, packageJsonPath, candidate, state); + if (mainOrTypesFile) { + var onlyRecordFailures_1 = !directoryProbablyExists(ts.getDirectoryPath(mainOrTypesFile), state.host); + // A package.json "typings" may specify an exact filename, or may choose to omit an extension. + var fromExactFile = tryFile(mainOrTypesFile, failedLookupLocations, onlyRecordFailures_1, state); + if (fromExactFile) { + var resolved_3 = fromExactFile && resolvedIfExtensionMatches(extensions, fromExactFile); + if (resolved_3) { + return resolved_3; + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromExactFile); + } + } + var resolved = tryAddingExtensions(mainOrTypesFile, 0 /* TypeScript */, failedLookupLocations, onlyRecordFailures_1, state); + if (resolved) { + return resolved; + } + if (extensions === 1 /* JavaScript */) { + // A package.json "main" may specify an exact filename, or may choose to omit an extension. + // We tried the ts extensions erlier, now try the js extensions. + // tryReadPackageJsonMainOrTypes returns main iff extensions is Extensions.JavaScript. + var resolved_4 = tryAddingExtensions(mainOrTypesFile, 1 /* JavaScript */, failedLookupLocations, onlyRecordFailures_1, state); + if (resolved_4) { + return resolved_4; + } + } + } + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_does_not_have_a_types_or_main_field); + } + } + } + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath); + } + // record package json as one of failed lookup locations - in the future if this file will appear it will invalidate resolution results + failedLookupLocations.push(packageJsonPath); + } + return loadModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocations, !directoryExists, state); + } + /** Resolve from an arbitrarily specified file. Return `undefined` if it has an unsupported extension. */ + function resolvedIfExtensionMatches(extensions, path) { + var extension = ts.tryGetExtensionFromPath(path); + return extension !== undefined && extensionIsOk(extensions, extension) ? { path: path, extension: extension } : undefined; + } + /** True if `extension` is one of the supported `extensions`. */ + function extensionIsOk(extensions, extension) { + switch (extensions) { + case 1 /* JavaScript */: + return extension === ts.Extension.Js || extension === ts.Extension.Jsx; + case 0 /* TypeScript */: + return extension === ts.Extension.Ts || extension === ts.Extension.Tsx || extension === ts.Extension.Dts; + case 2 /* DtsOnly */: + return extension === ts.Extension.Dts; + } + } + function pathToPackageJson(directory) { + return ts.combinePaths(directory, "package.json"); + } + function loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state) { + var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); + var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); + return loadModuleFromFile(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state) || + loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state); + } + function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state, cache) { + return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, /*typesOnly*/ false, cache); + } + function loadModuleFromNodeModulesAtTypes(moduleName, directory, failedLookupLocations, state) { + // Extensions parameter here doesn't actually matter, because typesOnly ensures we're just doing @types lookup, which is always DtsOnly. + return loadModuleFromNodeModulesWorker(2 /* DtsOnly */, moduleName, directory, failedLookupLocations, state, /*typesOnly*/ true, /*cache*/ undefined); + } + function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly, cache) { + var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); + return forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) { + if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") { + var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state.traceEnabled, state.host); + if (resolutionFromCache) { + return resolutionFromCache; + } + return toSearchResult(loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly)); + } + }); + } + /** Load a module from a single node_modules directory, but not from any ancestors' node_modules directories. */ + function loadModuleFromNodeModulesOneLevel(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) { + if (typesOnly === void 0) { typesOnly = false; } + var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, directory, failedLookupLocations, state); + if (packageResult) { + return packageResult; + } + if (extensions !== 1 /* JavaScript */) { + return loadModuleFromNodeModulesFolder(2 /* DtsOnly */, ts.combinePaths("@types", moduleName), directory, failedLookupLocations, state); + } + } + function tryFindNonRelativeModuleNameInCache(cache, moduleName, containingDirectory, traceEnabled, host) { + var result = cache && cache.get(containingDirectory); + if (result) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); + } + return { value: result.resolvedModule && { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension } }; + } + } + function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache) { + var traceEnabled = isTraceEnabled(compilerOptions, host); + var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; + var failedLookupLocations = []; + var containingDirectory = ts.getDirectoryPath(containingFile); + var resolved = tryResolve(0 /* TypeScript */) || tryResolve(1 /* JavaScript */); + return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, /*isExternalLibraryImport*/ false, failedLookupLocations); + function tryResolve(extensions) { + var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, state); + if (resolvedUsingSettings) { + return { value: resolvedUsingSettings }; + } + var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); + if (moduleHasNonRelativeName(moduleName)) { + // Climb up parent directories looking for a module. + var resolved_5 = forEachAncestorDirectory(containingDirectory, function (directory) { + var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, directory, traceEnabled, host); + if (resolutionFromCache) { + return resolutionFromCache; + } + var searchName = ts.normalizePath(ts.combinePaths(directory, moduleName)); + return toSearchResult(loadModuleFromFile(extensions, searchName, failedLookupLocations, /*onlyRecordFailures*/ false, state)); + }); + if (resolved_5) { + return resolved_5; + } + if (extensions === 0 /* TypeScript */) { + // If we didn't find the file normally, look it up in @types. + return loadModuleFromNodeModulesAtTypes(moduleName, containingDirectory, failedLookupLocations, state); + } + } + else { + var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); + return toSearchResult(loadModuleFromFile(extensions, candidate, failedLookupLocations, /*onlyRecordFailures*/ false, state)); + } + } + } + ts.classicNameResolver = classicNameResolver; + /** + * LSHost may load a module from a global cache of typings. + * This is the minumum code needed to expose that functionality; the rest is in LSHost. + */ + /* @internal */ + function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, host, globalCache) { + var traceEnabled = isTraceEnabled(compilerOptions, host); + if (traceEnabled) { + trace(host, ts.Diagnostics.Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2, projectName, moduleName, globalCache); + } + var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; + var failedLookupLocations = []; + var resolved = loadModuleFromNodeModulesOneLevel(2 /* DtsOnly */, moduleName, globalCache, failedLookupLocations, state); + return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ true, failedLookupLocations); + } + ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache; + /** + * Wraps value to SearchResult. + * @returns undefined if value is undefined or { value } otherwise + */ + function toSearchResult(value) { + return value !== undefined ? { value: value } : undefined; + } + /** Calls `callback` on `directory` and every ancestor directory it has, returning the first defined result. */ + function forEachAncestorDirectory(directory, callback) { + while (true) { + var result = callback(directory); + if (result !== undefined) { + return result; + } + var parentPath = ts.getDirectoryPath(directory); + if (parentPath === directory) { + return undefined; + } + directory = parentPath; + } + } +})(ts || (ts = {})); +/// /// /* @internal */ var ts; (function (ts) { + var ambientModuleSymbolRegex = /^".+"$/; var nextSymbolId = 1; var nextNodeId = 1; var nextMergeId = 1; @@ -16532,6 +24264,8 @@ var ts; // is because diagnostics can be quite expensive, and we want to allow hosts to bail out if // they no longer need the information (for example, if the user started editing again). var cancellationToken; + var requestedExternalEmitHelpers; + var externalHelpersModule; var Symbol = ts.objectAllocator.getSymbolConstructor(); var Type = ts.objectAllocator.getTypeConstructor(); var Signature = ts.objectAllocator.getSignatureConstructor(); @@ -16590,23 +24324,33 @@ var ts; getAliasedSymbol: resolveAlias, getEmitResolver: getEmitResolver, getExportsOfModule: getExportsOfModuleAsArray, + getAmbientModules: getAmbientModules, getJsxElementAttributesType: getJsxElementAttributesType, getJsxIntrinsicTagNames: getJsxIntrinsicTagNames, - isOptionalParameter: isOptionalParameter + isOptionalParameter: isOptionalParameter, + tryGetMemberInModuleExports: tryGetMemberInModuleExports, + tryFindAmbientModuleWithoutAugmentations: function (moduleName) { + // we deliberately exclude augmentations + // since we are only interested in declarations of the module itself + return tryFindAmbientModule(moduleName, /*withAugmentations*/ false); + } }; var tupleTypes = []; var unionTypes = ts.createMap(); 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__"); var anyType = createIntrinsicType(1 /* Any */, "any"); + var autoType = createIntrinsicType(1 /* Any */, "any"); var unknownType = createIntrinsicType(1 /* Any */, "unknown"); var undefinedType = createIntrinsicType(2048 /* Undefined */, "undefined"); - var undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(2048 /* Undefined */ | 33554432 /* ContainsWideningType */, "undefined"); + var undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(2048 /* Undefined */ | 2097152 /* ContainsWideningType */, "undefined"); var nullType = createIntrinsicType(4096 /* Null */, "null"); - var nullWideningType = strictNullChecks ? nullType : createIntrinsicType(4096 /* Null */ | 33554432 /* ContainsWideningType */, "null"); + var nullWideningType = strictNullChecks ? nullType : createIntrinsicType(4096 /* Null */ | 2097152 /* ContainsWideningType */, "null"); var stringType = createIntrinsicType(2 /* String */, "string"); var numberType = createIntrinsicType(4 /* Number */, "number"); var trueType = createIntrinsicType(128 /* BooleanLiteral */, "true"); @@ -16615,17 +24359,22 @@ var ts; var esSymbolType = createIntrinsicType(512 /* ESSymbol */, "symbol"); var voidType = createIntrinsicType(1024 /* Void */, "void"); var neverType = createIntrinsicType(8192 /* Never */, "never"); + var silentNeverType = createIntrinsicType(8192 /* Never */, "never"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + var emptyTypeLiteralSymbol = createSymbol(2048 /* TypeLiteral */ | 67108864 /* Transient */, "__type"); + emptyTypeLiteralSymbol.members = ts.createMap(); + var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, emptyArray, emptyArray, undefined, undefined); var emptyGenericType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); emptyGenericType.instantiations = ts.createMap(); var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); // The anyFunctionType contains the anyFunctionType by definition. The flag is further propagated // in getPropagatingFlagsOfTypes, and it is checked in inferFromTypes. - anyFunctionType.flags |= 134217728 /* ContainsAnyFunctionType */; + anyFunctionType.flags |= 8388608 /* ContainsAnyFunctionType */; var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); var unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); var resolvingSignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); + var silentNeverSignature = createSignature(undefined, undefined, undefined, emptyArray, silentNeverType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasLiteralTypes*/ false); var enumNumberIndexInfo = createIndexInfo(stringType, /*isReadonly*/ true); var globals = ts.createMap(); /** @@ -16636,6 +24385,7 @@ var ts; var patternAmbientModules; var getGlobalESSymbolConstructorSymbol; var getGlobalPromiseConstructorSymbol; + var tryGetGlobalPromiseConstructorSymbol; var globalObjectType; var globalFunctionType; var globalArrayType; @@ -16645,6 +24395,7 @@ var ts; var globalBooleanType; var globalRegExpType; var anyArrayType; + var autoArrayType; var anyReadonlyArrayType; // The library files are only loaded when the feature is used. // This allows users to just specify library files they want to used through --lib @@ -16777,6 +24528,8 @@ var ts; "undefined": undefinedType }); var jsxElementType; + var _jsxNamespace; + var _jsxFactoryEntity; /** Things we lazy load from the JSX namespace */ var jsxTypes = ts.createMap(); var JsxNames = { @@ -16806,6 +24559,21 @@ var ts; builtinGlobals[undefinedSymbol.name] = undefinedSymbol; initializeTypeChecker(); return checker; + function getJsxNamespace() { + if (_jsxNamespace === undefined) { + _jsxNamespace = "React"; + if (compilerOptions.jsxFactory) { + _jsxFactoryEntity = ts.parseIsolatedEntityName(compilerOptions.jsxFactory, languageVersion); + if (_jsxFactoryEntity) { + _jsxNamespace = getFirstIdentifier(_jsxFactoryEntity).text; + } + } + else if (compilerOptions.reactNamespace) { + _jsxNamespace = compilerOptions.reactNamespace; + } + } + return _jsxNamespace; + } function getEmitResolver(sourceFile, cancellationToken) { // Ensure we have all the type information in place for this file so that all the // emitter questions of this resolver will return the right information. @@ -16889,13 +24657,11 @@ var ts; target.flags |= source.flags; if (source.valueDeclaration && (!target.valueDeclaration || - (target.valueDeclaration.kind === 225 /* ModuleDeclaration */ && source.valueDeclaration.kind !== 225 /* ModuleDeclaration */))) { + (target.valueDeclaration.kind === 230 /* ModuleDeclaration */ && source.valueDeclaration.kind !== 230 /* ModuleDeclaration */))) { // other kinds of value declarations take precedence over modules target.valueDeclaration = source.valueDeclaration; } - ts.forEach(source.declarations, function (node) { - target.declarations.push(node); - }); + ts.addRange(target.declarations, source.declarations); if (source.members) { if (!target.members) target.members = ts.createMap(); @@ -16951,7 +24717,7 @@ var ts; var moduleNotFoundError = !ts.isInAmbientContext(moduleName.parent.parent) ? ts.Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found : undefined; - var mainModule = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError); + var mainModule = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError, /*isForAugmentation*/ true); if (!mainModule) { return; } @@ -16992,8 +24758,11 @@ var ts; var nodeId = getNodeId(node); return nodeLinks[nodeId] || (nodeLinks[nodeId] = { flags: 0 }); } + function getObjectFlags(type) { + return type.flags & 32768 /* Object */ ? type.objectFlags : 0; + } function isGlobalSourceFile(node) { - return node.kind === 256 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); + return node.kind === 261 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { @@ -17039,24 +24808,42 @@ var ts; // nodes are in different files and order cannot be determines return true; } + // declaration is after usage + // can be legal if usage is deferred (i.e. inside function or in initializer of instance property) + if (isUsedInFunctionOrNonStaticProperty(usage)) { + return true; + } var sourceFiles = host.getSourceFiles(); return ts.indexOf(sourceFiles, declarationFile) <= ts.indexOf(sourceFiles, useFile); } if (declaration.pos <= usage.pos) { // declaration is before usage - // still might be illegal if usage is in the initializer of the variable declaration - return declaration.kind !== 218 /* VariableDeclaration */ || - !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); + if (declaration.kind === 174 /* BindingElement */) { + // still might be illegal if declaration and usage are both binding elements (eg var [a = b, b = b] = [1, 2]) + var errorBindingElement = ts.getAncestor(usage, 174 /* BindingElement */); + if (errorBindingElement) { + return getAncestorBindingPattern(errorBindingElement) !== getAncestorBindingPattern(declaration) || + declaration.pos < errorBindingElement.pos; + } + // or it might be illegal if usage happens before parent variable is declared (eg var [a] = a) + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 223 /* VariableDeclaration */), usage); + } + else if (declaration.kind === 223 /* VariableDeclaration */) { + // still might be illegal if usage is in the initializer of the variable declaration (eg var a = a) + return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); + } + return true; } // declaration is after usage // can be legal if usage is deferred (i.e. inside function or in initializer of instance property) - return isUsedInFunctionOrNonStaticProperty(declaration, usage); + var container = ts.getEnclosingBlockScopeContainer(declaration); + return isUsedInFunctionOrNonStaticProperty(usage, container); function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); switch (declaration.parent.parent.kind) { - case 200 /* VariableStatement */: - case 206 /* ForStatement */: - case 208 /* ForOfStatement */: + case 205 /* VariableStatement */: + case 211 /* ForStatement */: + case 213 /* ForOfStatement */: // variable statement/for/for-of statement case, // use site should not be inside variable declaration (initializer of declaration or binding element) if (isSameScopeDescendentOf(usage, declaration, container)) { @@ -17065,8 +24852,8 @@ var ts; break; } switch (declaration.parent.parent.kind) { - case 207 /* ForInStatement */: - case 208 /* ForOfStatement */: + case 212 /* ForInStatement */: + case 213 /* ForOfStatement */: // ForIn/ForOf case - use site should not be used in expression part if (isSameScopeDescendentOf(usage, declaration.parent.parent.expression, container)) { return true; @@ -17074,8 +24861,7 @@ var ts; } return false; } - function isUsedInFunctionOrNonStaticProperty(declaration, usage) { - var container = ts.getEnclosingBlockScopeContainer(declaration); + function isUsedInFunctionOrNonStaticProperty(usage, container) { var current = usage; while (current) { if (current === container) { @@ -17085,8 +24871,8 @@ var ts; return true; } var initializerOfNonStaticProperty = current.parent && - current.parent.kind === 145 /* PropertyDeclaration */ && - (current.parent.flags & 32 /* Static */) === 0 && + current.parent.kind === 147 /* PropertyDeclaration */ && + (ts.getModifierFlags(current.parent) & 32 /* Static */) === 0 && current.parent.initializer === current; if (initializerOfNonStaticProperty) { return true; @@ -17095,6 +24881,15 @@ var ts; } return false; } + function getAncestorBindingPattern(node) { + while (node) { + if (ts.isBindingPattern(node)) { + return node; + } + node = node.parent; + } + return undefined; + } } // Resolve a given name for a given meaning at a given location. An error is reported if the name was not found and // the nameNotFoundMessage argument is not undefined. Returns the resolved symbol, or undefined if no symbol with @@ -17118,11 +24913,11 @@ var ts; // - parameters are only in the scope of function body // This restriction does not apply to JSDoc comment types because they are parented // at a higher level than type parameters would normally be - if (meaning & result.flags & 793064 /* Type */ && lastLocation.kind !== 273 /* JSDocComment */) { + if (meaning & result.flags & 793064 /* Type */ && lastLocation.kind !== 278 /* JSDocComment */) { useResult = result.flags & 262144 /* TypeParameter */ ? lastLocation === location.type || - lastLocation.kind === 142 /* Parameter */ || - lastLocation.kind === 141 /* TypeParameter */ + lastLocation.kind === 144 /* Parameter */ || + lastLocation.kind === 143 /* TypeParameter */ : false; } if (meaning & 107455 /* Value */ && result.flags & 1 /* FunctionScopedVariable */) { @@ -17131,9 +24926,9 @@ var ts; // however it is detected separately when checking initializers of parameters // to make sure that they reference no variables declared after them. useResult = - lastLocation.kind === 142 /* Parameter */ || + lastLocation.kind === 144 /* Parameter */ || (lastLocation === location.type && - result.valueDeclaration.kind === 142 /* Parameter */); + result.valueDeclaration.kind === 144 /* Parameter */); } } if (useResult) { @@ -17145,13 +24940,13 @@ var ts; } } switch (location.kind) { - case 256 /* SourceFile */: + case 261 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; - case 225 /* ModuleDeclaration */: + case 230 /* ModuleDeclaration */: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 256 /* SourceFile */ || ts.isAmbientModule(location)) { + if (location.kind === 261 /* SourceFile */ || ts.isAmbientModule(location)) { // It's an external module. First see if the module has an export default and if the local // name of that export default matches. if (result = moduleExports["default"]) { @@ -17174,7 +24969,7 @@ var ts; // which is not the desired behavior. if (moduleExports[name] && moduleExports[name].flags === 8388608 /* Alias */ && - ts.getDeclarationOfKind(moduleExports[name], 238 /* ExportSpecifier */)) { + ts.getDeclarationOfKind(moduleExports[name], 243 /* ExportSpecifier */)) { break; } } @@ -17182,20 +24977,20 @@ var ts; break loop; } break; - case 224 /* EnumDeclaration */: + case 229 /* EnumDeclaration */: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) { break loop; } break; - case 145 /* PropertyDeclaration */: - case 144 /* PropertySignature */: + case 147 /* PropertyDeclaration */: + case 146 /* PropertySignature */: // TypeScript 1.0 spec (April 2014): 8.4.1 // Initializer expressions for instance member variables are evaluated in the scope // of the class constructor body but are not permitted to reference parameters or // local variables of the constructor. This effectively means that entities from outer scopes // by the same name as a constructor parameter or local variable are inaccessible // in initializer expressions for instance member variables. - if (ts.isClassLike(location.parent) && !(location.flags & 32 /* Static */)) { + if (ts.isClassLike(location.parent) && !(ts.getModifierFlags(location) & 32 /* Static */)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { if (getSymbol(ctor.locals, name, meaning & 107455 /* Value */)) { @@ -17205,11 +25000,11 @@ var ts; } } break; - case 221 /* ClassDeclaration */: - case 192 /* ClassExpression */: - case 222 /* InterfaceDeclaration */: + case 226 /* ClassDeclaration */: + case 197 /* ClassExpression */: + case 227 /* InterfaceDeclaration */: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793064 /* Type */)) { - if (lastLocation && lastLocation.flags & 32 /* Static */) { + if (lastLocation && ts.getModifierFlags(lastLocation) & 32 /* Static */) { // TypeScript 1.0 spec (April 2014): 3.4.1 // The scope of a type parameter extends over the entire declaration with which the type // parameter list is associated, with the exception of static member declarations in classes. @@ -17218,7 +25013,7 @@ var ts; } break loop; } - if (location.kind === 192 /* ClassExpression */ && meaning & 32 /* Class */) { + if (location.kind === 197 /* ClassExpression */ && meaning & 32 /* Class */) { var className = location.name; if (className && name === className.text) { result = location.symbol; @@ -17234,9 +25029,9 @@ var ts; // [foo()]() { } // <-- Reference to T from class's own computed property // } // - case 140 /* ComputedPropertyName */: + case 142 /* ComputedPropertyName */: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 222 /* InterfaceDeclaration */) { + if (ts.isClassLike(grandparent) || grandparent.kind === 227 /* InterfaceDeclaration */) { // A reference to this grandparent's type parameters would be an error if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793064 /* Type */)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); @@ -17244,19 +25039,19 @@ var ts; } } break; - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - case 148 /* Constructor */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - case 220 /* FunctionDeclaration */: - case 180 /* ArrowFunction */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + case 150 /* Constructor */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + case 225 /* FunctionDeclaration */: + case 185 /* ArrowFunction */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 179 /* FunctionExpression */: + case 184 /* FunctionExpression */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; @@ -17269,7 +25064,7 @@ var ts; } } break; - case 143 /* Decorator */: + case 145 /* Decorator */: // Decorators are resolved at the class declaration. Resolving at the parameter // or member would result in looking up locals in the method. // @@ -17278,7 +25073,7 @@ var ts; // method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter. // } // - if (location.parent && location.parent.kind === 142 /* Parameter */) { + if (location.parent && location.parent.kind === 144 /* Parameter */) { location = location.parent; } // @@ -17305,7 +25100,9 @@ var ts; if (nameNotFoundMessage) { if (!errorLocation || !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && - !checkAndReportErrorForExtendingInterface(errorLocation)) { + !checkAndReportErrorForExtendingInterface(errorLocation) && + !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && + !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning)) { error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); } } @@ -17340,15 +25137,15 @@ var ts; // If we're in an external module, we can't reference value symbols created from UMD export declarations if (result && isInExternalModule && (meaning & 107455 /* Value */) === 107455 /* Value */) { var decls = result.declarations; - if (decls && decls.length === 1 && decls[0].kind === 228 /* NamespaceExportDeclaration */) { - error(errorLocation, ts.Diagnostics.Identifier_0_must_be_imported_from_a_module, name); + if (decls && decls.length === 1 && decls[0].kind === 233 /* NamespaceExportDeclaration */) { + error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, name); } } } return result; } function checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) { - if ((errorLocation.kind === 69 /* Identifier */ && (isTypeReferenceIdentifier(errorLocation)) || isInTypeQuery(errorLocation))) { + if ((errorLocation.kind === 70 /* Identifier */ && (isTypeReferenceIdentifier(errorLocation)) || isInTypeQuery(errorLocation))) { return false; } var container = ts.getThisContainer(errorLocation, /* includeArrowFunctions */ true); @@ -17367,7 +25164,7 @@ var ts; } // No static member is present. // Check if we're in an instance method and look for a relevant instance member. - if (location === container && !(location.flags & 32 /* Static */)) { + if (location === container && !(ts.getModifierFlags(location) & 32 /* Static */)) { var instanceType = getDeclaredTypeOfSymbol(classSymbol).thisType; if (getPropertyOfType(instanceType, name)) { error(errorLocation, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); @@ -17393,22 +25190,42 @@ var ts; */ function getEntityNameForExtendingInterface(node) { switch (node.kind) { - case 69 /* Identifier */: - case 172 /* PropertyAccessExpression */: + case 70 /* Identifier */: + case 177 /* PropertyAccessExpression */: return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined; - case 194 /* ExpressionWithTypeArguments */: + case 199 /* ExpressionWithTypeArguments */: ts.Debug.assert(ts.isEntityNameExpression(node.expression)); return node.expression; default: 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)); + if (symbol && !(symbol.flags & 1024 /* NamespaceModule */)) { + error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, name); + return true; + } + } + return false; + } function checkResolvedBlockScopedVariable(result, errorLocation) { ts.Debug.assert((result.flags & 2 /* BlockScopedVariable */) !== 0); // Block-scoped variables cannot be used before their definition var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; }); ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); - if (!ts.isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 218 /* VariableDeclaration */), errorLocation)) { + if (!ts.isInAmbientContext(declaration) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); } } @@ -17429,23 +25246,23 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 229 /* ImportEqualsDeclaration */) { + if (node.kind === 234 /* ImportEqualsDeclaration */) { return node; } - while (node && node.kind !== 230 /* ImportDeclaration */) { + while (node && node.kind !== 235 /* ImportDeclaration */) { node = node.parent; } return node; } } function getDeclarationOfAliasSymbol(symbol) { - return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); + return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 240 /* ExternalModuleReference */) { + if (node.moduleReference.kind === 245 /* ExternalModuleReference */) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } - return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); + return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference); } function getTargetOfImportClause(node) { var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier); @@ -17521,31 +25338,31 @@ var ts; var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier); if (targetSymbol) { - var name_10 = specifier.propertyName || specifier.name; - if (name_10.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_10.text); + symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_16.text); } else { - symbolFromVariable = getPropertyOfVariable(targetSymbol, name_10.text); + symbolFromVariable = getPropertyOfVariable(targetSymbol, name_16.text); } // if symbolFromVariable is export - get its final target symbolFromVariable = resolveSymbol(symbolFromVariable); - var symbolFromModule = getExportOfModule(targetSymbol, name_10.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_10.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_10, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_10)); + error(name_16, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name_16)); } return symbol; } @@ -17567,19 +25384,19 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 229 /* ImportEqualsDeclaration */: + case 234 /* ImportEqualsDeclaration */: return getTargetOfImportEqualsDeclaration(node); - case 231 /* ImportClause */: + case 236 /* ImportClause */: return getTargetOfImportClause(node); - case 232 /* NamespaceImport */: + case 237 /* NamespaceImport */: return getTargetOfNamespaceImport(node); - case 234 /* ImportSpecifier */: + case 239 /* ImportSpecifier */: return getTargetOfImportSpecifier(node); - case 238 /* ExportSpecifier */: + case 243 /* ExportSpecifier */: return getTargetOfExportSpecifier(node); - case 235 /* ExportAssignment */: + case 240 /* ExportAssignment */: return getTargetOfExportAssignment(node); - case 228 /* NamespaceExportDeclaration */: + case 233 /* NamespaceExportDeclaration */: return getTargetOfNamespaceExportDeclaration(node); } } @@ -17626,11 +25443,11 @@ var ts; links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); ts.Debug.assert(!!node); - if (node.kind === 235 /* ExportAssignment */) { + if (node.kind === 240 /* ExportAssignment */) { // export default checkExpressionCached(node.expression); } - else if (node.kind === 238 /* ExportSpecifier */) { + else if (node.kind === 243 /* ExportSpecifier */) { // export { } or export { as foo } checkExpressionCached(node.propertyName || node.name); } @@ -17641,24 +25458,24 @@ var ts; } } // This function is only for imports with entity names - function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration, dontResolveAlias) { + function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, dontResolveAlias) { // There are three things we might try to look for. In the following examples, // the search term is enclosed in |...|: // // import a = |b|; // Namespace // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace - if (entityName.kind === 69 /* Identifier */ && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (entityName.kind === 70 /* Identifier */ && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } // Check for case 1 and 3 in the above example - if (entityName.kind === 69 /* Identifier */ || entityName.parent.kind === 139 /* QualifiedName */) { + if (entityName.kind === 70 /* Identifier */ || entityName.parent.kind === 141 /* QualifiedName */) { return resolveEntityName(entityName, 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - ts.Debug.assert(entityName.parent.kind === 229 /* ImportEqualsDeclaration */); + ts.Debug.assert(entityName.parent.kind === 234 /* ImportEqualsDeclaration */); return resolveEntityName(entityName, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } } @@ -17666,22 +25483,22 @@ var ts; return symbol.parent ? getFullyQualifiedName(symbol.parent) + "." + symbolToString(symbol) : symbolToString(symbol); } // Resolves a qualified name and any involved aliases - function resolveEntityName(name, meaning, ignoreErrors, dontResolveAlias) { + function resolveEntityName(name, meaning, ignoreErrors, dontResolveAlias, location) { if (ts.nodeIsMissing(name)) { return undefined; } var symbol; - if (name.kind === 69 /* Identifier */) { + if (name.kind === 70 /* Identifier */) { var message = meaning === 1920 /* Namespace */ ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0; - symbol = resolveName(name, name.text, meaning, ignoreErrors ? undefined : message, name); + symbol = resolveName(location || name, name.text, meaning, ignoreErrors ? undefined : message, name); if (!symbol) { return undefined; } } - else if (name.kind === 139 /* QualifiedName */ || name.kind === 172 /* PropertyAccessExpression */) { - var left = name.kind === 139 /* QualifiedName */ ? name.left : name.expression; - var right = name.kind === 139 /* QualifiedName */ ? name.right : name.name; - var namespace = resolveEntityName(left, 1920 /* Namespace */, ignoreErrors); + else if (name.kind === 141 /* QualifiedName */ || name.kind === 177 /* PropertyAccessExpression */) { + var left = name.kind === 141 /* QualifiedName */ ? name.left : name.expression; + var right = name.kind === 141 /* QualifiedName */ ? name.right : name.name; + var namespace = resolveEntityName(left, 1920 /* Namespace */, ignoreErrors, /*dontResolveAlias*/ false, location); if (!namespace || ts.nodeIsMissing(right)) { return undefined; } @@ -17691,7 +25508,7 @@ var ts; symbol = getSymbol(getExportsOfSymbol(namespace), right.text, meaning); if (!symbol) { if (!ignoreErrors) { - error(right, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(namespace), ts.declarationNameToString(right)); + error(right, ts.Diagnostics.Namespace_0_has_no_exported_member_1, getFullyQualifiedName(namespace), ts.declarationNameToString(right)); } return undefined; } @@ -17705,27 +25522,30 @@ var ts; function resolveExternalModuleName(location, moduleReferenceExpression) { return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ts.Diagnostics.Cannot_find_module_0); } - function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError) { + function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError, isForAugmentation) { + if (isForAugmentation === void 0) { isForAugmentation = false; } if (moduleReferenceExpression.kind !== 9 /* StringLiteral */) { return; } var moduleReferenceLiteral = moduleReferenceExpression; + return resolveExternalModule(location, moduleReferenceLiteral.text, moduleNotFoundError, moduleReferenceLiteral, isForAugmentation); + } + function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation) { + if (isForAugmentation === void 0) { isForAugmentation = false; } // Module names are escaped in our symbol table. However, string literal values aren't. // Escape the name in the "require(...)" clause to ensure we find the right symbol. - var moduleName = ts.escapeIdentifier(moduleReferenceLiteral.text); + var moduleName = ts.escapeIdentifier(moduleReference); if (moduleName === undefined) { return; } - var isRelative = ts.isExternalModuleNameRelative(moduleName); - if (!isRelative) { - var symbol = getSymbol(globals, '"' + moduleName + '"', 512 /* ValueModule */); - if (symbol) { - // merged symbol is module declaration symbol combined with all augmentations - return getMergedSymbol(symbol); - } + var ambientModule = tryFindAmbientModule(moduleName, /*withAugmentations*/ true); + if (ambientModule) { + return ambientModule; } - var resolvedModule = ts.getResolvedModule(ts.getSourceFileOfNode(location), moduleReferenceLiteral.text); - var sourceFile = resolvedModule && host.getSourceFile(resolvedModule.resolvedFileName); + var isRelative = ts.isExternalModuleNameRelative(moduleName); + var resolvedModule = ts.getResolvedModule(ts.getSourceFileOfNode(location), moduleReference); + var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule); + var sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName); if (sourceFile) { if (sourceFile.symbol) { // merged symbol is module declaration symbol combined with all augmentations @@ -17733,7 +25553,7 @@ var ts; } if (moduleNotFoundError) { // report errors only if it was requested - error(moduleReferenceLiteral, ts.Diagnostics.File_0_is_not_a_module, sourceFile.fileName); + error(errorNode, ts.Diagnostics.File_0_is_not_a_module, sourceFile.fileName); } return undefined; } @@ -17743,15 +25563,32 @@ var ts; return getMergedSymbol(pattern.symbol); } } + // May be an untyped module. If so, ignore resolutionDiagnostic. + if (!isRelative && resolvedModule && !ts.extensionIsTypeScript(resolvedModule.extension)) { + if (isForAugmentation) { + var diag = ts.Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented; + error(errorNode, diag, moduleReference, resolvedModule.resolvedFileName); + } + else if (compilerOptions.noImplicitAny && moduleNotFoundError) { + error(errorNode, ts.Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type, moduleReference, resolvedModule.resolvedFileName); + } + // Failed imports and untyped modules are both treated in an untyped manner; only difference is whether we give a diagnostic first. + return undefined; + } if (moduleNotFoundError) { // report errors only if it was requested - var tsExtension = ts.tryExtractTypeScriptExtension(moduleName); - if (tsExtension) { - var diag = ts.Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead; - error(moduleReferenceLiteral, diag, tsExtension, ts.removeExtension(moduleName, tsExtension)); + if (resolutionDiagnostic) { + error(errorNode, resolutionDiagnostic, moduleName, resolvedModule.resolvedFileName); } else { - error(moduleReferenceLiteral, moduleNotFoundError, moduleName); + var tsExtension = ts.tryExtractTypeScriptExtension(moduleName); + if (tsExtension) { + var diag = ts.Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead; + error(errorNode, diag, tsExtension, ts.removeExtension(moduleName, tsExtension)); + } + else { + error(errorNode, moduleNotFoundError, moduleName); + } } } return undefined; @@ -17778,6 +25615,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; } @@ -17811,6 +25654,8 @@ var ts; } function getExportsForModule(moduleSymbol) { var visitedSymbols = []; + // A module defined by an 'export=' consists on one export that needs to be resolved + moduleSymbol = resolveExternalModuleSymbol(moduleSymbol); return visit(moduleSymbol) || moduleSymbol.exports; // The ES6 spec permits export * declarations in a module to circularly reference the module itself. For example, // module 'a' can 'export * from "b"' and 'b' can 'export * from "a"' without error. @@ -17882,7 +25727,7 @@ var ts; var members = node.members; for (var _i = 0, members_1 = members; _i < members_1.length; _i++) { var member = members_1[_i]; - if (member.kind === 148 /* Constructor */ && ts.nodeIsPresent(member.body)) { + if (member.kind === 150 /* Constructor */ && ts.nodeIsPresent(member.body)) { return member; } } @@ -17904,8 +25749,9 @@ var ts; type.intrinsicName = "boolean"; return type; } - function createObjectType(kind, symbol) { - var type = createType(kind); + function createObjectType(objectFlags, symbol) { + var type = createType(32768 /* Object */); + type.objectFlags = objectFlags; type.symbol = symbol; return type; } @@ -17933,7 +25779,7 @@ var ts; } return result || emptyArray; } - function setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) { + function setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) { type.members = members; type.properties = getNamedMembers(members); type.callSignatures = callSignatures; @@ -17945,7 +25791,7 @@ var ts; return type; } function createAnonymousType(symbol, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) { - return setObjectTypeMembers(createObjectType(2097152 /* Anonymous */, symbol), members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); + return setStructuredTypeMembers(createObjectType(16 /* Anonymous */, symbol), members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } function forEachSymbolTableInScope(enclosingDeclaration, callback) { var result; @@ -17957,11 +25803,11 @@ var ts; } } switch (location_1.kind) { - case 256 /* SourceFile */: + case 261 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location_1)) { break; } - case 225 /* ModuleDeclaration */: + case 230 /* ModuleDeclaration */: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } @@ -17976,6 +25822,16 @@ var ts; } function getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, useOnlyExternalAliasing) { function getAccessibleSymbolChainFromSymbolTable(symbols) { + return getAccessibleSymbolChainFromSymbolTableWorker(symbols, []); + } + function getAccessibleSymbolChainFromSymbolTableWorker(symbols, visitedSymbolTables) { + if (ts.contains(visitedSymbolTables, symbols)) { + return undefined; + } + visitedSymbolTables.push(symbols); + var result = trySymbolTable(symbols); + visitedSymbolTables.pop(); + return result; function canQualifySymbol(symbolFromSymbolTable, meaning) { // If the symbol is equivalent and doesn't need further qualification, this symbol is accessible if (!needsQualification(symbolFromSymbolTable, enclosingDeclaration, meaning)) { @@ -17994,31 +25850,33 @@ var ts; canQualifySymbol(symbolFromSymbolTable, meaning); } } - // If symbol is directly available by its name in the symbol table - if (isAccessible(symbols[symbol.name])) { - return [symbol]; - } - // Check if symbol is any of the alias - return ts.forEachProperty(symbols, function (symbolFromSymbolTable) { - if (symbolFromSymbolTable.flags & 8388608 /* Alias */ - && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 238 /* ExportSpecifier */)) { - if (!useOnlyExternalAliasing || - // Is this external alias, then use it to name - ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { - var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); - if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { - return [symbolFromSymbolTable]; - } - // Look in the exported members, if we can find accessibleSymbolChain, symbol is accessible using this chain - // but only if the symbolFromSymbolTable can be qualified - var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; - if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { - return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + function trySymbolTable(symbols) { + // If symbol is directly available by its name in the symbol table + if (isAccessible(symbols[symbol.name])) { + return [symbol]; + } + // Check if symbol is any of the alias + return ts.forEachProperty(symbols, function (symbolFromSymbolTable) { + if (symbolFromSymbolTable.flags & 8388608 /* Alias */ + && symbolFromSymbolTable.name !== "export=" + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243 /* ExportSpecifier */)) { + if (!useOnlyExternalAliasing || + // Is this external alias, then use it to name + ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { + var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); + if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { + return [symbolFromSymbolTable]; + } + // Look in the exported members, if we can find accessibleSymbolChain, symbol is accessible using this chain + // but only if the symbolFromSymbolTable can be qualified + var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTableWorker(resolvedImportedSymbol.exports, visitedSymbolTables) : undefined; + if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { + return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + } } } - } - }); + }); + } } if (symbol) { if (!(isPropertyOrMethodDeclarationSymbol(symbol))) { @@ -18041,7 +25899,7 @@ var ts; return true; } // Qualify if the symbol from symbol table has same meaning as expected - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 238 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 243 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -18056,10 +25914,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; switch (declaration.kind) { - case 145 /* PropertyDeclaration */: - case 147 /* MethodDeclaration */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: + case 147 /* PropertyDeclaration */: + case 149 /* MethodDeclaration */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: continue; default: return false; @@ -18069,7 +25927,15 @@ var ts; } return false; } - function isSymbolAccessible(symbol, enclosingDeclaration, meaning) { + /** + * Check if the given symbol in given enclosing declaration is accessible and mark all associated alias to be visible if requested + * + * @param symbol a Symbol to check if accessible + * @param enclosingDeclaration a Node containing reference to the symbol + * @param meaning a SymbolFlags to check if such meaning of the symbol is accessible + * @param shouldComputeAliasToMakeVisible a boolean value to indicate whether to return aliases to be mark visible in case the symbol is accessible + */ + function isSymbolAccessible(symbol, enclosingDeclaration, meaning, shouldComputeAliasesToMakeVisible) { if (symbol && enclosingDeclaration && !(symbol.flags & 262144 /* TypeParameter */)) { var initialSymbol = symbol; var meaningToLook = meaning; @@ -18077,12 +25943,12 @@ var ts; // Symbol is accessible if it by itself is accessible var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaningToLook, /*useOnlyExternalAliasing*/ false); if (accessibleSymbolChain) { - var hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0]); + var hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0], shouldComputeAliasesToMakeVisible); if (!hasAccessibleDeclarations) { return { accessibility: 1 /* NotAccessible */, errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning), - errorModuleName: symbol !== initialSymbol ? symbolToString(symbol, enclosingDeclaration, 1920 /* Namespace */) : undefined + errorModuleName: symbol !== initialSymbol ? symbolToString(symbol, enclosingDeclaration, 1920 /* Namespace */) : undefined, }; } return hasAccessibleDeclarations; @@ -18119,7 +25985,7 @@ var ts; // Just a local name that is not accessible return { accessibility: 1 /* NotAccessible */, - errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning) + errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning), }; } return { accessibility: 0 /* Accessible */ }; @@ -18132,9 +25998,9 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 256 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 261 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } - function hasVisibleDeclarations(symbol) { + function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; if (ts.forEach(symbol.declarations, function (declaration) { return !getIsDeclarationVisible(declaration); })) { return undefined; @@ -18146,16 +26012,21 @@ var ts; // because these kind of aliases can be used to name types in declaration file var anyImportSyntax = getAnyImportSyntax(declaration); if (anyImportSyntax && - !(anyImportSyntax.flags & 1 /* Export */) && + !(ts.getModifierFlags(anyImportSyntax) & 1 /* Export */) && isDeclarationVisible(anyImportSyntax.parent)) { - getNodeLinks(declaration).isVisible = true; - if (aliasesToMakeVisible) { - if (!ts.contains(aliasesToMakeVisible, anyImportSyntax)) { - aliasesToMakeVisible.push(anyImportSyntax); + // In function "buildTypeDisplay" where we decide whether to write type-alias or serialize types, + // we want to just check if type- alias is accessible or not but we don't care about emitting those alias at that time + // since we will do the emitting later in trackSymbol. + if (shouldComputeAliasToMakeVisible) { + getNodeLinks(declaration).isVisible = true; + if (aliasesToMakeVisible) { + if (!ts.contains(aliasesToMakeVisible, anyImportSyntax)) { + aliasesToMakeVisible.push(anyImportSyntax); + } + } + else { + aliasesToMakeVisible = [anyImportSyntax]; } - } - else { - aliasesToMakeVisible = [anyImportSyntax]; } return true; } @@ -18168,12 +26039,12 @@ var ts; function isEntityNameVisible(entityName, enclosingDeclaration) { // get symbol of the first identifier of the entityName var meaning; - if (entityName.parent.kind === 158 /* TypeQuery */ || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { + if (entityName.parent.kind === 160 /* TypeQuery */ || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { // Typeof value meaning = 107455 /* Value */ | 1048576 /* ExportValue */; } - else if (entityName.kind === 139 /* QualifiedName */ || entityName.kind === 172 /* PropertyAccessExpression */ || - entityName.parent.kind === 229 /* ImportEqualsDeclaration */) { + else if (entityName.kind === 141 /* QualifiedName */ || entityName.kind === 177 /* PropertyAccessExpression */ || + entityName.parent.kind === 234 /* ImportEqualsDeclaration */) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = 1920 /* Namespace */; @@ -18185,7 +26056,7 @@ var ts; var firstIdentifier = getFirstIdentifier(entityName); var symbol = resolveName(enclosingDeclaration, firstIdentifier.text, meaning, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined); // Verify if the symbol is accessible - return (symbol && hasVisibleDeclarations(symbol)) || { + return (symbol && hasVisibleDeclarations(symbol, /*shouldComputeAliasToMakeVisible*/ true)) || { accessibility: 1 /* NotAccessible */, errorSymbolName: ts.getTextOfNode(firstIdentifier), errorNode: firstIdentifier @@ -18269,10 +26140,10 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) { var node = type.symbol.declarations[0].parent; - while (node.kind === 164 /* ParenthesizedType */) { + while (node.kind === 166 /* ParenthesizedType */) { node = node.parent; } - if (node.kind === 223 /* TypeAliasDeclaration */) { + if (node.kind === 228 /* TypeAliasDeclaration */) { return getSymbolOfNode(node); } } @@ -18280,9 +26151,12 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 226 /* ModuleBlock */ && + node.parent.kind === 231 /* ModuleBlock */ && ts.isExternalModuleAugmentation(node.parent.parent); } + function literalTypeToString(type) { + return type.flags & 32 /* StringLiteral */ ? "\"" + ts.escapeString(type.text) + "\"" : type.text; + } function getSymbolDisplayBuilder() { function getNameOfSymbol(symbol) { if (symbol.declarations && symbol.declarations.length) { @@ -18291,10 +26165,10 @@ var ts; return ts.declarationNameToString(declaration.name); } switch (declaration.kind) { - case 192 /* ClassExpression */: + case 197 /* ClassExpression */: return "(Anonymous class)"; - case 179 /* FunctionExpression */: - case 180 /* ArrowFunction */: + case 184 /* FunctionExpression */: + case 185 /* ArrowFunction */: return "(Anonymous function)"; } } @@ -18317,17 +26191,17 @@ var ts; var firstChar = symbolName.charCodeAt(0); var needsElementAccess = !ts.isIdentifierStart(firstChar, languageVersion); if (needsElementAccess) { - writePunctuation(writer, 19 /* OpenBracketToken */); + writePunctuation(writer, 20 /* OpenBracketToken */); if (ts.isSingleOrDoubleQuote(firstChar)) { writer.writeStringLiteral(symbolName); } else { writer.writeSymbol(symbolName, symbol); } - writePunctuation(writer, 20 /* CloseBracketToken */); + writePunctuation(writer, 21 /* CloseBracketToken */); } else { - writePunctuation(writer, 21 /* DotToken */); + writePunctuation(writer, 22 /* DotToken */); writer.writeSymbol(symbolName, symbol); } } @@ -18355,7 +26229,7 @@ var ts; } parentSymbol = symbol; } - // const the writer know we just wrote out a symbol. The declaration emitter writer uses + // Let the writer know we just wrote out a symbol. The declaration emitter writer uses // this to determine if an import it has previously seen (and not written out) needs // to be written to the file once the walk of the tree is complete. // @@ -18363,32 +26237,32 @@ var ts; // up front (for example, during checking) could determine if we need to emit the imports // and we could then access that data during declaration emit. writer.trackSymbol(symbol, enclosingDeclaration, meaning); - function walkSymbol(symbol, meaning) { - if (symbol) { - var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2 /* UseOnlyExternalAliasing */)); - if (!accessibleSymbolChain || - needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { - // Go up and add our parent. - walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); + /** @param endOfChain Set to false for recursive calls; non-recursive calls should always output something. */ + function walkSymbol(symbol, meaning, endOfChain) { + var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2 /* UseOnlyExternalAliasing */)); + 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); } - if (accessibleSymbolChain) { - for (var _i = 0, accessibleSymbolChain_1 = accessibleSymbolChain; _i < accessibleSymbolChain_1.length; _i++) { - var accessibleSymbol = accessibleSymbolChain_1[_i]; - appendParentTypeArgumentsAndSymbolName(accessibleSymbol); - } - } - else { - // If we didn't find accessible symbol chain for this symbol, break if this is external module - if (!parentSymbol && ts.forEach(symbol.declarations, hasExternalModuleSymbol)) { - return; - } - // if this is anonymous type break - if (symbol.flags & 2048 /* TypeLiteral */ || symbol.flags & 4096 /* ObjectLiteral */) { - return; - } - appendParentTypeArgumentsAndSymbolName(symbol); + } + if (accessibleSymbolChain) { + for (var _i = 0, accessibleSymbolChain_1 = accessibleSymbolChain; _i < accessibleSymbolChain_1.length; _i++) { + var accessibleSymbol = accessibleSymbolChain_1[_i]; + appendParentTypeArgumentsAndSymbolName(accessibleSymbol); } } + else if ( + // If this is the last part of outputting the symbol, always output. The cases apply only to parent symbols. + endOfChain || + // If a parent symbol is an external module, don't write it. (We prefer just `x` vs `"foo/bar".x`.) + !(!parentSymbol && ts.forEach(symbol.declarations, hasExternalModuleSymbol)) && + // If a parent symbol is an anonymous type, don't write it. + !(symbol.flags & (2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */))) { + appendParentTypeArgumentsAndSymbolName(symbol); + } } // Get qualified name if the symbol is not a type parameter // and there is an enclosing declaration or we specifically @@ -18396,10 +26270,11 @@ var ts; var isTypeParameter = symbol.flags & 262144 /* TypeParameter */; var typeFormatFlag = 128 /* UseFullyQualifiedType */ & typeFlags; if (!isTypeParameter && (enclosingDeclaration || typeFormatFlag)) { - walkSymbol(symbol, meaning); - return; + walkSymbol(symbol, meaning, /*endOfChain*/ true); + } + else { + appendParentTypeArgumentsAndSymbolName(symbol); } - return appendParentTypeArgumentsAndSymbolName(symbol); } function buildTypeDisplay(type, writer, enclosingDeclaration, globalFlags, symbolStack) { var globalFlagsToPass = globalFlags & 16 /* WriteOwnNameForAnyLike */; @@ -18414,65 +26289,69 @@ var ts; ? "any" : type.intrinsicName); } - else if (type.flags & 268435456 /* ThisType */) { + else if (type.flags & 16384 /* TypeParameter */ && type.isThisType) { if (inObjectTypeLiteral) { writer.reportInaccessibleThisError(); } writer.writeKeyword("this"); } - else if (type.flags & 131072 /* Reference */) { + else if (getObjectFlags(type) & 4 /* Reference */) { writeTypeReference(type, nextFlags); } else if (type.flags & 256 /* EnumLiteral */) { buildSymbolDisplay(getParentOfSymbol(type.symbol), writer, enclosingDeclaration, 793064 /* Type */, 0 /* None */, nextFlags); - writePunctuation(writer, 21 /* DotToken */); + writePunctuation(writer, 22 /* DotToken */); appendSymbolNameOnly(type.symbol, writer); } - else if (type.flags & (32768 /* Class */ | 65536 /* Interface */ | 16 /* Enum */ | 16384 /* TypeParameter */)) { + else if (getObjectFlags(type) & 3 /* ClassOrInterface */ || type.flags & (16 /* Enum */ | 16384 /* TypeParameter */)) { // The specified symbol flags need to be reinterpreted as type flags buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 793064 /* Type */, 0 /* None */, nextFlags); } - else if (!(flags & 512 /* InTypeAlias */) && type.flags & (2097152 /* Anonymous */ | 1572864 /* UnionOrIntersection */) && type.aliasSymbol) { - if (type.flags & 2097152 /* Anonymous */ || !(flags & 1024 /* UseTypeAliasValue */)) { - var typeArguments = type.aliasTypeArguments; - writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags); - } - else { - writeUnionOrIntersectionType(type, nextFlags); - } + else if (!(flags & 512 /* InTypeAlias */) && type.aliasSymbol && + isSymbolAccessible(type.aliasSymbol, enclosingDeclaration, 793064 /* Type */, /*shouldComputeAliasesToMakeVisible*/ false).accessibility === 0 /* Accessible */) { + var typeArguments = type.aliasTypeArguments; + writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, typeArguments ? typeArguments.length : 0, nextFlags); } - else if (type.flags & 1572864 /* UnionOrIntersection */) { + else if (type.flags & 196608 /* UnionOrIntersection */) { writeUnionOrIntersectionType(type, nextFlags); } - else if (type.flags & 2097152 /* Anonymous */) { + else if (getObjectFlags(type) & (16 /* Anonymous */ | 32 /* Mapped */)) { writeAnonymousType(type, nextFlags); } - else if (type.flags & 32 /* StringLiteral */) { - writer.writeStringLiteral("\"" + ts.escapeString(type.text) + "\""); + else if (type.flags & 96 /* StringOrNumberLiteral */) { + writer.writeStringLiteral(literalTypeToString(type)); } - else if (type.flags & 64 /* NumberLiteral */) { - writer.writeStringLiteral(type.text); + else if (type.flags & 262144 /* Index */) { + writer.writeKeyword("keyof"); + writeSpace(writer); + writeType(type.type, 64 /* InElementType */); + } + else if (type.flags & 524288 /* IndexedAccess */) { + writeType(type.objectType, 64 /* InElementType */); + writePunctuation(writer, 20 /* OpenBracketToken */); + writeType(type.indexType, 0 /* None */); + writePunctuation(writer, 21 /* CloseBracketToken */); } else { // Should never get here // { ... } - writePunctuation(writer, 15 /* OpenBraceToken */); + writePunctuation(writer, 16 /* OpenBraceToken */); writeSpace(writer); - writePunctuation(writer, 22 /* DotDotDotToken */); + writePunctuation(writer, 23 /* DotDotDotToken */); writeSpace(writer); - writePunctuation(writer, 16 /* CloseBraceToken */); + writePunctuation(writer, 17 /* CloseBraceToken */); } } function writeTypeList(types, delimiter) { for (var i = 0; i < types.length; i++) { if (i > 0) { - if (delimiter !== 24 /* CommaToken */) { + if (delimiter !== 25 /* CommaToken */) { writeSpace(writer); } writePunctuation(writer, delimiter); writeSpace(writer); } - writeType(types[i], delimiter === 24 /* CommaToken */ ? 0 /* None */ : 64 /* InElementType */); + writeType(types[i], delimiter === 25 /* CommaToken */ ? 0 /* None */ : 64 /* InElementType */); } } function writeSymbolTypeReference(symbol, typeArguments, pos, end, flags) { @@ -18481,29 +26360,29 @@ var ts; buildSymbolDisplay(symbol, writer, enclosingDeclaration, 793064 /* Type */, 0 /* None */, flags); } if (pos < end) { - writePunctuation(writer, 25 /* LessThanToken */); + writePunctuation(writer, 26 /* LessThanToken */); writeType(typeArguments[pos], 256 /* InFirstTypeArgument */); pos++; while (pos < end) { - writePunctuation(writer, 24 /* CommaToken */); + writePunctuation(writer, 25 /* CommaToken */); writeSpace(writer); writeType(typeArguments[pos], 0 /* None */); pos++; } - writePunctuation(writer, 27 /* GreaterThanToken */); + writePunctuation(writer, 28 /* GreaterThanToken */); } } function writeTypeReference(type, flags) { var typeArguments = type.typeArguments || emptyArray; if (type.target === globalArrayType && !(flags & 1 /* WriteArrayAsGenericType */)) { writeType(typeArguments[0], 64 /* InElementType */); - writePunctuation(writer, 19 /* OpenBracketToken */); - writePunctuation(writer, 20 /* CloseBracketToken */); + writePunctuation(writer, 20 /* OpenBracketToken */); + writePunctuation(writer, 21 /* CloseBracketToken */); } - else if (type.target.flags & 262144 /* Tuple */) { - writePunctuation(writer, 19 /* OpenBracketToken */); - writeTypeList(type.typeArguments.slice(0, getTypeReferenceArity(type)), 24 /* CommaToken */); - writePunctuation(writer, 20 /* CloseBracketToken */); + else if (type.target.objectFlags & 8 /* Tuple */) { + writePunctuation(writer, 20 /* OpenBracketToken */); + writeTypeList(type.typeArguments.slice(0, getTypeReferenceArity(type)), 25 /* CommaToken */); + writePunctuation(writer, 21 /* CloseBracketToken */); } else { // Write the type reference in the format f.g.C where A and B are type arguments @@ -18524,7 +26403,7 @@ var ts; // 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); - writePunctuation(writer, 21 /* DotToken */); + writePunctuation(writer, 22 /* DotToken */); } } } @@ -18534,16 +26413,16 @@ var ts; } function writeUnionOrIntersectionType(type, flags) { if (flags & 64 /* InElementType */) { - writePunctuation(writer, 17 /* OpenParenToken */); + writePunctuation(writer, 18 /* OpenParenToken */); } - if (type.flags & 524288 /* Union */) { - writeTypeList(formatUnionTypes(type.types), 47 /* BarToken */); + if (type.flags & 65536 /* Union */) { + writeTypeList(formatUnionTypes(type.types), 48 /* BarToken */); } else { - writeTypeList(type.types, 46 /* AmpersandToken */); + writeTypeList(type.types, 47 /* AmpersandToken */); } if (flags & 64 /* InElementType */) { - writePunctuation(writer, 18 /* CloseParenToken */); + writePunctuation(writer, 19 /* CloseParenToken */); } } function writeAnonymousType(type, flags) { @@ -18565,7 +26444,7 @@ var ts; } else { // Recursive usage, use any - writeKeyword(writer, 117 /* AnyKeyword */); + writeKeyword(writer, 118 /* AnyKeyword */); } } else { @@ -18585,11 +26464,11 @@ var ts; } function shouldWriteTypeOfFunctionSymbol() { var isStaticMethodSymbol = !!(symbol.flags & 8192 /* Method */ && - ts.forEach(symbol.declarations, function (declaration) { return declaration.flags & 32 /* Static */; })); + ts.forEach(symbol.declarations, function (declaration) { return ts.getModifierFlags(declaration) & 32 /* Static */; })); var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 256 /* SourceFile */ || declaration.parent.kind === 226 /* ModuleBlock */; + return declaration.parent.kind === 261 /* SourceFile */ || declaration.parent.kind === 231 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -18599,37 +26478,37 @@ var ts; } } function writeTypeOfSymbol(type, typeFormatFlags) { - writeKeyword(writer, 101 /* TypeOfKeyword */); + writeKeyword(writer, 102 /* TypeOfKeyword */); writeSpace(writer); buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455 /* Value */, 0 /* None */, typeFormatFlags); } function writeIndexSignature(info, keyword) { if (info) { if (info.isReadonly) { - writeKeyword(writer, 128 /* ReadonlyKeyword */); + writeKeyword(writer, 130 /* ReadonlyKeyword */); writeSpace(writer); } - writePunctuation(writer, 19 /* OpenBracketToken */); + writePunctuation(writer, 20 /* OpenBracketToken */); writer.writeParameter(info.declaration ? ts.declarationNameToString(info.declaration.parameters[0].name) : "x"); - writePunctuation(writer, 54 /* ColonToken */); + writePunctuation(writer, 55 /* ColonToken */); writeSpace(writer); writeKeyword(writer, keyword); - writePunctuation(writer, 20 /* CloseBracketToken */); - writePunctuation(writer, 54 /* ColonToken */); + writePunctuation(writer, 21 /* CloseBracketToken */); + writePunctuation(writer, 55 /* ColonToken */); writeSpace(writer); writeType(info.type, 0 /* None */); - writePunctuation(writer, 23 /* SemicolonToken */); + writePunctuation(writer, 24 /* SemicolonToken */); writer.writeLine(); } } function writePropertyWithModifiers(prop) { if (isReadonlySymbol(prop)) { - writeKeyword(writer, 128 /* ReadonlyKeyword */); + writeKeyword(writer, 130 /* ReadonlyKeyword */); writeSpace(writer); } buildSymbolDisplay(prop, writer); if (prop.flags & 536870912 /* Optional */) { - writePunctuation(writer, 53 /* QuestionToken */); + writePunctuation(writer, 54 /* QuestionToken */); } } function shouldAddParenthesisAroundFunctionType(callSignature, flags) { @@ -18645,56 +26524,68 @@ var ts; return false; } function writeLiteralType(type, flags) { + if (type.objectFlags & 32 /* Mapped */) { + if (getConstraintTypeFromMappedType(type).flags & (16384 /* TypeParameter */ | 262144 /* Index */)) { + writeMappedType(type); + return; + } + } var resolved = resolveStructuredTypeMembers(type); if (!resolved.properties.length && !resolved.stringIndexInfo && !resolved.numberIndexInfo) { if (!resolved.callSignatures.length && !resolved.constructSignatures.length) { - writePunctuation(writer, 15 /* OpenBraceToken */); - writePunctuation(writer, 16 /* CloseBraceToken */); + writePunctuation(writer, 16 /* OpenBraceToken */); + writePunctuation(writer, 17 /* CloseBraceToken */); return; } if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { var parenthesizeSignature = shouldAddParenthesisAroundFunctionType(resolved.callSignatures[0], flags); if (parenthesizeSignature) { - writePunctuation(writer, 17 /* OpenParenToken */); + writePunctuation(writer, 18 /* OpenParenToken */); } buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8 /* WriteArrowStyleSignature */, /*kind*/ undefined, symbolStack); if (parenthesizeSignature) { - writePunctuation(writer, 18 /* CloseParenToken */); + writePunctuation(writer, 19 /* CloseParenToken */); } return; } if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { if (flags & 64 /* InElementType */) { - writePunctuation(writer, 17 /* OpenParenToken */); + writePunctuation(writer, 18 /* OpenParenToken */); } - writeKeyword(writer, 92 /* NewKeyword */); + writeKeyword(writer, 93 /* NewKeyword */); writeSpace(writer); buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8 /* WriteArrowStyleSignature */, /*kind*/ undefined, symbolStack); if (flags & 64 /* InElementType */) { - writePunctuation(writer, 18 /* CloseParenToken */); + writePunctuation(writer, 19 /* CloseParenToken */); } return; } } var saveInObjectTypeLiteral = inObjectTypeLiteral; inObjectTypeLiteral = true; - writePunctuation(writer, 15 /* OpenBraceToken */); + writePunctuation(writer, 16 /* OpenBraceToken */); writer.writeLine(); writer.increaseIndent(); + writeObjectLiteralType(resolved); + writer.decreaseIndent(); + writePunctuation(writer, 17 /* CloseBraceToken */); + inObjectTypeLiteral = saveInObjectTypeLiteral; + } + function writeObjectLiteralType(resolved) { for (var _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, /*kind*/ undefined, symbolStack); - writePunctuation(writer, 23 /* SemicolonToken */); + writePunctuation(writer, 24 /* SemicolonToken */); writer.writeLine(); } for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, 1 /* Construct */, symbolStack); - writePunctuation(writer, 23 /* SemicolonToken */); + writePunctuation(writer, 24 /* SemicolonToken */); writer.writeLine(); } - writeIndexSignature(resolved.stringIndexInfo, 132 /* StringKeyword */); - writeIndexSignature(resolved.numberIndexInfo, 130 /* NumberKeyword */); + writeIndexSignature(resolved.stringIndexInfo, 134 /* StringKeyword */); + writeIndexSignature(resolved.numberIndexInfo, 132 /* NumberKeyword */); for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { var p = _e[_d]; var t = getTypeOfSymbol(p); @@ -18704,22 +26595,45 @@ var ts; var signature = signatures_1[_f]; writePropertyWithModifiers(p); buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, /*kind*/ undefined, symbolStack); - writePunctuation(writer, 23 /* SemicolonToken */); + writePunctuation(writer, 24 /* SemicolonToken */); writer.writeLine(); } } else { writePropertyWithModifiers(p); - writePunctuation(writer, 54 /* ColonToken */); + writePunctuation(writer, 55 /* ColonToken */); writeSpace(writer); writeType(t, 0 /* None */); - writePunctuation(writer, 23 /* SemicolonToken */); + writePunctuation(writer, 24 /* SemicolonToken */); writer.writeLine(); } } + } + function writeMappedType(type) { + writePunctuation(writer, 16 /* OpenBraceToken */); + writer.writeLine(); + writer.increaseIndent(); + if (type.declaration.readonlyToken) { + writeKeyword(writer, 130 /* ReadonlyKeyword */); + writeSpace(writer); + } + writePunctuation(writer, 20 /* OpenBracketToken */); + appendSymbolNameOnly(getTypeParameterFromMappedType(type).symbol, writer); + writeSpace(writer); + writeKeyword(writer, 91 /* InKeyword */); + writeSpace(writer); + writeType(getConstraintTypeFromMappedType(type), 0 /* None */); + writePunctuation(writer, 21 /* CloseBracketToken */); + if (type.declaration.questionToken) { + writePunctuation(writer, 54 /* QuestionToken */); + } + writePunctuation(writer, 55 /* ColonToken */); + writeSpace(writer); + writeType(getTemplateTypeFromMappedType(type), 0 /* None */); + writePunctuation(writer, 24 /* SemicolonToken */); + writer.writeLine(); writer.decreaseIndent(); - writePunctuation(writer, 16 /* CloseBraceToken */); - inObjectTypeLiteral = saveInObjectTypeLiteral; + writePunctuation(writer, 17 /* CloseBraceToken */); } } function buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaration, flags) { @@ -18733,7 +26647,7 @@ var ts; var constraint = getConstraintOfTypeParameter(tp); if (constraint) { writeSpace(writer); - writeKeyword(writer, 83 /* ExtendsKeyword */); + writeKeyword(writer, 84 /* ExtendsKeyword */); writeSpace(writer); buildTypeDisplay(constraint, writer, enclosingDeclaration, flags, symbolStack); } @@ -18741,7 +26655,7 @@ var ts; function buildParameterDisplay(p, writer, enclosingDeclaration, flags, symbolStack) { var parameterNode = p.valueDeclaration; if (ts.isRestParameter(parameterNode)) { - writePunctuation(writer, 22 /* DotDotDotToken */); + writePunctuation(writer, 23 /* DotDotDotToken */); } if (ts.isBindingPattern(parameterNode.name)) { buildBindingPatternDisplay(parameterNode.name, writer, enclosingDeclaration, flags, symbolStack); @@ -18750,37 +26664,37 @@ var ts; appendSymbolNameOnly(p, writer); } if (isOptionalParameter(parameterNode)) { - writePunctuation(writer, 53 /* QuestionToken */); + writePunctuation(writer, 54 /* QuestionToken */); } - writePunctuation(writer, 54 /* ColonToken */); + writePunctuation(writer, 55 /* ColonToken */); writeSpace(writer); buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, symbolStack); } function buildBindingPatternDisplay(bindingPattern, writer, enclosingDeclaration, flags, symbolStack) { // We have to explicitly emit square bracket and bracket because these tokens are not stored inside the node. - if (bindingPattern.kind === 167 /* ObjectBindingPattern */) { - writePunctuation(writer, 15 /* OpenBraceToken */); + if (bindingPattern.kind === 172 /* ObjectBindingPattern */) { + writePunctuation(writer, 16 /* OpenBraceToken */); buildDisplayForCommaSeparatedList(bindingPattern.elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); - writePunctuation(writer, 16 /* CloseBraceToken */); + writePunctuation(writer, 17 /* CloseBraceToken */); } - else if (bindingPattern.kind === 168 /* ArrayBindingPattern */) { - writePunctuation(writer, 19 /* OpenBracketToken */); + else if (bindingPattern.kind === 173 /* ArrayBindingPattern */) { + writePunctuation(writer, 20 /* OpenBracketToken */); var elements = bindingPattern.elements; buildDisplayForCommaSeparatedList(elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); if (elements && elements.hasTrailingComma) { - writePunctuation(writer, 24 /* CommaToken */); + writePunctuation(writer, 25 /* CommaToken */); } - writePunctuation(writer, 20 /* CloseBracketToken */); + writePunctuation(writer, 21 /* CloseBracketToken */); } } function buildBindingElementDisplay(bindingElement, writer, enclosingDeclaration, flags, symbolStack) { - if (bindingElement.kind === 193 /* OmittedExpression */) { + if (ts.isOmittedExpression(bindingElement)) { return; } - ts.Debug.assert(bindingElement.kind === 169 /* BindingElement */); + ts.Debug.assert(bindingElement.kind === 174 /* BindingElement */); if (bindingElement.propertyName) { - writer.writeSymbol(ts.getTextOfNode(bindingElement.propertyName), bindingElement.symbol); - writePunctuation(writer, 54 /* ColonToken */); + writer.writeProperty(ts.getTextOfNode(bindingElement.propertyName)); + writePunctuation(writer, 55 /* ColonToken */); writeSpace(writer); } if (ts.isBindingPattern(bindingElement.name)) { @@ -18788,75 +26702,75 @@ var ts; } else { if (bindingElement.dotDotDotToken) { - writePunctuation(writer, 22 /* DotDotDotToken */); + writePunctuation(writer, 23 /* DotDotDotToken */); } appendSymbolNameOnly(bindingElement.symbol, writer); } } function buildDisplayForTypeParametersAndDelimiters(typeParameters, writer, enclosingDeclaration, flags, symbolStack) { if (typeParameters && typeParameters.length) { - writePunctuation(writer, 25 /* LessThanToken */); + writePunctuation(writer, 26 /* LessThanToken */); buildDisplayForCommaSeparatedList(typeParameters, writer, function (p) { return buildTypeParameterDisplay(p, writer, enclosingDeclaration, flags, symbolStack); }); - writePunctuation(writer, 27 /* GreaterThanToken */); + writePunctuation(writer, 28 /* GreaterThanToken */); } } function buildDisplayForCommaSeparatedList(list, writer, action) { for (var i = 0; i < list.length; i++) { if (i > 0) { - writePunctuation(writer, 24 /* CommaToken */); + writePunctuation(writer, 25 /* CommaToken */); writeSpace(writer); } action(list[i]); } } - function buildDisplayForTypeArgumentsAndDelimiters(typeParameters, mapper, writer, enclosingDeclaration, flags, symbolStack) { + function buildDisplayForTypeArgumentsAndDelimiters(typeParameters, mapper, writer, enclosingDeclaration) { if (typeParameters && typeParameters.length) { - writePunctuation(writer, 25 /* LessThanToken */); - var flags_1 = 256 /* InFirstTypeArgument */; + writePunctuation(writer, 26 /* LessThanToken */); + var flags = 256 /* InFirstTypeArgument */; for (var i = 0; i < typeParameters.length; i++) { if (i > 0) { - writePunctuation(writer, 24 /* CommaToken */); + writePunctuation(writer, 25 /* CommaToken */); writeSpace(writer); - flags_1 = 0 /* None */; + flags = 0 /* None */; } - buildTypeDisplay(mapper(typeParameters[i]), writer, enclosingDeclaration, flags_1); + buildTypeDisplay(mapper(typeParameters[i]), writer, enclosingDeclaration, flags); } - writePunctuation(writer, 27 /* GreaterThanToken */); + writePunctuation(writer, 28 /* GreaterThanToken */); } } function buildDisplayForParametersAndDelimiters(thisParameter, parameters, writer, enclosingDeclaration, flags, symbolStack) { - writePunctuation(writer, 17 /* OpenParenToken */); + writePunctuation(writer, 18 /* OpenParenToken */); if (thisParameter) { buildParameterDisplay(thisParameter, writer, enclosingDeclaration, flags, symbolStack); } for (var i = 0; i < parameters.length; i++) { if (i > 0 || thisParameter) { - writePunctuation(writer, 24 /* CommaToken */); + writePunctuation(writer, 25 /* CommaToken */); writeSpace(writer); } buildParameterDisplay(parameters[i], writer, enclosingDeclaration, flags, symbolStack); } - writePunctuation(writer, 18 /* CloseParenToken */); + writePunctuation(writer, 19 /* CloseParenToken */); } function buildTypePredicateDisplay(predicate, writer, enclosingDeclaration, flags, symbolStack) { if (ts.isIdentifierTypePredicate(predicate)) { writer.writeParameter(predicate.parameterName); } else { - writeKeyword(writer, 97 /* ThisKeyword */); + writeKeyword(writer, 98 /* ThisKeyword */); } writeSpace(writer); - writeKeyword(writer, 124 /* IsKeyword */); + writeKeyword(writer, 125 /* IsKeyword */); writeSpace(writer); buildTypeDisplay(predicate.type, writer, enclosingDeclaration, flags, symbolStack); } function buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack) { if (flags & 8 /* WriteArrowStyleSignature */) { writeSpace(writer); - writePunctuation(writer, 34 /* EqualsGreaterThanToken */); + writePunctuation(writer, 35 /* EqualsGreaterThanToken */); } else { - writePunctuation(writer, 54 /* ColonToken */); + writePunctuation(writer, 55 /* ColonToken */); } writeSpace(writer); if (signature.typePredicate) { @@ -18869,7 +26783,7 @@ var ts; } function buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, kind, symbolStack) { if (kind === 1 /* Construct */) { - writeKeyword(writer, 92 /* NewKeyword */); + writeKeyword(writer, 93 /* NewKeyword */); writeSpace(writer); } if (signature.target && (flags & 32 /* WriteTypeArgumentsOfSignature */)) { @@ -18907,74 +26821,75 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 169 /* BindingElement */: + case 174 /* BindingElement */: return isDeclarationVisible(node.parent.parent); - case 218 /* VariableDeclaration */: + case 223 /* VariableDeclaration */: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { // If the binding pattern is empty, this variable declaration is not visible return false; } // Otherwise fall through - case 225 /* ModuleDeclaration */: - case 221 /* ClassDeclaration */: - case 222 /* InterfaceDeclaration */: - case 223 /* TypeAliasDeclaration */: - case 220 /* FunctionDeclaration */: - case 224 /* EnumDeclaration */: - case 229 /* ImportEqualsDeclaration */: + case 230 /* ModuleDeclaration */: + case 226 /* ClassDeclaration */: + case 227 /* InterfaceDeclaration */: + case 228 /* TypeAliasDeclaration */: + case 225 /* FunctionDeclaration */: + case 229 /* EnumDeclaration */: + case 234 /* ImportEqualsDeclaration */: // external module augmentation is always visible if (ts.isExternalModuleAugmentation(node)) { return true; } var parent_8 = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) - if (!(ts.getCombinedNodeFlags(node) & 1 /* Export */) && - !(node.kind !== 229 /* ImportEqualsDeclaration */ && parent_8.kind !== 256 /* SourceFile */ && ts.isInAmbientContext(parent_8))) { + if (!(ts.getCombinedModifierFlags(node) & 1 /* Export */) && + !(node.kind !== 234 /* ImportEqualsDeclaration */ && parent_8.kind !== 261 /* SourceFile */ && ts.isInAmbientContext(parent_8))) { return isGlobalSourceFile(parent_8); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible return isDeclarationVisible(parent_8); - case 145 /* PropertyDeclaration */: - case 144 /* PropertySignature */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - if (node.flags & (8 /* Private */ | 16 /* Protected */)) { + case 147 /* PropertyDeclaration */: + case 146 /* PropertySignature */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + if (ts.getModifierFlags(node) & (8 /* Private */ | 16 /* Protected */)) { // Private/protected properties/methods are not visible return false; } // Public properties/methods are visible if its parents are visible, so const it fall into next case statement - case 148 /* Constructor */: - case 152 /* ConstructSignature */: - case 151 /* CallSignature */: - case 153 /* IndexSignature */: - case 142 /* Parameter */: - case 226 /* ModuleBlock */: - case 156 /* FunctionType */: - case 157 /* ConstructorType */: - case 159 /* TypeLiteral */: - case 155 /* TypeReference */: - case 160 /* ArrayType */: - case 161 /* TupleType */: - case 162 /* UnionType */: - case 163 /* IntersectionType */: - case 164 /* ParenthesizedType */: + case 150 /* Constructor */: + case 154 /* ConstructSignature */: + case 153 /* CallSignature */: + case 155 /* IndexSignature */: + case 144 /* Parameter */: + case 231 /* ModuleBlock */: + case 158 /* FunctionType */: + case 159 /* ConstructorType */: + case 161 /* TypeLiteral */: + case 157 /* TypeReference */: + case 162 /* ArrayType */: + case 163 /* TupleType */: + case 164 /* UnionType */: + case 165 /* IntersectionType */: + case 166 /* ParenthesizedType */: return isDeclarationVisible(node.parent); // Default binding, import specifier and namespace import is visible // only on demand so by default it is not visible - case 231 /* ImportClause */: - case 232 /* NamespaceImport */: - case 234 /* ImportSpecifier */: + case 236 /* ImportClause */: + case 237 /* NamespaceImport */: + case 239 /* ImportSpecifier */: return false; // Type parameters are always visible - case 141 /* TypeParameter */: - // Source file is always visible - case 256 /* SourceFile */: + case 143 /* TypeParameter */: + // Source file and namespace export are always visible + case 261 /* SourceFile */: + case 233 /* NamespaceExportDeclaration */: return true; // Export assignments do not create name bindings outside the module - case 235 /* ExportAssignment */: + case 240 /* ExportAssignment */: return false; default: return false; @@ -18983,10 +26898,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 235 /* ExportAssignment */) { + if (node.parent && node.parent.kind === 240 /* ExportAssignment */) { exportSymbol = resolveName(node.parent, node.text, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */ | 8388608 /* Alias */, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 238 /* ExportSpecifier */) { + else if (node.parent.kind === 243 /* ExportSpecifier */) { var exportSpecifier = node.parent; exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : @@ -19061,7 +26976,6 @@ var ts; return getSymbolLinks(target).declaredType; } if (propertyName === 1 /* ResolvedBaseConstructorType */) { - ts.Debug.assert(!!(target.flags & 32768 /* Class */)); return target.resolvedBaseConstructorType; } if (propertyName === 3 /* ResolvedReturnType */) { @@ -19080,12 +26994,12 @@ var ts; node = ts.getRootDeclaration(node); while (node) { switch (node.kind) { - case 218 /* VariableDeclaration */: - case 219 /* VariableDeclarationList */: - case 234 /* ImportSpecifier */: - case 233 /* NamedImports */: - case 232 /* NamespaceImport */: - case 231 /* ImportClause */: + case 223 /* VariableDeclaration */: + case 224 /* VariableDeclarationList */: + case 239 /* ImportSpecifier */: + case 238 /* NamedImports */: + case 237 /* NamespaceImport */: + case 236 /* ImportClause */: node = node.parent; break; default: @@ -19118,22 +27032,36 @@ var ts; var symbol = getSymbolOfNode(node); return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, /*includeOptionality*/ false); } - function getTextOfPropertyName(name) { - switch (name.kind) { - case 69 /* Identifier */: - return name.text; - case 9 /* StringLiteral */: - case 8 /* NumericLiteral */: - return name.text; - case 140 /* ComputedPropertyName */: - if (ts.isStringOrNumericLiteral(name.expression.kind)) { - return name.expression.text; - } - } - return undefined; - } function isComputedNonLiteralName(name) { - return name.kind === 140 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteral(name.expression.kind); + return name.kind === 142 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteral(name.expression); + } + function getRestType(source, properties, symbol) { + source = filterType(source, function (t) { return !(t.flags & 6144 /* Nullable */); }); + if (source.flags & 8192 /* Never */) { + return emptyObjectType; + } + if (source.flags & 65536 /* Union */) { + return mapType(source, function (t) { return getRestType(t, properties, symbol); }); + } + var members = ts.createMap(); + var names = ts.createMap(); + for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) { + 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]; + var inNamesToRemove = prop.name in names; + var isPrivate = getDeclarationModifierFlagsFromSymbol(prop) & (8 /* Private */ | 16 /* Protected */); + var isMethod = prop.flags & 8192 /* Method */; + var isSetOnlyAccessor = prop.flags & 65536 /* SetAccessor */ && !(prop.flags & 32768 /* GetAccessor */); + if (!inNamesToRemove && !isPrivate && !isMethod && !isSetOnlyAccessor) { + members[prop.name] = prop; + } + } + var stringIndexInfo = getIndexInfoOfType(source, 0 /* String */); + var numberIndexInfo = getIndexInfoOfType(source, 1 /* Number */); + return createAnonymousType(symbol, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); } /** Return the inferred type for a binding element */ function getTypeForBindingElement(declaration) { @@ -19148,30 +27076,46 @@ var ts; // undefined or any type of the parent. if (!parentType || isTypeAny(parentType)) { if (declaration.initializer) { - return checkExpressionCached(declaration.initializer); + return checkDeclarationInitializer(declaration); } return parentType; } var type; - if (pattern.kind === 167 /* ObjectBindingPattern */) { - // Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form) - var name_11 = declaration.propertyName || declaration.name; - if (isComputedNonLiteralName(name_11)) { - // computed properties with non-literal names are treated as 'any' - return anyType; + if (pattern.kind === 172 /* ObjectBindingPattern */) { + if (declaration.dotDotDotToken) { + if (!isValidSpreadType(parentType)) { + error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types); + return unknownType; + } + var literalMembers = []; + for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (!element.dotDotDotToken) { + literalMembers.push(element.propertyName || element.name); + } + } + type = getRestType(parentType, literalMembers, declaration.symbol); } - if (declaration.initializer) { - getContextualType(declaration.initializer); - } - // 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 = getTextOfPropertyName(name_11); - type = getTypeOfPropertyOfType(parentType, text) || - isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1 /* Number */) || - getIndexTypeOfType(parentType, 0 /* String */); - if (!type) { - error(name_11, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_11)); - return unknownType; + else { + // Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form) + var name_18 = declaration.propertyName || declaration.name; + if (isComputedNonLiteralName(name_18)) { + // computed properties with non-literal names are treated as 'any' + return anyType; + } + if (declaration.initializer) { + getContextualType(declaration.initializer); + } + // 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_18); + type = getTypeOfPropertyOfType(parentType, text) || + isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1 /* Number */) || + getIndexTypeOfType(parentType, 0 /* String */); + if (!type) { + error(name_18, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name_18)); + return unknownType; + } } } else { @@ -19179,7 +27123,11 @@ var ts; // present (aka the tuple element property). This call also checks that the parentType is in // fact an iterable or array (depending on target language). var elementType = checkIteratedTypeOrElementType(parentType, pattern, /*allowStringInput*/ false); - if (!declaration.dotDotDotToken) { + if (declaration.dotDotDotToken) { + // Rest element has an array type with the same element type as the parent type + type = createArrayType(elementType); + } + else { // Use specific property type when parent is a tuple or numeric index type when parent is an array var propName = "" + ts.indexOf(pattern.elements, declaration); type = isTupleLikeType(parentType) @@ -19195,10 +27143,6 @@ var ts; return unknownType; } } - else { - // Rest element has an array type with the same element type as the parent type - type = createArrayType(elementType); - } } // In strict null checking mode, if a default value of a non-undefined type is specified, remove // undefined from the final type. @@ -19210,42 +27154,26 @@ 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 === 218 /* VariableDeclaration */ && - declaration.parent.kind === 219 /* VariableDeclarationList */ && - declaration.parent.parent.kind === 200 /* 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 === 142 /* 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; } + function isNullOrUndefined(node) { + var expr = ts.skipParentheses(node); + return expr.kind === 94 /* NullKeyword */ || expr.kind === 70 /* Identifier */ && getResolvedSymbol(expr) === undefinedSymbol; + } + function isEmptyArrayLiteral(node) { + var expr = ts.skipParentheses(node); + return expr.kind === 175 /* ArrayLiteralExpression */ && expr.elements.length === 0; + } function addOptionality(type, optional) { return strictNullChecks && optional ? includeFalsyTypes(type, 2048 /* Undefined */) : type; } // Return the inferred type for a variable, parameter, or property declaration function getTypeForVariableLikeDeclaration(declaration, includeOptionality) { - if (declaration.flags & 134217728 /* JavaScriptFile */) { + if (declaration.flags & 65536 /* JavaScriptFile */) { // If this is a variable in a JavaScript file, then use the JSDoc type (if it has // one as its type), otherwise fallback to the below standard TS codepaths to // try to figure it out. @@ -19254,11 +27182,13 @@ var ts; return type; } } - // A variable declared in a for..in statement is always of type string - if (declaration.parent.parent.kind === 207 /* ForInStatement */) { - return stringType; + // 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 */) { + var indexType = getIndexType(checkNonNullExpression(declaration.parent.parent.expression)); + return indexType.flags & (16384 /* TypeParameter */ | 262144 /* Index */) ? indexType : stringType; } - if (declaration.parent.parent.kind === 208 /* ForOfStatement */) { + if (declaration.parent.parent.kind === 213 /* ForOfStatement */) { // checkRightHandSideOfForOf will return undefined if the for-of expression type was // missing properties/signatures required to get its iteratedType (like // [Symbol.iterator] or next). This may be because we accessed properties from anyType, @@ -19272,11 +27202,26 @@ var ts; if (declaration.type) { return addOptionality(getTypeFromTypeNode(declaration.type), /*optional*/ declaration.questionToken && includeOptionality); } - if (declaration.kind === 142 /* Parameter */) { + if ((compilerOptions.noImplicitAny || declaration.flags & 65536 /* JavaScriptFile */) && + declaration.kind === 223 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) && + !(ts.getCombinedModifierFlags(declaration) & 1 /* Export */) && !ts.isInAmbientContext(declaration)) { + // 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; + } + // Use control flow tracked 'any[]' type for non-ambient, non-exported variables with an empty array + // literal initializer. + if (declaration.initializer && isEmptyArrayLiteral(declaration.initializer)) { + return autoArrayType; + } + } + if (declaration.kind === 144 /* Parameter */) { var func = declaration.parent; // For a parameter of a set accessor, use the type of the get accessor if one is present - if (func.kind === 150 /* SetAccessor */ && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 149 /* GetAccessor */); + if (func.kind === 152 /* SetAccessor */ && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 151 /* GetAccessor */); if (getter) { var getterSignature = getSignatureFromDeclaration(getter); var thisParameter = getAccessorThisParameter(func); @@ -19291,8 +27236,7 @@ var ts; // Use contextual parameter type if one is available var type = void 0; if (declaration.symbol.name === "this") { - var thisParameter = getContextualThisParameter(func); - type = thisParameter ? getTypeOfSymbol(thisParameter) : undefined; + type = getContextualThisParameterType(func); } else { type = getContextuallyTypedParameterType(declaration); @@ -19303,10 +27247,11 @@ var ts; } // Use the type of the initializer expression if one is present if (declaration.initializer) { - return addOptionality(checkExpressionCached(declaration.initializer), /*optional*/ declaration.questionToken && includeOptionality); + var type = checkDeclarationInitializer(declaration); + return addOptionality(type, /*optional*/ declaration.questionToken && includeOptionality); } // If it is a short-hand property assignment, use the type of the identifier - if (declaration.kind === 254 /* ShorthandPropertyAssignment */) { + if (declaration.kind === 258 /* ShorthandPropertyAssignment */) { return checkIdentifier(declaration.name); } // If the declaration specifies a binding pattern, use the type implied by the binding pattern @@ -19321,7 +27266,7 @@ var ts; // pattern. Otherwise, it is the type any. function getTypeFromBindingElement(element, includePatternInType, reportErrors) { if (element.initializer) { - return checkExpressionCached(element.initializer); + return checkDeclarationInitializer(element); } if (ts.isBindingPattern(element.name)) { return getTypeFromBindingPattern(element.name, includePatternInType, reportErrors); @@ -19334,6 +27279,7 @@ var ts; // Return the type implied by an object binding pattern function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) { var members = ts.createMap(); + var stringIndexInfo; var hasComputedProperties = false; ts.forEach(pattern.elements, function (e) { var name = e.propertyName || e.name; @@ -19342,30 +27288,35 @@ var ts; hasComputedProperties = true; return; } - var text = getTextOfPropertyName(name); + if (e.dotDotDotToken) { + stringIndexInfo = createIndexInfo(anyType, /*isReadonly*/ false); + return; + } + var text = ts.getTextOfPropertyName(name); var flags = 4 /* Property */ | 67108864 /* Transient */ | (e.initializer ? 536870912 /* Optional */ : 0); var symbol = createSymbol(flags, text); symbol.type = getTypeFromBindingElement(e, includePatternInType, reportErrors); symbol.bindingElement = e; members[symbol.name] = symbol; }); - var result = createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined); + var result = createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, undefined); if (includePatternInType) { result.pattern = pattern; } if (hasComputedProperties) { - result.flags |= 536870912 /* ObjectLiteralPatternWithComputedProperties */; + result.objectFlags |= 512 /* ObjectLiteralPatternWithComputedProperties */; } return result; } // Return the type implied by an array binding pattern function getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors) { var elements = pattern.elements; - if (elements.length === 0 || elements[elements.length - 1].dotDotDotToken) { - return languageVersion >= 2 /* ES6 */ ? createIterableType(anyType) : anyArrayType; + var lastElement = ts.lastOrUndefined(elements); + if (elements.length === 0 || (!ts.isOmittedExpression(lastElement) && lastElement.dotDotDotToken)) { + return languageVersion >= 2 /* ES2015 */ ? createIterableType(anyType) : anyArrayType; } // If the pattern has at least one element, and no rest element, then it should imply a tuple type. - var elementTypes = ts.map(elements, function (e) { return e.kind === 193 /* OmittedExpression */ ? anyType : getTypeFromBindingElement(e, includePatternInType, reportErrors); }); + var elementTypes = ts.map(elements, function (e) { return ts.isOmittedExpression(e) ? anyType : getTypeFromBindingElement(e, includePatternInType, reportErrors); }); var result = createTupleType(elementTypes); if (includePatternInType) { result = cloneTypeReference(result); @@ -19381,7 +27332,7 @@ var ts; // parameter with no type annotation or initializer, the type implied by the binding pattern becomes the type of // the parameter. function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { - return pattern.kind === 167 /* ObjectBindingPattern */ + return pattern.kind === 172 /* ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); } @@ -19403,7 +27354,7 @@ var ts; // During a normal type check we'll never get to here with a property assignment (the check of the containing // object literal uses a different path). We exclude widening only so that language services and type verification // tools see the actual type. - if (declaration.kind === 253 /* PropertyAssignment */) { + if (declaration.kind === 257 /* PropertyAssignment */) { return type; } return getWidenedType(type); @@ -19420,7 +27371,7 @@ var ts; } function declarationBelongsToPrivateAmbientMember(declaration) { var root = ts.getRootDeclaration(declaration); - var memberDeclaration = root.kind === 142 /* Parameter */ ? root.parent : root; + var memberDeclaration = root.kind === 144 /* Parameter */ ? root.parent : root; return isPrivateWithinAmbient(memberDeclaration); } function getTypeOfVariableOrParameterOrProperty(symbol) { @@ -19432,14 +27383,14 @@ var ts; } // Handle catch clause variables var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 252 /* CatchClause */) { + if (ts.isCatchClauseVariableDeclarationOrBindingElement(declaration)) { return links.type = anyType; } // Handle export default expressions - if (declaration.kind === 235 /* ExportAssignment */) { + if (declaration.kind === 240 /* ExportAssignment */) { return links.type = checkExpression(declaration.expression); } - if (declaration.flags & 134217728 /* JavaScriptFile */ && declaration.kind === 280 /* JSDocPropertyTag */ && declaration.typeExpression) { + if (declaration.flags & 65536 /* JavaScriptFile */ && declaration.kind === 286 /* JSDocPropertyTag */ && declaration.typeExpression) { return links.type = getTypeFromTypeNode(declaration.typeExpression.type); } // Handle variable, parameter or property @@ -19452,16 +27403,16 @@ var ts; // * exports.p = expr // * this.p = expr // * className.prototype.method = expr - if (declaration.kind === 187 /* BinaryExpression */ || - declaration.kind === 172 /* PropertyAccessExpression */ && declaration.parent.kind === 187 /* BinaryExpression */) { + if (declaration.kind === 192 /* BinaryExpression */ || + declaration.kind === 177 /* PropertyAccessExpression */ && declaration.parent.kind === 192 /* BinaryExpression */) { // Use JS Doc type if present on parent expression statement - if (declaration.flags & 134217728 /* JavaScriptFile */) { - var typeTag = ts.getJSDocTypeTag(declaration.parent); - if (typeTag && typeTag.typeExpression) { - return links.type = getTypeFromTypeNode(typeTag.typeExpression.type); + if (declaration.flags & 65536 /* JavaScriptFile */) { + var jsdocType = ts.getJSDocType(declaration.parent); + if (jsdocType) { + return links.type = getTypeFromTypeNode(jsdocType); } } - var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 187 /* BinaryExpression */ ? + var declaredTypes = ts.map(symbol.declarations, function (decl) { return decl.kind === 192 /* BinaryExpression */ ? checkExpressionCached(decl.right) : checkExpressionCached(decl.parent.right); }); type = getUnionType(declaredTypes, /*subtypeReduction*/ true); @@ -19470,18 +27421,7 @@ var ts; type = getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true); } if (!popTypeResolution()) { - if (symbol.valueDeclaration.type) { - // Variable has type annotation that circularly references the variable itself - type = unknownType; - error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); - } - else { - // Variable has initializer that circularly references the variable itself - type = anyType; - if (compilerOptions.noImplicitAny) { - error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); - } - } + type = reportCircularityError(symbol); } links.type = type; } @@ -19489,7 +27429,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 149 /* GetAccessor */) { + if (accessor.kind === 151 /* GetAccessor */) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -19509,9 +27449,9 @@ var ts; function getTypeOfAccessors(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - var getter = ts.getDeclarationOfKind(symbol, 149 /* GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 150 /* SetAccessor */); - if (getter && getter.flags & 134217728 /* JavaScriptFile */) { + var getter = ts.getDeclarationOfKind(symbol, 151 /* GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 152 /* SetAccessor */); + if (getter && getter.flags & 65536 /* JavaScriptFile */) { var jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter); if (jsDocType) { return links.type = jsDocType; @@ -19539,7 +27479,13 @@ var ts; } else { if (compilerOptions.noImplicitAny) { - error(setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation, symbolToString(symbol)); + if (setter) { + error(setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol)); + } + else { + ts.Debug.assert(!!getter, "there must existed getter as we are current checking either setter or getter in this function"); + error(getter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation, symbolToString(symbol)); + } } type = anyType; } @@ -19548,7 +27494,7 @@ var ts; if (!popTypeResolution()) { type = anyType; if (compilerOptions.noImplicitAny) { - var getter_1 = ts.getDeclarationOfKind(symbol, 149 /* GetAccessor */); + var getter_1 = ts.getDeclarationOfKind(symbol, 151 /* GetAccessor */); error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } } @@ -19559,11 +27505,11 @@ var ts; function getTypeOfFuncClassEnumModule(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - if (symbol.valueDeclaration.kind === 225 /* ModuleDeclaration */ && ts.isShorthandAmbientModuleSymbol(symbol)) { + if (symbol.flags & 1536 /* Module */ && ts.isShorthandAmbientModuleSymbol(symbol)) { links.type = anyType; } else { - var type = createObjectType(2097152 /* Anonymous */, symbol); + var type = createObjectType(16 /* Anonymous */, symbol); links.type = strictNullChecks && symbol.flags & 536870912 /* Optional */ ? includeFalsyTypes(type, 2048 /* Undefined */) : type; } @@ -19573,7 +27519,7 @@ var ts; function getTypeOfEnumMember(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - links.type = getDeclaredTypeOfEnum(getParentOfSymbol(symbol)); + links.type = getDeclaredTypeOfEnumMember(symbol); } return links.type; } @@ -19595,10 +27541,29 @@ var ts; function getTypeOfInstantiatedSymbol(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - links.type = instantiateType(getTypeOfSymbol(links.target), links.mapper); + if (!pushTypeResolution(symbol, 0 /* Type */)) { + return unknownType; + } + var type = instantiateType(getTypeOfSymbol(links.target), links.mapper); + if (!popTypeResolution()) { + type = reportCircularityError(symbol); + } + links.type = type; } return links.type; } + function reportCircularityError(symbol) { + // Check if variable has type annotation that circularly references the variable itself + if (symbol.valueDeclaration.type) { + error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + return unknownType; + } + // Otherwise variable has initializer that circularly references the variable itself + if (compilerOptions.noImplicitAny) { + error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); + } + return anyType; + } function getTypeOfSymbol(symbol) { if (symbol.flags & 16777216 /* Instantiated */) { return getTypeOfInstantiatedSymbol(symbol); @@ -19621,7 +27586,7 @@ var ts; return unknownType; } function getTargetType(type) { - return type.flags & 131072 /* Reference */ ? type.target : type; + return getObjectFlags(type) & 4 /* Reference */ ? type.target : type; } function hasBaseType(type, checkBase) { return check(type); @@ -19655,9 +27620,9 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 221 /* ClassDeclaration */ || node.kind === 192 /* ClassExpression */ || - node.kind === 220 /* FunctionDeclaration */ || node.kind === 179 /* FunctionExpression */ || - node.kind === 147 /* MethodDeclaration */ || node.kind === 180 /* ArrowFunction */) { + if (node.kind === 226 /* ClassDeclaration */ || node.kind === 197 /* ClassExpression */ || + node.kind === 225 /* FunctionDeclaration */ || node.kind === 184 /* FunctionExpression */ || + node.kind === 149 /* MethodDeclaration */ || node.kind === 185 /* ArrowFunction */) { var declarations = node.typeParameters; if (declarations) { return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations); @@ -19667,7 +27632,7 @@ var ts; } // The outer type parameters are those defined by enclosing generic classes, methods, or functions. function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 222 /* InterfaceDeclaration */); + var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 227 /* InterfaceDeclaration */); return appendOuterTypeParameters(undefined, declaration); } // The local type parameters are the combined set of type parameters from all declarations of the class, @@ -19676,8 +27641,8 @@ var ts; var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 222 /* InterfaceDeclaration */ || node.kind === 221 /* ClassDeclaration */ || - node.kind === 192 /* ClassExpression */ || node.kind === 223 /* TypeAliasDeclaration */) { + if (node.kind === 227 /* InterfaceDeclaration */ || node.kind === 226 /* ClassDeclaration */ || + node.kind === 197 /* ClassExpression */ || node.kind === 228 /* TypeAliasDeclaration */) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -19692,7 +27657,7 @@ var ts; return ts.concatenate(getOuterTypeParametersOfClassOrInterface(symbol), getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol)); } function isConstructorType(type) { - return type.flags & 2588672 /* ObjectType */ && getSignaturesOfType(type, 1 /* Construct */).length > 0; + return type.flags & 32768 /* Object */ && getSignaturesOfType(type, 1 /* Construct */).length > 0; } function getBaseTypeNodeOfClass(type) { return ts.getClassExtendsHeritageClauseElement(type.symbol.valueDeclaration); @@ -19724,7 +27689,7 @@ var ts; return unknownType; } var baseConstructorType = checkExpression(baseTypeNode.expression); - if (baseConstructorType.flags & 2588672 /* ObjectType */) { + if (baseConstructorType.flags & 32768 /* Object */) { // Resolving the members of a class requires us to resolve the base class of that class. // We force resolution here such that we catch circularities now. resolveStructuredTypeMembers(baseConstructorType); @@ -19743,7 +27708,7 @@ var ts; } function getBaseTypes(type) { if (!type.resolvedBaseTypes) { - if (type.flags & 262144 /* Tuple */) { + if (type.objectFlags & 8 /* Tuple */) { type.resolvedBaseTypes = [createArrayType(getUnionType(type.typeParameters))]; } else if (type.symbol.flags & (32 /* Class */ | 64 /* Interface */)) { @@ -19763,7 +27728,7 @@ var ts; function resolveBaseTypesOfClass(type) { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; var baseConstructorType = getBaseConstructorTypeOfClass(type); - if (!(baseConstructorType.flags & 2588672 /* ObjectType */)) { + if (!(baseConstructorType.flags & 32768 /* Object */)) { return; } var baseTypeNode = getBaseTypeNodeOfClass(type); @@ -19787,15 +27752,23 @@ 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; } - if (!(getTargetType(baseType).flags & (32768 /* Class */ | 65536 /* Interface */))) { + if (!(getObjectFlags(getTargetType(baseType)) & 3 /* ClassOrInterface */)) { error(baseTypeNode.expression, ts.Diagnostics.Base_constructor_return_type_0_is_not_a_class_or_interface_type, typeToString(baseType)); 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) { @@ -19820,12 +27793,12 @@ var ts; type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 222 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 227 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); if (baseType !== unknownType) { - if (getTargetType(baseType).flags & (32768 /* Class */ | 65536 /* Interface */)) { + if (getObjectFlags(getTargetType(baseType)) & 3 /* ClassOrInterface */) { if (type !== baseType && !hasBaseType(baseType, type)) { if (type.resolvedBaseTypes === emptyArray) { type.resolvedBaseTypes = [baseType]; @@ -19852,8 +27825,8 @@ var ts; function isIndependentInterface(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 222 /* InterfaceDeclaration */) { - if (declaration.flags & 16384 /* ContainsThis */) { + if (declaration.kind === 227 /* InterfaceDeclaration */) { + if (declaration.flags & 64 /* ContainsThis */) { return false; } var baseTypeNodes = ts.getInterfaceBaseTypeNodes(declaration); @@ -19875,7 +27848,7 @@ var ts; function getDeclaredTypeOfClassOrInterface(symbol) { var links = getSymbolLinks(symbol); if (!links.declaredType) { - var kind = symbol.flags & 32 /* Class */ ? 32768 /* Class */ : 65536 /* Interface */; + var kind = symbol.flags & 32 /* Class */ ? 1 /* Class */ : 2 /* Interface */; var type = links.declaredType = createObjectType(kind, symbol); var outerTypeParameters = getOuterTypeParametersOfClassOrInterface(symbol); var localTypeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); @@ -19884,8 +27857,8 @@ var ts; // property types inferred from initializers and method return types inferred from return statements are very hard // to exhaustively analyze). We give interfaces a "this" type if we can't definitely determine that they are free of // "this" references. - if (outerTypeParameters || localTypeParameters || kind === 32768 /* Class */ || !isIndependentInterface(symbol)) { - type.flags |= 131072 /* Reference */; + if (outerTypeParameters || localTypeParameters || kind === 1 /* Class */ || !isIndependentInterface(symbol)) { + type.objectFlags |= 4 /* Reference */; type.typeParameters = ts.concatenate(outerTypeParameters, localTypeParameters); type.outerTypeParameters = outerTypeParameters; type.localTypeParameters = localTypeParameters; @@ -19893,7 +27866,8 @@ var ts; type.instantiations[getTypeListId(type.typeParameters)] = type; type.target = type; type.typeArguments = type.typeParameters; - type.thisType = createType(16384 /* TypeParameter */ | 268435456 /* ThisType */); + type.thisType = createType(16384 /* TypeParameter */); + type.thisType.isThisType = true; type.thisType.symbol = symbol; type.thisType.constraint = type; } @@ -19908,8 +27882,7 @@ var ts; if (!pushTypeResolution(symbol, 2 /* DeclaredType */)) { return unknownType; } - var typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); - var declaration = ts.getDeclarationOfKind(symbol, 279 /* JSDocTypedefTag */); + var declaration = ts.getDeclarationOfKind(symbol, 285 /* JSDocTypedefTag */); var type = void 0; if (declaration) { if (declaration.jsDocTypeLiteral) { @@ -19920,16 +27893,17 @@ var ts; } } else { - declaration = ts.getDeclarationOfKind(symbol, 223 /* TypeAliasDeclaration */); - type = getTypeFromTypeNode(declaration.type, symbol, typeParameters); + declaration = ts.getDeclarationOfKind(symbol, 228 /* TypeAliasDeclaration */); + type = getTypeFromTypeNode(declaration.type); } if (popTypeResolution()) { - links.typeParameters = typeParameters; + var typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); if (typeParameters) { // Initialize the instantiation cache for generic type aliases. The declared type corresponds to // an instantiation of the type alias with the type parameters supplied as type arguments. + links.typeParameters = typeParameters; links.instantiations = ts.createMap(); - links.instantiations[getTypeListId(links.typeParameters)] = type; + links.instantiations[getTypeListId(typeParameters)] = type; } } else { @@ -19946,14 +27920,14 @@ var ts; return !ts.isInAmbientContext(member); } return expr.kind === 8 /* NumericLiteral */ || - expr.kind === 185 /* PrefixUnaryExpression */ && expr.operator === 36 /* MinusToken */ && + expr.kind === 190 /* PrefixUnaryExpression */ && expr.operator === 37 /* MinusToken */ && expr.operand.kind === 8 /* NumericLiteral */ || - expr.kind === 69 /* Identifier */ && !!symbol.exports[expr.text]; + expr.kind === 70 /* Identifier */ && !!symbol.exports[expr.text]; } function enumHasLiteralMembers(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 224 /* EnumDeclaration */) { + if (declaration.kind === 229 /* EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (!isLiteralEnumMember(symbol, member)) { @@ -19964,6 +27938,13 @@ var ts; } return true; } + function createEnumLiteralType(symbol, baseType, text) { + var type = createType(256 /* EnumLiteral */); + type.symbol = symbol; + type.baseType = baseType; + type.text = text; + return type; + } function getDeclaredTypeOfEnum(symbol) { var links = getSymbolLinks(symbol); if (!links.declaredType) { @@ -19974,17 +27955,14 @@ var ts; var memberTypes = ts.createMap(); for (var _i = 0, _a = enumType.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 224 /* EnumDeclaration */) { + if (declaration.kind === 229 /* EnumDeclaration */) { computeEnumMemberValues(declaration); for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; var memberSymbol = getSymbolOfNode(member); var value = getEnumMemberValue(member); if (!memberTypes[value]) { - var memberType = memberTypes[value] = createType(256 /* EnumLiteral */); - memberType.symbol = memberSymbol; - memberType.baseType = enumType; - memberType.text = "" + value; + var memberType = memberTypes[value] = createEnumLiteralType(memberSymbol, enumType, "" + value); memberTypeList.push(memberType); } } @@ -19992,7 +27970,7 @@ var ts; } enumType.memberTypes = memberTypes; if (memberTypeList.length > 1) { - enumType.flags |= 524288 /* Union */; + enumType.flags |= 65536 /* Union */; enumType.types = memberTypeList; unionTypes[getTypeListId(memberTypeList)] = enumType; } @@ -20004,7 +27982,7 @@ var ts; var links = getSymbolLinks(symbol); if (!links.declaredType) { var enumType = getDeclaredTypeOfEnum(getParentOfSymbol(symbol)); - links.declaredType = enumType.flags & 524288 /* Union */ ? + links.declaredType = enumType.flags & 65536 /* Union */ ? enumType.memberTypes[getEnumMemberValue(symbol.valueDeclaration)] : enumType; } @@ -20015,7 +27993,7 @@ var ts; if (!links.declaredType) { var type = createType(16384 /* TypeParameter */); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 141 /* TypeParameter */).constraint) { + if (!ts.getDeclarationOfKind(symbol, 143 /* TypeParameter */).constraint) { type.constraint = noConstraintType; } links.declaredType = type; @@ -20068,20 +28046,20 @@ var ts; // considered independent. function isIndependentType(node) { switch (node.kind) { - case 117 /* AnyKeyword */: - case 132 /* StringKeyword */: - case 130 /* NumberKeyword */: - case 120 /* BooleanKeyword */: - case 133 /* SymbolKeyword */: - case 103 /* VoidKeyword */: - case 135 /* UndefinedKeyword */: - case 93 /* NullKeyword */: - case 127 /* NeverKeyword */: - case 166 /* LiteralType */: + case 118 /* AnyKeyword */: + case 134 /* StringKeyword */: + case 132 /* NumberKeyword */: + case 121 /* BooleanKeyword */: + case 135 /* SymbolKeyword */: + case 104 /* VoidKeyword */: + case 137 /* UndefinedKeyword */: + case 94 /* NullKeyword */: + case 129 /* NeverKeyword */: + case 171 /* LiteralType */: return true; - case 160 /* ArrayType */: + case 162 /* ArrayType */: return isIndependentType(node.elementType); - case 155 /* TypeReference */: + case 157 /* TypeReference */: return isIndependentTypeReference(node); } return false; @@ -20094,7 +28072,7 @@ var ts; // A function-like declaration is considered independent (free of this references) if it has a return type // annotation that is considered independent and if each parameter is considered independent. function isIndependentFunctionLikeDeclaration(node) { - if (node.kind !== 148 /* Constructor */ && (!node.type || !isIndependentType(node.type))) { + if (node.kind !== 150 /* Constructor */ && (!node.type || !isIndependentType(node.type))) { return false; } for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { @@ -20115,12 +28093,12 @@ var ts; var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { - case 145 /* PropertyDeclaration */: - case 144 /* PropertySignature */: + case 147 /* PropertyDeclaration */: + case 146 /* PropertySignature */: return isIndependentVariableLikeDeclaration(declaration); - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - case 148 /* Constructor */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + case 150 /* Constructor */: return isIndependentFunctionLikeDeclaration(declaration); } } @@ -20165,7 +28143,7 @@ var ts; return type; } function getTypeWithThisArgument(type, thisArgument) { - if (type.flags & 131072 /* Reference */) { + if (getObjectFlags(type) & 4 /* Reference */) { return createTypeReference(type.target, ts.concatenate(type.typeArguments, [thisArgument || type.target.thisType])); } return type; @@ -20188,8 +28166,8 @@ var ts; else { mapper = createTypeMapper(typeParameters, typeArguments); members = createInstantiatedSymbolTable(source.declaredProperties, mapper, /*mappingThisOnly*/ typeParameters.length === 1); - callSignatures = instantiateList(source.declaredCallSignatures, mapper, instantiateSignature); - constructSignatures = instantiateList(source.declaredConstructSignatures, mapper, instantiateSignature); + callSignatures = instantiateSignatures(source.declaredCallSignatures, mapper); + constructSignatures = instantiateSignatures(source.declaredConstructSignatures, mapper); stringIndexInfo = instantiateIndexInfo(source.declaredStringIndexInfo, mapper); numberIndexInfo = instantiateIndexInfo(source.declaredNumberIndexInfo, mapper); } @@ -20209,7 +28187,7 @@ var ts; numberIndexInfo = numberIndexInfo || getIndexInfoOfType(instantiatedBaseType, 1 /* Number */); } } - setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); + setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } function resolveClassOrInterfaceMembers(type) { resolveObjectTypeMembers(type, resolveDeclaredMembers(type), emptyArray, emptyArray); @@ -20251,7 +28229,7 @@ var ts; var baseSig = baseSignatures_1[_i]; var typeParamCount = baseSig.typeParameters ? baseSig.typeParameters.length : 0; if (typeParamCount === typeArgCount) { - var sig = typeParamCount ? getSignatureInstantiation(baseSig, typeArguments) : cloneSignature(baseSig); + var sig = typeParamCount ? createSignatureInstantiation(baseSig, typeArguments) : cloneSignature(baseSig); sig.typeParameters = classType.localTypeParameters; sig.resolvedReturnType = classType; result.push(sig); @@ -20348,7 +28326,7 @@ var ts; var constructSignatures = getUnionSignatures(type.types, 1 /* Construct */); var stringIndexInfo = getUnionIndexInfo(type.types, 0 /* String */); var numberIndexInfo = getUnionIndexInfo(type.types, 1 /* Number */); - setObjectTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); + setStructuredTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } function intersectTypes(type1, type2) { return !type1 ? type2 : !type2 ? type1 : getIntersectionType([type1, type2]); @@ -20356,6 +28334,9 @@ var ts; function intersectIndexInfos(info1, info2) { return !info1 ? info2 : !info2 ? info1 : createIndexInfo(getIntersectionType([info1.type, info2.type]), info1.isReadonly && info2.isReadonly); } + function unionSpreadIndexInfos(info1, info2) { + return info1 && info2 && createIndexInfo(getUnionType([info1.type, info2.type]), info1.isReadonly || info2.isReadonly); + } function resolveIntersectionTypeMembers(type) { // The members and properties collections are empty for intersection types. To get all properties of an // intersection type use getPropertiesOfType (only the language service uses this). @@ -20370,17 +28351,17 @@ var ts; stringIndexInfo = intersectIndexInfos(stringIndexInfo, getIndexInfoOfType(t, 0 /* String */)); numberIndexInfo = intersectIndexInfos(numberIndexInfo, getIndexInfoOfType(t, 1 /* Number */)); } - setObjectTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); + setStructuredTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } function resolveAnonymousTypeMembers(type) { var symbol = type.symbol; if (type.target) { var members = createInstantiatedSymbolTable(getPropertiesOfObjectType(type.target), type.mapper, /*mappingThisOnly*/ false); - var callSignatures = instantiateList(getSignaturesOfType(type.target, 0 /* Call */), type.mapper, instantiateSignature); - var constructSignatures = instantiateList(getSignaturesOfType(type.target, 1 /* Construct */), type.mapper, instantiateSignature); + var callSignatures = instantiateSignatures(getSignaturesOfType(type.target, 0 /* Call */), type.mapper); + var constructSignatures = instantiateSignatures(getSignaturesOfType(type.target, 1 /* Construct */), type.mapper); var stringIndexInfo = instantiateIndexInfo(getIndexInfoOfType(type.target, 0 /* String */), type.mapper); var numberIndexInfo = instantiateIndexInfo(getIndexInfoOfType(type.target, 1 /* Number */), type.mapper); - setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); + setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } else if (symbol.flags & 2048 /* TypeLiteral */) { var members = symbol.members; @@ -20388,7 +28369,7 @@ var ts; var constructSignatures = getSignaturesOfSymbol(members["__new"]); var stringIndexInfo = getIndexInfoOfSymbol(symbol, 0 /* String */); var numberIndexInfo = getIndexInfoOfSymbol(symbol, 1 /* Number */); - setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); + setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } else { // Combinations of function, class, enum and module @@ -20404,13 +28385,13 @@ var ts; constructSignatures = getDefaultConstructSignatures(classType); } var baseConstructorType = getBaseConstructorTypeOfClass(classType); - if (baseConstructorType.flags & 2588672 /* ObjectType */) { + if (baseConstructorType.flags & 32768 /* Object */) { members = createSymbolTable(getNamedMembers(members)); addInheritedMembers(members, getPropertiesOfObjectType(baseConstructorType)); } } var numberIndexInfo = symbol.flags & 384 /* Enum */ ? enumNumberIndexInfo : undefined; - setObjectTypeMembers(type, members, emptyArray, constructSignatures, undefined, numberIndexInfo); + setStructuredTypeMembers(type, members, emptyArray, constructSignatures, undefined, numberIndexInfo); // We resolve the members before computing the signatures because a signature may use // typeof with a qualified name expression that circularly references the type we are // in the process of resolving (see issue #6072). The temporarily empty signature list @@ -20420,21 +28401,124 @@ var ts; } } } + /** Resolve the members of a mapped type { [P in K]: T } */ + function resolveMappedTypeMembers(type) { + var members = ts.createMap(); + var stringIndexInfo; + // 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); + var constraintType = getConstraintTypeFromMappedType(type); + var templateType = getTemplateTypeFromMappedType(type); + var modifiersType = getApparentType(getModifiersTypeFromMappedType(type)); + var templateReadonly = !!type.declaration.readonlyToken; + var templateOptional = !!type.declaration.questionToken; + if (type.declaration.typeParameter.constraint.kind === 168 /* TypeOperator */) { + // We have a { [P in keyof T]: X } + forEachType(getLiteralTypeFromPropertyNames(modifiersType), addMemberForKeyType); + if (getIndexInfoOfType(modifiersType, 0 /* String */)) { + addMemberForKeyType(stringType); + } + } + else { + // First, if the constraint type is a type parameter, obtain the base constraint. Then, + // if the key type is a 'keyof X', obtain 'keyof C' where C is the base constraint of X. + // Finally, iterate over the constituents of the resulting iteration type. + var keyType = constraintType.flags & 540672 /* TypeVariable */ ? getApparentType(constraintType) : constraintType; + var iterationType = keyType.flags & 262144 /* Index */ ? getIndexType(getApparentType(keyType.type)) : keyType; + forEachType(iterationType, addMemberForKeyType); + } + setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, undefined); + function addMemberForKeyType(t) { + // Create a mapper from T to the current iteration type constituent. Then, if the + // mapped type is itself an instantiated type, combine the iteration mapper with the + // instantiation mapper. + var iterationMapper = createUnaryTypeMapper(typeParameter, t); + var templateMapper = type.mapper ? combineTypeMappers(type.mapper, iterationMapper) : iterationMapper; + var propType = instantiateType(templateType, templateMapper); + // If the current iteration type constituent is a string literal type, create a property. + // Otherwise, for type string create a string index signature. + if (t.flags & 32 /* StringLiteral */) { + var propName = t.text; + var modifiersProp = getPropertyOfType(modifiersType, propName); + var isOptional = templateOptional || !!(modifiersProp && modifiersProp.flags & 536870912 /* Optional */); + var prop = createSymbol(4 /* Property */ | 67108864 /* Transient */ | (isOptional ? 536870912 /* Optional */ : 0), propName); + prop.type = propType; + prop.isReadonly = templateReadonly || modifiersProp && isReadonlySymbol(modifiersProp); + members[propName] = prop; + } + else if (t.flags & 2 /* String */) { + stringIndexInfo = createIndexInfo(propType, templateReadonly); + } + } + } + function getTypeParameterFromMappedType(type) { + return type.typeParameter || + (type.typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(type.declaration.typeParameter))); + } + function getConstraintTypeFromMappedType(type) { + return type.constraintType || + (type.constraintType = instantiateType(getConstraintOfTypeParameter(getTypeParameterFromMappedType(type)), type.mapper || identityMapper) || unknownType); + } + function getTemplateTypeFromMappedType(type) { + return type.templateType || + (type.templateType = type.declaration.type ? + instantiateType(addOptionality(getTypeFromTypeNode(type.declaration.type), !!type.declaration.questionToken), type.mapper || identityMapper) : + unknownType); + } + function getModifiersTypeFromMappedType(type) { + if (!type.modifiersType) { + var constraintDeclaration = type.declaration.typeParameter.constraint; + if (constraintDeclaration.kind === 168 /* TypeOperator */) { + // If the constraint declaration is a 'keyof T' node, the modifiers type is T. We check + // AST nodes here because, when T is a non-generic type, the logic below eagerly resolves + // 'keyof T' to a literal union type and we can't recover T from that type. + type.modifiersType = instantiateType(getTypeFromTypeNode(constraintDeclaration.type), type.mapper || identityMapper); + } + else { + // Otherwise, get the declared constraint type, and if the constraint type is a type parameter, + // get the constraint of that type parameter. If the resulting type is an indexed type 'keyof T', + // the modifiers type is T. Otherwise, the modifiers type is {}. + var declaredType = getTypeFromMappedTypeNode(type.declaration); + var constraint = getConstraintTypeFromMappedType(declaredType); + var extendedConstraint = constraint && constraint.flags & 16384 /* TypeParameter */ ? getConstraintOfTypeParameter(constraint) : constraint; + type.modifiersType = extendedConstraint && extendedConstraint.flags & 262144 /* Index */ ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : emptyObjectType; + } + } + return type.modifiersType; + } + function getErasedTemplateTypeFromMappedType(type) { + return instantiateType(getTemplateTypeFromMappedType(type), createUnaryTypeMapper(getTypeParameterFromMappedType(type), anyType)); + } + function isGenericMappedType(type) { + if (getObjectFlags(type) & 32 /* Mapped */) { + var constraintType = getConstraintTypeFromMappedType(type); + return maybeTypeOfKind(constraintType, 540672 /* TypeVariable */ | 262144 /* Index */); + } + return false; + } function resolveStructuredTypeMembers(type) { if (!type.members) { - if (type.flags & 131072 /* Reference */) { - resolveTypeReferenceMembers(type); + if (type.flags & 32768 /* Object */) { + if (type.objectFlags & 4 /* Reference */) { + resolveTypeReferenceMembers(type); + } + else if (type.objectFlags & 3 /* ClassOrInterface */) { + resolveClassOrInterfaceMembers(type); + } + else if (type.objectFlags & 16 /* Anonymous */) { + resolveAnonymousTypeMembers(type); + } + else if (type.objectFlags & 32 /* Mapped */) { + resolveMappedTypeMembers(type); + } } - else if (type.flags & (32768 /* Class */ | 65536 /* Interface */)) { - resolveClassOrInterfaceMembers(type); - } - else if (type.flags & 2097152 /* Anonymous */) { - resolveAnonymousTypeMembers(type); - } - else if (type.flags & 524288 /* Union */) { + else if (type.flags & 65536 /* Union */) { resolveUnionTypeMembers(type); } - else if (type.flags & 1048576 /* Intersection */) { + else if (type.flags & 131072 /* Intersection */) { resolveIntersectionTypeMembers(type); } } @@ -20442,7 +28526,7 @@ var ts; } /** Return properties of an object type or an empty array for other types */ function getPropertiesOfObjectType(type) { - if (type.flags & 2588672 /* ObjectType */) { + if (type.flags & 32768 /* Object */) { return resolveStructuredTypeMembers(type).properties; } return emptyArray; @@ -20450,7 +28534,7 @@ var ts; /** If the given type is an object type and that type has a property by the given name, * return the symbol for that property. Otherwise return undefined. */ function getPropertyOfObjectType(type, name) { - if (type.flags & 2588672 /* ObjectType */) { + if (type.flags & 32768 /* Object */) { var resolved = resolveStructuredTypeMembers(type); var symbol = resolved.members[name]; if (symbol && symbolIsValue(symbol)) { @@ -20463,29 +28547,43 @@ var ts; var current = _a[_i]; for (var _b = 0, _c = getPropertiesOfType(current); _b < _c.length; _b++) { var prop = _c[_b]; - getPropertyOfUnionOrIntersectionType(type, prop.name); + getUnionOrIntersectionProperty(type, prop.name); } // The properties of a union type are those that are present in all constituent types, so // we only need to check the properties of the first type - if (type.flags & 524288 /* Union */) { + if (type.flags & 65536 /* Union */) { break; } } - return type.resolvedProperties ? symbolsToArray(type.resolvedProperties) : emptyArray; + var props = type.resolvedProperties; + if (props) { + var result = []; + for (var key in props) { + var prop = props[key]; + // We need to filter out partial properties in union types + if (!(prop.flags & 268435456 /* SyntheticProperty */ && prop.isPartial)) { + result.push(prop); + } + } + return result; + } + return emptyArray; } function getPropertiesOfType(type) { type = getApparentType(type); - return type.flags & 1572864 /* UnionOrIntersection */ ? getPropertiesOfUnionOrIntersectionType(type) : getPropertiesOfObjectType(type); + return type.flags & 196608 /* UnionOrIntersection */ ? + getPropertiesOfUnionOrIntersectionType(type) : + getPropertiesOfObjectType(type); } /** * The apparent type of a type parameter is the base constraint instantiated with the type parameter * as the type argument for the 'this' type. */ - function getApparentTypeOfTypeParameter(type) { + function getApparentTypeOfTypeVariable(type) { if (!type.resolvedApparentType) { - var constraintType = getConstraintOfTypeParameter(type); + var constraintType = getConstraintOfTypeVariable(type); while (constraintType && constraintType.flags & 16384 /* TypeParameter */) { - constraintType = getConstraintOfTypeParameter(constraintType); + constraintType = getConstraintOfTypeVariable(constraintType); } type.resolvedApparentType = getTypeWithThisArgument(constraintType || emptyObjectType, type); } @@ -20497,35 +28595,26 @@ var ts; * type itself. Note that the apparent type of a union type is the union type itself. */ function getApparentType(type) { - if (type.flags & 16384 /* TypeParameter */) { - type = getApparentTypeOfTypeParameter(type); - } - if (type.flags & 34 /* StringLike */) { - type = globalStringType; - } - else if (type.flags & 340 /* NumberLike */) { - type = globalNumberType; - } - else if (type.flags & 136 /* BooleanLike */) { - type = globalBooleanType; - } - else if (type.flags & 512 /* ESSymbol */) { - type = getGlobalESSymbolType(); - } - return type; + var t = type.flags & 540672 /* TypeVariable */ ? getApparentTypeOfTypeVariable(type) : type; + return t.flags & 262178 /* StringLike */ ? globalStringType : + t.flags & 340 /* NumberLike */ ? globalNumberType : + t.flags & 136 /* BooleanLike */ ? globalBooleanType : + t.flags & 512 /* ESSymbol */ ? getGlobalESSymbolType() : + t; } function createUnionOrIntersectionProperty(containingType, name) { var types = containingType.types; var props; // Flags we want to propagate to the result if they exist in all source symbols - var commonFlags = (containingType.flags & 1048576 /* Intersection */) ? 536870912 /* Optional */ : 0 /* None */; + var commonFlags = (containingType.flags & 131072 /* Intersection */) ? 536870912 /* Optional */ : 0 /* None */; var isReadonly = false; + var isPartial = false; for (var _i = 0, types_2 = types; _i < types_2.length; _i++) { var current = types_2[_i]; var type = getApparentType(current); if (type !== unknownType) { var prop = getPropertyOfType(type, name); - if (prop && !(getDeclarationFlagsFromSymbol(prop) & (8 /* Private */ | 16 /* Protected */))) { + if (prop && !(getDeclarationModifierFlagsFromSymbol(prop) & (8 /* Private */ | 16 /* Protected */))) { commonFlags &= prop.flags; if (!props) { props = [prop]; @@ -20537,22 +28626,21 @@ var ts; isReadonly = true; } } - else if (containingType.flags & 524288 /* Union */) { - // A union type requires the property to be present in all constituent types - return undefined; + else if (containingType.flags & 65536 /* Union */) { + isPartial = true; } } } if (!props) { return undefined; } - if (props.length === 1) { + if (props.length === 1 && !isPartial) { return props[0]; } var propTypes = []; var declarations = []; var commonType = undefined; - var hasCommonType = true; + var hasNonUniformType = false; for (var _a = 0, props_1 = props; _a < props_1.length; _a++) { var prop = props_1[_a]; if (prop.declarations) { @@ -20563,22 +28651,25 @@ var ts; commonType = type; } else if (type !== commonType) { - hasCommonType = false; + hasNonUniformType = true; } - propTypes.push(getTypeOfSymbol(prop)); + propTypes.push(type); } - var result = createSymbol(4 /* Property */ | - 67108864 /* Transient */ | - 268435456 /* SyntheticProperty */ | - commonFlags, name); + var result = createSymbol(4 /* Property */ | 67108864 /* Transient */ | 268435456 /* SyntheticProperty */ | commonFlags, name); result.containingType = containingType; - result.hasCommonType = hasCommonType; + result.hasNonUniformType = hasNonUniformType; + result.isPartial = isPartial; result.declarations = declarations; result.isReadonly = isReadonly; - result.type = containingType.flags & 524288 /* Union */ ? getUnionType(propTypes) : getIntersectionType(propTypes); + result.type = containingType.flags & 65536 /* Union */ ? getUnionType(propTypes) : getIntersectionType(propTypes); return result; } - function getPropertyOfUnionOrIntersectionType(type, name) { + // Return the symbol for a given property in a union or intersection type, or undefined if the property + // does not exist in any constituent type. Note that the returned property may only be present in some + // constituents, in which case the isPartial flag is set when the containing type is union type. We need + // these partial properties when identifying discriminant properties, but otherwise they are filtered out + // and do not appear to be present in the union type. + function getUnionOrIntersectionProperty(type, name) { var properties = type.resolvedProperties || (type.resolvedProperties = ts.createMap()); var property = properties[name]; if (!property) { @@ -20589,6 +28680,11 @@ var ts; } return property; } + function getPropertyOfUnionOrIntersectionType(type, name) { + var property = getUnionOrIntersectionProperty(type, name); + // We need to filter out partial properties in union types + return property && !(property.flags & 268435456 /* SyntheticProperty */ && property.isPartial) ? property : undefined; + } /** * Return the symbol for the property with the given name in the given type. Creates synthetic union properties when * necessary, maps primitive types and type parameters are to their apparent types, and augments with properties from @@ -20599,7 +28695,7 @@ var ts; */ function getPropertyOfType(type, name) { type = getApparentType(type); - if (type.flags & 2588672 /* ObjectType */) { + if (type.flags & 32768 /* Object */) { var resolved = resolveStructuredTypeMembers(type); var symbol = resolved.members[name]; if (symbol && symbolIsValue(symbol)) { @@ -20613,13 +28709,13 @@ var ts; } return getPropertyOfObjectType(globalObjectType, name); } - if (type.flags & 1572864 /* UnionOrIntersection */) { + if (type.flags & 196608 /* UnionOrIntersection */) { return getPropertyOfUnionOrIntersectionType(type, name); } return undefined; } function getSignaturesOfStructuredType(type, kind) { - if (type.flags & 4161536 /* StructuredType */) { + if (type.flags & 229376 /* StructuredType */) { var resolved = resolveStructuredTypeMembers(type); return kind === 0 /* Call */ ? resolved.callSignatures : resolved.constructSignatures; } @@ -20633,7 +28729,7 @@ var ts; return getSignaturesOfStructuredType(getApparentType(type), kind); } function getIndexInfoOfStructuredType(type, kind) { - if (type.flags & 4161536 /* StructuredType */) { + if (type.flags & 229376 /* StructuredType */) { var resolved = resolveStructuredTypeMembers(type); return kind === 0 /* String */ ? resolved.stringIndexInfo : resolved.numberIndexInfo; } @@ -20668,7 +28764,7 @@ var ts; return undefined; } function getTypeParametersFromJSDocTemplate(declaration) { - if (declaration.flags & 134217728 /* JavaScriptFile */) { + if (declaration.flags & 65536 /* JavaScriptFile */) { var templateTag = ts.getJSDocTemplateTag(declaration); if (templateTag) { return getTypeParametersFromDeclaration(templateTag.typeParameters); @@ -20698,21 +28794,32 @@ var ts; return result; } function isJSDocOptionalParameter(node) { - if (node.flags & 134217728 /* JavaScriptFile */) { - if (node.type && node.type.kind === 268 /* JSDocOptionalType */) { + if (node.flags & 65536 /* JavaScriptFile */) { + 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 === 268 /* 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 */; + } } } } } + function tryFindAmbientModule(moduleName, withAugmentations) { + if (ts.isExternalModuleNameRelative(moduleName)) { + return undefined; + } + var symbol = getSymbol(globals, "\"" + moduleName + "\"", 512 /* ValueModule */); + // merged symbol is module declaration symbol combined with all augmentations + return symbol && withAugmentations ? getMergedSymbol(symbol) : symbol; + } function isOptionalParameter(node) { if (ts.hasQuestionToken(node) || isJSDocOptionalParameter(node)) { return true; @@ -20727,7 +28834,7 @@ var ts; return false; } function createTypePredicateFromTypePredicateNode(node) { - if (node.parameterName.kind === 69 /* Identifier */) { + if (node.parameterName.kind === 70 /* Identifier */) { var parameterName = node.parameterName; return { kind: 1 /* Identifier */, @@ -20770,7 +28877,7 @@ var ts; else { parameters.push(paramSymbol); } - if (param.type && param.type.kind === 166 /* LiteralType */) { + if (param.type && param.type.kind === 171 /* LiteralType */) { hasLiteralTypes = true; } if (param.initializer || param.questionToken || param.dotDotDotToken || isJSDocOptionalParameter(param)) { @@ -20784,10 +28891,10 @@ var ts; } } // If only one accessor includes a this-type annotation, the other behaves as if it had the same type annotation - if ((declaration.kind === 149 /* GetAccessor */ || declaration.kind === 150 /* SetAccessor */) && + if ((declaration.kind === 151 /* GetAccessor */ || declaration.kind === 152 /* SetAccessor */) && !ts.hasDynamicName(declaration) && (!hasThisParameter || !thisParameter)) { - var otherKind = declaration.kind === 149 /* GetAccessor */ ? 150 /* SetAccessor */ : 149 /* GetAccessor */; + var otherKind = declaration.kind === 151 /* GetAccessor */ ? 152 /* SetAccessor */ : 151 /* GetAccessor */; var other = ts.getDeclarationOfKind(declaration.symbol, otherKind); if (other) { thisParameter = getAnnotatedAccessorThisParameter(other); @@ -20799,24 +28906,21 @@ var ts; if (isJSConstructSignature) { minArgumentCount--; } - if (!thisParameter && ts.isObjectLiteralMethod(declaration)) { - thisParameter = getContextualThisParameter(declaration); - } - var classType = declaration.kind === 148 /* Constructor */ ? + var classType = declaration.kind === 150 /* Constructor */ ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : undefined; var typeParameters = classType ? classType.localTypeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : getTypeParametersFromJSDocTemplate(declaration); - var returnType = getSignatureReturnTypeFromDeclaration(declaration, minArgumentCount, isJSConstructSignature, classType); - var typePredicate = declaration.type && declaration.type.kind === 154 /* TypePredicate */ ? + var returnType = getSignatureReturnTypeFromDeclaration(declaration, isJSConstructSignature, classType); + var typePredicate = declaration.type && declaration.type.kind === 156 /* TypePredicate */ ? createTypePredicateFromTypePredicateNode(declaration.type) : undefined; links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasLiteralTypes); } return links.resolvedSignature; } - function getSignatureReturnTypeFromDeclaration(declaration, minArgumentCount, isJSConstructSignature, classType) { + function getSignatureReturnTypeFromDeclaration(declaration, isJSConstructSignature, classType) { if (isJSConstructSignature) { return getTypeFromTypeNode(declaration.parameters[0].type); } @@ -20826,7 +28930,7 @@ var ts; else if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.flags & 134217728 /* JavaScriptFile */) { + if (declaration.flags & 65536 /* JavaScriptFile */) { var type = getReturnTypeFromJSDocComment(declaration); if (type && type !== unknownType) { return type; @@ -20834,8 +28938,8 @@ var ts; } // TypeScript 1.0 spec (April 2014): // If only one accessor includes a type annotation, the other behaves as if it had the same type annotation. - if (declaration.kind === 149 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 150 /* SetAccessor */); + if (declaration.kind === 151 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 152 /* SetAccessor */); return getAnnotatedAccessorType(setter); } if (ts.nodeIsMissing(declaration.body)) { @@ -20849,20 +28953,20 @@ var ts; for (var i = 0, len = symbol.declarations.length; i < len; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 156 /* FunctionType */: - case 157 /* ConstructorType */: - case 220 /* FunctionDeclaration */: - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - case 148 /* Constructor */: - case 151 /* CallSignature */: - case 152 /* ConstructSignature */: - case 153 /* IndexSignature */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - case 179 /* FunctionExpression */: - case 180 /* ArrowFunction */: - case 269 /* JSDocFunctionType */: + case 158 /* FunctionType */: + case 159 /* ConstructorType */: + case 225 /* FunctionDeclaration */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + case 150 /* Constructor */: + case 153 /* CallSignature */: + case 154 /* ConstructSignature */: + case 155 /* IndexSignature */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + case 184 /* FunctionExpression */: + case 185 /* ArrowFunction */: + case 274 /* JSDocFunctionType */: // Don't include signature if node is the implementation of an overloaded function. A node is considered // an implementation node if it has a body and the previous node is of the same kind and immediately // precedes the implementation node (i.e. has the same parent and ends where the implementation starts). @@ -20926,13 +29030,18 @@ var ts; function getRestTypeOfSignature(signature) { if (signature.hasRestParameter) { var type = getTypeOfSymbol(ts.lastOrUndefined(signature.parameters)); - if (type.flags & 131072 /* Reference */ && type.target === globalArrayType) { + if (getObjectFlags(type) & 4 /* Reference */ && type.target === globalArrayType) { return type.typeArguments[0]; } } return anyType; } function getSignatureInstantiation(signature, typeArguments) { + var instantiations = signature.instantiations || (signature.instantiations = ts.createMap()); + var id = getTypeListId(typeArguments); + return instantiations[id] || (instantiations[id] = createSignatureInstantiation(signature, typeArguments)); + } + function createSignatureInstantiation(signature, typeArguments) { return instantiateSignature(signature, createTypeMapper(signature.typeParameters, typeArguments), /*eraseTypeParameters*/ true); } function getErasedSignature(signature) { @@ -20949,8 +29058,8 @@ var ts; // object type literal or interface (using the new keyword). Each way of declaring a constructor // will result in a different declaration kind. if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 148 /* Constructor */ || signature.declaration.kind === 152 /* ConstructSignature */; - var type = createObjectType(2097152 /* Anonymous */); + var isConstructor = signature.declaration.kind === 150 /* Constructor */ || signature.declaration.kind === 154 /* ConstructSignature */; + var type = createObjectType(16 /* Anonymous */); type.members = emptySymbols; type.properties = emptyArray; type.callSignatures = !isConstructor ? [signature] : emptyArray; @@ -20963,7 +29072,7 @@ var ts; return symbol.members["__index"]; } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 /* Number */ ? 130 /* NumberKeyword */ : 132 /* StringKeyword */; + var syntaxKind = kind === 1 /* Number */ ? 132 /* NumberKeyword */ : 134 /* StringKeyword */; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { @@ -20985,16 +29094,16 @@ var ts; function getIndexInfoOfSymbol(symbol, kind) { var declaration = getIndexDeclarationOfSymbol(symbol, kind); if (declaration) { - return createIndexInfo(declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, (declaration.flags & 64 /* Readonly */) !== 0, declaration); + return createIndexInfo(declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, (ts.getModifierFlags(declaration) & 64 /* Readonly */) !== 0, declaration); } return undefined; } function getConstraintDeclaration(type) { - return ts.getDeclarationOfKind(type.symbol, 141 /* TypeParameter */).constraint; + return ts.getDeclarationOfKind(type.symbol, 143 /* TypeParameter */).constraint; } function hasConstraintReferenceTo(type, target) { var checked; - while (type && !(type.flags & 268435456 /* ThisType */) && type.flags & 16384 /* TypeParameter */ && !ts.contains(checked, type)) { + while (type && type.flags & 16384 /* TypeParameter */ && !(type.isThisType) && !ts.contains(checked, type)) { if (type === target) { return true; } @@ -21022,8 +29131,13 @@ var ts; } return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } + function getConstraintOfTypeVariable(type) { + return type.flags & 16384 /* TypeParameter */ ? getConstraintOfTypeParameter(type) : + type.flags & 524288 /* IndexedAccess */ ? type.constraint : + undefined; + } function getParentSymbolOfTypeParameter(typeParameter) { - return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 141 /* TypeParameter */).parent); + return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 143 /* TypeParameter */).parent); } function getTypeListId(types) { var result = ""; @@ -21060,22 +29174,23 @@ var ts; result |= type.flags; } } - return result & 234881024 /* PropagatingFlags */; + return result & 14680064 /* PropagatingFlags */; } function createTypeReference(target, typeArguments) { var id = getTypeListId(typeArguments); var type = target.instantiations[id]; if (!type) { - var propagatedFlags = typeArguments ? getPropagatingFlagsOfTypes(typeArguments, /*excludeKinds*/ 0) : 0; - var flags = 131072 /* Reference */ | propagatedFlags; - type = target.instantiations[id] = createObjectType(flags, target.symbol); + type = target.instantiations[id] = createObjectType(4 /* Reference */, target.symbol); + type.flags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments, /*excludeKinds*/ 0) : 0; type.target = target; type.typeArguments = typeArguments; } return type; } function cloneTypeReference(source) { - var type = createObjectType(source.flags, source.symbol); + var type = createType(source.flags); + type.symbol = source.symbol; + type.objectFlags = source.objectFlags; type.target = source.target; type.typeArguments = source.typeArguments; return type; @@ -21103,21 +29218,26 @@ var ts; } return type; } + function getTypeAliasInstantiation(symbol, typeArguments) { + var type = getDeclaredTypeOfSymbol(symbol); + var links = getSymbolLinks(symbol); + var typeParameters = links.typeParameters; + var id = getTypeListId(typeArguments); + return links.instantiations[id] || (links.instantiations[id] = instantiateTypeNoAlias(type, createTypeMapper(typeParameters, typeArguments))); + } // Get type from reference to type alias. When a type alias is generic, the declared type of the type alias may include // references to the type parameters of the alias. We replace those with the actual type arguments by instantiating the // declared type. Instantiations are cached using the type identities of the type arguments as the key. function getTypeFromTypeAliasReference(node, symbol) { var type = getDeclaredTypeOfSymbol(symbol); - var links = getSymbolLinks(symbol); - var typeParameters = links.typeParameters; + var typeParameters = getSymbolLinks(symbol).typeParameters; if (typeParameters) { if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) { error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, symbolToString(symbol), typeParameters.length); return unknownType; } var typeArguments = ts.map(node.typeArguments, getTypeFromTypeNode); - var id = getTypeListId(typeArguments); - return links.instantiations[id] || (links.instantiations[id] = instantiateType(type, createTypeMapper(typeParameters, typeArguments))); + return getTypeAliasInstantiation(symbol, typeArguments); } if (node.typeArguments) { error(node, ts.Diagnostics.Type_0_is_not_generic, symbolToString(symbol)); @@ -21135,11 +29255,11 @@ var ts; } function getTypeReferenceName(node) { switch (node.kind) { - case 155 /* TypeReference */: + case 157 /* TypeReference */: return node.typeName; - case 267 /* JSDocTypeReference */: + case 272 /* JSDocTypeReference */: return node.name; - case 194 /* ExpressionWithTypeArguments */: + case 199 /* ExpressionWithTypeArguments */: // We only support expressions that are simple qualified names. For other // expressions this produces undefined. var expr = node.expression; @@ -21149,7 +29269,7 @@ var ts; } return undefined; } - function resolveTypeReferenceName(node, typeReferenceName) { + function resolveTypeReferenceName(typeReferenceName) { if (!typeReferenceName) { return unknownSymbol; } @@ -21165,7 +29285,7 @@ var ts; if (symbol.flags & 524288 /* TypeAlias */) { return getTypeFromTypeAliasReference(node, symbol); } - if (symbol.flags & 107455 /* Value */ && node.kind === 267 /* JSDocTypeReference */) { + if (symbol.flags & 107455 /* Value */ && node.kind === 272 /* JSDocTypeReference */) { // A JSDocTypeReference may have resolved to a value (as opposed to a type). In // that case, the type of this reference is just the type of the value we resolved // to. @@ -21178,14 +29298,14 @@ var ts; if (!links.resolvedType) { var symbol = void 0; var type = void 0; - if (node.kind === 267 /* JSDocTypeReference */) { + if (node.kind === 272 /* JSDocTypeReference */) { var typeReferenceName = getTypeReferenceName(node); - symbol = resolveTypeReferenceName(node, typeReferenceName); + symbol = resolveTypeReferenceName(typeReferenceName); type = getTypeReferenceType(node, symbol); } else { // We only support expressions that are simple qualified names. For other expressions this produces undefined. - var typeNameOrExpression = node.kind === 155 /* TypeReference */ + var typeNameOrExpression = node.kind === 157 /* TypeReference */ ? node.typeName : ts.isEntityNameExpression(node.expression) ? node.expression @@ -21220,9 +29340,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 221 /* ClassDeclaration */: - case 222 /* InterfaceDeclaration */: - case 224 /* EnumDeclaration */: + case 226 /* ClassDeclaration */: + case 227 /* InterfaceDeclaration */: + case 229 /* EnumDeclaration */: return declaration; } } @@ -21231,7 +29351,7 @@ var ts; return arity ? emptyGenericType : emptyObjectType; } var type = getDeclaredTypeOfSymbol(symbol); - if (!(type.flags & 2588672 /* ObjectType */)) { + if (!(type.flags & 32768 /* Object */)) { error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_be_a_class_or_interface_type, symbol.name); return arity ? emptyGenericType : emptyObjectType; } @@ -21311,7 +29431,7 @@ var ts; property.type = typeParameter; properties.push(property); } - var type = createObjectType(262144 /* Tuple */ | 131072 /* Reference */); + var type = createObjectType(8 /* Tuple */ | 4 /* Reference */); type.typeParameters = typeParameters; type.outerTypeParameters = undefined; type.localTypeParameters = typeParameters; @@ -21319,7 +29439,8 @@ var ts; type.instantiations[getTypeListId(type.typeParameters)] = type; type.target = type; type.typeArguments = type.typeParameters; - type.thisType = createType(16384 /* TypeParameter */ | 268435456 /* ThisType */); + type.thisType = createType(16384 /* TypeParameter */); + type.thisType.isThisType = true; type.thisType.constraint = type; type.declaredProperties = properties; type.declaredCallSignatures = emptyArray; @@ -21364,25 +29485,33 @@ var ts; return binarySearchTypes(types, type) >= 0; } function addTypeToUnion(typeSet, type) { - if (type.flags & 524288 /* Union */) { + var flags = type.flags; + if (flags & 65536 /* Union */) { addTypesToUnion(typeSet, type.types); } - else if (type.flags & 1 /* Any */) { + else if (flags & 1 /* Any */) { typeSet.containsAny = true; } - else if (!strictNullChecks && type.flags & 6144 /* Nullable */) { - if (type.flags & 2048 /* Undefined */) + else if (!strictNullChecks && flags & 6144 /* Nullable */) { + if (flags & 2048 /* Undefined */) typeSet.containsUndefined = true; - if (type.flags & 4096 /* Null */) + if (flags & 4096 /* Null */) typeSet.containsNull = true; - if (!(type.flags & 33554432 /* ContainsWideningType */)) + if (!(flags & 2097152 /* ContainsWideningType */)) typeSet.containsNonWideningType = true; } - else if (!(type.flags & 8192 /* Never */)) { + else if (!(flags & 8192 /* Never */)) { + if (flags & 2 /* String */) + typeSet.containsString = true; + if (flags & 4 /* Number */) + typeSet.containsNumber = true; + if (flags & 96 /* StringOrNumberLiteral */) + typeSet.containsStringOrNumberLiteral = true; var len = typeSet.length; var index = len && type.id > typeSet[len - 1].id ? ~len : binarySearchTypes(typeSet, type); if (index < 0) { - if (!(type.flags & 2097152 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */) && containsIdenticalType(typeSet, type))) { + if (!(flags & 32768 /* Object */ && type.objectFlags & 16 /* Anonymous */ && + type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */) && containsIdenticalType(typeSet, type))) { typeSet.splice(~index, 0, type); } } @@ -21413,12 +29542,42 @@ var ts; } return false; } + function isSetOfLiteralsFromSameEnum(types) { + var first = types[0]; + if (first.flags & 256 /* EnumLiteral */) { + var firstEnum = getParentOfSymbol(first.symbol); + for (var i = 1; i < types.length; i++) { + var other = types[i]; + if (!(other.flags & 256 /* EnumLiteral */) || (firstEnum !== getParentOfSymbol(other.symbol))) { + return false; + } + } + return true; + } + return false; + } function removeSubtypes(types) { + if (types.length === 0 || isSetOfLiteralsFromSameEnum(types)) { + return; + } var i = types.length; while (i > 0) { i--; if (isSubtypeOfAny(types[i], types)) { - types.splice(i, 1); + ts.orderedRemoveItemAt(types, i); + } + } + } + function removeRedundantLiteralTypes(types) { + var i = types.length; + while (i > 0) { + i--; + var t = types[i]; + var remove = t.flags & 32 /* StringLiteral */ && types.containsString || + t.flags & 64 /* NumberLiteral */ && types.containsNumber || + t.flags & 96 /* StringOrNumberLiteral */ && t.flags & 1048576 /* FreshLiteral */ && containsType(types, t.regularType); + if (remove) { + ts.orderedRemoveItemAt(types, i); } } } @@ -21444,6 +29603,9 @@ var ts; if (subtypeReduction) { removeSubtypes(typeSet); } + else if (typeSet.containsStringOrNumberLiteral) { + removeRedundantLiteralTypes(typeSet); + } if (typeSet.length === 0) { return typeSet.containsNull ? typeSet.containsNonWideningType ? nullType : nullWideningType : typeSet.containsUndefined ? typeSet.containsNonWideningType ? undefinedType : undefinedWideningType : @@ -21463,28 +29625,31 @@ var ts; var type = unionTypes[id]; if (!type) { var propagatedFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ 6144 /* Nullable */); - type = unionTypes[id] = createObjectType(524288 /* Union */ | propagatedFlags); + type = unionTypes[id] = createType(65536 /* Union */ | propagatedFlags); type.types = types; type.aliasSymbol = aliasSymbol; type.aliasTypeArguments = aliasTypeArguments; } return type; } - function getTypeFromUnionTypeNode(node, aliasSymbol, aliasTypeArguments) { + function getTypeFromUnionTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), /*subtypeReduction*/ false, aliasSymbol, aliasTypeArguments); + links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), /*subtypeReduction*/ false, getAliasSymbolForTypeNode(node), getAliasTypeArgumentsForTypeNode(node)); } return links.resolvedType; } function addTypeToIntersection(typeSet, type) { - if (type.flags & 1048576 /* Intersection */) { + if (type.flags & 131072 /* Intersection */) { addTypesToIntersection(typeSet, type.types); } else if (type.flags & 1 /* Any */) { typeSet.containsAny = true; } else if (!(type.flags & 8192 /* Never */) && (strictNullChecks || !(type.flags & 6144 /* Nullable */)) && !ts.contains(typeSet, type)) { + if (type.flags & 65536 /* Union */ && typeSet.unionIndex === undefined) { + typeSet.unionIndex = typeSet.length; + } typeSet.push(type); } } @@ -21496,6 +29661,11 @@ var ts; addTypeToIntersection(typeSet, type); } } + // We normalize combinations of intersection and union types based on the distributive property of the '&' + // operator. Specifically, because X & (A | B) is equivalent to X & A | X & B, we can transform intersection + // types with union type constituents into equivalent union types with intersection type constituents and + // effectively ensure that union types are always at the top level in type representations. + // // We do not perform structural deduplication on intersection types. Intersection types are created only by the & // type operator and we can't reduce those because we want to support recursive intersection types. For example, // a type alias of the form "type List = T & { next: List }" cannot be reduced during its declaration. @@ -21513,40 +29683,345 @@ var ts; if (typeSet.length === 1) { return typeSet[0]; } + var unionIndex = typeSet.unionIndex; + if (unionIndex !== undefined) { + // We are attempting to construct a type of the form X & (A | B) & Y. Transform this into a type of + // the form X & A & Y | X & B & Y and recursively reduce until no union type constituents remain. + var unionType = typeSet[unionIndex]; + return getUnionType(ts.map(unionType.types, function (t) { return getIntersectionType(ts.replaceElement(typeSet, unionIndex, t)); }), + /*subtypeReduction*/ false, aliasSymbol, aliasTypeArguments); + } var id = getTypeListId(typeSet); var type = intersectionTypes[id]; if (!type) { var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, /*excludeKinds*/ 6144 /* Nullable */); - type = intersectionTypes[id] = createObjectType(1048576 /* Intersection */ | propagatedFlags); + type = intersectionTypes[id] = createType(131072 /* Intersection */ | propagatedFlags); type.types = typeSet; type.aliasSymbol = aliasSymbol; type.aliasTypeArguments = aliasTypeArguments; } return type; } - function getTypeFromIntersectionTypeNode(node, aliasSymbol, aliasTypeArguments) { + function getTypeFromIntersectionTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = getIntersectionType(ts.map(node.types, getTypeFromTypeNode), aliasSymbol, aliasTypeArguments); + links.resolvedType = getIntersectionType(ts.map(node.types, getTypeFromTypeNode), getAliasSymbolForTypeNode(node), getAliasTypeArgumentsForTypeNode(node)); } return links.resolvedType; } - function getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node, aliasSymbol, aliasTypeArguments) { + function getIndexTypeForGenericType(type) { + if (!type.resolvedIndexType) { + type.resolvedIndexType = createType(262144 /* Index */); + type.resolvedIndexType.type = type; + } + return type.resolvedIndexType; + } + function getLiteralTypeFromPropertyName(prop) { + return getDeclarationModifierFlagsFromSymbol(prop) & 24 /* NonPublicAccessibilityModifier */ || ts.startsWith(prop.name, "__@") ? + neverType : + getLiteralTypeForText(32 /* StringLiteral */, ts.unescapeIdentifier(prop.name)); + } + function getLiteralTypeFromPropertyNames(type) { + return getUnionType(ts.map(getPropertiesOfType(type), getLiteralTypeFromPropertyName)); + } + function getIndexType(type) { + return maybeTypeOfKind(type, 540672 /* TypeVariable */) ? getIndexTypeForGenericType(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) { + links.resolvedType = getIndexType(getTypeFromTypeNode(node.type)); + } + return links.resolvedType; + } + function createIndexedAccessType(objectType, indexType) { + var type = createType(524288 /* IndexedAccess */); + type.objectType = objectType; + type.indexType = indexType; + // We eagerly compute the constraint of the indexed access type such that circularity + // errors are immediately caught and reported. For example, class C { x: this["x"] } + // becomes an error only when the constraint is eagerly computed. + if (type.objectType.flags & 229376 /* StructuredType */) { + // The constraint of T[K], where T is an object, union, or intersection type, + // is the type of the string index signature of T, if any. + type.constraint = getIndexTypeOfType(type.objectType, 0 /* String */); + } + else if (type.objectType.flags & 540672 /* TypeVariable */) { + // The constraint of T[K], where T is a type variable, is A[K], where A is the + // apparent type of T. + var apparentType = getApparentTypeOfTypeVariable(type.objectType); + if (apparentType !== emptyObjectType) { + type.constraint = isTypeOfKind(type.indexType, 262178 /* StringLike */) ? + getIndexedAccessType(apparentType, type.indexType) : + getIndexTypeOfType(apparentType, 0 /* String */); + } + } + return type; + } + 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 */) ? + indexType.text : + accessExpression && checkThatExpressionIsProperSymbolReference(accessExpression.argumentExpression, indexType, /*reportError*/ false) ? + ts.getPropertyNameForKnownSymbolName(accessExpression.argumentExpression.name.text) : + undefined; + if (propName) { + var prop = getPropertyOfType(objectType, propName); + if (prop) { + if (accessExpression) { + if (ts.isAssignmentTarget(accessExpression) && (isReferenceToReadonlyEntity(accessExpression, prop) || isReferenceThroughNamespaceImport(accessExpression))) { + error(accessExpression.argumentExpression, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, symbolToString(prop)); + return unknownType; + } + if (cacheSymbol) { + getNodeLinks(accessNode).resolvedSymbol = prop; + } + } + return getTypeOfSymbol(prop); + } + } + if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 262178 /* StringLike */ | 340 /* NumberLike */ | 512 /* ESSymbol */)) { + if (isTypeAny(objectType)) { + return anyType; + } + var indexInfo = isTypeAnyOrAllConstituentTypesHaveKind(indexType, 340 /* NumberLike */) && getIndexInfoOfType(objectType, 1 /* Number */) || + getIndexInfoOfType(objectType, 0 /* String */) || + undefined; + if (indexInfo) { + if (accessExpression && ts.isAssignmentTarget(accessExpression) && indexInfo.isReadonly) { + error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); + return unknownType; + } + return indexInfo.type; + } + if (accessExpression && !isConstEnumObjectType(objectType)) { + if (compilerOptions.noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors) { + if (getIndexTypeOfType(objectType, 1 /* Number */)) { + error(accessExpression.argumentExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number); + } + else { + error(accessExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature, typeToString(objectType)); + } + } + return anyType; + } + } + if (accessNode) { + var indexNode = accessNode.kind === 178 /* ElementAccessExpression */ ? accessNode.argumentExpression : accessNode.indexType; + if (indexType.flags & (32 /* StringLiteral */ | 64 /* NumberLiteral */)) { + error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.text, typeToString(objectType)); + } + else if (indexType.flags & (2 /* String */ | 4 /* Number */)) { + error(indexNode, ts.Diagnostics.Type_0_has_no_matching_index_signature_for_type_1, typeToString(objectType), typeToString(indexType)); + } + else { + error(indexNode, ts.Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType)); + } + } + 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 instantiateType(getTemplateTypeFromMappedType(type), templateMapper); + } + function getIndexedAccessType(objectType, indexType, accessNode) { + // If the index type is generic, if the object type is generic and doesn't originate in an expression, + // 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. Note that for a + // generic T and a non-generic K, we eagerly resolve T[K] if it originates in an expression. This is to + // preserve backwards compatibility. For example, an element access 'this["foo"]' has always been resolved + // eagerly using the constraint type of 'this' at the given location. + if (maybeTypeOfKind(indexType, 540672 /* TypeVariable */ | 262144 /* Index */) || + maybeTypeOfKind(objectType, 540672 /* TypeVariable */) && !(accessNode && accessNode.kind === 178 /* ElementAccessExpression */) || + isGenericMappedType(objectType)) { + if (objectType.flags & 1 /* Any */) { + return objectType; + } + // 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; + } + } + // 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 }[X], we construct the + // type Box. + 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)); + } + // In the following we resolve T[K] to the type of the property in T selected by K. + 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(apparentObjectType, t, accessNode, /*cacheSymbol*/ false); + if (propType === unknownType) { + return unknownType; + } + propTypes.push(propType); + } + return getUnionType(propTypes); + } + return getPropertyTypeForIndexType(apparentObjectType, indexType, accessNode, /*cacheSymbol*/ true); + } + function getTypeFromIndexedAccessTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = getIndexedAccessType(getTypeFromTypeNode(node.objectType), getTypeFromTypeNode(node.indexType), node); + } + return links.resolvedType; + } + function getTypeFromMappedTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + var type = createObjectType(32 /* Mapped */, node.symbol); + type.declaration = node; + 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; + } + function getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { // Deferred resolution of members is handled by resolveObjectTypeMembers - var type = createObjectType(2097152 /* Anonymous */, node.symbol); - type.aliasSymbol = aliasSymbol; - type.aliasTypeArguments = aliasTypeArguments; - links.resolvedType = type; + var aliasSymbol = getAliasSymbolForTypeNode(node); + if (ts.isEmpty(node.symbol.members) && !aliasSymbol) { + links.resolvedType = emptyTypeLiteralType; + } + else { + var type = createObjectType(16 /* Anonymous */, node.symbol); + type.aliasSymbol = aliasSymbol; + type.aliasTypeArguments = getAliasTypeArgumentsForTypeNode(node); + links.resolvedType = type; + } } return links.resolvedType; } + function getAliasSymbolForTypeNode(node) { + return node.parent.kind === 228 /* TypeAliasDeclaration */ ? getSymbolOfNode(node.parent) : undefined; + } + function getAliasTypeArgumentsForTypeNode(node) { + var symbol = getAliasSymbolForTypeNode(node); + return symbol ? getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) : undefined; + } + /** + * Since the source of spread types are object literals, which are not binary, + * this function should be called in a left folding style, with left = previous result of getSpreadType + * and right = the new element to be spread. + */ + function getSpreadType(left, right, isFromObjectLiteral) { + if (left.flags & 1 /* Any */ || right.flags & 1 /* Any */) { + return anyType; + } + left = filterType(left, function (t) { return !(t.flags & 6144 /* Nullable */); }); + if (left.flags & 8192 /* Never */) { + return right; + } + right = filterType(right, function (t) { return !(t.flags & 6144 /* Nullable */); }); + if (right.flags & 8192 /* Never */) { + return left; + } + if (left.flags & 65536 /* Union */) { + return mapType(left, function (t) { return getSpreadType(t, right, isFromObjectLiteral); }); + } + if (right.flags & 65536 /* Union */) { + return mapType(right, function (t) { return getSpreadType(left, t, isFromObjectLiteral); }); + } + var members = ts.createMap(); + var skippedPrivateMembers = ts.createMap(); + var stringIndexInfo; + var numberIndexInfo; + if (left === emptyObjectType) { + // for the first spread element, left === emptyObjectType, so take the right's string indexer + stringIndexInfo = getIndexInfoOfType(right, 0 /* String */); + numberIndexInfo = getIndexInfoOfType(right, 1 /* Number */); + } + else { + stringIndexInfo = unionSpreadIndexInfos(getIndexInfoOfType(left, 0 /* String */), getIndexInfoOfType(right, 0 /* String */)); + numberIndexInfo = unionSpreadIndexInfos(getIndexInfoOfType(left, 1 /* Number */), getIndexInfoOfType(right, 1 /* Number */)); + } + for (var _i = 0, _a = getPropertiesOfType(right); _i < _a.length; _i++) { + var rightProp = _a[_i]; + // we approximate own properties as non-methods plus methods that are inside the object literal + var isOwnProperty = !(rightProp.flags & 8192 /* Method */) || isFromObjectLiteral; + var isSetterWithoutGetter = rightProp.flags & 65536 /* SetAccessor */ && !(rightProp.flags & 32768 /* GetAccessor */); + if (getDeclarationModifierFlagsFromSymbol(rightProp) & (8 /* Private */ | 16 /* Protected */)) { + skippedPrivateMembers[rightProp.name] = true; + } + else if (isOwnProperty && !isSetterWithoutGetter) { + members[rightProp.name] = rightProp; + } + } + for (var _b = 0, _c = getPropertiesOfType(left); _b < _c.length; _b++) { + var leftProp = _c[_b]; + if (leftProp.flags & 65536 /* SetAccessor */ && !(leftProp.flags & 32768 /* GetAccessor */) + || leftProp.name in skippedPrivateMembers) { + continue; + } + if (leftProp.name in members) { + var rightProp = members[leftProp.name]; + var rightType = getTypeOfSymbol(rightProp); + if (maybeTypeOfKind(rightType, 2048 /* Undefined */) || rightProp.flags & 536870912 /* Optional */) { + var declarations = ts.concatenate(leftProp.declarations, rightProp.declarations); + var flags = 4 /* Property */ | 67108864 /* Transient */ | (leftProp.flags & 536870912 /* Optional */); + var result = createSymbol(flags, leftProp.name); + result.type = getUnionType([getTypeOfSymbol(leftProp), getTypeWithFacts(rightType, 131072 /* NEUndefined */)]); + result.leftSpread = leftProp; + result.rightSpread = rightProp; + result.declarations = declarations; + result.isReadonly = isReadonlySymbol(leftProp) || isReadonlySymbol(rightProp); + members[leftProp.name] = result; + } + } + else { + members[leftProp.name] = leftProp; + } + } + return createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); + } function createLiteralType(flags, text) { var type = createType(flags); type.text = text; return type; } + function getFreshTypeOfLiteralType(type) { + if (type.flags & 96 /* StringOrNumberLiteral */ && !(type.flags & 1048576 /* FreshLiteral */)) { + if (!type.freshType) { + var freshType = createLiteralType(type.flags | 1048576 /* FreshLiteral */, type.text); + freshType.regularType = type; + type.freshType = freshType; + } + return type.freshType; + } + return type; + } + function getRegularTypeOfLiteralType(type) { + return type.flags & 96 /* StringOrNumberLiteral */ && type.flags & 1048576 /* FreshLiteral */ ? type.regularType : type; + } function getLiteralTypeForText(flags, text) { var map = flags & 32 /* StringLiteral */ ? stringLiteralTypes : numericLiteralTypes; return map[text] || (map[text] = createLiteralType(flags, text)); @@ -21554,7 +30029,7 @@ var ts; function getTypeFromLiteralTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = checkExpression(node.literal); + links.resolvedType = getRegularTypeOfLiteralType(checkExpression(node.literal)); } return links.resolvedType; } @@ -21577,9 +30052,9 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 222 /* InterfaceDeclaration */)) { - if (!(container.flags & 32 /* Static */) && - (container.kind !== 148 /* Constructor */ || ts.isNodeDescendentOf(node, container.body))) { + if (parent && (ts.isClassLike(parent) || parent.kind === 227 /* InterfaceDeclaration */)) { + if (!(ts.getModifierFlags(container) & 32 /* Static */) && + (container.kind !== 150 /* Constructor */ || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; } } @@ -21593,83 +30068,90 @@ var ts; } return links.resolvedType; } - function getTypeFromTypeNode(node, aliasSymbol, aliasTypeArguments) { + function getTypeFromTypeNode(node) { switch (node.kind) { - case 117 /* AnyKeyword */: - case 258 /* JSDocAllType */: - case 259 /* JSDocUnknownType */: + case 118 /* AnyKeyword */: + case 263 /* JSDocAllType */: + case 264 /* JSDocUnknownType */: return anyType; - case 132 /* StringKeyword */: + case 134 /* StringKeyword */: return stringType; - case 130 /* NumberKeyword */: + case 132 /* NumberKeyword */: return numberType; - case 120 /* BooleanKeyword */: + case 121 /* BooleanKeyword */: return booleanType; - case 133 /* SymbolKeyword */: + case 135 /* SymbolKeyword */: return esSymbolType; - case 103 /* VoidKeyword */: + case 104 /* VoidKeyword */: return voidType; - case 135 /* UndefinedKeyword */: + case 137 /* UndefinedKeyword */: return undefinedType; - case 93 /* NullKeyword */: + case 94 /* NullKeyword */: return nullType; - case 127 /* NeverKeyword */: + case 129 /* NeverKeyword */: return neverType; - case 283 /* JSDocNullKeyword */: + case 289 /* JSDocNullKeyword */: return nullType; - case 284 /* JSDocUndefinedKeyword */: + case 290 /* JSDocUndefinedKeyword */: return undefinedType; - case 285 /* JSDocNeverKeyword */: + case 291 /* JSDocNeverKeyword */: return neverType; - case 165 /* ThisType */: - case 97 /* ThisKeyword */: + case 167 /* ThisType */: + case 98 /* ThisKeyword */: return getTypeFromThisTypeNode(node); - case 166 /* LiteralType */: + case 171 /* LiteralType */: return getTypeFromLiteralTypeNode(node); - case 282 /* JSDocLiteralType */: + case 288 /* JSDocLiteralType */: return getTypeFromLiteralTypeNode(node.literal); - case 155 /* TypeReference */: - case 267 /* JSDocTypeReference */: + case 157 /* TypeReference */: + case 272 /* JSDocTypeReference */: return getTypeFromTypeReference(node); - case 154 /* TypePredicate */: + case 156 /* TypePredicate */: return booleanType; - case 194 /* ExpressionWithTypeArguments */: + case 199 /* ExpressionWithTypeArguments */: return getTypeFromTypeReference(node); - case 158 /* TypeQuery */: + case 160 /* TypeQuery */: return getTypeFromTypeQueryNode(node); - case 160 /* ArrayType */: - case 260 /* JSDocArrayType */: + case 162 /* ArrayType */: + case 265 /* JSDocArrayType */: return getTypeFromArrayTypeNode(node); - case 161 /* TupleType */: + case 163 /* TupleType */: return getTypeFromTupleTypeNode(node); - case 162 /* UnionType */: - case 261 /* JSDocUnionType */: - return getTypeFromUnionTypeNode(node, aliasSymbol, aliasTypeArguments); - case 163 /* IntersectionType */: - return getTypeFromIntersectionTypeNode(node, aliasSymbol, aliasTypeArguments); - case 164 /* ParenthesizedType */: - case 263 /* JSDocNullableType */: - case 264 /* JSDocNonNullableType */: - case 271 /* JSDocConstructorType */: - case 272 /* JSDocThisType */: - case 268 /* JSDocOptionalType */: + case 164 /* UnionType */: + case 266 /* JSDocUnionType */: + return getTypeFromUnionTypeNode(node); + case 165 /* IntersectionType */: + return getTypeFromIntersectionTypeNode(node); + case 166 /* ParenthesizedType */: + case 268 /* JSDocNullableType */: + case 269 /* JSDocNonNullableType */: + case 276 /* JSDocConstructorType */: + case 277 /* JSDocThisType */: + case 273 /* JSDocOptionalType */: return getTypeFromTypeNode(node.type); - case 156 /* FunctionType */: - case 157 /* ConstructorType */: - case 159 /* TypeLiteral */: - case 281 /* JSDocTypeLiteral */: - case 269 /* JSDocFunctionType */: - case 265 /* JSDocRecordType */: - return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node, aliasSymbol, aliasTypeArguments); + case 270 /* JSDocRecordType */: + return getTypeFromTypeNode(node.literal); + case 158 /* FunctionType */: + case 159 /* ConstructorType */: + case 161 /* TypeLiteral */: + case 287 /* JSDocTypeLiteral */: + case 274 /* JSDocFunctionType */: + return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); + case 168 /* TypeOperator */: + return getTypeFromTypeOperatorNode(node); + case 169 /* IndexedAccessType */: + return getTypeFromIndexedAccessTypeNode(node); + case 170 /* MappedType */: + return getTypeFromMappedTypeNode(node); // This function assumes that an identifier or qualified name is a type expression // Callers should first ensure this by calling isTypeNode - case 69 /* Identifier */: - case 139 /* QualifiedName */: + case 70 /* Identifier */: + case 141 /* QualifiedName */: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); - case 262 /* JSDocTupleType */: + case 267 /* JSDocTupleType */: return getTypeFromJSDocTupleType(node); - case 270 /* JSDocVariadicType */: + case 275 /* JSDocVariadicType */: return getTypeFromJSDocVariadicType(node); default: return unknownType; @@ -21686,6 +30168,16 @@ var ts; } return items; } + function instantiateTypes(types, mapper) { + return instantiateList(types, mapper, instantiateType); + } + function instantiateSignatures(signatures, mapper) { + return instantiateList(signatures, mapper, instantiateSignature); + } + function instantiateCached(type, mapper, instantiator) { + var instantiations = mapper.instantiations || (mapper.instantiations = []); + return instantiations[type.id] || (instantiations[type.id] = instantiator(type, mapper)); + } function createUnaryTypeMapper(source, target) { return function (t) { return t === source ? target : t; }; } @@ -21708,7 +30200,6 @@ var ts; count == 2 ? createBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : createArrayTypeMapper(sources, targets); mapper.mappedTypes = sources; - mapper.targetTypes = targets; return mapper; } function createTypeEraser(sources) { @@ -21717,7 +30208,7 @@ var ts; function getInferenceMapper(context) { if (!context.mapper) { var mapper = function (t) { - var typeParameters = context.typeParameters; + var typeParameters = context.signature.typeParameters; for (var i = 0; i < typeParameters.length; i++) { if (t === typeParameters[i]) { context.inferences[i].isFixed = true; @@ -21726,7 +30217,7 @@ var ts; } return t; }; - mapper.mappedTypes = context.typeParameters; + mapper.mappedTypes = context.signature.typeParameters; mapper.context = context; context.mapper = mapper; } @@ -21806,49 +30297,76 @@ var ts; return result; } function instantiateAnonymousType(type, mapper) { - if (mapper.instantiations) { - var cachedType = mapper.instantiations[type.id]; - if (cachedType) { - return cachedType; + var result = createObjectType(16 /* Anonymous */ | 64 /* Instantiated */, type.symbol); + result.target = type.objectFlags & 64 /* Instantiated */ ? type.target : type; + result.mapper = type.objectFlags & 64 /* Instantiated */ ? combineTypeMappers(type.mapper, mapper) : mapper; + result.aliasSymbol = type.aliasSymbol; + result.aliasTypeArguments = instantiateTypes(type.aliasTypeArguments, mapper); + return result; + } + function instantiateMappedType(type, mapper) { + // Check if we have a homomorphic mapped type, i.e. a type of the form { [P in keyof T]: X } for some + // type variable 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 + // homomorphic 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 typeVariable_1 = constraintType.type; + var mappedTypeVariable = instantiateType(typeVariable_1, mapper); + if (typeVariable_1 !== mappedTypeVariable) { + return mapType(mappedTypeVariable, function (t) { + if (isMappableType(t)) { + var replacementMapper = createUnaryTypeMapper(typeVariable_1, t); + var combinedMapper = mapper.mappedTypes && mapper.mappedTypes.length === 1 ? replacementMapper : combineTypeMappers(replacementMapper, mapper); + combinedMapper.mappedTypes = mapper.mappedTypes; + return instantiateMappedObjectType(type, combinedMapper); + } + return t; + }); } } - else { - mapper.instantiations = []; - } - // Mark the anonymous type as instantiated such that our infinite instantiation detection logic can recognize it - var result = createObjectType(2097152 /* Anonymous */ | 4194304 /* Instantiated */, type.symbol); - result.target = type; - result.mapper = mapper; + 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; result.aliasSymbol = type.aliasSymbol; - result.aliasTypeArguments = mapper.targetTypes; - mapper.instantiations[type.id] = result; + result.aliasTypeArguments = instantiateTypes(type.aliasTypeArguments, mapper); return result; } function isSymbolInScopeOfMappedTypeParameter(symbol, mapper) { + if (!(symbol.declarations && symbol.declarations.length)) { + return false; + } var mappedTypes = mapper.mappedTypes; // Starting with the parent of the symbol's declaration, check if the mapper maps any of // the type parameters introduced by enclosing declarations. We just pick the first // declaration since multiple declarations will all have the same parent anyway. - var node = symbol.declarations[0].parent; + var node = symbol.declarations[0]; while (node) { switch (node.kind) { - case 156 /* FunctionType */: - case 157 /* ConstructorType */: - case 220 /* FunctionDeclaration */: - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - case 148 /* Constructor */: - case 151 /* CallSignature */: - case 152 /* ConstructSignature */: - case 153 /* IndexSignature */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - case 179 /* FunctionExpression */: - case 180 /* ArrowFunction */: - case 221 /* ClassDeclaration */: - case 192 /* ClassExpression */: - case 222 /* InterfaceDeclaration */: - case 223 /* TypeAliasDeclaration */: + case 158 /* FunctionType */: + case 159 /* ConstructorType */: + case 225 /* FunctionDeclaration */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + case 150 /* Constructor */: + case 153 /* CallSignature */: + case 154 /* ConstructSignature */: + case 155 /* IndexSignature */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + case 184 /* FunctionExpression */: + case 185 /* ArrowFunction */: + case 226 /* ClassDeclaration */: + case 197 /* ClassExpression */: + case 227 /* InterfaceDeclaration */: + case 228 /* TypeAliasDeclaration */: var declaration = node; if (declaration.typeParameters) { for (var _i = 0, _a = declaration.typeParameters; _i < _a.length; _i++) { @@ -21858,27 +30376,72 @@ var ts; } } } - if (ts.isClassLike(node) || node.kind === 222 /* InterfaceDeclaration */) { + if (ts.isClassLike(node) || node.kind === 227 /* InterfaceDeclaration */) { var thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; if (thisType && ts.contains(mappedTypes, thisType)) { return true; } } break; - case 225 /* ModuleDeclaration */: - case 256 /* SourceFile */: + case 274 /* JSDocFunctionType */: + var func = node; + for (var _b = 0, _c = func.parameters; _b < _c.length; _b++) { + var p = _c[_b]; + if (ts.contains(mappedTypes, getTypeOfNode(p))) { + return true; + } + } + break; + case 230 /* ModuleDeclaration */: + case 261 /* SourceFile */: return false; } node = node.parent; } return false; } + function isTopLevelTypeAlias(symbol) { + if (symbol.declarations && symbol.declarations.length) { + var parentKind = symbol.declarations[0].parent.kind; + return parentKind === 261 /* SourceFile */ || parentKind === 231 /* ModuleBlock */; + } + return false; + } function instantiateType(type, mapper) { if (type && mapper !== identityMapper) { - if (type.flags & 16384 /* TypeParameter */) { - return mapper(type); + // If we are instantiating a type that has a top-level type alias, obtain the instantiation through + // the type alias instead in order to share instantiations for the same type arguments. This can + // dramatically reduce the number of structurally identical types we generate. Note that we can only + // perform this optimization for top-level type aliases. Consider: + // + // function f1(x: T) { + // type Foo = { x: X, t: T }; + // let obj: Foo = { x: x }; + // return obj; + // } + // function f2(x: U) { return f1(x); } + // let z = f2(42); + // + // Above, the declaration of f2 has an inferred return type that is an instantiation of f1's Foo + // equivalent to { x: U, t: U }. When instantiating this return type, we can't go back to Foo's + // cache because all cached instantiations are of the form { x: ???, t: T }, i.e. they have not been + // instantiated for T. Instead, we need to further instantiate the { x: U, t: U } form. + if (type.aliasSymbol && isTopLevelTypeAlias(type.aliasSymbol)) { + if (type.aliasTypeArguments) { + return getTypeAliasInstantiation(type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper)); + } + return type; } - if (type.flags & 2097152 /* Anonymous */) { + return instantiateTypeNoAlias(type, mapper); + } + return type; + } + function instantiateTypeNoAlias(type, mapper) { + if (type.flags & 16384 /* TypeParameter */) { + return mapper(type); + } + if (type.flags & 32768 /* Object */) { + if (type.objectFlags & 16 /* Anonymous */) { // If the anonymous type originates in a declaration of a function, method, class, or // interface, in an object type literal, or in an object literal expression, we may need // to instantiate the type because it might reference a type parameter. We skip instantiation @@ -21887,19 +30450,28 @@ var ts; // instantiation. return type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && - (type.flags & 4194304 /* Instantiated */ || isSymbolInScopeOfMappedTypeParameter(type.symbol, mapper)) ? - instantiateAnonymousType(type, mapper) : type; + (type.objectFlags & 64 /* Instantiated */ || isSymbolInScopeOfMappedTypeParameter(type.symbol, mapper)) ? + instantiateCached(type, mapper, instantiateAnonymousType) : type; } - if (type.flags & 131072 /* Reference */) { - return createTypeReference(type.target, instantiateList(type.typeArguments, mapper, instantiateType)); + if (type.objectFlags & 32 /* Mapped */) { + return instantiateCached(type, mapper, instantiateMappedType); } - if (type.flags & 524288 /* Union */ && !(type.flags & 8190 /* Primitive */)) { - return getUnionType(instantiateList(type.types, mapper, instantiateType), /*subtypeReduction*/ false, type.aliasSymbol, mapper.targetTypes); - } - if (type.flags & 1048576 /* Intersection */) { - return getIntersectionType(instantiateList(type.types, mapper, instantiateType), type.aliasSymbol, mapper.targetTypes); + if (type.objectFlags & 4 /* Reference */) { + return createTypeReference(type.target, instantiateTypes(type.typeArguments, mapper)); } } + if (type.flags & 65536 /* Union */ && !(type.flags & 8190 /* Primitive */)) { + return getUnionType(instantiateTypes(type.types, mapper), /*subtypeReduction*/ false, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper)); + } + if (type.flags & 131072 /* Intersection */) { + return getIntersectionType(instantiateTypes(type.types, mapper), type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper)); + } + if (type.flags & 262144 /* Index */) { + return getIndexType(instantiateType(type.type, mapper)); + } + if (type.flags & 524288 /* IndexedAccess */) { + return getIndexedAccessType(instantiateType(type.objectType, mapper), instantiateType(type.indexType, mapper)); + } return type; } function instantiateIndexInfo(info, mapper) { @@ -21908,44 +30480,59 @@ var ts; // Returns true if the given expression contains (at any level of nesting) a function or arrow expression // that is subject to contextual typing. function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 147 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 149 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 179 /* FunctionExpression */: - case 180 /* ArrowFunction */: + case 184 /* FunctionExpression */: + case 185 /* ArrowFunction */: return isContextSensitiveFunctionLikeDeclaration(node); - case 171 /* ObjectLiteralExpression */: + case 176 /* ObjectLiteralExpression */: return ts.forEach(node.properties, isContextSensitive); - case 170 /* ArrayLiteralExpression */: + case 175 /* ArrayLiteralExpression */: return ts.forEach(node.elements, isContextSensitive); - case 188 /* ConditionalExpression */: + case 193 /* ConditionalExpression */: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 187 /* BinaryExpression */: - return node.operatorToken.kind === 52 /* BarBarToken */ && + case 192 /* BinaryExpression */: + return node.operatorToken.kind === 53 /* BarBarToken */ && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 253 /* PropertyAssignment */: + case 257 /* PropertyAssignment */: return isContextSensitive(node.initializer); - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: return isContextSensitiveFunctionLikeDeclaration(node); - case 178 /* ParenthesizedExpression */: + case 183 /* ParenthesizedExpression */: return isContextSensitive(node.expression); } return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - var areAllParametersUntyped = !ts.forEach(node.parameters, function (p) { return p.type; }); - var isNullaryArrow = node.kind === 180 /* ArrowFunction */ && !node.parameters.length; - return !node.typeParameters && areAllParametersUntyped && !isNullaryArrow; + // Functions with type parameters are not context sensitive. + if (node.typeParameters) { + return false; + } + // Functions with any parameters that lack type annotations are context sensitive. + if (ts.forEach(node.parameters, function (p) { return !p.type; })) { + return true; + } + // For arrow functions we now know we're not context sensitive. + if (node.kind === 185 /* ArrowFunction */) { + return false; + } + // If the first parameter is not an explicit 'this' parameter, then the function has + // an implicit 'this' parameter which is subject to contextual typing. Otherwise we + // know that all parameters (including 'this') have type annotations and nothing is + // subject to contextual typing. + var parameter = ts.firstOrUndefined(node.parameters); + return !(parameter && ts.parameterIsThisKeyword(parameter)); } function isContextSensitiveFunctionOrObjectLiteralMethod(func) { return (isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func); } function getTypeWithoutSignatures(type) { - if (type.flags & 2588672 /* ObjectType */) { + if (type.flags & 32768 /* Object */) { var resolved = resolveStructuredTypeMembers(type); if (resolved.constructSignatures.length) { - var result = createObjectType(2097152 /* Anonymous */, type.symbol); + var result = createObjectType(16 /* Anonymous */, type.symbol); result.members = resolved.members; result.properties = resolved.properties; result.callSignatures = emptyArray; @@ -22148,7 +30735,7 @@ var ts; } if (source.symbol.name !== target.symbol.name || !(source.symbol.flags & 256 /* RegularEnum */) || !(target.symbol.flags & 256 /* RegularEnum */) || - (source.flags & 524288 /* Union */) !== (target.flags & 524288 /* Union */)) { + (source.flags & 65536 /* Union */) !== (target.flags & 65536 /* Union */)) { return enumRelation[id] = false; } var targetEnumType = getTypeOfSymbol(target.symbol); @@ -22171,7 +30758,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; @@ -22205,17 +30792,23 @@ var ts; return false; } function isTypeRelatedTo(source, target, relation) { + if (source.flags & 96 /* StringOrNumberLiteral */ && source.flags & 1048576 /* FreshLiteral */) { + source = source.regularType; + } + if (target.flags & 96 /* StringOrNumberLiteral */ && target.flags & 1048576 /* FreshLiteral */) { + target = target.regularType; + } if (source === target || relation !== identityRelation && isSimpleTypeRelatedTo(source, target, relation)) { return true; } - if (source.flags & 2588672 /* ObjectType */ && target.flags & 2588672 /* ObjectType */) { + if (source.flags & 32768 /* Object */ && target.flags & 32768 /* Object */) { var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; var related = relation[id]; if (related !== undefined) { return related === 1 /* Succeeded */; } } - if (source.flags & 4177920 /* StructuredOrTypeParameter */ || target.flags & 4177920 /* StructuredOrTypeParameter */) { + if (source.flags & 507904 /* StructuredOrTypeParameter */ || target.flags & 507904 /* StructuredOrTypeParameter */) { return checkTypeRelatedTo(source, target, relation, undefined, undefined, undefined); } return false; @@ -22262,9 +30855,15 @@ var ts; targetType = typeToString(target, /*enclosingDeclaration*/ undefined, 128 /* UseFullyQualifiedType */); } if (!message) { - message = relation === comparableRelation ? - ts.Diagnostics.Type_0_is_not_comparable_to_type_1 : - ts.Diagnostics.Type_0_is_not_assignable_to_type_1; + if (relation === comparableRelation) { + message = ts.Diagnostics.Type_0_is_not_comparable_to_type_1; + } + else if (sourceType === targetType) { + message = ts.Diagnostics.Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated; + } + else { + message = ts.Diagnostics.Type_0_is_not_assignable_to_type_1; + } } reportError(message, sourceType, targetType); } @@ -22278,12 +30877,37 @@ var ts; reportError(ts.Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType); } } + function isUnionOrIntersectionTypeWithoutNullableConstituents(type) { + if (!(type.flags & 196608 /* UnionOrIntersection */)) { + return false; + } + // at this point we know that this is union or intersection type possibly with nullable constituents. + // check if we still will have compound type if we ignore nullable components. + var seenNonNullable = false; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (t.flags & 6144 /* Nullable */) { + continue; + } + if (seenNonNullable) { + return true; + } + seenNonNullable = true; + } + return false; + } // Compare two types and return // Ternary.True if they are related with no assumptions, // Ternary.Maybe if they are related with assumptions of other relationships, or // Ternary.False if they are not related. function isRelatedTo(source, target, reportErrors, headMessage) { var result; + if (source.flags & 96 /* StringOrNumberLiteral */ && source.flags & 1048576 /* FreshLiteral */) { + source = source.regularType; + } + if (target.flags & 96 /* StringOrNumberLiteral */ && target.flags & 1048576 /* FreshLiteral */) { + target = target.regularType; + } // both types are the same - covers 'they are the same primitive type or both are Any' or the same type parameter cases if (source === target) return -1 /* True */; @@ -22292,7 +30916,7 @@ var ts; } if (isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined)) return -1 /* True */; - if (source.flags & 16777216 /* FreshObjectLiteral */) { + if (getObjectFlags(source) & 128 /* ObjectLiteral */ && source.flags & 1048576 /* FreshLiteral */) { if (hasExcessProperties(source, target, reportErrors)) { if (reportErrors) { reportRelationError(headMessage, source, target); @@ -22303,13 +30927,15 @@ var ts; // and intersection types are further deconstructed on the target side, we don't want to // make the check again (as it might fail for a partial target type). Therefore we obtain // the regular source type and proceed with that. - if (target.flags & 1572864 /* UnionOrIntersection */) { + if (isUnionOrIntersectionTypeWithoutNullableConstituents(target)) { source = getRegularTypeOfObjectLiteral(source); } } var saveErrorInfo = errorInfo; - // Note that these checks are specifically ordered to produce correct results. - if (source.flags & 524288 /* Union */) { + // Note that these checks are specifically ordered to produce correct results. In particular, + // we need to deconstruct unions before intersections (because unions are always at the top), + // and we need to handle "each" relations before "some" relations for the same kind of type. + if (source.flags & 65536 /* Union */) { if (relation === comparableRelation) { result = someTypeRelatedToType(source, target, reportErrors && !(source.flags & 8190 /* Primitive */)); } @@ -22320,56 +30946,128 @@ var ts; return result; } } - else if (target.flags & 1048576 /* Intersection */) { - result = typeRelatedToEachType(source, target, reportErrors); - if (result) { + else if (target.flags & 65536 /* Union */) { + if (result = typeRelatedToSomeType(source, target, reportErrors && !(source.flags & 8190 /* Primitive */) && !(target.flags & 8190 /* Primitive */))) { return result; } } - else { - // It is necessary to try these "some" checks on both sides because there may be nested "each" checks - // on either side that need to be prioritized. For example, A | B = (A | B) & (C | D) or - // A & B = (A & B) | (C & D). - if (source.flags & 1048576 /* Intersection */) { - // Check to see if any constituents of the intersection are immediately related to the target. - // - // Don't report errors though. Checking whether a constituent is related to the source is not actually - // useful and leads to some confusing error messages. Instead it is better to let the below checks - // take care of this, or to not elaborate at all. For instance, - // - // - For an object type (such as 'C = A & B'), users are usually more interested in structural errors. - // - // - For a union type (such as '(A | B) = (C & D)'), it's better to hold onto the whole intersection - // than to report that 'D' is not assignable to 'A' or 'B'. - // - // - For a primitive type or type parameter (such as 'number = A & B') there is no point in - // breaking the intersection apart. - if (result = someTypeRelatedToType(source, target, /*reportErrors*/ false)) { + else if (target.flags & 131072 /* Intersection */) { + if (result = typeRelatedToEachType(source, target, reportErrors)) { + return result; + } + } + else if (source.flags & 131072 /* Intersection */) { + // Check to see if any constituents of the intersection are immediately related to the target. + // + // Don't report errors though. Checking whether a constituent is related to the source is not actually + // useful and leads to some confusing error messages. Instead it is better to let the below checks + // take care of this, or to not elaborate at all. For instance, + // + // - For an object type (such as 'C = A & B'), users are usually more interested in structural errors. + // + // - For a union type (such as '(A | B) = (C & D)'), it's better to hold onto the whole intersection + // than to report that 'D' is not assignable to 'A' or 'B'. + // + // - For a primitive type or type parameter (such as 'number = A & B') there is no point in + // breaking the intersection apart. + if (result = someTypeRelatedToType(source, target, /*reportErrors*/ false)) { + return result; + } + } + else if (target.flags & 16384 /* TypeParameter */) { + // 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; + } + } + } + } + else if (target.flags & 262144 /* Index */) { + // A keyof S is related to a keyof T if T is related to S. + if (source.flags & 262144 /* Index */) { + if (result = isRelatedTo(target.type, source.type, /*reportErrors*/ false)) { return result; } } - if (target.flags & 524288 /* Union */) { - if (result = typeRelatedToSomeType(source, target, reportErrors && !(source.flags & 8190 /* Primitive */) && !(target.flags & 8190 /* Primitive */))) { + // Given a type variable T with a constraint C, a type S is assignable to + // keyof T if S is assignable to keyof C. + if (target.type.flags & 540672 /* TypeVariable */) { + var constraint = getConstraintOfTypeVariable(target.type); + if (constraint) { + if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) { + return result; + } + } + } + } + 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; + } + } + // A type S is related to a type T[K] if S is related to A[K], where K is string-like and + // A is the apparent type of S. + if (target.constraint) { + if (result = isRelatedTo(source, target.constraint, reportErrors)) { + errorInfo = saveErrorInfo; return result; } } } if (source.flags & 16384 /* TypeParameter */) { - var constraint = getConstraintOfTypeParameter(source); - if (!constraint || constraint.flags & 1 /* Any */) { - constraint = emptyObjectType; + // 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)) { + errorInfo = saveErrorInfo; + return result; + } } - // 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 { + 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 if (source.flags & 524288 /* IndexedAccess */) { + // A type S[K] is related to a type T if A[K] is related to T, where K is string-like and + // A is the apparent type of S. + if (source.constraint) { + if (result = isRelatedTo(source.constraint, target, reportErrors)) { + errorInfo = saveErrorInfo; + return result; + } } } else { - if (source.flags & 131072 /* Reference */ && target.flags & 131072 /* Reference */ && source.target === target.target) { + if (getObjectFlags(source) & 4 /* Reference */ && getObjectFlags(target) & 4 /* Reference */ && source.target === target.target) { // We have type references to same target type, see if relationship holds for all type arguments if (result = typeArgumentsRelatedTo(source, target, reportErrors)) { return result; @@ -22381,7 +31079,7 @@ var ts; // 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 & (2588672 /* ObjectType */ | 1048576 /* Intersection */) && target.flags & 2588672 /* ObjectType */) { + 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)) { @@ -22391,17 +31089,20 @@ var ts; } } if (reportErrors) { - if (source.flags & 2588672 /* ObjectType */ && target.flags & 8190 /* Primitive */) { + if (source.flags & 32768 /* Object */ && target.flags & 8190 /* Primitive */) { tryElaborateErrorsForPrimitivesAndObjects(source, target); } + else if (source.symbol && source.flags & 32768 /* Object */ && globalObjectType === source) { + reportError(ts.Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead); + } reportRelationError(headMessage, source, target); } return 0 /* False */; } function isIdenticalTo(source, target) { var result; - if (source.flags & 2588672 /* ObjectType */ && target.flags & 2588672 /* ObjectType */) { - if (source.flags & 131072 /* Reference */ && target.flags & 131072 /* Reference */ && source.target === target.target) { + if (source.flags & 32768 /* Object */ && target.flags & 32768 /* Object */) { + if (getObjectFlags(source) & 4 /* Reference */ && getObjectFlags(target) & 4 /* Reference */ && source.target === target.target) { // We have type references to same target type, see if all type arguments are identical if (result = typeArgumentsRelatedTo(source, target, /*reportErrors*/ false)) { return result; @@ -22409,10 +31110,10 @@ var ts; } return objectTypeRelatedTo(source, source, target, /*reportErrors*/ false); } - if (source.flags & 524288 /* Union */ && target.flags & 524288 /* Union */ || - source.flags & 1048576 /* Intersection */ && target.flags & 1048576 /* Intersection */) { - if (result = eachTypeRelatedToSomeType(source, target, /*reportErrors*/ false)) { - if (result &= eachTypeRelatedToSomeType(target, source, /*reportErrors*/ false)) { + if (source.flags & 65536 /* Union */ && target.flags & 65536 /* Union */ || + source.flags & 131072 /* Intersection */ && target.flags & 131072 /* Intersection */) { + if (result = eachTypeRelatedToSomeType(source, target)) { + if (result &= eachTypeRelatedToSomeType(target, source)) { return result; } } @@ -22424,7 +31125,7 @@ var ts; // index signatures, or if the property is actually declared in the object type. In a union or intersection // type, a property is considered known if it is known in any constituent type. function isKnownProperty(type, name) { - if (type.flags & 2588672 /* ObjectType */) { + if (type.flags & 32768 /* Object */) { var resolved = resolveStructuredTypeMembers(type); if ((relation === assignableRelation || relation === comparableRelation) && (type === globalObjectType || isEmptyObjectType(resolved)) || resolved.stringIndexInfo || @@ -22433,7 +31134,7 @@ var ts; return true; } } - else if (type.flags & 1572864 /* UnionOrIntersection */) { + else if (type.flags & 196608 /* UnionOrIntersection */) { for (var _i = 0, _a = type.types; _i < _a.length; _i++) { var t = _a[_i]; if (isKnownProperty(t, name)) { @@ -22451,7 +31152,7 @@ var ts; !t.numberIndexInfo; } function hasExcessProperties(source, target, reportErrors) { - if (!(target.flags & 536870912 /* ObjectLiteralPatternWithComputedProperties */) && maybeTypeOfKind(target, 2588672 /* ObjectType */)) { + if (maybeTypeOfKind(target, 32768 /* Object */) && !(getObjectFlags(target) & 512 /* ObjectLiteralPatternWithComputedProperties */)) { for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { var prop = _a[_i]; if (!isKnownProperty(target, prop.name)) { @@ -22469,7 +31170,7 @@ var ts; } return false; } - function eachTypeRelatedToSomeType(source, target, reportErrors) { + function eachTypeRelatedToSomeType(source, target) { var result = -1 /* True */; var sourceTypes = source.types; for (var _i = 0, sourceTypes_1 = sourceTypes; _i < sourceTypes_1.length; _i++) { @@ -22484,7 +31185,7 @@ var ts; } function typeRelatedToSomeType(source, target, reportErrors) { var targetTypes = target.types; - if (target.flags & 524288 /* Union */ && containsType(targetTypes, source)) { + if (target.flags & 65536 /* Union */ && containsType(targetTypes, source)) { return -1 /* True */; } var len = targetTypes.length; @@ -22511,7 +31212,7 @@ var ts; } function someTypeRelatedToType(source, target, reportErrors) { var sourceTypes = source.types; - if (source.flags & 524288 /* Union */ && containsType(sourceTypes, target)) { + if (source.flags & 65536 /* Union */ && containsType(sourceTypes, target)) { return -1 /* True */; } var len = sourceTypes.length; @@ -22606,6 +31307,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) { @@ -22636,15 +31340,46 @@ 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) { + var resolved = resolveStructuredTypeMembers(target); + if (isEmptyObjectType(resolved) || resolved.stringIndexInfo && resolved.stringIndexInfo.type.flags & 1 /* Any */) { + return -1 /* True */; + } + } + return 0 /* False */; + } function propertiesRelatedTo(source, target, reportErrors) { if (relation === identityRelation) { return propertiesIdenticalTo(source, target); } var result = -1 /* True */; var properties = getPropertiesOfObjectType(target); - var requireOptionalProperties = relation === subtypeRelation && !(source.flags & 8388608 /* ObjectLiteral */); - for (var _i = 0, properties_1 = properties; _i < properties_1.length; _i++) { - var targetProp = properties_1[_i]; + var requireOptionalProperties = relation === subtypeRelation && !(getObjectFlags(source) & 128 /* ObjectLiteral */); + for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) { + var targetProp = properties_3[_i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { if (!sourceProp) { @@ -22656,8 +31391,8 @@ var ts; } } else if (!(targetProp.flags & 134217728 /* Prototype */)) { - var sourcePropFlags = getDeclarationFlagsFromSymbol(sourceProp); - var targetPropFlags = getDeclarationFlagsFromSymbol(targetProp); + var sourcePropFlags = getDeclarationModifierFlagsFromSymbol(sourceProp); + var targetPropFlags = getDeclarationModifierFlagsFromSymbol(targetProp); if (sourcePropFlags & 8 /* Private */ || targetPropFlags & 8 /* Private */) { if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) { if (reportErrors) { @@ -22696,7 +31431,8 @@ var ts; return 0 /* False */; } result &= related; - if (sourceProp.flags & 536870912 /* Optional */ && !(targetProp.flags & 536870912 /* Optional */)) { + // When checking for comparability, be more lenient with optional properties. + if (relation !== comparableRelation && sourceProp.flags & 536870912 /* Optional */ && !(targetProp.flags & 536870912 /* Optional */)) { // TypeScript 1.0 spec (April 2014): 3.8.3 // S is a subtype of a type T, and T is a supertype of S if ... // S' and T are object types and, for each member M in T.. @@ -22715,7 +31451,7 @@ var ts; return result; } function propertiesIdenticalTo(source, target) { - if (!(source.flags & 2588672 /* ObjectType */ && target.flags & 2588672 /* ObjectType */)) { + if (!(source.flags & 32768 /* Object */ && target.flags & 32768 /* Object */)) { return 0 /* False */; } var sourceProperties = getPropertiesOfObjectType(source); @@ -22878,8 +31614,8 @@ var ts; if (!sourceSignature.declaration || !targetSignature.declaration) { return true; } - var sourceAccessibility = sourceSignature.declaration.flags & (8 /* Private */ | 16 /* Protected */); - var targetAccessibility = targetSignature.declaration.flags & (8 /* Private */ | 16 /* Protected */); + var sourceAccessibility = ts.getModifierFlags(sourceSignature.declaration) & 24 /* NonPublicAccessibilityModifier */; + var targetAccessibility = ts.getModifierFlags(targetSignature.declaration) & 24 /* NonPublicAccessibilityModifier */; // A public, protected and private signature is assignable to a private signature. if (targetAccessibility === 8 /* Private */) { return true; @@ -22900,11 +31636,11 @@ var ts; } // Return true if the given type is the constructor type for an abstract class function isAbstractConstructorType(type) { - if (type.flags & 2097152 /* Anonymous */) { + if (getObjectFlags(type) & 16 /* Anonymous */) { var symbol = type.symbol; if (symbol && symbol.flags & 32 /* Class */) { var declaration = getClassLikeDeclarationOfSymbol(symbol); - if (declaration && declaration.flags & 128 /* Abstract */) { + if (declaration && ts.getModifierFlags(declaration) & 128 /* Abstract */) { return true; } } @@ -22918,12 +31654,12 @@ var ts; // some level beyond that. function isDeeplyNestedGeneric(type, stack, depth) { // We track type references (created by createTypeReference) and instantiated types (created by instantiateType) - if (type.flags & (131072 /* Reference */ | 4194304 /* Instantiated */) && depth >= 5) { + if (getObjectFlags(type) & (4 /* Reference */ | 64 /* Instantiated */) && depth >= 5) { var symbol = type.symbol; var count = 0; for (var i = 0; i < depth; i++) { var t = stack[i]; - if (t.flags & (131072 /* Reference */ | 4194304 /* Instantiated */) && t.symbol === symbol) { + if (getObjectFlags(t) & (4 /* Reference */ | 64 /* Instantiated */) && t.symbol === symbol) { count++; if (count >= 5) return true; @@ -22942,8 +31678,8 @@ var ts; if (sourceProp === targetProp) { return -1 /* True */; } - var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (8 /* Private */ | 16 /* Protected */); - var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (8 /* Private */ | 16 /* Protected */); + var sourcePropAccessibility = getDeclarationModifierFlagsFromSymbol(sourceProp) & 24 /* NonPublicAccessibilityModifier */; + var targetPropAccessibility = getDeclarationModifierFlagsFromSymbol(targetProp) & 24 /* NonPublicAccessibilityModifier */; if (sourcePropAccessibility !== targetPropAccessibility) { return 0 /* False */; } @@ -23044,15 +31780,35 @@ var ts; } return true; } + function literalTypesWithSameBaseType(types) { + var commonBaseType; + for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { + var t = types_8[_i]; + var baseType = getBaseTypeOfLiteralType(t); + if (!commonBaseType) { + commonBaseType = baseType; + } + if (baseType === t || baseType !== commonBaseType) { + return false; + } + } + return true; + } + // When the candidate types are all literal types with the same base type, the common + // supertype is a union of those literal types. Otherwise, the common supertype is the + // first type that is a supertype of each of the other types. + function getSupertypeOrUnion(types) { + return literalTypesWithSameBaseType(types) ? getUnionType(types) : ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); + } function getCommonSupertype(types) { if (!strictNullChecks) { - return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); + return getSupertypeOrUnion(types); } var primaryTypes = ts.filter(types, function (t) { return !(t.flags & 6144 /* Nullable */); }); if (!primaryTypes.length) { return getUnionType(types, /*subtypeReduction*/ true); } - var supertype = ts.forEach(primaryTypes, function (t) { return isSupertypeOfEach(t, primaryTypes) ? t : undefined; }); + var supertype = getSupertypeOrUnion(primaryTypes); return supertype && includeFalsyTypes(supertype, getFalsyFlagsOfTypes(types) & 6144 /* Nullable */); } function reportNoCommonSupertypeError(types, errorLocation, errorMessageChainHead) { @@ -23089,12 +31845,12 @@ var ts; checkTypeSubtypeOf(bestSupertypeDownfallType, bestSupertype, errorLocation, ts.Diagnostics.Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0, errorMessageChainHead); } function isArrayType(type) { - return type.flags & 131072 /* Reference */ && type.target === globalArrayType; + return getObjectFlags(type) & 4 /* Reference */ && type.target === globalArrayType; } function isArrayLikeType(type) { // A type is array-like if it is a reference to the global Array or global ReadonlyArray type, // or if it is not the undefined or null type and if it is assignable to ReadonlyArray - return type.flags & 131072 /* Reference */ && (type.target === globalArrayType || type.target === globalReadonlyArrayType) || + return getObjectFlags(type) & 4 /* Reference */ && (type.target === globalArrayType || type.target === globalReadonlyArrayType) || !(type.flags & 6144 /* Nullable */) && isTypeAssignableTo(type, anyReadonlyArrayType); } function isTupleLikeType(type) { @@ -23103,17 +31859,25 @@ var ts; function isUnitType(type) { return (type.flags & (480 /* Literal */ | 2048 /* Undefined */ | 4096 /* Null */)) !== 0; } - function isUnitUnionType(type) { + function isLiteralType(type) { return type.flags & 8 /* Boolean */ ? true : - type.flags & 524288 /* Union */ ? type.flags & 16 /* Enum */ ? true : !ts.forEach(type.types, function (t) { return !isUnitType(t); }) : + type.flags & 65536 /* Union */ ? type.flags & 16 /* Enum */ ? true : !ts.forEach(type.types, function (t) { return !isUnitType(t); }) : isUnitType(type); } - function getBaseTypeOfUnitType(type) { + function getBaseTypeOfLiteralType(type) { return type.flags & 32 /* StringLiteral */ ? stringType : type.flags & 64 /* NumberLiteral */ ? numberType : type.flags & 128 /* BooleanLiteral */ ? booleanType : type.flags & 256 /* EnumLiteral */ ? type.baseType : - type.flags & 524288 /* Union */ && !(type.flags & 16 /* Enum */) ? getUnionType(ts.map(type.types, getBaseTypeOfUnitType)) : + type.flags & 65536 /* Union */ && !(type.flags & 16 /* Enum */) ? getUnionType(ts.sameMap(type.types, getBaseTypeOfLiteralType)) : + type; + } + function getWidenedLiteralType(type) { + return type.flags & 32 /* StringLiteral */ && type.flags & 1048576 /* FreshLiteral */ ? stringType : + type.flags & 64 /* NumberLiteral */ && type.flags & 1048576 /* FreshLiteral */ ? numberType : + type.flags & 128 /* BooleanLiteral */ ? booleanType : + type.flags & 256 /* EnumLiteral */ ? type.baseType : + type.flags & 65536 /* Union */ && !(type.flags & 16 /* Enum */) ? getUnionType(ts.sameMap(type.types, getWidenedLiteralType)) : type; } /** @@ -23121,12 +31885,12 @@ var ts; * Prefer using isTupleLikeType() unless the use of `elementTypes` is required. */ function isTupleType(type) { - return !!(type.flags & 131072 /* Reference */ && type.target.flags & 262144 /* Tuple */); + return !!(getObjectFlags(type) & 4 /* Reference */ && type.target.objectFlags & 8 /* Tuple */); } function getFalsyFlagsOfTypes(types) { var result = 0; - for (var _i = 0, types_8 = types; _i < types_8.length; _i++) { - var t = types_8[_i]; + for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { + var t = types_9[_i]; result |= getFalsyFlags(t); } return result; @@ -23135,9 +31899,9 @@ var ts; // flags for the string, number, boolean, "", 0, false, void, undefined, or null types respectively. Returns // no flags for all other types (including non-falsy literal types). function getFalsyFlags(type) { - return type.flags & 524288 /* Union */ ? getFalsyFlagsOfTypes(type.types) : - type.flags & 32 /* StringLiteral */ ? type === emptyStringType ? 32 /* StringLiteral */ : 0 : - type.flags & 64 /* NumberLiteral */ ? type === zeroType ? 64 /* NumberLiteral */ : 0 : + return type.flags & 65536 /* Union */ ? getFalsyFlagsOfTypes(type.types) : + type.flags & 32 /* StringLiteral */ ? type.text === "" ? 32 /* StringLiteral */ : 0 : + type.flags & 64 /* NumberLiteral */ ? type.text === "0" ? 64 /* NumberLiteral */ : 0 : type.flags & 128 /* BooleanLiteral */ ? type === falseType ? 128 /* BooleanLiteral */ : 0 : type.flags & 7406 /* PossiblyFalsy */; } @@ -23146,7 +31910,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); @@ -23205,7 +31969,7 @@ var ts; * Leave signatures alone since they are not subject to the check. */ function getRegularTypeOfObjectLiteral(type) { - if (!(type.flags & 16777216 /* FreshObjectLiteral */)) { + if (!(getObjectFlags(type) & 128 /* ObjectLiteral */ && type.flags & 1048576 /* FreshLiteral */)) { return type; } var regularType = type.regularType; @@ -23215,7 +31979,8 @@ var ts; var resolved = type; var members = transformTypeOfMembers(type, getRegularTypeOfObjectLiteral); var regularNew = createAnonymousType(resolved.symbol, members, resolved.callSignatures, resolved.constructSignatures, resolved.stringIndexInfo, resolved.numberIndexInfo); - regularNew.flags = resolved.flags & ~16777216 /* FreshObjectLiteral */; + regularNew.flags = resolved.flags & ~1048576 /* FreshLiteral */; + regularNew.objectFlags |= 128 /* ObjectLiteral */; type.regularType = regularNew; return regularNew; } @@ -23232,18 +31997,18 @@ var ts; return type.flags & 6144 /* Nullable */ ? type : getWidenedType(type); } function getWidenedType(type) { - if (type.flags & 100663296 /* RequiresWidening */) { + if (type.flags & 6291456 /* RequiresWidening */) { if (type.flags & 6144 /* Nullable */) { return anyType; } - if (type.flags & 8388608 /* ObjectLiteral */) { + if (getObjectFlags(type) & 128 /* ObjectLiteral */) { return getWidenedTypeOfObjectLiteral(type); } - if (type.flags & 524288 /* Union */) { - return getUnionType(ts.map(type.types, getWidenedConstituentType)); + if (type.flags & 65536 /* Union */) { + return getUnionType(ts.sameMap(type.types, getWidenedConstituentType)); } if (isArrayType(type) || isTupleType(type)) { - return createTypeReference(type.target, ts.map(type.typeArguments, getWidenedType)); + return createTypeReference(type.target, ts.sameMap(type.typeArguments, getWidenedType)); } } return type; @@ -23261,7 +32026,7 @@ var ts; */ function reportWideningErrorsInType(type) { var errorReported = false; - if (type.flags & 524288 /* Union */) { + if (type.flags & 65536 /* Union */) { for (var _i = 0, _a = type.types; _i < _a.length; _i++) { var t = _a[_i]; if (reportWideningErrorsInType(t)) { @@ -23277,11 +32042,11 @@ var ts; } } } - if (type.flags & 8388608 /* ObjectLiteral */) { + if (getObjectFlags(type) & 128 /* ObjectLiteral */) { for (var _d = 0, _e = getPropertiesOfObjectType(type); _d < _e.length; _d++) { var p = _e[_d]; var t = getTypeOfSymbol(p); - if (t.flags & 33554432 /* ContainsWideningType */) { + if (t.flags & 2097152 /* ContainsWideningType */) { if (!reportWideningErrorsInType(t)) { error(p.valueDeclaration, ts.Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, p.name, typeToString(getWidenedType(t))); } @@ -23295,25 +32060,25 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { - case 145 /* PropertyDeclaration */: - case 144 /* PropertySignature */: + case 147 /* PropertyDeclaration */: + case 146 /* PropertySignature */: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 142 /* Parameter */: + case 144 /* Parameter */: diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 169 /* BindingElement */: + case 174 /* BindingElement */: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; break; - case 220 /* FunctionDeclaration */: - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - case 179 /* FunctionExpression */: - case 180 /* ArrowFunction */: + case 225 /* FunctionDeclaration */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + case 184 /* FunctionExpression */: + case 185 /* ArrowFunction */: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -23326,7 +32091,7 @@ var ts; error(declaration, diagnostic, ts.declarationNameToString(declaration.name), typeAsString); } function reportErrorsFromWidening(declaration, type) { - if (produceDiagnostics && compilerOptions.noImplicitAny && type.flags & 33554432 /* ContainsWideningType */) { + if (produceDiagnostics && compilerOptions.noImplicitAny && type.flags & 2097152 /* ContainsWideningType */) { // Report implicit any error within type if possible, otherwise report error on declaration if (!reportWideningErrorsInType(type)) { reportImplicitAnyError(declaration, type); @@ -23353,44 +32118,99 @@ var ts; callback(getTypeAtPosition(source, i), getTypeAtPosition(target, i)); } } - function createInferenceContext(typeParameters, inferUnionTypes) { - var inferences = ts.map(typeParameters, createTypeInferencesObject); + function createInferenceContext(signature, inferUnionTypes) { + var inferences = ts.map(signature.typeParameters, createTypeInferencesObject); return { - typeParameters: typeParameters, + signature: signature, inferUnionTypes: inferUnionTypes, inferences: inferences, - inferredTypes: new Array(typeParameters.length) + inferredTypes: new Array(signature.typeParameters.length), }; } function createTypeInferencesObject() { return { primary: undefined, secondary: undefined, - isFixed: false + topLevel: true, + isFixed: false, }; } // Return true if the given type could possibly reference a type parameter for which // we perform type inference (i.e. a type parameter of a generic function). We cache // results for union and intersection types for performance reasons. - function couldContainTypeParameters(type) { - return !!(type.flags & 16384 /* TypeParameter */ || - type.flags & 131072 /* Reference */ && ts.forEach(type.typeArguments, couldContainTypeParameters) || - type.flags & 2097152 /* Anonymous */ && type.symbol && type.symbol.flags & (8192 /* Method */ | 2048 /* TypeLiteral */ | 32 /* Class */) || - type.flags & 1572864 /* UnionOrIntersection */ && couldUnionOrIntersectionContainTypeParameters(type)); + function couldContainTypeVariables(type) { + var objectFlags = getObjectFlags(type); + return !!(type.flags & 540672 /* TypeVariable */ || + objectFlags & 4 /* Reference */ && ts.forEach(type.typeArguments, couldContainTypeVariables) || + objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (8192 /* Method */ | 2048 /* TypeLiteral */ | 32 /* Class */) || + objectFlags & 32 /* Mapped */ || + type.flags & 196608 /* UnionOrIntersection */ && couldUnionOrIntersectionContainTypeVariables(type)); } - function couldUnionOrIntersectionContainTypeParameters(type) { - if (type.couldContainTypeParameters === undefined) { - type.couldContainTypeParameters = ts.forEach(type.types, couldContainTypeParameters); + function couldUnionOrIntersectionContainTypeVariables(type) { + if (type.couldContainTypeVariables === undefined) { + type.couldContainTypeVariables = ts.forEach(type.types, couldContainTypeVariables); } - return type.couldContainTypeParameters; + return type.couldContainTypeVariables; } - function inferTypes(context, source, target) { + function isTypeParameterAtTopLevel(type, typeParameter) { + return type === typeParameter || type.flags & 196608 /* UnionOrIntersection */ && ts.forEach(type.types, function (t) { return isTypeParameterAtTopLevel(t, typeParameter); }); + } + // Infer a suitable input type for a homomorphic mapped type { [P in keyof T]: X }. We construct + // an object type with the same set of properties as the source type, where the type of each + // property is computed by inferring from the source property type to X for the type + // variable T[P] (i.e. we treat the type T[P] as the type variable we're inferring for). + function inferTypeForHomomorphicMappedType(source, target) { + var properties = getPropertiesOfType(source); + var indexInfo = getIndexInfoOfType(source, 0 /* String */); + if (properties.length === 0 && !indexInfo) { + return undefined; + } + var typeVariable = getIndexedAccessType(getConstraintTypeFromMappedType(target).type, getTypeParameterFromMappedType(target)); + var typeVariableArray = [typeVariable]; + var typeInferences = createTypeInferencesObject(); + var typeInferencesArray = [typeInferences]; + var templateType = getTemplateTypeFromMappedType(target); + var readonlyMask = target.declaration.readonlyToken ? false : true; + var optionalMask = target.declaration.questionToken ? 0 : 536870912 /* Optional */; + var members = createSymbolTable(properties); + for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) { + var prop = properties_4[_i]; + var inferredPropType = inferTargetType(getTypeOfSymbol(prop)); + if (!inferredPropType) { + return undefined; + } + var inferredProp = createSymbol(4 /* Property */ | 67108864 /* Transient */ | prop.flags & optionalMask, prop.name); + inferredProp.declarations = prop.declarations; + inferredProp.type = inferredPropType; + inferredProp.isReadonly = readonlyMask && isReadonlySymbol(prop); + members[prop.name] = inferredProp; + } + if (indexInfo) { + var inferredIndexType = inferTargetType(indexInfo.type); + if (!inferredIndexType) { + return undefined; + } + indexInfo = createIndexInfo(inferredIndexType, readonlyMask && indexInfo.isReadonly); + } + return createAnonymousType(undefined, members, emptyArray, emptyArray, indexInfo, undefined); + function inferTargetType(sourceType) { + typeInferences.primary = undefined; + typeInferences.secondary = undefined; + inferTypes(typeVariableArray, typeInferencesArray, sourceType, templateType); + var inferences = typeInferences.primary || typeInferences.secondary; + return inferences && getUnionType(inferences, /*subtypeReduction*/ true); + } + } + function inferTypesWithContext(context, originalSource, originalTarget) { + inferTypes(context.signature.typeParameters, context.inferences, originalSource, originalTarget); + } + function inferTypes(typeVariables, typeInferences, originalSource, originalTarget) { var sourceStack; var targetStack; var depth = 0; var inferiority = 0; var visited = ts.createMap(); - inferFromTypes(source, target); + inferFromTypes(originalSource, originalTarget); function isInProcess(source, target) { for (var i = 0; i < depth; i++) { if (source === sourceStack[i] && target === targetStack[i]) { @@ -23400,11 +32220,21 @@ var ts; return false; } function inferFromTypes(source, target) { - if (!couldContainTypeParameters(target)) { + if (!couldContainTypeVariables(target)) { return; } - if (source.flags & 524288 /* Union */ && target.flags & 524288 /* Union */ && !(source.flags & 16 /* Enum */ && target.flags & 16 /* Enum */) || - source.flags & 1048576 /* Intersection */ && target.flags & 1048576 /* Intersection */) { + if (source.aliasSymbol && source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol) { + // Source and target are types originating in the same generic type alias declaration. + // Simply infer from source type arguments to target type arguments. + var sourceTypes = source.aliasTypeArguments; + var targetTypes = target.aliasTypeArguments; + for (var i = 0; i < sourceTypes.length; i++) { + inferFromTypes(sourceTypes[i], targetTypes[i]); + } + return; + } + if (source.flags & 65536 /* Union */ && target.flags & 65536 /* Union */ && !(source.flags & 16 /* Enum */ && target.flags & 16 /* Enum */) || + source.flags & 131072 /* Intersection */ && target.flags & 131072 /* Intersection */) { // Source and target are both unions or both intersections. If source and target // are the same type, just relate each constituent type to itself. if (source === target) { @@ -23414,17 +32244,25 @@ var ts; } return; } - // Find each target constituent type that has an identically matching source - // constituent type, and for each such target constituent type infer from the type to - // itself. When inferring from a type to itself we effectively find all type parameter - // occurrences within that type and infer themselves as their type arguments. + // Find each source constituent type that has an identically matching target constituent + // type, and for each such type infer from the type to itself. When inferring from a + // type to itself we effectively find all type parameter occurrences within that type + // and infer themselves as their type arguments. We have special handling for numeric + // and string literals because the number and string types are not represented as unions + // of all their possible values. var matchingTypes = void 0; - for (var _b = 0, _c = target.types; _b < _c.length; _b++) { + for (var _b = 0, _c = source.types; _b < _c.length; _b++) { var t = _c[_b]; - if (typeIdenticalToSomeType(t, source.types)) { + if (typeIdenticalToSomeType(t, target.types)) { (matchingTypes || (matchingTypes = [])).push(t); inferFromTypes(t, t); } + else if (t.flags & (64 /* NumberLiteral */ | 32 /* StringLiteral */)) { + var b = getBaseTypeOfLiteralType(t); + if (typeIdenticalToSomeType(b, target.types)) { + (matchingTypes || (matchingTypes = [])).push(t, b); + } + } } // Next, to improve the quality of inferences, reduce the source and target types by // removing the identically matched constituents. For example, when inferring from @@ -23434,20 +32272,19 @@ var ts; target = removeTypesFromUnionOrIntersection(target, matchingTypes); } } - if (target.flags & 16384 /* TypeParameter */) { + if (target.flags & 540672 /* TypeVariable */) { // If target is a type parameter, make an inference, unless the source type contains // the anyFunctionType (the wildcard type that's used to avoid contextually typing functions). // Because the anyFunctionType is internal, it should not be exposed to the user by adding // it as an inference candidate. Hopefully, a better candidate will come along that does // not contain anyFunctionType when we come back to this argument for its second round // of inference. - if (source.flags & 134217728 /* ContainsAnyFunctionType */) { + if (source.flags & 8388608 /* ContainsAnyFunctionType */) { return; } - var typeParameters = context.typeParameters; - for (var i = 0; i < typeParameters.length; i++) { - if (target === typeParameters[i]) { - var inferences = context.inferences[i]; + for (var i = 0; i < typeVariables.length; i++) { + if (target === typeVariables[i]) { + var inferences = typeInferences[i]; if (!inferences.isFixed) { // Any inferences that are made to a type parameter in a union type are inferior // to inferences made to a flat (non-union) type. This is because if we infer to @@ -23461,12 +32298,15 @@ var ts; if (!ts.contains(candidates, source)) { candidates.push(source); } + if (target.flags & 16384 /* TypeParameter */ && !isTypeParameterAtTopLevel(originalTarget, target)) { + inferences.topLevel = false; + } } return; } } } - else if (source.flags & 131072 /* Reference */ && target.flags & 131072 /* Reference */ && source.target === target.target) { + else if (getObjectFlags(source) & 4 /* Reference */ && getObjectFlags(target) & 4 /* Reference */ && source.target === target.target) { // If source and target are references to the same generic type, infer from type arguments var sourceTypes = source.typeArguments || emptyArray; var targetTypes = target.typeArguments || emptyArray; @@ -23475,31 +32315,31 @@ var ts; inferFromTypes(sourceTypes[i], targetTypes[i]); } } - else if (target.flags & 1572864 /* UnionOrIntersection */) { + else if (target.flags & 196608 /* UnionOrIntersection */) { var targetTypes = target.types; - var typeParameterCount = 0; - var typeParameter = void 0; - // First infer to each type in union or intersection that isn't a type parameter + var typeVariableCount = 0; + var typeVariable = void 0; + // First infer to each type in union or intersection that isn't a type variable for (var _d = 0, targetTypes_2 = targetTypes; _d < targetTypes_2.length; _d++) { var t = targetTypes_2[_d]; - if (t.flags & 16384 /* TypeParameter */ && ts.contains(context.typeParameters, t)) { - typeParameter = t; - typeParameterCount++; + if (t.flags & 540672 /* TypeVariable */ && ts.contains(typeVariables, t)) { + typeVariable = t; + typeVariableCount++; } else { inferFromTypes(source, t); } } - // Next, if target containings a single naked type parameter, make a secondary inference to that type - // parameter. This gives meaningful results for union types in co-variant positions and intersection + // Next, if target containings a single naked type variable, make a secondary inference to that type + // variable. This gives meaningful results for union types in co-variant positions and intersection // types in contra-variant positions (such as callback parameters). - if (typeParameterCount === 1) { + if (typeVariableCount === 1) { inferiority++; - inferFromTypes(source, typeParameter); + inferFromTypes(source, typeVariable); inferiority--; } } - else if (source.flags & 1572864 /* UnionOrIntersection */) { + else if (source.flags & 196608 /* UnionOrIntersection */) { // Source is a union or intersection type, infer from each constituent type var sourceTypes = source.types; for (var _e = 0, sourceTypes_3 = sourceTypes; _e < sourceTypes_3.length; _e++) { @@ -23509,7 +32349,7 @@ var ts; } else { source = getApparentType(source); - if (source.flags & 2588672 /* ObjectType */) { + if (source.flags & 32768 /* Object */) { if (isInProcess(source, target)) { return; } @@ -23528,18 +32368,47 @@ 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 (constraintType.flags & 262144 /* Index */) { + // We're inferring from some source type S to a homomorphic mapped type { [P in keyof T]: X }, + // where T is a type variable. Use inferTypeForHomomorphicMappedType to infer a suitable source + // type and then make a secondary inference from that type to T. We make a secondary inference + // such that direct inferences to T get priority over inferences to Partial, for example. + var index = ts.indexOf(typeVariables, constraintType.type); + if (index >= 0 && !typeInferences[index].isFixed) { + var inferredType = inferTypeForHomomorphicMappedType(source, target); + if (inferredType) { + inferiority++; + inferFromTypes(inferredType, typeVariables[index]); + inferiority--; + } + } + return; + } + if (constraintType.flags & 16384 /* TypeParameter */) { + // We're inferring from some source type S to a mapped type { [P in T]: X }, where T is a type + // parameter. Infer from 'keyof S' to T and infer from a union of each property type in S to X. + 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_2 = properties; _i < properties_2.length; _i++) { - var targetProp = properties_2[_i]; + for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) { + var targetProp = properties_5[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); @@ -23556,8 +32425,11 @@ var ts; inferFromSignature(getErasedSignature(sourceSignatures[sourceLen - len + i]), getErasedSignature(targetSignatures[targetLen - len + i])); } } + function inferFromParameterTypes(source, target) { + return inferFromTypes(source, target); + } function inferFromSignature(source, target) { - forEachMatchingParameterType(source, target, inferFromTypes); + forEachMatchingParameterType(source, target, inferFromParameterTypes); if (source.typePredicate && target.typePredicate && source.typePredicate.kind === target.typePredicate.kind) { inferFromTypes(source.typePredicate.type, target.typePredicate.type); } @@ -23586,8 +32458,8 @@ var ts; } } function typeIdenticalToSomeType(type, types) { - for (var _i = 0, types_9 = types; _i < types_9.length; _i++) { - var t = types_9[_i]; + for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { + var t = types_10[_i]; if (isTypeIdenticalTo(t, type)) { return true; } @@ -23606,20 +32478,33 @@ var ts; reducedTypes.push(t); } } - return type.flags & 524288 /* Union */ ? getUnionType(reducedTypes) : getIntersectionType(reducedTypes); + return type.flags & 65536 /* Union */ ? getUnionType(reducedTypes) : getIntersectionType(reducedTypes); } function getInferenceCandidates(context, index) { var inferences = context.inferences[index]; return inferences.primary || inferences.secondary || emptyArray; } + function hasPrimitiveConstraint(type) { + var constraint = getConstraintOfTypeParameter(type); + return constraint && maybeTypeOfKind(constraint, 8190 /* Primitive */ | 262144 /* Index */); + } function getInferredType(context, index) { var inferredType = context.inferredTypes[index]; var inferenceSucceeded; if (!inferredType) { var inferences = getInferenceCandidates(context, index); if (inferences.length) { + // We widen inferred literal types if + // all inferences were made to top-level ocurrences of the type parameter, and + // the type parameter has no constraint or its constraint includes no primitive or literal types, and + // the type parameter was fixed during inference or does not occur at top-level in the return type. + var signature = context.signature; + var widenLiteralTypes = context.inferences[index].topLevel && + !hasPrimitiveConstraint(signature.typeParameters[index]) && + (context.inferences[index].isFixed || !isTypeParameterAtTopLevel(getReturnTypeOfSignature(signature), signature.typeParameters[index])); + var baseInferences = widenLiteralTypes ? ts.sameMap(inferences, getWidenedLiteralType) : inferences; // Infer widened union or supertype, or the unknown type for no common supertype - var unionOrSuperType = context.inferUnionTypes ? getUnionType(inferences, /*subtypeReduction*/ true) : getCommonSupertype(inferences); + var unionOrSuperType = context.inferUnionTypes ? getUnionType(baseInferences, /*subtypeReduction*/ true) : getCommonSupertype(baseInferences); inferredType = unionOrSuperType ? getWidenedType(unionOrSuperType) : unknownType; inferenceSucceeded = !!unionOrSuperType; } @@ -23634,7 +32519,7 @@ var ts; context.inferredTypes[index] = inferredType; // Only do the constraint check if inference succeeded (to prevent cascading errors) if (inferenceSucceeded) { - var constraint = getConstraintOfTypeParameter(context.typeParameters[index]); + var constraint = getConstraintOfTypeParameter(context.signature.typeParameters[index]); if (constraint) { var instantiatedConstraint = instantiateType(constraint, getInferenceMapper(context)); if (!isTypeAssignableTo(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) { @@ -23671,10 +32556,10 @@ var ts; // The expression is restricted to a single identifier or a sequence of identifiers separated by periods while (node) { switch (node.kind) { - case 158 /* TypeQuery */: + case 160 /* TypeQuery */: return true; - case 69 /* Identifier */: - case 139 /* QualifiedName */: + case 70 /* Identifier */: + case 141 /* QualifiedName */: node = node.parent; continue; default: @@ -23688,14 +32573,14 @@ var ts; // leftmost identifier followed by zero or more property names separated by dots. // The result is undefined if the reference isn't a dotted name. function getFlowCacheKey(node) { - if (node.kind === 69 /* Identifier */) { + if (node.kind === 70 /* Identifier */) { var symbol = getResolvedSymbol(node); return symbol !== unknownSymbol ? "" + getSymbolId(symbol) : undefined; } - if (node.kind === 97 /* ThisKeyword */) { + if (node.kind === 98 /* ThisKeyword */) { return "0"; } - if (node.kind === 172 /* PropertyAccessExpression */) { + if (node.kind === 177 /* PropertyAccessExpression */) { var key = getFlowCacheKey(node.expression); return key && key + "." + node.name.text; } @@ -23703,31 +32588,31 @@ var ts; } function getLeftmostIdentifierOrThis(node) { switch (node.kind) { - case 69 /* Identifier */: - case 97 /* ThisKeyword */: + case 70 /* Identifier */: + case 98 /* ThisKeyword */: return node; - case 172 /* PropertyAccessExpression */: + case 177 /* PropertyAccessExpression */: return getLeftmostIdentifierOrThis(node.expression); } return undefined; } function isMatchingReference(source, target) { switch (source.kind) { - case 69 /* Identifier */: - return target.kind === 69 /* Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 218 /* VariableDeclaration */ || target.kind === 169 /* BindingElement */) && + case 70 /* Identifier */: + return target.kind === 70 /* Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) || + (target.kind === 223 /* VariableDeclaration */ || target.kind === 174 /* BindingElement */) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); - case 97 /* ThisKeyword */: - return target.kind === 97 /* ThisKeyword */; - case 172 /* PropertyAccessExpression */: - return target.kind === 172 /* PropertyAccessExpression */ && + case 98 /* ThisKeyword */: + return target.kind === 98 /* ThisKeyword */; + case 177 /* PropertyAccessExpression */: + return target.kind === 177 /* PropertyAccessExpression */ && source.name.text === target.name.text && isMatchingReference(source.expression, target.expression); } return false; } function containsMatchingReference(source, target) { - while (source.kind === 172 /* PropertyAccessExpression */) { + while (source.kind === 177 /* PropertyAccessExpression */) { source = source.expression; if (isMatchingReference(source, target)) { return true; @@ -23740,37 +32625,26 @@ var ts; // a possible discriminant if its type differs in the constituents of containing union type, and if every // choice is a unit type or a union of unit types. function containsMatchingReferenceDiscriminant(source, target) { - return target.kind === 172 /* PropertyAccessExpression */ && + return target.kind === 177 /* PropertyAccessExpression */ && containsMatchingReference(source, target.expression) && isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), target.name.text); } function getDeclaredTypeOfReference(expr) { - if (expr.kind === 69 /* Identifier */) { + if (expr.kind === 70 /* Identifier */) { return getTypeOfSymbol(getResolvedSymbol(expr)); } - if (expr.kind === 172 /* PropertyAccessExpression */) { + if (expr.kind === 177 /* PropertyAccessExpression */) { var type = getDeclaredTypeOfReference(expr.expression); return type && getTypeOfPropertyOfType(type, expr.name.text); } return undefined; } function isDiscriminantProperty(type, name) { - if (type && type.flags & 524288 /* Union */) { - var prop = getPropertyOfType(type, name); - if (!prop) { - // The type may be a union that includes nullable or primitive types. If filtering - // those out produces a different type, get the property from that type instead. - // Effectively, we're checking if this *could* be a discriminant property once nullable - // and primitive types are removed by other type guards. - var filteredType = getTypeWithFacts(type, 4194304 /* Discriminatable */); - if (filteredType !== type && filteredType.flags & 524288 /* Union */) { - prop = getPropertyOfType(filteredType, name); - } - } + if (type && type.flags & 65536 /* Union */) { + var prop = getUnionOrIntersectionProperty(type, name); if (prop && prop.flags & 268435456 /* SyntheticProperty */) { if (prop.isDiscriminantProperty === undefined) { - prop.isDiscriminantProperty = !prop.hasCommonType && - isUnitUnionType(getTypeOfSymbol(prop)); + prop.isDiscriminantProperty = prop.hasNonUniformType && isLiteralType(getTypeOfSymbol(prop)); } return prop.isDiscriminantProperty; } @@ -23789,7 +32663,7 @@ var ts; } } } - if (callExpression.expression.kind === 172 /* PropertyAccessExpression */ && + if (callExpression.expression.kind === 177 /* PropertyAccessExpression */ && isOrContainsMatchingReference(reference, callExpression.expression.expression)) { return true; } @@ -23803,7 +32677,7 @@ var ts; return flow.id; } function typeMaybeAssignableTo(source, target) { - if (!(source.flags & 524288 /* Union */)) { + if (!(source.flags & 65536 /* Union */)) { return isTypeAssignableTo(source, target); } for (var _i = 0, _a = source.types; _i < _a.length; _i++) { @@ -23819,8 +32693,11 @@ var ts; // we remove type string. function getAssignmentReducedType(declaredType, assignedType) { if (declaredType !== assignedType) { + if (assignedType.flags & 8192 /* Never */) { + return assignedType; + } var reducedType = filterType(declaredType, function (t) { return typeMaybeAssignableTo(assignedType, t); }); - if (reducedType !== neverType) { + if (!(reducedType.flags & 8192 /* Never */)) { return reducedType; } } @@ -23828,8 +32705,8 @@ var ts; } function getTypeFactsOfTypes(types) { var result = 0 /* None */; - for (var _i = 0, types_10 = types; _i < types_10.length; _i++) { - var t = types_10[_i]; + for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { + var t = types_11[_i]; result |= getTypeFacts(t); } return result; @@ -23848,14 +32725,14 @@ var ts; } if (flags & 32 /* StringLiteral */) { return strictNullChecks ? - type === emptyStringType ? 3030785 /* EmptyStringStrictFacts */ : 1982209 /* NonEmptyStringStrictFacts */ : - type === emptyStringType ? 3145473 /* EmptyStringFacts */ : 4194049 /* NonEmptyStringFacts */; + type.text === "" ? 3030785 /* EmptyStringStrictFacts */ : 1982209 /* NonEmptyStringStrictFacts */ : + type.text === "" ? 3145473 /* EmptyStringFacts */ : 4194049 /* NonEmptyStringFacts */; } if (flags & (4 /* Number */ | 16 /* Enum */)) { return strictNullChecks ? 4079234 /* NumberStrictFacts */ : 4193922 /* NumberFacts */; } if (flags & (64 /* NumberLiteral */ | 256 /* EnumLiteral */)) { - var isZero = type === zeroType || type.flags & 256 /* EnumLiteral */ && type.text === "0"; + var isZero = type.text === "0"; return strictNullChecks ? isZero ? 3030658 /* ZeroStrictFacts */ : 1982082 /* NonZeroStrictFacts */ : isZero ? 3145346 /* ZeroFacts */ : 4193922 /* NonZeroFacts */; @@ -23868,7 +32745,7 @@ var ts; type === falseType ? 3030404 /* FalseStrictFacts */ : 1981828 /* TrueStrictFacts */ : type === falseType ? 3145092 /* FalseFacts */ : 4193668 /* TrueFacts */; } - if (flags & 2588672 /* ObjectType */) { + if (flags & 32768 /* Object */) { return isFunctionObjectType(type) ? strictNullChecks ? 6164448 /* FunctionStrictFacts */ : 8376288 /* FunctionFacts */ : strictNullChecks ? 6166480 /* ObjectStrictFacts */ : 8378320 /* ObjectFacts */; @@ -23886,7 +32763,7 @@ var ts; var constraint = getConstraintOfTypeParameter(type); return getTypeFacts(constraint || emptyObjectType); } - if (flags & 1572864 /* UnionOrIntersection */) { + if (flags & 196608 /* UnionOrIntersection */) { return getTypeFactsOfTypes(type.types); } return 8388607 /* All */; @@ -23896,13 +32773,13 @@ 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; } function getTypeOfDestructuredProperty(type, name) { - var text = getTextOfPropertyName(name); + var text = ts.getTextOfPropertyName(name); return getTypeOfPropertyOfType(type, text) || isNumericLiteralName(text) && getIndexTypeOfType(type, 1 /* Number */) || getIndexTypeOfType(type, 0 /* String */) || @@ -23913,19 +32790,19 @@ var ts; checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false) || unknownType; } - function getTypeOfDestructuredSpreadElement(type) { + function getTypeOfDestructuredSpreadExpression(type) { return createArrayType(checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false) || unknownType); } function getAssignedTypeOfBinaryExpression(node) { - return node.parent.kind === 170 /* ArrayLiteralExpression */ || node.parent.kind === 253 /* PropertyAssignment */ ? + 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)); } - function getAssignedTypeOfSpreadElement(node) { - return getTypeOfDestructuredSpreadElement(getAssignedType(node.parent)); + function getAssignedTypeOfSpreadExpression(node) { + return getTypeOfDestructuredSpreadExpression(getAssignedType(node.parent)); } function getAssignedTypeOfPropertyAssignment(node) { return getTypeOfDestructuredProperty(getAssignedType(node.parent), node.name); @@ -23936,21 +32813,21 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 207 /* ForInStatement */: + case 212 /* ForInStatement */: return stringType; - case 208 /* ForOfStatement */: + case 213 /* ForOfStatement */: return checkRightHandSideOfForOf(parent.expression) || unknownType; - case 187 /* BinaryExpression */: + case 192 /* BinaryExpression */: return getAssignedTypeOfBinaryExpression(parent); - case 181 /* DeleteExpression */: + case 186 /* DeleteExpression */: return undefinedType; - case 170 /* ArrayLiteralExpression */: + case 175 /* ArrayLiteralExpression */: return getAssignedTypeOfArrayLiteralElement(parent, node); - case 191 /* SpreadElementExpression */: - return getAssignedTypeOfSpreadElement(parent); - case 253 /* PropertyAssignment */: + case 196 /* SpreadElement */: + return getAssignedTypeOfSpreadExpression(parent); + case 257 /* PropertyAssignment */: return getAssignedTypeOfPropertyAssignment(parent); - case 254 /* ShorthandPropertyAssignment */: + case 258 /* ShorthandPropertyAssignment */: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return unknownType; @@ -23958,11 +32835,11 @@ var ts; function getInitialTypeOfBindingElement(node) { var pattern = node.parent; var parentType = getInitialType(pattern.parent); - var type = pattern.kind === 167 /* ObjectBindingPattern */ ? + var type = pattern.kind === 172 /* ObjectBindingPattern */ ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, ts.indexOf(pattern.elements, node)) : - getTypeOfDestructuredSpreadElement(parentType); + getTypeOfDestructuredSpreadExpression(parentType); return getTypeWithDefault(type, node.initializer); } function getTypeOfInitializer(node) { @@ -23970,47 +32847,60 @@ 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) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 207 /* ForInStatement */) { + if (node.parent.parent.kind === 212 /* ForInStatement */) { return stringType; } - if (node.parent.parent.kind === 208 /* ForOfStatement */) { + if (node.parent.parent.kind === 213 /* ForOfStatement */) { return checkRightHandSideOfForOf(node.parent.parent.expression) || unknownType; } return unknownType; } function getInitialType(node) { - return node.kind === 218 /* VariableDeclaration */ ? + return node.kind === 223 /* VariableDeclaration */ ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function getInitialOrAssignedType(node) { - return node.kind === 218 /* VariableDeclaration */ || node.kind === 169 /* BindingElement */ ? + return node.kind === 223 /* VariableDeclaration */ || node.kind === 174 /* BindingElement */ ? getInitialType(node) : getAssignedType(node); } + function isEmptyArrayAssignment(node) { + return node.kind === 223 /* VariableDeclaration */ && node.initializer && + isEmptyArrayLiteral(node.initializer) || + node.kind !== 174 /* BindingElement */ && node.parent.kind === 192 /* BinaryExpression */ && + isEmptyArrayLiteral(node.parent.right); + } function getReferenceCandidate(node) { switch (node.kind) { - case 178 /* ParenthesizedExpression */: + case 183 /* ParenthesizedExpression */: return getReferenceCandidate(node.expression); - case 187 /* BinaryExpression */: + case 192 /* BinaryExpression */: switch (node.operatorToken.kind) { - case 56 /* EqualsToken */: + case 57 /* EqualsToken */: return getReferenceCandidate(node.left); - case 24 /* CommaToken */: + case 25 /* CommaToken */: return getReferenceCandidate(node.right); } } return node; } + function getReferenceRoot(node) { + var parent = node.parent; + return parent.kind === 183 /* ParenthesizedExpression */ || + parent.kind === 192 /* BinaryExpression */ && parent.operatorToken.kind === 57 /* EqualsToken */ && parent.left === node || + parent.kind === 192 /* BinaryExpression */ && parent.operatorToken.kind === 25 /* CommaToken */ && parent.right === node ? + getReferenceRoot(parent) : node; + } function getTypeOfSwitchClause(clause) { - if (clause.kind === 249 /* CaseClause */) { - var caseType = checkExpression(clause.expression); + if (clause.kind === 253 /* CaseClause */) { + var caseType = getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); return isUnitType(caseType) ? caseType : undefined; } return neverType; @@ -24026,13 +32916,13 @@ var ts; return links.switchTypes; } function eachTypeContainedIn(source, types) { - return source.flags & 524288 /* Union */ ? !ts.forEach(source.types, function (t) { return !ts.contains(types, t); }) : ts.contains(types, source); + return source.flags & 65536 /* Union */ ? !ts.forEach(source.types, function (t) { return !ts.contains(types, t); }) : ts.contains(types, source); } function isTypeSubsetOf(source, target) { - return source === target || target.flags & 524288 /* Union */ && isTypeSubsetOfUnion(source, target); + return source === target || target.flags & 65536 /* Union */ && isTypeSubsetOfUnion(source, target); } function isTypeSubsetOfUnion(source, target) { - if (source.flags & 524288 /* Union */) { + if (source.flags & 65536 /* Union */) { for (var _i = 0, _a = source.types; _i < _a.length; _i++) { var t = _a[_i]; if (!containsType(target.types, t)) { @@ -24046,14 +32936,37 @@ var ts; } return containsType(target.types, source); } + function forEachType(type, f) { + return type.flags & 65536 /* Union */ ? ts.forEach(type.types, f) : f(type); + } function filterType(type, f) { - if (type.flags & 524288 /* Union */) { + if (type.flags & 65536 /* Union */) { var types = type.types; var filtered = ts.filter(types, f); return filtered === types ? type : getUnionTypeFromSortedList(filtered); } return f(type) ? type : neverType; } + function mapType(type, f) { + return type.flags & 65536 /* Union */ ? getUnionType(ts.map(type.types, f)) : f(type); + } + function extractTypesOfKind(type, kind) { + return filterType(type, function (t) { return (t.flags & kind) !== 0; }); + } + // Return a new type in which occurrences of the string and number primitive types in + // typeWithPrimitives have been replaced with occurrences of string literals and numeric + // literals in typeWithLiterals, respectively. + function replacePrimitivesWithLiterals(typeWithPrimitives, typeWithLiterals) { + if (isTypeSubsetOf(stringType, typeWithPrimitives) && maybeTypeOfKind(typeWithLiterals, 32 /* StringLiteral */) || + isTypeSubsetOf(numberType, typeWithPrimitives) && maybeTypeOfKind(typeWithLiterals, 64 /* NumberLiteral */)) { + return mapType(typeWithPrimitives, function (t) { + return t.flags & 2 /* String */ ? extractTypesOfKind(typeWithLiterals, 2 /* String */ | 32 /* StringLiteral */) : + t.flags & 4 /* Number */ ? extractTypesOfKind(typeWithLiterals, 4 /* Number */ | 64 /* NumberLiteral */) : + t; + }); + } + return typeWithPrimitives; + } function isIncomplete(flowType) { return flowType.flags === 0; } @@ -24063,22 +32976,122 @@ var ts; function createFlowType(type, incomplete) { return incomplete ? { flags: 0, type: type } : type; } + // An evolving array type tracks the element types that have so far been seen in an + // 'x.push(value)' or 'x[n] = value' operation along the control flow graph. Evolving + // array types are ultimately converted into manifest array types (using getFinalArrayType) + // and never escape the getFlowTypeOfReference function. + function createEvolvingArrayType(elementType) { + var result = createObjectType(256 /* EvolvingArray */); + result.elementType = elementType; + return result; + } + function getEvolvingArrayType(elementType) { + return evolvingArrayTypes[elementType.id] || (evolvingArrayTypes[elementType.id] = createEvolvingArrayType(elementType)); + } + // When adding evolving array element types we do not perform subtype reduction. Instead, + // we defer subtype reduction until the evolving array type is finalized into a manifest + // array type. + function addEvolvingArrayElementType(evolvingArrayType, node) { + var elementType = getBaseTypeOfLiteralType(getTypeOfExpression(node)); + return isTypeSubsetOf(elementType, evolvingArrayType.elementType) ? evolvingArrayType : getEvolvingArrayType(getUnionType([evolvingArrayType.elementType, elementType])); + } + function createFinalArrayType(elementType) { + return elementType.flags & 8192 /* Never */ ? + autoArrayType : + createArrayType(elementType.flags & 65536 /* Union */ ? + getUnionType(elementType.types, /*subtypeReduction*/ true) : + elementType); + } + // We perform subtype reduction upon obtaining the final array type from an evolving array type. + function getFinalArrayType(evolvingArrayType) { + return evolvingArrayType.finalArrayType || (evolvingArrayType.finalArrayType = createFinalArrayType(evolvingArrayType.elementType)); + } + function finalizeEvolvingArrayType(type) { + return getObjectFlags(type) & 256 /* EvolvingArray */ ? getFinalArrayType(type) : type; + } + function getElementTypeOfEvolvingArrayType(type) { + return getObjectFlags(type) & 256 /* EvolvingArray */ ? type.elementType : neverType; + } + function isEvolvingArrayTypeList(types) { + var hasEvolvingArrayType = false; + for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { + var t = types_12[_i]; + if (!(t.flags & 8192 /* Never */)) { + if (!(getObjectFlags(t) & 256 /* EvolvingArray */)) { + return false; + } + hasEvolvingArrayType = true; + } + } + return hasEvolvingArrayType; + } + // At flow control branch or loop junctions, if the type along every antecedent code path + // is an evolving array type, we construct a combined evolving array type. Otherwise we + // finalize all evolving array types. + function getUnionOrEvolvingArrayType(types, subtypeReduction) { + return isEvolvingArrayTypeList(types) ? + getEvolvingArrayType(getUnionType(ts.map(types, getElementTypeOfEvolvingArrayType))) : + getUnionType(ts.sameMap(types, finalizeEvolvingArrayType), subtypeReduction); + } + // Return true if the given node is 'x' in an 'x.length', x.push(value)', 'x.unshift(value)' or + // 'x[n] = value' operation, where 'n' is an expression of type any, undefined, or a number-like type. + function isEvolvingArrayOperationTarget(node) { + var root = getReferenceRoot(node); + var parent = root.parent; + var isLengthPushOrUnshift = parent.kind === 177 /* PropertyAccessExpression */ && (parent.name.text === "length" || + parent.parent.kind === 179 /* CallExpression */ && ts.isPushOrUnshiftIdentifier(parent.name)); + var isElementAssignment = parent.kind === 178 /* ElementAccessExpression */ && + parent.expression === root && + parent.parent.kind === 192 /* BinaryExpression */ && + parent.parent.operatorToken.kind === 57 /* EqualsToken */ && + parent.parent.left === parent && + !ts.isAssignmentTarget(parent.parent) && + isTypeAnyOrAllConstituentTypesHaveKind(getTypeOfExpression(parent.argumentExpression), 340 /* NumberLike */ | 2048 /* Undefined */); + return isLengthPushOrUnshift || isElementAssignment; + } + function maybeTypePredicateCall(node) { + var links = getNodeLinks(node); + if (links.maybeTypePredicate === undefined) { + links.maybeTypePredicate = getMaybeTypePredicate(node); + } + return links.maybeTypePredicate; + } + function getMaybeTypePredicate(node) { + if (node.expression.kind !== 96 /* SuperKeyword */) { + var funcType = checkNonNullExpression(node.expression); + if (funcType !== silentNeverType) { + var apparentType = getApparentType(funcType); + if (apparentType !== unknownType) { + var callSignatures = getSignaturesOfType(apparentType, 0 /* Call */); + return !!ts.forEach(callSignatures, function (sig) { return sig.typePredicate; }); + } + } + } + return false; + } function getFlowTypeOfReference(reference, declaredType, assumeInitialized, flowContainer) { var key; - if (!reference.flowNode || assumeInitialized && !(declaredType.flags & 4178943 /* Narrowable */)) { + if (!reference.flowNode || assumeInitialized && !(declaredType.flags & 1033215 /* Narrowable */)) { return declaredType; } - var initialType = assumeInitialized ? declaredType : includeFalsyTypes(declaredType, 2048 /* Undefined */); + var initialType = assumeInitialized ? declaredType : + declaredType === autoType || declaredType === autoArrayType ? undefinedType : + includeFalsyTypes(declaredType, 2048 /* Undefined */); var visitedFlowStart = visitedFlowCount; - var result = getTypeFromFlowType(getTypeAtFlowNode(reference.flowNode)); + var evolvedType = getTypeFromFlowType(getTypeAtFlowNode(reference.flowNode)); visitedFlowCount = visitedFlowStart; - if (reference.parent.kind === 196 /* NonNullExpression */ && getTypeWithFacts(result, 524288 /* NEUndefinedOrNull */) === neverType) { + // When the reference is 'x' in an 'x.length', 'x.push(value)', 'x.unshift(value)' or x[n] = value' operation, + // we give type 'any[]' to 'x' instead of using the type determined by control flow analysis such that operations + // on empty arrays are possible without implicit any errors and new element types can be inferred without + // type mismatch errors. + var resultType = getObjectFlags(evolvedType) & 256 /* EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? anyArrayType : finalizeEvolvingArrayType(evolvedType); + if (reference.parent.kind === 201 /* NonNullExpression */ && getTypeWithFacts(resultType, 524288 /* NEUndefinedOrNull */).flags & 8192 /* Never */) { return declaredType; } - return result; + return resultType; function getTypeAtFlowNode(flow) { while (true) { - if (flow.flags & 512 /* Shared */) { + if (flow.flags & 1024 /* Shared */) { // We cache results of flow type resolution for shared nodes that were previously visited in // the same getFlowTypeOfReference invocation. A node is considered shared when it is the // antecedent of more than one node. @@ -24111,10 +33124,17 @@ var ts; getTypeAtFlowBranchLabel(flow) : getTypeAtFlowLoopLabel(flow); } + else if (flow.flags & 256 /* ArrayMutation */) { + type = getTypeAtFlowArrayMutation(flow); + if (!type) { + flow = flow.antecedent; + continue; + } + } else if (flow.flags & 2 /* Start */) { // Check if we should continue with the control flow of the containing function. var container = flow.container; - if (container && container !== flowContainer && reference.kind !== 172 /* PropertyAccessExpression */) { + if (container && container !== flowContainer && reference.kind !== 177 /* PropertyAccessExpression */) { flow = container.flowNode; continue; } @@ -24123,10 +33143,10 @@ var ts; } else { // Unreachable code errors are reported in the binding phase. Here we - // simply return the declared type to reduce follow-on errors. - type = declaredType; + // simply return the non-auto declared type to reduce follow-on errors. + type = convertAutoToAny(declaredType); } - if (flow.flags & 512 /* Shared */) { + if (flow.flags & 1024 /* Shared */) { // Record visited node and the associated type in the cache. visitedFlowNodes[visitedFlowCount] = flow; visitedFlowTypes[visitedFlowCount] = type; @@ -24140,9 +33160,21 @@ var ts; // Assignments only narrow the computed type if the declared type is a union type. Thus, we // only need to evaluate the assigned type if the declared type is a union type. if (isMatchingReference(reference, node)) { - return declaredType.flags & 524288 /* Union */ ? - getAssignmentReducedType(declaredType, getInitialOrAssignedType(node)) : - declaredType; + if (ts.getAssignmentTargetKind(node) === 2 /* Compound */) { + var flowType = getTypeAtFlowNode(flow.antecedent); + return createFlowType(getBaseTypeOfLiteralType(getTypeFromFlowType(flowType)), isIncomplete(flowType)); + } + if (declaredType === autoType || declaredType === autoArrayType) { + if (isEmptyArrayAssignment(node)) { + return getEvolvingArrayType(neverType); + } + var assignedType = getBaseTypeOfLiteralType(getInitialOrAssignedType(node)); + return isTypeAssignableTo(assignedType, declaredType) ? assignedType : anyArrayType; + } + if (declaredType.flags & 65536 /* Union */) { + return getAssignmentReducedType(declaredType, getInitialOrAssignedType(node)); + } + return declaredType; } // We didn't have a direct match. However, if the reference is a dotted name, this // may be an assignment to a left hand part of the reference. For example, for a @@ -24154,23 +33186,56 @@ var ts; // Assignment doesn't affect reference return undefined; } + function getTypeAtFlowArrayMutation(flow) { + var node = flow.node; + var expr = node.kind === 179 /* CallExpression */ ? + node.expression.expression : + node.left.expression; + if (isMatchingReference(reference, getReferenceCandidate(expr))) { + var flowType = getTypeAtFlowNode(flow.antecedent); + var type = getTypeFromFlowType(flowType); + if (getObjectFlags(type) & 256 /* EvolvingArray */) { + var evolvedType_1 = type; + if (node.kind === 179 /* CallExpression */) { + for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { + var arg = _a[_i]; + evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg); + } + } + else { + var indexType = getTypeOfExpression(node.left.argumentExpression); + if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 340 /* NumberLike */ | 2048 /* Undefined */)) { + evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, node.right); + } + } + return evolvedType_1 === type ? flowType : createFlowType(evolvedType_1, isIncomplete(flowType)); + } + return flowType; + } + return undefined; + } function getTypeAtFlowCondition(flow) { var flowType = getTypeAtFlowNode(flow.antecedent); var type = getTypeFromFlowType(flowType); - if (type !== neverType) { - // If we have an antecedent type (meaning we're reachable in some way), we first - // attempt to narrow the antecedent type. If that produces the never type, and if - // the antecedent type is incomplete (i.e. a transient type in a loop), then we - // take the type guard as an indication that control *could* reach here once we - // have the complete type. We proceed by reverting to the declared type and then - // narrow that. - var assumeTrue = (flow.flags & 32 /* TrueCondition */) !== 0; - type = narrowType(type, flow.expression, assumeTrue); - if (type === neverType && isIncomplete(flowType)) { - type = narrowType(declaredType, flow.expression, assumeTrue); - } + if (type.flags & 8192 /* Never */) { + return flowType; } - return createFlowType(type, isIncomplete(flowType)); + // If we have an antecedent type (meaning we're reachable in some way), we first + // attempt to narrow the antecedent type. If that produces the never type, and if + // the antecedent type is incomplete (i.e. a transient type in a loop), then we + // take the type guard as an indication that control *could* reach here once we + // have the complete type. We proceed by switching to the silent never type which + // doesn't report errors when operators are applied to it. Note that this is the + // *only* place a silent never type is ever generated. + var assumeTrue = (flow.flags & 32 /* TrueCondition */) !== 0; + var nonEvolvingType = finalizeEvolvingArrayType(type); + var narrowedType = narrowType(nonEvolvingType, flow.expression, assumeTrue); + if (narrowedType === nonEvolvingType) { + return flowType; + } + var incomplete = isIncomplete(flowType); + var resultType = incomplete && narrowedType.flags & 8192 /* Never */ ? silentNeverType : narrowedType; + return createFlowType(resultType, incomplete); } function getTypeAtSwitchClause(flow) { var flowType = getTypeAtFlowNode(flow.antecedent); @@ -24212,7 +33277,7 @@ var ts; seenIncomplete = true; } } - return createFlowType(getUnionType(antecedentTypes, subtypeReduction), seenIncomplete); + return createFlowType(getUnionOrEvolvingArrayType(antecedentTypes, subtypeReduction), seenIncomplete); } function getTypeAtFlowLoopLabel(flow) { // If we have previously computed the control flow type for the reference at @@ -24227,11 +33292,15 @@ var ts; } // If this flow loop junction and reference are already being processed, return // the union of the types computed for each branch so far, marked as incomplete. - // We should never see an empty array here because the first antecedent of a loop - // junction is always the non-looping control flow path that leads to the top. + // It is possible to see an empty array in cases where loops are nested and the + // back edge of the outer loop reaches an inner loop that is already being analyzed. + // In such cases we restart the analysis of the inner loop, which will then see + // a non-empty in-process array for the outer loop and eventually terminate because + // the first antecedent of a loop junction is always the non-looping control flow + // path that leads to the top. for (var i = flowLoopStart; i < flowLoopCount; i++) { - if (flowLoopNodes[i] === flow && flowLoopKeys[i] === key) { - return createFlowType(getUnionType(flowLoopTypes[i]), /*incomplete*/ true); + if (flowLoopNodes[i] === flow && flowLoopKeys[i] === key && flowLoopTypes[i].length) { + return createFlowType(getUnionOrEvolvingArrayType(flowLoopTypes[i], /*subtypeReduction*/ false), /*incomplete*/ true); } } // Add the flow loop junction and reference to the in-process stack and analyze @@ -24275,15 +33344,15 @@ var ts; } // The result is incomplete if the first antecedent (the non-looping control flow path) // is incomplete. - var result = getUnionType(antecedentTypes, subtypeReduction); + var result = getUnionOrEvolvingArrayType(antecedentTypes, subtypeReduction); if (isIncomplete(firstAntecedentType)) { return createFlowType(result, /*incomplete*/ true); } return cache[key] = result; } function isMatchingReferenceDiscriminant(expr) { - return expr.kind === 172 /* PropertyAccessExpression */ && - declaredType.flags & 524288 /* Union */ && + return expr.kind === 177 /* PropertyAccessExpression */ && + declaredType.flags & 65536 /* Union */ && isMatchingReference(reference, expr.expression) && isDiscriminantProperty(declaredType, expr.name.text); } @@ -24307,19 +33376,19 @@ var ts; } function narrowTypeByBinaryExpression(type, expr, assumeTrue) { switch (expr.operatorToken.kind) { - case 56 /* EqualsToken */: + case 57 /* EqualsToken */: return narrowTypeByTruthiness(type, expr.left, assumeTrue); - case 30 /* EqualsEqualsToken */: - case 31 /* ExclamationEqualsToken */: - case 32 /* EqualsEqualsEqualsToken */: - case 33 /* ExclamationEqualsEqualsToken */: + case 31 /* EqualsEqualsToken */: + case 32 /* ExclamationEqualsToken */: + case 33 /* EqualsEqualsEqualsToken */: + case 34 /* ExclamationEqualsEqualsToken */: var operator_1 = expr.operatorToken.kind; var left_1 = getReferenceCandidate(expr.left); var right_1 = getReferenceCandidate(expr.right); - if (left_1.kind === 182 /* TypeOfExpression */ && right_1.kind === 9 /* StringLiteral */) { + if (left_1.kind === 187 /* TypeOfExpression */ && right_1.kind === 9 /* StringLiteral */) { return narrowTypeByTypeof(type, left_1, operator_1, right_1, assumeTrue); } - if (right_1.kind === 182 /* TypeOfExpression */ && left_1.kind === 9 /* StringLiteral */) { + if (right_1.kind === 187 /* TypeOfExpression */ && left_1.kind === 9 /* StringLiteral */) { return narrowTypeByTypeof(type, right_1, operator_1, left_1, assumeTrue); } if (isMatchingReference(reference, left_1)) { @@ -24338,9 +33407,9 @@ var ts; return declaredType; } break; - case 91 /* InstanceOfKeyword */: + case 92 /* InstanceOfKeyword */: return narrowTypeByInstanceof(type, expr, assumeTrue); - case 24 /* CommaToken */: + case 25 /* CommaToken */: return narrowType(type, expr.right, assumeTrue); } return type; @@ -24349,30 +33418,34 @@ var ts; if (type.flags & 1 /* Any */) { return type; } - if (operator === 31 /* ExclamationEqualsToken */ || operator === 33 /* ExclamationEqualsEqualsToken */) { + 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; } - var doubleEquals = operator === 30 /* EqualsEqualsToken */ || operator === 31 /* ExclamationEqualsToken */; + var doubleEquals = operator === 31 /* EqualsEqualsToken */ || operator === 32 /* ExclamationEqualsToken */; var facts = doubleEquals ? assumeTrue ? 65536 /* EQUndefinedOrNull */ : 524288 /* NEUndefinedOrNull */ : - value.kind === 93 /* NullKeyword */ ? + value.kind === 94 /* NullKeyword */ ? assumeTrue ? 32768 /* EQNull */ : 262144 /* NENull */ : assumeTrue ? 16384 /* EQUndefined */ : 131072 /* NEUndefined */; return getTypeWithFacts(type, facts); } - if (type.flags & 2589191 /* NotUnionOrUnit */) { + if (type.flags & 33281 /* NotUnionOrUnit */) { return type; } if (assumeTrue) { var narrowedType = filterType(type, function (t) { return areTypesComparable(t, valueType); }); - return narrowedType !== neverType ? narrowedType : type; + return narrowedType.flags & 8192 /* Never */ ? type : replacePrimitivesWithLiterals(narrowedType, valueType); } - return isUnitType(valueType) ? filterType(type, function (t) { return t !== valueType; }) : type; + if (isUnitType(valueType)) { + var regularType_1 = getRegularTypeOfLiteralType(valueType); + return filterType(type, function (t) { return getRegularTypeOfLiteralType(t) !== regularType_1; }); + } + return type; } function narrowTypeByTypeof(type, typeOfExpr, operator, literal, assumeTrue) { // We have '==', '!=', '====', or !==' operator with 'typeof xxx' and string literal operands @@ -24385,10 +33458,10 @@ var ts; } return type; } - if (operator === 31 /* ExclamationEqualsToken */ || operator === 33 /* ExclamationEqualsEqualsToken */) { + if (operator === 32 /* ExclamationEqualsToken */ || operator === 34 /* ExclamationEqualsEqualsToken */) { assumeTrue = !assumeTrue; } - if (assumeTrue && !(type.flags & 524288 /* Union */)) { + if (assumeTrue && !(type.flags & 65536 /* Union */)) { // We narrow a non-union type to an exact primitive type if the non-union type // is a supertype of that primitive type. For example, type 'any' can be narrowed // to one of the primitive types. @@ -24411,12 +33484,13 @@ var ts; var clauseTypes = switchTypes.slice(clauseStart, clauseEnd); var hasDefaultClause = clauseStart === clauseEnd || ts.contains(clauseTypes, neverType); var discriminantType = getUnionType(clauseTypes); - var caseType = discriminantType === neverType ? neverType : filterType(type, function (t) { return isTypeComparableTo(discriminantType, t); }); + var caseType = discriminantType.flags & 8192 /* Never */ ? neverType : + replacePrimitivesWithLiterals(filterType(type, function (t) { return isTypeComparableTo(discriminantType, t); }), discriminantType); if (!hasDefaultClause) { return caseType; } - var defaultType = filterType(type, function (t) { return !(isUnitType(t) && ts.contains(switchTypes, t)); }); - return caseType === neverType ? defaultType : getUnionType([caseType, defaultType]); + var defaultType = filterType(type, function (t) { return !(isUnitType(t) && ts.contains(switchTypes, getRegularTypeOfLiteralType(t))); }); + return caseType.flags & 8192 /* Never */ ? defaultType : getUnionType([caseType, defaultType]); } function narrowTypeByInstanceof(type, expr, assumeTrue) { var left = getReferenceCandidate(expr.left); @@ -24429,7 +33503,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; } @@ -24449,10 +33523,10 @@ var ts; if (!targetType) { // Target type is type of construct signature var constructSignatures = void 0; - if (rightType.flags & 65536 /* Interface */) { + if (getObjectFlags(rightType) & 2 /* Interface */) { constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures; } - else if (rightType.flags & 2097152 /* Anonymous */) { + else if (getObjectFlags(rightType) & 16 /* Anonymous */) { constructSignatures = getSignaturesOfType(rightType, 1 /* Construct */); } if (constructSignatures && constructSignatures.length) { @@ -24460,19 +33534,19 @@ 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 & 524288 /* Union */) { - var assignableType = filterType(type, function (t) { return isTypeInstanceOf(t, candidate); }); - if (assignableType !== neverType) { + if (type.flags & 65536 /* Union */) { + var assignableType = filterType(type, function (t) { return isRelated(t, candidate); }); + if (!(assignableType.flags & 8192 /* Never */)) { return assignableType; } } @@ -24488,7 +33562,7 @@ var ts; getIntersectionType([type, candidate]); } function narrowTypeByTypePredicate(type, callExpression, assumeTrue) { - if (!hasMatchingArgument(callExpression, reference)) { + if (!hasMatchingArgument(callExpression, reference) || !maybeTypePredicateCall(callExpression)) { return type; } var signature = getResolvedSignature(callExpression); @@ -24504,7 +33578,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; @@ -24512,12 +33586,12 @@ var ts; } } else { - var invokedExpression = skipParenthesizedNodes(callExpression.expression); - if (invokedExpression.kind === 173 /* ElementAccessExpression */ || invokedExpression.kind === 172 /* PropertyAccessExpression */) { + var invokedExpression = ts.skipParentheses(callExpression.expression); + if (invokedExpression.kind === 178 /* ElementAccessExpression */ || invokedExpression.kind === 177 /* PropertyAccessExpression */) { var accessExpression = invokedExpression; - var possibleReference = skipParenthesizedNodes(accessExpression.expression); + 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; @@ -24530,18 +33604,18 @@ var ts; // will be a subtype or the same type as the argument. function narrowType(type, expr, assumeTrue) { switch (expr.kind) { - case 69 /* Identifier */: - case 97 /* ThisKeyword */: - case 172 /* PropertyAccessExpression */: + case 70 /* Identifier */: + case 98 /* ThisKeyword */: + case 177 /* PropertyAccessExpression */: return narrowTypeByTruthiness(type, expr, assumeTrue); - case 174 /* CallExpression */: + case 179 /* CallExpression */: return narrowTypeByTypePredicate(type, expr, assumeTrue); - case 178 /* ParenthesizedExpression */: + case 183 /* ParenthesizedExpression */: return narrowType(type, expr.expression, assumeTrue); - case 187 /* BinaryExpression */: + case 192 /* BinaryExpression */: return narrowTypeByBinaryExpression(type, expr, assumeTrue); - case 185 /* PrefixUnaryExpression */: - if (expr.operator === 49 /* ExclamationToken */) { + case 190 /* PrefixUnaryExpression */: + if (expr.operator === 50 /* ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } break; @@ -24554,12 +33628,12 @@ var ts; // an dotted name expression, and if the location is not an assignment target, obtain the type // of the expression (which will reflect control flow analysis). If the expression indeed // resolved to the given symbol, return the narrowed type. - if (location.kind === 69 /* Identifier */) { + if (location.kind === 70 /* Identifier */) { if (ts.isRightSideOfQualifiedNameOrPropertyAccess(location)) { location = location.parent; } - if (ts.isExpression(location) && !ts.isAssignmentTarget(location)) { - var type = checkExpression(location); + if (ts.isPartOfExpression(location) && !ts.isAssignmentTarget(location)) { + var type = getTypeOfExpression(location); if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) { return type; } @@ -24568,23 +33642,17 @@ var ts; // The location isn't a reference to the given symbol, meaning we're being asked // a hypothetical question of what type the symbol would have if there was a reference // to it at the given location. Since we have no control flow information for the - // hypotherical reference (control flow information is created and attached by the + // hypothetical reference (control flow information is created and attached by the // binder), we simply return the declared type of the symbol. return getTypeOfSymbol(symbol); } - function skipParenthesizedNodes(expression) { - while (expression.kind === 178 /* ParenthesizedExpression */) { - expression = expression.expression; - } - return expression; - } function getControlFlowContainer(node) { while (true) { node = node.parent; if (ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 226 /* ModuleBlock */ || - node.kind === 256 /* SourceFile */ || - node.kind === 145 /* PropertyDeclaration */) { + node.kind === 231 /* ModuleBlock */ || + node.kind === 261 /* SourceFile */ || + node.kind === 147 /* PropertyDeclaration */) { return node; } } @@ -24613,10 +33681,10 @@ var ts; } } function markParameterAssignments(node) { - if (node.kind === 69 /* Identifier */) { + if (node.kind === 70 /* Identifier */) { if (ts.isAssignmentTarget(node)) { var symbol = getResolvedSymbol(node); - if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 142 /* Parameter */) { + if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 144 /* Parameter */) { symbol.isAssigned = true; } } @@ -24625,8 +33693,14 @@ var ts; ts.forEachChild(node, markParameterAssignments); } } + function isConstVariable(symbol) { + return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 2 /* Const */) !== 0 && getTypeOfSymbol(symbol) !== autoArrayType; + } function checkIdentifier(node) { var symbol = getResolvedSymbol(node); + if (symbol === unknownSymbol) { + return unknownType; + } // As noted in ECMAScript 6 language spec, arrow functions never have an arguments objects. // Although in down-level emit of arrow function, we emit it using function expression which means that // arguments objects will be bound to the inner object; emitting arrow function natively in ES6, arguments objects @@ -24635,34 +33709,55 @@ var ts; // can explicitly bound arguments objects if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); - if (container.kind === 180 /* ArrowFunction */) { - if (languageVersion < 2 /* ES6 */) { + if (languageVersion < 2 /* ES2015 */) { + if (container.kind === 185 /* ArrowFunction */) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } + else if (ts.hasModifier(container, 256 /* Async */)) { + error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method); + } } - if (node.flags & 33554432 /* AwaitContext */) { + if (node.flags & 16384 /* AwaitContext */) { getNodeLinks(container).flags |= 8192 /* CaptureArguments */; } + return getTypeOfSymbol(symbol); } if (symbol.flags & 8388608 /* Alias */ && !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol))) { markAliasSymbolAsReferenced(symbol); } var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); - // Due to the emit for class decorators, any reference to the class from inside of the class body - // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind - // behavior of class names in ES6. - if (languageVersion === 2 /* ES6 */ - && localOrExportSymbol.flags & 32 /* Class */ - && localOrExportSymbol.valueDeclaration.kind === 221 /* ClassDeclaration */ - && ts.nodeIsDecorated(localOrExportSymbol.valueDeclaration)) { - var container = ts.getContainingClass(node); - while (container !== undefined) { - if (container === localOrExportSymbol.valueDeclaration && container.name !== node) { - getNodeLinks(container).flags |= 524288 /* ClassWithBodyScopedClassBinding */; - getNodeLinks(node).flags |= 1048576 /* BodyScopedClassBinding */; - break; + if (localOrExportSymbol.flags & 32 /* Class */) { + var declaration_1 = localOrExportSymbol.valueDeclaration; + // Due to the emit for class decorators, any reference to the class from inside of the class body + // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind + // behavior of class names in ES6. + if (declaration_1.kind === 226 /* ClassDeclaration */ + && ts.nodeIsDecorated(declaration_1)) { + var container = ts.getContainingClass(node); + while (container !== undefined) { + if (container === declaration_1 && container.name !== node) { + getNodeLinks(declaration_1).flags |= 8388608 /* ClassWithConstructorReference */; + getNodeLinks(node).flags |= 16777216 /* ConstructorReferenceInClass */; + break; + } + container = ts.getContainingClass(container); + } + } + else if (declaration_1.kind === 197 /* ClassExpression */) { + // When we emit a class expression with static members that contain a reference + // to the constructor in the initializer, we will need to substitute that + // binding with an alias as the class name is not in scope. + var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); + while (container !== undefined) { + if (container.parent === declaration_1) { + if (container.kind === 147 /* PropertyDeclaration */ && ts.hasModifier(container, 32 /* Static */)) { + getNodeLinks(declaration_1).flags |= 8388608 /* ClassWithConstructorReference */; + getNodeLinks(node).flags |= 16777216 /* ConstructorReferenceInClass */; + } + break; + } + container = ts.getThisContainer(container, /*includeArrowFunctions*/ false); } - container = ts.getContainingClass(container); } } checkCollisionWithCapturedSuperVariable(node, node); @@ -24670,41 +33765,62 @@ var ts; checkNestedBlockScopedBinding(node, symbol); var type = getTypeOfSymbol(localOrExportSymbol); var declaration = localOrExportSymbol.valueDeclaration; + var assignmentKind = ts.getAssignmentTargetKind(node); + if (assignmentKind) { + if (!(localOrExportSymbol.flags & 3 /* Variable */)) { + error(node, ts.Diagnostics.Cannot_assign_to_0_because_it_is_not_a_variable, symbolToString(symbol)); + return unknownType; + } + if (isReadonlySymbol(localOrExportSymbol)) { + error(node, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, symbolToString(symbol)); + return unknownType; + } + } // We only narrow variables and parameters occurring in a non-assignment position. For all other // entities we simply return the declared type. - if (!(localOrExportSymbol.flags & 3 /* Variable */) || ts.isAssignmentTarget(node) || !declaration) { + if (!(localOrExportSymbol.flags & 3 /* Variable */) || assignmentKind === 1 /* Definite */ || !declaration) { return type; } // The declaration container is the innermost function that encloses the declaration of the variable // or parameter. The flow container is the innermost function starting with which we analyze the control // flow graph to determine the control flow based type. - var isParameter = ts.getRootDeclaration(declaration).kind === 142 /* Parameter */; + var isParameter = ts.getRootDeclaration(declaration).kind === 144 /* Parameter */; var declarationContainer = getControlFlowContainer(declaration); var flowContainer = getControlFlowContainer(node); var isOuterVariable = flowContainer !== declarationContainer; // When the control flow originates in a function expression or arrow function and we are referencing // a const variable or parameter from an outer function, we extend the origin of the control flow // analysis to include the immediately enclosing function. - while (flowContainer !== declarationContainer && - (flowContainer.kind === 179 /* FunctionExpression */ || flowContainer.kind === 180 /* ArrowFunction */) && - (isReadonlySymbol(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) { + while (flowContainer !== declarationContainer && (flowContainer.kind === 184 /* FunctionExpression */ || + flowContainer.kind === 185 /* ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) && + (isConstVariable(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } // We only look for uninitialized variables in strict null checking mode, and only when we can analyze // the entire control flow graph from the variable's declaration (i.e. when the flow container and // declaration container are the same). - var assumeInitialized = !strictNullChecks || (type.flags & 1 /* Any */) !== 0 || isParameter || - isOuterVariable || ts.isInAmbientContext(declaration); + var assumeInitialized = isParameter || isOuterVariable || + type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 1 /* Any */) !== 0) || + ts.isInAmbientContext(declaration); var flowType = getFlowTypeOfReference(node, type, assumeInitialized, flowContainer); // A variable is considered uninitialized when it is possible to analyze the entire control flow graph // from declaration to use, and when the variable's declared type doesn't include undefined but the // control flow based type does include undefined. - if (!assumeInitialized && !(getFalsyFlags(type) & 2048 /* Undefined */) && getFalsyFlags(flowType) & 2048 /* Undefined */) { + if (type === autoType || type === autoArrayType) { + if (flowType === autoType || flowType === autoArrayType) { + if (compilerOptions.noImplicitAny) { + error(declaration.name, ts.Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined, symbolToString(symbol), typeToString(flowType)); + error(node, ts.Diagnostics.Variable_0_implicitly_has_an_1_type, symbolToString(symbol), typeToString(flowType)); + } + return convertAutoToAny(flowType); + } + } + else if (!assumeInitialized && !(getFalsyFlags(type) & 2048 /* Undefined */) && getFalsyFlags(flowType) & 2048 /* Undefined */) { error(node, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol)); // Return the declared type to reduce follow-on errors return type; } - return flowType; + return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType; } function isInsideFunction(node, threshold) { var current = node; @@ -24717,9 +33833,9 @@ var ts; return false; } function checkNestedBlockScopedBinding(node, symbol) { - if (languageVersion >= 2 /* ES6 */ || + if (languageVersion >= 2 /* ES2015 */ || (symbol.flags & (2 /* BlockScopedVariable */ | 32 /* Class */)) === 0 || - symbol.valueDeclaration.parent.kind === 252 /* CatchClause */) { + symbol.valueDeclaration.parent.kind === 256 /* CatchClause */) { return; } // 1. walk from the use site up to the declaration and check @@ -24744,8 +33860,8 @@ var ts; } // mark variables that are declared in loop initializer and reassigned inside the body of ForStatement. // if body of ForStatement will be converted to function then we'll need a extra machinery to propagate reassigned values back. - if (container.kind === 206 /* ForStatement */ && - ts.getAncestor(symbol.valueDeclaration, 219 /* VariableDeclarationList */).parent === container && + if (container.kind === 211 /* ForStatement */ && + ts.getAncestor(symbol.valueDeclaration, 224 /* VariableDeclarationList */).parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 2097152 /* NeedsLoopOutParameter */; } @@ -24759,7 +33875,7 @@ var ts; function isAssignedInBodyOfForStatement(node, container) { var current = node; // skip parenthesized nodes - while (current.parent.kind === 178 /* ParenthesizedExpression */) { + while (current.parent.kind === 183 /* ParenthesizedExpression */) { current = current.parent; } // check if node is used as LHS in some assignment expression @@ -24767,9 +33883,9 @@ var ts; if (ts.isAssignmentTarget(current)) { isAssigned = true; } - else if ((current.parent.kind === 185 /* PrefixUnaryExpression */ || current.parent.kind === 186 /* PostfixUnaryExpression */)) { + else if ((current.parent.kind === 190 /* PrefixUnaryExpression */ || current.parent.kind === 191 /* PostfixUnaryExpression */)) { var expr = current.parent; - isAssigned = expr.operator === 41 /* PlusPlusToken */ || expr.operator === 42 /* MinusMinusToken */; + isAssigned = expr.operator === 42 /* PlusPlusToken */ || expr.operator === 43 /* MinusMinusToken */; } if (!isAssigned) { return false; @@ -24788,7 +33904,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2 /* LexicalThis */; - if (container.kind === 145 /* PropertyDeclaration */ || container.kind === 148 /* Constructor */) { + if (container.kind === 147 /* PropertyDeclaration */ || container.kind === 150 /* Constructor */) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4 /* CaptureThis */; } @@ -24797,7 +33913,7 @@ var ts; } } function findFirstSuperCall(n) { - if (ts.isSuperCallExpression(n)) { + if (ts.isSuperCall(n)) { return n; } else if (ts.isFunctionLike(n)) { @@ -24831,58 +33947,61 @@ var ts; var baseConstructorType = getBaseConstructorTypeOfClass(classInstanceType); return baseConstructorType === nullWideningType; } + function checkThisBeforeSuper(node, container, diagnosticMessage) { + var containingClassDecl = container.parent; + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl); + // If a containing class does not have extends clause or the class extends null + // skip checking whether super statement is called before "this" accessing. + if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { + var superCall = getSuperCallInConstructor(container); + // We should give an error in the following cases: + // - No super-call + // - "this" is accessing before super-call. + // i.e super(this) + // this.x; super(); + // We want to make sure that super-call is done before accessing "this" so that + // "this" is not accessed as a parameter of the super-call. + if (!superCall || superCall.end > node.pos) { + // In ES6, super inside constructor of class-declaration has to precede "this" accessing + error(node, diagnosticMessage); + } + } + } function checkThisExpression(node) { // Stop at the first arrow function so that we can // tell whether 'this' needs to be captured. var container = ts.getThisContainer(node, /* includeArrowFunctions */ true); var needToCaptureLexicalThis = false; - if (container.kind === 148 /* Constructor */) { - var containingClassDecl = container.parent; - var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl); - // If a containing class does not have extends clause or the class extends null - // skip checking whether super statement is called before "this" accessing. - if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { - var superCall = getSuperCallInConstructor(container); - // We should give an error in the following cases: - // - No super-call - // - "this" is accessing before super-call. - // i.e super(this) - // this.x; super(); - // We want to make sure that super-call is done before accessing "this" so that - // "this" is not accessed as a parameter of the super-call. - if (!superCall || superCall.end > node.pos) { - // In ES6, super inside constructor of class-declaration has to precede "this" accessing - error(node, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); - } - } + if (container.kind === 150 /* Constructor */) { + checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } // Now skip arrow functions to get the "real" owner of 'this'. - if (container.kind === 180 /* ArrowFunction */) { + if (container.kind === 185 /* ArrowFunction */) { container = ts.getThisContainer(container, /* includeArrowFunctions */ false); // When targeting es6, arrow function lexically bind "this" so we do not need to do the work of binding "this" in emitted code - needToCaptureLexicalThis = (languageVersion < 2 /* ES6 */); + needToCaptureLexicalThis = (languageVersion < 2 /* ES2015 */); } switch (container.kind) { - case 225 /* ModuleDeclaration */: + case 230 /* ModuleDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 224 /* EnumDeclaration */: + case 229 /* EnumDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 148 /* Constructor */: + case 150 /* Constructor */: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; - case 145 /* PropertyDeclaration */: - case 144 /* PropertySignature */: - if (container.flags & 32 /* Static */) { + case 147 /* PropertyDeclaration */: + case 146 /* PropertySignature */: + if (ts.getModifierFlags(container) & 32 /* Static */) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 140 /* ComputedPropertyName */: + case 142 /* ComputedPropertyName */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -24890,11 +34009,11 @@ var ts; captureLexicalThis(node, container); } if (ts.isFunctionLike(container) && - (!isInParameterInitializerBeforeContainingFunction(node) || getFunctionLikeThisParameter(container))) { + (!isInParameterInitializerBeforeContainingFunction(node) || ts.getThisParameter(container))) { // Note: a parameter initializer should refer to class-this unless function-this is explicitly annotated. // If this is a function in a JS file, it might be a class method. Check if it's the RHS // of a x.prototype.y = function [name]() { .... } - if (container.kind === 179 /* FunctionExpression */ && + if (container.kind === 184 /* FunctionExpression */ && ts.isInJavaScriptFile(container.parent) && ts.getSpecialPropertyAssignmentKind(container.parent) === 3 /* PrototypeProperty */) { // Get the 'x' of 'x.prototype.y = f' (here, 'f' is 'container') @@ -24907,14 +34026,14 @@ var ts; return getInferredClassType(classSymbol); } } - var thisType = getThisTypeOfDeclaration(container); + var thisType = getThisTypeOfDeclaration(container) || getContextualThisParameterType(container); if (thisType) { return thisType; } } if (ts.isClassLike(container.parent)) { var symbol = getSymbolOfNode(container.parent); - var type = container.flags & 32 /* Static */ ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; + var type = ts.hasModifier(container, 32 /* Static */) ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; return getFlowTypeOfReference(node, type, /*assumeInitialized*/ true, /*flowContainer*/ undefined); } if (ts.isInJavaScriptFile(node)) { @@ -24930,31 +34049,31 @@ var ts; return anyType; } function getTypeForThisExpressionFromJSDoc(node) { - var typeTag = ts.getJSDocTypeTag(node); - if (typeTag && typeTag.typeExpression && typeTag.typeExpression.type && typeTag.typeExpression.type.kind === 269 /* JSDocFunctionType */) { - var jsDocFunctionType = typeTag.typeExpression.type; - if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 272 /* JSDocThisType */) { + 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); } } } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 142 /* Parameter */) { + if (n.kind === 144 /* Parameter */) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 174 /* CallExpression */ && node.parent.expression === node; + var isCallExpression = node.parent.kind === 179 /* CallExpression */ && node.parent.expression === node; var container = ts.getSuperContainer(node, /*stopOnFunctions*/ true); var needToCaptureLexicalThis = false; + // adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting if (!isCallExpression) { - // adjust the container reference in case if super is used inside arrow functions with arbitrary deep nesting - while (container && container.kind === 180 /* ArrowFunction */) { + while (container && container.kind === 185 /* ArrowFunction */) { container = ts.getSuperContainer(container, /*stopOnFunctions*/ true); - needToCaptureLexicalThis = languageVersion < 2 /* ES6 */; + needToCaptureLexicalThis = languageVersion < 2 /* ES2015 */; } } var canUseSuperExpression = isLegalUsageOfSuperExpression(container); @@ -24966,16 +34085,16 @@ var ts; // [super.foo()]() {} // } var current = node; - while (current && current !== container && current.kind !== 140 /* ComputedPropertyName */) { + while (current && current !== container && current.kind !== 142 /* ComputedPropertyName */) { current = current.parent; } - if (current && current.kind === 140 /* ComputedPropertyName */) { + if (current && current.kind === 142 /* ComputedPropertyName */) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); } - else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 171 /* ObjectLiteralExpression */)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 176 /* ObjectLiteralExpression */)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -24983,7 +34102,10 @@ var ts; } return unknownType; } - if ((container.flags & 32 /* Static */) || isCallExpression) { + if (!isCallExpression && container.kind === 150 /* Constructor */) { + checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); + } + if ((ts.getModifierFlags(container) & 32 /* Static */) || isCallExpression) { nodeCheckFlag = 512 /* SuperStatic */; } else { @@ -25046,8 +34168,8 @@ var ts; // This helper creates an object with a "value" property that wraps the `super` property or indexed access for both get and set. // This is required for destructuring assignments, as a call expression cannot be used as the target of a destructuring assignment // while a property access can. - if (container.kind === 147 /* MethodDeclaration */ && container.flags & 256 /* Async */) { - if (ts.isSuperPropertyOrElementAccess(node.parent) && ts.isAssignmentTarget(node.parent)) { + if (container.kind === 149 /* MethodDeclaration */ && ts.getModifierFlags(container) & 256 /* Async */) { + if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) { getNodeLinks(container).flags |= 4096 /* AsyncMethodWithSuperBinding */; } else { @@ -25060,8 +34182,8 @@ var ts; // in this case they should also use correct lexical this captureLexicalThis(node.parent, container); } - if (container.parent.kind === 171 /* ObjectLiteralExpression */) { - if (languageVersion < 2 /* ES6 */) { + if (container.parent.kind === 176 /* ObjectLiteralExpression */) { + if (languageVersion < 2 /* ES2015 */) { error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return unknownType; } @@ -25080,7 +34202,7 @@ var ts; } return unknownType; } - if (container.kind === 148 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 150 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { // issue custom error message for super property access in constructor arguments (to be aligned with old compiler) error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return unknownType; @@ -25095,7 +34217,7 @@ var ts; if (isCallExpression) { // TS 1.0 SPEC (April 2014): 4.8.1 // Super calls are only permitted in constructors of derived classes - return container.kind === 148 /* Constructor */; + return container.kind === 150 /* Constructor */; } else { // TS 1.0 SPEC (April 2014) @@ -25103,32 +34225,35 @@ var ts; // - In a constructor, instance member function, instance member accessor, or instance member variable initializer where this references a derived class instance // - In a static member function or static member accessor // topmost container must be something that is directly nested in the class declaration\object literal expression - if (ts.isClassLike(container.parent) || container.parent.kind === 171 /* ObjectLiteralExpression */) { - if (container.flags & 32 /* Static */) { - return container.kind === 147 /* MethodDeclaration */ || - container.kind === 146 /* MethodSignature */ || - container.kind === 149 /* GetAccessor */ || - container.kind === 150 /* SetAccessor */; + if (ts.isClassLike(container.parent) || container.parent.kind === 176 /* ObjectLiteralExpression */) { + if (ts.getModifierFlags(container) & 32 /* Static */) { + return container.kind === 149 /* MethodDeclaration */ || + container.kind === 148 /* MethodSignature */ || + container.kind === 151 /* GetAccessor */ || + container.kind === 152 /* SetAccessor */; } else { - return container.kind === 147 /* MethodDeclaration */ || - container.kind === 146 /* MethodSignature */ || - container.kind === 149 /* GetAccessor */ || - container.kind === 150 /* SetAccessor */ || - container.kind === 145 /* PropertyDeclaration */ || - container.kind === 144 /* PropertySignature */ || - container.kind === 148 /* Constructor */; + return container.kind === 149 /* MethodDeclaration */ || + container.kind === 148 /* MethodSignature */ || + container.kind === 151 /* GetAccessor */ || + container.kind === 152 /* SetAccessor */ || + container.kind === 147 /* PropertyDeclaration */ || + container.kind === 146 /* PropertySignature */ || + container.kind === 150 /* Constructor */; } } } return false; } } - function getContextualThisParameter(func) { - if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== 180 /* ArrowFunction */) { + function getContextualThisParameterType(func) { + if (isContextSensitiveFunctionOrObjectLiteralMethod(func) && func.kind !== 185 /* ArrowFunction */) { var contextualSignature = getContextualSignature(func); if (contextualSignature) { - return contextualSignature.thisParameter; + var thisParameter = contextualSignature.thisParameter; + if (thisParameter) { + return getTypeOfSymbol(thisParameter); + } } } return undefined; @@ -25144,14 +34269,14 @@ var ts; if (parameter.dotDotDotToken) { var restTypes = []; for (var i = indexOfParameter; i < iife.arguments.length; i++) { - restTypes.push(getTypeOfExpression(iife.arguments[i])); + restTypes.push(getWidenedLiteralType(checkExpression(iife.arguments[i]))); } return createArrayType(getUnionType(restTypes)); } var links = getNodeLinks(iife); var cached = links.resolvedSignature; links.resolvedSignature = anySignature; - var type = checkExpression(iife.arguments[indexOfParameter]); + var type = getWidenedLiteralType(checkExpression(iife.arguments[indexOfParameter])); links.resolvedSignature = cached; return type; } @@ -25188,7 +34313,7 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 142 /* Parameter */) { + if (declaration.kind === 144 /* Parameter */) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -25199,11 +34324,11 @@ var ts; } if (ts.isBindingPattern(declaration.parent)) { var parentDeclaration = declaration.parent.parent; - var name_12 = declaration.propertyName || declaration.name; + var name_19 = declaration.propertyName || declaration.name; if (ts.isVariableLike(parentDeclaration) && parentDeclaration.type && - !ts.isBindingPattern(name_12)) { - var text = getTextOfPropertyName(name_12); + !ts.isBindingPattern(name_19)) { + var text = ts.getTextOfPropertyName(name_19); if (text) { return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text); } @@ -25240,7 +34365,7 @@ var ts; } function isInParameterInitializerBeforeContainingFunction(node) { while (node.parent && !ts.isFunctionLike(node.parent)) { - if (node.parent.kind === 142 /* Parameter */ && node.parent.initializer === node) { + if (node.parent.kind === 144 /* Parameter */ && node.parent.initializer === node) { return true; } node = node.parent; @@ -25251,8 +34376,8 @@ var ts; // If the containing function has a return type annotation, is a constructor, or is a get accessor whose // corresponding set accessor has a type annotation, return statements in the function are contextually typed if (functionDecl.type || - functionDecl.kind === 148 /* Constructor */ || - functionDecl.kind === 149 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 150 /* SetAccessor */))) { + functionDecl.kind === 150 /* Constructor */ || + functionDecl.kind === 151 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 152 /* SetAccessor */))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl)); } // Otherwise, if the containing function is contextually typed by a function type with exactly one call signature @@ -25274,7 +34399,7 @@ var ts; return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 176 /* TaggedTemplateExpression */) { + if (template.parent.kind === 181 /* TaggedTemplateExpression */) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -25282,26 +34407,26 @@ var ts; function getContextualTypeForBinaryOperand(node) { var binaryExpression = node.parent; var operator = binaryExpression.operatorToken.kind; - if (operator >= 56 /* FirstAssignment */ && operator <= 68 /* LastAssignment */) { + if (operator >= 57 /* FirstAssignment */ && operator <= 69 /* LastAssignment */) { // Don't do this for special property assignments to avoid circularity if (ts.getSpecialPropertyAssignmentKind(binaryExpression) !== 0 /* None */) { return undefined; } // 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 === 52 /* BarBarToken */) { + else if (operator === 53 /* BarBarToken */) { // When an || expression has a contextual type, the operands are contextually typed by that type. When an || // 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; } - else if (operator === 51 /* AmpersandAmpersandToken */ || operator === 24 /* CommaToken */) { + else if (operator === 52 /* AmpersandAmpersandToken */ || operator === 25 /* CommaToken */) { if (node === binaryExpression.right) { return getContextualType(binaryExpression); } @@ -25312,14 +34437,14 @@ var ts; // is a union type, the mapping function is applied to each constituent type and a union of the resulting // types is returned. function applyToContextualType(type, mapper) { - if (!(type.flags & 524288 /* Union */)) { + if (!(type.flags & 65536 /* Union */)) { return mapper(type); } var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0, types_11 = types; _i < types_11.length; _i++) { - var current = types_11[_i]; + for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { + var current = types_13[_i]; var t = mapper(current); if (t) { if (!mappedType) { @@ -25337,7 +34462,7 @@ var ts; } function getTypeOfPropertyOfContextualType(type, name) { return applyToContextualType(type, function (t) { - var prop = t.flags & 4161536 /* StructuredType */ ? getPropertyOfType(t, name) : undefined; + var prop = t.flags & 229376 /* StructuredType */ ? getPropertyOfType(t, name) : undefined; return prop ? getTypeOfSymbol(prop) : undefined; }); } @@ -25346,7 +34471,7 @@ var ts; } // Return true if the given contextual type is a tuple-like type function contextualTypeIsTupleLikeType(type) { - return !!(type.flags & 524288 /* Union */ ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type)); + return !!(type.flags & 65536 /* Union */ ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type)); } // In an object literal contextually typed by a type T, the contextual type of a property assignment is the type of // the matching property in T, if one exists. Otherwise, it is the type of the numeric index signature in T, if one @@ -25389,7 +34514,7 @@ var ts; var index = ts.indexOf(arrayLiteral.elements, node); return getTypeOfPropertyOfContextualType(type, "" + index) || getIndexTypeOfContextualType(type, 1 /* Number */) - || (languageVersion >= 2 /* ES6 */ ? getElementTypeOfIterable(type, /*errorNode*/ undefined) : undefined); + || (languageVersion >= 2 /* ES2015 */ ? getElementTypeOfIterable(type, /*errorNode*/ undefined) : undefined); } return undefined; } @@ -25402,13 +34527,13 @@ var ts; var kind = attribute.kind; var jsxElement = attribute.parent; var attrsType = getJsxElementAttributesType(jsxElement); - if (attribute.kind === 246 /* JsxAttribute */) { + if (attribute.kind === 250 /* JsxAttribute */) { if (!attrsType || isTypeAny(attrsType)) { return undefined; } return getTypeOfPropertyOfType(attrsType, attribute.name.text); } - else if (attribute.kind === 247 /* JsxSpreadAttribute */) { + else if (attribute.kind === 251 /* JsxSpreadAttribute */) { return attrsType; } ts.Debug.fail("Expected JsxAttribute or JsxSpreadAttribute, got ts.SyntaxKind[" + kind + "]"); @@ -25446,81 +34571,73 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 218 /* VariableDeclaration */: - case 142 /* Parameter */: - case 145 /* PropertyDeclaration */: - case 144 /* PropertySignature */: - case 169 /* BindingElement */: + case 223 /* VariableDeclaration */: + case 144 /* Parameter */: + case 147 /* PropertyDeclaration */: + case 146 /* PropertySignature */: + case 174 /* BindingElement */: return getContextualTypeForInitializerExpression(node); - case 180 /* ArrowFunction */: - case 211 /* ReturnStatement */: + case 185 /* ArrowFunction */: + case 216 /* ReturnStatement */: return getContextualTypeForReturnExpression(node); - case 190 /* YieldExpression */: + case 195 /* YieldExpression */: return getContextualTypeForYieldOperand(parent); - case 174 /* CallExpression */: - case 175 /* NewExpression */: + case 179 /* CallExpression */: + case 180 /* NewExpression */: return getContextualTypeForArgument(parent, node); - case 177 /* TypeAssertionExpression */: - case 195 /* AsExpression */: + case 182 /* TypeAssertionExpression */: + case 200 /* AsExpression */: return getTypeFromTypeNode(parent.type); - case 187 /* BinaryExpression */: + case 192 /* BinaryExpression */: return getContextualTypeForBinaryOperand(node); - case 253 /* PropertyAssignment */: + case 257 /* PropertyAssignment */: + case 258 /* ShorthandPropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent); - case 170 /* ArrayLiteralExpression */: + case 175 /* ArrayLiteralExpression */: return getContextualTypeForElementExpression(node); - case 188 /* ConditionalExpression */: + case 193 /* ConditionalExpression */: return getContextualTypeForConditionalOperand(node); - case 197 /* TemplateSpan */: - ts.Debug.assert(parent.parent.kind === 189 /* TemplateExpression */); + case 202 /* TemplateSpan */: + ts.Debug.assert(parent.parent.kind === 194 /* TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 178 /* ParenthesizedExpression */: + case 183 /* ParenthesizedExpression */: return getContextualType(parent); - case 248 /* JsxExpression */: + case 252 /* JsxExpression */: return getContextualType(parent); - case 246 /* JsxAttribute */: - case 247 /* JsxSpreadAttribute */: + case 250 /* JsxAttribute */: + case 251 /* JsxSpreadAttribute */: return getContextualTypeForJsxAttribute(parent); } return undefined; } - function isLiteralTypeLocation(node) { - var parent = node.parent; - switch (parent.kind) { - case 187 /* BinaryExpression */: - switch (parent.operatorToken.kind) { - case 32 /* EqualsEqualsEqualsToken */: - case 33 /* ExclamationEqualsEqualsToken */: - case 30 /* EqualsEqualsToken */: - case 31 /* ExclamationEqualsToken */: - return true; - } - break; - case 188 /* ConditionalExpression */: - return (node === parent.whenTrue || - node === parent.whenFalse) && - isLiteralTypeLocation(parent); - case 178 /* ParenthesizedExpression */: - return isLiteralTypeLocation(parent); - case 249 /* CaseClause */: - case 166 /* LiteralType */: - return true; - } - return false; - } // If the given type is an object or union type, if that type has a single signature, and if // that signature is non-generic, return the signature. Otherwise return undefined. - function getNonGenericSignature(type) { + function getNonGenericSignature(type, node) { var signatures = getSignaturesOfStructuredType(type, 0 /* Call */); if (signatures.length === 1) { var signature = signatures[0]; - if (!signature.typeParameters) { + if (!signature.typeParameters && !isAritySmaller(signature, node)) { return signature; } } } + /** If the contextual signature has fewer parameters than the function expression, do not use it */ + function isAritySmaller(signature, target) { + var targetParameterCount = 0; + for (; targetParameterCount < target.parameters.length; targetParameterCount++) { + var param = target.parameters[targetParameterCount]; + if (param.initializer || param.questionToken || param.dotDotDotToken || isJSDocOptionalParameter(param)) { + break; + } + } + if (target.parameters.length && ts.parameterIsThisKeyword(target.parameters[0])) { + targetParameterCount--; + } + var sourceLength = signature.hasRestParameter ? Number.MAX_VALUE : signature.parameters.length; + return sourceLength < targetParameterCount; + } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 179 /* FunctionExpression */ || node.kind === 180 /* ArrowFunction */; + return node.kind === 184 /* FunctionExpression */ || node.kind === 185 /* ArrowFunction */; } function getContextualSignatureForFunctionLikeDeclaration(node) { // Only function expressions, arrow functions, and object literal methods are contextually typed. @@ -25539,19 +34656,19 @@ var ts; // all identical ignoring their return type, the result is same signature but with return type as // union type of return types from these signatures function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 147 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 149 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var type = getContextualTypeForFunctionLikeDeclaration(node); if (!type) { return undefined; } - if (!(type.flags & 524288 /* Union */)) { - return getNonGenericSignature(type); + if (!(type.flags & 65536 /* Union */)) { + return getNonGenericSignature(type, node); } var signatureList; var types = type.types; - for (var _i = 0, types_12 = types; _i < types_12.length; _i++) { - var current = types_12[_i]; - var signature = getNonGenericSignature(current); + for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { + var current = types_14[_i]; + var signature = getNonGenericSignature(current, node); if (signature) { if (!signatureList) { // This signature will contribute to contextual union signature @@ -25595,19 +34712,13 @@ var ts; function isInferentialContext(mapper) { return mapper && mapper.context; } - function checkSpreadElementExpression(node, contextualMapper) { - // It is usually not safe to call checkExpressionCached if we can be contextually typing. - // You can tell that we are contextually typing because of the contextualMapper parameter. - // While it is true that a spread element can have a contextual type, it does not do anything - // with this type. It is neither affected by it, nor does it propagate it to its operand. - // So the fact that contextualMapper is passed is not important, because the operand of a spread - // element is not contextually typed. - var arrayOrIterableType = checkExpressionCached(node.expression, contextualMapper); + function checkSpreadExpression(node, contextualMapper) { + var arrayOrIterableType = checkExpression(node.expression, contextualMapper); return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false); } function hasDefaultValue(node) { - return (node.kind === 169 /* BindingElement */ && !!node.initializer) || - (node.kind === 187 /* BinaryExpression */ && node.operatorToken.kind === 56 /* EqualsToken */); + return (node.kind === 174 /* BindingElement */ && !!node.initializer) || + (node.kind === 192 /* BinaryExpression */ && node.operatorToken.kind === 57 /* EqualsToken */); } function checkArrayLiteral(node, contextualMapper) { var elements = node.elements; @@ -25616,7 +34727,7 @@ var ts; var inDestructuringPattern = ts.isAssignmentTarget(node); for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) { var e = elements_1[_i]; - if (inDestructuringPattern && e.kind === 191 /* SpreadElementExpression */) { + if (inDestructuringPattern && e.kind === 196 /* SpreadElement */) { // Given the following situation: // var c: {}; // [...c] = ["", 0]; @@ -25631,16 +34742,16 @@ var ts; // if there is no index type / iterated type. var restArrayType = checkExpression(e.expression, contextualMapper); var restElementType = getIndexTypeOfType(restArrayType, 1 /* Number */) || - (languageVersion >= 2 /* ES6 */ ? getElementTypeOfIterable(restArrayType, /*errorNode*/ undefined) : undefined); + (languageVersion >= 2 /* ES2015 */ ? getElementTypeOfIterable(restArrayType, /*errorNode*/ undefined) : undefined); if (restElementType) { elementTypes.push(restElementType); } } else { - var type = checkExpression(e, contextualMapper); + var type = checkExpressionForMutableLocation(e, contextualMapper); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 191 /* SpreadElementExpression */; + hasSpreadElement = hasSpreadElement || e.kind === 196 /* SpreadElement */; } if (!hasSpreadElement) { // If array literal is actually a destructuring pattern, mark it as an implied type. We do this such @@ -25655,7 +34766,7 @@ var ts; var pattern = contextualType.pattern; // If array literal is contextually typed by a binding pattern or an assignment pattern, pad the resulting // tuple type with the corresponding binding or assignment element types to make the lengths equal. - if (pattern && (pattern.kind === 168 /* ArrayBindingPattern */ || pattern.kind === 170 /* ArrayLiteralExpression */)) { + if (pattern && (pattern.kind === 173 /* ArrayBindingPattern */ || pattern.kind === 175 /* ArrayLiteralExpression */)) { var patternElements = pattern.elements; for (var i = elementTypes.length; i < patternElements.length; i++) { var patternElement = patternElements[i]; @@ -25663,7 +34774,7 @@ var ts; elementTypes.push(contextualType.typeArguments[i]); } else { - if (patternElement.kind !== 193 /* OmittedExpression */) { + if (patternElement.kind !== 198 /* OmittedExpression */) { error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } elementTypes.push(unknownType); @@ -25680,7 +34791,7 @@ var ts; strictNullChecks ? neverType : undefinedWideningType); } function isNumericName(name) { - return name.kind === 140 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 142 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text); } function isNumericComputedName(name) { // It seems odd to consider an expression of type Any to result in a numeric name, @@ -25690,6 +34801,9 @@ var ts; function isTypeAnyOrAllConstituentTypesHaveKind(type, kind) { return isTypeAny(type) || isTypeOfKind(type, kind); } + function isInfinityOrNaNString(name) { + return name === "Infinity" || name === "-Infinity" || name === "NaN"; + } function isNumericLiteralName(name) { // The intent of numeric names is that // - they are names with text in a numeric form, and that @@ -25720,7 +34834,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 { @@ -25729,10 +34843,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])); } } @@ -25745,37 +34859,40 @@ var ts; checkGrammarObjectLiteralExpression(node, inDestructuringPattern); var propertiesTable = ts.createMap(); var propertiesArray = []; + var spread = emptyObjectType; + var propagatedFlags = 0; var contextualType = getApparentTypeOfContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 167 /* ObjectBindingPattern */ || contextualType.pattern.kind === 171 /* ObjectLiteralExpression */); + (contextualType.pattern.kind === 172 /* ObjectBindingPattern */ || contextualType.pattern.kind === 176 /* ObjectLiteralExpression */); var typeFlags = 0; 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 === 253 /* PropertyAssignment */ || - memberDecl.kind === 254 /* ShorthandPropertyAssignment */ || + if (memberDecl.kind === 257 /* PropertyAssignment */ || + memberDecl.kind === 258 /* ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 253 /* PropertyAssignment */) { + if (memberDecl.kind === 257 /* PropertyAssignment */) { type = checkPropertyAssignment(memberDecl, contextualMapper); } - else if (memberDecl.kind === 147 /* MethodDeclaration */) { + else if (memberDecl.kind === 149 /* MethodDeclaration */) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 254 /* ShorthandPropertyAssignment */); - type = checkExpression(memberDecl.name, contextualMapper); + ts.Debug.assert(memberDecl.kind === 258 /* ShorthandPropertyAssignment */); + type = checkExpressionForMutableLocation(memberDecl.name, contextualMapper); } typeFlags |= type.flags; var prop = createSymbol(4 /* Property */ | 67108864 /* Transient */ | member.flags, member.name); if (inDestructuringPattern) { // If object literal is an assignment pattern and if the assignment pattern specifies a default value // for the property, make the property optional. - var isOptional = (memberDecl.kind === 253 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 254 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 257 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 258 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 536870912 /* Optional */; } @@ -25783,14 +34900,14 @@ var ts; patternWithComputedProperties = true; } } - else if (contextualTypeHasPattern && !(contextualType.flags & 536870912 /* ObjectLiteralPatternWithComputedProperties */)) { + else if (contextualTypeHasPattern && !(getObjectFlags(contextualType) & 512 /* ObjectLiteralPatternWithComputedProperties */)) { // If object literal is contextually typed by the implied type of a binding pattern, and if the // binding pattern specifies a default value for the property, make the property optional. var impliedProp = getPropertyOfType(contextualType, member.name); if (impliedProp) { prop.flags |= impliedProp.flags & 536870912 /* Optional */; } - else if (!compilerOptions.suppressExcessPropertyErrors) { + else if (!compilerOptions.suppressExcessPropertyErrors && !getIndexInfoOfType(contextualType, 0 /* String */)) { error(memberDecl.name, ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(member), typeToString(contextualType)); } } @@ -25803,13 +34920,34 @@ var ts; prop.target = member; member = prop; } + else if (memberDecl.kind === 259 /* SpreadAssignment */) { + if (languageVersion < 5 /* ESNext */) { + checkExternalEmitHelpers(memberDecl, 2 /* Assign */); + } + if (propertiesArray.length > 0) { + spread = getSpreadType(spread, createObjectLiteralType(), /*isFromObjectLiteral*/ true); + propertiesArray = []; + propertiesTable = ts.createMap(); + hasComputedStringProperty = false; + hasComputedNumberProperty = false; + typeFlags = 0; + } + var type = checkExpression(memberDecl.expression); + if (!isValidSpreadType(type)) { + error(memberDecl, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types); + return unknownType; + } + spread = getSpreadType(spread, type, /*isFromObjectLiteral*/ false); + offset = i + 1; + continue; + } else { // TypeScript 1.0 spec (April 2014) // A get accessor declaration is processed in the same manner as // an ordinary function declaration(section 6.1) with no parameters. // A set accessor declaration is processed in the same manner // as an ordinary function declaration with a single parameter and a Void return type. - ts.Debug.assert(memberDecl.kind === 149 /* GetAccessor */ || memberDecl.kind === 150 /* SetAccessor */); + ts.Debug.assert(memberDecl.kind === 151 /* GetAccessor */ || memberDecl.kind === 152 /* SetAccessor */); checkAccessorDeclaration(memberDecl); } if (ts.hasDynamicName(memberDecl)) { @@ -25828,8 +34966,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); @@ -25839,15 +34977,41 @@ var ts; } } } - var stringIndexInfo = hasComputedStringProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 0 /* String */) : undefined; - var numberIndexInfo = hasComputedNumberProperty ? getObjectLiteralIndexInfo(node, propertiesArray, 1 /* Number */) : undefined; - var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); - var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 16777216 /* FreshObjectLiteral */; - result.flags |= 8388608 /* ObjectLiteral */ | 67108864 /* ContainsObjectLiteral */ | freshObjectLiteralFlag | (typeFlags & 234881024 /* PropagatingFlags */) | (patternWithComputedProperties ? 536870912 /* ObjectLiteralPatternWithComputedProperties */ : 0); - if (inDestructuringPattern) { - result.pattern = node; + if (spread !== emptyObjectType) { + if (propertiesArray.length > 0) { + spread = getSpreadType(spread, createObjectLiteralType(), /*isFromObjectLiteral*/ true); + } + if (spread.flags & 32768 /* Object */) { + // only set the symbol and flags if this is a (fresh) object type + spread.flags |= propagatedFlags; + spread.symbol = node.symbol; + } + return spread; } - return result; + return createObjectLiteralType(); + function createObjectLiteralType() { + 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 */); + result.objectFlags |= 128 /* ObjectLiteral */; + if (patternWithComputedProperties) { + result.objectFlags |= 512 /* ObjectLiteralPatternWithComputedProperties */; + } + if (inDestructuringPattern) { + result.pattern = node; + } + if (!(result.flags & 6144 /* Nullable */)) { + propagatedFlags |= (result.flags & 14680064 /* PropagatingFlags */); + } + return result; + } + } + function isValidSpreadType(type) { + return !!(type.flags & (1 /* Any */ | 4096 /* Null */ | 2048 /* Undefined */) || + type.flags & 32768 /* Object */ && !isGenericMappedType(type) || + type.flags & 196608 /* UnionOrIntersection */ && !ts.forEach(type.types, function (t) { return !isValidSpreadType(t); })); } function checkJsxSelfClosingElement(node) { checkJsxOpeningLikeElement(node); @@ -25867,13 +35031,13 @@ var ts; for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 248 /* JsxExpression */: + case 252 /* JsxExpression */: checkJsxExpression(child); break; - case 241 /* JsxElement */: + case 246 /* JsxElement */: checkJsxElement(child); break; - case 242 /* JsxSelfClosingElement */: + case 247 /* JsxSelfClosingElement */: checkJsxSelfClosingElement(child); break; } @@ -25892,7 +35056,7 @@ var ts; */ function isJsxIntrinsicIdentifier(tagName) { // TODO (yuisu): comment - if (tagName.kind === 172 /* PropertyAccessExpression */ || tagName.kind === 97 /* ThisKeyword */) { + if (tagName.kind === 177 /* PropertyAccessExpression */ || tagName.kind === 98 /* ThisKeyword */) { return false; } else { @@ -25910,7 +35074,7 @@ var ts; var correspondingPropSymbol = getPropertyOfType(elementAttributesType, node.name.text); correspondingPropType = correspondingPropSymbol && getTypeOfSymbol(correspondingPropSymbol); if (isUnhyphenatedJsxName(node.name.text)) { - var attributeType = getTypeOfPropertyOfType(elementAttributesType, getTextOfPropertyName(node.name)) || getIndexTypeOfType(elementAttributesType, 0 /* String */); + var attributeType = getTypeOfPropertyOfType(elementAttributesType, ts.getTextOfPropertyName(node.name)) || getIndexTypeOfType(elementAttributesType, 0 /* String */); if (attributeType) { correspondingPropType = attributeType; } @@ -25938,6 +35102,9 @@ var ts; return exprType; } function checkJsxSpreadAttribute(node, elementAttributesType, nameTable) { + if (compilerOptions.jsx === 2 /* React */) { + checkExternalEmitHelpers(node, 2 /* Assign */); + } var type = checkExpression(node.expression); var props = getPropertiesOfType(type); for (var _i = 0, props_2 = props; _i < props_2.length; _i++) { @@ -26003,7 +35170,7 @@ var ts; * For example, in the element , the element instance type is `MyClass` (not `typeof MyClass`). */ function getJsxElementInstanceType(node, valueType) { - ts.Debug.assert(!(valueType.flags & 524288 /* Union */)); + ts.Debug.assert(!(valueType.flags & 65536 /* Union */)); if (isTypeAny(valueType)) { // Short-circuit if the class tag is using an element type 'any' return anyType; @@ -26019,7 +35186,7 @@ var ts; return unknownType; } } - return getUnionType(signatures.map(getReturnTypeOfSignature), /*subtypeReduction*/ true); + return getUnionType(ts.map(signatures, getReturnTypeOfSignature), /*subtypeReduction*/ true); } /// e.g. "props" for React.d.ts, /// or 'undefined' if ElementAttributesProperty doesn't exist (which means all @@ -26061,9 +35228,9 @@ var ts; if (!elemType) { elemType = checkExpression(node.tagName); } - if (elemType.flags & 524288 /* Union */) { + if (elemType.flags & 65536 /* Union */) { var types = elemType.types; - return getUnionType(types.map(function (type) { + return getUnionType(ts.map(types, function (type) { return getResolvedJsxType(node, type, elemClassType); }), /*subtypeReduction*/ true); } @@ -26135,7 +35302,7 @@ var ts; // Props is of type 'any' or unknown return attributesType; } - else if (attributesType.flags & 524288 /* Union */) { + else if (attributesType.flags & 65536 /* Union */) { // Props cannot be a union type error(node.tagName, ts.Diagnostics.JSX_element_attributes_type_0_may_not_be_a_union_type, typeToString(attributesType)); return anyType; @@ -26224,13 +35391,19 @@ var ts; function checkJsxOpeningLikeElement(node) { checkGrammarJsxElement(node); checkJsxPreconditions(node); - // The reactNamespace symbol should be marked as 'used' so we don't incorrectly elide its import. And if there - // is no reactNamespace symbol in scope when targeting React emit, we should issue an error. + // The reactNamespace/jsxFactory's root symbol should be marked as 'used' so we don't incorrectly elide its import. + // And if there is no reactNamespace/jsxFactory's symbol in scope when targeting React emit, we should issue an error. var reactRefErr = compilerOptions.jsx === 2 /* React */ ? ts.Diagnostics.Cannot_find_name_0 : undefined; - var reactNamespace = compilerOptions.reactNamespace ? compilerOptions.reactNamespace : "React"; + var reactNamespace = getJsxNamespace(); var reactSym = resolveName(node.tagName, reactNamespace, 107455 /* Value */, reactRefErr, reactNamespace); if (reactSym) { - getSymbolLinks(reactSym).referenced = true; + // Mark local symbol as referenced here because it might not have been marked + // if jsx emit was not react as there wont be error being emitted + reactSym.isReferenced = true; + // If react symbol is alias, mark it as refereced + if (reactSym.flags & 8388608 /* Alias */ && !isConstEnumOrConstEnumOnlyModule(resolveAlias(reactSym))) { + markAliasSymbolAsReferenced(reactSym); + } } var targetAttributesType = getJsxElementAttributesType(node); var nameTable = ts.createMap(); @@ -26239,11 +35412,11 @@ var ts; // thus should have their types ignored var sawSpreadedAny = false; for (var i = node.attributes.length - 1; i >= 0; i--) { - if (node.attributes[i].kind === 246 /* JsxAttribute */) { + if (node.attributes[i].kind === 250 /* JsxAttribute */) { checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); } else { - ts.Debug.assert(node.attributes[i].kind === 247 /* JsxSpreadAttribute */); + ts.Debug.assert(node.attributes[i].kind === 251 /* JsxSpreadAttribute */); var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); if (isTypeAny(spreadType)) { sawSpreadedAny = true; @@ -26273,10 +35446,13 @@ var ts; // If a symbol is a synthesized symbol with no value declaration, we assume it is a property. Example of this are the synthesized // '.prototype' property as well as synthesized tuple index properties. function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 145 /* PropertyDeclaration */; + return s.valueDeclaration ? s.valueDeclaration.kind : 147 /* PropertyDeclaration */; } - function getDeclarationFlagsFromSymbol(s) { - return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 /* Prototype */ ? 4 /* Public */ | 32 /* Static */ : 0; + function getDeclarationModifierFlagsFromSymbol(s) { + return s.valueDeclaration ? ts.getCombinedModifierFlags(s.valueDeclaration) : s.flags & 134217728 /* Prototype */ ? 4 /* Public */ | 32 /* Static */ : 0; + } + function getDeclarationNodeFlagsFromSymbol(s) { + return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : 0; } /** * Check whether the requested property access is valid. @@ -26287,12 +35463,12 @@ var ts; * @param prop The symbol for the right hand side of the property access. */ function checkClassPropertyAccess(node, left, type, prop) { - var flags = getDeclarationFlagsFromSymbol(prop); + var flags = getDeclarationModifierFlagsFromSymbol(prop); var declaringClass = getDeclaredTypeOfSymbol(getParentOfSymbol(prop)); - var errorNode = node.kind === 172 /* PropertyAccessExpression */ || node.kind === 218 /* VariableDeclaration */ ? + var errorNode = node.kind === 177 /* PropertyAccessExpression */ || node.kind === 223 /* VariableDeclaration */ ? node.name : node.right; - if (left.kind === 95 /* SuperKeyword */) { + if (left.kind === 96 /* SuperKeyword */) { // TS 1.0 spec (April 2014): 4.8.2 // - In a constructor, instance member function, instance member accessor, or // instance member variable initializer where this references a derived class instance, @@ -26300,7 +35476,7 @@ var ts; // - In a static member function or static member accessor // where this references the constructor function object of a derived class, // a super property access is permitted and must specify a public static member function of the base class. - if (languageVersion < 2 /* ES6 */ && getDeclarationKindFromSymbol(prop) !== 147 /* MethodDeclaration */) { + if (languageVersion < 2 /* ES2015 */ && getDeclarationKindFromSymbol(prop) !== 149 /* MethodDeclaration */) { // `prop` refers to a *property* declared in the super class // rather than a *method*, so it does not satisfy the above criteria. error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); @@ -26316,7 +35492,7 @@ var ts; } } // Public properties are otherwise accessible. - if (!(flags & (8 /* Private */ | 16 /* Protected */))) { + if (!(flags & 24 /* NonPublicAccessibilityModifier */)) { return true; } // Property is known to be private or protected at this point @@ -26331,7 +35507,7 @@ var ts; } // Property is known to be protected at this point // All protected properties of a supertype are accessible in a super access - if (left.kind === 95 /* SuperKeyword */) { + if (left.kind === 96 /* SuperKeyword */) { return true; } // Get the enclosing class that has the declaring class as its base type @@ -26349,12 +35525,12 @@ var ts; return true; } // An instance property must be accessed through an instance of the enclosing class - if (type.flags & 268435456 /* ThisType */) { + if (type.flags & 16384 /* TypeParameter */ && type.isThisType) { // get the original type -- represented as the type constraint of the 'this' type type = getConstraintOfTypeParameter(type); } // TODO: why is the first part of this check here? - if (!(getTargetType(type).flags & (32768 /* Class */ | 65536 /* Interface */) && hasBaseType(type, enclosingClass))) { + if (!(getObjectFlags(getTargetType(type)) & 3 /* ClassOrInterface */ && hasBaseType(type, enclosingClass))) { error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); return false; } @@ -26380,9 +35556,36 @@ var ts; function checkQualifiedName(node) { return checkPropertyAccessExpressionOrQualifiedName(node, node.left, node.right); } + function reportNonexistentProperty(propNode, containingType) { + var errorInfo; + if (containingType.flags & 65536 /* Union */ && !(containingType.flags & 8190 /* Primitive */)) { + for (var _i = 0, _a = containingType.types; _i < _a.length; _i++) { + var subtype = _a[_i]; + if (!getPropertyOfType(subtype, propNode.text)) { + errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(propNode), typeToString(subtype)); + break; + } + } + } + errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(propNode), typeToString(containingType)); + diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(propNode, errorInfo)); + } + function markPropertyAsReferenced(prop) { + if (prop && + noUnusedIdentifiers && + (prop.flags & 106500 /* ClassMember */) && + prop.valueDeclaration && (ts.getModifierFlags(prop.valueDeclaration) & 8 /* Private */)) { + if (prop.flags & 16777216 /* Instantiated */) { + getSymbolLinks(prop).target.isReferenced = true; + } + else { + prop.isReferenced = true; + } + } + } function checkPropertyAccessExpressionOrQualifiedName(node, left, right) { var type = checkNonNullExpression(left); - if (isTypeAny(type)) { + if (isTypeAny(type) || type === silentNeverType) { return type; } var apparentType = getApparentType(getWidenedType(type)); @@ -26393,40 +35596,36 @@ var ts; var prop = getPropertyOfType(apparentType, right.text); if (!prop) { if (right.text && !checkAndReportErrorForExtendingInterface(node)) { - error(right, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(right), typeToString(type.flags & 268435456 /* ThisType */ ? apparentType : type)); + reportNonexistentProperty(right, type.flags & 16384 /* TypeParameter */ && type.isThisType ? apparentType : type); } return unknownType; } - if (noUnusedIdentifiers && - (prop.flags & 106500 /* ClassMember */) && - prop.valueDeclaration && (prop.valueDeclaration.flags & 8 /* Private */)) { - if (prop.flags & 16777216 /* Instantiated */) { - getSymbolLinks(prop).target.isReferenced = true; - } - else { - prop.isReferenced = true; - } - } + markPropertyAsReferenced(prop); getNodeLinks(node).resolvedSymbol = prop; if (prop.parent && prop.parent.flags & 32 /* Class */) { checkClassPropertyAccess(node, left, apparentType, prop); } var propType = getTypeOfSymbol(prop); - if (prop.flags & 8 /* EnumMember */ && isLiteralContextForType(node, propType)) { - propType = getDeclaredTypeOfSymbol(prop); + var assignmentKind = ts.getAssignmentTargetKind(node); + if (assignmentKind) { + if (isReferenceToReadonlyEntity(node, prop) || isReferenceThroughNamespaceImport(node)) { + error(right, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, right.text); + return unknownType; + } } // Only compute control flow type if this is a property access expression that isn't an // assignment target, and the referenced property was declared as a variable, property, // accessor, or optional method. - if (node.kind !== 172 /* PropertyAccessExpression */ || ts.isAssignmentTarget(node) || + if (node.kind !== 177 /* PropertyAccessExpression */ || assignmentKind === 1 /* Definite */ || !(prop.flags & (3 /* Variable */ | 4 /* Property */ | 98304 /* Accessor */)) && - !(prop.flags & 8192 /* Method */ && propType.flags & 524288 /* Union */)) { + !(prop.flags & 8192 /* Method */ && propType.flags & 65536 /* Union */)) { return propType; } - return getFlowTypeOfReference(node, propType, /*assumeInitialized*/ true, /*flowContainer*/ undefined); + var flowType = getFlowTypeOfReference(node, propType, /*assumeInitialized*/ true, /*flowContainer*/ undefined); + return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 172 /* PropertyAccessExpression */ + var left = node.kind === 177 /* PropertyAccessExpression */ ? node.expression : node.left; var type = checkExpression(left); @@ -26443,13 +35642,13 @@ var ts; */ function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 219 /* VariableDeclarationList */) { + if (initializer.kind === 224 /* VariableDeclarationList */) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); } } - else if (initializer.kind === 69 /* Identifier */) { + else if (initializer.kind === 70 /* Identifier */) { return getResolvedSymbol(initializer); } return undefined; @@ -26465,17 +35664,17 @@ var ts; * that references a for-in variable for an object with numeric property names. */ function isForInVariableForNumericPropertyNames(expr) { - var e = skipParenthesizedNodes(expr); - if (e.kind === 69 /* Identifier */) { + var e = ts.skipParentheses(expr); + if (e.kind === 70 /* Identifier */) { var symbol = getResolvedSymbol(e); if (symbol.flags & 3 /* Variable */) { var child = expr; var node = expr.parent; while (node) { - if (node.kind === 207 /* ForInStatement */ && + if (node.kind === 212 /* ForInStatement */ && child === node.statement && getForInVariableSymbol(node) === symbol && - hasNumericPropertyNames(checkExpression(node.expression))) { + hasNumericPropertyNames(getTypeOfExpression(node.expression))) { return true; } child = node; @@ -26486,10 +35685,11 @@ var ts; return false; } function checkIndexedAccess(node) { - // Grammar checking - if (!node.argumentExpression) { + var objectType = checkNonNullExpression(node.expression); + var indexExpression = node.argumentExpression; + if (!indexExpression) { var sourceFile = ts.getSourceFileOfNode(node); - if (node.parent.kind === 175 /* NewExpression */ && node.parent.expression === node) { + if (node.parent.kind === 180 /* NewExpression */ && node.parent.expression === node) { var start = ts.skipTrivia(sourceFile.text, node.expression.end); var end = node.end; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); @@ -26499,101 +35699,18 @@ var ts; var end = node.end; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Expression_expected); } - } - // Obtain base constraint such that we can bail out if the constraint is an unknown type - var objectType = getApparentType(checkNonNullExpression(node.expression)); - var indexType = node.argumentExpression ? checkExpression(node.argumentExpression) : unknownType; - if (objectType === unknownType) { return unknownType; } - var isConstEnum = isConstEnumObjectType(objectType); - if (isConstEnum && - (!node.argumentExpression || node.argumentExpression.kind !== 9 /* StringLiteral */)) { - error(node.argumentExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); + var indexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : checkExpression(indexExpression); + if (objectType === unknownType || objectType === silentNeverType) { + return objectType; + } + if (isConstEnumObjectType(objectType) && indexExpression.kind !== 9 /* StringLiteral */) { + error(indexExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); return unknownType; } - // TypeScript 1.0 spec (April 2014): 4.10 Property Access - // - If IndexExpr is a string literal or a numeric literal and ObjExpr's apparent type has a property with the name - // given by that literal(converted to its string representation in the case of a numeric literal), the property access is of the type of that property. - // - Otherwise, if ObjExpr's apparent type has a numeric index signature and IndexExpr is of type Any, the Number primitive type, or an enum type, - // the property access is of the type of that index signature. - // - Otherwise, if ObjExpr's apparent type has a string index signature and IndexExpr is of type Any, the String or Number primitive type, or an enum type, - // the property access is of the type of that index signature. - // - Otherwise, if IndexExpr is of type Any, the String or Number primitive type, or an enum type, the property access is of type Any. - // See if we can index as a property. - if (node.argumentExpression) { - var name_13 = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); - if (name_13 !== undefined) { - var prop = getPropertyOfType(objectType, name_13); - if (prop) { - getNodeLinks(node).resolvedSymbol = prop; - return getTypeOfSymbol(prop); - } - else if (isConstEnum) { - error(node.argumentExpression, ts.Diagnostics.Property_0_does_not_exist_on_const_enum_1, name_13, symbolToString(objectType.symbol)); - return unknownType; - } - } - } - // Check for compatible indexer types. - var allowedNullableFlags = strictNullChecks ? 0 : 6144 /* Nullable */; - if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 34 /* StringLike */ | 340 /* NumberLike */ | 512 /* ESSymbol */ | allowedNullableFlags)) { - // Try to use a number indexer. - if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 340 /* NumberLike */ | allowedNullableFlags) || isForInVariableForNumericPropertyNames(node.argumentExpression)) { - var numberIndexInfo = getIndexInfoOfType(objectType, 1 /* Number */); - if (numberIndexInfo) { - getNodeLinks(node).resolvedIndexInfo = numberIndexInfo; - return numberIndexInfo.type; - } - } - // Try to use string indexing. - var stringIndexInfo = getIndexInfoOfType(objectType, 0 /* String */); - if (stringIndexInfo) { - getNodeLinks(node).resolvedIndexInfo = stringIndexInfo; - return stringIndexInfo.type; - } - // Fall back to any. - if (compilerOptions.noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && !isTypeAny(objectType)) { - error(node, getIndexTypeOfType(objectType, 1 /* Number */) ? - ts.Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number : - ts.Diagnostics.Index_signature_of_object_type_implicitly_has_an_any_type); - } - return anyType; - } - // REVIEW: Users should know the type that was actually used. - error(node, ts.Diagnostics.An_index_expression_argument_must_be_of_type_string_number_symbol_or_any); - return unknownType; + return getIndexedAccessType(objectType, indexType, node); } - /** - * If indexArgumentExpression is a string literal or number literal, returns its text. - * If indexArgumentExpression is a constant value, returns its string value. - * If indexArgumentExpression is a well known symbol, returns the property name corresponding - * to this symbol, as long as it is a proper symbol reference. - * Otherwise, returns undefined. - */ - function getPropertyNameForIndexedAccess(indexArgumentExpression, indexArgumentType) { - if (indexArgumentExpression.kind === 9 /* StringLiteral */ || indexArgumentExpression.kind === 8 /* NumericLiteral */) { - return indexArgumentExpression.text; - } - if (indexArgumentExpression.kind === 173 /* ElementAccessExpression */ || indexArgumentExpression.kind === 172 /* PropertyAccessExpression */) { - var value = getConstantValue(indexArgumentExpression); - if (value !== undefined) { - return value.toString(); - } - } - if (checkThatExpressionIsProperSymbolReference(indexArgumentExpression, indexArgumentType, /*reportError*/ false)) { - var rightHandSideName = indexArgumentExpression.name.text; - return ts.getPropertyNameForKnownSymbolName(rightHandSideName); - } - return undefined; - } - /** - * A proper symbol reference requires the following: - * 1. The property access denotes a property that exists - * 2. The expression is of the form Symbol. - * 3. The property access is of the primitive type symbol. - * 4. Symbol in this context resolves to the global Symbol object - */ function checkThatExpressionIsProperSymbolReference(expression, expressionType, reportError) { if (expressionType === unknownType) { // There is already an error, so no need to report one. @@ -26630,10 +35747,10 @@ var ts; return true; } function resolveUntypedCall(node) { - if (node.kind === 176 /* TaggedTemplateExpression */) { + if (node.kind === 181 /* TaggedTemplateExpression */) { checkExpression(node.template); } - else if (node.kind !== 143 /* Decorator */) { + else if (node.kind !== 145 /* Decorator */) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -26699,7 +35816,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 191 /* SpreadElementExpression */) { + if (arg && arg.kind === 196 /* SpreadElement */) { return i; } } @@ -26712,13 +35829,13 @@ var ts; var callIsIncomplete; // In incomplete call we want to be lenient when we have too few arguments var isDecorator; var spreadArgIndex = -1; - if (node.kind === 176 /* TaggedTemplateExpression */) { + if (node.kind === 181 /* TaggedTemplateExpression */) { var tagExpression = node; // Even if the call is incomplete, we'll have a missing expression as our last argument, // so we can say the count is just the arg list length argCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 189 /* TemplateExpression */) { + if (tagExpression.template.kind === 194 /* TemplateExpression */) { // If a tagged template expression lacks a tail literal, the call is incomplete. // Specifically, a template only can end in a TemplateTail or a Missing literal. var templateExpression = tagExpression.template; @@ -26731,11 +35848,11 @@ var ts; // then this might actually turn out to be a TemplateHead in the future; // so we consider the call to be incomplete. var templateLiteral = tagExpression.template; - ts.Debug.assert(templateLiteral.kind === 11 /* NoSubstitutionTemplateLiteral */); + ts.Debug.assert(templateLiteral.kind === 12 /* NoSubstitutionTemplateLiteral */); callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 143 /* Decorator */) { + else if (node.kind === 145 /* Decorator */) { isDecorator = true; typeArguments = undefined; argCount = getEffectiveArgumentCount(node, /*args*/ undefined, signature); @@ -26744,7 +35861,7 @@ var ts; var callExpression = node; if (!callExpression.arguments) { // This only happens when we have something of the form: 'new C' - ts.Debug.assert(callExpression.kind === 175 /* NewExpression */); + ts.Debug.assert(callExpression.kind === 180 /* NewExpression */); return signature.minArgumentCount === 0; } argCount = signatureHelpTrailingComma ? args.length + 1 : args.length; @@ -26775,7 +35892,7 @@ var ts; } // If type has a single call signature and no other members, return that signature. Otherwise, return undefined. function getSingleCallSignature(type) { - if (type.flags & 2588672 /* ObjectType */) { + if (type.flags & 32768 /* Object */) { var resolved = resolveStructuredTypeMembers(type); if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && resolved.properties.length === 0 && !resolved.stringIndexInfo && !resolved.numberIndexInfo) { @@ -26786,10 +35903,10 @@ var ts; } // Instantiate a generic signature in the context of a non-generic signature (section 3.8.5 in TypeScript spec) function instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper) { - var context = createInferenceContext(signature.typeParameters, /*inferUnionTypes*/ true); + var context = createInferenceContext(signature, /*inferUnionTypes*/ true); forEachMatchingParameterType(contextualSignature, signature, function (source, target) { // Type parameters from outer context referenced by source type are fixed by instantiation of the source type - inferTypes(context, instantiateType(source, contextualMapper), target); + inferTypesWithContext(context, instantiateType(source, contextualMapper), target); }); return getSignatureInstantiation(signature, getInferredTypes(context)); } @@ -26820,7 +35937,7 @@ var ts; if (thisType) { var thisArgumentNode = getThisArgumentOfCall(node); var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; - inferTypes(context, thisArgumentType, thisType); + inferTypesWithContext(context, thisArgumentType, thisType); } // We perform two passes over the arguments. In the first pass we infer from all arguments, but use // wildcards for all context sensitive function expressions. @@ -26828,9 +35945,9 @@ var ts; for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); // If the effective argument is 'undefined', then it is an argument that is present but is synthetic. - if (arg === undefined || arg.kind !== 193 /* OmittedExpression */) { + if (arg === undefined || arg.kind !== 198 /* OmittedExpression */) { var paramType = getTypeAtPosition(signature, i); - var argType = getEffectiveArgumentType(node, i, arg); + var argType = getEffectiveArgumentType(node, i); // If the effective argument type is 'undefined', there is no synthetic type // for the argument. In that case, we should check the argument. if (argType === undefined) { @@ -26839,7 +35956,7 @@ var ts; var mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper; argType = checkExpressionWithContextualType(arg, paramType, mapper); } - inferTypes(context, argType, paramType); + inferTypesWithContext(context, argType, paramType); } } // In the second pass we visit only context sensitive arguments, and only those that aren't excluded, this @@ -26853,7 +35970,7 @@ var ts; if (excludeArgument[i] === false) { var arg = args[i]; var paramType = getTypeAtPosition(signature, i); - inferTypes(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); + inferTypesWithContext(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); } } } @@ -26885,7 +36002,7 @@ var ts; } function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { var thisType = getThisTypeOfSignature(signature); - if (thisType && thisType !== voidType && node.kind !== 175 /* NewExpression */) { + if (thisType && thisType !== voidType && node.kind !== 180 /* NewExpression */) { // If the called expression is not of the form `x.f` or `x["f"]`, then sourceType = voidType // If the signature's 'this' type is voidType, then the check is skipped -- anything is compatible. // If the expression is a new expression, then the check is skipped. @@ -26902,10 +36019,10 @@ var ts; for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); // If the effective argument is 'undefined', then it is an argument that is present but is synthetic. - if (arg === undefined || arg.kind !== 193 /* OmittedExpression */) { + if (arg === undefined || arg.kind !== 198 /* OmittedExpression */) { // Check spread elements against rest type (from arity check we know spread argument corresponds to a rest parameter) var paramType = getTypeAtPosition(signature, i); - var argType = getEffectiveArgumentType(node, i, arg); + var argType = getEffectiveArgumentType(node, i); // If the effective argument type is 'undefined', there is no synthetic type // for the argument. In that case, we should check the argument. if (argType === undefined) { @@ -26924,12 +36041,12 @@ var ts; * Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise. */ function getThisArgumentOfCall(node) { - if (node.kind === 174 /* CallExpression */) { + if (node.kind === 179 /* CallExpression */) { var callee = node.expression; - if (callee.kind === 172 /* PropertyAccessExpression */) { + if (callee.kind === 177 /* PropertyAccessExpression */) { return callee.expression; } - else if (callee.kind === 173 /* ElementAccessExpression */) { + else if (callee.kind === 178 /* ElementAccessExpression */) { return callee.expression; } } @@ -26945,16 +36062,16 @@ var ts; */ function getEffectiveCallArguments(node) { var args; - if (node.kind === 176 /* TaggedTemplateExpression */) { + if (node.kind === 181 /* TaggedTemplateExpression */) { var template = node.template; args = [undefined]; - if (template.kind === 189 /* TemplateExpression */) { + if (template.kind === 194 /* TemplateExpression */) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); } } - else if (node.kind === 143 /* Decorator */) { + else if (node.kind === 145 /* Decorator */) { // For a decorator, we return undefined as we will determine // the number and types of arguments for a decorator using // `getEffectiveArgumentCount` and `getEffectiveArgumentType` below. @@ -26979,19 +36096,19 @@ var ts; * Otherwise, the argument count is the length of the 'args' array. */ function getEffectiveArgumentCount(node, args, signature) { - if (node.kind === 143 /* Decorator */) { + if (node.kind === 145 /* Decorator */) { switch (node.parent.kind) { - case 221 /* ClassDeclaration */: - case 192 /* ClassExpression */: + case 226 /* ClassDeclaration */: + case 197 /* ClassExpression */: // A class decorator will have one argument (see `ClassDecorator` in core.d.ts) return 1; - case 145 /* PropertyDeclaration */: + case 147 /* PropertyDeclaration */: // A property declaration decorator will have two arguments (see // `PropertyDecorator` in core.d.ts) return 2; - case 147 /* MethodDeclaration */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: + case 149 /* MethodDeclaration */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: // A method or accessor declaration decorator will have two or three arguments (see // `PropertyDecorator` and `MethodDecorator` in core.d.ts) // If we are emitting decorators for ES3, we will only pass two arguments. @@ -27001,7 +36118,7 @@ var ts; // If the method decorator signature only accepts a target and a key, we will only // type check those arguments. return signature.parameters.length >= 3 ? 3 : 2; - case 142 /* Parameter */: + case 144 /* Parameter */: // A parameter declaration decorator will have three arguments (see // `ParameterDecorator` in core.d.ts) return 3; @@ -27025,25 +36142,25 @@ var ts; */ function getEffectiveDecoratorFirstArgumentType(node) { // The first argument to a decorator is its `target`. - if (node.kind === 221 /* ClassDeclaration */) { + if (node.kind === 226 /* ClassDeclaration */) { // For a class decorator, the `target` is the type of the class (e.g. the // "static" or "constructor" side of the class) var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } - if (node.kind === 142 /* Parameter */) { + if (node.kind === 144 /* Parameter */) { // For a parameter decorator, the `target` is the parent type of the // parameter's containing method. node = node.parent; - if (node.kind === 148 /* Constructor */) { + if (node.kind === 150 /* Constructor */) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } } - if (node.kind === 145 /* PropertyDeclaration */ || - node.kind === 147 /* MethodDeclaration */ || - node.kind === 149 /* GetAccessor */ || - node.kind === 150 /* SetAccessor */) { + if (node.kind === 147 /* PropertyDeclaration */ || + node.kind === 149 /* MethodDeclaration */ || + node.kind === 151 /* GetAccessor */ || + node.kind === 152 /* SetAccessor */) { // For a property or method decorator, the `target` is the // "static"-side type of the parent of the member if the member is // declared "static"; otherwise, it is the "instance"-side type of the @@ -27070,32 +36187,32 @@ var ts; */ function getEffectiveDecoratorSecondArgumentType(node) { // The second argument to a decorator is its `propertyKey` - if (node.kind === 221 /* ClassDeclaration */) { + if (node.kind === 226 /* ClassDeclaration */) { ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; } - if (node.kind === 142 /* Parameter */) { + if (node.kind === 144 /* Parameter */) { node = node.parent; - if (node.kind === 148 /* Constructor */) { + if (node.kind === 150 /* Constructor */) { // For a constructor parameter decorator, the `propertyKey` will be `undefined`. return anyType; } } - if (node.kind === 145 /* PropertyDeclaration */ || - node.kind === 147 /* MethodDeclaration */ || - node.kind === 149 /* GetAccessor */ || - node.kind === 150 /* SetAccessor */) { + if (node.kind === 147 /* PropertyDeclaration */ || + node.kind === 149 /* MethodDeclaration */ || + node.kind === 151 /* GetAccessor */ || + node.kind === 152 /* SetAccessor */) { // The `propertyKey` for a property or method decorator will be a // string literal type if the member name is an identifier, number, or string; // otherwise, if the member name is a computed property name it will // be either string or symbol. var element = node; switch (element.name.kind) { - case 69 /* Identifier */: + case 70 /* Identifier */: case 8 /* NumericLiteral */: case 9 /* StringLiteral */: return getLiteralTypeForText(32 /* StringLiteral */, element.name.text); - case 140 /* ComputedPropertyName */: + case 142 /* ComputedPropertyName */: var nameType = checkComputedPropertyName(element.name); if (isTypeOfKind(nameType, 512 /* ESSymbol */)) { return nameType; @@ -27121,21 +36238,21 @@ var ts; function getEffectiveDecoratorThirdArgumentType(node) { // The third argument to a decorator is either its `descriptor` for a method decorator // or its `parameterIndex` for a parameter decorator - if (node.kind === 221 /* ClassDeclaration */) { + if (node.kind === 226 /* ClassDeclaration */) { ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 142 /* Parameter */) { + if (node.kind === 144 /* Parameter */) { // The `parameterIndex` for a parameter decorator is always a number return numberType; } - if (node.kind === 145 /* PropertyDeclaration */) { + if (node.kind === 147 /* PropertyDeclaration */) { ts.Debug.fail("Property decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 147 /* MethodDeclaration */ || - node.kind === 149 /* GetAccessor */ || - node.kind === 150 /* SetAccessor */) { + if (node.kind === 149 /* MethodDeclaration */ || + node.kind === 151 /* GetAccessor */ || + node.kind === 152 /* SetAccessor */) { // The `descriptor` for a method decorator will be a `TypedPropertyDescriptor` // for the type of the member. var propertyType = getTypeOfNode(node); @@ -27163,14 +36280,14 @@ var ts; /** * Gets the effective argument type for an argument in a call expression. */ - function getEffectiveArgumentType(node, argIndex, arg) { + function getEffectiveArgumentType(node, argIndex) { // Decorators provide special arguments, a tagged template expression provides // a special first argument, and string literals get string literal types // unless we're reporting errors - if (node.kind === 143 /* Decorator */) { + if (node.kind === 145 /* Decorator */) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 176 /* TaggedTemplateExpression */) { + else if (argIndex === 0 && node.kind === 181 /* TaggedTemplateExpression */) { return getGlobalTemplateStringsArrayType(); } // This is not a synthetic argument, so we return 'undefined' @@ -27182,8 +36299,8 @@ var ts; */ function getEffectiveArgument(node, args, argIndex) { // For a decorator or the first argument of a tagged template expression we return undefined. - if (node.kind === 143 /* Decorator */ || - (argIndex === 0 && node.kind === 176 /* TaggedTemplateExpression */)) { + if (node.kind === 145 /* Decorator */ || + (argIndex === 0 && node.kind === 181 /* TaggedTemplateExpression */)) { return undefined; } return args[argIndex]; @@ -27192,11 +36309,11 @@ var ts; * Gets the error node to use when reporting errors for an effective argument. */ function getEffectiveArgumentErrorNode(node, argIndex, arg) { - if (node.kind === 143 /* Decorator */) { + if (node.kind === 145 /* Decorator */) { // For a decorator, we use the expression of the decorator for error reporting. return node.expression; } - else if (argIndex === 0 && node.kind === 176 /* TaggedTemplateExpression */) { + else if (argIndex === 0 && node.kind === 181 /* TaggedTemplateExpression */) { // For a the first argument of a tagged template expression, we use the template of the tag for error reporting. return node.template; } @@ -27205,13 +36322,13 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray, headMessage) { - var isTaggedTemplate = node.kind === 176 /* TaggedTemplateExpression */; - var isDecorator = node.kind === 143 /* Decorator */; + var isTaggedTemplate = node.kind === 181 /* TaggedTemplateExpression */; + var isDecorator = node.kind === 145 /* Decorator */; var typeArguments; if (!isTaggedTemplate && !isDecorator) { typeArguments = node.typeArguments; // We already perform checking on the type arguments on the class declaration itself. - if (node.expression.kind !== 95 /* SuperKeyword */) { + if (node.expression.kind !== 96 /* SuperKeyword */) { ts.forEach(typeArguments, checkSourceElement); } } @@ -27277,7 +36394,7 @@ var ts; var result; // If we are in signature help, a trailing comma indicates that we intend to provide another argument, // so we will only accept overloads with arity at least 1 higher than the current number of provided arguments. - var signatureHelpTrailingComma = candidatesOutArray && node.kind === 174 /* CallExpression */ && node.arguments.hasTrailingComma; + var signatureHelpTrailingComma = candidatesOutArray && node.kind === 179 /* CallExpression */ && node.arguments.hasTrailingComma; // Section 4.12.1: // if the candidate list contains one or more signatures for which the type of each argument // expression is a subtype of each corresponding parameter type, the return type of the first @@ -27368,7 +36485,7 @@ var ts; var candidate = void 0; var typeArgumentsAreValid = void 0; var inferenceContext = originalCandidate.typeParameters - ? createInferenceContext(originalCandidate.typeParameters, /*inferUnionTypes*/ false) + ? createInferenceContext(originalCandidate, /*inferUnionTypes*/ false) : undefined; while (true) { candidate = originalCandidate; @@ -27423,7 +36540,7 @@ var ts; } } function resolveCallExpression(node, candidatesOutArray) { - if (node.expression.kind === 95 /* SuperKeyword */) { + if (node.expression.kind === 96 /* SuperKeyword */) { var superType = checkSuperExpression(node.expression); if (superType !== unknownType) { // In super call, the candidate signatures are the matching arity signatures of the base constructor function instantiated @@ -27437,6 +36554,9 @@ var ts; return resolveUntypedCall(node); } var funcType = checkNonNullExpression(node.expression); + if (funcType === silentNeverType) { + return silentNeverSignature; + } var apparentType = getApparentType(funcType); if (apparentType === unknownType) { // Another error has already been reported @@ -27448,16 +36568,10 @@ var ts; // that the user will not add any. var callSignatures = getSignaturesOfType(apparentType, 0 /* Call */); var constructSignatures = getSignaturesOfType(apparentType, 1 /* Construct */); - // TS 1.0 spec: 4.12 - // If FuncExpr is of type Any, or of an object type that has no call or construct signatures - // but is a subtype of the Function interface, the call is an untyped function call. In an - // untyped function call no TypeArgs are permitted, Args can be any argument list, no contextual + // TS 1.0 Spec: 4.12 + // In an untyped function call no TypeArgs are permitted, Args can be any argument list, no contextual // types are provided for the argument expressions, and the result is always of type Any. - // We exclude union types because we may have a union of function types that happen to have - // no common signatures. - if (isTypeAny(funcType) || - (isTypeAny(apparentType) && funcType.flags & 16384 /* TypeParameter */) || - (!callSignatures.length && !constructSignatures.length && !(funcType.flags & 524288 /* Union */) && isTypeAssignableTo(funcType, globalFunctionType))) { + if (isUntypedFunctionCall(funcType, apparentType, callSignatures.length, constructSignatures.length)) { // The unknownType indicates that an error already occurred (and was reported). No // need to report another error in this case. if (funcType !== unknownType && node.typeArguments) { @@ -27473,12 +36587,34 @@ var ts; error(node, ts.Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType)); } else { - error(node, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature); + error(node, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures, typeToString(apparentType)); } return resolveErrorCall(node); } return resolveCall(node, callSignatures, candidatesOutArray); } + /** + * TS 1.0 spec: 4.12 + * If FuncExpr is of type Any, or of an object type that has no call or construct signatures + * but is a subtype of the Function interface, the call is an untyped function call. + */ + function isUntypedFunctionCall(funcType, apparentFuncType, numCallSignatures, numConstructSignatures) { + if (isTypeAny(funcType)) { + return true; + } + if (isTypeAny(apparentFuncType) && funcType.flags & 16384 /* TypeParameter */) { + return true; + } + if (!numCallSignatures && !numConstructSignatures) { + // We exclude union types because we may have a union of function types that happen to have + // no common signatures. + if (funcType.flags & 65536 /* Union */) { + return false; + } + return isTypeAssignableTo(funcType, globalFunctionType); + } + return false; + } function resolveNewExpression(node, candidatesOutArray) { if (node.arguments && languageVersion < 1 /* ES5 */) { var spreadIndex = getSpreadArgumentIndex(node.arguments); @@ -27487,6 +36623,9 @@ var ts; } } var expressionType = checkNonNullExpression(node.expression); + if (expressionType === silentNeverType) { + return silentNeverSignature; + } // If expressionType's apparent type(section 3.8.1) is an object type with one or // more construct signatures, the expression is processed in the same manner as a // function call, but using the construct signatures as the initial set of candidate @@ -27502,7 +36641,7 @@ var ts; // In the case of a merged class-module or class-interface declaration, // only the class declaration node will have the Abstract flag set. var valueDecl = expressionType.symbol && getClassLikeDeclarationOfSymbol(expressionType.symbol); - if (valueDecl && valueDecl.flags & 128 /* Abstract */) { + if (valueDecl && ts.getModifierFlags(valueDecl) & 128 /* Abstract */) { error(node, ts.Diagnostics.Cannot_create_an_instance_of_the_abstract_class_0, ts.declarationNameToString(valueDecl.name)); return resolveErrorCall(node); } @@ -27549,9 +36688,9 @@ var ts; return true; } var declaration = signature.declaration; - var flags = declaration.flags; + var modifiers = ts.getModifierFlags(declaration); // Public constructor is accessible. - if (!(flags & (8 /* Private */ | 16 /* Protected */))) { + if (!(modifiers & 24 /* NonPublicAccessibilityModifier */)) { return true; } var declaringClassDeclaration = getClassLikeDeclarationOfSymbol(declaration.parent.symbol); @@ -27562,18 +36701,19 @@ var ts; if (containingClass) { var containingType = getTypeOfNode(containingClass); var baseTypes = getBaseTypes(containingType); - if (baseTypes.length) { + while (baseTypes.length) { var baseType = baseTypes[0]; - if (flags & 16 /* Protected */ && + if (modifiers & 16 /* Protected */ && baseType.symbol === declaration.parent.symbol) { return true; } + baseTypes = getBaseTypes(baseType); } } - if (flags & 8 /* Private */) { + if (modifiers & 8 /* Private */) { error(node, ts.Diagnostics.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration, typeToString(declaringClass)); } - if (flags & 16 /* Protected */) { + if (modifiers & 16 /* Protected */) { error(node, ts.Diagnostics.Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration, typeToString(declaringClass)); } return false; @@ -27588,11 +36728,12 @@ var ts; return resolveErrorCall(node); } var callSignatures = getSignaturesOfType(apparentType, 0 /* Call */); - if (isTypeAny(tagType) || (!callSignatures.length && !(tagType.flags & 524288 /* Union */) && isTypeAssignableTo(tagType, globalFunctionType))) { + var constructSignatures = getSignaturesOfType(apparentType, 1 /* Construct */); + if (isUntypedFunctionCall(tagType, apparentType, callSignatures.length, constructSignatures.length)) { return resolveUntypedCall(node); } if (!callSignatures.length) { - error(node, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature); + error(node, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures, typeToString(apparentType)); return resolveErrorCall(node); } return resolveCall(node, callSignatures, candidatesOutArray); @@ -27602,16 +36743,16 @@ var ts; */ function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 221 /* ClassDeclaration */: - case 192 /* ClassExpression */: + case 226 /* ClassDeclaration */: + case 197 /* ClassExpression */: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 142 /* Parameter */: + case 144 /* Parameter */: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 145 /* PropertyDeclaration */: + case 147 /* PropertyDeclaration */: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 147 /* MethodDeclaration */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: + case 149 /* MethodDeclaration */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; } } @@ -27625,13 +36766,14 @@ var ts; return resolveErrorCall(node); } var callSignatures = getSignaturesOfType(apparentType, 0 /* Call */); - if (funcType === anyType || (!callSignatures.length && !(funcType.flags & 524288 /* Union */) && isTypeAssignableTo(funcType, globalFunctionType))) { + var constructSignatures = getSignaturesOfType(apparentType, 1 /* Construct */); + if (isUntypedFunctionCall(funcType, apparentType, callSignatures.length, constructSignatures.length)) { return resolveUntypedCall(node); } var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); if (!callSignatures.length) { var errorInfo = void 0; - errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature); + errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures, typeToString(apparentType)); errorInfo = ts.chainDiagnosticMessages(errorInfo, headMessage); diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(node, errorInfo)); return resolveErrorCall(node); @@ -27640,13 +36782,13 @@ var ts; } function resolveSignature(node, candidatesOutArray) { switch (node.kind) { - case 174 /* CallExpression */: + case 179 /* CallExpression */: return resolveCallExpression(node, candidatesOutArray); - case 175 /* NewExpression */: + case 180 /* NewExpression */: return resolveNewExpression(node, candidatesOutArray); - case 176 /* TaggedTemplateExpression */: + case 181 /* TaggedTemplateExpression */: return resolveTaggedTemplateExpression(node, candidatesOutArray); - case 143 /* Decorator */: + case 145 /* Decorator */: return resolveDecorator(node, candidatesOutArray); } ts.Debug.fail("Branch in 'resolveSignature' should be unreachable."); @@ -27692,22 +36834,22 @@ var ts; // Grammar checking; stop grammar-checking if checkGrammarTypeArguments return true checkGrammarTypeArguments(node, node.typeArguments) || checkGrammarArguments(node, node.arguments); var signature = getResolvedSignature(node); - if (node.expression.kind === 95 /* SuperKeyword */) { + if (node.expression.kind === 96 /* SuperKeyword */) { return voidType; } - if (node.kind === 175 /* NewExpression */) { + if (node.kind === 180 /* NewExpression */) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 148 /* Constructor */ && - declaration.kind !== 152 /* ConstructSignature */ && - declaration.kind !== 157 /* ConstructorType */ && + declaration.kind !== 150 /* Constructor */ && + declaration.kind !== 154 /* ConstructSignature */ && + declaration.kind !== 159 /* ConstructorType */ && !ts.isJSDocConstructSignature(declaration)) { // When resolved signature is a call signature (and not a construct signature) the result type is any, unless // the declaring function had members created through 'x.prototype.y = expr' or 'this.y = expr' psuedodeclarations // in a JS file // Note:JS inferred classes might come from a variable declaration instead of a function declaration. // In this case, using getResolvedSymbol directly is required to avoid losing the members from the declaration. - var funcSymbol = node.expression.kind === 69 /* Identifier */ ? + var funcSymbol = node.expression.kind === 70 /* Identifier */ ? getResolvedSymbol(node.expression) : checkExpression(node.expression).symbol; if (funcSymbol && funcSymbol.members && (funcSymbol.flags & 16 /* Function */ || ts.isDeclarationOfFunctionExpression(funcSymbol))) { @@ -27720,16 +36862,42 @@ var ts; } } // In JavaScript files, calls to any identifier 'require' are treated as external module imports - if (ts.isInJavaScriptFile(node) && ts.isRequireCall(node, /*checkArgumentIsStringLiteral*/ true)) { + if (ts.isInJavaScriptFile(node) && isCommonJsRequire(node)) { return resolveExternalModuleTypeByLiteral(node.arguments[0]); } return getReturnTypeOfSignature(signature); } + function isCommonJsRequire(node) { + if (!ts.isRequireCall(node, /*checkArgumentIsStringLiteral*/ true)) { + return false; + } + // Make sure require is not a local function + var resolvedRequire = resolveName(node.expression, node.expression.text, 107455 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); + if (!resolvedRequire) { + // project does not contain symbol named 'require' - assume commonjs require + return true; + } + // project includes symbol named 'require' - make sure that it it ambient and local non-alias + if (resolvedRequire.flags & 8388608 /* Alias */) { + return false; + } + var targetDeclarationKind = resolvedRequire.flags & 16 /* Function */ + ? 225 /* FunctionDeclaration */ + : resolvedRequire.flags & 3 /* Variable */ + ? 223 /* VariableDeclaration */ + : 0 /* Unknown */; + if (targetDeclarationKind !== 0 /* Unknown */) { + var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); + // function/variable declaration should be ambient + return ts.isInAmbientContext(decl); + } + return false; + } function checkTaggedTemplateExpression(node) { return getReturnTypeOfSignature(getResolvedSignature(node)); } function checkAssertion(node) { - var exprType = getRegularTypeOfObjectLiteral(checkExpression(node.expression)); + var exprType = getRegularTypeOfObjectLiteral(getBaseTypeOfLiteralType(checkExpression(node.expression))); checkSourceElement(node.type); var targetType = getTypeFromTypeNode(node.type); if (produceDiagnostics && targetType !== unknownType) { @@ -27760,21 +36928,36 @@ var ts; } function assignContextualParameterTypes(signature, context, mapper) { var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); - if (context.thisParameter) { - if (!signature.thisParameter) { - signature.thisParameter = createTransientSymbol(context.thisParameter, undefined); + if (isInferentialContext(mapper)) { + for (var i = 0; i < len; i++) { + var declaration = signature.parameters[i].valueDeclaration; + if (declaration.type) { + inferTypesWithContext(mapper.context, getTypeFromTypeNode(declaration.type), getTypeAtPosition(context, i)); + } + } + } + if (context.thisParameter) { + var parameter = signature.thisParameter; + if (!parameter || parameter.valueDeclaration && !parameter.valueDeclaration.type) { + if (!parameter) { + signature.thisParameter = createTransientSymbol(context.thisParameter, undefined); + } + assignTypeToParameterAndFixTypeParameters(signature.thisParameter, getTypeOfSymbol(context.thisParameter), mapper); } - assignTypeToParameterAndFixTypeParameters(signature.thisParameter, getTypeOfSymbol(context.thisParameter), mapper); } for (var i = 0; i < len; i++) { var parameter = signature.parameters[i]; - var contextualParameterType = getTypeAtPosition(context, i); - assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); + if (!parameter.valueDeclaration.type) { + var contextualParameterType = getTypeAtPosition(context, i); + assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); + } } if (signature.hasRestParameter && isRestParameterIndex(context, signature.parameters.length - 1)) { var parameter = ts.lastOrUndefined(signature.parameters); - var contextualParameterType = getTypeOfSymbol(ts.lastOrUndefined(context.parameters)); - assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); + if (!parameter.valueDeclaration.type) { + var contextualParameterType = getTypeOfSymbol(ts.lastOrUndefined(context.parameters)); + assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); + } } } // When contextual typing assigns a type to a parameter that contains a binding pattern, we also need to push @@ -27783,8 +36966,8 @@ var ts; if (ts.isBindingPattern(node.name)) { for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 193 /* OmittedExpression */) { - if (element.name.kind === 69 /* Identifier */) { + if (!ts.isOmittedExpression(element)) { + if (element.name.kind === 70 /* Identifier */) { getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element); } assignBindingElementTypes(element); @@ -27798,8 +36981,8 @@ var ts; links.type = instantiateType(contextualType, mapper); // if inference didn't come up with anything but {}, fall back to the binding pattern if present. if (links.type === emptyObjectType && - (parameter.valueDeclaration.name.kind === 167 /* ObjectBindingPattern */ || - parameter.valueDeclaration.name.kind === 168 /* ArrayBindingPattern */)) { + (parameter.valueDeclaration.name.kind === 172 /* ObjectBindingPattern */ || + parameter.valueDeclaration.name.kind === 173 /* ArrayBindingPattern */)) { links.type = getTypeFromBindingPattern(parameter.valueDeclaration.name); } assignBindingElementTypes(parameter.valueDeclaration); @@ -27834,7 +37017,7 @@ var ts; // T in the second overload so that we do not infer Base as a candidate for T // (inferring Base would make type argument inference inconsistent between the two // overloads). - inferTypes(mapper.context, links.type, instantiateType(contextualType, mapper)); + inferTypesWithContext(mapper.context, links.type, instantiateType(contextualType, mapper)); } } function getReturnTypeFromJSDocComment(func) { @@ -27857,7 +37040,7 @@ var ts; function createPromiseReturnType(func, promisedType) { var promiseType = createPromiseType(promisedType); if (promiseType === emptyObjectType) { - error(func, ts.Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type); + error(func, ts.Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option); return unknownType; } return promiseType; @@ -27869,7 +37052,7 @@ var ts; } var isAsync = ts.isAsyncFunctionLike(func); var type; - if (func.body.kind !== 199 /* Block */) { + if (func.body.kind !== 204 /* Block */) { type = checkExpressionCached(func.body, contextualMapper); if (isAsync) { // From within an async function you can return either a non-promise value or a promise. Any @@ -27903,20 +37086,8 @@ var ts; return isAsync ? createPromiseReturnType(func, voidType) : voidType; } } - // When yield/return statements are contextually typed we allow the return type to be a union type. - // Otherwise we require the yield/return expressions to have a best common supertype. - type = contextualSignature ? getUnionType(types, /*subtypeReduction*/ true) : getCommonSupertype(types); - if (!type) { - if (funcIsGenerator) { - error(func, ts.Diagnostics.No_best_common_type_exists_among_yield_expressions); - return createIterableIteratorType(unknownType); - } - else { - error(func, ts.Diagnostics.No_best_common_type_exists_among_return_expressions); - // Defer to unioning the return types so we get a) downstream errors earlier and b) better Salsa experience - return isAsync ? createPromiseReturnType(func, getUnionType(types, /*subtypeReduction*/ true)) : getUnionType(types, /*subtypeReduction*/ true); - } - } + // Return a union of the return expression types. + type = getUnionType(types, /*subtypeReduction*/ true); if (funcIsGenerator) { type = createIterableIteratorType(type); } @@ -27924,6 +37095,11 @@ var ts; if (!contextualSignature) { reportErrorsFromWidening(func, type); } + if (isUnitType(type) && + !(contextualSignature && + isLiteralContextualType(contextualSignature === getSignatureFromDeclaration(func) ? type : getReturnTypeOfSignature(contextualSignature)))) { + type = getWidenedLiteralType(type); + } var widenedType = getWidenedType(type); // From within an async function you can return either a non-promise value or a promise. Any // Promise/A+ compatible implementation will always assimilate any foreign promise, so the @@ -27951,22 +37127,22 @@ var ts; if (!node.possiblyExhaustive) { return false; } - var type = checkExpression(node.expression); - if (!isUnitUnionType(type)) { + var type = getTypeOfExpression(node.expression); + if (!isLiteralType(type)) { return false; } var switchTypes = getSwitchClauseTypes(node); if (!switchTypes.length) { return false; } - return eachTypeContainedIn(type, switchTypes); + return eachTypeContainedIn(mapType(type, getRegularTypeOfLiteralType), switchTypes); } function functionHasImplicitReturn(func) { - if (!(func.flags & 32768 /* HasImplicitReturn */)) { + if (!(func.flags & 128 /* HasImplicitReturn */)) { return false; } var lastStatement = ts.lastOrUndefined(func.body.statements); - if (lastStatement && lastStatement.kind === 213 /* SwitchStatement */ && isExhaustiveSwitchStatement(lastStatement)) { + if (lastStatement && lastStatement.kind === 218 /* SwitchStatement */ && isExhaustiveSwitchStatement(lastStatement)) { return false; } return true; @@ -27987,7 +37163,7 @@ var ts; // the native Promise type by the caller. type = checkAwaitedType(type, func, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); } - if (type === neverType) { + if (type.flags & 8192 /* Never */) { hasReturnOfTypeNever = true; } else if (!ts.contains(aggregatedTypes, type)) { @@ -27999,7 +37175,7 @@ var ts; } }); if (aggregatedTypes.length === 0 && !hasReturnWithNoExpression && (hasReturnOfTypeNever || - func.kind === 179 /* FunctionExpression */ || func.kind === 180 /* ArrowFunction */)) { + func.kind === 184 /* FunctionExpression */ || func.kind === 185 /* ArrowFunction */)) { return undefined; } if (strictNullChecks && aggregatedTypes.length && hasReturnWithNoExpression) { @@ -28028,11 +37204,11 @@ var ts; } // If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check. // also if HasImplicitReturn flag is not set this means that all codepaths in function body end with return or throw - if (ts.nodeIsMissing(func.body) || func.body.kind !== 199 /* Block */ || !functionHasImplicitReturn(func)) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 204 /* Block */ || !functionHasImplicitReturn(func)) { return; } - var hasExplicitReturn = func.flags & 65536 /* HasExplicitReturn */; - if (returnType === neverType) { + var hasExplicitReturn = func.flags & 256 /* HasExplicitReturn */; + if (returnType && returnType.flags & 8192 /* Never */) { error(func.type, ts.Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point); } else if (returnType && !hasExplicitReturn) { @@ -28061,10 +37237,10 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { - ts.Debug.assert(node.kind !== 147 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 149 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); // Grammar checking var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 179 /* FunctionExpression */) { + if (!hasGrammarError && node.kind === 184 /* FunctionExpression */) { checkGrammarForGenerator(node); } // The identityMapper object is used to indicate that function expressions are wildcards @@ -28105,14 +37281,14 @@ var ts; } } } - if (produceDiagnostics && node.kind !== 147 /* MethodDeclaration */ && node.kind !== 146 /* MethodSignature */) { + if (produceDiagnostics && node.kind !== 149 /* MethodDeclaration */) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); } return type; } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { - ts.Debug.assert(node.kind !== 147 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 149 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var isAsync = ts.isAsyncFunctionLike(node); var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); if (!node.asteriskToken) { @@ -28128,7 +37304,7 @@ var ts; // checkFunctionExpressionBodies). So it must be done now. getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 199 /* Block */) { + if (node.body.kind === 204 /* Block */) { checkSourceElement(node.body); } else { @@ -28166,8 +37342,8 @@ var ts; // Enum members // Unions and intersections of the above (unions and intersections eagerly set isReadonly on creation) return symbol.isReadonly || - symbol.flags & 4 /* Property */ && (getDeclarationFlagsFromSymbol(symbol) & 64 /* Readonly */) !== 0 || - symbol.flags & 3 /* Variable */ && (getDeclarationFlagsFromSymbol(symbol) & 2048 /* Const */) !== 0 || + symbol.flags & 4 /* Property */ && (getDeclarationModifierFlagsFromSymbol(symbol) & 64 /* Readonly */) !== 0 || + symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 2 /* Const */) !== 0 || symbol.flags & 98304 /* Accessor */ && !(symbol.flags & 65536 /* SetAccessor */) || (symbol.flags & 8 /* EnumMember */) !== 0; } @@ -28175,11 +37351,11 @@ var ts; if (isReadonlySymbol(symbol)) { // Allow assignments to readonly properties within constructors of the same class declaration. if (symbol.flags & 4 /* Property */ && - (expr.kind === 172 /* PropertyAccessExpression */ || expr.kind === 173 /* ElementAccessExpression */) && - expr.expression.kind === 97 /* ThisKeyword */) { + (expr.kind === 177 /* PropertyAccessExpression */ || expr.kind === 178 /* ElementAccessExpression */) && + expr.expression.kind === 98 /* ThisKeyword */) { // Look for if this is the constructor for the class that `symbol` is a property of. var func = ts.getContainingFunction(expr); - if (!(func && func.kind === 148 /* Constructor */)) + if (!(func && func.kind === 150 /* Constructor */)) return true; // If func.parent is a class and symbol is a (readonly) property of that class, or // if func is a constructor and symbol is a (readonly) parameter property declared in it, @@ -28191,50 +37367,25 @@ var ts; return false; } function isReferenceThroughNamespaceImport(expr) { - if (expr.kind === 172 /* PropertyAccessExpression */ || expr.kind === 173 /* ElementAccessExpression */) { - var node = skipParenthesizedNodes(expr.expression); - if (node.kind === 69 /* Identifier */) { + if (expr.kind === 177 /* PropertyAccessExpression */ || expr.kind === 178 /* ElementAccessExpression */) { + var node = ts.skipParentheses(expr.expression); + if (node.kind === 70 /* Identifier */) { var symbol = getNodeLinks(node).resolvedSymbol; if (symbol.flags & 8388608 /* Alias */) { var declaration = getDeclarationOfAliasSymbol(symbol); - return declaration && declaration.kind === 232 /* NamespaceImport */; + return declaration && declaration.kind === 237 /* NamespaceImport */; } } } return false; } - function checkReferenceExpression(expr, invalidReferenceMessage, constantVariableMessage) { + function checkReferenceExpression(expr, invalidReferenceMessage) { // References are combinations of identifiers, parentheses, and property accesses. - var node = skipParenthesizedNodes(expr); - if (node.kind !== 69 /* Identifier */ && node.kind !== 172 /* PropertyAccessExpression */ && node.kind !== 173 /* ElementAccessExpression */) { + var node = ts.skipParentheses(expr); + if (node.kind !== 70 /* Identifier */ && node.kind !== 177 /* PropertyAccessExpression */ && node.kind !== 178 /* ElementAccessExpression */) { error(expr, invalidReferenceMessage); return false; } - // Because we get the symbol from the resolvedSymbol property, it might be of kind - // SymbolFlags.ExportValue. In this case it is necessary to get the actual export - // symbol, which will have the correct flags set on it. - var links = getNodeLinks(node); - var symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol); - if (symbol) { - if (symbol !== unknownSymbol && symbol !== argumentsSymbol) { - // Only variables (and not functions, classes, namespaces, enum objects, or enum members) - // are considered references when referenced using a simple identifier. - if (node.kind === 69 /* Identifier */ && !(symbol.flags & 3 /* Variable */)) { - error(expr, invalidReferenceMessage); - return false; - } - if (isReferenceToReadonlyEntity(node, symbol) || isReferenceThroughNamespaceImport(node)) { - error(expr, constantVariableMessage); - return false; - } - } - } - else if (node.kind === 173 /* ElementAccessExpression */) { - if (links.resolvedIndexInfo && links.resolvedIndexInfo.isReadonly) { - error(expr, constantVariableMessage); - return false; - } - } return true; } function checkDeleteExpression(node) { @@ -28252,7 +37403,7 @@ var ts; function checkAwaitExpression(node) { // Grammar checking if (produceDiagnostics) { - if (!(node.flags & 33554432 /* AwaitContext */)) { + if (!(node.flags & 16384 /* AwaitContext */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function); } if (isInParameterInitializerBeforeContainingFunction(node)) { @@ -28264,28 +37415,31 @@ var ts; } function checkPrefixUnaryExpression(node) { var operandType = checkExpression(node.operand); - if (node.operator === 36 /* MinusToken */ && node.operand.kind === 8 /* NumericLiteral */ && isLiteralContextForType(node, numberType)) { - return getLiteralTypeForText(64 /* NumberLiteral */, "" + -node.operand.text); + if (operandType === silentNeverType) { + return silentNeverType; + } + if (node.operator === 37 /* MinusToken */ && node.operand.kind === 8 /* NumericLiteral */) { + return getFreshTypeOfLiteralType(getLiteralTypeForText(64 /* NumberLiteral */, "" + -node.operand.text)); } switch (node.operator) { - case 35 /* PlusToken */: - case 36 /* MinusToken */: - case 50 /* TildeToken */: + case 36 /* PlusToken */: + case 37 /* MinusToken */: + case 51 /* TildeToken */: if (maybeTypeOfKind(operandType, 512 /* ESSymbol */)) { error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator)); } return numberType; - case 49 /* ExclamationToken */: + case 50 /* ExclamationToken */: var facts = getTypeFacts(operandType) & (1048576 /* Truthy */ | 2097152 /* Falsy */); return facts === 1048576 /* Truthy */ ? falseType : facts === 2097152 /* Falsy */ ? trueType : booleanType; - case 41 /* PlusPlusToken */: - case 42 /* MinusMinusToken */: + case 42 /* PlusPlusToken */: + case 43 /* MinusMinusToken */: var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { // run check only if former checks succeeded to avoid reporting cascading errors - checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property); + checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access); } return numberType; } @@ -28293,10 +37447,13 @@ var ts; } function checkPostfixUnaryExpression(node) { var operandType = checkExpression(node.operand); + if (operandType === silentNeverType) { + return silentNeverType; + } var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { // run check only if former checks succeeded to avoid reporting cascading errors - checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_or_a_read_only_property); + checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access); } return numberType; } @@ -28306,10 +37463,10 @@ var ts; if (type.flags & kind) { return true; } - if (type.flags & 1572864 /* UnionOrIntersection */) { + if (type.flags & 196608 /* UnionOrIntersection */) { var types = type.types; - for (var _i = 0, types_13 = types; _i < types_13.length; _i++) { - var t = types_13[_i]; + for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { + var t = types_15[_i]; if (maybeTypeOfKind(t, kind)) { return true; } @@ -28324,20 +37481,20 @@ var ts; if (type.flags & kind) { return true; } - if (type.flags & 524288 /* Union */) { + if (type.flags & 65536 /* Union */) { var types = type.types; - for (var _i = 0, types_14 = types; _i < types_14.length; _i++) { - var t = types_14[_i]; + for (var _i = 0, types_16 = types; _i < types_16.length; _i++) { + var t = types_16[_i]; if (!isTypeOfKind(t, kind)) { return false; } } return true; } - if (type.flags & 1048576 /* Intersection */) { + if (type.flags & 131072 /* Intersection */) { var types = type.types; - for (var _a = 0, types_15 = types; _a < types_15.length; _a++) { - var t = types_15[_a]; + for (var _a = 0, types_17 = types; _a < types_17.length; _a++) { + var t = types_17[_a]; if (isTypeOfKind(t, kind)) { return true; } @@ -28346,12 +37503,15 @@ var ts; return false; } function isConstEnumObjectType(type) { - return type.flags & (2588672 /* ObjectType */ | 2097152 /* Anonymous */) && type.symbol && isConstEnumSymbol(type.symbol); + return getObjectFlags(type) & 16 /* Anonymous */ && type.symbol && isConstEnumSymbol(type.symbol); } function isConstEnumSymbol(symbol) { return (symbol.flags & 128 /* ConstEnum */) !== 0; } function checkInstanceOfExpression(left, right, leftType, rightType) { + if (leftType === silentNeverType || rightType === silentNeverType) { + return silentNeverType; + } // TypeScript 1.0 spec (April 2014): 4.15.4 // The instanceof operator requires the left operand to be of type Any, an object type, or a type parameter type, // and the right operand to be of type Any or a subtype of the 'Function' interface type. @@ -28367,43 +37527,47 @@ var ts; return booleanType; } function checkInExpression(left, right, leftType, rightType) { + if (leftType === silentNeverType || rightType === silentNeverType) { + return silentNeverType; + } // TypeScript 1.0 spec (April 2014): 4.15.5 // 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, 2588672 /* ObjectType */ | 16384 /* TypeParameter */)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 /* Object */ | 540672 /* TypeVariable */)) { 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; } - function checkObjectLiteralAssignment(node, sourceType, contextualMapper) { + function checkObjectLiteralAssignment(node, sourceType) { var properties = node.properties; - for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) { - var p = properties_3[_i]; - checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, contextualMapper); + for (var _i = 0, properties_6 = properties; _i < properties_6.length; _i++) { + var p = properties_6[_i]; + checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, properties); } return sourceType; } - function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, contextualMapper) { - if (property.kind === 253 /* PropertyAssignment */ || property.kind === 254 /* ShorthandPropertyAssignment */) { - var name_14 = property.name; - if (name_14.kind === 140 /* ComputedPropertyName */) { - checkComputedPropertyName(name_14); + /** 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_20 = property.name; + if (name_20.kind === 142 /* ComputedPropertyName */) { + checkComputedPropertyName(name_20); } - if (isComputedNonLiteralName(name_14)) { + if (isComputedNonLiteralName(name_20)) { return undefined; } - var text = getTextOfPropertyName(name_14); + var text = ts.getTextOfPropertyName(name_20); var type = isTypeAny(objectLiteralType) ? objectLiteralType : getTypeOfPropertyOfType(objectLiteralType, text) || isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, 1 /* Number */) || getIndexTypeOfType(objectLiteralType, 0 /* String */); if (type) { - if (property.kind === 254 /* ShorthandPropertyAssignment */) { + if (property.kind === 258 /* ShorthandPropertyAssignment */) { return checkDestructuringAssignment(property, type); } else { @@ -28412,9 +37576,22 @@ var ts; } } else { - error(name_14, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), ts.declarationNameToString(name_14)); + 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 (languageVersion < 5 /* ESNext */) { + checkExternalEmitHelpers(property, 4 /* Rest */); + } + 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); } @@ -28433,8 +37610,8 @@ var ts; function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, contextualMapper) { var elements = node.elements; var element = elements[elementIndex]; - if (element.kind !== 193 /* OmittedExpression */) { - if (element.kind !== 191 /* SpreadElementExpression */) { + if (element.kind !== 198 /* OmittedExpression */) { + if (element.kind !== 196 /* SpreadElement */) { var propName = "" + elementIndex; var type = isTypeAny(sourceType) ? sourceType @@ -28458,11 +37635,11 @@ var ts; } else { if (elementIndex < elements.length - 1) { - error(element, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); + error(element, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } else { var restExpression = element.expression; - if (restExpression.kind === 187 /* BinaryExpression */ && restExpression.operatorToken.kind === 56 /* EqualsToken */) { + if (restExpression.kind === 192 /* BinaryExpression */ && restExpression.operatorToken.kind === 57 /* EqualsToken */) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -28475,7 +37652,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) { var target; - if (exprOrAssignment.kind === 254 /* ShorthandPropertyAssignment */) { + if (exprOrAssignment.kind === 258 /* ShorthandPropertyAssignment */) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { // In strict null checking mode, if a default value of a non-undefined type is specified, remove @@ -28491,25 +37668,89 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 187 /* BinaryExpression */ && target.operatorToken.kind === 56 /* EqualsToken */) { + if (target.kind === 192 /* BinaryExpression */ && target.operatorToken.kind === 57 /* EqualsToken */) { checkBinaryExpression(target, contextualMapper); target = target.left; } - if (target.kind === 171 /* ObjectLiteralExpression */) { - return checkObjectLiteralAssignment(target, sourceType, contextualMapper); + if (target.kind === 176 /* ObjectLiteralExpression */) { + return checkObjectLiteralAssignment(target, sourceType); } - if (target.kind === 170 /* ArrayLiteralExpression */) { + if (target.kind === 175 /* ArrayLiteralExpression */) { return checkArrayLiteralAssignment(target, sourceType, contextualMapper); } return checkReferenceAssignment(target, sourceType, contextualMapper); } function checkReferenceAssignment(target, sourceType, contextualMapper) { var targetType = checkExpression(target, contextualMapper); - if (checkReferenceExpression(target, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property)) { + 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; } + /** + * This is a *shallow* check: An expression is side-effect-free if the + * evaluation of the expression *itself* cannot produce side effects. + * For example, x++ / 3 is side-effect free because the / operator + * does not have side effects. + * The intent is to "smell test" an expression for correctness in positions where + * its value is discarded (e.g. the left side of the comma operator). + */ + function isSideEffectFree(node) { + node = ts.skipParentheses(node); + switch (node.kind) { + case 70 /* Identifier */: + case 9 /* StringLiteral */: + case 11 /* RegularExpressionLiteral */: + case 181 /* TaggedTemplateExpression */: + case 194 /* TemplateExpression */: + case 12 /* NoSubstitutionTemplateLiteral */: + case 8 /* NumericLiteral */: + case 100 /* TrueKeyword */: + case 85 /* FalseKeyword */: + case 94 /* NullKeyword */: + case 137 /* UndefinedKeyword */: + case 184 /* FunctionExpression */: + case 197 /* ClassExpression */: + case 185 /* ArrowFunction */: + case 175 /* ArrayLiteralExpression */: + case 176 /* ObjectLiteralExpression */: + case 187 /* TypeOfExpression */: + case 201 /* NonNullExpression */: + case 247 /* JsxSelfClosingElement */: + case 246 /* JsxElement */: + return true; + case 193 /* ConditionalExpression */: + return isSideEffectFree(node.whenTrue) && + isSideEffectFree(node.whenFalse); + case 192 /* BinaryExpression */: + if (ts.isAssignmentOperator(node.operatorToken.kind)) { + return false; + } + return isSideEffectFree(node.left) && + isSideEffectFree(node.right); + case 190 /* PrefixUnaryExpression */: + case 191 /* PostfixUnaryExpression */: + // Unary operators ~, !, +, and - have no side effects. + // The rest do. + switch (node.operator) { + case 50 /* ExclamationToken */: + case 36 /* PlusToken */: + case 37 /* MinusToken */: + case 51 /* TildeToken */: + return true; + } + return false; + // Some forms listed here for clarity + case 188 /* VoidExpression */: // Explicit opt-out + case 182 /* TypeAssertionExpression */: // Not SEF, but can produce useful type warnings + case 200 /* AsExpression */: // Not SEF, but can produce useful type warnings + default: + return false; + } + } function isTypeEqualityComparableTo(source, target) { return (target.flags & 6144 /* Nullable */) !== 0 || isTypeComparableTo(source, target); } @@ -28525,34 +37766,37 @@ var ts; } function checkBinaryLikeExpression(left, operatorToken, right, contextualMapper, errorNode) { var operator = operatorToken.kind; - if (operator === 56 /* EqualsToken */ && (left.kind === 171 /* ObjectLiteralExpression */ || left.kind === 170 /* ArrayLiteralExpression */)) { + if (operator === 57 /* EqualsToken */ && (left.kind === 176 /* ObjectLiteralExpression */ || left.kind === 175 /* ArrayLiteralExpression */)) { return checkDestructuringAssignment(left, checkExpression(right, contextualMapper), contextualMapper); } var leftType = checkExpression(left, contextualMapper); var rightType = checkExpression(right, contextualMapper); switch (operator) { - case 37 /* AsteriskToken */: - case 38 /* AsteriskAsteriskToken */: - case 59 /* AsteriskEqualsToken */: - case 60 /* AsteriskAsteriskEqualsToken */: - case 39 /* SlashToken */: - case 61 /* SlashEqualsToken */: - case 40 /* PercentToken */: - case 62 /* PercentEqualsToken */: - case 36 /* MinusToken */: - case 58 /* MinusEqualsToken */: - case 43 /* LessThanLessThanToken */: - case 63 /* LessThanLessThanEqualsToken */: - case 44 /* GreaterThanGreaterThanToken */: - case 64 /* GreaterThanGreaterThanEqualsToken */: - case 45 /* GreaterThanGreaterThanGreaterThanToken */: - case 65 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 47 /* BarToken */: - case 67 /* BarEqualsToken */: - case 48 /* CaretToken */: - case 68 /* CaretEqualsToken */: - case 46 /* AmpersandToken */: - case 66 /* AmpersandEqualsToken */: + case 38 /* AsteriskToken */: + case 39 /* AsteriskAsteriskToken */: + case 60 /* AsteriskEqualsToken */: + case 61 /* AsteriskAsteriskEqualsToken */: + case 40 /* SlashToken */: + case 62 /* SlashEqualsToken */: + case 41 /* PercentToken */: + case 63 /* PercentEqualsToken */: + case 37 /* MinusToken */: + case 59 /* MinusEqualsToken */: + case 44 /* LessThanLessThanToken */: + case 64 /* LessThanLessThanEqualsToken */: + case 45 /* GreaterThanGreaterThanToken */: + case 65 /* GreaterThanGreaterThanEqualsToken */: + case 46 /* GreaterThanGreaterThanGreaterThanToken */: + case 66 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 48 /* BarToken */: + case 68 /* BarEqualsToken */: + case 49 /* CaretToken */: + case 69 /* CaretEqualsToken */: + case 47 /* AmpersandToken */: + case 67 /* AmpersandEqualsToken */: + if (leftType === silentNeverType || rightType === silentNeverType) { + return silentNeverType; + } // TypeScript 1.0 spec (April 2014): 4.19.1 // These operators require their operands to be of type Any, the Number primitive type, // or an enum type. Operands of an enum type are treated @@ -28582,8 +37826,11 @@ var ts; } } return numberType; - case 35 /* PlusToken */: - case 57 /* PlusEqualsToken */: + case 36 /* PlusToken */: + case 58 /* PlusEqualsToken */: + if (leftType === silentNeverType || rightType === silentNeverType) { + return silentNeverType; + } // TypeScript 1.0 spec (April 2014): 4.19.2 // The binary + operator requires both operands to be of the Number primitive type or an enum type, // or at least one of the operands to be of type Any or the String primitive type. @@ -28601,7 +37848,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; } @@ -28619,50 +37866,55 @@ var ts; reportOperatorError(); return anyType; } - if (operator === 57 /* PlusEqualsToken */) { + if (operator === 58 /* PlusEqualsToken */) { checkAssignmentOperator(resultType); } return resultType; - case 25 /* LessThanToken */: - case 27 /* GreaterThanToken */: - case 28 /* LessThanEqualsToken */: - case 29 /* GreaterThanEqualsToken */: + case 26 /* LessThanToken */: + case 28 /* GreaterThanToken */: + case 29 /* LessThanEqualsToken */: + case 30 /* GreaterThanEqualsToken */: if (checkForDisallowedESSymbolOperand(operator)) { + leftType = getBaseTypeOfLiteralType(leftType); + rightType = getBaseTypeOfLiteralType(rightType); if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) { reportOperatorError(); } } return booleanType; - case 30 /* EqualsEqualsToken */: - case 31 /* ExclamationEqualsToken */: - case 32 /* EqualsEqualsEqualsToken */: - case 33 /* ExclamationEqualsEqualsToken */: - var leftIsUnit = isUnitUnionType(leftType); - var rightIsUnit = isUnitUnionType(rightType); - if (!leftIsUnit || !rightIsUnit) { - leftType = leftIsUnit ? getBaseTypeOfUnitType(leftType) : leftType; - rightType = rightIsUnit ? getBaseTypeOfUnitType(rightType) : rightType; + case 31 /* EqualsEqualsToken */: + case 32 /* ExclamationEqualsToken */: + case 33 /* EqualsEqualsEqualsToken */: + case 34 /* ExclamationEqualsEqualsToken */: + var leftIsLiteral = isLiteralType(leftType); + var rightIsLiteral = isLiteralType(rightType); + if (!leftIsLiteral || !rightIsLiteral) { + leftType = leftIsLiteral ? getBaseTypeOfLiteralType(leftType) : leftType; + rightType = rightIsLiteral ? getBaseTypeOfLiteralType(rightType) : rightType; } if (!isTypeEqualityComparableTo(leftType, rightType) && !isTypeEqualityComparableTo(rightType, leftType)) { reportOperatorError(); } return booleanType; - case 91 /* InstanceOfKeyword */: + case 92 /* InstanceOfKeyword */: return checkInstanceOfExpression(left, right, leftType, rightType); - case 90 /* InKeyword */: + case 91 /* InKeyword */: return checkInExpression(left, right, leftType, rightType); - case 51 /* AmpersandAmpersandToken */: + case 52 /* AmpersandAmpersandToken */: return getTypeFacts(leftType) & 1048576 /* Truthy */ ? - includeFalsyTypes(rightType, getFalsyFlags(strictNullChecks ? leftType : getBaseTypeOfUnitType(rightType))) : + includeFalsyTypes(rightType, getFalsyFlags(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType))) : leftType; - case 52 /* BarBarToken */: + case 53 /* BarBarToken */: return getTypeFacts(leftType) & 2097152 /* Falsy */ ? getBestChoiceType(removeDefinitelyFalsyTypes(leftType), rightType) : leftType; - case 56 /* EqualsToken */: + case 57 /* EqualsToken */: checkAssignmentOperator(rightType); return getRegularTypeOfObjectLiteral(rightType); - case 24 /* CommaToken */: + case 25 /* CommaToken */: + if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left)) { + error(left, ts.Diagnostics.Left_side_of_comma_operator_is_unused_and_has_no_side_effects); + } return rightType; } // Return true if there was no error, false if there was an error. @@ -28678,30 +37930,28 @@ var ts; } function getSuggestedBooleanOperator(operator) { switch (operator) { - case 47 /* BarToken */: - case 67 /* BarEqualsToken */: - return 52 /* BarBarToken */; - case 48 /* CaretToken */: - case 68 /* CaretEqualsToken */: - return 33 /* ExclamationEqualsEqualsToken */; - case 46 /* AmpersandToken */: - case 66 /* AmpersandEqualsToken */: - return 51 /* AmpersandAmpersandToken */; + case 48 /* BarToken */: + case 68 /* BarEqualsToken */: + return 53 /* BarBarToken */; + case 49 /* CaretToken */: + case 69 /* CaretEqualsToken */: + return 34 /* ExclamationEqualsEqualsToken */; + case 47 /* AmpersandToken */: + case 67 /* AmpersandEqualsToken */: + return 52 /* AmpersandAmpersandToken */; default: return undefined; } } function checkAssignmentOperator(valueType) { - if (produceDiagnostics && operator >= 56 /* FirstAssignment */ && operator <= 68 /* LastAssignment */) { + if (produceDiagnostics && operator >= 57 /* FirstAssignment */ && operator <= 69 /* LastAssignment */) { // TypeScript 1.0 spec (April 2014): 4.17 // An assignment of the form // VarExpr = ValueExpr // requires VarExpr to be classified as a reference // A compound assignment furthermore requires VarExpr to be classified as a reference (section 4.1) // and the type of the non - compound operation to be assignable to the type of VarExpr. - var ok = checkReferenceExpression(left, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant_or_a_read_only_property); - // Use default messages - if (ok) { + if (checkReferenceExpression(left, ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access)) { // to avoid cascading errors check assignability only if 'isReference' check succeeded and no errors were reported checkTypeAssignableTo(valueType, leftType, left, /*headMessage*/ undefined); } @@ -28729,7 +37979,7 @@ var ts; function checkYieldExpression(node) { // Grammar checking if (produceDiagnostics) { - if (!(node.flags & 8388608 /* YieldContext */) || isYieldExpressionInClass(node)) { + if (!(node.flags & 4096 /* YieldContext */) || isYieldExpressionInClass(node)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body); } if (isInParameterInitializerBeforeContainingFunction(node)) { @@ -28770,63 +38020,19 @@ var ts; var type2 = checkExpression(node.whenFalse, contextualMapper); return getBestChoiceType(type1, type2); } - function typeContainsLiteralFromEnum(type, enumType) { - if (type.flags & 524288 /* Union */) { - for (var _i = 0, _a = type.types; _i < _a.length; _i++) { - var t = _a[_i]; - if (t.flags & 256 /* EnumLiteral */ && t.baseType === enumType) { - return true; - } - } - } - if (type.flags & 256 /* EnumLiteral */) { - return type.baseType === enumType; - } - return false; - } - function isLiteralContextForType(node, type) { - if (isLiteralTypeLocation(node)) { - return true; - } - var contextualType = getContextualType(node); - if (contextualType) { - if (contextualType.flags & 16384 /* TypeParameter */) { - var apparentType = getApparentTypeOfTypeParameter(contextualType); - // If the type parameter is constrained to the base primitive type we're checking for, - // consider this a literal context. For example, given a type parameter 'T extends string', - // this causes us to infer string literal types for T. - if (type === apparentType) { - return true; - } - contextualType = apparentType; - } - if (type.flags & 2 /* String */) { - return maybeTypeOfKind(contextualType, 32 /* StringLiteral */); - } - if (type.flags & 4 /* Number */) { - return maybeTypeOfKind(contextualType, (64 /* NumberLiteral */ | 256 /* EnumLiteral */)); - } - if (type.flags & 8 /* Boolean */) { - return maybeTypeOfKind(contextualType, 128 /* BooleanLiteral */); - } - if (type.flags & 16 /* Enum */) { - return typeContainsLiteralFromEnum(contextualType, type); - } - } - return false; - } function checkLiteralExpression(node) { if (node.kind === 8 /* NumericLiteral */) { checkGrammarNumericLiteral(node); } switch (node.kind) { case 9 /* StringLiteral */: - return isLiteralContextForType(node, stringType) ? getLiteralTypeForText(32 /* StringLiteral */, node.text) : stringType; + return getFreshTypeOfLiteralType(getLiteralTypeForText(32 /* StringLiteral */, node.text)); case 8 /* NumericLiteral */: - return isLiteralContextForType(node, numberType) ? getLiteralTypeForText(64 /* NumberLiteral */, node.text) : numberType; - case 99 /* TrueKeyword */: - case 84 /* FalseKeyword */: - return isLiteralContextForType(node, booleanType) ? node.kind === 99 /* TrueKeyword */ ? trueType : falseType : booleanType; + return getFreshTypeOfLiteralType(getLiteralTypeForText(64 /* NumberLiteral */, node.text)); + case 100 /* TrueKeyword */: + return trueType; + case 85 /* FalseKeyword */: + return falseType; } } function checkTemplateExpression(node) { @@ -28860,14 +38066,44 @@ var ts; } return links.resolvedType; } + function isTypeAssertion(node) { + node = ts.skipParentheses(node); + return node.kind === 182 /* TypeAssertionExpression */ || node.kind === 200 /* AsExpression */; + } + function checkDeclarationInitializer(declaration) { + var type = checkExpressionCached(declaration.initializer); + return ts.getCombinedNodeFlags(declaration) & 2 /* Const */ || + ts.getCombinedModifierFlags(declaration) & 64 /* Readonly */ && !ts.isParameterPropertyDeclaration(declaration) || + isTypeAssertion(declaration.initializer) ? type : getWidenedLiteralType(type); + } + function isLiteralContextualType(contextualType) { + if (contextualType) { + if (contextualType.flags & 540672 /* TypeVariable */) { + var apparentType = getApparentTypeOfTypeVariable(contextualType); + // If the type parameter is constrained to the base primitive type we're checking for, + // consider this a literal context. For example, given a type parameter 'T extends string', + // this causes us to infer string literal types for T. + if (apparentType.flags & (2 /* String */ | 4 /* Number */ | 8 /* Boolean */ | 16 /* Enum */)) { + return true; + } + contextualType = apparentType; + } + return maybeTypeOfKind(contextualType, (480 /* Literal */ | 262144 /* Index */)); + } + return false; + } + function checkExpressionForMutableLocation(node, contextualMapper) { + var type = checkExpression(node, contextualMapper); + return isTypeAssertion(node) || isLiteralContextualType(getContextualType(node)) ? type : getWidenedLiteralType(type); + } function checkPropertyAssignment(node, contextualMapper) { // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 140 /* ComputedPropertyName */) { + if (node.name.kind === 142 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } - return checkExpression(node.initializer, contextualMapper); + return checkExpressionForMutableLocation(node.initializer, contextualMapper); } function checkObjectLiteralMethod(node, contextualMapper) { // Grammar checking @@ -28875,7 +38111,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 140 /* ComputedPropertyName */) { + if (node.name.kind === 142 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -28896,6 +38132,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 @@ -28905,7 +38158,7 @@ var ts; // contextually typed function and arrow expressions in the initial phase. function checkExpression(node, contextualMapper) { var type; - if (node.kind === 139 /* QualifiedName */) { + if (node.kind === 141 /* QualifiedName */) { type = checkQualifiedName(node); } else { @@ -28917,9 +38170,9 @@ var ts; // - 'left' in property access // - 'object' in indexed access // - target in rhs of import statement - var ok = (node.parent.kind === 172 /* PropertyAccessExpression */ && node.parent.expression === node) || - (node.parent.kind === 173 /* ElementAccessExpression */ && node.parent.expression === node) || - ((node.kind === 69 /* Identifier */ || node.kind === 139 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 177 /* PropertyAccessExpression */ && node.parent.expression === node) || + (node.parent.kind === 178 /* ElementAccessExpression */ && node.parent.expression === node) || + ((node.kind === 70 /* Identifier */ || node.kind === 141 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); } @@ -28928,79 +38181,79 @@ var ts; } function checkExpressionWorker(node, contextualMapper) { switch (node.kind) { - case 69 /* Identifier */: + case 70 /* Identifier */: return checkIdentifier(node); - case 97 /* ThisKeyword */: + case 98 /* ThisKeyword */: return checkThisExpression(node); - case 95 /* SuperKeyword */: + case 96 /* SuperKeyword */: return checkSuperExpression(node); - case 93 /* NullKeyword */: + case 94 /* NullKeyword */: return nullWideningType; case 9 /* StringLiteral */: case 8 /* NumericLiteral */: - case 99 /* TrueKeyword */: - case 84 /* FalseKeyword */: + case 100 /* TrueKeyword */: + case 85 /* FalseKeyword */: return checkLiteralExpression(node); - case 189 /* TemplateExpression */: + case 194 /* TemplateExpression */: return checkTemplateExpression(node); - case 11 /* NoSubstitutionTemplateLiteral */: + case 12 /* NoSubstitutionTemplateLiteral */: return stringType; - case 10 /* RegularExpressionLiteral */: + case 11 /* RegularExpressionLiteral */: return globalRegExpType; - case 170 /* ArrayLiteralExpression */: + case 175 /* ArrayLiteralExpression */: return checkArrayLiteral(node, contextualMapper); - case 171 /* ObjectLiteralExpression */: + case 176 /* ObjectLiteralExpression */: return checkObjectLiteral(node, contextualMapper); - case 172 /* PropertyAccessExpression */: + case 177 /* PropertyAccessExpression */: return checkPropertyAccessExpression(node); - case 173 /* ElementAccessExpression */: + case 178 /* ElementAccessExpression */: return checkIndexedAccess(node); - case 174 /* CallExpression */: - case 175 /* NewExpression */: + case 179 /* CallExpression */: + case 180 /* NewExpression */: return checkCallExpression(node); - case 176 /* TaggedTemplateExpression */: + case 181 /* TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 178 /* ParenthesizedExpression */: + case 183 /* ParenthesizedExpression */: return checkExpression(node.expression, contextualMapper); - case 192 /* ClassExpression */: + case 197 /* ClassExpression */: return checkClassExpression(node); - case 179 /* FunctionExpression */: - case 180 /* ArrowFunction */: + case 184 /* FunctionExpression */: + case 185 /* ArrowFunction */: return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 182 /* TypeOfExpression */: + case 187 /* TypeOfExpression */: return checkTypeOfExpression(node); - case 177 /* TypeAssertionExpression */: - case 195 /* AsExpression */: + case 182 /* TypeAssertionExpression */: + case 200 /* AsExpression */: return checkAssertion(node); - case 196 /* NonNullExpression */: + case 201 /* NonNullExpression */: return checkNonNullAssertion(node); - case 181 /* DeleteExpression */: + case 186 /* DeleteExpression */: return checkDeleteExpression(node); - case 183 /* VoidExpression */: + case 188 /* VoidExpression */: return checkVoidExpression(node); - case 184 /* AwaitExpression */: + case 189 /* AwaitExpression */: return checkAwaitExpression(node); - case 185 /* PrefixUnaryExpression */: + case 190 /* PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); - case 186 /* PostfixUnaryExpression */: + case 191 /* PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); - case 187 /* BinaryExpression */: + case 192 /* BinaryExpression */: return checkBinaryExpression(node, contextualMapper); - case 188 /* ConditionalExpression */: + case 193 /* ConditionalExpression */: return checkConditionalExpression(node, contextualMapper); - case 191 /* SpreadElementExpression */: - return checkSpreadElementExpression(node, contextualMapper); - case 193 /* OmittedExpression */: + case 196 /* SpreadElement */: + return checkSpreadExpression(node, contextualMapper); + case 198 /* OmittedExpression */: return undefinedWideningType; - case 190 /* YieldExpression */: + case 195 /* YieldExpression */: return checkYieldExpression(node); - case 248 /* JsxExpression */: + case 252 /* JsxExpression */: return checkJsxExpression(node); - case 241 /* JsxElement */: + case 246 /* JsxElement */: return checkJsxElement(node); - case 242 /* JsxSelfClosingElement */: + case 247 /* JsxSelfClosingElement */: return checkJsxSelfClosingElement(node); - case 243 /* JsxOpeningElement */: + case 248 /* JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -29026,9 +38279,9 @@ var ts; checkGrammarDecorators(node) || checkGrammarModifiers(node); checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); - if (node.flags & 92 /* ParameterPropertyModifier */) { + if (ts.getModifierFlags(node) & 92 /* ParameterPropertyModifier */) { func = ts.getContainingFunction(node); - if (!(func.kind === 148 /* Constructor */ && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 150 /* Constructor */ && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } @@ -29039,7 +38292,7 @@ var ts; if (ts.indexOf(func.parameters, node) !== 0) { error(node, ts.Diagnostics.A_this_parameter_must_be_the_first_parameter); } - if (func.kind === 148 /* Constructor */ || func.kind === 152 /* ConstructSignature */ || func.kind === 157 /* ConstructorType */) { + if (func.kind === 150 /* Constructor */ || func.kind === 154 /* ConstructSignature */ || func.kind === 159 /* ConstructorType */) { error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); } } @@ -29053,15 +38306,15 @@ var ts; if (!node.asteriskToken || !node.body) { return false; } - return node.kind === 147 /* MethodDeclaration */ || - node.kind === 220 /* FunctionDeclaration */ || - node.kind === 179 /* FunctionExpression */; + return node.kind === 149 /* MethodDeclaration */ || + node.kind === 225 /* FunctionDeclaration */ || + node.kind === 184 /* FunctionExpression */; } function getTypePredicateParameterIndex(parameterList, parameter) { if (parameterList) { for (var i = 0; i < parameterList.length; i++) { var param = parameterList[i]; - if (param.name.kind === 69 /* Identifier */ && + if (param.name.kind === 70 /* Identifier */ && param.name.text === parameter.text) { return i; } @@ -29091,16 +38344,16 @@ var ts; } else { var leadingError = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type); - checkTypeAssignableTo(typePredicate.type, getTypeOfNode(parent.parameters[typePredicate.parameterIndex]), node.type, + checkTypeAssignableTo(typePredicate.type, getTypeOfNode(parent.parameters[typePredicate.parameterIndex]), node.type, /*headMessage*/ undefined, leadingError); } } else if (parameterName) { var hasReportedError = false; for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) { - var name_15 = _a[_i].name; - if (ts.isBindingPattern(name_15) && - checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_15, parameterName, typePredicate.parameterName)) { + var name_21 = _a[_i].name; + if (ts.isBindingPattern(name_21) && + checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_21, parameterName, typePredicate.parameterName)) { hasReportedError = true; break; } @@ -29113,13 +38366,13 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { - case 180 /* ArrowFunction */: - case 151 /* CallSignature */: - case 220 /* FunctionDeclaration */: - case 179 /* FunctionExpression */: - case 156 /* FunctionType */: - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: + case 185 /* ArrowFunction */: + case 153 /* CallSignature */: + case 225 /* FunctionDeclaration */: + case 184 /* FunctionExpression */: + case 158 /* FunctionType */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: var parent_10 = node.parent; if (node === parent_10.type) { return parent_10; @@ -29128,15 +38381,19 @@ var ts; } function checkIfTypePredicateVariableIsDeclaredInBindingPattern(pattern, predicateVariableNode, predicateVariableName) { for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { - var name_16 = _a[_i].name; - if (name_16.kind === 69 /* Identifier */ && - name_16.text === predicateVariableName) { + var element = _a[_i]; + if (ts.isOmittedExpression(element)) { + continue; + } + 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_16.kind === 168 /* ArrayBindingPattern */ || - name_16.kind === 167 /* ObjectBindingPattern */) { - if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_16, predicateVariableNode, predicateVariableName)) { + else if (name_22.kind === 173 /* ArrayBindingPattern */ || + name_22.kind === 172 /* ObjectBindingPattern */) { + if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_22, predicateVariableNode, predicateVariableName)) { return true; } } @@ -29144,14 +38401,20 @@ var ts; } function checkSignatureDeclaration(node) { // Grammar checking - if (node.kind === 153 /* IndexSignature */) { + if (node.kind === 155 /* IndexSignature */) { checkGrammarIndexSignature(node); } - else if (node.kind === 156 /* FunctionType */ || node.kind === 220 /* FunctionDeclaration */ || node.kind === 157 /* ConstructorType */ || - node.kind === 151 /* CallSignature */ || node.kind === 148 /* Constructor */ || - node.kind === 152 /* ConstructSignature */) { + else if (node.kind === 158 /* FunctionType */ || node.kind === 225 /* FunctionDeclaration */ || node.kind === 159 /* ConstructorType */ || + node.kind === 153 /* CallSignature */ || node.kind === 150 /* Constructor */ || + node.kind === 154 /* ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); } + if (ts.isAsyncFunctionLike(node) && languageVersion < 4 /* ES2017 */) { + checkExternalEmitHelpers(node, 64 /* Awaiter */); + if (languageVersion < 2 /* ES2015 */) { + checkExternalEmitHelpers(node, 128 /* Generator */); + } + } checkTypeParameters(node.typeParameters); ts.forEach(node.parameters, checkParameter); if (node.type) { @@ -29161,16 +38424,16 @@ var ts; checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 152 /* ConstructSignature */: + case 154 /* ConstructSignature */: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 151 /* CallSignature */: + case 153 /* CallSignature */: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } } if (node.type) { - if (languageVersion >= 2 /* ES6 */ && isSyntacticallyValidGenerator(node)) { + if (languageVersion >= 2 /* ES2015 */ && isSyntacticallyValidGenerator(node)) { var returnType = getTypeFromTypeNode(node.type); if (returnType === voidType) { error(node.type, ts.Diagnostics.A_generator_cannot_have_a_void_type_annotation); @@ -29207,7 +38470,7 @@ var ts; var staticNames = ts.createMap(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 148 /* Constructor */) { + if (member.kind === 150 /* Constructor */) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var param = _c[_b]; if (ts.isParameterPropertyDeclaration(param)) { @@ -29216,18 +38479,18 @@ var ts; } } else { - var isStatic = ts.forEach(member.modifiers, function (m) { return m.kind === 113 /* StaticKeyword */; }); + var isStatic = ts.forEach(member.modifiers, function (m) { return m.kind === 114 /* StaticKeyword */; }); var names = isStatic ? staticNames : instanceNames; var memberName = member.name && ts.getPropertyNameForPropertyNameNode(member.name); if (memberName) { switch (member.kind) { - case 149 /* GetAccessor */: + case 151 /* GetAccessor */: addName(names, member.name, memberName, 1 /* Getter */); break; - case 150 /* SetAccessor */: + case 152 /* SetAccessor */: addName(names, member.name, memberName, 2 /* Setter */); break; - case 145 /* PropertyDeclaration */: + case 147 /* PropertyDeclaration */: addName(names, member.name, memberName, 3 /* Property */); break; } @@ -29253,12 +38516,12 @@ var ts; var names = ts.createMap(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind == 144 /* PropertySignature */) { + if (member.kind == 146 /* PropertySignature */) { var memberName = void 0; switch (member.name.kind) { case 9 /* StringLiteral */: case 8 /* NumericLiteral */: - case 69 /* Identifier */: + case 70 /* Identifier */: memberName = member.name.text; break; default: @@ -29275,7 +38538,7 @@ var ts; } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 222 /* InterfaceDeclaration */) { + if (node.kind === 227 /* InterfaceDeclaration */) { var nodeSymbol = getSymbolOfNode(node); // in case of merging interface declaration it is possible that we'll enter this check procedure several times for every declaration // to prevent this run check only for the first declaration of a given kind @@ -29295,7 +38558,7 @@ var ts; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 132 /* StringKeyword */: + case 134 /* StringKeyword */: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -29303,7 +38566,7 @@ var ts; error(declaration, ts.Diagnostics.Duplicate_string_index_signature); } break; - case 130 /* NumberKeyword */: + case 132 /* NumberKeyword */: if (!seenNumericIndexer) { seenNumericIndexer = true; } @@ -29328,7 +38591,7 @@ var ts; checkFunctionOrMethodDeclaration(node); // Abstract methods cannot have an implementation. // Extra checks are to avoid reporting multiple errors relating to the "abstractness" of the node. - if (node.flags & 128 /* Abstract */ && node.body) { + if (ts.getModifierFlags(node) & 128 /* Abstract */ && node.body) { error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } } @@ -29356,7 +38619,7 @@ var ts; return n.name && containsSuperCall(n.name); } function containsSuperCall(n) { - if (ts.isSuperCallExpression(n)) { + if (ts.isSuperCall(n)) { return true; } else if (ts.isFunctionLike(n)) { @@ -29368,16 +38631,16 @@ var ts; return ts.forEachChild(n, containsSuperCall); } function markThisReferencesAsErrors(n) { - if (n.kind === 97 /* ThisKeyword */) { + if (n.kind === 98 /* ThisKeyword */) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 179 /* FunctionExpression */ && n.kind !== 220 /* FunctionDeclaration */) { + else if (n.kind !== 184 /* FunctionExpression */ && n.kind !== 225 /* FunctionDeclaration */) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 145 /* PropertyDeclaration */ && - !(n.flags & 32 /* Static */) && + return n.kind === 147 /* PropertyDeclaration */ && + !(ts.getModifierFlags(n) & 32 /* Static */) && !!n.initializer; } // TS 1.0 spec (April 2014): 8.3.2 @@ -29385,6 +38648,7 @@ var ts; // constructors of derived classes must contain at least one super call somewhere in their function body. var containingClassDecl = node.parent; if (ts.getClassExtendsHeritageClauseElement(containingClassDecl)) { + captureLexicalThis(node.parent, containingClassDecl); var classExtendsNull = classDeclarationExtendsNull(containingClassDecl); var superCall = getSuperCallInConstructor(node); if (superCall) { @@ -29397,15 +38661,15 @@ var ts; // - The constructor declares parameter properties // or the containing class declares instance member variables with initializers. var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || - ts.forEach(node.parameters, function (p) { return p.flags & 92 /* ParameterPropertyModifier */; }); + ts.forEach(node.parameters, function (p) { return ts.getModifierFlags(p) & 92 /* ParameterPropertyModifier */; }); // Skip past any prologue directives to find the first statement // to ensure that it was a super call. 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]; - if (statement.kind === 202 /* ExpressionStatement */ && ts.isSuperCallExpression(statement.expression)) { + 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; } @@ -29429,9 +38693,9 @@ var ts; checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); checkDecorators(node); checkSignatureDeclaration(node); - if (node.kind === 149 /* GetAccessor */) { - if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 32768 /* HasImplicitReturn */)) { - if (!(node.flags & 65536 /* HasExplicitReturn */)) { + if (node.kind === 151 /* GetAccessor */) { + if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 128 /* HasImplicitReturn */)) { + if (!(node.flags & 256 /* HasExplicitReturn */)) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value); } } @@ -29439,19 +38703,19 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 140 /* ComputedPropertyName */) { + if (node.name.kind === 142 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } if (!ts.hasDynamicName(node)) { // TypeScript 1.0 spec (April 2014): 8.4.3 // Accessors for the same member name must specify the same accessibility. - var otherKind = node.kind === 149 /* GetAccessor */ ? 150 /* SetAccessor */ : 149 /* GetAccessor */; + var otherKind = node.kind === 151 /* GetAccessor */ ? 152 /* SetAccessor */ : 151 /* GetAccessor */; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { - if (((node.flags & 28 /* AccessibilityModifier */) !== (otherAccessor.flags & 28 /* AccessibilityModifier */))) { + if ((ts.getModifierFlags(node) & 28 /* AccessibilityModifier */) !== (ts.getModifierFlags(otherAccessor) & 28 /* AccessibilityModifier */)) { error(node.name, ts.Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility); } - if (((node.flags & 128 /* Abstract */) !== (otherAccessor.flags & 128 /* Abstract */))) { + if (ts.hasModifier(node, 128 /* Abstract */) !== ts.hasModifier(otherAccessor, 128 /* Abstract */)) { error(node.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); } // TypeScript 1.0 spec (April 2014): 4.5 @@ -29461,11 +38725,11 @@ var ts; } } var returnType = getTypeOfAccessors(getSymbolOfNode(node)); - if (node.kind === 149 /* GetAccessor */) { + if (node.kind === 151 /* GetAccessor */) { checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); } } - if (node.parent.kind !== 171 /* ObjectLiteralExpression */) { + if (node.parent.kind !== 176 /* ObjectLiteralExpression */) { checkSourceElement(node.body); registerForUnusedIdentifiersCheck(node); } @@ -29548,16 +38812,27 @@ var ts; function checkUnionOrIntersectionType(node) { ts.forEach(node.types, checkSourceElement); } + function checkIndexedAccessType(node) { + getTypeFromIndexedAccessTypeNode(node); + } + function checkMappedType(node) { + checkSourceElement(node.typeParameter); + checkSourceElement(node.type); + var type = getTypeFromMappedTypeNode(node); + var constraintType = getConstraintTypeFromMappedType(type); + var keyType = constraintType.flags & 540672 /* TypeVariable */ ? getApparentTypeOfTypeVariable(constraintType) : constraintType; + checkTypeAssignableTo(keyType, stringType, node.typeParameter.constraint); + } function isPrivateWithinAmbient(node) { - return (node.flags & 8 /* Private */) && ts.isInAmbientContext(node); + return (ts.getModifierFlags(node) & 8 /* Private */) && ts.isInAmbientContext(node); } function getEffectiveDeclarationFlags(n, flagsToCheck) { - var flags = ts.getCombinedNodeFlags(n); + var flags = ts.getCombinedModifierFlags(n); // children of classes (even ambient classes) should not be marked as ambient or export // because those flags have no useful semantics there. - if (n.parent.kind !== 222 /* InterfaceDeclaration */ && - n.parent.kind !== 221 /* ClassDeclaration */ && - n.parent.kind !== 192 /* ClassExpression */ && + if (n.parent.kind !== 227 /* InterfaceDeclaration */ && + n.parent.kind !== 226 /* ClassDeclaration */ && + n.parent.kind !== 197 /* ClassExpression */ && ts.isInAmbientContext(n)) { if (!(flags & 2 /* Ambient */)) { // It is nested in an ambient context, which means it is automatically exported @@ -29615,7 +38890,7 @@ var ts; } } var flagsToCheck = 1 /* Export */ | 2 /* Ambient */ | 8 /* Private */ | 16 /* Protected */ | 128 /* Abstract */; - var someNodeFlags = 0; + var someNodeFlags = 0 /* None */; var allNodeFlags = flagsToCheck; var someHaveQuestionToken = false; var allHaveQuestionToken = true; @@ -29645,14 +38920,14 @@ var ts; var errorNode_1 = subsequentNode.name || subsequentNode; // TODO(jfreeman): These are methods, so handle computed name case if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - var reportError = (node.kind === 147 /* MethodDeclaration */ || node.kind === 146 /* MethodSignature */) && - (node.flags & 32 /* Static */) !== (subsequentNode.flags & 32 /* Static */); + var reportError = (node.kind === 149 /* MethodDeclaration */ || node.kind === 148 /* MethodSignature */) && + (ts.getModifierFlags(node) & 32 /* Static */) !== (ts.getModifierFlags(subsequentNode) & 32 /* Static */); // we can get here in two cases // 1. mixed static and instance class members // 2. something with the same name was defined before the set of overloads that prevents them from merging // here we'll report error only for the first case since for second we should already report error in binder if (reportError) { - var diagnostic = node.flags & 32 /* Static */ ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; + var diagnostic = ts.getModifierFlags(node) & 32 /* Static */ ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; error(errorNode_1, diagnostic); } return; @@ -29670,7 +38945,7 @@ var ts; else { // Report different errors regarding non-consecutive blocks of declarations depending on whether // the node in question is abstract. - if (node.flags & 128 /* Abstract */) { + if (ts.getModifierFlags(node) & 128 /* Abstract */) { error(errorNode, ts.Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive); } else { @@ -29684,7 +38959,7 @@ var ts; var current = declarations_4[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 222 /* InterfaceDeclaration */ || node.parent.kind === 159 /* TypeLiteral */ || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 227 /* InterfaceDeclaration */ || node.parent.kind === 161 /* TypeLiteral */ || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -29695,7 +38970,7 @@ var ts; // 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one previousDeclaration = undefined; } - if (node.kind === 220 /* FunctionDeclaration */ || node.kind === 147 /* MethodDeclaration */ || node.kind === 146 /* MethodSignature */ || node.kind === 148 /* Constructor */) { + if (node.kind === 225 /* FunctionDeclaration */ || node.kind === 149 /* MethodDeclaration */ || node.kind === 148 /* MethodSignature */ || node.kind === 150 /* Constructor */) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -29738,7 +39013,7 @@ var ts; } // Abstract methods can't have an implementation -- in particular, they don't need one. if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && - !(lastSeenNonAmbientDeclaration.flags & 128 /* Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) { + !(ts.getModifierFlags(lastSeenNonAmbientDeclaration) & 128 /* Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) { reportImplementationExpectedError(lastSeenNonAmbientDeclaration); } if (hasOverloads) { @@ -29817,20 +39092,20 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 222 /* InterfaceDeclaration */: + case 227 /* InterfaceDeclaration */: return 2097152 /* ExportType */; - case 225 /* ModuleDeclaration */: + case 230 /* ModuleDeclaration */: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ ? 4194304 /* ExportNamespace */ | 1048576 /* ExportValue */ : 4194304 /* ExportNamespace */; - case 221 /* ClassDeclaration */: - case 224 /* EnumDeclaration */: + case 226 /* ClassDeclaration */: + case 229 /* EnumDeclaration */: return 2097152 /* ExportType */ | 1048576 /* ExportValue */; - case 229 /* ImportEqualsDeclaration */: - var result_2 = 0; + case 234 /* ImportEqualsDeclaration */: + 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 */; } @@ -29867,7 +39142,7 @@ var ts; if (isTypeAny(promise)) { return undefined; } - if (promise.flags & 131072 /* Reference */) { + if (getObjectFlags(promise) & 4 /* Reference */) { if (promise.target === tryGetGlobalPromiseType() || promise.target === getGlobalPromiseLikeType()) { return promise.typeArguments[0]; @@ -29885,7 +39160,7 @@ var ts; if (thenSignatures.length === 0) { return undefined; } - var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 131072 /* NEUndefined */); + var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 524288 /* NEUndefinedOrNull */); if (isTypeAny(onfulfilledParameterType)) { return undefined; } @@ -29911,7 +39186,7 @@ var ts; function checkAwaitedType(type, location, message) { return checkAwaitedTypeWorker(type); function checkAwaitedTypeWorker(type) { - if (type.flags & 524288 /* Union */) { + if (type.flags & 65536 /* Union */) { var types = []; for (var _i = 0, _a = type.types; _i < _a.length; _i++) { var constituentType = _a[_i]; @@ -29990,56 +39265,19 @@ var ts; } } /** - * Checks that the return type provided is an instantiation of the global Promise type - * and returns the awaited type of the return type. + * Checks the return type of an async function to ensure it is a compatible + * Promise implementation. * - * @param returnType The return type of a FunctionLikeDeclaration - * @param location The node on which to report the error. + * This checks that an async function has a valid Promise-compatible return type, + * and returns the *awaited type* of the promise. An async function has a valid + * Promise-compatible return type if the resolved value of the return type has a + * construct signature that takes in an `initializer` function that in turn supplies + * a `resolve` function as one of its arguments and results in an object with a + * callable `then` signature. + * + * @param node The signature to check */ - function checkCorrectPromiseType(returnType, location) { - if (returnType === unknownType) { - // The return type already had some other error, so we ignore and return - // the unknown type. - return unknownType; - } - var globalPromiseType = getGlobalPromiseType(); - if (globalPromiseType === emptyGenericType - || globalPromiseType === getTargetType(returnType)) { - // Either we couldn't resolve the global promise type, which would have already - // reported an error, or we could resolve it and the return type is a valid type - // reference to the global type. In either case, we return the awaited type for - // the return type. - return checkAwaitedType(returnType, location, ts.Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type); - } - // The promise type was not a valid type reference to the global promise type, so we - // report an error and return the unknown type. - error(location, ts.Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type); - return unknownType; - } - /** - * Checks the return type of an async function to ensure it is a compatible - * Promise implementation. - * @param node The signature to check - * @param returnType The return type for the function - * @remarks - * This checks that an async function has a valid Promise-compatible return type, - * and returns the *awaited type* of the promise. An async function has a valid - * Promise-compatible return type if the resolved value of the return type has a - * construct signature that takes in an `initializer` function that in turn supplies - * a `resolve` function as one of its arguments and results in an object with a - * callable `then` signature. - */ function checkAsyncFunctionReturnType(node) { - if (languageVersion >= 2 /* ES6 */) { - var returnType = getTypeFromTypeNode(node.type); - return checkCorrectPromiseType(returnType, node.type); - } - var globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType(); - if (globalPromiseConstructorLikeType === emptyObjectType) { - // If we couldn't resolve the global PromiseConstructorLike type we cannot verify - // compatibility with __awaiter. - return unknownType; - } // As part of our emit for an async function, we will need to emit the entity name of // the return type annotation as an expression. To meet the necessary runtime semantics // for __awaiter, we must also check that the type of the declaration (e.g. the static @@ -30064,39 +39302,56 @@ var ts; // then(...): Promise; // } // - // When we get the type of the `Promise` symbol here, we get the type of the static - // side of the `Promise` class, which would be `{ new (...): Promise }`. - var promiseType = getTypeFromTypeNode(node.type); - if (promiseType === unknownType && compilerOptions.isolatedModules) { - // If we are compiling with isolatedModules, we may not be able to resolve the - // type as a value. As such, we will just return unknownType; - return unknownType; + var returnType = getTypeFromTypeNode(node.type); + if (languageVersion >= 2 /* ES2015 */) { + if (returnType === unknownType) { + return unknownType; + } + var globalPromiseType = getGlobalPromiseType(); + if (globalPromiseType !== emptyGenericType && globalPromiseType !== getTargetType(returnType)) { + // The promise type was not a valid type reference to the global promise type, so we + // report an error and return the unknown type. + error(node.type, ts.Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type); + return unknownType; + } } - var promiseConstructor = getNodeLinks(node.type).resolvedSymbol; - if (!promiseConstructor || !symbolIsValue(promiseConstructor)) { - var typeName = promiseConstructor - ? symbolToString(promiseConstructor) - : typeToString(promiseType); - error(node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeName); - return unknownType; - } - // If the Promise constructor, resolved locally, is an alias symbol we should mark it as referenced. - checkReturnTypeAnnotationAsExpression(node); - // Validate the promise constructor type. - var promiseConstructorType = getTypeOfSymbol(promiseConstructor); - if (!checkTypeAssignableTo(promiseConstructorType, globalPromiseConstructorLikeType, node, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type)) { - return unknownType; - } - // Verify there is no local declaration that could collide with the promise constructor. - var promiseName = ts.getEntityNameFromTypeNode(node.type); - var promiseNameOrNamespaceRoot = getFirstIdentifier(promiseName); - var rootSymbol = getSymbol(node.locals, promiseNameOrNamespaceRoot.text, 107455 /* Value */); - if (rootSymbol) { - error(rootSymbol.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions, promiseNameOrNamespaceRoot.text, getFullyQualifiedName(promiseConstructor)); - return unknownType; + else { + // Always mark the type node as referenced if it points to a value + markTypeNodeAsReferenced(node.type); + if (returnType === unknownType) { + return unknownType; + } + var promiseConstructorName = ts.getEntityNameFromTypeNode(node.type); + if (promiseConstructorName === undefined) { + error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, typeToString(returnType)); + return unknownType; + } + var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 107455 /* Value */, /*ignoreErrors*/ true); + var promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : unknownType; + if (promiseConstructorType === unknownType) { + error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName)); + return unknownType; + } + var globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType(); + if (globalPromiseConstructorLikeType === emptyObjectType) { + // If we couldn't resolve the global PromiseConstructorLike type we cannot verify + // compatibility with __awaiter. + error(node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value, ts.entityNameToString(promiseConstructorName)); + return unknownType; + } + if (!checkTypeAssignableTo(promiseConstructorType, globalPromiseConstructorLikeType, node.type, ts.Diagnostics.Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value)) { + return unknownType; + } + // Verify there is no local declaration that could collide with the promise constructor. + var rootName = promiseConstructorName && getFirstIdentifier(promiseConstructorName); + var collidingSymbol = getSymbol(node.locals, rootName.text, 107455 /* Value */); + if (collidingSymbol) { + error(collidingSymbol.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions, rootName.text, ts.entityNameToString(promiseConstructorName)); + return unknownType; + } } // Get and return the awaited type of the return type. - return checkAwaitedType(promiseType, node, ts.Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type); + return checkAwaitedType(returnType, node, ts.Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type); } /** Check a decorator */ function checkDecorator(node) { @@ -30109,22 +39364,22 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 221 /* ClassDeclaration */: + case 226 /* ClassDeclaration */: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 142 /* Parameter */: + case 144 /* Parameter */: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any); break; - case 145 /* PropertyDeclaration */: + case 147 /* PropertyDeclaration */: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any); break; - case 147 /* MethodDeclaration */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: + case 149 /* MethodDeclaration */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); expectedReturnType = getUnionType([descriptorType, voidType]); @@ -30132,44 +39387,24 @@ var ts; } checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage, errorInfo); } - /** Checks a type reference node as an expression. */ - function checkTypeNodeAsExpression(node) { - // When we are emitting type metadata for decorators, we need to try to check the type - // as if it were an expression so that we can emit the type in a value position when we - // serialize the type metadata. - if (node && node.kind === 155 /* TypeReference */) { - var root = getFirstIdentifier(node.typeName); - var meaning = root.parent.kind === 155 /* TypeReference */ ? 793064 /* Type */ : 1920 /* Namespace */; - // Resolve type so we know which symbol is referenced - var rootSymbol = resolveName(root, root.text, meaning | 8388608 /* Alias */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); - // Resolved symbol is alias - if (rootSymbol && rootSymbol.flags & 8388608 /* Alias */) { - var aliasTarget = resolveAlias(rootSymbol); - // If alias has value symbol - mark alias as referenced - if (aliasTarget.flags & 107455 /* Value */ && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol))) { - markAliasSymbolAsReferenced(rootSymbol); - } - } - } - } /** - * Checks the type annotation of an accessor declaration or property declaration as - * an expression if it is a type reference to a type with a value declaration. - */ - function checkTypeAnnotationAsExpression(node) { - checkTypeNodeAsExpression(node.type); - } - function checkReturnTypeAnnotationAsExpression(node) { - checkTypeNodeAsExpression(node.type); - } - /** Checks the type annotation of the parameters of a function/method or the constructor of a class as expressions */ - function checkParameterTypeAnnotationsAsExpressions(node) { - // ensure all type annotations with a value declaration are checked as an expression - for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { - var parameter = _a[_i]; - checkTypeAnnotationAsExpression(parameter); + * If a TypeNode can be resolved to a value symbol imported from an external module, it is + * marked as referenced to prevent import elision. + */ + function markTypeNodeAsReferenced(node) { + var typeName = node && ts.getEntityNameFromTypeNode(node); + var rootName = typeName && getFirstIdentifier(typeName); + var rootSymbol = rootName && resolveName(rootName, rootName.text, (typeName.kind === 70 /* Identifier */ ? 793064 /* Type */ : 1920 /* Namespace */) | 8388608 /* Alias */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); + if (rootSymbol + && rootSymbol.flags & 8388608 /* Alias */ + && symbolIsValue(rootSymbol) + && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol))) { + markAliasSymbolAsReferenced(rootSymbol); } } + function getParameterTypeNodeForDecoratorCheck(node) { + return node.dotDotDotToken ? ts.getRestParameterElementType(node.type) : node.type; + } /** Check the decorators of a node */ function checkDecorators(node) { if (!node.decorators) { @@ -30183,24 +39418,38 @@ var ts; if (!compilerOptions.experimentalDecorators) { error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning); } + var firstDecorator = node.decorators[0]; + checkExternalEmitHelpers(firstDecorator, 8 /* Decorate */); + if (node.kind === 144 /* Parameter */) { + checkExternalEmitHelpers(firstDecorator, 32 /* Param */); + } if (compilerOptions.emitDecoratorMetadata) { + checkExternalEmitHelpers(firstDecorator, 16 /* Metadata */); // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { - case 221 /* ClassDeclaration */: + case 226 /* ClassDeclaration */: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { - checkParameterTypeAnnotationsAsExpressions(constructor); + for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { + var parameter = _a[_i]; + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); + } } break; - case 147 /* MethodDeclaration */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - checkParameterTypeAnnotationsAsExpressions(node); - checkReturnTypeAnnotationAsExpression(node); + case 149 /* MethodDeclaration */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { + var parameter = _c[_b]; + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); + } + markTypeNodeAsReferenced(node.type); break; - case 145 /* PropertyDeclaration */: - case 142 /* Parameter */: - checkTypeAnnotationAsExpression(node); + case 147 /* PropertyDeclaration */: + markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); + break; + case 144 /* Parameter */: + markTypeNodeAsReferenced(node.type); break; } } @@ -30222,7 +39471,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name && node.name.kind === 140 /* ComputedPropertyName */) { + if (node.name && node.name.kind === 142 /* ComputedPropertyName */) { // This check will account for methods in class/interface declarations, // as well as accessors in classes/object literals checkComputedPropertyName(node.name); @@ -30236,7 +39485,7 @@ var ts; // Since the javascript won't do semantic analysis like typescript, // if the javascript file comes before the typescript file and both contain same name functions, // checkFunctionOrConstructorSymbol wouldn't be called if we didnt ignore javascript function. - var firstDeclaration = ts.forEach(localSymbol.declarations, + var firstDeclaration = ts.forEach(localSymbol.declarations, // Get first non javascript function declaration function (declaration) { return declaration.kind === node.kind && !ts.isSourceFileJavaScript(ts.getSourceFileOfNode(declaration)) ? declaration : undefined; }); @@ -30282,43 +39531,43 @@ var ts; for (var _i = 0, deferredUnusedIdentifierNodes_1 = deferredUnusedIdentifierNodes; _i < deferredUnusedIdentifierNodes_1.length; _i++) { var node = deferredUnusedIdentifierNodes_1[_i]; switch (node.kind) { - case 256 /* SourceFile */: - case 225 /* ModuleDeclaration */: + case 261 /* SourceFile */: + case 230 /* ModuleDeclaration */: checkUnusedModuleMembers(node); break; - case 221 /* ClassDeclaration */: - case 192 /* ClassExpression */: + case 226 /* ClassDeclaration */: + case 197 /* ClassExpression */: checkUnusedClassMembers(node); checkUnusedTypeParameters(node); break; - case 222 /* InterfaceDeclaration */: + case 227 /* InterfaceDeclaration */: checkUnusedTypeParameters(node); break; - case 199 /* Block */: - case 227 /* CaseBlock */: - case 206 /* ForStatement */: - case 207 /* ForInStatement */: - case 208 /* ForOfStatement */: + case 204 /* Block */: + case 232 /* CaseBlock */: + case 211 /* ForStatement */: + case 212 /* ForInStatement */: + case 213 /* ForOfStatement */: checkUnusedLocalsAndParameters(node); break; - case 148 /* Constructor */: - case 179 /* FunctionExpression */: - case 220 /* FunctionDeclaration */: - case 180 /* ArrowFunction */: - case 147 /* MethodDeclaration */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: + case 150 /* Constructor */: + case 184 /* FunctionExpression */: + case 225 /* FunctionDeclaration */: + case 185 /* ArrowFunction */: + case 149 /* MethodDeclaration */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: if (node.body) { checkUnusedLocalsAndParameters(node); } checkUnusedTypeParameters(node); break; - case 146 /* MethodSignature */: - case 151 /* CallSignature */: - case 152 /* ConstructSignature */: - case 153 /* IndexSignature */: - case 156 /* FunctionType */: - case 157 /* ConstructorType */: + case 148 /* MethodSignature */: + case 153 /* CallSignature */: + case 154 /* ConstructSignature */: + case 155 /* IndexSignature */: + case 158 /* FunctionType */: + case 159 /* ConstructorType */: checkUnusedTypeParameters(node); break; } @@ -30327,49 +39576,69 @@ var ts; } } function checkUnusedLocalsAndParameters(node) { - if (node.parent.kind !== 222 /* InterfaceDeclaration */ && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { - var _loop_1 = function(key) { + if (node.parent.kind !== 227 /* InterfaceDeclaration */ && noUnusedIdentifiers && !ts.isInAmbientContext(node)) { + var _loop_2 = function (key) { var local = node.locals[key]; if (!local.isReferenced) { - if (local.valueDeclaration && local.valueDeclaration.kind === 142 /* Parameter */) { - var parameter = local.valueDeclaration; + if (local.valueDeclaration && ts.getRootDeclaration(local.valueDeclaration).kind === 144 /* Parameter */) { + var parameter = ts.getRootDeclaration(local.valueDeclaration); if (compilerOptions.noUnusedParameters && !ts.isParameterPropertyDeclaration(parameter) && - !parameterIsThisKeyword(parameter) && - !parameterNameStartsWithUnderscore(parameter)) { + !ts.parameterIsThisKeyword(parameter) && + !parameterNameStartsWithUnderscore(local.valueDeclaration.name)) { error(local.valueDeclaration.name, ts.Diagnostics._0_is_declared_but_never_used, local.name); } } else if (compilerOptions.noUnusedLocals) { - ts.forEach(local.declarations, function (d) { return error(d.name || d, ts.Diagnostics._0_is_declared_but_never_used, local.name); }); + ts.forEach(local.declarations, function (d) { return errorUnusedLocal(d.name || d, local.name); }); } } }; for (var key in node.locals) { - _loop_1(key); + _loop_2(key); } } } - function parameterIsThisKeyword(parameter) { - return parameter.name && parameter.name.originalKeywordKind === 97 /* ThisKeyword */; + function isRemovedPropertyFromObjectSpread(node) { + if (ts.isBindingElement(node) && ts.isObjectBindingPattern(node.parent)) { + var lastElement = ts.lastOrUndefined(node.parent.elements); + return lastElement !== node && !!lastElement.dotDotDotToken; + } + return false; } - function parameterNameStartsWithUnderscore(parameter) { - return parameter.name && parameter.name.kind === 69 /* Identifier */ && parameter.name.text.charCodeAt(0) === 95 /* _ */; + function errorUnusedLocal(node, name) { + if (isIdentifierThatStartsWithUnderScore(node)) { + var declaration = ts.getRootDeclaration(node.parent); + if (declaration.kind === 223 /* VariableDeclaration */ && + (declaration.parent.parent.kind === 212 /* ForInStatement */ || + declaration.parent.parent.kind === 213 /* ForOfStatement */)) { + return; + } + } + if (!isRemovedPropertyFromObjectSpread(node.kind === 70 /* Identifier */ ? node.parent : node)) { + error(node, ts.Diagnostics._0_is_declared_but_never_used, name); + } + } + function parameterNameStartsWithUnderscore(parameterName) { + return parameterName && isIdentifierThatStartsWithUnderScore(parameterName); + } + function isIdentifierThatStartsWithUnderScore(node) { + return node.kind === 70 /* Identifier */ && node.text.charCodeAt(0) === 95 /* _ */; } function checkUnusedClassMembers(node) { if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) { if (node.members) { for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 147 /* MethodDeclaration */ || member.kind === 145 /* PropertyDeclaration */) { - if (!member.symbol.isReferenced && member.flags & 8 /* Private */) { + if (member.kind === 149 /* MethodDeclaration */ || member.kind === 147 /* PropertyDeclaration */) { + if (!member.symbol.isReferenced && ts.getModifierFlags(member) & 8 /* Private */) { error(member.name, ts.Diagnostics._0_is_declared_but_never_used, member.symbol.name); } } - else if (member.kind === 148 /* Constructor */) { + else if (member.kind === 150 /* Constructor */) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; - if (!parameter.symbol.isReferenced && parameter.flags & 8 /* Private */) { + if (!parameter.symbol.isReferenced && ts.getModifierFlags(parameter) & 8 /* Private */) { error(parameter.name, ts.Diagnostics.Property_0_is_declared_but_never_used, parameter.symbol.name); } } @@ -30405,7 +39674,7 @@ var ts; for (var _i = 0, _a = local.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (!ts.isAmbientModule(declaration)) { - error(declaration.name, ts.Diagnostics._0_is_declared_but_never_used, local.name); + errorUnusedLocal(declaration.name, local.name); } } } @@ -30414,7 +39683,7 @@ var ts; } function checkBlock(node) { // Grammar checking for SyntaxKind.Block - if (node.kind === 199 /* Block */) { + if (node.kind === 204 /* Block */) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); @@ -30437,12 +39706,12 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 145 /* PropertyDeclaration */ || - node.kind === 144 /* PropertySignature */ || - node.kind === 147 /* MethodDeclaration */ || - node.kind === 146 /* MethodSignature */ || - node.kind === 149 /* GetAccessor */ || - node.kind === 150 /* SetAccessor */) { + if (node.kind === 147 /* PropertyDeclaration */ || + node.kind === 146 /* PropertySignature */ || + node.kind === 149 /* MethodDeclaration */ || + node.kind === 148 /* MethodSignature */ || + node.kind === 151 /* GetAccessor */ || + node.kind === 152 /* SetAccessor */) { // it is ok to have member named '_super' or '_this' - member access is always qualified return false; } @@ -30451,7 +39720,7 @@ var ts; return false; } var root = ts.getRootDeclaration(node); - if (root.kind === 142 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 144 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { // just an overload - no codegen impact return false; } @@ -30467,7 +39736,7 @@ var ts; var current = node; while (current) { if (getNodeCheckFlags(current) & 4 /* CaptureThis */) { - var isDeclaration_1 = node.kind !== 69 /* Identifier */; + var isDeclaration_1 = node.kind !== 70 /* Identifier */; if (isDeclaration_1) { error(node.name, ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); } @@ -30490,7 +39759,7 @@ var ts; return; } if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { - var isDeclaration_2 = node.kind !== 69 /* Identifier */; + var isDeclaration_2 = node.kind !== 70 /* Identifier */; if (isDeclaration_2) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); } @@ -30500,31 +39769,35 @@ var ts; } } function checkCollisionWithRequireExportsInGeneratedCode(node, name) { + // No need to check for require or exports for ES6 modules and later + if (modulekind >= ts.ModuleKind.ES2015) { + return; + } if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } // Uninstantiated modules shouldnt do this check - if (node.kind === 225 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + if (node.kind === 230 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 256 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 261 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } function checkCollisionWithGlobalPromiseInGeneratedCode(node, name) { - if (!needCollisionCheckForIdentifier(node, name, "Promise")) { + if (languageVersion >= 4 /* ES2017 */ || !needCollisionCheckForIdentifier(node, name, "Promise")) { return; } // Uninstantiated modules shouldnt do this check - if (node.kind === 225 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + if (node.kind === 230 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 256 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2097152 /* HasAsyncFunctions */) { + if (parent.kind === 261 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) { // If the declaration happens to be in external module, report error that Promise is a reserved identifier. error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -30553,13 +39826,13 @@ var ts; // const x = 0; // symbol for this declaration will be 'symbol' // } // skip block-scoped variables and parameters - if ((ts.getCombinedNodeFlags(node) & 3072 /* BlockScoped */) !== 0 || ts.isParameterDeclaration(node)) { + if ((ts.getCombinedNodeFlags(node) & 3 /* BlockScoped */) !== 0 || ts.isParameterDeclaration(node)) { return; } // skip variable declarations that don't have initializers // NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern // so we'll always treat binding elements as initialized - if (node.kind === 218 /* VariableDeclaration */ && !node.initializer) { + if (node.kind === 223 /* VariableDeclaration */ && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -30568,25 +39841,25 @@ var ts; if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) { - if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 3072 /* BlockScoped */) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 219 /* VariableDeclarationList */); - var container = varDeclList.parent.kind === 200 /* VariableStatement */ && varDeclList.parent.parent + if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3 /* BlockScoped */) { + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 224 /* VariableDeclarationList */); + var container = varDeclList.parent.kind === 205 /* VariableStatement */ && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; // names of block-scoped and function scoped variables can collide only // if block scoped variable is defined in the function\module\source file scope (because of variable hoisting) var namesShareScope = container && - (container.kind === 199 /* Block */ && ts.isFunctionLike(container.parent) || - container.kind === 226 /* ModuleBlock */ || - container.kind === 225 /* ModuleDeclaration */ || - container.kind === 256 /* SourceFile */); + (container.kind === 204 /* Block */ && ts.isFunctionLike(container.parent) || + container.kind === 231 /* ModuleBlock */ || + container.kind === 230 /* ModuleDeclaration */ || + container.kind === 261 /* SourceFile */); // here we know that function scoped variable is shadowed by block scoped one // if they are defined in the same scope - binder has already reported redeclaration error // 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_17 = symbolToString(localDeclarationSymbol); - error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_17, name_17); + 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); } } } @@ -30594,7 +39867,7 @@ var ts; } // Check that a parameter initializer contains no references to parameters declared to the right of itself function checkParameterInitializer(node) { - if (ts.getRootDeclaration(node).kind !== 142 /* Parameter */) { + if (ts.getRootDeclaration(node).kind !== 144 /* Parameter */) { return; } var func = ts.getContainingFunction(node); @@ -30605,11 +39878,11 @@ var ts; // skip declaration names (i.e. in object literal expressions) return; } - if (n.kind === 172 /* PropertyAccessExpression */) { + if (n.kind === 177 /* PropertyAccessExpression */) { // skip property names in property access expression return visit(n.expression); } - else if (n.kind === 69 /* Identifier */) { + else if (n.kind === 70 /* Identifier */) { // check FunctionLikeDeclaration.locals (stores parameters\function local variable) // if it contains entry with a specified name var symbol = resolveName(n, n.text, 107455 /* Value */ | 8388608 /* Alias */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); @@ -30624,7 +39897,8 @@ var ts; // so we need to do a bit of extra work to check if reference is legal var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); if (enclosingContainer === func) { - if (symbol.valueDeclaration.kind === 142 /* Parameter */) { + if (symbol.valueDeclaration.kind === 144 /* Parameter */ || + symbol.valueDeclaration.kind === 174 /* BindingElement */) { // it is ok to reference parameter in initializer if either // - parameter is located strictly on the left of current parameter declaration if (symbol.valueDeclaration.pos < node.pos) { @@ -30638,8 +39912,8 @@ var ts; } // computed property names/initializers in instance property declaration of class like entities // are executed in constructor and thus deferred - if (current.parent.kind === 145 /* PropertyDeclaration */ && - !(current.parent.flags & 32 /* Static */) && + if (current.parent.kind === 147 /* PropertyDeclaration */ && + !(ts.hasModifier(current.parent, 32 /* Static */)) && ts.isClassLike(current.parent.parent)) { return; } @@ -30654,6 +39928,9 @@ var ts; } } } + function convertAutoToAny(type) { + return type === autoType ? anyType : type === autoArrayType ? anyArrayType : type; + } // Check variable, parameter, or property declaration function checkVariableLikeDeclaration(node) { checkDecorators(node); @@ -30662,22 +39939,26 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 140 /* ComputedPropertyName */) { + if (node.name.kind === 142 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); } } - if (node.kind === 169 /* BindingElement */) { + if (node.kind === 174 /* BindingElement */) { + if (node.parent.kind === 172 /* ObjectBindingPattern */ && languageVersion < 5 /* ESNext */ && !ts.isInAmbientContext(node)) { + checkExternalEmitHelpers(node, 4 /* Rest */); + } // check computed properties inside property names of binding elements - if (node.propertyName && node.propertyName.kind === 140 /* ComputedPropertyName */) { + if (node.propertyName && node.propertyName.kind === 142 /* ComputedPropertyName */) { checkComputedPropertyName(node.propertyName); } // check private/protected variable access var parent_11 = node.parent.parent; var parentType = getTypeForBindingElementParent(parent_11); - var name_18 = node.propertyName || node.name; - var property = getPropertyOfType(parentType, getTextOfPropertyName(name_18)); + 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); } @@ -30687,25 +39968,25 @@ var ts; ts.forEach(node.name.elements, checkSourceElement); } // For a parameter declaration with an initializer, error and exit if the containing function doesn't have a body - if (node.initializer && ts.getRootDeclaration(node).kind === 142 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 144 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } // For a binding pattern, validate the initializer and exit if (ts.isBindingPattern(node.name)) { // Don't validate for-in initializer as it is already an error - if (node.initializer && node.parent.parent.kind !== 207 /* ForInStatement */) { + if (node.initializer && node.parent.parent.kind !== 212 /* ForInStatement */) { checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, /*headMessage*/ undefined); checkParameterInitializer(node); } return; } var symbol = getSymbolOfNode(node); - var type = getTypeOfVariableOrParameterOrProperty(symbol); + var type = convertAutoToAny(getTypeOfVariableOrParameterOrProperty(symbol)); if (node === symbol.valueDeclaration) { // Node is the primary declaration of the symbol, just validate the initializer // Don't validate for-in initializer as it is already an error - if (node.initializer && node.parent.parent.kind !== 207 /* ForInStatement */) { + if (node.initializer && node.parent.parent.kind !== 212 /* ForInStatement */) { checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, /*headMessage*/ undefined); checkParameterInitializer(node); } @@ -30713,7 +39994,7 @@ var ts; else { // Node is a secondary declaration, check that type is identical to primary declaration and check that // initializer is consistent with type associated with the node - var declarationType = getWidenedTypeForVariableLikeDeclaration(node); + var declarationType = convertAutoToAny(getWidenedTypeForVariableLikeDeclaration(node)); if (type !== unknownType && declarationType !== unknownType && !isTypeIdenticalTo(type, declarationType)) { error(node.name, ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2, ts.declarationNameToString(node.name), typeToString(type), typeToString(declarationType)); } @@ -30725,10 +40006,10 @@ var ts; error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name)); } } - if (node.kind !== 145 /* PropertyDeclaration */ && node.kind !== 144 /* PropertySignature */) { + if (node.kind !== 147 /* PropertyDeclaration */ && node.kind !== 146 /* PropertySignature */) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - if (node.kind === 218 /* VariableDeclaration */ || node.kind === 169 /* BindingElement */) { + if (node.kind === 223 /* VariableDeclaration */ || node.kind === 174 /* BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); @@ -30738,8 +40019,8 @@ var ts; } } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 142 /* Parameter */ && right.kind === 218 /* VariableDeclaration */) || - (left.kind === 218 /* VariableDeclaration */ && right.kind === 142 /* Parameter */)) { + if ((left.kind === 144 /* Parameter */ && right.kind === 223 /* VariableDeclaration */) || + (left.kind === 223 /* VariableDeclaration */ && right.kind === 144 /* Parameter */)) { // Differences in optionality between parameters and variables are allowed. return true; } @@ -30752,7 +40033,7 @@ var ts; 128 /* Abstract */ | 64 /* Readonly */ | 32 /* Static */; - return (left.flags & interestingFlags) === (right.flags & interestingFlags); + return (ts.getModifierFlags(left) & interestingFlags) === (ts.getModifierFlags(right) & interestingFlags); } function checkVariableDeclaration(node) { checkGrammarVariableDeclaration(node); @@ -30769,7 +40050,7 @@ var ts; } function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) { // We only disallow modifier on a method declaration if it is a property of object-literal-expression - if (node.modifiers && node.parent.kind === 171 /* ObjectLiteralExpression */) { + if (node.modifiers && node.parent.kind === 176 /* ObjectLiteralExpression */) { if (ts.isAsyncFunctionLike(node)) { if (node.modifiers.length > 1) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); @@ -30790,7 +40071,7 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 201 /* EmptyStatement */) { + if (node.thenStatement.kind === 206 /* EmptyStatement */) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); @@ -30810,12 +40091,12 @@ var ts; function checkForStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 219 /* VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 224 /* VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 219 /* VariableDeclarationList */) { + if (node.initializer.kind === 224 /* VariableDeclarationList */) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -30838,14 +40119,14 @@ var ts; // via checkRightHandSideOfForOf. // If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference. // Then check that the RHS is assignable to it. - if (node.initializer.kind === 219 /* VariableDeclarationList */) { + if (node.initializer.kind === 224 /* VariableDeclarationList */) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node.expression); // There may be a destructuring assignment on the left side - if (varExpr.kind === 170 /* ArrayLiteralExpression */ || varExpr.kind === 171 /* ObjectLiteralExpression */) { + if (varExpr.kind === 175 /* ArrayLiteralExpression */ || varExpr.kind === 176 /* ObjectLiteralExpression */) { // iteratedType may be undefined. In this case, we still want to check the structure of // varExpr, in particular making sure it's a valid LeftHandSideExpression. But we'd like // to short circuit the type relation checking as much as possible, so we pass the unknownType. @@ -30853,8 +40134,7 @@ var ts; } else { var leftType = checkExpression(varExpr); - checkReferenceExpression(varExpr, /*invalidReferenceMessage*/ ts.Diagnostics.Invalid_left_hand_side_in_for_of_statement, - /*constantVariableMessage*/ ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_be_a_constant_or_a_read_only_property); + checkReferenceExpression(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access); // iteratedType will be undefined if the rightType was missing properties/signatures // required to get its iteratedType (like [Symbol.iterator] or next). This may be // because we accessed properties from anyType, or it may have led to an error inside @@ -30872,12 +40152,13 @@ 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 // VarDecl must be a variable declaration without a type annotation that declares a variable of type Any, // and Expr must be an expression of type Any, an object type, or a type parameter type. - if (node.initializer.kind === 219 /* VariableDeclarationList */) { + if (node.initializer.kind === 224 /* VariableDeclarationList */) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -30891,21 +40172,20 @@ var ts; // and Expr must be an expression of type Any, an object type, or a type parameter type. var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 170 /* ArrayLiteralExpression */ || varExpr.kind === 171 /* ObjectLiteralExpression */) { + 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 { // run check only former check succeeded to avoid cascading errors - checkReferenceExpression(varExpr, ts.Diagnostics.Invalid_left_hand_side_in_for_in_statement, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_constant_or_a_read_only_property); + 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, 2588672 /* ObjectType */ | 16384 /* TypeParameter */)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 /* Object */ | 540672 /* TypeVariable */)) { 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); @@ -30929,7 +40209,7 @@ var ts; if (isTypeAny(inputType)) { return inputType; } - if (languageVersion >= 2 /* ES6 */) { + if (languageVersion >= 2 /* ES2015 */) { return checkElementTypeOfIterable(inputType, errorNode); } if (allowStringInput) { @@ -30987,7 +40267,7 @@ var ts; if (!typeAsIterable.iterableElementType) { // As an optimization, if the type is instantiated directly using the globalIterableType (Iterable), // then just grab its type argument. - if ((type.flags & 131072 /* Reference */) && type.target === getGlobalIterableType()) { + if ((getObjectFlags(type) & 4 /* Reference */) && type.target === getGlobalIterableType()) { typeAsIterable.iterableElementType = type.typeArguments[0]; } else { @@ -31028,7 +40308,7 @@ var ts; if (!typeAsIterator.iteratorElementType) { // As an optimization, if the type is instantiated directly using the globalIteratorType (Iterator), // then just grab its type argument. - if ((type.flags & 131072 /* Reference */) && type.target === getGlobalIteratorType()) { + if ((getObjectFlags(type) & 4 /* Reference */) && type.target === getGlobalIteratorType()) { typeAsIterator.iteratorElementType = type.typeArguments[0]; } else { @@ -31065,7 +40345,7 @@ var ts; } // As an optimization, if the type is instantiated directly using the globalIterableIteratorType (IterableIterator), // then just grab its type argument. - if ((type.flags & 131072 /* Reference */) && type.target === getGlobalIterableIteratorType()) { + if ((getObjectFlags(type) & 4 /* Reference */) && type.target === getGlobalIterableIteratorType()) { return type.typeArguments[0]; } return getElementTypeOfIterable(type, /*errorNode*/ undefined) || @@ -31089,14 +40369,18 @@ var ts; * 2. Some constituent is a string and target is less than ES5 (because in ES3 string is not indexable). */ function checkElementTypeOfArrayOrString(arrayOrStringType, errorNode) { - ts.Debug.assert(languageVersion < 2 /* ES6 */); - // After we remove all types that are StringLike, we will know if there was a string constituent - // based on whether the remaining type is the same as the initial type. + ts.Debug.assert(languageVersion < 2 /* ES2015 */); var arrayType = arrayOrStringType; - if (arrayOrStringType.flags & 524288 /* Union */) { - arrayType = getUnionType(ts.filter(arrayOrStringType.types, function (t) { return !(t.flags & 34 /* StringLike */); }), /*subtypeReduction*/ true); + if (arrayOrStringType.flags & 65536 /* Union */) { + // 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 & 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; @@ -31108,7 +40392,7 @@ var ts; } // Now that we've removed all the StringLike types, if no constituents remain, then the entire // arrayOrStringType was a string. - if (arrayType === neverType) { + if (arrayType.flags & 8192 /* Never */) { return stringType; } } @@ -31128,7 +40412,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); @@ -31141,7 +40425,7 @@ var ts; // TODO: Check that target label is valid } function isGetAccessorWithAnnotatedSetAccessor(node) { - return !!(node.kind === 149 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 150 /* SetAccessor */))); + return !!(node.kind === 151 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 152 /* SetAccessor */))); } function isUnwrappedReturnTypeVoidOrAny(func, returnType) { var unwrappedReturnType = ts.isAsyncFunctionLike(func) ? getPromisedType(returnType) : returnType; @@ -31159,7 +40443,7 @@ var ts; if (func) { var signature = getSignatureFromDeclaration(func); var returnType = getReturnTypeOfSignature(signature); - if (strictNullChecks || node.expression || returnType === neverType) { + if (strictNullChecks || node.expression || returnType.flags & 8192 /* Never */) { var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; if (func.asteriskToken) { // A generator does not need its return expressions checked against its return type. @@ -31168,12 +40452,12 @@ var ts; // for generators. return; } - if (func.kind === 150 /* SetAccessor */) { + if (func.kind === 152 /* SetAccessor */) { if (node.expression) { error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); } } - else if (func.kind === 148 /* Constructor */) { + else if (func.kind === 150 /* Constructor */) { if (node.expression && !checkTypeAssignableTo(exprType, returnType, node.expression)) { error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -31194,7 +40478,7 @@ var ts; } } } - else if (func.kind !== 148 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) { + else if (func.kind !== 150 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) { // The function has a return type, but the return statement doesn't have an expression. error(node, ts.Diagnostics.Not_all_code_paths_return_a_value); } @@ -31203,12 +40487,17 @@ var ts; function checkWithStatement(node) { // Grammar checking for withStatement if (!checkGrammarStatementInAmbientContext(node)) { - if (node.flags & 33554432 /* AwaitContext */) { + if (node.flags & 16384 /* AwaitContext */) { grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_an_async_function_block); } } checkExpression(node.expression); - error(node.expression, ts.Diagnostics.All_symbols_within_a_with_block_will_be_resolved_to_any); + var sourceFile = ts.getSourceFileOfNode(node); + if (!hasParseDiagnostics(sourceFile)) { + var start = ts.getSpanOfTokenAtPosition(sourceFile, node.pos).start; + var end = node.statement.pos; + grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any); + } } function checkSwitchStatement(node) { // Grammar checking @@ -31216,9 +40505,10 @@ var ts; var firstDefaultClause; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); + var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause - if (clause.kind === 250 /* DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 254 /* DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -31230,15 +40520,21 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 249 /* CaseClause */) { + if (produceDiagnostics && clause.kind === 253 /* CaseClause */) { var caseClause = clause; // TypeScript 1.0 spec (April 2014): 5.9 // In a 'switch' statement, each 'case' expression must be of a type that is comparable // to or from the type of the 'switch' expression. var caseType = checkExpression(caseClause.expression); - if (!isTypeEqualityComparableTo(expressionType, caseType)) { + var caseIsLiteral = isLiteralType(caseType); + var comparedExpressionType = expressionType; + if (!caseIsLiteral || !expressionIsLiteral) { + caseType = caseIsLiteral ? getBaseTypeOfLiteralType(caseType) : caseType; + comparedExpressionType = getBaseTypeOfLiteralType(expressionType); + } + if (!isTypeEqualityComparableTo(comparedExpressionType, caseType)) { // expressionType is not comparable to caseType, try the reversed check and report errors if it fails - checkTypeComparableTo(caseType, expressionType, caseClause.expression, /*headMessage*/ undefined); + checkTypeComparableTo(caseType, comparedExpressionType, caseClause.expression, /*headMessage*/ undefined); } } ts.forEach(clause.statements, checkSourceElement); @@ -31255,7 +40551,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 214 /* LabeledStatement */ && current.label.text === node.label.text) { + if (current.kind === 219 /* LabeledStatement */ && current.label.text === node.label.text) { var sourceFile = ts.getSourceFileOfNode(node); grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label)); break; @@ -31285,22 +40581,20 @@ var ts; if (catchClause) { // Grammar checking if (catchClause.variableDeclaration) { - if (catchClause.variableDeclaration.name.kind !== 69 /* Identifier */) { - grammarErrorOnFirstToken(catchClause.variableDeclaration.name, ts.Diagnostics.Catch_clause_variable_name_must_be_an_identifier); - } - else if (catchClause.variableDeclaration.type) { + if (catchClause.variableDeclaration.type) { grammarErrorOnFirstToken(catchClause.variableDeclaration.type, ts.Diagnostics.Catch_clause_variable_cannot_have_a_type_annotation); } else if (catchClause.variableDeclaration.initializer) { grammarErrorOnFirstToken(catchClause.variableDeclaration.initializer, ts.Diagnostics.Catch_clause_variable_cannot_have_an_initializer); } else { - var identifierName = catchClause.variableDeclaration.name.text; - var locals = catchClause.block.locals; - if (locals) { - var localSymbol = locals[identifierName]; - if (localSymbol && (localSymbol.flags & 2 /* BlockScopedVariable */) !== 0) { - grammarErrorOnNode(localSymbol.valueDeclaration, ts.Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, identifierName); + var blockLocals = catchClause.block.locals; + if (blockLocals) { + for (var caughtName in catchClause.locals) { + var blockLocal = blockLocals[caughtName]; + if (blockLocal && (blockLocal.flags & 2 /* BlockScopedVariable */) !== 0) { + grammarErrorOnNode(blockLocal.valueDeclaration, ts.Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, caughtName); + } } } } @@ -31322,14 +40616,14 @@ var ts; checkIndexConstraintForProperty(prop, propType, type, declaredStringIndexer, stringIndexType, 0 /* String */); checkIndexConstraintForProperty(prop, propType, type, declaredNumberIndexer, numberIndexType, 1 /* Number */); }); - if (type.flags & 32768 /* Class */ && ts.isClassLike(type.symbol.valueDeclaration)) { + if (getObjectFlags(type) & 1 /* Class */ && ts.isClassLike(type.symbol.valueDeclaration)) { var classDeclaration = type.symbol.valueDeclaration; for (var _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) { var member = _a[_i]; // Only process instance properties with computed names here. // Static properties cannot be in conflict with indexers, // and properties with literal names were already checked. - if (!(member.flags & 32 /* Static */) && ts.hasDynamicName(member)) { + if (!(ts.getModifierFlags(member) & 32 /* Static */) && ts.hasDynamicName(member)) { var propType = getTypeOfSymbol(member.symbol); checkIndexConstraintForProperty(member.symbol, propType, type, declaredStringIndexer, stringIndexType, 0 /* String */); checkIndexConstraintForProperty(member.symbol, propType, type, declaredNumberIndexer, numberIndexType, 1 /* Number */); @@ -31341,7 +40635,7 @@ var ts; if (stringIndexType && numberIndexType) { errorNode = declaredNumberIndexer || declaredStringIndexer; // condition 'errorNode === undefined' may appear if types does not declare nor string neither number indexer - if (!errorNode && (type.flags & 65536 /* Interface */)) { + if (!errorNode && (getObjectFlags(type) & 2 /* Interface */)) { var someBaseTypeHasBothIndexers = ts.forEach(getBaseTypes(type), function (base) { return getIndexTypeOfType(base, 0 /* String */) && getIndexTypeOfType(base, 1 /* Number */); }); errorNode = someBaseTypeHasBothIndexers ? undefined : type.symbol.declarations[0]; } @@ -31360,13 +40654,13 @@ var ts; // perform property check if property or indexer is declared in 'type' // this allows to rule out cases when both property and indexer are inherited from the base class var errorNode; - if (prop.valueDeclaration.name.kind === 140 /* ComputedPropertyName */ || prop.parent === containingType.symbol) { + if (prop.valueDeclaration.name.kind === 142 /* ComputedPropertyName */ || prop.parent === containingType.symbol) { errorNode = prop.valueDeclaration; } else if (indexDeclaration) { errorNode = indexDeclaration; } - else if (containingType.flags & 65536 /* Interface */) { + else if (getObjectFlags(containingType) & 2 /* Interface */) { // for interfaces property and indexer might be inherited from different bases // check if any base class already has both property and indexer. // check should be performed only if 'type' is the first type that brings property\indexer together @@ -31418,7 +40712,7 @@ var ts; var firstDecl; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 221 /* ClassDeclaration */ || declaration.kind === 222 /* InterfaceDeclaration */) { + if (declaration.kind === 226 /* ClassDeclaration */ || declaration.kind === 227 /* InterfaceDeclaration */) { if (!firstDecl) { firstDecl = declaration; } @@ -31438,7 +40732,7 @@ var ts; registerForUnusedIdentifiersCheck(node); } function checkClassDeclaration(node) { - if (!node.name && !(node.flags & 512 /* Default */)) { + if (!node.name && !(ts.getModifierFlags(node) & 512 /* Default */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); } checkClassLikeDeclaration(node); @@ -31464,6 +40758,9 @@ var ts; checkClassForDuplicateDeclarations(node); var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { + if (languageVersion < 2 /* ES2015 */ && !ts.isInAmbientContext(node)) { + checkExternalEmitHelpers(baseTypeNode.parent, 1 /* Extends */); + } var baseTypes = getBaseTypes(type); if (baseTypes.length && produceDiagnostics) { var baseType_1 = baseTypes[0]; @@ -31481,7 +40778,9 @@ var ts; } checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType_1, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); - if (baseType_1.symbol.valueDeclaration && !ts.isInAmbientContext(baseType_1.symbol.valueDeclaration)) { + if (baseType_1.symbol.valueDeclaration && + !ts.isInAmbientContext(baseType_1.symbol.valueDeclaration) && + baseType_1.symbol.valueDeclaration.kind === 226 /* ClassDeclaration */) { if (!isBlockScopedNameDeclaredBeforeUse(baseType_1.symbol.valueDeclaration, node)) { error(baseTypeNode, ts.Diagnostics.A_class_must_be_declared_after_its_base_class); } @@ -31510,8 +40809,8 @@ var ts; if (produceDiagnostics) { var t = getTypeFromTypeNode(typeRefNode); if (t !== unknownType) { - var declaredType = (t.flags & 131072 /* Reference */) ? t.target : t; - if (declaredType.flags & (32768 /* Class */ | 65536 /* Interface */)) { + var declaredType = getObjectFlags(t) & 4 /* Reference */ ? t.target : t; + if (getObjectFlags(declaredType) & 3 /* ClassOrInterface */) { checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(t, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_implements_interface_1); } else { @@ -31530,10 +40829,10 @@ var ts; var signatures = getSignaturesOfType(type, 1 /* Construct */); if (signatures.length) { var declaration = signatures[0].declaration; - if (declaration && declaration.flags & 8 /* Private */) { + if (declaration && ts.getModifierFlags(declaration) & 8 /* Private */) { var typeClassDeclaration = getClassLikeDeclarationOfSymbol(type.symbol); if (!isNodeWithinClass(node, typeClassDeclaration)) { - error(node, ts.Diagnostics.Cannot_extend_a_class_0_Class_constructor_is_marked_as_private, node.expression.text); + error(node, ts.Diagnostics.Cannot_extend_a_class_0_Class_constructor_is_marked_as_private, getFullyQualifiedName(type.symbol)); } } } @@ -31569,7 +40868,7 @@ var ts; continue; } var derived = getTargetSymbol(getPropertyOfObjectType(type, base.name)); - var baseDeclarationFlags = getDeclarationFlagsFromSymbol(base); + var baseDeclarationFlags = getDeclarationModifierFlagsFromSymbol(base); ts.Debug.assert(!!derived, "derived should point to something, even if it is the base class' declaration."); if (derived) { // In order to resolve whether the inherited method was overridden in the base class or not, @@ -31581,8 +40880,8 @@ var ts; // It is an error to inherit an abstract member without implementing it or being declared abstract. // If there is no declaration for the derived class (as in the case of class expressions), // then the class cannot be declared abstract. - if (baseDeclarationFlags & 128 /* Abstract */ && (!derivedClassDecl || !(derivedClassDecl.flags & 128 /* Abstract */))) { - if (derivedClassDecl.kind === 192 /* ClassExpression */) { + if (baseDeclarationFlags & 128 /* Abstract */ && (!derivedClassDecl || !(ts.getModifierFlags(derivedClassDecl) & 128 /* Abstract */))) { + if (derivedClassDecl.kind === 197 /* ClassExpression */) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -31592,7 +40891,7 @@ var ts; } else { // derived overrides base. - var derivedDeclarationFlags = getDeclarationFlagsFromSymbol(derived); + var derivedDeclarationFlags = getDeclarationModifierFlagsFromSymbol(derived); if ((baseDeclarationFlags & 8 /* Private */) || (derivedDeclarationFlags & 8 /* Private */)) { // either base or derived property is private - not override, skip it continue; @@ -31630,7 +40929,7 @@ var ts; } } function isAccessor(kind) { - return kind === 149 /* GetAccessor */ || kind === 150 /* SetAccessor */; + return kind === 151 /* GetAccessor */ || kind === 152 /* SetAccessor */; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -31671,8 +40970,8 @@ var ts; for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) { var base = baseTypes_2[_i]; var properties = getPropertiesOfObjectType(getTypeWithThisArgument(base, type.thisType)); - for (var _a = 0, properties_4 = properties; _a < properties_4.length; _a++) { - var prop = properties_4[_a]; + for (var _a = 0, properties_7 = properties; _a < properties_7.length; _a++) { + var prop = properties_7[_a]; var existing = seen[prop.name]; if (!existing) { seen[prop.name] = { prop: prop, containingType: base }; @@ -31702,7 +41001,7 @@ var ts; var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(node, symbol); // Only check this symbol once - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 222 /* InterfaceDeclaration */); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 227 /* InterfaceDeclaration */); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -31733,6 +41032,7 @@ var ts; // Grammar checking checkGrammarDecorators(node) || checkGrammarModifiers(node); checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_alias_name_cannot_be_0); + checkTypeParameters(node.typeParameters); checkSourceElement(node.type); } function computeEnumMemberValues(node) { @@ -31749,8 +41049,8 @@ var ts; error(member.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); } else { - var text = getTextOfPropertyName(member.name); - if (isNumericLiteralName(text)) { + var text = ts.getTextOfPropertyName(member.name); + if (isNumericLiteralName(text) && !isInfinityOrNaNString(text)) { error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name); } } @@ -31808,18 +41108,18 @@ var ts; return value; function evalConstant(e) { switch (e.kind) { - case 185 /* PrefixUnaryExpression */: + case 190 /* PrefixUnaryExpression */: var value_1 = evalConstant(e.operand); if (value_1 === undefined) { return undefined; } switch (e.operator) { - case 35 /* PlusToken */: return value_1; - case 36 /* MinusToken */: return -value_1; - case 50 /* TildeToken */: return ~value_1; + case 36 /* PlusToken */: return value_1; + case 37 /* MinusToken */: return -value_1; + case 51 /* TildeToken */: return ~value_1; } return undefined; - case 187 /* BinaryExpression */: + case 192 /* BinaryExpression */: var left = evalConstant(e.left); if (left === undefined) { return undefined; @@ -31829,31 +41129,31 @@ var ts; return undefined; } switch (e.operatorToken.kind) { - case 47 /* BarToken */: return left | right; - case 46 /* AmpersandToken */: return left & right; - case 44 /* GreaterThanGreaterThanToken */: return left >> right; - case 45 /* GreaterThanGreaterThanGreaterThanToken */: return left >>> right; - case 43 /* LessThanLessThanToken */: return left << right; - case 48 /* CaretToken */: return left ^ right; - case 37 /* AsteriskToken */: return left * right; - case 39 /* SlashToken */: return left / right; - case 35 /* PlusToken */: return left + right; - case 36 /* MinusToken */: return left - right; - case 40 /* PercentToken */: return left % right; + case 48 /* BarToken */: return left | right; + case 47 /* AmpersandToken */: return left & right; + case 45 /* GreaterThanGreaterThanToken */: return left >> right; + case 46 /* GreaterThanGreaterThanGreaterThanToken */: return left >>> right; + case 44 /* LessThanLessThanToken */: return left << right; + case 49 /* CaretToken */: return left ^ right; + case 38 /* AsteriskToken */: return left * right; + case 40 /* SlashToken */: return left / right; + case 36 /* PlusToken */: return left + right; + case 37 /* MinusToken */: return left - right; + case 41 /* PercentToken */: return left % right; } return undefined; case 8 /* NumericLiteral */: return +e.text; - case 178 /* ParenthesizedExpression */: + case 183 /* ParenthesizedExpression */: return evalConstant(e.expression); - case 69 /* Identifier */: - case 173 /* ElementAccessExpression */: - case 172 /* PropertyAccessExpression */: + case 70 /* Identifier */: + case 178 /* ElementAccessExpression */: + case 177 /* PropertyAccessExpression */: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); var enumType_1; var propertyName = void 0; - if (e.kind === 69 /* Identifier */) { + if (e.kind === 70 /* Identifier */) { // unqualified names can refer to member that reside in different declaration of the enum so just doing name resolution won't work. // instead pick current enum type and later try to fetch member from the type enumType_1 = currentType; @@ -31861,7 +41161,7 @@ var ts; } else { var expression = void 0; - if (e.kind === 173 /* ElementAccessExpression */) { + if (e.kind === 178 /* ElementAccessExpression */) { if (e.argumentExpression === undefined || e.argumentExpression.kind !== 9 /* StringLiteral */) { return undefined; @@ -31876,17 +41176,17 @@ var ts; // expression part in ElementAccess\PropertyAccess should be either identifier or dottedName var current = expression; while (current) { - if (current.kind === 69 /* Identifier */) { + if (current.kind === 70 /* Identifier */) { break; } - else if (current.kind === 172 /* PropertyAccessExpression */) { + else if (current.kind === 177 /* PropertyAccessExpression */) { current = current.expression; } else { 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; @@ -31951,7 +41251,7 @@ var ts; var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { // return true if we hit a violation of the rule, false otherwise - if (declaration.kind !== 224 /* EnumDeclaration */) { + if (declaration.kind !== 229 /* EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -31974,8 +41274,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { var declaration = declarations_5[_i]; - if ((declaration.kind === 221 /* ClassDeclaration */ || - (declaration.kind === 220 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 226 /* ClassDeclaration */ || + (declaration.kind === 225 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -32016,9 +41316,11 @@ var ts; grammarErrorOnNode(node.name, ts.Diagnostics.Only_ambient_modules_can_use_quoted_names); } } - checkCollisionWithCapturedThisVariable(node, node.name); - checkCollisionWithRequireExportsInGeneratedCode(node, node.name); - checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); + if (ts.isIdentifier(node.name)) { + checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); + } checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); // The following checks only apply on a non-ambient instantiated module declaration. @@ -32037,7 +41339,7 @@ var ts; } // if the module merges with a class declaration in the same lexical scope, // we need to track this to ensure the correct emit. - var mergedClass = ts.getDeclarationOfKind(symbol, 221 /* ClassDeclaration */); + var mergedClass = ts.getDeclarationOfKind(symbol, 226 /* ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768 /* LexicalModuleMergesWithClass */; @@ -32088,26 +41390,26 @@ var ts; } function checkModuleAugmentationElement(node, isGlobalAugmentation) { switch (node.kind) { - case 200 /* VariableStatement */: + case 205 /* VariableStatement */: // error each individual name in variable statement instead of marking the entire variable statement for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 235 /* ExportAssignment */: - case 236 /* ExportDeclaration */: + case 240 /* ExportAssignment */: + case 241 /* ExportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 229 /* ImportEqualsDeclaration */: - case 230 /* ImportDeclaration */: + case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 169 /* BindingElement */: - case 218 /* VariableDeclaration */: - var name_19 = node.name; - if (ts.isBindingPattern(name_19)) { - for (var _b = 0, _c = name_19.elements; _b < _c.length; _b++) { + case 174 /* BindingElement */: + case 223 /* VariableDeclaration */: + 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); @@ -32115,12 +41417,12 @@ var ts; break; } // fallthrough - case 221 /* ClassDeclaration */: - case 224 /* EnumDeclaration */: - case 220 /* FunctionDeclaration */: - case 222 /* InterfaceDeclaration */: - case 225 /* ModuleDeclaration */: - case 223 /* TypeAliasDeclaration */: + case 226 /* ClassDeclaration */: + case 229 /* EnumDeclaration */: + case 225 /* FunctionDeclaration */: + case 227 /* InterfaceDeclaration */: + case 230 /* ModuleDeclaration */: + case 228 /* TypeAliasDeclaration */: if (isGlobalAugmentation) { return; } @@ -32141,17 +41443,17 @@ var ts; } function getFirstIdentifier(node) { switch (node.kind) { - case 69 /* Identifier */: + case 70 /* Identifier */: return node; - case 139 /* QualifiedName */: + case 141 /* QualifiedName */: do { node = node.left; - } while (node.kind !== 69 /* Identifier */); + } while (node.kind !== 70 /* Identifier */); return node; - case 172 /* PropertyAccessExpression */: + case 177 /* PropertyAccessExpression */: do { node = node.expression; - } while (node.kind !== 69 /* Identifier */); + } while (node.kind !== 70 /* Identifier */); return node; } } @@ -32161,9 +41463,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 226 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 256 /* SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 236 /* ExportDeclaration */ ? + var inAmbientExternalModule = node.parent.kind === 231 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 261 /* SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 241 /* ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -32196,7 +41498,7 @@ var ts; (symbol.flags & 793064 /* Type */ ? 793064 /* Type */ : 0) | (symbol.flags & 1920 /* Namespace */ ? 1920 /* Namespace */ : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 238 /* ExportSpecifier */ ? + var message = node.kind === 243 /* ExportSpecifier */ ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -32214,7 +41516,7 @@ var ts; // If we hit an import declaration in an illegal context, just bail out to avoid cascading errors. return; } - if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1023 /* Modifier */)) { + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && ts.getModifierFlags(node) !== 0) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_import_declaration_cannot_have_modifiers); } if (checkExternalImportOrExportDeclaration(node)) { @@ -32224,7 +41526,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 232 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 237 /* NamespaceImport */) { checkImportBinding(importClause.namedBindings); } else { @@ -32242,7 +41544,7 @@ var ts; checkGrammarDecorators(node) || checkGrammarModifiers(node); if (ts.isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) { checkImportBinding(node); - if (node.flags & 1 /* Export */) { + if (ts.getModifierFlags(node) & 1 /* Export */) { markExportAsReferenced(node); } if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -32261,7 +41563,7 @@ var ts; } } else { - if (modulekind === ts.ModuleKind.ES6 && !ts.isInAmbientContext(node)) { + if (modulekind === ts.ModuleKind.ES2015 && !ts.isInAmbientContext(node)) { // Import equals declaration is deprecated in es6 or above grammarErrorOnNode(node, ts.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead); } @@ -32273,7 +41575,7 @@ var ts; // If we hit an export in an illegal context, just bail out to avoid cascading errors. return; } - if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1023 /* Modifier */)) { + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && ts.getModifierFlags(node) !== 0) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_declaration_cannot_have_modifiers); } if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { @@ -32281,8 +41583,8 @@ var ts; // export { x, y } // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 226 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 256 /* SourceFile */ && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 231 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 261 /* SourceFile */ && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -32296,16 +41598,18 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - if (node.parent.kind !== 256 /* SourceFile */ && node.parent.kind !== 226 /* ModuleBlock */ && node.parent.kind !== 225 /* ModuleDeclaration */) { - return grammarErrorOnFirstToken(node, errorMessage); + var isInAppropriateContext = node.parent.kind === 261 /* SourceFile */ || node.parent.kind === 231 /* ModuleBlock */ || node.parent.kind === 230 /* ModuleDeclaration */; + if (!isInAppropriateContext) { + grammarErrorOnFirstToken(node, errorMessage); } + return !isInAppropriateContext; } function checkExportSpecifier(node) { checkAliasSymbol(node); if (!node.parent.parent.moduleSpecifier) { var exportedName = node.propertyName || node.name; // find immediate value referenced by exported name (SymbolFlags.Alias is set so we don't chase down aliases) - var symbol = resolveName(exportedName, exportedName.text, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */ | 8388608 /* Alias */, + var symbol = resolveName(exportedName, exportedName.text, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */ | 8388608 /* Alias */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); if (symbol && (symbol === undefinedSymbol || isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) { error(exportedName, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, exportedName.text); @@ -32320,16 +41624,16 @@ var ts; // If we hit an export assignment in an illegal context, just bail out to avoid cascading errors. return; } - var container = node.parent.kind === 256 /* SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 225 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 261 /* SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 230 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); return; } // Grammar checking - if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 1023 /* Modifier */)) { + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && ts.getModifierFlags(node) !== 0) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers); } - if (node.expression.kind === 69 /* Identifier */) { + if (node.expression.kind === 70 /* Identifier */) { markExportAsReferenced(node); } else { @@ -32337,7 +41641,7 @@ var ts; } checkExternalModuleExports(container); if (node.isExportEquals && !ts.isInAmbientContext(node)) { - if (modulekind === ts.ModuleKind.ES6) { + if (modulekind === ts.ModuleKind.ES2015) { // export assignment is not supported in es6 modules grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_export_default_or_another_module_format_instead); } @@ -32396,7 +41700,8 @@ var ts; links.exportsChecked = true; } function isNotOverload(declaration) { - return declaration.kind !== 220 /* FunctionDeclaration */ || !!declaration.body; + return (declaration.kind !== 225 /* FunctionDeclaration */ && declaration.kind !== 149 /* MethodDeclaration */) || + !!declaration.body; } } function checkSourceElement(node) { @@ -32408,118 +41713,123 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { - case 225 /* ModuleDeclaration */: - case 221 /* ClassDeclaration */: - case 222 /* InterfaceDeclaration */: - case 220 /* FunctionDeclaration */: + case 230 /* ModuleDeclaration */: + case 226 /* ClassDeclaration */: + case 227 /* InterfaceDeclaration */: + case 225 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } switch (kind) { - case 141 /* TypeParameter */: + case 143 /* TypeParameter */: return checkTypeParameter(node); - case 142 /* Parameter */: + case 144 /* Parameter */: return checkParameter(node); - case 145 /* PropertyDeclaration */: - case 144 /* PropertySignature */: + case 147 /* PropertyDeclaration */: + case 146 /* PropertySignature */: return checkPropertyDeclaration(node); - case 156 /* FunctionType */: - case 157 /* ConstructorType */: - case 151 /* CallSignature */: - case 152 /* ConstructSignature */: + case 158 /* FunctionType */: + case 159 /* ConstructorType */: + case 153 /* CallSignature */: + case 154 /* ConstructSignature */: return checkSignatureDeclaration(node); - case 153 /* IndexSignature */: + case 155 /* IndexSignature */: return checkSignatureDeclaration(node); - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: return checkMethodDeclaration(node); - case 148 /* Constructor */: + case 150 /* Constructor */: return checkConstructorDeclaration(node); - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: return checkAccessorDeclaration(node); - case 155 /* TypeReference */: + case 157 /* TypeReference */: return checkTypeReferenceNode(node); - case 154 /* TypePredicate */: + case 156 /* TypePredicate */: return checkTypePredicate(node); - case 158 /* TypeQuery */: + case 160 /* TypeQuery */: return checkTypeQuery(node); - case 159 /* TypeLiteral */: + case 161 /* TypeLiteral */: return checkTypeLiteral(node); - case 160 /* ArrayType */: + case 162 /* ArrayType */: return checkArrayType(node); - case 161 /* TupleType */: + case 163 /* TupleType */: return checkTupleType(node); - case 162 /* UnionType */: - case 163 /* IntersectionType */: + case 164 /* UnionType */: + case 165 /* IntersectionType */: return checkUnionOrIntersectionType(node); - case 164 /* ParenthesizedType */: + case 166 /* ParenthesizedType */: + case 168 /* TypeOperator */: return checkSourceElement(node.type); - case 220 /* FunctionDeclaration */: + case 169 /* IndexedAccessType */: + return checkIndexedAccessType(node); + case 170 /* MappedType */: + return checkMappedType(node); + case 225 /* FunctionDeclaration */: return checkFunctionDeclaration(node); - case 199 /* Block */: - case 226 /* ModuleBlock */: + case 204 /* Block */: + case 231 /* ModuleBlock */: return checkBlock(node); - case 200 /* VariableStatement */: + case 205 /* VariableStatement */: return checkVariableStatement(node); - case 202 /* ExpressionStatement */: + case 207 /* ExpressionStatement */: return checkExpressionStatement(node); - case 203 /* IfStatement */: + case 208 /* IfStatement */: return checkIfStatement(node); - case 204 /* DoStatement */: + case 209 /* DoStatement */: return checkDoStatement(node); - case 205 /* WhileStatement */: + case 210 /* WhileStatement */: return checkWhileStatement(node); - case 206 /* ForStatement */: + case 211 /* ForStatement */: return checkForStatement(node); - case 207 /* ForInStatement */: + case 212 /* ForInStatement */: return checkForInStatement(node); - case 208 /* ForOfStatement */: + case 213 /* ForOfStatement */: return checkForOfStatement(node); - case 209 /* ContinueStatement */: - case 210 /* BreakStatement */: + case 214 /* ContinueStatement */: + case 215 /* BreakStatement */: return checkBreakOrContinueStatement(node); - case 211 /* ReturnStatement */: + case 216 /* ReturnStatement */: return checkReturnStatement(node); - case 212 /* WithStatement */: + case 217 /* WithStatement */: return checkWithStatement(node); - case 213 /* SwitchStatement */: + case 218 /* SwitchStatement */: return checkSwitchStatement(node); - case 214 /* LabeledStatement */: + case 219 /* LabeledStatement */: return checkLabeledStatement(node); - case 215 /* ThrowStatement */: + case 220 /* ThrowStatement */: return checkThrowStatement(node); - case 216 /* TryStatement */: + case 221 /* TryStatement */: return checkTryStatement(node); - case 218 /* VariableDeclaration */: + case 223 /* VariableDeclaration */: return checkVariableDeclaration(node); - case 169 /* BindingElement */: + case 174 /* BindingElement */: return checkBindingElement(node); - case 221 /* ClassDeclaration */: + case 226 /* ClassDeclaration */: return checkClassDeclaration(node); - case 222 /* InterfaceDeclaration */: + case 227 /* InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 223 /* TypeAliasDeclaration */: + case 228 /* TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 224 /* EnumDeclaration */: + case 229 /* EnumDeclaration */: return checkEnumDeclaration(node); - case 225 /* ModuleDeclaration */: + case 230 /* ModuleDeclaration */: return checkModuleDeclaration(node); - case 230 /* ImportDeclaration */: + case 235 /* ImportDeclaration */: return checkImportDeclaration(node); - case 229 /* ImportEqualsDeclaration */: + case 234 /* ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 236 /* ExportDeclaration */: + case 241 /* ExportDeclaration */: return checkExportDeclaration(node); - case 235 /* ExportAssignment */: + case 240 /* ExportAssignment */: return checkExportAssignment(node); - case 201 /* EmptyStatement */: + case 206 /* EmptyStatement */: checkGrammarStatementInAmbientContext(node); return; - case 217 /* DebuggerStatement */: + case 222 /* DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 239 /* MissingDeclaration */: + case 244 /* MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -32541,17 +41851,17 @@ var ts; for (var _i = 0, deferredNodes_1 = deferredNodes; _i < deferredNodes_1.length; _i++) { var node = deferredNodes_1[_i]; switch (node.kind) { - case 179 /* FunctionExpression */: - case 180 /* ArrowFunction */: - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: + case 184 /* FunctionExpression */: + case 185 /* ArrowFunction */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); break; - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: checkAccessorDeferred(node); break; - case 192 /* ClassExpression */: + case 197 /* ClassExpression */: checkClassExpressionDeferred(node); break; } @@ -32613,9 +41923,29 @@ var ts; function getDiagnosticsWorker(sourceFile) { throwIfNonDiagnosticsProducing(); if (sourceFile) { + // Some global diagnostics are deferred until they are needed and + // may not be reported in the firt call to getGlobalDiagnostics. + // We should catch these changes and report them. + var previousGlobalDiagnostics = diagnostics.getGlobalDiagnostics(); + var previousGlobalDiagnosticsSize = previousGlobalDiagnostics.length; checkSourceFile(sourceFile); - return diagnostics.getDiagnostics(sourceFile.fileName); + var semanticDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName); + var currentGlobalDiagnostics = diagnostics.getGlobalDiagnostics(); + if (currentGlobalDiagnostics !== previousGlobalDiagnostics) { + // If the arrays are not the same reference, new diagnostics were added. + var deferredGlobalDiagnostics = ts.relativeComplement(previousGlobalDiagnostics, currentGlobalDiagnostics, ts.compareDiagnostics); + return ts.concatenate(deferredGlobalDiagnostics, semanticDiagnostics); + } + else if (previousGlobalDiagnosticsSize === 0 && currentGlobalDiagnostics.length > 0) { + // If the arrays are the same reference, but the length has changed, a single + // new diagnostic was added as DiagnosticCollection attempts to reuse the + // same array. + return ts.concatenate(currentGlobalDiagnostics, semanticDiagnostics); + } + return semanticDiagnostics; } + // Global diagnostics are always added when a file is not provided to + // getDiagnostics ts.forEach(host.getSourceFiles(), checkSourceFile); return diagnostics.getDiagnostics(); } @@ -32632,7 +41962,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 212 /* WithStatement */ && node.parent.statement === node) { + if (node.parent.kind === 217 /* WithStatement */ && node.parent.statement === node) { return true; } node = node.parent; @@ -32642,7 +41972,7 @@ var ts; } function getSymbolsInScope(location, meaning) { var symbols = ts.createMap(); - var memberFlags = 0; + var memberFlags = 0 /* None */; if (isInsideWithStatementBody(location)) { // We cannot answer semantic questions within a with block, do not proceed any further return []; @@ -32655,25 +41985,25 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 256 /* SourceFile */: + case 261 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 225 /* ModuleDeclaration */: + case 230 /* ModuleDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931 /* ModuleMember */); break; - case 224 /* EnumDeclaration */: + case 229 /* EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */); break; - case 192 /* ClassExpression */: + case 197 /* ClassExpression */: var className = location.name; if (className) { copySymbol(location.symbol, meaning); } // fall through; this fall-through is necessary because we would like to handle // type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration - case 221 /* ClassDeclaration */: - case 222 /* InterfaceDeclaration */: + case 226 /* ClassDeclaration */: + case 227 /* InterfaceDeclaration */: // If we didn't come from static member of class or interface, // add the type parameters into the symbol table // (type parameters of classDeclaration/classExpression and interface are in member property of the symbol. @@ -32682,7 +42012,7 @@ var ts; copySymbols(getSymbolOfNode(location).members, meaning & 793064 /* Type */); } break; - case 179 /* FunctionExpression */: + case 184 /* FunctionExpression */: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -32692,7 +42022,7 @@ var ts; if (ts.introducesArgumentsExoticObject(location)) { copySymbol(argumentsSymbol, meaning); } - memberFlags = location.flags; + memberFlags = ts.getModifierFlags(location); location = location.parent; } copySymbols(globals, meaning); @@ -32725,34 +42055,34 @@ var ts; } } function isTypeDeclarationName(name) { - return name.kind === 69 /* Identifier */ && + return name.kind === 70 /* Identifier */ && isTypeDeclaration(name.parent) && name.parent.name === name; } function isTypeDeclaration(node) { switch (node.kind) { - case 141 /* TypeParameter */: - case 221 /* ClassDeclaration */: - case 222 /* InterfaceDeclaration */: - case 223 /* TypeAliasDeclaration */: - case 224 /* EnumDeclaration */: + case 143 /* TypeParameter */: + case 226 /* ClassDeclaration */: + case 227 /* InterfaceDeclaration */: + case 228 /* TypeAliasDeclaration */: + case 229 /* EnumDeclaration */: return true; } } // True if the given identifier is part of a type reference function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 139 /* QualifiedName */) { + while (node.parent && node.parent.kind === 141 /* QualifiedName */) { node = node.parent; } - return node.parent && (node.parent.kind === 155 /* TypeReference */ || node.parent.kind === 267 /* JSDocTypeReference */); + return node.parent && (node.parent.kind === 157 /* TypeReference */ || node.parent.kind === 272 /* JSDocTypeReference */); } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 172 /* PropertyAccessExpression */) { + while (node.parent && node.parent.kind === 177 /* PropertyAccessExpression */) { node = node.parent; } - return node.parent && node.parent.kind === 194 /* ExpressionWithTypeArguments */; + return node.parent && node.parent.kind === 199 /* ExpressionWithTypeArguments */; } function forEachEnclosingClass(node, callback) { var result; @@ -32769,13 +42099,13 @@ var ts; return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 139 /* QualifiedName */) { + while (nodeOnRightSide.parent.kind === 141 /* QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 229 /* ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 234 /* ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 235 /* ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 240 /* ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -32787,7 +42117,7 @@ var ts; if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 172 /* PropertyAccessExpression */) { + if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 177 /* PropertyAccessExpression */) { var specialPropertyAssignmentKind = ts.getSpecialPropertyAssignmentKind(entityName.parent.parent); switch (specialPropertyAssignmentKind) { case 1 /* ExportsProperty */: @@ -32799,15 +42129,15 @@ var ts; default: } } - if (entityName.parent.kind === 235 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) { - return resolveEntityName(entityName, + if (entityName.parent.kind === 240 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) { + return resolveEntityName(entityName, /*all meanings*/ 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */ | 8388608 /* Alias */); } - if (entityName.kind !== 172 /* PropertyAccessExpression */ && isInRightSideOfImportOrExportAssignment(entityName)) { + if (entityName.kind !== 177 /* PropertyAccessExpression */ && isInRightSideOfImportOrExportAssignment(entityName)) { // Since we already checked for ExportAssignment, this really could only be an Import - var importEqualsDeclaration = ts.getAncestor(entityName, 229 /* ImportEqualsDeclaration */); + var importEqualsDeclaration = ts.getAncestor(entityName, 234 /* ImportEqualsDeclaration */); ts.Debug.assert(importEqualsDeclaration !== undefined); - return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importEqualsDeclaration, /*dontResolveAlias*/ true); + return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, /*dontResolveAlias*/ true); } if (ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; @@ -32815,7 +42145,7 @@ var ts; if (isHeritageClauseElementIdentifier(entityName)) { var meaning = 0 /* None */; // In an interface or class, we're definitely interested in a type. - if (entityName.parent.kind === 194 /* ExpressionWithTypeArguments */) { + if (entityName.parent.kind === 199 /* ExpressionWithTypeArguments */) { meaning = 793064 /* Type */; // In a class 'extends' clause we are also looking for a value. if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { @@ -32828,25 +42158,25 @@ var ts; meaning |= 8388608 /* Alias */; return resolveEntityName(entityName, meaning); } - else if (ts.isExpression(entityName)) { + else if (ts.isPartOfExpression(entityName)) { if (ts.nodeIsMissing(entityName)) { // Missing entity name. return undefined; } - if (entityName.kind === 69 /* Identifier */) { + if (entityName.kind === 70 /* Identifier */) { if (ts.isJSXTagName(entityName) && isJsxIntrinsicIdentifier(entityName)) { return getIntrinsicTagSymbol(entityName.parent); } return resolveEntityName(entityName, 107455 /* Value */, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); } - else if (entityName.kind === 172 /* PropertyAccessExpression */) { + else if (entityName.kind === 177 /* PropertyAccessExpression */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 139 /* QualifiedName */) { + else if (entityName.kind === 141 /* QualifiedName */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -32855,20 +42185,20 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = (entityName.parent.kind === 155 /* TypeReference */ || entityName.parent.kind === 267 /* JSDocTypeReference */) ? 793064 /* Type */ : 1920 /* Namespace */; + var meaning = (entityName.parent.kind === 157 /* TypeReference */ || entityName.parent.kind === 272 /* JSDocTypeReference */) ? 793064 /* Type */ : 1920 /* Namespace */; return resolveEntityName(entityName, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); } - else if (entityName.parent.kind === 246 /* JsxAttribute */) { + else if (entityName.parent.kind === 250 /* JsxAttribute */) { return getJsxAttributePropertySymbol(entityName.parent); } - if (entityName.parent.kind === 154 /* TypePredicate */) { + if (entityName.parent.kind === 156 /* TypePredicate */) { return resolveEntityName(entityName, /*meaning*/ 1 /* FunctionScopedVariable */); } // Do we want to return undefined here? return undefined; } function getSymbolAtLocation(node) { - if (node.kind === 256 /* SourceFile */) { + if (node.kind === 261 /* SourceFile */) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } if (isInsideWithStatementBody(node)) { @@ -32882,12 +42212,12 @@ var ts; else if (ts.isLiteralComputedPropertyDeclarationName(node)) { return getSymbolOfNode(node.parent.parent); } - if (node.kind === 69 /* Identifier */) { + if (node.kind === 70 /* Identifier */) { if (isInRightSideOfImportOrExportAssignment(node)) { return getSymbolOfEntityNameOrPropertyAccessExpression(node); } - else if (node.parent.kind === 169 /* BindingElement */ && - node.parent.parent.kind === 167 /* ObjectBindingPattern */ && + else if (node.parent.kind === 174 /* BindingElement */ && + node.parent.parent.kind === 172 /* ObjectBindingPattern */ && node === node.parent.propertyName) { var typeOfPattern = getTypeOfNode(node.parent.parent); var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text); @@ -32897,11 +42227,11 @@ var ts; } } switch (node.kind) { - case 69 /* Identifier */: - case 172 /* PropertyAccessExpression */: - case 139 /* QualifiedName */: + case 70 /* Identifier */: + case 177 /* PropertyAccessExpression */: + case 141 /* QualifiedName */: return getSymbolOfEntityNameOrPropertyAccessExpression(node); - case 97 /* ThisKeyword */: + case 98 /* ThisKeyword */: var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); if (ts.isFunctionLike(container)) { var sig = getSignatureFromDeclaration(container); @@ -32910,15 +42240,15 @@ var ts; } } // fallthrough - case 95 /* SuperKeyword */: - var type = ts.isExpression(node) ? checkExpression(node) : getTypeFromTypeNode(node); + case 96 /* SuperKeyword */: + var type = ts.isPartOfExpression(node) ? getTypeOfExpression(node) : getTypeFromTypeNode(node); return type.symbol; - case 165 /* ThisType */: + case 167 /* ThisType */: return getTypeFromTypeNode(node).symbol; - case 121 /* ConstructorKeyword */: + case 122 /* ConstructorKeyword */: // constructor keyword for an overload, should take us to the definition if it exist var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 148 /* Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 150 /* Constructor */) { return constructorDeclaration.parent.symbol; } return undefined; @@ -32926,15 +42256,18 @@ var ts; // External module name in an import declaration if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 230 /* ImportDeclaration */ || node.parent.kind === 236 /* ExportDeclaration */) && + ((node.parent.kind === 235 /* ImportDeclaration */ || node.parent.kind === 241 /* ExportDeclaration */) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } + if (ts.isInJavaScriptFile(node) && ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteral*/ false)) { + return resolveExternalModuleName(node, node); + } // Fall through case 8 /* NumericLiteral */: // index access - if (node.parent.kind === 173 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { - var objectType = checkExpression(node.parent.expression); + if (node.parent.kind === 178 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { + var objectType = getTypeOfExpression(node.parent.expression); if (objectType === unknownType) return undefined; var apparentType = getApparentType(objectType); @@ -32950,7 +42283,7 @@ var ts; // The function returns a value symbol of an identifier in the short-hand property assignment. // This is necessary as an identifier in short-hand property assignment can contains two meaning: // property name and property value. - if (location && location.kind === 254 /* ShorthandPropertyAssignment */) { + if (location && location.kind === 258 /* ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 107455 /* Value */ | 8388608 /* Alias */); } return undefined; @@ -32966,11 +42299,11 @@ var ts; // We cannot answer semantic questions within a with block, do not proceed any further return unknownType; } - if (ts.isTypeNode(node)) { + if (ts.isPartOfTypeNode(node)) { return getTypeFromTypeNode(node); } - if (ts.isExpression(node)) { - return getTypeOfExpression(node); + if (ts.isPartOfExpression(node)) { + return getRegularTypeOfExpression(node); } if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(node)) { // A SyntaxKind.ExpressionWithTypeArguments is considered a type node, except when it occurs in the @@ -33012,28 +42345,28 @@ var ts; // [ a ] from // [a] = [ some array ...] function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) { - ts.Debug.assert(expr.kind === 171 /* ObjectLiteralExpression */ || expr.kind === 170 /* ArrayLiteralExpression */); + ts.Debug.assert(expr.kind === 176 /* ObjectLiteralExpression */ || expr.kind === 175 /* ArrayLiteralExpression */); // If this is from "for of" // for ( { a } of elems) { // } - if (expr.parent.kind === 208 /* ForOfStatement */) { + if (expr.parent.kind === 213 /* ForOfStatement */) { var iteratedType = checkRightHandSideOfForOf(expr.parent.expression); return checkDestructuringAssignment(expr, iteratedType || unknownType); } // If this is from "for" initializer // for ({a } = elems[0];.....) { } - if (expr.parent.kind === 187 /* BinaryExpression */) { - var iteratedType = checkExpression(expr.parent.right); + if (expr.parent.kind === 192 /* BinaryExpression */) { + var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || unknownType); } // If this is from nested object binding pattern // for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { - if (expr.parent.kind === 253 /* PropertyAssignment */) { + if (expr.parent.kind === 257 /* PropertyAssignment */) { var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); } // Array literal assignment - array destructuring pattern - ts.Debug.assert(expr.parent.kind === 170 /* ArrayLiteralExpression */); + ts.Debug.assert(expr.parent.kind === 175 /* ArrayLiteralExpression */); // [{ property1: p1, property2 }] = elems; var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent); var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, /*allowStringInput*/ false) || unknownType; @@ -33050,11 +42383,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 checkExpression(expr); + return getRegularTypeOfLiteralType(getTypeOfExpression(expr)); } /** * Gets either the static or instance type of a class element, based on @@ -33062,7 +42395,7 @@ var ts; */ function getParentTypeOfClassElement(node) { var classSymbol = getSymbolOfNode(node.parent); - return node.flags & 32 /* Static */ + return ts.getModifierFlags(node) & 32 /* Static */ ? getTypeOfSymbol(classSymbol) : getDeclaredTypeOfSymbol(classSymbol); } @@ -33083,9 +42416,9 @@ var ts; function getRootSymbols(symbol) { if (symbol.flags & 268435456 /* SyntheticProperty */) { var symbols_3 = []; - var name_20 = symbol.name; + var name_26 = symbol.name; ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) { - var symbol = getPropertyOfType(t, name_20); + var symbol = getPropertyOfType(t, name_26); if (symbol) { symbols_3.push(symbol); } @@ -33093,6 +42426,10 @@ var ts; return symbols_3; } else if (symbol.flags & 67108864 /* Transient */) { + if (symbol.leftSpread) { + var links = symbol; + return [links.leftSpread, links.rightSpread]; + } var target = void 0; var next = symbol; while (next = getSymbolLinks(next).target) { @@ -33106,7 +42443,13 @@ var ts; } // Emitter support function isArgumentsLocalBinding(node) { - return getReferencedValueSymbol(node) === argumentsSymbol; + if (!ts.isGeneratedIdentifier(node)) { + node = ts.getParseTreeNode(node, ts.isIdentifier); + if (node) { + return getReferencedValueSymbol(node) === argumentsSymbol; + } + } + return false; } function moduleExportsSomeValue(moduleReferenceExpression) { var moduleSymbol = resolveExternalModuleName(moduleReferenceExpression.parent, moduleReferenceExpression); @@ -33132,32 +42475,44 @@ var ts; return s && !!(s.flags & 107455 /* Value */); } } + function isNameOfModuleOrEnumDeclaration(node) { + var parent = node.parent; + 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. - function getReferencedExportContainer(node) { - var symbol = getReferencedValueSymbol(node); - if (symbol) { - if (symbol.flags & 1048576 /* ExportValue */) { - // If we reference an exported entity within the same module declaration, then whether - // we prefix depends on the kind of entity. SymbolFlags.ExportHasLocal encompasses all the - // kinds that we do NOT prefix. - var exportSymbol = getMergedSymbol(symbol.exportSymbol); - if (exportSymbol.flags & 944 /* ExportHasLocal */) { - return undefined; - } - symbol = exportSymbol; - } - var parentSymbol = getParentOfSymbol(symbol); - if (parentSymbol) { - if (parentSymbol.flags & 512 /* ValueModule */ && parentSymbol.valueDeclaration.kind === 256 /* SourceFile */) { - // If `node` accesses an export and that export isn't in the same file, then symbol is a namespace export, so return undefined. - if (parentSymbol.valueDeclaration === ts.getSourceFileOfNode(node)) { - return parentSymbol.valueDeclaration; + function getReferencedExportContainer(node, prefixLocals) { + node = ts.getParseTreeNode(node, ts.isIdentifier); + if (node) { + // When resolving the export container for the name of a module or enum + // declaration, we need to start resolution at the declaration's container. + // Otherwise, we could incorrectly resolve the export container as the + // declaration if it contains an exported member with the same name. + var symbol = getReferencedValueSymbol(node, /*startInDeclarationContainer*/ isNameOfModuleOrEnumDeclaration(node)); + if (symbol) { + if (symbol.flags & 1048576 /* ExportValue */) { + // If we reference an exported entity within the same module declaration, then whether + // we prefix depends on the kind of entity. SymbolFlags.ExportHasLocal encompasses all the + // kinds that we do NOT prefix. + var exportSymbol = getMergedSymbol(symbol.exportSymbol); + if (!prefixLocals && exportSymbol.flags & 944 /* ExportHasLocal */) { + return undefined; } + symbol = exportSymbol; } - for (var n = node.parent; n; n = n.parent) { - if ((n.kind === 225 /* ModuleDeclaration */ || n.kind === 224 /* EnumDeclaration */) && getSymbolOfNode(n) === parentSymbol) { - return n; + var parentSymbol = getParentOfSymbol(symbol); + if (parentSymbol) { + if (parentSymbol.flags & 512 /* ValueModule */ && parentSymbol.valueDeclaration.kind === 261 /* SourceFile */) { + var symbolFile = parentSymbol.valueDeclaration; + var referenceFile = ts.getSourceFileOfNode(node); + // If `node` accesses an export and that export isn't in the same file, then symbol is a namespace export, so return undefined. + var symbolIsUmdExport = symbolFile !== referenceFile; + return symbolIsUmdExport ? undefined : symbolFile; + } + for (var n = node.parent; n; n = n.parent) { + if (ts.isModuleOrEnumDeclaration(n) && getSymbolOfNode(n) === parentSymbol) { + return n; + } } } } @@ -33166,8 +42521,14 @@ var ts; // When resolved as an expression identifier, if the given node references an import, return the declaration of // that import. Otherwise, return undefined. function getReferencedImportDeclaration(node) { - var symbol = getReferencedValueSymbol(node); - return symbol && symbol.flags & 8388608 /* Alias */ ? getDeclarationOfAliasSymbol(symbol) : undefined; + node = ts.getParseTreeNode(node, ts.isIdentifier); + if (node) { + var symbol = getReferencedValueSymbol(node); + if (symbol && symbol.flags & 8388608 /* Alias */) { + return getDeclarationOfAliasSymbol(symbol); + } + } + return undefined; } function isSymbolOfDeclarationWithCollidingName(symbol) { if (symbol.flags & 418 /* BlockScoped */) { @@ -33198,7 +42559,7 @@ var ts; // they will not collide with anything var isDeclaredInLoop = nodeLinks_1.flags & 262144 /* BlockScopedBindingInLoop */; var inLoopInitializer = ts.isIterationStatement(container, /*lookInLabeledStatements*/ false); - var inLoopBodyBlock = container.kind === 199 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); + var inLoopBodyBlock = container.kind === 204 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -33214,32 +42575,56 @@ var ts; // a name that either hides an existing name or might hide it when compiled downlevel, // return the declaration of that entity. Otherwise, return undefined. function getReferencedDeclarationWithCollidingName(node) { - var symbol = getReferencedValueSymbol(node); - return symbol && isSymbolOfDeclarationWithCollidingName(symbol) ? symbol.valueDeclaration : undefined; + if (!ts.isGeneratedIdentifier(node)) { + node = ts.getParseTreeNode(node, ts.isIdentifier); + if (node) { + var symbol = getReferencedValueSymbol(node); + if (symbol && isSymbolOfDeclarationWithCollidingName(symbol)) { + return symbol.valueDeclaration; + } + } + } + return undefined; } // Return true if the given node is a declaration of a nested block scoped entity with a name that either hides an // existing name or might hide a name when compiled downlevel function isDeclarationWithCollidingName(node) { - return isSymbolOfDeclarationWithCollidingName(getSymbolOfNode(node)); + node = ts.getParseTreeNode(node, ts.isDeclaration); + if (node) { + var symbol = getSymbolOfNode(node); + if (symbol) { + return isSymbolOfDeclarationWithCollidingName(symbol); + } + } + return false; } function isValueAliasDeclaration(node) { + node = ts.getParseTreeNode(node); + if (node === undefined) { + // A synthesized node comes from an emit transformation and is always a value. + return true; + } switch (node.kind) { - case 229 /* ImportEqualsDeclaration */: - case 231 /* ImportClause */: - case 232 /* NamespaceImport */: - case 234 /* ImportSpecifier */: - case 238 /* ExportSpecifier */: - return isAliasResolvedToValue(getSymbolOfNode(node)); - case 236 /* ExportDeclaration */: + case 234 /* ImportEqualsDeclaration */: + case 236 /* ImportClause */: + case 237 /* NamespaceImport */: + case 239 /* ImportSpecifier */: + case 243 /* ExportSpecifier */: + return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol); + case 241 /* ExportDeclaration */: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 235 /* ExportAssignment */: - return node.expression && node.expression.kind === 69 /* Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; + case 240 /* ExportAssignment */: + return node.expression + && node.expression.kind === 70 /* Identifier */ + ? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol) + : true; } return false; } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 256 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + node = ts.getParseTreeNode(node, ts.isImportEqualsDeclaration); + if (node === undefined || node.parent.kind !== 261 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -33260,9 +42645,14 @@ var ts; return isConstEnumSymbol(s) || s.constEnumOnlyModule; } function isReferencedAliasDeclaration(node, checkChildren) { + node = ts.getParseTreeNode(node); + // Purely synthesized nodes are always emitted. + if (node === undefined) { + return true; + } if (ts.isAliasSymbolDeclaration(node)) { var symbol = getSymbolOfNode(node); - if (getSymbolLinks(symbol).referenced) { + if (symbol && getSymbolLinks(symbol).referenced) { return true; } } @@ -33292,14 +42682,15 @@ var ts; return false; } function getNodeCheckFlags(node) { - return getNodeLinks(node).flags; + node = ts.getParseTreeNode(node); + return node ? getNodeLinks(node).flags : undefined; } function getEnumMemberValue(node) { computeEnumMemberValues(node.parent); return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 255 /* EnumMember */) { + if (node.kind === 260 /* EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -33312,17 +42703,21 @@ var ts; return undefined; } function isFunctionType(type) { - return type.flags & 2588672 /* ObjectType */ && getSignaturesOfType(type, 0 /* Call */).length > 0; + return type.flags & 32768 /* Object */ && getSignaturesOfType(type, 0 /* Call */).length > 0; } - function getTypeReferenceSerializationKind(typeName) { + function getTypeReferenceSerializationKind(typeName, location) { // Resolve the symbol as a value to ensure the type can be reached at runtime during emit. - var valueSymbol = resolveEntityName(typeName, 107455 /* Value */, /*ignoreErrors*/ true); + var valueSymbol = resolveEntityName(typeName, 107455 /* Value */, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location); + var globalPromiseSymbol = tryGetGlobalPromiseConstructorSymbol(); + if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) { + return ts.TypeReferenceSerializationKind.Promise; + } var constructorType = valueSymbol ? getTypeOfSymbol(valueSymbol) : undefined; if (constructorType && isConstructorType(constructorType)) { return ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue; } // Resolve the symbol as a type so that we can provide a more useful hint for the type serializer. - var typeSymbol = resolveEntityName(typeName, 793064 /* Type */, /*ignoreErrors*/ true); + var typeSymbol = resolveEntityName(typeName, 793064 /* Type */, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location); // We might not be able to resolve type symbol so use unknown type in that case (eg error case) if (!typeSymbol) { return ts.TypeReferenceSerializationKind.ObjectType; @@ -33334,8 +42729,8 @@ var ts; else if (type.flags & 1 /* Any */) { return ts.TypeReferenceSerializationKind.ObjectType; } - else if (isTypeOfKind(type, 1024 /* Void */)) { - return ts.TypeReferenceSerializationKind.VoidType; + else if (isTypeOfKind(type, 1024 /* Void */ | 6144 /* Nullable */ | 8192 /* Never */)) { + return ts.TypeReferenceSerializationKind.VoidNullableOrNeverType; } else if (isTypeOfKind(type, 136 /* BooleanLike */)) { return ts.TypeReferenceSerializationKind.BooleanType; @@ -33343,7 +42738,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)) { @@ -33366,7 +42761,7 @@ var ts; // Get type of the symbol if this is the valid symbol otherwise get type at location var symbol = getSymbolOfNode(declaration); var type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) - ? getTypeOfSymbol(symbol) + ? getWidenedLiteralType(getTypeOfSymbol(symbol)) : unknownType; getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } @@ -33375,7 +42770,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) { @@ -33387,15 +42782,44 @@ var ts; function hasGlobalName(name) { return !!globals[name]; } - function getReferencedValueSymbol(reference) { - return getNodeLinks(reference).resolvedSymbol || - resolveName(reference, reference.text, 107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */, - /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined); + function getReferencedValueSymbol(reference, startInDeclarationContainer) { + var resolvedSymbol = getNodeLinks(reference).resolvedSymbol; + if (resolvedSymbol) { + return resolvedSymbol; + } + var location = reference; + 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); + } + } + return resolveName(location, reference.text, 107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined); } function getReferencedValueDeclaration(reference) { - ts.Debug.assert(!ts.nodeIsSynthesized(reference)); - var symbol = getReferencedValueSymbol(reference); - return symbol && getExportSymbolOfValueSymbolIfExported(symbol).valueDeclaration; + if (!ts.isGeneratedIdentifier(reference)) { + reference = ts.getParseTreeNode(reference, ts.isIdentifier); + if (reference) { + var symbol = getReferencedValueSymbol(reference); + if (symbol) { + return getExportSymbolOfValueSymbolIfExported(symbol).valueDeclaration; + } + } + } + return undefined; + } + function isLiteralConstDeclaration(node) { + if (ts.isConst(node)) { + var type = getTypeOfSymbol(getSymbolOfNode(node)); + return !!(type.flags & 96 /* StringOrNumberLiteral */ && type.flags & 1048576 /* FreshLiteral */); + } + return false; + } + function writeLiteralConstValue(node, writer) { + var type = getTypeOfSymbol(getSymbolOfNode(node)); + writer.writeStringLiteral(literalTypeToString(type)); } function createResolver() { // this variable and functions that use it are deliberately moved here from the outer scope @@ -33441,7 +42865,10 @@ var ts; isArgumentsLocalBinding: isArgumentsLocalBinding, getExternalModuleFileFromDeclaration: getExternalModuleFileFromDeclaration, getTypeReferenceDirectivesForEntityName: getTypeReferenceDirectivesForEntityName, - getTypeReferenceDirectivesForSymbol: getTypeReferenceDirectivesForSymbol + getTypeReferenceDirectivesForSymbol: getTypeReferenceDirectivesForSymbol, + isLiteralConstDeclaration: isLiteralConstDeclaration, + writeLiteralConstValue: writeLiteralConstValue, + getJsxFactoryEntity: function () { return _jsxFactoryEntity; } }; // defined here to avoid outer scope pollution function getTypeReferenceDirectivesForEntityName(node) { @@ -33452,7 +42879,7 @@ var ts; // property access can only be used as values // qualified names can only be used as types\namespaces // identifiers are treated as values only if they appear in type queries - var meaning = (node.kind === 172 /* PropertyAccessExpression */) || (node.kind === 69 /* Identifier */ && isInTypeQuery(node)) + var meaning = (node.kind === 177 /* PropertyAccessExpression */) || (node.kind === 70 /* Identifier */ && isInTypeQuery(node)) ? 107455 /* Value */ | 1048576 /* ExportValue */ : 793064 /* Type */ | 1920 /* Namespace */; var symbol = resolveEntityName(node, meaning, /*ignoreErrors*/ true); @@ -33478,6 +42905,10 @@ var ts; if (typeReferenceDirective) { (typeReferenceDirectives || (typeReferenceDirectives = [])).push(typeReferenceDirective); } + else { + // found at least one entry that does not originate from type reference directive + return undefined; + } } } return typeReferenceDirectives; @@ -33491,15 +42922,15 @@ var ts; // external modules cannot define or contribute to type declaration files var current = symbol; while (true) { - var parent_12 = getParentOfSymbol(current); - if (parent_12) { - current = parent_12; + var parent_13 = getParentOfSymbol(current); + if (parent_13) { + current = parent_13; } else { break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 256 /* SourceFile */ && current.flags & 512 /* ValueModule */) { + if (current.valueDeclaration && current.valueDeclaration.kind === 261 /* SourceFile */ && current.flags & 512 /* ValueModule */) { return false; } // check that at least one declaration of top level symbol originates from type declaration file @@ -33519,16 +42950,18 @@ var ts; if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 256 /* SourceFile */); + return ts.getDeclarationOfKind(moduleSymbol, 261 /* SourceFile */); } function initializeTypeChecker() { // Bind all source files and propagate errors - ts.forEach(host.getSourceFiles(), function (file) { + for (var _i = 0, _a = host.getSourceFiles(); _i < _a.length; _i++) { + var file = _a[_i]; ts.bindSourceFile(file, compilerOptions); - }); - var augmentations; + } // Initialize global symbol table - ts.forEach(host.getSourceFiles(), function (file) { + var augmentations; + for (var _b = 0, _c = host.getSourceFiles(); _b < _c.length; _b++) { + var file = _c[_b]; if (!ts.isExternalOrCommonJsModule(file)) { mergeSymbolTable(globals, file.locals); } @@ -33539,16 +42972,22 @@ var ts; (augmentations || (augmentations = [])).push(file.moduleAugmentations); } if (file.symbol && file.symbol.globalExports) { - mergeSymbolTable(globals, file.symbol.globalExports); + // Merge in UMD exports with first-in-wins semantics (see #9771) + var source = file.symbol.globalExports; + for (var id in source) { + if (!(id in globals)) { + globals[id] = source[id]; + } + } } - }); + } if (augmentations) { // merge module augmentations. // this needs to be done after global symbol table is initialized to make sure that all ambient modules are indexed - for (var _i = 0, augmentations_1 = augmentations; _i < augmentations_1.length; _i++) { - var list = augmentations_1[_i]; - for (var _a = 0, list_2 = list; _a < list_2.length; _a++) { - var augmentation = list_2[_a]; + for (var _d = 0, augmentations_1 = augmentations; _d < augmentations_1.length; _d++) { + var list = augmentations_1[_d]; + for (var _e = 0, list_1 = list; _e < list_1.length; _e++) { + var augmentation = list_1[_e]; mergeModuleAugmentation(augmentation); } } @@ -33578,10 +43017,11 @@ var ts; getGlobalPromiseLikeType = ts.memoize(function () { return getGlobalType("PromiseLike", /*arity*/ 1); }); getInstantiatedGlobalPromiseLikeType = ts.memoize(createInstantiatedPromiseLikeType); getGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Promise"); }); + tryGetGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalSymbol("Promise", 107455 /* Value */, /*diagnostic*/ undefined) && getGlobalPromiseConstructorSymbol(); }); getGlobalPromiseConstructorLikeType = ts.memoize(function () { return getGlobalType("PromiseConstructorLike"); }); getGlobalThenableType = ts.memoize(createThenableType); getGlobalTemplateStringsArrayType = ts.memoize(function () { return getGlobalType("TemplateStringsArray"); }); - if (languageVersion >= 2 /* ES6 */) { + if (languageVersion >= 2 /* ES2015 */) { getGlobalESSymbolType = ts.memoize(function () { return getGlobalType("Symbol"); }); getGlobalIterableType = ts.memoize(function () { return getGlobalType("Iterable", /*arity*/ 1); }); getGlobalIteratorType = ts.memoize(function () { return getGlobalType("Iterator", /*arity*/ 1); }); @@ -33594,10 +43034,50 @@ var ts; getGlobalIterableIteratorType = ts.memoize(function () { return emptyGenericType; }); } anyArrayType = createArrayType(anyType); + autoArrayType = createArrayType(autoType); var symbol = getGlobalSymbol("ReadonlyArray", 793064 /* Type */, /*diagnostic*/ undefined); globalReadonlyArrayType = symbol && getTypeOfGlobalSymbol(symbol, /*arity*/ 1); anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType; } + function checkExternalEmitHelpers(location, helpers) { + if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) { + var sourceFile = ts.getSourceFileOfNode(location); + if (ts.isEffectiveExternalModule(sourceFile, compilerOptions)) { + var helpersModule = resolveHelpersModule(sourceFile, location); + if (helpersModule !== unknownSymbol) { + var uncheckedHelpers = helpers & ~requestedExternalEmitHelpers; + for (var helper = 1 /* FirstEmitHelper */; helper <= 128 /* LastEmitHelper */; helper <<= 1) { + if (uncheckedHelpers & helper) { + var name_27 = getHelperName(helper); + var symbol = getSymbol(helpersModule.exports, ts.escapeIdentifier(name_27), 107455 /* Value */); + if (!symbol) { + error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name_27); + } + } + } + } + requestedExternalEmitHelpers |= helpers; + } + } + } + function getHelperName(helper) { + switch (helper) { + case 1 /* Extends */: return "__extends"; + case 2 /* Assign */: return "__assign"; + case 4 /* Rest */: return "__rest"; + case 8 /* Decorate */: return "__decorate"; + case 16 /* Metadata */: return "__metadata"; + case 32 /* Param */: return "__param"; + case 64 /* Awaiter */: return "__awaiter"; + case 128 /* Generator */: return "__generator"; + } + } + function resolveHelpersModule(node, errorNode) { + if (!externalHelpersModule) { + externalHelpersModule = resolveExternalModule(node, ts.externalHelpersModuleNameText, ts.Diagnostics.This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found, errorNode) || unknownSymbol; + } + return externalHelpersModule; + } function createInstantiatedPromiseLikeType() { var promiseLikeType = getGlobalPromiseLikeType(); if (promiseLikeType !== emptyGenericType) { @@ -33609,7 +43089,7 @@ var ts; // build the thenable type that is used to verify against a non-promise "thenable" operand to `await`. var thenPropertySymbol = createSymbol(67108864 /* Transient */ | 4 /* Property */, "then"); getSymbolLinks(thenPropertySymbol).type = globalFunctionType; - var thenableType = createObjectType(2097152 /* Anonymous */); + var thenableType = createObjectType(16 /* Anonymous */); thenableType.properties = [thenPropertySymbol]; thenableType.members = createSymbolTable(thenableType.properties); thenableType.callSignatures = []; @@ -33622,14 +43102,14 @@ var ts; return false; } if (!ts.nodeCanBeDecorated(node)) { - if (node.kind === 147 /* MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { + if (node.kind === 149 /* MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); } else { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } } - else if (node.kind === 149 /* GetAccessor */ || node.kind === 150 /* SetAccessor */) { + else if (node.kind === 151 /* GetAccessor */ || node.kind === 152 /* SetAccessor */) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -33643,31 +43123,31 @@ var ts; return quickResult; } var lastStatic, lastPrivate, lastProtected, lastDeclare, lastAsync, lastReadonly; - var flags = 0; + var flags = 0 /* None */; for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; - if (modifier.kind !== 128 /* ReadonlyKeyword */) { - if (node.kind === 144 /* PropertySignature */ || node.kind === 146 /* MethodSignature */) { + if (modifier.kind !== 130 /* ReadonlyKeyword */) { + if (node.kind === 146 /* PropertySignature */ || node.kind === 148 /* MethodSignature */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); } - if (node.kind === 153 /* IndexSignature */) { + if (node.kind === 155 /* IndexSignature */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)); } } switch (modifier.kind) { - case 74 /* ConstKeyword */: - if (node.kind !== 224 /* EnumDeclaration */ && node.parent.kind === 221 /* ClassDeclaration */) { - return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(74 /* ConstKeyword */)); + case 75 /* ConstKeyword */: + if (node.kind !== 229 /* EnumDeclaration */ && node.parent.kind === 226 /* ClassDeclaration */) { + return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(75 /* ConstKeyword */)); } break; - case 112 /* PublicKeyword */: - case 111 /* ProtectedKeyword */: - case 110 /* PrivateKeyword */: + case 113 /* PublicKeyword */: + case 112 /* ProtectedKeyword */: + case 111 /* PrivateKeyword */: var text = visibilityToString(ts.modifierToFlag(modifier.kind)); - if (modifier.kind === 111 /* ProtectedKeyword */) { + if (modifier.kind === 112 /* ProtectedKeyword */) { lastProtected = modifier; } - else if (modifier.kind === 110 /* PrivateKeyword */) { + else if (modifier.kind === 111 /* PrivateKeyword */) { lastPrivate = modifier; } if (flags & 28 /* AccessibilityModifier */) { @@ -33682,11 +43162,11 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 226 /* ModuleBlock */ || node.parent.kind === 256 /* SourceFile */) { + else if (node.parent.kind === 231 /* ModuleBlock */ || node.parent.kind === 261 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128 /* Abstract */) { - if (modifier.kind === 110 /* PrivateKeyword */) { + if (modifier.kind === 111 /* PrivateKeyword */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); } else { @@ -33695,7 +43175,7 @@ var ts; } flags |= ts.modifierToFlag(modifier.kind); break; - case 113 /* StaticKeyword */: + case 114 /* StaticKeyword */: if (flags & 32 /* Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } @@ -33705,10 +43185,10 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 226 /* ModuleBlock */ || node.parent.kind === 256 /* SourceFile */) { + else if (node.parent.kind === 231 /* ModuleBlock */ || node.parent.kind === 261 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 142 /* Parameter */) { + else if (node.kind === 144 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } else if (flags & 128 /* Abstract */) { @@ -33717,18 +43197,18 @@ var ts; flags |= 32 /* Static */; lastStatic = modifier; break; - case 128 /* ReadonlyKeyword */: + case 130 /* ReadonlyKeyword */: if (flags & 64 /* Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); } - else if (node.kind !== 145 /* PropertyDeclaration */ && node.kind !== 144 /* PropertySignature */ && node.kind !== 153 /* IndexSignature */ && node.kind !== 142 /* Parameter */) { + else if (node.kind !== 147 /* PropertyDeclaration */ && node.kind !== 146 /* PropertySignature */ && node.kind !== 155 /* IndexSignature */ && node.kind !== 144 /* Parameter */) { // If node.kind === SyntaxKind.Parameter, checkParameter report an error if it's not a parameter property. return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); } flags |= 64 /* Readonly */; lastReadonly = modifier; break; - case 82 /* ExportKeyword */: + case 83 /* ExportKeyword */: if (flags & 1 /* Export */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export"); } @@ -33741,45 +43221,45 @@ var ts; else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 221 /* ClassDeclaration */) { + else if (node.parent.kind === 226 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 142 /* Parameter */) { + else if (node.kind === 144 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1 /* Export */; break; - case 122 /* DeclareKeyword */: + case 123 /* DeclareKeyword */: if (flags & 2 /* Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } else if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 221 /* ClassDeclaration */) { + else if (node.parent.kind === 226 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 142 /* Parameter */) { + else if (node.kind === 144 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 226 /* ModuleBlock */) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 231 /* ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2 /* Ambient */; lastDeclare = modifier; break; - case 115 /* AbstractKeyword */: + case 116 /* AbstractKeyword */: if (flags & 128 /* Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 221 /* ClassDeclaration */) { - if (node.kind !== 147 /* MethodDeclaration */ && - node.kind !== 145 /* PropertyDeclaration */ && - node.kind !== 149 /* GetAccessor */ && - node.kind !== 150 /* SetAccessor */) { + if (node.kind !== 226 /* ClassDeclaration */) { + if (node.kind !== 149 /* MethodDeclaration */ && + node.kind !== 147 /* PropertyDeclaration */ && + node.kind !== 151 /* GetAccessor */ && + node.kind !== 152 /* SetAccessor */) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 221 /* ClassDeclaration */ && node.parent.flags & 128 /* Abstract */)) { + if (!(node.parent.kind === 226 /* ClassDeclaration */ && ts.getModifierFlags(node.parent) & 128 /* Abstract */)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32 /* Static */) { @@ -33791,14 +43271,14 @@ var ts; } flags |= 128 /* Abstract */; break; - case 118 /* AsyncKeyword */: + case 119 /* AsyncKeyword */: if (flags & 256 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); } else if (flags & 2 /* Ambient */ || ts.isInAmbientContext(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 142 /* Parameter */) { + else if (node.kind === 144 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } flags |= 256 /* Async */; @@ -33806,7 +43286,7 @@ var ts; break; } } - if (node.kind === 148 /* Constructor */) { + if (node.kind === 150 /* Constructor */) { if (flags & 32 /* Static */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -33821,13 +43301,13 @@ var ts; } return; } - else if ((node.kind === 230 /* ImportDeclaration */ || node.kind === 229 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { + else if ((node.kind === 235 /* ImportDeclaration */ || node.kind === 234 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 142 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { + else if (node.kind === 144 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern); } - else if (node.kind === 142 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && node.dotDotDotToken) { + else if (node.kind === 144 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && node.dotDotDotToken) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter); } if (flags & 256 /* Async */) { @@ -33847,38 +43327,38 @@ var ts; } function shouldReportBadModifier(node) { switch (node.kind) { - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - case 148 /* Constructor */: - case 145 /* PropertyDeclaration */: - case 144 /* PropertySignature */: - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - case 153 /* IndexSignature */: - case 225 /* ModuleDeclaration */: - case 230 /* ImportDeclaration */: - case 229 /* ImportEqualsDeclaration */: - case 236 /* ExportDeclaration */: - case 235 /* ExportAssignment */: - case 179 /* FunctionExpression */: - case 180 /* ArrowFunction */: - case 142 /* Parameter */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + case 150 /* Constructor */: + case 147 /* PropertyDeclaration */: + case 146 /* PropertySignature */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + case 155 /* IndexSignature */: + case 230 /* ModuleDeclaration */: + case 235 /* ImportDeclaration */: + case 234 /* ImportEqualsDeclaration */: + case 241 /* ExportDeclaration */: + case 240 /* ExportAssignment */: + case 184 /* FunctionExpression */: + case 185 /* ArrowFunction */: + case 144 /* Parameter */: return false; default: - if (node.parent.kind === 226 /* ModuleBlock */ || node.parent.kind === 256 /* SourceFile */) { + if (node.parent.kind === 231 /* ModuleBlock */ || node.parent.kind === 261 /* SourceFile */) { return false; } switch (node.kind) { - case 220 /* FunctionDeclaration */: - return nodeHasAnyModifiersExcept(node, 118 /* AsyncKeyword */); - case 221 /* ClassDeclaration */: - return nodeHasAnyModifiersExcept(node, 115 /* AbstractKeyword */); - case 222 /* InterfaceDeclaration */: - case 200 /* VariableStatement */: - case 223 /* TypeAliasDeclaration */: + case 225 /* FunctionDeclaration */: + return nodeHasAnyModifiersExcept(node, 119 /* AsyncKeyword */); + case 226 /* ClassDeclaration */: + return nodeHasAnyModifiersExcept(node, 116 /* AbstractKeyword */); + case 227 /* InterfaceDeclaration */: + case 205 /* VariableStatement */: + case 228 /* TypeAliasDeclaration */: return true; - case 224 /* EnumDeclaration */: - return nodeHasAnyModifiersExcept(node, 74 /* ConstKeyword */); + case 229 /* EnumDeclaration */: + return nodeHasAnyModifiersExcept(node, 75 /* ConstKeyword */); default: ts.Debug.fail(); return false; @@ -33889,14 +43369,11 @@ var ts; return node.modifiers.length > 1 || node.modifiers[0].kind !== allowedModifier; } function checkGrammarAsyncModifier(node, asyncModifier) { - if (languageVersion < 2 /* ES6 */) { - return grammarErrorOnNode(asyncModifier, ts.Diagnostics.Async_functions_are_only_available_when_targeting_ECMAScript_2015_or_higher); - } switch (node.kind) { - case 147 /* MethodDeclaration */: - case 220 /* FunctionDeclaration */: - case 179 /* FunctionExpression */: - case 180 /* ArrowFunction */: + case 149 /* MethodDeclaration */: + case 225 /* FunctionDeclaration */: + case 184 /* FunctionExpression */: + case 185 /* ArrowFunction */: if (!node.asteriskToken) { return false; } @@ -33912,7 +43389,7 @@ var ts; return grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Trailing_comma_not_allowed); } } - function checkGrammarTypeParameterList(node, typeParameters, file) { + function checkGrammarTypeParameterList(typeParameters, file) { if (checkGrammarForDisallowedTrailingComma(typeParameters)) { return true; } @@ -33955,11 +43432,11 @@ var ts; function checkGrammarFunctionLikeDeclaration(node) { // Prevent cascading error by short-circuit var file = ts.getSourceFileOfNode(node); - return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarTypeParameterList(node, node.typeParameters, file) || + return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarTypeParameterList(node.typeParameters, file) || checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } function checkGrammarArrowFunction(node, file) { - if (node.kind === 180 /* ArrowFunction */) { + if (node.kind === 185 /* ArrowFunction */) { var arrowFunction = node; var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; @@ -33982,7 +43459,7 @@ var ts; if (parameter.dotDotDotToken) { return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.An_index_signature_cannot_have_a_rest_parameter); } - if (parameter.flags & 1023 /* Modifier */) { + if (ts.getModifierFlags(parameter) !== 0) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier); } if (parameter.questionToken) { @@ -33994,7 +43471,7 @@ var ts; if (!parameter.type) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - if (parameter.type.kind !== 132 /* StringKeyword */ && parameter.type.kind !== 130 /* NumberKeyword */) { + if (parameter.type.kind !== 134 /* StringKeyword */ && parameter.type.kind !== 132 /* NumberKeyword */) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } if (!node.type) { @@ -34020,9 +43497,9 @@ var ts; function checkGrammarForOmittedArgument(node, args) { if (args) { var sourceFile = ts.getSourceFileOfNode(node); - for (var _i = 0, args_1 = args; _i < args_1.length; _i++) { - var arg = args_1[_i]; - if (arg.kind === 193 /* OmittedExpression */) { + for (var _i = 0, args_4 = args; _i < args_4.length; _i++) { + var arg = args_4[_i]; + if (arg.kind === 198 /* OmittedExpression */) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -34048,7 +43525,7 @@ var ts; if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && node.heritageClauses) { for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; - if (heritageClause.token === 83 /* ExtendsKeyword */) { + if (heritageClause.token === 84 /* ExtendsKeyword */) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); } @@ -34061,7 +43538,7 @@ var ts; seenExtendsClause = true; } else { - ts.Debug.assert(heritageClause.token === 106 /* ImplementsKeyword */); + ts.Debug.assert(heritageClause.token === 107 /* ImplementsKeyword */); if (seenImplementsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.implements_clause_already_seen); } @@ -34077,14 +43554,14 @@ var ts; if (node.heritageClauses) { for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; - if (heritageClause.token === 83 /* ExtendsKeyword */) { + if (heritageClause.token === 84 /* ExtendsKeyword */) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); } seenExtendsClause = true; } else { - ts.Debug.assert(heritageClause.token === 106 /* ImplementsKeyword */); + ts.Debug.assert(heritageClause.token === 107 /* ImplementsKeyword */); return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.Interface_declaration_cannot_have_implements_clause); } // Grammar checking heritageClause inside class declaration @@ -34095,31 +43572,31 @@ var ts; } function checkGrammarComputedPropertyName(node) { // If node is not a computedPropertyName, just skip the grammar checking - if (node.kind !== 140 /* ComputedPropertyName */) { + if (node.kind !== 142 /* ComputedPropertyName */) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 187 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 24 /* CommaToken */) { + if (computedPropertyName.expression.kind === 192 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 25 /* CommaToken */) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 220 /* FunctionDeclaration */ || - node.kind === 179 /* FunctionExpression */ || - node.kind === 147 /* MethodDeclaration */); + ts.Debug.assert(node.kind === 225 /* FunctionDeclaration */ || + node.kind === 184 /* FunctionExpression */ || + node.kind === 149 /* MethodDeclaration */); if (ts.isInAmbientContext(node)) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } if (!node.body) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.An_overload_signature_cannot_be_declared_as_a_generator); } - if (languageVersion < 2 /* ES6 */) { + if (languageVersion < 2 /* ES2015 */) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher); } } } - function checkGrammarForInvalidQuestionMark(node, questionToken, message) { + function checkGrammarForInvalidQuestionMark(questionToken, message) { if (questionToken) { return grammarErrorOnNode(questionToken, message); } @@ -34130,24 +43607,30 @@ var ts; var GetAccessor = 2; var SetAccessor = 4; var GetOrSetAccessor = GetAccessor | SetAccessor; - var _loop_2 = function(prop) { - var name_21 = prop.name; - if (prop.kind === 193 /* OmittedExpression */ || - name_21.kind === 140 /* ComputedPropertyName */) { - // If the name is not a ComputedPropertyName, the grammar checking will skip it - checkGrammarComputedPropertyName(name_21); + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { + var prop = _a[_i]; + if (prop.kind === 259 /* SpreadAssignment */) { + continue; } - if (prop.kind === 254 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + var name_28 = prop.name; + if (name_28.kind === 142 /* ComputedPropertyName */) { + // If the name is not a ComputedPropertyName, the grammar checking will skip it + checkGrammarComputedPropertyName(name_28); + } + if (prop.kind === 258 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { // having objectAssignmentInitializer is only valid in ObjectAssignmentPattern // outside of destructuring it is a syntax error - return { value: grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment) }; + return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment); } // Modifiers are never allowed on properties except for 'async' on a method declaration - ts.forEach(prop.modifiers, function (mod) { - if (mod.kind !== 118 /* AsyncKeyword */ || prop.kind !== 147 /* MethodDeclaration */) { - grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); + if (prop.modifiers) { + for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) { + var mod = _c[_b]; + if (mod.kind !== 119 /* AsyncKeyword */ || prop.kind !== 149 /* MethodDeclaration */) { + grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); + } } - }); + } // ECMA-262 11.1.5 Object Initializer // If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true // a.This production is contained in strict code and IsDataDescriptor(previous) is true and @@ -34157,29 +43640,29 @@ var ts; // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields var currentKind = void 0; - if (prop.kind === 253 /* PropertyAssignment */ || prop.kind === 254 /* ShorthandPropertyAssignment */) { + if (prop.kind === 257 /* PropertyAssignment */ || prop.kind === 258 /* ShorthandPropertyAssignment */) { // Grammar checking for computedPropertyName and shorthandPropertyAssignment - checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); - if (name_21.kind === 8 /* NumericLiteral */) { - checkGrammarNumericLiteral(name_21); + checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); + if (name_28.kind === 8 /* NumericLiteral */) { + checkGrammarNumericLiteral(name_28); } currentKind = Property; } - else if (prop.kind === 147 /* MethodDeclaration */) { + else if (prop.kind === 149 /* MethodDeclaration */) { currentKind = Property; } - else if (prop.kind === 149 /* GetAccessor */) { + else if (prop.kind === 151 /* GetAccessor */) { currentKind = GetAccessor; } - else if (prop.kind === 150 /* SetAccessor */) { + else if (prop.kind === 152 /* SetAccessor */) { currentKind = SetAccessor; } else { ts.Debug.fail("Unexpected syntax kind:" + prop.kind); } - var effectiveName = ts.getPropertyNameForPropertyNameNode(name_21); + var effectiveName = ts.getPropertyNameForPropertyNameNode(name_28); if (effectiveName === undefined) { - return "continue"; + continue; } if (!seen[effectiveName]) { seen[effectiveName] = currentKind; @@ -34187,44 +43670,39 @@ var ts; else { var existingKind = seen[effectiveName]; if (currentKind === Property && existingKind === Property) { - grammarErrorOnNode(name_21, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name_21)); + grammarErrorOnNode(name_28, ts.Diagnostics.Duplicate_identifier_0, ts.getTextOfNode(name_28)); } else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { seen[effectiveName] = currentKind | existingKind; } else { - return { value: grammarErrorOnNode(name_21, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name) }; + return grammarErrorOnNode(name_28, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); } } else { - return { value: grammarErrorOnNode(name_21, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name) }; + return grammarErrorOnNode(name_28, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); } } - }; - for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { - var prop = _a[_i]; - var state_3 = _loop_2(prop); - if (typeof state_3 === "object") return state_3.value; } } function checkGrammarJsxElement(node) { var seen = ts.createMap(); for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 247 /* JsxSpreadAttribute */) { + if (attr.kind === 251 /* JsxSpreadAttribute */) { continue; } var jsxAttr = attr; - var name_22 = jsxAttr.name; - if (!seen[name_22.text]) { - seen[name_22.text] = true; + var name_29 = jsxAttr.name; + if (!seen[name_29.text]) { + seen[name_29.text] = true; } else { - return grammarErrorOnNode(name_22, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); + return grammarErrorOnNode(name_29, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 248 /* JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 252 /* JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -34233,7 +43711,7 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 219 /* VariableDeclarationList */) { + if (forInOrOfStatement.initializer.kind === 224 /* VariableDeclarationList */) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -34248,20 +43726,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 207 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 212 /* ForInStatement */ ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 207 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 212 /* ForInStatement */ ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 207 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 212 /* ForInStatement */ ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -34278,18 +43756,21 @@ var ts; else if (ts.isInAmbientContext(accessor)) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_be_declared_in_an_ambient_context); } - else if (accessor.body === undefined && !(accessor.flags & 128 /* Abstract */)) { + else if (accessor.body === undefined && !(ts.getModifierFlags(accessor) & 128 /* Abstract */)) { return grammarErrorAtPos(ts.getSourceFileOfNode(accessor), accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } + else if (accessor.body && ts.getModifierFlags(accessor) & 128 /* Abstract */) { + return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation); + } else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } else if (!doesAccessorHaveCorrectParameterCount(accessor)) { - return grammarErrorOnNode(accessor.name, kind === 149 /* GetAccessor */ ? + return grammarErrorOnNode(accessor.name, kind === 151 /* GetAccessor */ ? ts.Diagnostics.A_get_accessor_cannot_have_parameters : ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); } - else if (kind === 150 /* SetAccessor */) { + else if (kind === 152 /* SetAccessor */) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -34312,20 +43793,11 @@ var ts; A get accessor has no parameters or a single `this` parameter. A set accessor has one parameter or a `this` parameter and one more parameter */ function doesAccessorHaveCorrectParameterCount(accessor) { - return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 149 /* GetAccessor */ ? 0 : 1); + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 151 /* GetAccessor */ ? 0 : 1); } function getAccessorThisParameter(accessor) { - if (accessor.parameters.length === (accessor.kind === 149 /* GetAccessor */ ? 1 : 2) && - accessor.parameters[0].name.kind === 69 /* Identifier */ && - accessor.parameters[0].name.originalKeywordKind === 97 /* ThisKeyword */) { - return accessor.parameters[0]; - } - } - function getFunctionLikeThisParameter(func) { - if (func.parameters.length && - func.parameters[0].name.kind === 69 /* Identifier */ && - func.parameters[0].name.originalKeywordKind === 97 /* ThisKeyword */) { - return func.parameters[0]; + if (accessor.parameters.length === (accessor.kind === 151 /* GetAccessor */ ? 1 : 2)) { + return ts.getThisParameter(accessor); } } function checkGrammarForNonSymbolComputedProperty(node, message) { @@ -34339,8 +43811,8 @@ var ts; checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 171 /* ObjectLiteralExpression */) { - if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) { + if (node.parent.kind === 176 /* ObjectLiteralExpression */) { + if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) { return true; } else if (node.body === undefined) { @@ -34360,10 +43832,10 @@ var ts; return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } - else if (node.parent.kind === 222 /* InterfaceDeclaration */) { + else if (node.parent.kind === 227 /* InterfaceDeclaration */) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); } - else if (node.parent.kind === 159 /* TypeLiteral */) { + else if (node.parent.kind === 161 /* TypeLiteral */) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); } } @@ -34374,11 +43846,11 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 214 /* LabeledStatement */: + case 219 /* LabeledStatement */: if (node.label && current.label.text === node.label.text) { // found matching label - verify that label usage is correct // continue can only target labels that are on iteration statements - var isMisplacedContinueLabel = node.kind === 209 /* ContinueStatement */ + var isMisplacedContinueLabel = node.kind === 214 /* ContinueStatement */ && !ts.isIterationStatement(current.statement, /*lookInLabeledStatement*/ true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -34386,8 +43858,8 @@ var ts; return false; } break; - case 213 /* SwitchStatement */: - if (node.kind === 210 /* BreakStatement */ && !node.label) { + case 218 /* SwitchStatement */: + if (node.kind === 215 /* BreakStatement */ && !node.label) { // unlabeled break within switch statement - ok return false; } @@ -34402,13 +43874,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 210 /* BreakStatement */ + var message = node.kind === 215 /* BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 210 /* BreakStatement */ + var message = node.kind === 215 /* BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -34418,21 +43890,38 @@ var ts; if (node.dotDotDotToken) { var elements = node.parent.elements; if (node !== ts.lastOrUndefined(elements)) { - return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); + return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } - if (node.name.kind === 168 /* ArrayBindingPattern */ || node.name.kind === 167 /* ObjectBindingPattern */) { + if (node.name.kind === 173 /* ArrayBindingPattern */ || node.name.kind === 172 /* ObjectBindingPattern */) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.initializer) { - // Error on equals token which immediate precedes the initializer + // Error on equals token which immediately precedes the initializer return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.initializer.pos - 1, 1, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } } } + function isStringOrNumberLiteralExpression(expr) { + return expr.kind === 9 /* StringLiteral */ || expr.kind === 8 /* NumericLiteral */ || + expr.kind === 190 /* PrefixUnaryExpression */ && expr.operator === 37 /* MinusToken */ && + expr.operand.kind === 8 /* NumericLiteral */; + } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 207 /* ForInStatement */ && node.parent.parent.kind !== 208 /* ForOfStatement */) { + if (node.parent.parent.kind !== 212 /* ForInStatement */ && node.parent.parent.kind !== 213 /* ForOfStatement */) { if (ts.isInAmbientContext(node)) { if (node.initializer) { + if (ts.isConst(node) && !node.type) { + if (!isStringOrNumberLiteralExpression(node.initializer)) { + return grammarErrorOnNode(node.initializer, ts.Diagnostics.A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal); + } + } + else { + // Error on equals token which immediate precedes the initializer + var equalsTokenLength = "=".length; + return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.initializer.pos - equalsTokenLength, equalsTokenLength, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); + } + } + if (node.initializer && !(ts.isConst(node) && isStringOrNumberLiteralExpression(node.initializer))) { // Error on equals token which immediate precedes the initializer var equalsTokenLength = "=".length; return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.initializer.pos - equalsTokenLength, equalsTokenLength, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); @@ -34457,8 +43946,8 @@ var ts; return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name); } function checkGrammarNameInLetOrConstDeclarations(name) { - if (name.kind === 69 /* Identifier */) { - if (name.originalKeywordKind === 108 /* LetKeyword */) { + if (name.kind === 70 /* Identifier */) { + if (name.originalKeywordKind === 109 /* LetKeyword */) { return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations); } } @@ -34466,7 +43955,7 @@ var ts; var elements = name.elements; for (var _i = 0, elements_2 = elements; _i < elements_2.length; _i++) { var element = elements_2[_i]; - if (element.kind !== 193 /* OmittedExpression */) { + if (!ts.isOmittedExpression(element)) { checkGrammarNameInLetOrConstDeclarations(element.name); } } @@ -34483,15 +43972,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 203 /* IfStatement */: - case 204 /* DoStatement */: - case 205 /* WhileStatement */: - case 212 /* WithStatement */: - case 206 /* ForStatement */: - case 207 /* ForInStatement */: - case 208 /* ForOfStatement */: + case 208 /* IfStatement */: + case 209 /* DoStatement */: + case 210 /* WhileStatement */: + case 217 /* WithStatement */: + case 211 /* ForStatement */: + case 212 /* ForInStatement */: + case 213 /* ForOfStatement */: return false; - case 214 /* LabeledStatement */: + case 219 /* LabeledStatement */: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -34512,8 +44001,8 @@ var ts; function grammarErrorOnFirstToken(node, message, arg0, arg1, arg2) { var sourceFile = ts.getSourceFileOfNode(node); if (!hasParseDiagnostics(sourceFile)) { - var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos); - diagnostics.add(ts.createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2)); + var span_4 = ts.getSpanOfTokenAtPosition(sourceFile, node.pos); + diagnostics.add(ts.createFileDiagnostic(sourceFile, span_4.start, span_4.length, message, arg0, arg1, arg2)); return true; } } @@ -34546,7 +44035,7 @@ var ts; return true; } } - else if (node.parent.kind === 222 /* InterfaceDeclaration */) { + else if (node.parent.kind === 227 /* InterfaceDeclaration */) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -34554,7 +44043,7 @@ var ts; return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer); } } - else if (node.parent.kind === 159 /* TypeLiteral */) { + else if (node.parent.kind === 161 /* TypeLiteral */) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -34579,15 +44068,14 @@ var ts; // export_opt AmbientDeclaration // // TODO: The spec needs to be amended to reflect this grammar. - if (node.kind === 222 /* InterfaceDeclaration */ || - node.kind === 223 /* TypeAliasDeclaration */ || - node.kind === 230 /* ImportDeclaration */ || - node.kind === 229 /* ImportEqualsDeclaration */ || - node.kind === 236 /* ExportDeclaration */ || - node.kind === 235 /* ExportAssignment */ || - node.kind === 228 /* NamespaceExportDeclaration */ || - (node.flags & 2 /* Ambient */) || - (node.flags & (1 /* Export */ | 512 /* Default */))) { + if (node.kind === 227 /* InterfaceDeclaration */ || + node.kind === 228 /* TypeAliasDeclaration */ || + node.kind === 235 /* ImportDeclaration */ || + node.kind === 234 /* ImportEqualsDeclaration */ || + node.kind === 241 /* ExportDeclaration */ || + node.kind === 240 /* ExportAssignment */ || + node.kind === 233 /* NamespaceExportDeclaration */ || + ts.getModifierFlags(node) & (2 /* Ambient */ | 1 /* Export */ | 512 /* Default */)) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); @@ -34595,7 +44083,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 200 /* VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 205 /* VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -34621,7 +44109,7 @@ var ts; // to prevent noisiness. So use a bit on the block to indicate if // this has already been reported, and don't report if it has. // - if (node.parent.kind === 199 /* Block */ || node.parent.kind === 226 /* ModuleBlock */ || node.parent.kind === 256 /* SourceFile */) { + if (node.parent.kind === 204 /* Block */ || node.parent.kind === 231 /* ModuleBlock */ || node.parent.kind === 261 /* SourceFile */) { var links_1 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_1.hasReportedStatementInAmbientContext) { @@ -34634,1963 +44122,4649 @@ var ts; } function checkGrammarNumericLiteral(node) { // Grammar checking - if (node.isOctalLiteral && languageVersion >= 1 /* ES5 */) { - return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); + if (node.isOctalLiteral) { + var diagnosticMessage = void 0; + if (languageVersion >= 1 /* ES5 */) { + diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; + } + else if (ts.isChildOfLiteralType(node)) { + diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; + } + if (diagnosticMessage) { + var withMinus = ts.isPrefixUnaryExpression(node.parent) && node.parent.operator === 37 /* MinusToken */; + var literal = (withMinus ? "-" : "") + "0o" + node.text; + return grammarErrorOnNode(withMinus ? node.parent : node, diagnosticMessage, literal); + } } } function grammarErrorAfterFirstToken(node, message, arg0, arg1, arg2) { var sourceFile = ts.getSourceFileOfNode(node); if (!hasParseDiagnostics(sourceFile)) { - var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos); - diagnostics.add(ts.createFileDiagnostic(sourceFile, ts.textSpanEnd(span), /*length*/ 0, message, arg0, arg1, arg2)); + var span_5 = ts.getSpanOfTokenAtPosition(sourceFile, node.pos); + diagnostics.add(ts.createFileDiagnostic(sourceFile, ts.textSpanEnd(span_5), /*length*/ 0, message, arg0, arg1, arg2)); return true; } } + function getAmbientModules() { + var result = []; + for (var sym in globals) { + if (ambientModuleSymbolRegex.test(sym)) { + result.push(globals[sym]); + } + } + return result; + } } ts.createTypeChecker = createTypeChecker; })(ts || (ts = {})); -/// +/// +/// +/// /* @internal */ var ts; (function (ts) { - var nullSourceMapWriter; - // Used for initialize lastEncodedSourceMapSpan and reset lastEncodedSourceMapSpan when updateLastEncodedAndRecordedSpans - var defaultLastEncodedSourceMapSpan = { - emittedLine: 1, - emittedColumn: 1, - sourceLine: 1, - sourceColumn: 1, - sourceIndex: 0 - }; - function getNullSourceMapWriter() { - if (nullSourceMapWriter === undefined) { - nullSourceMapWriter = { - getSourceMapData: function () { return undefined; }, - setSourceFile: function (sourceFile) { }, - emitStart: function (range) { }, - emitEnd: function (range, stopOverridingSpan) { }, - emitPos: function (pos) { }, - changeEmitSourcePos: function () { }, - getText: function () { return undefined; }, - getSourceMappingURL: function () { return undefined; }, - initialize: function (filePath, sourceMapFilePath, sourceFiles, isBundledEmit) { }, - reset: function () { } - }; - } - return nullSourceMapWriter; + ; + /** + * This map contains information about the shape of each Node in "types.ts" pertaining to how + * each node should be traversed during a transformation. + * + * Each edge corresponds to a property in a Node subtype that should be traversed when visiting + * each child. The properties are assigned in the order in which traversal should occur. + * + * We only add entries for nodes that do not have a create/update pair defined in factory.ts + * + * NOTE: This needs to be kept up to date with changes to nodes in "types.ts". Currently, this + * map is not comprehensive. Only node edges relevant to tree transformation are + * currently defined. We may extend this to be more comprehensive, and eventually + * supplant the existing `forEachChild` implementation if performance is not + * significantly impacted. + */ + var nodeEdgeTraversalMap = ts.createMap((_a = {}, + _a[141 /* QualifiedName */] = [ + { name: "left", test: ts.isEntityName }, + { name: "right", test: ts.isIdentifier } + ], + _a[145 /* Decorator */] = [ + { name: "expression", test: ts.isLeftHandSideExpression } + ], + _a[182 /* TypeAssertionExpression */] = [ + { name: "type", test: ts.isTypeNode }, + { name: "expression", test: ts.isUnaryExpression } + ], + _a[200 /* AsExpression */] = [ + { name: "expression", test: ts.isExpression }, + { name: "type", test: ts.isTypeNode } + ], + _a[201 /* NonNullExpression */] = [ + { name: "expression", test: ts.isLeftHandSideExpression } + ], + _a[229 /* EnumDeclaration */] = [ + { name: "decorators", test: ts.isDecorator }, + { name: "modifiers", test: ts.isModifier }, + { name: "name", test: ts.isIdentifier }, + { name: "members", test: ts.isEnumMember } + ], + _a[230 /* ModuleDeclaration */] = [ + { name: "decorators", test: ts.isDecorator }, + { name: "modifiers", test: ts.isModifier }, + { name: "name", test: ts.isModuleName }, + { name: "body", test: ts.isModuleBody } + ], + _a[231 /* ModuleBlock */] = [ + { name: "statements", test: ts.isStatement } + ], + _a[234 /* ImportEqualsDeclaration */] = [ + { name: "decorators", test: ts.isDecorator }, + { name: "modifiers", test: ts.isModifier }, + { name: "name", test: ts.isIdentifier }, + { name: "moduleReference", test: ts.isModuleReference } + ], + _a[245 /* ExternalModuleReference */] = [ + { name: "expression", test: ts.isExpression, optional: true } + ], + _a[260 /* EnumMember */] = [ + { name: "name", test: ts.isPropertyName }, + { name: "initializer", test: ts.isExpression, optional: true, parenthesize: ts.parenthesizeExpressionForList } + ], + _a)); + function reduceNode(node, f, initial) { + return node ? f(initial, node) : initial; } - ts.getNullSourceMapWriter = getNullSourceMapWriter; - function createSourceMapWriter(host, writer) { - var compilerOptions = host.getCompilerOptions(); - var extendedDiagnostics = compilerOptions.extendedDiagnostics; - var currentSourceFile; - var sourceMapDir; // The directory in which sourcemap will be - var stopOverridingSpan = false; - var modifyLastSourcePos = false; - // Current source map file and its index in the sources list - var sourceMapSourceIndex; - // Last recorded and encoded spans - var lastRecordedSourceMapSpan; - var lastEncodedSourceMapSpan; - var lastEncodedNameIndex; - // Source map data - var sourceMapData; - return { - getSourceMapData: function () { return sourceMapData; }, - setSourceFile: setSourceFile, - emitPos: emitPos, - emitStart: emitStart, - emitEnd: emitEnd, - changeEmitSourcePos: changeEmitSourcePos, - getText: getText, - getSourceMappingURL: getSourceMappingURL, - initialize: initialize, - reset: reset - }; - function initialize(filePath, sourceMapFilePath, sourceFiles, isBundledEmit) { - if (sourceMapData) { - reset(); - } - currentSourceFile = undefined; - // Current source map file and its index in the sources list - sourceMapSourceIndex = -1; - // Last recorded and encoded spans - lastRecordedSourceMapSpan = undefined; - lastEncodedSourceMapSpan = defaultLastEncodedSourceMapSpan; - lastEncodedNameIndex = 0; - // Initialize source map data - sourceMapData = { - sourceMapFilePath: sourceMapFilePath, - jsSourceMappingURL: !compilerOptions.inlineSourceMap ? ts.getBaseFileName(ts.normalizeSlashes(sourceMapFilePath)) : undefined, - sourceMapFile: ts.getBaseFileName(ts.normalizeSlashes(filePath)), - sourceMapSourceRoot: compilerOptions.sourceRoot || "", - sourceMapSources: [], - inputSourceFileNames: [], - sourceMapNames: [], - sourceMapMappings: "", - sourceMapSourcesContent: compilerOptions.inlineSources ? [] : undefined, - sourceMapDecodedMappings: [] - }; - // Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the - // relative paths of the sources list in the sourcemap - sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot); - if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== 47 /* slash */) { - sourceMapData.sourceMapSourceRoot += ts.directorySeparator; - } - if (compilerOptions.mapRoot) { - sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); - if (!isBundledEmit) { - ts.Debug.assert(sourceFiles.length === 1); - // For modules or multiple emit files the mapRoot will have directory structure like the sources - // So if src\a.ts and src\lib\b.ts are compiled together user would be moving the maps into mapRoot\a.js.map and mapRoot\lib\b.js.map - sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFiles[0], host, sourceMapDir)); - } - if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { - // The relative paths are relative to the common directory - sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir); - sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(filePath)), // get the relative sourceMapDir path based on jsFilePath - ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), // this is where user expects to see sourceMap - host.getCurrentDirectory(), host.getCanonicalFileName, - /*isAbsolutePathAnUrl*/ true); - } - else { - sourceMapData.jsSourceMappingURL = ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL); - } - } - else { - sourceMapDir = ts.getDirectoryPath(ts.normalizePath(filePath)); - } + 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 initial The initial value to supply to the reduction. + * @param f The callback function + */ + function reduceEachChild(node, initial, cbNode, cbNodeArray) { + if (node === undefined) { + return initial; } - function reset() { - currentSourceFile = undefined; - sourceMapDir = undefined; - sourceMapSourceIndex = undefined; - lastRecordedSourceMapSpan = undefined; - lastEncodedSourceMapSpan = undefined; - lastEncodedNameIndex = undefined; - sourceMapData = undefined; + 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 */)) { + return initial; } - function updateLastEncodedAndRecordedSpans() { - if (modifyLastSourcePos) { - // Reset the source pos - modifyLastSourcePos = false; - // Change Last recorded Map with last encoded emit line and character - lastRecordedSourceMapSpan.emittedLine = lastEncodedSourceMapSpan.emittedLine; - lastRecordedSourceMapSpan.emittedColumn = lastEncodedSourceMapSpan.emittedColumn; - // Pop sourceMapDecodedMappings to remove last entry - sourceMapData.sourceMapDecodedMappings.pop(); - // Point the lastEncodedSourceMapSpace to the previous encoded sourceMapSpan - // If the list is empty which indicates that we are at the beginning of the file, - // we have to reset it to default value (same value when we first initialize sourceMapWriter) - lastEncodedSourceMapSpan = sourceMapData.sourceMapDecodedMappings.length ? - sourceMapData.sourceMapDecodedMappings[sourceMapData.sourceMapDecodedMappings.length - 1] : - defaultLastEncodedSourceMapSpan; - // TODO: Update lastEncodedNameIndex - // Since we dont support this any more, lets not worry about it right now. - // When we start supporting nameIndex, we will get back to this - // Change the encoded source map - var sourceMapMappings = sourceMapData.sourceMapMappings; - var lenthToSet = sourceMapMappings.length - 1; - for (; lenthToSet >= 0; lenthToSet--) { - var currentChar = sourceMapMappings.charAt(lenthToSet); - if (currentChar === ",") { - // Separator for the entry found - break; - } - if (currentChar === ";" && lenthToSet !== 0 && sourceMapMappings.charAt(lenthToSet - 1) !== ";") { - // Last line separator found - break; + // We do not yet support types. + if ((kind >= 156 /* TypePredicate */ && kind <= 171 /* LiteralType */)) { + return initial; + } + var result = initial; + switch (node.kind) { + // Leaf nodes + case 203 /* SemicolonClassElement */: + case 206 /* EmptyStatement */: + case 198 /* OmittedExpression */: + case 222 /* DebuggerStatement */: + case 293 /* NotEmittedStatement */: + // No need to visit nodes with no children. + break; + // Names + case 142 /* ComputedPropertyName */: + result = reduceNode(node.expression, cbNode, result); + break; + // Signature elements + case 144 /* Parameter */: + 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, cbNode, result); + break; + // Type member + case 147 /* PropertyDeclaration */: + 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 = 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 = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNodes(node.parameters, cbNodes, result); + result = reduceNode(node.body, cbNode, result); + break; + case 151 /* GetAccessor */: + 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 = 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 = reduceNodes(node.elements, cbNodes, result); + break; + case 174 /* BindingElement */: + result = reduceNode(node.propertyName, cbNode, result); + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); + break; + // Expression + case 175 /* ArrayLiteralExpression */: + result = reduceNodes(node.elements, cbNodes, result); + break; + case 176 /* ObjectLiteralExpression */: + result = reduceNodes(node.properties, cbNodes, result); + break; + case 177 /* PropertyAccessExpression */: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.name, cbNode, result); + break; + case 178 /* ElementAccessExpression */: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.argumentExpression, cbNode, result); + break; + case 179 /* CallExpression */: + 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, cbNode, result); + result = reduceNodes(node.typeArguments, cbNodes, result); + result = reduceNodes(node.arguments, cbNodes, result); + break; + case 181 /* TaggedTemplateExpression */: + result = reduceNode(node.tag, cbNode, result); + result = reduceNode(node.template, cbNode, result); + break; + case 184 /* FunctionExpression */: + 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 = 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 */: + case 187 /* TypeOfExpression */: + case 188 /* VoidExpression */: + case 189 /* AwaitExpression */: + case 195 /* YieldExpression */: + case 196 /* SpreadElement */: + case 201 /* NonNullExpression */: + result = reduceNode(node.expression, cbNode, result); + break; + case 190 /* PrefixUnaryExpression */: + case 191 /* PostfixUnaryExpression */: + result = reduceNode(node.operand, cbNode, result); + break; + case 192 /* BinaryExpression */: + result = reduceNode(node.left, cbNode, result); + result = reduceNode(node.right, cbNode, result); + break; + case 193 /* ConditionalExpression */: + 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, cbNode, result); + result = reduceNodes(node.templateSpans, cbNodes, result); + break; + case 197 /* ClassExpression */: + 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, cbNode, result); + result = reduceNodes(node.typeArguments, cbNodes, result); + break; + // Misc + case 202 /* TemplateSpan */: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.literal, cbNode, result); + break; + // Element + case 204 /* Block */: + result = reduceNodes(node.statements, cbNodes, result); + break; + case 205 /* VariableStatement */: + result = reduceNodes(node.modifiers, cbNodes, result); + result = reduceNode(node.declarationList, cbNode, result); + break; + case 207 /* ExpressionStatement */: + result = reduceNode(node.expression, cbNode, result); + break; + case 208 /* IfStatement */: + 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, cbNode, result); + result = reduceNode(node.expression, cbNode, result); + break; + case 210 /* WhileStatement */: + case 217 /* WithStatement */: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.statement, cbNode, result); + break; + case 211 /* ForStatement */: + 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, 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, cbNode, result); + break; + case 218 /* SwitchStatement */: + result = reduceNode(node.expression, cbNode, result); + result = reduceNode(node.caseBlock, cbNode, result); + break; + case 219 /* LabeledStatement */: + result = reduceNode(node.label, cbNode, result); + result = reduceNode(node.statement, cbNode, result); + break; + case 221 /* TryStatement */: + 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, cbNode, result); + result = reduceNode(node.type, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); + break; + case 224 /* VariableDeclarationList */: + result = reduceNodes(node.declarations, cbNodes, result); + break; + case 225 /* FunctionDeclaration */: + 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 = 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 = reduceNodes(node.clauses, cbNodes, result); + break; + case 235 /* ImportDeclaration */: + 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, cbNode, result); + result = reduceNode(node.namedBindings, cbNode, result); + break; + case 237 /* NamespaceImport */: + result = reduceNode(node.name, cbNode, result); + break; + case 238 /* NamedImports */: + case 242 /* NamedExports */: + result = reduceNodes(node.elements, cbNodes, result); + break; + case 239 /* ImportSpecifier */: + case 243 /* ExportSpecifier */: + result = reduceNode(node.propertyName, cbNode, result); + result = reduceNode(node.name, cbNode, result); + break; + case 240 /* ExportAssignment */: + 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, 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, 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, cbNode, result); + result = reduceNodes(node.attributes, cbNodes, result); + break; + case 249 /* JsxClosingElement */: + result = reduceNode(node.tagName, cbNode, result); + break; + case 250 /* JsxAttribute */: + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); + break; + case 251 /* JsxSpreadAttribute */: + result = reduceNode(node.expression, cbNode, result); + break; + case 252 /* JsxExpression */: + result = reduceNode(node.expression, cbNode, result); + break; + // Clauses + case 253 /* CaseClause */: + result = reduceNode(node.expression, cbNode, result); + // fall-through + case 254 /* DefaultClause */: + result = reduceNodes(node.statements, cbNodes, result); + break; + case 255 /* HeritageClause */: + result = reduceNodes(node.types, cbNodes, result); + break; + case 256 /* CatchClause */: + result = reduceNode(node.variableDeclaration, cbNode, result); + result = reduceNode(node.block, cbNode, result); + break; + // Property assignments + case 257 /* PropertyAssignment */: + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.initializer, cbNode, result); + break; + case 258 /* ShorthandPropertyAssignment */: + result = reduceNode(node.name, cbNode, result); + result = reduceNode(node.objectAssignmentInitializer, cbNode, result); + break; + case 259 /* SpreadAssignment */: + result = reduceNode(node.expression, cbNode, result); + break; + // Top-level nodes + case 261 /* SourceFile */: + result = reduceNodes(node.statements, cbNodes, result); + break; + case 294 /* PartiallyEmittedExpression */: + result = reduceNode(node.expression, cbNode, result); + break; + default: + var edgeTraversalPath = nodeEdgeTraversalMap[kind]; + if (edgeTraversalPath) { + for (var _i = 0, edgeTraversalPath_1 = edgeTraversalPath; _i < edgeTraversalPath_1.length; _i++) { + var edge = edgeTraversalPath_1[_i]; + var value = node[edge.name]; + if (value !== undefined) { + result = ts.isArray(value) + ? reduceNodes(value, cbNodes, result) + : cbNode(result, value); + } } } - sourceMapData.sourceMapMappings = sourceMapMappings.substr(0, Math.max(0, lenthToSet)); - } - } - // Encoding for sourcemap span - function encodeLastRecordedSourceMapSpan() { - if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) { - return; - } - var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn; - // Line/Comma delimiters - if (lastEncodedSourceMapSpan.emittedLine === lastRecordedSourceMapSpan.emittedLine) { - // Emit comma to separate the entry - if (sourceMapData.sourceMapMappings) { - sourceMapData.sourceMapMappings += ","; - } - } - else { - // Emit line delimiters - for (var encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) { - sourceMapData.sourceMapMappings += ";"; - } - prevEncodedEmittedColumn = 1; - } - // 1. Relative Column 0 based - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn); - // 2. Relative sourceIndex - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex); - // 3. Relative sourceLine 0 based - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine); - // 4. Relative sourceColumn 0 based - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn); - // 5. Relative namePosition 0 based - if (lastRecordedSourceMapSpan.nameIndex >= 0) { - ts.Debug.assert(false, "We do not support name index right now, Make sure to update updateLastEncodedAndRecordedSpans when we start using this"); - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex - lastEncodedNameIndex); - lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex; - } - lastEncodedSourceMapSpan = lastRecordedSourceMapSpan; - sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan); - } - function emitPos(pos) { - if (pos === -1) { - return; - } - if (extendedDiagnostics) { - ts.performance.mark("beforeSourcemap"); - } - var sourceLinePos = ts.getLineAndCharacterOfPosition(currentSourceFile, pos); - // Convert the location to be one-based. - sourceLinePos.line++; - sourceLinePos.character++; - var emittedLine = writer.getLine(); - var emittedColumn = writer.getColumn(); - // If this location wasn't recorded or the location in source is going backwards, record the span - if (!lastRecordedSourceMapSpan || - lastRecordedSourceMapSpan.emittedLine !== emittedLine || - lastRecordedSourceMapSpan.emittedColumn !== emittedColumn || - (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && - (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || - (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { - // Encode the last recordedSpan before assigning new - encodeLastRecordedSourceMapSpan(); - // New span - lastRecordedSourceMapSpan = { - emittedLine: emittedLine, - emittedColumn: emittedColumn, - sourceLine: sourceLinePos.line, - sourceColumn: sourceLinePos.character, - sourceIndex: sourceMapSourceIndex - }; - stopOverridingSpan = false; - } - else if (!stopOverridingSpan) { - // Take the new pos instead since there is no change in emittedLine and column since last location - lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line; - lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character; - lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex; - } - updateLastEncodedAndRecordedSpans(); - if (extendedDiagnostics) { - ts.performance.mark("afterSourcemap"); - ts.performance.measure("Source Map", "beforeSourcemap", "afterSourcemap"); - } - } - function getStartPos(range) { - var rangeHasDecorators = !!range.decorators; - return range.pos !== -1 ? ts.skipTrivia(currentSourceFile.text, rangeHasDecorators ? range.decorators.end : range.pos) : -1; - } - function emitStart(range) { - emitPos(getStartPos(range)); - } - function emitEnd(range, stopOverridingEnd) { - emitPos(range.end); - stopOverridingSpan = stopOverridingEnd; - } - function changeEmitSourcePos() { - ts.Debug.assert(!modifyLastSourcePos); - modifyLastSourcePos = true; - } - function setSourceFile(sourceFile) { - currentSourceFile = sourceFile; - // Add the file to tsFilePaths - // If sourceroot option: Use the relative path corresponding to the common directory path - // otherwise source locations relative to map file location - var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir; - var source = ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, currentSourceFile.fileName, host.getCurrentDirectory(), host.getCanonicalFileName, - /*isAbsolutePathAnUrl*/ true); - sourceMapSourceIndex = ts.indexOf(sourceMapData.sourceMapSources, source); - if (sourceMapSourceIndex === -1) { - sourceMapSourceIndex = sourceMapData.sourceMapSources.length; - sourceMapData.sourceMapSources.push(source); - // The one that can be used from program to get the actual source file - sourceMapData.inputSourceFileNames.push(sourceFile.fileName); - if (compilerOptions.inlineSources) { - sourceMapData.sourceMapSourcesContent.push(sourceFile.text); - } - } - } - function getText() { - encodeLastRecordedSourceMapSpan(); - return ts.stringify({ - version: 3, - file: sourceMapData.sourceMapFile, - sourceRoot: sourceMapData.sourceMapSourceRoot, - sources: sourceMapData.sourceMapSources, - names: sourceMapData.sourceMapNames, - mappings: sourceMapData.sourceMapMappings, - sourcesContent: sourceMapData.sourceMapSourcesContent - }); - } - function getSourceMappingURL() { - if (compilerOptions.inlineSourceMap) { - // Encode the sourceMap into the sourceMap url - var base64SourceMapText = ts.convertToBase64(getText()); - return sourceMapData.jsSourceMappingURL = "data:application/json;base64," + base64SourceMapText; - } - else { - return sourceMapData.jsSourceMappingURL; - } + break; } + return result; } - ts.createSourceMapWriter = createSourceMapWriter; - var base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - function base64FormatEncode(inValue) { - if (inValue < 64) { - return base64Chars.charAt(inValue); + ts.reduceEachChild = reduceEachChild; + function visitNode(node, visitor, test, optional, lift, parenthesize, parentNode) { + if (node === undefined || visitor === undefined) { + return node; } - throw TypeError(inValue + ": not a 64 based value"); - } - function base64VLQFormatEncode(inValue) { - // Add a new least significant bit that has the sign of the value. - // if negative number the least significant bit that gets added to the number has value 1 - // else least significant bit value that gets added is 0 - // eg. -1 changes to binary : 01 [1] => 3 - // +1 changes to binary : 01 [0] => 2 - if (inValue < 0) { - inValue = ((-inValue) << 1) + 1; + aggregateTransformFlags(node); + var visited = visitor(node); + if (visited === node) { + return node; + } + var visitedNode; + if (visited === undefined) { + if (!optional) { + Debug.failNotOptional(); + } + return undefined; + } + else if (ts.isArray(visited)) { + visitedNode = (lift || extractSingleNode)(visited); } else { - inValue = inValue << 1; + visitedNode = visited; } - // Encode 5 bits at a time starting from least significant bits - var encodedStr = ""; - do { - var currentDigit = inValue & 31; // 11111 - inValue = inValue >> 5; - if (inValue > 0) { - // There are still more digits to decode, set the msb (6th bit) - currentDigit = currentDigit | 32; - } - encodedStr = encodedStr + base64FormatEncode(currentDigit); - } while (inValue > 0); - return encodedStr; + if (parenthesize !== undefined) { + visitedNode = parenthesize(visitedNode, parentNode); + } + Debug.assertNode(visitedNode, test); + aggregateTransformFlags(visitedNode); + return visitedNode; } + ts.visitNode = visitNode; + function visitNodes(nodes, visitor, test, start, count, parenthesize, parentNode) { + if (nodes === undefined) { + return undefined; + } + var updated; + // Ensure start and count have valid values + var length = nodes.length; + if (start === undefined || start < 0) { + start = 0; + } + if (count === undefined || count > length - start) { + count = length - start; + } + if (start > 0 || count < length) { + // If we are not visiting all of the original nodes, we must always create a new array. + // Since this is a fragment of a node array, we do not copy over the previous location + // and will only copy over `hasTrailingComma` if we are including the last element. + updated = ts.createNodeArray([], /*location*/ undefined, + /*hasTrailingComma*/ nodes.hasTrailingComma && start + count === length); + } + // Visit each original node. + for (var i = 0; i < count; i++) { + var node = nodes[i + start]; + aggregateTransformFlags(node); + var visited = node !== undefined ? visitor(node) : undefined; + if (updated !== undefined || visited === undefined || visited !== node) { + if (updated === undefined) { + // Ensure we have a copy of `nodes`, up to the current index. + updated = ts.createNodeArray(nodes.slice(0, i), /*location*/ nodes, nodes.hasTrailingComma); + } + if (visited) { + if (ts.isArray(visited)) { + for (var _i = 0, visited_1 = visited; _i < visited_1.length; _i++) { + var visitedNode = visited_1[_i]; + visitedNode = parenthesize + ? parenthesize(visitedNode, parentNode) + : visitedNode; + Debug.assertNode(visitedNode, test); + aggregateTransformFlags(visitedNode); + updated.push(visitedNode); + } + } + else { + var visitedNode = parenthesize + ? parenthesize(visited, parentNode) + : visited; + Debug.assertNode(visitedNode, test); + aggregateTransformFlags(visitedNode); + updated.push(visitedNode); + } + } + } + } + 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; + } + var kind = node.kind; + // No need to visit nodes with no children. + if ((kind > 0 /* FirstToken */ && kind <= 140 /* LastToken */)) { + return node; + } + // We do not yet support types. + if ((kind >= 156 /* TypePredicate */ && kind <= 171 /* LiteralType */)) { + return node; + } + switch (node.kind) { + case 203 /* SemicolonClassElement */: + case 206 /* EmptyStatement */: + case 198 /* OmittedExpression */: + case 222 /* DebuggerStatement */: + // No need to visit nodes with no children. + return node; + // Names + case 142 /* ComputedPropertyName */: + 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), 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), 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), 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), 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), 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, 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)); + case 176 /* ObjectLiteralExpression */: + return ts.updateObjectLiteral(node, visitNodes(node.properties, visitor, ts.isObjectLiteralElementLike)); + case 177 /* PropertyAccessExpression */: + return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier)); + case 178 /* ElementAccessExpression */: + return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression)); + case 179 /* CallExpression */: + return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression)); + case 180 /* NewExpression */: + return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNodes(node.arguments, visitor, ts.isExpression)); + case 181 /* TaggedTemplateExpression */: + return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral)); + 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), 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), 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 */: + return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression)); + case 188 /* VoidExpression */: + return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression)); + case 189 /* AwaitExpression */: + return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression)); + case 192 /* BinaryExpression */: + return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression)); + case 190 /* PrefixUnaryExpression */: + return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression)); + case 191 /* PostfixUnaryExpression */: + return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression)); + case 193 /* ConditionalExpression */: + return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.whenFalse, visitor, ts.isExpression)); + case 194 /* TemplateExpression */: + return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), visitNodes(node.templateSpans, visitor, ts.isTemplateSpan)); + case 195 /* YieldExpression */: + return ts.updateYield(node, visitNode(node.expression, visitor, ts.isExpression)); + case 196 /* SpreadElement */: + return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression)); + case 197 /* ClassExpression */: + return ts.updateClassExpression(node, 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 199 /* ExpressionWithTypeArguments */: + return ts.updateExpressionWithTypeArguments(node, visitNodes(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression)); + // Misc + case 202 /* TemplateSpan */: + return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); + // Element + case 204 /* Block */: + return ts.updateBlock(node, visitNodes(node.statements, visitor, ts.isStatement)); + case 205 /* VariableStatement */: + return ts.updateVariableStatement(node, visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList)); + case 207 /* ExpressionStatement */: + return ts.updateStatement(node, visitNode(node.expression, visitor, ts.isExpression)); + case 208 /* IfStatement */: + return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, /*optional*/ false, liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, /*optional*/ true, liftToBlock)); + case 209 /* DoStatement */: + return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock), visitNode(node.expression, visitor, ts.isExpression)); + case 210 /* WhileStatement */: + return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); + case 211 /* ForStatement */: + return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); + case 212 /* ForInStatement */: + return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); + case 213 /* ForOfStatement */: + return ts.updateForOf(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); + case 214 /* ContinueStatement */: + return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier, /*optional*/ true)); + case 215 /* BreakStatement */: + return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier, /*optional*/ true)); + case 216 /* ReturnStatement */: + return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression, /*optional*/ true)); + case 217 /* WithStatement */: + return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); + case 218 /* SwitchStatement */: + return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock)); + case 219 /* LabeledStatement */: + return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, liftToBlock)); + case 220 /* ThrowStatement */: + return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression)); + case 221 /* TryStatement */: + return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause, /*optional*/ true), visitNode(node.finallyBlock, visitor, ts.isBlock, /*optional*/ true)); + case 223 /* VariableDeclaration */: + return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode, /*optional*/ true), visitNode(node.initializer, visitor, ts.isExpression, /*optional*/ true)); + 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), 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 */: + return ts.updateCaseBlock(node, visitNodes(node.clauses, visitor, ts.isCaseOrDefaultClause)); + case 235 /* ImportDeclaration */: + return ts.updateImportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause, /*optional*/ true), visitNode(node.moduleSpecifier, visitor, ts.isExpression)); + case 236 /* ImportClause */: + return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier, /*optional*/ true), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings, /*optional*/ true)); + case 237 /* NamespaceImport */: + return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier)); + case 238 /* NamedImports */: + return ts.updateNamedImports(node, visitNodes(node.elements, visitor, ts.isImportSpecifier)); + case 239 /* ImportSpecifier */: + return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, /*optional*/ true), visitNode(node.name, visitor, ts.isIdentifier)); + case 240 /* ExportAssignment */: + return ts.updateExportAssignment(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression)); + case 241 /* ExportDeclaration */: + return ts.updateExportDeclaration(node, visitNodes(node.decorators, visitor, ts.isDecorator), visitNodes(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports, /*optional*/ true), visitNode(node.moduleSpecifier, visitor, ts.isExpression, /*optional*/ true)); + case 242 /* NamedExports */: + return ts.updateNamedExports(node, visitNodes(node.elements, visitor, ts.isExportSpecifier)); + case 243 /* ExportSpecifier */: + return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier, /*optional*/ true), visitNode(node.name, visitor, ts.isIdentifier)); + // JSX + case 246 /* JsxElement */: + return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), visitNodes(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement)); + case 247 /* JsxSelfClosingElement */: + return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); + case 248 /* JsxOpeningElement */: + return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), visitNodes(node.attributes, visitor, ts.isJsxAttributeLike)); + case 249 /* JsxClosingElement */: + return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression)); + case 250 /* JsxAttribute */: + return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); + case 251 /* JsxSpreadAttribute */: + return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression)); + case 252 /* JsxExpression */: + return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression)); + // Clauses + case 253 /* CaseClause */: + return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), visitNodes(node.statements, visitor, ts.isStatement)); + case 254 /* DefaultClause */: + return ts.updateDefaultClause(node, visitNodes(node.statements, visitor, ts.isStatement)); + case 255 /* HeritageClause */: + return ts.updateHeritageClause(node, visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments)); + case 256 /* CatchClause */: + return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock)); + // Property assignments + case 257 /* PropertyAssignment */: + return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); + case 258 /* ShorthandPropertyAssignment */: + return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression)); + case 259 /* SpreadAssignment */: + return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression)); + // Top-level nodes + case 261 /* SourceFile */: + return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); + // Transformation nodes + case 294 /* PartiallyEmittedExpression */: + return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); + default: + var updated = void 0; + var edgeTraversalPath = nodeEdgeTraversalMap[kind]; + if (edgeTraversalPath) { + for (var _i = 0, edgeTraversalPath_2 = edgeTraversalPath; _i < edgeTraversalPath_2.length; _i++) { + var edge = edgeTraversalPath_2[_i]; + var value = node[edge.name]; + if (value !== undefined) { + var visited = ts.isArray(value) + ? visitNodes(value, visitor, edge.test, 0, value.length, edge.parenthesize, node) + : visitNode(value, visitor, edge.test, edge.optional, edge.lift, edge.parenthesize, node); + if (updated !== undefined || visited !== value) { + if (updated === undefined) { + updated = ts.getMutableClone(node); + } + if (visited !== value) { + updated[edge.name] = visited; + } + } + } + } + } + return updated ? ts.updateNode(updated, node) : node; + } + // 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)) { + return ts.updateBlock(body, ts.createNodeArray(ts.concatenate(body.statements, declarations), body.statements)); + } + else { + return ts.createBlock(ts.createNodeArray([ts.createReturn(body, /*location*/ body)].concat(declarations), body), + /*location*/ body, + /*multiLine*/ true); + } + } + return body; + } + ts.mergeFunctionBodyLexicalEnvironment = mergeFunctionBodyLexicalEnvironment; + /** + * Lifts a NodeArray containing only Statement nodes to a block. + * + * @param nodes The NodeArray. + */ + function liftToBlock(nodes) { + Debug.assert(ts.every(nodes, ts.isStatement), "Cannot lift nodes to a Block."); + return ts.singleOrUndefined(nodes) || ts.createBlock(nodes); + } + ts.liftToBlock = liftToBlock; + /** + * Extracts the single node from a NodeArray. + * + * @param nodes The NodeArray. + */ + function extractSingleNode(nodes) { + Debug.assert(nodes.length <= 1, "Too many nodes written to output."); + return ts.singleOrUndefined(nodes); + } + /** + * Aggregates the TransformFlags for a Node and its subtree. + */ + function aggregateTransformFlags(node) { + aggregateTransformFlagsForNode(node); + return node; + } + ts.aggregateTransformFlags = aggregateTransformFlags; + /** + * Aggregates the TransformFlags for a Node and its subtree. The flags for the subtree are + * computed first, then the transform flags for the current node are computed from the subtree + * flags and the state of the current node. Finally, the transform flags of the node are + * returned, excluding any flags that should not be included in its parent node's subtree + * flags. + */ + function aggregateTransformFlagsForNode(node) { + if (node === undefined) { + return 0 /* None */; + } + if (node.transformFlags & 536870912 /* HasComputedFlags */) { + return node.transformFlags & ~ts.getTransformFlagsSubtreeExclusions(node.kind); + } + 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. + */ + function aggregateTransformFlagsForSubtree(node) { + // We do not transform ambient declarations or types, so there is no need to + // recursively aggregate transform flags. + if (ts.hasModifier(node, 2 /* Ambient */) || (ts.isTypeNode(node) && node.kind !== 199 /* ExpressionWithTypeArguments */)) { + return 0 /* None */; + } + // Aggregate the transform flags of each child. + return reduceEachChild(node, 0 /* None */, aggregateTransformFlagsForChildNode, aggregateTransformFlagsForChildNodes); + } + /** + * Aggregates the TransformFlags of a child node with the TransformFlags of its + * siblings. + */ + function aggregateTransformFlagsForChildNode(transformFlags, node) { + return transformFlags | aggregateTransformFlagsForNode(node); + } + function aggregateTransformFlagsForChildNodes(transformFlags, nodes) { + return transformFlags | aggregateTransformFlagsForNodeArray(nodes); + } + var Debug; + (function (Debug) { + Debug.failNotOptional = Debug.shouldAssert(1 /* Normal */) + ? function (message) { return Debug.assert(false, message || "Node not optional."); } + : ts.noop; + 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 ""; + } + else if (func.hasOwnProperty("name")) { + return func.name; + } + else { + var text = Function.prototype.toString.call(func); + var match = /^function\s+([\w\$]+)\s*\(/.exec(text); + return match ? match[1] : ""; + } + } + })(Debug = ts.Debug || (ts.Debug = {})); + var _a; })(ts || (ts = {})); -/// -/* @internal */ +/// +/// +/*@internal*/ var ts; (function (ts) { - function getDeclarationDiagnostics(host, resolver, targetSourceFile) { - var declarationDiagnostics = ts.createDiagnosticCollection(); - ts.forEachExpectedEmitFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); - return declarationDiagnostics.getDiagnostics(targetSourceFile ? targetSourceFile.fileName : undefined); - function getDeclarationDiagnosticsFromFile(_a, sources, isBundledEmit) { - var declarationFilePath = _a.declarationFilePath; - emitDeclarations(host, resolver, declarationDiagnostics, declarationFilePath, sources, isBundledEmit); + var FlattenLevel; + (function (FlattenLevel) { + FlattenLevel[FlattenLevel["All"] = 0] = "All"; + FlattenLevel[FlattenLevel["ObjectRest"] = 1] = "ObjectRest"; + })(FlattenLevel = ts.FlattenLevel || (ts.FlattenLevel = {})); + /** + * Flattens a DestructuringAssignment or a VariableDeclaration to an expression. + * + * @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(node, visitor, context, level, needsValue, createAssignmentCallback) { + var location = node; + 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; + } + } + } + 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; + } + } + flattenBindingOrAssignmentElement(flattenContext, node, value, location, /*skipInitializer*/ ts.isDestructuringAssignment(node)); + if (value && needsValue) { + if (!ts.some(expressions)) { + return value; + } + expressions.push(value); + } + 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, 64 /* NoNestedSourceMaps */); + ts.aggregateTransformFlags(expression); + expressions = ts.append(expressions, expression); + } + 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.getDeclarationDiagnostics = getDeclarationDiagnostics; - function emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit) { - var newLine = host.getNewLine(); - var compilerOptions = host.getCompilerOptions(); - var write; - var writeLine; - var increaseIndent; - var decreaseIndent; - var writeTextOfNode; - var writer; - createAndSetNewTextWriterWithSymbolWriter(); - var enclosingDeclaration; - var resultHasExternalModuleIndicator; - var currentText; - var currentLineMap; - var currentIdentifiers; - var isCurrentFileExternalModule; - var reportedDeclarationError = false; - var errorNameNode; - var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { } : writeJsDocComments; - var emit = compilerOptions.stripInternal ? stripInternal : emitNode; - var noDeclare; - var moduleElementDeclarationEmitInfo = []; - var asynchronousSubModuleDeclarationEmitInfo; - // Contains the reference paths that needs to go in the declaration file. - // Collecting this separately because reference paths need to be first thing in the declaration file - // and we could be collecting these paths from multiple files into single one with --out option - var referencesOutput = ""; - var usedTypeDirectiveReferences; - // Emit references corresponding to each file - var emittedReferencedFiles = []; - var addedGlobalFileReference = false; - var allSourcesModuleElementDeclarationEmitInfo = []; - ts.forEach(sourceFiles, function (sourceFile) { - // Dont emit for javascript file - if (ts.isSourceFileJavaScript(sourceFile)) { - return; - } - // Check what references need to be added - if (!compilerOptions.noResolve) { - ts.forEach(sourceFile.referencedFiles, function (fileReference) { - var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference); - // Emit reference in dts, if the file reference was not already emitted - if (referencedFile && !ts.contains(emittedReferencedFiles, referencedFile)) { - // Add a reference to generated dts file, - // global file reference is added only - // - if it is not bundled emit (because otherwise it would be self reference) - // - and it is not already added - if (writeReferencePath(referencedFile, !isBundledEmit && !addedGlobalFileReference)) { - addedGlobalFileReference = true; - } - emittedReferencedFiles.push(referencedFile); - } - }); - } - resultHasExternalModuleIndicator = false; - if (!isBundledEmit || !ts.isExternalModule(sourceFile)) { - noDeclare = false; - emitSourceFile(sourceFile); - } - else if (ts.isExternalModule(sourceFile)) { - noDeclare = true; - write("declare module \"" + ts.getResolvedExternalModuleName(host, sourceFile) + "\" {"); - writeLine(); - increaseIndent(); - emitSourceFile(sourceFile); - decreaseIndent(); - write("}"); - writeLine(); - } - // create asynchronous output for the importDeclarations - if (moduleElementDeclarationEmitInfo.length) { - var oldWriter = writer; - ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { - if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { - ts.Debug.assert(aliasEmitInfo.node.kind === 230 /* ImportDeclaration */); - createAndSetNewTextWriterWithSymbolWriter(); - ts.Debug.assert(aliasEmitInfo.indent === 0 || (aliasEmitInfo.indent === 1 && isBundledEmit)); - for (var i = 0; i < aliasEmitInfo.indent; i++) { - increaseIndent(); - } - writeImportDeclaration(aliasEmitInfo.node); - aliasEmitInfo.asynchronousOutput = writer.getText(); - for (var i = 0; i < aliasEmitInfo.indent; i++) { - decreaseIndent(); - } - } - }); - setWriter(oldWriter); - allSourcesModuleElementDeclarationEmitInfo = allSourcesModuleElementDeclarationEmitInfo.concat(moduleElementDeclarationEmitInfo); - moduleElementDeclarationEmitInfo = []; - } - if (!isBundledEmit && ts.isExternalModule(sourceFile) && sourceFile.moduleAugmentations.length && !resultHasExternalModuleIndicator) { - // if file was external module with augmentations - this fact should be preserved in .d.ts as well. - // in case if we didn't write any external module specifiers in .d.ts we need to emit something - // that will force compiler to think that this file is an external module - 'export {}' is a reasonable choice here. - write("export {};"); - writeLine(); - } - }); - if (usedTypeDirectiveReferences) { - for (var directive in usedTypeDirectiveReferences) { - referencesOutput += "/// " + newLine; - } - } - return { - reportedDeclarationError: reportedDeclarationError, - moduleElementDeclarationEmitInfo: allSourcesModuleElementDeclarationEmitInfo, - synchronousDeclarationOutput: writer.getText(), - referencesOutput: referencesOutput + ts.flattenDestructuringAssignment = flattenDestructuringAssignment; + /** + * Flattens a VariableDeclaration or ParameterDeclaration to one or more variable declarations. + * + * @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 flattenDestructuringBinding(node, visitor, context, level, rval, hoistTempVariables, skipInitializer) { + var pendingExpressions; + var pendingDeclarations = []; + var declarations = []; + var flattenContext = { + context: context, + level: level, + hoistTempVariables: hoistTempVariables, + emitExpression: emitExpression, + emitBindingOrAssignment: emitBindingOrAssignment, + createArrayBindingOrAssignmentPattern: makeArrayBindingPattern, + createObjectBindingOrAssignmentPattern: makeObjectBindingPattern, + createArrayBindingOrAssignmentElement: makeBindingElement, + visitor: visitor }; - function hasInternalAnnotation(range) { - var comment = currentText.substring(range.pos, range.end); - return comment.indexOf("@internal") >= 0; - } - function stripInternal(node) { - if (node) { - var leadingCommentRanges = ts.getLeadingCommentRanges(currentText, node.pos); - if (ts.forEach(leadingCommentRanges, hasInternalAnnotation)) { - return; - } - emitNode(node); + 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 createAndSetNewTextWriterWithSymbolWriter() { - var writer = ts.createTextWriter(newLine); - writer.trackSymbol = trackSymbol; - writer.reportInaccessibleThisError = reportInaccessibleThisError; - writer.writeKeyword = writer.write; - writer.writeOperator = writer.write; - writer.writePunctuation = writer.write; - writer.writeSpace = writer.write; - writer.writeStringLiteral = writer.writeLiteral; - writer.writeParameter = writer.write; - writer.writeSymbol = writer.write; - setWriter(writer); + for (var _i = 0, pendingDeclarations_1 = pendingDeclarations; _i < pendingDeclarations_1.length; _i++) { + var _a = pendingDeclarations_1[_i], pendingExpressions_1 = _a.pendingExpressions, name_30 = _a.name, value = _a.value, location_2 = _a.location, original = _a.original; + var variable = ts.createVariableDeclaration(name_30, + /*type*/ undefined, pendingExpressions_1 ? ts.inlineExpressions(ts.append(pendingExpressions_1, value)) : value, location_2); + variable.original = original; + if (ts.isIdentifier(name_30)) { + ts.setEmitFlags(variable, 64 /* NoNestedSourceMaps */); + } + ts.aggregateTransformFlags(variable); + declarations.push(variable); } - function setWriter(newWriter) { - writer = newWriter; - write = newWriter.write; - writeTextOfNode = newWriter.writeTextOfNode; - writeLine = newWriter.writeLine; - increaseIndent = newWriter.increaseIndent; - decreaseIndent = newWriter.decreaseIndent; + return declarations; + function emitExpression(value) { + pendingExpressions = ts.append(pendingExpressions, value); } - function writeAsynchronousModuleElements(nodes) { - var oldWriter = writer; - ts.forEach(nodes, function (declaration) { - var nodeToCheck; - if (declaration.kind === 218 /* VariableDeclaration */) { - nodeToCheck = declaration.parent.parent; - } - else if (declaration.kind === 233 /* NamedImports */ || declaration.kind === 234 /* ImportSpecifier */ || declaration.kind === 231 /* ImportClause */) { - ts.Debug.fail("We should be getting ImportDeclaration instead to write"); + 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.flattenDestructuringBinding = flattenDestructuringBinding; + /** + * Flattens a BindingOrAssignmentElement into zero or more bindings or assignments. + * + * @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 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 if (!value) { + // Use 'void 0' in absence of value and initializer + value = ts.createVoidZero(); + } + } + var bindingTarget = ts.getTargetOfBindingOrAssignmentElement(element); + if (ts.isObjectBindingOrAssignmentPattern(bindingTarget)) { + flattenObjectBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location); + } + else if (ts.isArrayBindingOrAssignmentPattern(bindingTarget)) { + flattenArrayBindingOrAssignmentPattern(flattenContext, element, bindingTarget, value, location); + } + 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 { - nodeToCheck = declaration; - } - var moduleElementEmitInfo = ts.forEach(moduleElementDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); - if (!moduleElementEmitInfo && asynchronousSubModuleDeclarationEmitInfo) { - moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); - } - // If the alias was marked as not visible when we saw its declaration, we would have saved the aliasEmitInfo, but if we haven't yet visited the alias declaration - // then we don't need to write it at this point. We will write it when we actually see its declaration - // Eg. - // export function bar(a: foo.Foo) { } - // import foo = require("foo"); - // Writing of function bar would mark alias declaration foo as visible but we haven't yet visited that declaration so do nothing, - // we would write alias foo declaration when we visit it since it would now be marked as visible - if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 230 /* ImportDeclaration */) { - // we have to create asynchronous output only after we have collected complete information - // because it is possible to enable multiple bindings as asynchronously visible - moduleElementEmitInfo.isVisible = true; + if (bindingElements) { + flattenContext.emitBindingOrAssignment(flattenContext.createObjectBindingOrAssignmentPattern(bindingElements), value, location, pattern); + bindingElements = undefined; } - else { - createAndSetNewTextWriterWithSymbolWriter(); - for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { - increaseIndent(); - } - if (nodeToCheck.kind === 225 /* ModuleDeclaration */) { - ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); - asynchronousSubModuleDeclarationEmitInfo = []; - } - writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 225 /* ModuleDeclaration */) { - moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; - asynchronousSubModuleDeclarationEmitInfo = undefined; - } - moduleElementEmitInfo.asynchronousOutput = writer.getText(); + var rhsValue = createDestructuringPropertyAccess(flattenContext, value, propertyName); + if (ts.isComputedPropertyName(propertyName)) { + computedTempVariables = ts.append(computedTempVariables, rhsValue.argumentExpression); } + flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, /*location*/ element); } - }); - setWriter(oldWriter); - } - function recordTypeReferenceDirectivesIfNecessary(typeReferenceDirectives) { - if (!typeReferenceDirectives) { - return; } - if (!usedTypeDirectiveReferences) { - usedTypeDirectiveReferences = ts.createMap(); - } - for (var _i = 0, typeReferenceDirectives_1 = typeReferenceDirectives; _i < typeReferenceDirectives_1.length; _i++) { - var directive = typeReferenceDirectives_1[_i]; - if (!(directive in usedTypeDirectiveReferences)) { - usedTypeDirectiveReferences[directive] = directive; + 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 handleSymbolAccessibilityError(symbolAccessibilityResult) { - if (symbolAccessibilityResult.accessibility === 0 /* Accessible */) { - // write the aliases - if (symbolAccessibilityResult && symbolAccessibilityResult.aliasesToMakeVisible) { - writeAsynchronousModuleElements(symbolAccessibilityResult.aliasesToMakeVisible); - } - } - else { - // Report error - reportedDeclarationError = true; - var errorInfo = writer.getSymbolAccessibilityDiagnostic(symbolAccessibilityResult); - if (errorInfo) { - if (errorInfo.typeName) { - emitterDiagnostics.add(ts.createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, ts.getTextOfNodeFromSourceText(currentText, errorInfo.typeName), symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName)); + 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); } - else { - emitterDiagnostics.add(ts.createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName)); - } - } - } - } - function trackSymbol(symbol, enclosingDeclaration, meaning) { - handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning)); - recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning)); - } - function reportInaccessibleThisError() { - if (errorNameNode) { - reportedDeclarationError = true; - emitterDiagnostics.add(ts.createDiagnosticForNode(errorNameNode, ts.Diagnostics.The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary, ts.declarationNameToString(errorNameNode))); - } - } - function writeTypeOfDeclaration(declaration, type, getSymbolAccessibilityDiagnostic) { - writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; - write(": "); - if (type) { - // Write the type - emitType(type); - } - else { - errorNameNode = declaration.name; - resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */, writer); - errorNameNode = undefined; - } - } - function writeReturnTypeAtSignature(signature, getSymbolAccessibilityDiagnostic) { - writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; - write(": "); - if (signature.type) { - // Write the type - emitType(signature.type); - } - else { - errorNameNode = signature.name; - resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */, writer); - errorNameNode = undefined; - } - } - function emitLines(nodes) { - for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) { - var node = nodes_2[_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]; - if (!canEmitFn || canEmitFn(node)) { - if (currentWriterPos !== writer.getTextPos()) { - write(separator); - } - currentWriterPos = writer.getTextPos(); - eachNodeEmitFn(node); - } - } - } - function emitCommaList(nodes, eachNodeEmitFn, canEmitFn) { - emitSeparatedList(nodes, ", ", eachNodeEmitFn, canEmitFn); - } - function writeJsDocComments(declaration) { - if (declaration) { - var jsDocComments = ts.getJsDocCommentsFromText(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, /*trailingSeparator*/ true, newLine, ts.writeCommentRange); - } - } - function emitTypeWithNewGetSymbolAccessibilityDiagnostic(type, getSymbolAccessibilityDiagnostic) { - writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; - emitType(type); - } - function emitType(type) { - switch (type.kind) { - case 117 /* AnyKeyword */: - case 132 /* StringKeyword */: - case 130 /* NumberKeyword */: - case 120 /* BooleanKeyword */: - case 133 /* SymbolKeyword */: - case 103 /* VoidKeyword */: - case 135 /* UndefinedKeyword */: - case 93 /* NullKeyword */: - case 127 /* NeverKeyword */: - case 165 /* ThisType */: - case 166 /* LiteralType */: - return writeTextOfNode(currentText, type); - case 194 /* ExpressionWithTypeArguments */: - return emitExpressionWithTypeArguments(type); - case 155 /* TypeReference */: - return emitTypeReference(type); - case 158 /* TypeQuery */: - return emitTypeQuery(type); - case 160 /* ArrayType */: - return emitArrayType(type); - case 161 /* TupleType */: - return emitTupleType(type); - case 162 /* UnionType */: - return emitUnionType(type); - case 163 /* IntersectionType */: - return emitIntersectionType(type); - case 164 /* ParenthesizedType */: - return emitParenType(type); - case 156 /* FunctionType */: - case 157 /* ConstructorType */: - return emitSignatureDeclarationWithJsDocComments(type); - case 159 /* TypeLiteral */: - return emitTypeLiteral(type); - case 69 /* Identifier */: - return emitEntityName(type); - case 139 /* QualifiedName */: - return emitEntityName(type); - case 154 /* TypePredicate */: - return emitTypePredicate(type); - } - function writeEntityName(entityName) { - if (entityName.kind === 69 /* Identifier */) { - writeTextOfNode(currentText, entityName); + restContainingElements = ts.append(restContainingElements, [temp, element]); + bindingElements = ts.append(bindingElements, flattenContext.createArrayBindingOrAssignmentElement(temp)); } else { - var left = entityName.kind === 139 /* QualifiedName */ ? entityName.left : entityName.expression; - var right = entityName.kind === 139 /* QualifiedName */ ? entityName.right : entityName.name; - writeEntityName(left); - write("."); - writeTextOfNode(currentText, right); + bindingElements = ts.append(bindingElements, element); } } - function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, - // Aliases can be written asynchronously so use correct enclosing declaration - entityName.parent.kind === 229 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); - handleSymbolAccessibilityError(visibilityResult); - recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName)); - writeEntityName(entityName); + else if (ts.isOmittedExpression(element)) { + continue; } - function emitExpressionWithTypeArguments(node) { - if (ts.isEntityNameExpression(node.expression)) { - ts.Debug.assert(node.expression.kind === 69 /* Identifier */ || node.expression.kind === 172 /* PropertyAccessExpression */); - emitEntityName(node.expression); - if (node.typeArguments) { - write("<"); - emitCommaList(node.typeArguments, emitType); - write(">"); - } - } + else if (!ts.getRestIndicatorOfBindingOrAssignmentElement(element)) { + var rhsValue = ts.createElementAccess(value, i); + flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, /*location*/ element); } - function emitTypeReference(type) { - emitEntityName(type.typeName); - if (type.typeArguments) { - write("<"); - emitCommaList(type.typeArguments, emitType); - write(">"); - } - } - function emitTypePredicate(type) { - writeTextOfNode(currentText, type.parameterName); - write(" is "); - emitType(type.type); - } - function emitTypeQuery(type) { - write("typeof "); - emitEntityName(type.exprName); - } - function emitArrayType(type) { - emitType(type.elementType); - write("[]"); - } - function emitTupleType(type) { - write("["); - emitCommaList(type.elementTypes, emitType); - write("]"); - } - function emitUnionType(type) { - emitSeparatedList(type.types, " | ", emitType); - } - function emitIntersectionType(type) { - emitSeparatedList(type.types, " & ", emitType); - } - function emitParenType(type) { - write("("); - emitType(type.type); - write(")"); - } - function emitTypeLiteral(type) { - write("{"); - if (type.members.length) { - writeLine(); - increaseIndent(); - // write members - emitLines(type.members); - decreaseIndent(); - } - write("}"); + else if (i === numElements - 1) { + var rhsValue = ts.createArraySlice(value, i); + flattenBindingOrAssignmentElement(flattenContext, element, rhsValue, /*location*/ element); } } - function emitSourceFile(node) { - currentText = node.text; - currentLineMap = ts.getLineStarts(node); - currentIdentifiers = node.identifiers; - isCurrentFileExternalModule = ts.isExternalModule(node); - enclosingDeclaration = node; - ts.emitDetachedComments(currentText, currentLineMap, writer, ts.writeCommentRange, node, newLine, true /* remove comments */); - emitLines(node.statements); + if (bindingElements) { + flattenContext.emitBindingOrAssignment(flattenContext.createArrayBindingOrAssignmentPattern(bindingElements), value, location, pattern); } - // Return a temp variable name to be used in `export default` statements. - // The temp name will be of the form _default_counter. - // Note that export default is only allowed at most once in a module, so we - // do not need to keep track of created temp names. - function getExportDefaultTempVariableName() { - var baseName = "_default"; - if (!(baseName in currentIdentifiers)) { - return baseName; - } - var count = 0; - while (true) { - count++; - var name_23 = baseName + "_" + count; - if (!(name_23 in currentIdentifiers)) { - return name_23; - } + 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 emitExportAssignment(node) { - if (node.expression.kind === 69 /* Identifier */) { - write(node.isExportEquals ? "export = " : "export default "); - writeTextOfNode(currentText, node.expression); + } + /** + * 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); + } + else if (ts.isStringOrNumericLiteral(propertyName)) { + var argumentExpression = ts.getSynthesizedClone(propertyName); + argumentExpression.text = ts.unescapeIdentifier(argumentExpression.text); + return ts.createElementAccess(value, argumentExpression); + } + else { + var name_31 = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)); + return ts.createPropertyAccess(value, name_31); + } + } + /** + * Ensures that there exists a declared identifier whose value holds the given expression. + * 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. + * @param location The location to use for source maps and comments. + */ + function ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location) { + if (ts.isIdentifier(value) && reuseIdentifierExpressions) { + return value; + } + else { + var temp = ts.createTempVariable(/*recordTempVariable*/ undefined); + if (flattenContext.hoistTempVariables) { + flattenContext.context.hoistVariableDeclaration(temp); + flattenContext.emitExpression(ts.createAssignment(temp, value, location)); } else { - // Expression - var tempVarName = getExportDefaultTempVariableName(); - if (!noDeclare) { - write("declare "); - } - write("var "); - write(tempVarName); - write(": "); - writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic; - resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */, writer); - write(";"); - writeLine(); - write(node.isExportEquals ? "export = " : "export default "); - write(tempVarName); - } - write(";"); - writeLine(); - // Make all the declarations visible for the export name - if (node.expression.kind === 69 /* Identifier */) { - var nodes = resolver.collectLinkedAliases(node.expression); - // write each of these declarations asynchronously - writeAsynchronousModuleElements(nodes); - } - function getDefaultExportAccessibilityDiagnostic(diagnostic) { - return { - diagnosticMessage: ts.Diagnostics.Default_export_of_the_module_has_or_is_using_private_name_0, - errorNode: node - }; + flattenContext.emitBindingOrAssignment(temp, value, location, /*original*/ undefined); } + return temp; } - function isModuleElementVisible(node) { - return resolver.isDeclarationVisible(node); - } - function emitModuleElement(node, isModuleElementVisible) { - if (isModuleElementVisible) { - writeModuleElement(node); - } - else if (node.kind === 229 /* ImportEqualsDeclaration */ || - (node.parent.kind === 256 /* SourceFile */ && isCurrentFileExternalModule)) { - var isVisible = void 0; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 256 /* SourceFile */) { - // Import declaration of another module that is visited async so lets put it in right spot - asynchronousSubModuleDeclarationEmitInfo.push({ - node: node, - outputPos: writer.getTextPos(), - indent: writer.getIndent(), - isVisible: isVisible - }); + } + 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 (s != null && 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 { - if (node.kind === 230 /* ImportDeclaration */) { - var importDeclaration = node; - if (importDeclaration.importClause) { - isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || - isVisibleNamedBinding(importDeclaration.importClause.namedBindings); - } - } - moduleElementDeclarationEmitInfo.push({ - node: node, - outputPos: writer.getTextPos(), - indent: writer.getIndent(), - isVisible: isVisible - }); + propertyNames.push(ts.createLiteral(propertyName)); } } } - function writeModuleElement(node) { + return ts.createCall(ts.getHelperName("__rest"), undefined, [value, ts.createArrayLiteral(propertyNames, location)]); + } +})(ts || (ts = {})); +/// +/// +/// +/*@internal*/ +var ts; +(function (ts) { + /** + * Indicates whether to emit type metadata in the new format. + */ + var USE_NEW_TYPE_METADATA_FORMAT = false; + var TypeScriptSubstitutionFlags; + (function (TypeScriptSubstitutionFlags) { + /** Enables substitutions for decorated classes. */ + TypeScriptSubstitutionFlags[TypeScriptSubstitutionFlags["ClassAliases"] = 1] = "ClassAliases"; + /** Enables substitutions for namespace exports. */ + TypeScriptSubstitutionFlags[TypeScriptSubstitutionFlags["NamespaceExports"] = 2] = "NamespaceExports"; + /* Enables substitutions for unqualified enum members */ + TypeScriptSubstitutionFlags[TypeScriptSubstitutionFlags["NonQualifiedEnumMembers"] = 8] = "NonQualifiedEnumMembers"; + })(TypeScriptSubstitutionFlags || (TypeScriptSubstitutionFlags = {})); + function transformTypeScript(context) { + 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); + var moduleKind = ts.getEmitModuleKind(compilerOptions); + // Save the previous transformation hooks. + var previousOnEmitNode = context.onEmitNode; + var previousOnSubstituteNode = context.onSubstituteNode; + // Set new transformation hooks. + context.onEmitNode = onEmitNode; + context.onSubstituteNode = onSubstituteNode; + // Enable substitution for property/element access to emit const enum values. + context.enableSubstitution(177 /* PropertyAccessExpression */); + context.enableSubstitution(178 /* ElementAccessExpression */); + // These variables contain state that changes as we descend into the tree. + var currentSourceFile; + var currentNamespace; + var currentNamespaceContainerName; + var currentScope; + var currentScopeFirstDeclarationsOfName; + /** + * 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; + /** + * A map that keeps track of aliases created for classes with decorators to avoid issues + * with the double-binding behavior of classes. + */ + var classAliases; + /** + * Keeps track of whether we are within any containing namespaces when performing + * just-in-time substitution while printing an expression identifier. + */ + var applicableSubstitutions; + return transformSourceFile; + /** + * Transform TypeScript-specific syntax in a SourceFile. + * + * @param node A SourceFile node. + */ + function transformSourceFile(node) { + if (ts.isDeclarationFile(node)) { + return node; + } + 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. + * + * @param node The node to visit. + */ + function saveStateAndInvoke(node, f) { + // Save state + var savedCurrentScope = currentScope; + var savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName; + // Handle state changes before visiting a node. + onBeforeVisitNode(node); + var visited = f(node); + // Restore state + if (currentScope !== savedCurrentScope) { + currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName; + } + currentScope = savedCurrentScope; + 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 220 /* FunctionDeclaration */: - return writeFunctionDeclaration(node); - case 200 /* VariableStatement */: - return writeVariableStatement(node); - case 222 /* InterfaceDeclaration */: - return writeInterfaceDeclaration(node); - case 221 /* ClassDeclaration */: - return writeClassDeclaration(node); - case 223 /* TypeAliasDeclaration */: - return writeTypeAliasDeclaration(node); - case 224 /* EnumDeclaration */: - return writeEnumDeclaration(node); - case 225 /* ModuleDeclaration */: - return writeModuleDeclaration(node); - case 229 /* ImportEqualsDeclaration */: - return writeImportEqualsDeclaration(node); - case 230 /* ImportDeclaration */: - return writeImportDeclaration(node); - default: - ts.Debug.fail("Unknown symbol kind"); - } - } - function emitModuleElementDeclarationFlags(node) { - // If the node is parented in the current source file we need to emit export declare or just export - if (node.parent.kind === 256 /* SourceFile */) { - // If the node is exported - if (node.flags & 1 /* Export */) { - write("export "); - } - if (node.flags & 512 /* Default */) { - write("default "); - } - else if (node.kind !== 222 /* InterfaceDeclaration */ && !noDeclare) { - write("declare "); - } - } - } - function emitClassMemberDeclarationFlags(flags) { - if (flags & 8 /* Private */) { - write("private "); - } - else if (flags & 16 /* Protected */) { - write("protected "); - } - if (flags & 32 /* Static */) { - write("static "); - } - if (flags & 64 /* Readonly */) { - write("readonly "); - } - if (flags & 128 /* Abstract */) { - write("abstract "); - } - } - function writeImportEqualsDeclaration(node) { - // note usage of writer. methods instead of aliases created, just to make sure we are using - // correct writer especially to handle asynchronous alias writing - emitJsDocComments(node); - if (node.flags & 1 /* Export */) { - write("export "); - } - write("import "); - writeTextOfNode(currentText, node.name); - write(" = "); - if (ts.isInternalModuleImportEqualsDeclaration(node)) { - emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.moduleReference, getImportEntityNameVisibilityError); - write(";"); - } - else { - write("require("); - emitExternalModuleSpecifier(node); - write(");"); - } - writer.writeLine(); - function getImportEntityNameVisibilityError(symbolAccessibilityResult) { - return { - diagnosticMessage: ts.Diagnostics.Import_declaration_0_is_using_private_name_1, - errorNode: node, - typeName: node.name - }; - } - } - function isVisibleNamedBinding(namedBindings) { - if (namedBindings) { - if (namedBindings.kind === 232 /* NamespaceImport */) { - return resolver.isDeclarationVisible(namedBindings); - } - else { - return ts.forEach(namedBindings.elements, function (namedImport) { return resolver.isDeclarationVisible(namedImport); }); - } - } - } - function writeImportDeclaration(node) { - emitJsDocComments(node); - if (node.flags & 1 /* Export */) { - write("export "); - } - write("import "); - if (node.importClause) { - var currentWriterPos = writer.getTextPos(); - if (node.importClause.name && resolver.isDeclarationVisible(node.importClause)) { - writeTextOfNode(currentText, node.importClause.name); - } - if (node.importClause.namedBindings && isVisibleNamedBinding(node.importClause.namedBindings)) { - if (currentWriterPos !== writer.getTextPos()) { - // If the default binding was emitted, write the separated - write(", "); - } - if (node.importClause.namedBindings.kind === 232 /* NamespaceImport */) { - write("* as "); - writeTextOfNode(currentText, node.importClause.namedBindings.name); - } - else { - write("{ "); - emitCommaList(node.importClause.namedBindings.elements, emitImportOrExportSpecifier, resolver.isDeclarationVisible); - write(" }"); - } - } - write(" from "); - } - emitExternalModuleSpecifier(node); - write(";"); - writer.writeLine(); - } - function emitExternalModuleSpecifier(parent) { - // emitExternalModuleSpecifier is usually called when we emit something in the.d.ts file that will make it an external module (i.e. import/export declarations). - // the only case when it is not true is when we call it to emit correct name for module augmentation - d.ts files with just module augmentations are not considered - // external modules since they are indistinguishable from script files with ambient modules. To fix this in such d.ts files we'll emit top level 'export {}' - // so compiler will treat them as external modules. - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 225 /* ModuleDeclaration */; - var moduleSpecifier; - if (parent.kind === 229 /* ImportEqualsDeclaration */) { - var node = parent; - moduleSpecifier = ts.getExternalModuleImportEqualsDeclarationExpression(node); - } - else if (parent.kind === 225 /* ModuleDeclaration */) { - moduleSpecifier = parent.name; - } - else { - var node = parent; - moduleSpecifier = node.moduleSpecifier; - } - if (moduleSpecifier.kind === 9 /* StringLiteral */ && isBundledEmit && (compilerOptions.out || compilerOptions.outFile)) { - var moduleName = ts.getExternalModuleNameFromDeclaration(host, resolver, parent); - if (moduleName) { - write('"'); - write(moduleName); - write('"'); - return; - } - } - writeTextOfNode(currentText, moduleSpecifier); - } - function emitImportOrExportSpecifier(node) { - if (node.propertyName) { - writeTextOfNode(currentText, node.propertyName); - write(" as "); - } - writeTextOfNode(currentText, node.name); - } - function emitExportSpecifier(node) { - emitImportOrExportSpecifier(node); - // Make all the declarations visible for the export name - var nodes = resolver.collectLinkedAliases(node.propertyName || node.name); - // write each of these declarations asynchronously - writeAsynchronousModuleElements(nodes); - } - function emitExportDeclaration(node) { - emitJsDocComments(node); - write("export "); - if (node.exportClause) { - write("{ "); - emitCommaList(node.exportClause.elements, emitExportSpecifier); - write(" }"); - } - else { - write("*"); - } - if (node.moduleSpecifier) { - write(" from "); - emitExternalModuleSpecifier(node); - } - write(";"); - writer.writeLine(); - } - function writeModuleDeclaration(node) { - emitJsDocComments(node); - emitModuleElementDeclarationFlags(node); - if (ts.isGlobalScopeAugmentation(node)) { - write("global "); - } - else { - if (node.flags & 4096 /* Namespace */) { - write("namespace "); - } - else { - write("module "); - } - if (ts.isExternalModuleAugmentation(node)) { - emitExternalModuleSpecifier(node); - } - else { - writeTextOfNode(currentText, node.name); - } - } - while (node.body && node.body.kind !== 226 /* ModuleBlock */) { - node = node.body; - write("."); - writeTextOfNode(currentText, node.name); - } - var prevEnclosingDeclaration = enclosingDeclaration; - if (node.body) { - enclosingDeclaration = node; - write(" {"); - writeLine(); - increaseIndent(); - emitLines(node.body.statements); - decreaseIndent(); - write("}"); - writeLine(); - enclosingDeclaration = prevEnclosingDeclaration; - } - else { - write(";"); - } - } - function writeTypeAliasDeclaration(node) { - var prevEnclosingDeclaration = enclosingDeclaration; - enclosingDeclaration = node; - emitJsDocComments(node); - emitModuleElementDeclarationFlags(node); - write("type "); - writeTextOfNode(currentText, node.name); - emitTypeParameters(node.typeParameters); - write(" = "); - emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.type, getTypeAliasDeclarationVisibilityError); - write(";"); - writeLine(); - enclosingDeclaration = prevEnclosingDeclaration; - function getTypeAliasDeclarationVisibilityError(symbolAccessibilityResult) { - return { - diagnosticMessage: ts.Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1, - errorNode: node.type, - typeName: node.name - }; - } - } - function writeEnumDeclaration(node) { - emitJsDocComments(node); - emitModuleElementDeclarationFlags(node); - if (ts.isConst(node)) { - write("const "); - } - write("enum "); - writeTextOfNode(currentText, node.name); - write(" {"); - writeLine(); - increaseIndent(); - emitLines(node.members); - decreaseIndent(); - write("}"); - writeLine(); - } - function emitEnumMemberDeclaration(node) { - emitJsDocComments(node); - writeTextOfNode(currentText, node.name); - var enumMemberValue = resolver.getConstantValue(node); - if (enumMemberValue !== undefined) { - write(" = "); - write(enumMemberValue.toString()); - } - write(","); - writeLine(); - } - function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 147 /* MethodDeclaration */ && (node.parent.flags & 8 /* Private */); - } - function emitTypeParameters(typeParameters) { - function emitTypeParameter(node) { - increaseIndent(); - emitJsDocComments(node); - decreaseIndent(); - writeTextOfNode(currentText, node.name); - // If there is constraint present and this is not a type parameter of the private method emit the constraint - if (node.constraint && !isPrivateMethodTypeParameter(node)) { - write(" extends "); - if (node.parent.kind === 156 /* FunctionType */ || - node.parent.kind === 157 /* ConstructorType */ || - (node.parent.parent && node.parent.parent.kind === 159 /* TypeLiteral */)) { - ts.Debug.assert(node.parent.kind === 147 /* MethodDeclaration */ || - node.parent.kind === 146 /* MethodSignature */ || - node.parent.kind === 156 /* FunctionType */ || - node.parent.kind === 157 /* ConstructorType */ || - node.parent.kind === 151 /* CallSignature */ || - node.parent.kind === 152 /* ConstructSignature */); - emitType(node.constraint); - } - else { - emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.constraint, getTypeParameterConstraintVisibilityError); - } - } - function getTypeParameterConstraintVisibilityError(symbolAccessibilityResult) { - // Type parameter constraints are named by user so we should always be able to name it - var diagnosticMessage; - switch (node.parent.kind) { - case 221 /* ClassDeclaration */: - diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; - break; - case 222 /* InterfaceDeclaration */: - diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; - break; - case 152 /* ConstructSignature */: - diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - break; - case 151 /* CallSignature */: - diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - break; - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - if (node.parent.flags & 32 /* Static */) { - diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; - } - else if (node.parent.parent.kind === 221 /* ClassDeclaration */) { - diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; - } - else { - diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; - } - break; - case 220 /* FunctionDeclaration */: - diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; - break; - default: - ts.Debug.fail("This is unknown parent for type parameter: " + node.parent.kind); - } - return { - diagnosticMessage: diagnosticMessage, - errorNode: node, - typeName: node.name - }; - } - } - if (typeParameters) { - write("<"); - emitCommaList(typeParameters, emitTypeParameter); - write(">"); - } - } - function emitHeritageClause(typeReferences, isImplementsList) { - if (typeReferences) { - write(isImplementsList ? " implements " : " extends "); - emitCommaList(typeReferences, emitTypeOfTypeReference); - } - function emitTypeOfTypeReference(node) { - if (ts.isEntityNameExpression(node.expression)) { - emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); - } - else if (!isImplementsList && node.expression.kind === 93 /* NullKeyword */) { - write("null"); - } - else { - writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError; - resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */, writer); - } - function getHeritageClauseVisibilityError(symbolAccessibilityResult) { - var diagnosticMessage; - // Heritage clause is written by user so it can always be named - if (node.parent.parent.kind === 221 /* ClassDeclaration */) { - // Class or Interface implemented/extended is inaccessible - diagnosticMessage = isImplementsList ? - ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : - ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; - } - else { - // interface is inaccessible - diagnosticMessage = ts.Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1; - } - return { - diagnosticMessage: diagnosticMessage, - errorNode: node, - typeName: node.parent.parent.name - }; - } - } - } - function writeClassDeclaration(node) { - function emitParameterProperties(constructorDeclaration) { - if (constructorDeclaration) { - ts.forEach(constructorDeclaration.parameters, function (param) { - if (param.flags & 92 /* ParameterPropertyModifier */) { - emitPropertyDeclaration(param); - } - }); - } - } - emitJsDocComments(node); - emitModuleElementDeclarationFlags(node); - if (node.flags & 128 /* Abstract */) { - write("abstract "); - } - write("class "); - writeTextOfNode(currentText, node.name); - var prevEnclosingDeclaration = enclosingDeclaration; - enclosingDeclaration = node; - emitTypeParameters(node.typeParameters); - var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); - if (baseTypeNode) { - emitHeritageClause([baseTypeNode], /*isImplementsList*/ false); - } - emitHeritageClause(ts.getClassImplementsHeritageClauseElements(node), /*isImplementsList*/ true); - write(" {"); - writeLine(); - increaseIndent(); - emitParameterProperties(ts.getFirstConstructorWithBody(node)); - emitLines(node.members); - decreaseIndent(); - write("}"); - writeLine(); - enclosingDeclaration = prevEnclosingDeclaration; - } - function writeInterfaceDeclaration(node) { - emitJsDocComments(node); - emitModuleElementDeclarationFlags(node); - write("interface "); - writeTextOfNode(currentText, node.name); - var prevEnclosingDeclaration = enclosingDeclaration; - enclosingDeclaration = node; - emitTypeParameters(node.typeParameters); - emitHeritageClause(ts.getInterfaceBaseTypeNodes(node), /*isImplementsList*/ false); - write(" {"); - writeLine(); - increaseIndent(); - emitLines(node.members); - decreaseIndent(); - write("}"); - writeLine(); - enclosingDeclaration = prevEnclosingDeclaration; - } - function emitPropertyDeclaration(node) { - if (ts.hasDynamicName(node)) { - return; - } - emitJsDocComments(node); - emitClassMemberDeclarationFlags(node.flags); - emitVariableDeclaration(node); - write(";"); - writeLine(); - } - function emitVariableDeclaration(node) { - // If we are emitting property it isn't moduleElement and hence we already know it needs to be emitted - // so there is no check needed to see if declaration is visible - if (node.kind !== 218 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { - if (ts.isBindingPattern(node.name)) { - emitBindingPattern(node.name); - } - else { - // If this node is a computed name, it can only be a symbol, because we've already skipped - // it if it's not a well known symbol. In that case, the text of the name will be exactly - // what we want, namely the name expression enclosed in brackets. - writeTextOfNode(currentText, node.name); - // If optional property emit ? but in the case of parameterProperty declaration with "?" indicating optional parameter for the constructor - // we don't want to emit property declaration with "?" - if ((node.kind === 145 /* PropertyDeclaration */ || node.kind === 144 /* PropertySignature */ || - (node.kind === 142 /* Parameter */ && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) { - write("?"); - } - if ((node.kind === 145 /* PropertyDeclaration */ || node.kind === 144 /* PropertySignature */) && node.parent.kind === 159 /* TypeLiteral */) { - emitTypeOfVariableDeclarationFromTypeLiteral(node); - } - else if (!(node.flags & 8 /* Private */)) { - writeTypeOfDeclaration(node, node.type, getVariableDeclarationTypeVisibilityError); - } - } - } - function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 218 /* VariableDeclaration */) { - return symbolAccessibilityResult.errorModuleName ? - symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? - ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; - } - else if (node.kind === 145 /* PropertyDeclaration */ || node.kind === 144 /* PropertySignature */) { - // TODO(jfreeman): Deal with computed properties in error reporting. - if (node.flags & 32 /* Static */) { - return symbolAccessibilityResult.errorModuleName ? - symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? - ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; - } - else if (node.parent.kind === 221 /* ClassDeclaration */) { - return symbolAccessibilityResult.errorModuleName ? - symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? - ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; - } - else { - // Interfaces cannot have types that cannot be named - return symbolAccessibilityResult.errorModuleName ? - ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; - } - } - } - function getVariableDeclarationTypeVisibilityError(symbolAccessibilityResult) { - var diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult); - return diagnosticMessage !== undefined ? { - diagnosticMessage: diagnosticMessage, - errorNode: node, - typeName: node.name - } : undefined; - } - function emitBindingPattern(bindingPattern) { - // Only select non-omitted expression from the bindingPattern's elements. - // We have to do this to avoid emitting trailing commas. - // For example: - // original: var [, c,,] = [ 2,3,4] - // emitted: declare var c: number; // instead of declare var c:number, ; - var elements = []; - for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { - var element = _a[_i]; - if (element.kind !== 193 /* OmittedExpression */) { - elements.push(element); - } - } - emitCommaList(elements, emitBindingElement); - } - function emitBindingElement(bindingElement) { - function getBindingElementTypeVisibilityError(symbolAccessibilityResult) { - var diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult); - return diagnosticMessage !== undefined ? { - diagnosticMessage: diagnosticMessage, - errorNode: bindingElement, - typeName: bindingElement.name - } : undefined; - } - if (bindingElement.name) { - if (ts.isBindingPattern(bindingElement.name)) { - emitBindingPattern(bindingElement.name); - } - else { - writeTextOfNode(currentText, bindingElement.name); - writeTypeOfDeclaration(bindingElement, /*type*/ undefined, getBindingElementTypeVisibilityError); - } - } - } - } - function emitTypeOfVariableDeclarationFromTypeLiteral(node) { - // if this is property of type literal, - // or is parameter of method/call/construct/index signature of type literal - // emit only if type is specified - if (node.type) { - write(": "); - emitType(node.type); - } - } - function isVariableStatementVisible(node) { - return ts.forEach(node.declarationList.declarations, function (varDeclaration) { return resolver.isDeclarationVisible(varDeclaration); }); - } - function writeVariableStatement(node) { - emitJsDocComments(node); - emitModuleElementDeclarationFlags(node); - if (ts.isLet(node.declarationList)) { - write("let "); - } - else if (ts.isConst(node.declarationList)) { - write("const "); - } - else { - write("var "); - } - emitCommaList(node.declarationList.declarations, emitVariableDeclaration, resolver.isDeclarationVisible); - write(";"); - writeLine(); - } - function emitAccessorDeclaration(node) { - if (ts.hasDynamicName(node)) { - return; - } - var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); - var accessorWithTypeAnnotation; - if (node === accessors.firstAccessor) { - emitJsDocComments(accessors.getAccessor); - emitJsDocComments(accessors.setAccessor); - emitClassMemberDeclarationFlags(node.flags | (accessors.setAccessor ? 0 : 64 /* Readonly */)); - writeTextOfNode(currentText, node.name); - if (!(node.flags & 8 /* Private */)) { - accessorWithTypeAnnotation = node; - var type = getTypeAnnotationFromAccessor(node); - if (!type) { - // couldn't get type for the first accessor, try the another one - var anotherAccessor = node.kind === 149 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; - type = getTypeAnnotationFromAccessor(anotherAccessor); - if (type) { - accessorWithTypeAnnotation = anotherAccessor; - } - } - writeTypeOfDeclaration(node, type, getAccessorDeclarationTypeVisibilityError); - } - write(";"); - writeLine(); - } - function getTypeAnnotationFromAccessor(accessor) { - if (accessor) { - return accessor.kind === 149 /* GetAccessor */ - ? accessor.type // Getter - return type - : accessor.parameters.length > 0 - ? accessor.parameters[0].type // Setter parameter type - : undefined; - } - } - function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { - var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 150 /* SetAccessor */) { - // Setters have to have type named and cannot infer it so, the type should always be named - if (accessorWithTypeAnnotation.parent.flags & 32 /* Static */) { - diagnosticMessage = symbolAccessibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; - } - else { - diagnosticMessage = symbolAccessibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; - } - return { - diagnosticMessage: diagnosticMessage, - errorNode: accessorWithTypeAnnotation.parameters[0], - // TODO(jfreeman): Investigate why we are passing node.name instead of node.parameters[0].name - typeName: accessorWithTypeAnnotation.name - }; - } - else { - if (accessorWithTypeAnnotation.flags & 32 /* Static */) { - diagnosticMessage = symbolAccessibilityResult.errorModuleName ? - symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? - ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; - } - else { - diagnosticMessage = symbolAccessibilityResult.errorModuleName ? - symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? - ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; - } - return { - diagnosticMessage: diagnosticMessage, - errorNode: accessorWithTypeAnnotation.name, - typeName: undefined - }; - } - } - } - function writeFunctionDeclaration(node) { - if (ts.hasDynamicName(node)) { - return; - } - // If we are emitting Method/Constructor it isn't moduleElement and hence already determined to be emitting - // so no need to verify if the declaration is visible - if (!resolver.isImplementationOfOverload(node)) { - emitJsDocComments(node); - if (node.kind === 220 /* FunctionDeclaration */) { - emitModuleElementDeclarationFlags(node); - } - else if (node.kind === 147 /* MethodDeclaration */ || node.kind === 148 /* Constructor */) { - emitClassMemberDeclarationFlags(node.flags); - } - if (node.kind === 220 /* FunctionDeclaration */) { - write("function "); - writeTextOfNode(currentText, node.name); - } - else if (node.kind === 148 /* Constructor */) { - write("constructor"); - } - else { - writeTextOfNode(currentText, node.name); - if (ts.hasQuestionToken(node)) { - write("?"); - } - } - emitSignatureDeclaration(node); - } - } - function emitSignatureDeclarationWithJsDocComments(node) { - emitJsDocComments(node); - emitSignatureDeclaration(node); - } - function emitSignatureDeclaration(node) { - var prevEnclosingDeclaration = enclosingDeclaration; - enclosingDeclaration = node; - var closeParenthesizedFunctionType = false; - if (node.kind === 153 /* IndexSignature */) { - // Index signature can have readonly modifier - emitClassMemberDeclarationFlags(node.flags); - write("["); - } - else { - // Construct signature or constructor type write new Signature - if (node.kind === 152 /* ConstructSignature */ || node.kind === 157 /* ConstructorType */) { - write("new "); - } - else if (node.kind === 156 /* FunctionType */) { - var currentOutput = writer.getText(); - // Do not generate incorrect type when function type with type parameters is type argument - // This could happen if user used space between two '<' making it error free - // e.g var x: A< (a: Tany)=>Tany>; - if (node.typeParameters && currentOutput.charAt(currentOutput.length - 1) === "<") { - closeParenthesizedFunctionType = true; - write("("); - } - } - emitTypeParameters(node.typeParameters); - write("("); - } - // Parameters - emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 153 /* IndexSignature */) { - write("]"); - } - else { - write(")"); - } - // If this is not a constructor and is not private, emit the return type - var isFunctionTypeOrConstructorType = node.kind === 156 /* FunctionType */ || node.kind === 157 /* ConstructorType */; - if (isFunctionTypeOrConstructorType || node.parent.kind === 159 /* TypeLiteral */) { - // Emit type literal signature return type only if specified - if (node.type) { - write(isFunctionTypeOrConstructorType ? " => " : ": "); - emitType(node.type); - } - } - else if (node.kind !== 148 /* Constructor */ && !(node.flags & 8 /* Private */)) { - writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); - } - enclosingDeclaration = prevEnclosingDeclaration; - if (!isFunctionTypeOrConstructorType) { - write(";"); - writeLine(); - } - else if (closeParenthesizedFunctionType) { - write(")"); - } - function getReturnTypeVisibilityError(symbolAccessibilityResult) { - var diagnosticMessage; - switch (node.kind) { - case 152 /* ConstructSignature */: - // Interfaces cannot have return types that cannot be named - diagnosticMessage = symbolAccessibilityResult.errorModuleName ? - ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; + 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; - case 151 /* CallSignature */: - // Interfaces cannot have return types that cannot be named - diagnosticMessage = symbolAccessibilityResult.errorModuleName ? - ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; - break; - case 153 /* IndexSignature */: - // Interfaces cannot have return types that cannot be named - diagnosticMessage = symbolAccessibilityResult.errorModuleName ? - ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; - break; - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - if (node.flags & 32 /* Static */) { - diagnosticMessage = symbolAccessibilityResult.errorModuleName ? - symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? - ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; - } - else if (node.parent.kind === 221 /* ClassDeclaration */) { - diagnosticMessage = symbolAccessibilityResult.errorModuleName ? - symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? - ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; - } - else { - // Interfaces cannot have return types that cannot be named - diagnosticMessage = symbolAccessibilityResult.errorModuleName ? - ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; - } - break; - case 220 /* FunctionDeclaration */: - diagnosticMessage = symbolAccessibilityResult.errorModuleName ? - symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? - ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; - break; - default: - ts.Debug.fail("This is unknown kind for signature: " + node.kind); - } - return { - diagnosticMessage: diagnosticMessage, - errorNode: node.name || node - }; - } - } - function emitParameterDeclaration(node) { - increaseIndent(); - emitJsDocComments(node); - if (node.dotDotDotToken) { - write("..."); - } - if (ts.isBindingPattern(node.name)) { - // For bindingPattern, we can't simply writeTextOfNode from the source file - // because we want to omit the initializer and using writeTextOfNode will result in initializer get emitted. - // Therefore, we will have to recursively emit each element in the bindingPattern. - emitBindingPattern(node.name); - } - else { - writeTextOfNode(currentText, node.name); - } - if (resolver.isOptionalParameter(node)) { - write("?"); - } - decreaseIndent(); - if (node.parent.kind === 156 /* FunctionType */ || - node.parent.kind === 157 /* ConstructorType */ || - node.parent.parent.kind === 159 /* TypeLiteral */) { - emitTypeOfVariableDeclarationFromTypeLiteral(node); - } - else if (!(node.parent.flags & 8 /* Private */)) { - writeTypeOfDeclaration(node, node.type, getParameterDeclarationTypeVisibilityError); - } - function getParameterDeclarationTypeVisibilityError(symbolAccessibilityResult) { - var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult); - return diagnosticMessage !== undefined ? { - diagnosticMessage: diagnosticMessage, - errorNode: node, - typeName: node.name - } : undefined; - } - function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - switch (node.parent.kind) { - case 148 /* Constructor */: - return symbolAccessibilityResult.errorModuleName ? - symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? - ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 152 /* ConstructSignature */: - // Interfaces cannot have parameter types that cannot be named - return symbolAccessibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 151 /* CallSignature */: - // Interfaces cannot have parameter types that cannot be named - return symbolAccessibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - if (node.parent.flags & 32 /* Static */) { - return symbolAccessibilityResult.errorModuleName ? - symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? - ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; - } - else if (node.parent.parent.kind === 221 /* ClassDeclaration */) { - return symbolAccessibilityResult.errorModuleName ? - symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? - ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; - } - else { - // Interfaces cannot have parameter types that cannot be named - return symbolAccessibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; - } - case 220 /* FunctionDeclaration */: - return symbolAccessibilityResult.errorModuleName ? - symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? - ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; - default: - ts.Debug.fail("This is unknown parent for parameter: " + node.parent.kind); - } - } - function emitBindingPattern(bindingPattern) { - // We have to explicitly emit square bracket and bracket because these tokens are not store inside the node. - if (bindingPattern.kind === 167 /* ObjectBindingPattern */) { - write("{"); - emitCommaList(bindingPattern.elements, emitBindingElement); - write("}"); - } - else if (bindingPattern.kind === 168 /* ArrayBindingPattern */) { - write("["); - var elements = bindingPattern.elements; - emitCommaList(elements, emitBindingElement); - if (elements && elements.hasTrailingComma) { - write(", "); } - write("]"); - } - } - function emitBindingElement(bindingElement) { - if (bindingElement.kind === 193 /* OmittedExpression */) { - // If bindingElement is an omittedExpression (i.e. containing elision), - // we will emit blank space (although this may differ from users' original code, - // it allows emitSeparatedList to write separator appropriately) - // Example: - // original: function foo([, x, ,]) {} - // emit : function foo([ , x, , ]) {} - write(" "); - } - else if (bindingElement.kind === 169 /* BindingElement */) { - if (bindingElement.propertyName) { - // bindingElement has propertyName property in the following case: - // { y: [a,b,c] ...} -> bindingPattern will have a property called propertyName for "y" - // We have to explicitly emit the propertyName before descending into its binding elements. - // Example: - // original: function foo({y: [a,b,c]}) {} - // emit : declare function foo({y: [a, b, c]}: { y: [any, any, any] }) void; - writeTextOfNode(currentText, bindingElement.propertyName); - write(": "); - } - if (bindingElement.name) { - if (ts.isBindingPattern(bindingElement.name)) { - // If it is a nested binding pattern, we will recursively descend into each element and emit each one separately. - // In the case of rest element, we will omit rest element. - // Example: - // original: function foo([a, [[b]], c] = [1,[["string"]], 3]) {} - // emit : declare function foo([a, [[b]], c]: [number, [[string]], number]): void; - // original with rest: function foo([a, ...c]) {} - // emit : declare function foo([a, ...c]): void; - emitBindingPattern(bindingElement.name); - } - else { - ts.Debug.assert(bindingElement.name.kind === 69 /* Identifier */); - // If the node is just an identifier, we will simply emit the text associated with the node's name - // Example: - // original: function foo({y = 10, x}) {} - // emit : declare function foo({y, x}: {number, any}): void; - if (bindingElement.dotDotDotToken) { - write("..."); - } - writeTextOfNode(currentText, bindingElement.name); - } - } - } - } - } - function emitNode(node) { - switch (node.kind) { - case 220 /* FunctionDeclaration */: - case 225 /* ModuleDeclaration */: - case 229 /* ImportEqualsDeclaration */: - case 222 /* InterfaceDeclaration */: - case 221 /* ClassDeclaration */: - case 223 /* TypeAliasDeclaration */: - case 224 /* EnumDeclaration */: - return emitModuleElement(node, isModuleElementVisible(node)); - case 200 /* VariableStatement */: - return emitModuleElement(node, isVariableStatementVisible(node)); - case 230 /* ImportDeclaration */: - // Import declaration without import clause is visible, otherwise it is not visible - return emitModuleElement(node, /*isModuleElementVisible*/ !node.importClause); - case 236 /* ExportDeclaration */: - return emitExportDeclaration(node); - case 148 /* Constructor */: - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - return writeFunctionDeclaration(node); - case 152 /* ConstructSignature */: - case 151 /* CallSignature */: - case 153 /* IndexSignature */: - return emitSignatureDeclarationWithJsDocComments(node); - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - return emitAccessorDeclaration(node); - case 145 /* PropertyDeclaration */: - case 144 /* PropertySignature */: - return emitPropertyDeclaration(node); - case 255 /* EnumMember */: - return emitEnumMemberDeclaration(node); - case 235 /* ExportAssignment */: - return emitExportAssignment(node); - case 256 /* SourceFile */: - return emitSourceFile(node); + recordEmittedDeclarationInScope(node); + break; } } /** - * Adds the reference to referenced file, returns true if global file reference was emitted - * @param referencedFile - * @param addBundledFileReference Determines if global file reference corresponding to bundled file should be emitted or not + * General-purpose node visitor. + * + * @param node The node to visit. */ - function writeReferencePath(referencedFile, addBundledFileReference) { - var declFileName; - var addedBundledEmitReference = false; - if (ts.isDeclarationFile(referencedFile)) { - // Declaration file, use declaration file name - declFileName = referencedFile.fileName; + function visitor(node) { + return saveStateAndInvoke(node, visitorWorker); + } + /** + * Visits and possibly transforms any node. + * + * @param node The node to visit. + */ + function visitorWorker(node) { + if (node.transformFlags & 1 /* TypeScript */) { + // This node is explicitly marked as TypeScript, so we should transform the node. + return visitTypeScript(node); + } + else if (node.transformFlags & 2 /* ContainsTypeScript */) { + // This node contains TypeScript, so we should visit its children. + return ts.visitEachChild(node, visitor, context); + } + return node; + } + /** + * Specialized visitor that visits the immediate children of a SourceFile. + * + * @param node The node to visit. + */ + function sourceElementVisitor(node) { + return saveStateAndInvoke(node, sourceElementVisitorWorker); + } + /** + * Specialized visitor that visits the immediate children of a SourceFile. + * + * @param node The node to visit. + */ + function sourceElementVisitorWorker(node) { + switch (node.kind) { + case 235 /* ImportDeclaration */: + return visitImportDeclaration(node); + case 234 /* ImportEqualsDeclaration */: + return visitImportEqualsDeclaration(node); + case 240 /* ExportAssignment */: + return visitExportAssignment(node); + case 241 /* ExportDeclaration */: + return visitExportDeclaration(node); + default: + return visitorWorker(node); + } + } + /** + * Specialized visitor that visits the immediate children of a namespace. + * + * @param node The node to visit. + */ + function namespaceElementVisitor(node) { + return saveStateAndInvoke(node, namespaceElementVisitorWorker); + } + /** + * Specialized visitor that visits the immediate children of a namespace. + * + * @param node The node to visit. + */ + function namespaceElementVisitorWorker(node) { + if (node.kind === 241 /* ExportDeclaration */ || + node.kind === 235 /* ImportDeclaration */ || + node.kind === 236 /* ImportClause */ || + (node.kind === 234 /* ImportEqualsDeclaration */ && + node.moduleReference.kind === 245 /* ExternalModuleReference */)) { + // do not emit ES6 imports and exports since they are illegal inside a namespace + return undefined; + } + else if (node.transformFlags & 1 /* TypeScript */ || ts.hasModifier(node, 1 /* Export */)) { + // This node is explicitly marked as TypeScript, or is exported at the namespace + // level, so we should transform the node. + return visitTypeScript(node); + } + else if (node.transformFlags & 2 /* ContainsTypeScript */) { + // This node contains TypeScript, so we should visit its children. + return ts.visitEachChild(node, visitor, context); + } + return node; + } + /** + * Specialized visitor that visits the immediate children of a class with TypeScript syntax. + * + * @param node The node to visit. + */ + function classElementVisitor(node) { + return saveStateAndInvoke(node, classElementVisitorWorker); + } + /** + * Specialized visitor that visits the immediate children of a class with TypeScript syntax. + * + * @param node The node to visit. + */ + function classElementVisitorWorker(node) { + switch (node.kind) { + case 150 /* Constructor */: + // TypeScript constructors are transformed in `visitClassDeclaration`. + // We elide them here as `visitorWorker` checks transform flags, which could + // erronously include an ES6 constructor without TypeScript syntax. + return undefined; + case 147 /* PropertyDeclaration */: + case 155 /* IndexSignature */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + case 149 /* MethodDeclaration */: + // Fallback to the default visit behavior. + return visitorWorker(node); + case 203 /* SemicolonClassElement */: + return node; + default: + ts.Debug.failBadSyntaxKind(node); + return undefined; + } + } + function modifierVisitor(node) { + if (ts.modifierToFlag(node.kind) & 2270 /* TypeScriptModifier */) { + return undefined; + } + else if (currentNamespace && node.kind === 83 /* ExportKeyword */) { + return undefined; + } + return node; + } + /** + * Branching visitor, visits a TypeScript syntax node. + * + * @param node The node to visit. + */ + function visitTypeScript(node) { + if (ts.hasModifier(node, 2 /* Ambient */) && ts.isStatement(node)) { + // TypeScript ambient declarations are elided, but some comments may be preserved. + // See the implementation of `getLeadingComments` in comments.ts for more details. + return ts.createNotEmittedStatement(node); + } + switch (node.kind) { + case 83 /* ExportKeyword */: + case 78 /* DefaultKeyword */: + // ES6 export and default modifiers are elided when inside a namespace. + return currentNamespace ? undefined : node; + case 113 /* PublicKeyword */: + case 111 /* PrivateKeyword */: + case 112 /* ProtectedKeyword */: + case 116 /* AbstractKeyword */: + case 75 /* ConstKeyword */: + case 123 /* DeclareKeyword */: + case 130 /* ReadonlyKeyword */: + // TypeScript accessibility and readonly modifiers are elided. + case 162 /* ArrayType */: + case 163 /* TupleType */: + case 161 /* TypeLiteral */: + case 156 /* TypePredicate */: + case 143 /* TypeParameter */: + case 118 /* AnyKeyword */: + case 121 /* BooleanKeyword */: + case 134 /* StringKeyword */: + case 132 /* NumberKeyword */: + case 129 /* NeverKeyword */: + case 104 /* VoidKeyword */: + case 135 /* SymbolKeyword */: + case 159 /* ConstructorType */: + case 158 /* FunctionType */: + case 160 /* TypeQuery */: + case 157 /* TypeReference */: + case 164 /* UnionType */: + case 165 /* IntersectionType */: + case 166 /* ParenthesizedType */: + case 167 /* ThisType */: + case 168 /* TypeOperator */: + case 169 /* IndexedAccessType */: + case 170 /* MappedType */: + case 171 /* LiteralType */: + // TypeScript type nodes are elided. + case 155 /* IndexSignature */: + // TypeScript index signatures are elided. + case 145 /* Decorator */: + // TypeScript decorators are elided. They will be emitted as part of visitClassDeclaration. + case 228 /* TypeAliasDeclaration */: + // TypeScript type-only declarations are elided. + case 147 /* PropertyDeclaration */: + // TypeScript property declarations are elided. + return undefined; + case 150 /* Constructor */: + return visitConstructor(node); + case 227 /* InterfaceDeclaration */: + // TypeScript interfaces are elided, but some comments may be preserved. + // See the implementation of `getLeadingComments` in comments.ts for more details. + return ts.createNotEmittedStatement(node); + case 226 /* ClassDeclaration */: + // This is a class declaration with TypeScript syntax extensions. + // + // TypeScript class syntax extensions include: + // - decorators + // - optional `implements` heritage clause + // - parameter property assignments in the constructor + // - property declarations + // - index signatures + // - method overload signatures + return visitClassDeclaration(node); + case 197 /* ClassExpression */: + // This is a class expression with TypeScript syntax extensions. + // + // TypeScript class syntax extensions include: + // - decorators + // - optional `implements` heritage clause + // - parameter property assignments in the constructor + // - property declarations + // - index signatures + // - method overload signatures + return visitClassExpression(node); + case 255 /* HeritageClause */: + // This is a heritage clause with TypeScript syntax extensions. + // + // TypeScript heritage clause extensions include: + // - `implements` clause + return visitHeritageClause(node); + case 199 /* ExpressionWithTypeArguments */: + // TypeScript supports type arguments on an expression in an `extends` heritage clause. + return visitExpressionWithTypeArguments(node); + case 149 /* MethodDeclaration */: + // TypeScript method declarations may have decorators, modifiers + // or type annotations. + return visitMethodDeclaration(node); + case 151 /* GetAccessor */: + // Get Accessors can have TypeScript modifiers, decorators, and type annotations. + return visitGetAccessor(node); + case 152 /* SetAccessor */: + // Set Accessors can have TypeScript modifiers and type annotations. + return visitSetAccessor(node); + case 225 /* FunctionDeclaration */: + // Typescript function declarations can have modifiers, decorators, and type annotations. + return visitFunctionDeclaration(node); + case 184 /* FunctionExpression */: + // TypeScript function expressions can have modifiers and type annotations. + return visitFunctionExpression(node); + case 185 /* ArrowFunction */: + // TypeScript arrow functions can have modifiers and type annotations. + return visitArrowFunction(node); + case 144 /* Parameter */: + // This is a parameter declaration with TypeScript syntax extensions. + // + // TypeScript parameter declaration syntax extensions include: + // - decorators + // - accessibility modifiers + // - the question mark (?) token for optional parameters + // - type annotations + // - this parameters + return visitParameter(node); + case 183 /* ParenthesizedExpression */: + // ParenthesizedExpressions are TypeScript if their expression is a + // TypeAssertion or AsExpression + return visitParenthesizedExpression(node); + case 182 /* TypeAssertionExpression */: + case 200 /* AsExpression */: + // TypeScript type assertions are removed, but their subtrees are preserved. + return visitAssertionExpression(node); + case 179 /* CallExpression */: + return visitCallExpression(node); + case 180 /* NewExpression */: + return visitNewExpression(node); + case 201 /* NonNullExpression */: + // TypeScript non-null expressions are removed, but their subtrees are preserved. + return visitNonNullExpression(node); + case 229 /* EnumDeclaration */: + // TypeScript enum declarations do not exist in ES6 and must be rewritten. + return visitEnumDeclaration(node); + case 205 /* VariableStatement */: + // TypeScript namespace exports for variable statements must be transformed. + return visitVariableStatement(node); + case 223 /* VariableDeclaration */: + return visitVariableDeclaration(node); + case 230 /* ModuleDeclaration */: + // TypeScript namespace declarations must be transformed. + return visitModuleDeclaration(node); + case 234 /* ImportEqualsDeclaration */: + // TypeScript namespace or external module import. + return visitImportEqualsDeclaration(node); + default: + ts.Debug.failBadSyntaxKind(node); + return ts.visitEachChild(node, visitor, context); + } + } + function visitSourceFile(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. + */ + function shouldEmitDecorateCallForClass(node) { + if (node.decorators && node.decorators.length > 0) { + return true; + } + var constructor = ts.getFirstConstructorWithBody(node); + if (constructor) { + return ts.forEach(constructor.parameters, shouldEmitDecorateCallForParameter); + } + return false; + } + /** + * Tests whether we should emit a __decorate call for a parameter declaration. + */ + function shouldEmitDecorateCallForParameter(parameter) { + return parameter.decorators !== undefined && parameter.decorators.length > 0; + } + /** + * Transforms a class declaration with TypeScript syntax into compatible ES6. + * + * This function will only be called when one of the following conditions are met: + * - The class has decorators. + * - The class has property declarations with initializers. + * - The class contains a constructor that contains parameters with accessibility modifiers. + * - The class is an export in a TypeScript namespace. + * + * @param node The node to transform. + */ + function visitClassDeclaration(node) { + var staticProperties = getInitializedProperties(node, /*isStatic*/ true); + var hasExtendsClause = ts.getClassExtendsHeritageClauseElement(node) !== undefined; + var isDecoratedClass = shouldEmitDecorateCallForClass(node); + // emit name if + // - node has a name + // - node has static initializers + // + var name = node.name; + if (!name && staticProperties.length > 0) { + name = ts.getGeneratedNameForNode(node); + } + var classStatement = isDecoratedClass + ? createClassDeclarationHeadWithDecorators(node, name, hasExtendsClause) + : createClassDeclarationHeadWithoutDecorators(node, name, hasExtendsClause, staticProperties.length > 0); + var statements = [classStatement]; + // Emit static property assignment. Because classDeclaration is lexically evaluated, + // it is safe to emit static property assignment after classDeclaration + // From ES6 specification: + // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using + // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. + if (staticProperties.length) { + addInitializedPropertyStatements(statements, staticProperties, ts.getLocalName(node)); + } + // Write any decorators of the node. + addClassElementDecorationStatements(statements, node, /*isStatic*/ false); + addClassElementDecorationStatements(statements, node, /*isStatic*/ true); + addConstructorDecorationStatement(statements, node); + // If the class is exported as part of a TypeScript namespace, emit the namespace export. + // Otherwise, if the class was exported at the top level and was decorated, emit an export + // declaration or export default for the class. + if (isNamespaceExport(node)) { + addExportMemberAssignment(statements, node); + } + else if (isDecoratedClass) { + if (isDefaultExternalModuleExport(node)) { + statements.push(ts.createExportDefault(ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true))); + } + else if (isNamedExternalModuleExport(node)) { + statements.push(ts.createExternalModuleExport(ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true))); + } + } + 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) | 2097152 /* HasEndOfDeclarationMarker */); + } + return ts.singleOrMany(statements); + } + /** + * Transforms a non-decorated class declaration and appends the resulting statements. + * + * @param node A ClassDeclaration node. + * @param name The name of the class. + * @param hasExtendsClause A value indicating whether the class has an extends clause. + * @param hasStaticProperties A value indicating whether the class has static properties. + */ + function createClassDeclarationHeadWithoutDecorators(node, name, hasExtendsClause, hasStaticProperties) { + // ${modifiers} class ${name} ${heritageClauses} { + // ${members} + // } + var classDeclaration = ts.createClassDeclaration( + /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), name, + /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, hasExtendsClause), node); + var emitFlags = ts.getEmitFlags(node); + // 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 |= 32 /* NoTrailingSourceMap */; + } + ts.setOriginalNode(classDeclaration, node); + ts.setEmitFlags(classDeclaration, emitFlags); + return classDeclaration; + } + /** + * Transforms a decorated class declaration and appends the resulting statements. If + * the class requires an alias to avoid issues with double-binding, the alias is returned. + * + * @param statements A statement list to which to add the declaration. + * @param node A ClassDeclaration node. + * @param name The name of the class. + * @param hasExtendsClause A value indicating whether the class has an extends clause. + */ + function createClassDeclarationHeadWithDecorators(node, name, hasExtendsClause) { + // When we emit an ES6 class that has a class decorator, we must tailor the + // emit to certain specific cases. + // + // In the simplest case, we emit the class declaration as a let declaration, and + // evaluate decorators after the close of the class body: + // + // [Example 1] + // --------------------------------------------------------------------- + // TypeScript | Javascript + // --------------------------------------------------------------------- + // @dec | let C = class C { + // class C { | } + // } | C = __decorate([dec], C); + // --------------------------------------------------------------------- + // @dec | let C = class C { + // export class C { | } + // } | C = __decorate([dec], C); + // | export { C }; + // --------------------------------------------------------------------- + // + // If a class declaration contains a reference to itself *inside* of the class body, + // this introduces two bindings to the class: One outside of the class body, and one + // inside of the class body. If we apply decorators as in [Example 1] above, there + // is the possibility that the decorator `dec` will return a new value for the + // constructor, which would result in the binding inside of the class no longer + // pointing to the same reference as the binding outside of the class. + // + // As a result, we must instead rewrite all references to the class *inside* of the + // class body to instead point to a local temporary alias for the class: + // + // [Example 2] + // --------------------------------------------------------------------- + // TypeScript | Javascript + // --------------------------------------------------------------------- + // @dec | let C = C_1 = class C { + // class C { | static x() { return C_1.y; } + // static x() { return C.y; } | } + // static y = 1; | C.y = 1; + // } | C = C_1 = __decorate([dec], C); + // | var C_1; + // --------------------------------------------------------------------- + // @dec | let C = class C { + // export class C { | static x() { return C_1.y; } + // static x() { return C.y; } | } + // static y = 1; | C.y = 1; + // } | C = C_1 = __decorate([dec], C); + // | export { C }; + // | var C_1; + // --------------------------------------------------------------------- + // + // If a class declaration is the default export of a module, we instead emit + // the export after the decorated declaration: + // + // [Example 3] + // --------------------------------------------------------------------- + // TypeScript | Javascript + // --------------------------------------------------------------------- + // @dec | let default_1 = class { + // export default class { | } + // } | default_1 = __decorate([dec], default_1); + // | export default default_1; + // --------------------------------------------------------------------- + // @dec | let C = class C { + // export default class C { | } + // } | C = __decorate([dec], C); + // | export default C; + // --------------------------------------------------------------------- + // + // If the class declaration is the default export and a reference to itself + // inside of the class body, we must emit both an alias for the class *and* + // move the export after the declaration: + // + // [Example 4] + // --------------------------------------------------------------------- + // TypeScript | Javascript + // --------------------------------------------------------------------- + // @dec | let C = class C { + // export default class C { | static x() { return C_1.y; } + // static x() { return C.y; } | } + // static y = 1; | C.y = 1; + // } | C = C_1 = __decorate([dec], C); + // | export default C; + // | var C_1; + // --------------------------------------------------------------------- + // + var location = ts.moveRangePastDecorators(node); + var classAlias = getClassAliasIfNeeded(node); + var declName = ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true); + // ... = class ${name} ${heritageClauses} { + // ${members} + // } + var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause); + var members = transformClassMembers(node, hasExtendsClause); + var classExpression = ts.createClassExpression(/*modifiers*/ undefined, name, /*typeParameters*/ undefined, heritageClauses, members, location); + ts.setOriginalNode(classExpression, node); + // let ${name} = ${classExpression} where name is either declaredName if the class doesn't contain self-reference + // or decoratedClassAlias if the class contain self-reference. + var statement = ts.createLetStatement(declName, classAlias ? ts.createAssignment(classAlias, classExpression) : classExpression, location); + ts.setOriginalNode(statement, node); + ts.setCommentRange(statement, node); + return statement; + } + /** + * Transforms a class expression with TypeScript syntax into compatible ES6. + * + * This function will only be called when one of the following conditions are met: + * - The class has property declarations with initializers. + * - The class contains a constructor that contains parameters with accessibility modifiers. + * + * @param node The node to transform. + */ + function visitClassExpression(node) { + var staticProperties = getInitializedProperties(node, /*isStatic*/ true); + var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause); + var members = transformClassMembers(node, ts.some(heritageClauses, function (c) { return c.token === 84 /* ExtendsKeyword */; })); + var classExpression = ts.setOriginalNode(ts.createClassExpression( + /*modifiers*/ undefined, node.name, + /*typeParameters*/ undefined, heritageClauses, members, + /*location*/ node), node); + if (staticProperties.length > 0) { + var expressions = []; + var temp = ts.createTempVariable(hoistVariableDeclaration); + if (resolver.getNodeCheckFlags(node) & 8388608 /* ClassWithConstructorReference */) { + // record an alias as the class name is not in scope for statics. + enableSubstitutionForClassAliases(); + classAliases[ts.getOriginalNodeId(node)] = ts.getSynthesizedClone(temp); + } + // To preserve the behavior of the old emitter, we explicitly indent + // the body of a class with static initializers. + 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)); + return ts.inlineExpressions(expressions); + } + return classExpression; + } + /** + * Transforms the members of a class. + * + * @param node The current class. + * @param hasExtendsClause A value indicating whether the class has an extends clause. + */ + function transformClassMembers(node, hasExtendsClause) { + var members = []; + var constructor = transformConstructor(node, hasExtendsClause); + if (constructor) { + members.push(constructor); + } + ts.addRange(members, ts.visitNodes(node.members, classElementVisitor, ts.isClassElement)); + return ts.createNodeArray(members, /*location*/ node.members); + } + /** + * Transforms (or creates) a constructor for a class. + * + * @param node The current class. + * @param hasExtendsClause A value indicating whether the class has an extends clause. + */ + function transformConstructor(node, hasExtendsClause) { + // Check if we have property assignment inside class declaration. + // 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 & 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. + if (!hasInstancePropertyWithInitializer && !hasParameterPropertyAssignments) { + return ts.visitEachChild(constructor, visitor, context); + } + var parameters = transformConstructorParameters(constructor); + var body = transformConstructorBody(node, constructor, hasExtendsClause); + // constructor(${parameters}) { + // ${body} + // } + return ts.startOnNewLine(ts.setOriginalNode(ts.createConstructor( + /*decorators*/ undefined, + /*modifiers*/ undefined, parameters, body, + /*location*/ constructor || node), constructor)); + } + /** + * Transforms (or creates) the parameters for the constructor of a class with + * parameter property assignments or instance property initializers. + * + * @param constructor The constructor declaration. + * @param hasExtendsClause A value indicating whether the class has an extends clause. + */ + function transformConstructorParameters(constructor) { + // The ES2015 spec specifies in 14.5.14. Runtime Semantics: ClassDefinitionEvaluation: + // If constructor is empty, then + // If ClassHeritag_eopt is present and protoParent is not null, then + // Let constructor be the result of parsing the source text + // constructor(...args) { super (...args);} + // using the syntactic grammar with the goal symbol MethodDefinition[~Yield]. + // Else, + // Let constructor be the result of parsing the source text + // constructor( ){ } + // using the syntactic grammar with the goal symbol MethodDefinition[~Yield]. + // + // While we could emit the '...args' rest parameter, certain later tools in the pipeline might + // 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 ts.visitParameterList(constructor && constructor.parameters, visitor, context) + || []; + } + /** + * Transforms (or creates) a constructor body for a class with parameter property + * assignments or instance property initializers. + * + * @param node The current class. + * @param constructor The current class constructor. + * @param hasExtendsClause A value indicating whether the class has an extends clause. + */ + function transformConstructorBody(node, constructor, hasExtendsClause) { + var statements = []; + var indexOfFirstStatement = 0; + resumeLexicalEnvironment(); + if (constructor) { + indexOfFirstStatement = addPrologueDirectivesAndInitialSuperCall(constructor, statements); + // Add parameters with property assignments. Transforms this: + // + // constructor (public x, public y) { + // } + // + // Into this: + // + // constructor (x, y) { + // this.x = x; + // this.y = y; + // } + // + var propertyAssignments = getParametersWithPropertyAssignments(constructor); + ts.addRange(statements, ts.map(propertyAssignments, transformParameterWithPropertyAssignment)); + } + else if (hasExtendsClause) { + // Add a synthetic `super` call: + // + // super(...arguments); + // + statements.push(ts.createStatement(ts.createCall(ts.createSuper(), + /*typeArguments*/ undefined, [ts.createSpread(ts.createIdentifier("arguments"))]))); + } + // Add the property initializers. Transforms this: + // + // public x = 1; + // + // Into this: + // + // constructor() { + // this.x = 1; + // } + // + var properties = getInitializedProperties(node, /*isStatic*/ false); + addInitializedPropertyStatements(statements, properties, ts.createThis()); + if (constructor) { + // The class already had a constructor, so we should add the existing statements, skipping the initial super call. + ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatement)); + } + // End the lexical environment. + ts.addRange(statements, endLexicalEnvironment()); + return ts.createBlock(ts.createNodeArray(statements, + /*location*/ constructor ? constructor.body.statements : node.members), + /*location*/ constructor ? constructor.body : undefined, + /*multiLine*/ true); + } + /** + * Adds super call and preceding prologue directives into the list of statements. + * + * @param ctor The constructor node. + * @returns index of the statement that follows super call + */ + function addPrologueDirectivesAndInitialSuperCall(ctor, result) { + if (ctor.body) { + var statements = ctor.body.statements; + // add prologue directives to the list (if any) + var index = ts.addPrologueDirectives(result, statements, /*ensureUseStrict*/ false, visitor); + if (index === statements.length) { + // list contains nothing but prologue directives (or empty) - exit + return index; + } + var statement = statements[index]; + if (statement.kind === 207 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) { + result.push(ts.visitNode(statement, visitor, ts.isStatement)); + return index + 1; + } + return index; + } + return 0; + } + /** + * Gets all parameters of a constructor that should be transformed into property assignments. + * + * @param node The constructor node. + */ + function getParametersWithPropertyAssignments(node) { + return ts.filter(node.parameters, isParameterWithPropertyAssignment); + } + /** + * Determines whether a parameter should be transformed into a property assignment. + * + * @param parameter The parameter node. + */ + function isParameterWithPropertyAssignment(parameter) { + return ts.hasModifier(parameter, 92 /* ParameterPropertyModifier */) + && ts.isIdentifier(parameter.name); + } + /** + * Transforms a parameter into a property assignment statement. + * + * @param node The parameter declaration. + */ + function transformParameterWithPropertyAssignment(node) { + ts.Debug.assert(ts.isIdentifier(node.name)); + var name = node.name; + var propertyName = ts.getMutableClone(name); + ts.setEmitFlags(propertyName, 1536 /* NoComments */ | 48 /* NoSourceMap */); + var localName = ts.getMutableClone(name); + 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))); + } + /** + * Gets all property declarations with initializers on either the static or instance side of a class. + * + * @param node The class node. + * @param isStatic A value indicating whether to get properties from the static or instance side of the class. + */ + function getInitializedProperties(node, isStatic) { + return ts.filter(node.members, isStatic ? isStaticInitializedProperty : isInstanceInitializedProperty); + } + /** + * Gets a value indicating whether a class element is a static property declaration with an initializer. + * + * @param member The class element node. + */ + function isStaticInitializedProperty(member) { + return isInitializedProperty(member, /*isStatic*/ true); + } + /** + * Gets a value indicating whether a class element is an instance property declaration with an initializer. + * + * @param member The class element node. + */ + function isInstanceInitializedProperty(member) { + return isInitializedProperty(member, /*isStatic*/ false); + } + /** + * Gets a value indicating whether a class element is either a static or an instance property declaration with an initializer. + * + * @param member The class element node. + * @param isStatic A value indicating whether the member should be a static or instance member. + */ + function isInitializedProperty(member, isStatic) { + return member.kind === 147 /* PropertyDeclaration */ + && isStatic === ts.hasModifier(member, 32 /* Static */) + && member.initializer !== undefined; + } + /** + * Generates assignment statements for property initializers. + * + * @param properties An array of property declarations to transform. + * @param receiver The receiver on which each property should be assigned. + */ + function addInitializedPropertyStatements(statements, properties, receiver) { + for (var _i = 0, properties_8 = properties; _i < properties_8.length; _i++) { + var property = properties_8[_i]; + var statement = ts.createStatement(transformInitializedProperty(property, receiver)); + ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property)); + ts.setCommentRange(statement, property); + statements.push(statement); + } + } + /** + * Generates assignment expressions for property initializers. + * + * @param properties An array of property declarations to transform. + * @param receiver The receiver on which each property should be assigned. + */ + function generateInitializedPropertyExpressions(properties, receiver) { + var expressions = []; + for (var _i = 0, properties_9 = properties; _i < properties_9.length; _i++) { + var property = properties_9[_i]; + var expression = transformInitializedProperty(property, receiver); + expression.startsOnNewLine = true; + ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property)); + ts.setCommentRange(expression, property); + expressions.push(expression); + } + return expressions; + } + /** + * Transforms a property initializer into an assignment statement. + * + * @param property The property declaration. + * @param receiver The object receiving the property assignment. + */ + function transformInitializedProperty(property, receiver) { + var propertyName = visitPropertyNameOfClassElement(property); + var initializer = ts.visitNode(property.initializer, visitor, ts.isExpression); + var memberAccess = ts.createMemberAccessForPropertyName(receiver, propertyName, /*location*/ propertyName); + return ts.createAssignment(memberAccess, initializer); + } + /** + * Gets either the static or instance members of a class that are decorated, or have + * parameters that are decorated. + * + * @param node The class containing the member. + * @param isStatic A value indicating whether to retrieve static or instance members of + * the class. + */ + function getDecoratedClassElements(node, isStatic) { + return ts.filter(node.members, isStatic ? isStaticDecoratedClassElement : isInstanceDecoratedClassElement); + } + /** + * Determines whether a class member is a static member of a class that is decorated, or + * has parameters that are decorated. + * + * @param member The class member. + */ + function isStaticDecoratedClassElement(member) { + return isDecoratedClassElement(member, /*isStatic*/ true); + } + /** + * Determines whether a class member is an instance member of a class that is decorated, + * or has parameters that are decorated. + * + * @param member The class member. + */ + function isInstanceDecoratedClassElement(member) { + return isDecoratedClassElement(member, /*isStatic*/ false); + } + /** + * Determines whether a class member is either a static or an instance member of a class + * that is decorated, or has parameters that are decorated. + * + * @param member The class member. + */ + function isDecoratedClassElement(member, isStatic) { + return ts.nodeOrChildIsDecorated(member) + && isStatic === ts.hasModifier(member, 32 /* Static */); + } + /** + * Gets an array of arrays of decorators for the parameters of a function-like node. + * The offset into the result array should correspond to the offset of the parameter. + * + * @param node The function-like node. + */ + function getDecoratorsOfParameters(node) { + var decorators; + if (node) { + var parameters = node.parameters; + for (var i = 0; i < parameters.length; i++) { + var parameter = parameters[i]; + if (decorators || parameter.decorators) { + if (!decorators) { + decorators = new Array(parameters.length); + } + decorators[i] = parameter.decorators; + } + } + } + return decorators; + } + /** + * Gets an AllDecorators object containing the decorators for the class and the decorators for the + * parameters of the constructor of the class. + * + * @param node The class node. + */ + function getAllDecoratorsOfConstructor(node) { + var decorators = node.decorators; + var parameters = getDecoratorsOfParameters(ts.getFirstConstructorWithBody(node)); + if (!decorators && !parameters) { + return undefined; + } + return { + decorators: decorators, + parameters: parameters + }; + } + /** + * Gets an AllDecorators object containing the decorators for the member and its parameters. + * + * @param node The class node that contains the member. + * @param member The class member. + */ + function getAllDecoratorsOfClassElement(node, member) { + switch (member.kind) { + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + return getAllDecoratorsOfAccessors(node, member); + case 149 /* MethodDeclaration */: + return getAllDecoratorsOfMethod(member); + case 147 /* PropertyDeclaration */: + return getAllDecoratorsOfProperty(member); + default: + return undefined; + } + } + /** + * Gets an AllDecorators object containing the decorators for the accessor and its parameters. + * + * @param node The class node that contains the accessor. + * @param accessor The class accessor member. + */ + function getAllDecoratorsOfAccessors(node, accessor) { + if (!accessor.body) { + return undefined; + } + var _a = ts.getAllAccessorDeclarations(node.members, accessor), firstAccessor = _a.firstAccessor, secondAccessor = _a.secondAccessor, setAccessor = _a.setAccessor; + var firstAccessorWithDecorators = firstAccessor.decorators ? firstAccessor : secondAccessor && secondAccessor.decorators ? secondAccessor : undefined; + if (!firstAccessorWithDecorators || accessor !== firstAccessorWithDecorators) { + return undefined; + } + var decorators = firstAccessorWithDecorators.decorators; + var parameters = getDecoratorsOfParameters(setAccessor); + if (!decorators && !parameters) { + return undefined; + } + return { decorators: decorators, parameters: parameters }; + } + /** + * Gets an AllDecorators object containing the decorators for the method and its parameters. + * + * @param method The class method member. + */ + function getAllDecoratorsOfMethod(method) { + if (!method.body) { + return undefined; + } + var decorators = method.decorators; + var parameters = getDecoratorsOfParameters(method); + if (!decorators && !parameters) { + return undefined; + } + return { decorators: decorators, parameters: parameters }; + } + /** + * Gets an AllDecorators object containing the decorators for the property. + * + * @param property The class property member. + */ + function getAllDecoratorsOfProperty(property) { + var decorators = property.decorators; + if (!decorators) { + return undefined; + } + return { decorators: decorators }; + } + /** + * Transforms all of the decorators for a declaration into an array of expressions. + * + * @param node The declaration node. + * @param allDecorators An object containing all of the decorators for the declaration. + */ + function transformAllDecoratorsOfDeclaration(node, container, allDecorators) { + if (!allDecorators) { + return undefined; + } + var decoratorExpressions = []; + ts.addRange(decoratorExpressions, ts.map(allDecorators.decorators, transformDecorator)); + ts.addRange(decoratorExpressions, ts.flatMap(allDecorators.parameters, transformDecoratorsOfParameter)); + addTypeMetadata(node, container, decoratorExpressions); + return decoratorExpressions; + } + /** + * Generates statements used to apply decorators to either the static or instance members + * of a class. + * + * @param node The class node. + * @param isStatic A value indicating whether to generate statements for static or + * instance members. + */ + function addClassElementDecorationStatements(statements, node, isStatic) { + ts.addRange(statements, ts.map(generateClassElementDecorationExpressions(node, isStatic), expressionToStatement)); + } + /** + * Generates expressions used to apply decorators to either the static or instance members + * of a class. + * + * @param node The class node. + * @param isStatic A value indicating whether to generate expressions for static or + * instance members. + */ + function generateClassElementDecorationExpressions(node, isStatic) { + var members = getDecoratedClassElements(node, isStatic); + var expressions; + for (var _i = 0, members_2 = members; _i < members_2.length; _i++) { + var member = members_2[_i]; + var expression = generateClassElementDecorationExpression(node, member); + if (expression) { + if (!expressions) { + expressions = [expression]; + } + else { + expressions.push(expression); + } + } + } + return expressions; + } + /** + * Generates an expression used to evaluate class element decorators at runtime. + * + * @param node The class node that contains the member. + * @param member The class member. + */ + function generateClassElementDecorationExpression(node, member) { + var allDecorators = getAllDecoratorsOfClassElement(node, member); + var decoratorExpressions = transformAllDecoratorsOfDeclaration(member, node, allDecorators); + if (!decoratorExpressions) { + return undefined; + } + // Emit the call to __decorate. Given the following: + // + // class C { + // @dec method(@dec2 x) {} + // @dec get accessor() {} + // @dec prop; + // } + // + // The emit for a method is: + // + // __decorate([ + // dec, + // __param(0, dec2), + // __metadata("design:type", Function), + // __metadata("design:paramtypes", [Object]), + // __metadata("design:returntype", void 0) + // ], C.prototype, "method", null); + // + // The emit for an accessor is: + // + // __decorate([ + // dec + // ], C.prototype, "accessor", null); + // + // The emit for a property is: + // + // __decorate([ + // dec + // ], C.prototype, "prop"); + // + var prefix = getClassMemberPrefix(node, member); + var memberName = getExpressionForPropertyName(member, /*generateNameForComputedPropertyName*/ true); + var descriptor = languageVersion > 0 /* ES3 */ + ? member.kind === 147 /* PropertyDeclaration */ + ? ts.createVoidZero() + : ts.createNull() + : undefined; + var helper = createDecorateHelper(context, decoratorExpressions, prefix, memberName, descriptor, ts.moveRangePastDecorators(member)); + ts.setEmitFlags(helper, 1536 /* NoComments */); + return helper; + } + /** + * Generates a __decorate helper call for a class constructor. + * + * @param node The class node. + */ + function addConstructorDecorationStatement(statements, node) { + var expression = generateConstructorDecorationExpression(node); + if (expression) { + statements.push(ts.setOriginalNode(ts.createStatement(expression), node)); + } + } + /** + * Generates a __decorate helper call for a class constructor. + * + * @param node The class node. + */ + function generateConstructorDecorationExpression(node) { + var allDecorators = getAllDecoratorsOfConstructor(node); + var decoratorExpressions = transformAllDecoratorsOfDeclaration(node, node, allDecorators); + if (!decoratorExpressions) { + return undefined; + } + var classAlias = classAliases && classAliases[ts.getOriginalNodeId(node)]; + var localName = ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true); + var decorate = createDecorateHelper(context, decoratorExpressions, localName); + var expression = ts.createAssignment(localName, classAlias ? ts.createAssignment(classAlias, decorate) : decorate); + ts.setEmitFlags(expression, 1536 /* NoComments */); + ts.setSourceMapRange(expression, ts.moveRangePastDecorators(node)); + return expression; + } + /** + * Transforms a decorator into an expression. + * + * @param decorator The decorator node. + */ + function transformDecorator(decorator) { + return ts.visitNode(decorator.expression, visitor, ts.isExpression); + } + /** + * Transforms the decorators of a parameter. + * + * @param decorators The decorators for the parameter at the provided offset. + * @param parameterOffset The offset of the parameter. + */ + function transformDecoratorsOfParameter(decorators, parameterOffset) { + var expressions; + if (decorators) { + expressions = []; + for (var _i = 0, decorators_1 = decorators; _i < decorators_1.length; _i++) { + var decorator = decorators_1[_i]; + var helper = createParamHelper(context, transformDecorator(decorator), parameterOffset, + /*location*/ decorator.expression); + ts.setEmitFlags(helper, 1536 /* NoComments */); + expressions.push(helper); + } + } + return expressions; + } + /** + * Adds optional type metadata for a declaration. + * + * @param node The declaration node. + * @param decoratorExpressions The destination array to which to add new decorator expressions. + */ + function addTypeMetadata(node, container, decoratorExpressions) { + if (USE_NEW_TYPE_METADATA_FORMAT) { + addNewTypeMetadata(node, container, decoratorExpressions); } else { - // Get the declaration file path - ts.forEachExpectedEmitFile(host, getDeclFileName, referencedFile); + addOldTypeMetadata(node, container, decoratorExpressions); } - if (declFileName) { - declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(declarationFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, - /*isAbsolutePathAnUrl*/ false); - referencesOutput += "/// " + newLine; - } - return addedBundledEmitReference; - function getDeclFileName(emitFileNames, sourceFiles, isBundledEmit) { - // Dont add reference path to this file if it is a bundled emit and caller asked not emit bundled file path - if (isBundledEmit && !addBundledFileReference) { - return; + } + function addOldTypeMetadata(node, container, decoratorExpressions) { + if (compilerOptions.emitDecoratorMetadata) { + if (shouldAddTypeMetadata(node)) { + decoratorExpressions.push(createMetadataHelper(context, "design:type", serializeTypeOfNode(node))); + } + if (shouldAddParamTypesMetadata(node)) { + decoratorExpressions.push(createMetadataHelper(context, "design:paramtypes", serializeParameterTypesOfNode(node, container))); + } + if (shouldAddReturnTypeMetadata(node)) { + decoratorExpressions.push(createMetadataHelper(context, "design:returntype", serializeReturnTypeOfNode(node))); } - ts.Debug.assert(!!emitFileNames.declarationFilePath || ts.isSourceFileJavaScript(referencedFile), "Declaration file is not present only for javascript files"); - declFileName = emitFileNames.declarationFilePath || emitFileNames.jsFilePath; - addedBundledEmitReference = isBundledEmit; } } - } - /* @internal */ - function writeDeclarationFile(declarationFilePath, sourceFiles, isBundledEmit, host, resolver, emitterDiagnostics) { - var emitDeclarationResult = emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit); - var emitSkipped = emitDeclarationResult.reportedDeclarationError || host.isEmitBlocked(declarationFilePath) || host.getCompilerOptions().noEmit; - if (!emitSkipped) { - var declarationOutput = emitDeclarationResult.referencesOutput - + getDeclarationOutput(emitDeclarationResult.synchronousDeclarationOutput, emitDeclarationResult.moduleElementDeclarationEmitInfo); - ts.writeFile(host, emitterDiagnostics, declarationFilePath, declarationOutput, host.getCompilerOptions().emitBOM, sourceFiles); - } - return emitSkipped; - function getDeclarationOutput(synchronousDeclarationOutput, moduleElementDeclarationEmitInfo) { - var appliedSyncOutputPos = 0; - var declarationOutput = ""; - // apply asynchronous additions to the synchronous output - ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { - if (aliasEmitInfo.asynchronousOutput) { - declarationOutput += synchronousDeclarationOutput.substring(appliedSyncOutputPos, aliasEmitInfo.outputPos); - declarationOutput += getDeclarationOutput(aliasEmitInfo.asynchronousOutput, aliasEmitInfo.subModuleElementDeclarationEmitInfo); - appliedSyncOutputPos = aliasEmitInfo.outputPos; + function addNewTypeMetadata(node, container, decoratorExpressions) { + if (compilerOptions.emitDecoratorMetadata) { + var properties = void 0; + if (shouldAddTypeMetadata(node)) { + (properties || (properties = [])).push(ts.createPropertyAssignment("type", ts.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, ts.createToken(35 /* EqualsGreaterThanToken */), serializeTypeOfNode(node)))); } - }); - declarationOutput += synchronousDeclarationOutput.substring(appliedSyncOutputPos); - return declarationOutput; + if (shouldAddParamTypesMetadata(node)) { + (properties || (properties = [])).push(ts.createPropertyAssignment("paramTypes", ts.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, ts.createToken(35 /* EqualsGreaterThanToken */), serializeParameterTypesOfNode(node, container)))); + } + if (shouldAddReturnTypeMetadata(node)) { + (properties || (properties = [])).push(ts.createPropertyAssignment("returnType", ts.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, ts.createToken(35 /* EqualsGreaterThanToken */), serializeReturnTypeOfNode(node)))); + } + if (properties) { + decoratorExpressions.push(createMetadataHelper(context, "design:typeinfo", ts.createObjectLiteral(properties, /*location*/ undefined, /*multiLine*/ true))); + } + } } - } - ts.writeDeclarationFile = writeDeclarationFile; -})(ts || (ts = {})); -/// -/// -/// -/* @internal */ -var ts; -(function (ts) { - function getResolvedExternalModuleName(host, file) { - return file.moduleName || ts.getExternalModuleNameFromPath(host, file.fileName); - } - ts.getResolvedExternalModuleName = getResolvedExternalModuleName; - function getExternalModuleNameFromDeclaration(host, resolver, declaration) { - var file = resolver.getExternalModuleFileFromDeclaration(declaration); - if (!file || ts.isDeclarationFile(file)) { + /** + * Determines whether to emit the "design:type" metadata based on the node's kind. + * The caller should have already tested whether the node has decorators and whether the + * emitDecoratorMetadata compiler option is set. + * + * @param node The node to test. + */ + function shouldAddTypeMetadata(node) { + var kind = node.kind; + return kind === 149 /* MethodDeclaration */ + || kind === 151 /* GetAccessor */ + || kind === 152 /* SetAccessor */ + || kind === 147 /* PropertyDeclaration */; + } + /** + * Determines whether to emit the "design:returntype" metadata based on the node's kind. + * The caller should have already tested whether the node has decorators and whether the + * emitDecoratorMetadata compiler option is set. + * + * @param node The node to test. + */ + function shouldAddReturnTypeMetadata(node) { + return node.kind === 149 /* MethodDeclaration */; + } + /** + * Determines whether to emit the "design:paramtypes" metadata based on the node's kind. + * The caller should have already tested whether the node has decorators and whether the + * emitDecoratorMetadata compiler option is set. + * + * @param node The node to test. + */ + function shouldAddParamTypesMetadata(node) { + switch (node.kind) { + case 226 /* ClassDeclaration */: + case 197 /* ClassExpression */: + return ts.getFirstConstructorWithBody(node) !== undefined; + case 149 /* MethodDeclaration */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + return true; + } + return false; + } + /** + * Serializes the type of a node for use with decorator type metadata. + * + * @param node The node that should have its type serialized. + */ + function serializeTypeOfNode(node) { + switch (node.kind) { + case 147 /* PropertyDeclaration */: + case 144 /* Parameter */: + case 151 /* GetAccessor */: + return serializeTypeNode(node.type); + case 152 /* SetAccessor */: + return serializeTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); + case 226 /* ClassDeclaration */: + case 197 /* ClassExpression */: + case 149 /* MethodDeclaration */: + return ts.createIdentifier("Function"); + default: + return ts.createVoidZero(); + } + } + /** + * Serializes the types of the parameters of a node for use with decorator type metadata. + * + * @param node The node that should have its parameter types serialized. + */ + function serializeParameterTypesOfNode(node, container) { + var valueDeclaration = ts.isClassLike(node) + ? ts.getFirstConstructorWithBody(node) + : ts.isFunctionLike(node) && ts.nodeIsPresent(node.body) + ? node + : undefined; + var expressions = []; + if (valueDeclaration) { + var parameters = getParametersOfDecoratedDeclaration(valueDeclaration, container); + var numParameters = parameters.length; + for (var i = 0; i < numParameters; i++) { + var parameter = parameters[i]; + if (i === 0 && ts.isIdentifier(parameter.name) && parameter.name.text === "this") { + continue; + } + if (parameter.dotDotDotToken) { + expressions.push(serializeTypeNode(ts.getRestParameterElementType(parameter.type))); + } + else { + expressions.push(serializeTypeOfNode(parameter)); + } + } + } + return ts.createArrayLiteral(expressions); + } + function getParametersOfDecoratedDeclaration(node, container) { + if (container && node.kind === 151 /* GetAccessor */) { + var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor; + if (setAccessor) { + return setAccessor.parameters; + } + } + return node.parameters; + } + /** + * Serializes the return type of a node for use with decorator type metadata. + * + * @param node The node that should have its return type serialized. + */ + function serializeReturnTypeOfNode(node) { + if (ts.isFunctionLike(node) && node.type) { + return serializeTypeNode(node.type); + } + else if (ts.isAsyncFunctionLike(node)) { + return ts.createIdentifier("Promise"); + } + return ts.createVoidZero(); + } + /** + * Serializes a type node for use with decorator type metadata. + * + * Types are serialized in the following fashion: + * - Void types point to "undefined" (e.g. "void 0") + * - Function and Constructor types point to the global "Function" constructor. + * - Interface types with a call or construct signature types point to the global + * "Function" constructor. + * - Array and Tuple types point to the global "Array" constructor. + * - Type predicates and booleans point to the global "Boolean" constructor. + * - String literal types and strings point to the global "String" constructor. + * - Enum and number types point to the global "Number" constructor. + * - Symbol types point to the global "Symbol" constructor. + * - Type references to classes (or class-like variables) point to the constructor for the class. + * - Anything else points to the global "Object" constructor. + * + * @param node The type node to serialize. + */ + function serializeTypeNode(node) { + if (node === undefined) { + return ts.createIdentifier("Object"); + } + switch (node.kind) { + case 104 /* VoidKeyword */: + case 137 /* UndefinedKeyword */: + case 94 /* NullKeyword */: + case 129 /* NeverKeyword */: + return ts.createVoidZero(); + case 166 /* ParenthesizedType */: + return serializeTypeNode(node.type); + case 158 /* FunctionType */: + case 159 /* ConstructorType */: + return ts.createIdentifier("Function"); + case 162 /* ArrayType */: + case 163 /* TupleType */: + return ts.createIdentifier("Array"); + case 156 /* TypePredicate */: + case 121 /* BooleanKeyword */: + return ts.createIdentifier("Boolean"); + case 134 /* StringKeyword */: + return ts.createIdentifier("String"); + case 171 /* LiteralType */: + switch (node.literal.kind) { + case 9 /* StringLiteral */: + return ts.createIdentifier("String"); + case 8 /* NumericLiteral */: + return ts.createIdentifier("Number"); + case 100 /* TrueKeyword */: + case 85 /* FalseKeyword */: + return ts.createIdentifier("Boolean"); + default: + ts.Debug.failBadSyntaxKind(node.literal); + break; + } + break; + case 132 /* NumberKeyword */: + return ts.createIdentifier("Number"); + case 135 /* SymbolKeyword */: + return languageVersion < 2 /* ES2015 */ + ? getGlobalSymbolNameWithFallback() + : ts.createIdentifier("Symbol"); + case 157 /* TypeReference */: + return serializeTypeReferenceNode(node); + case 165 /* IntersectionType */: + case 164 /* UnionType */: + return serializeUnionOrIntersectionType(node); + case 160 /* TypeQuery */: + case 168 /* TypeOperator */: + case 169 /* IndexedAccessType */: + case 170 /* MappedType */: + case 161 /* TypeLiteral */: + case 118 /* AnyKeyword */: + case 167 /* ThisType */: + break; + default: + ts.Debug.failBadSyntaxKind(node); + break; + } + return ts.createIdentifier("Object"); + } + function serializeUnionOrIntersectionType(node) { + var serializedUnion; + for (var _i = 0, _a = node.types; _i < _a.length; _i++) { + var typeNode = _a[_i]; + var serializedIndividual = serializeTypeNode(typeNode); + if (ts.isVoidExpression(serializedIndividual)) { + // If we dont have any other type already set, set the initial type + if (!serializedUnion) { + serializedUnion = serializedIndividual; + } + } + else if (ts.isIdentifier(serializedIndividual) && serializedIndividual.text === "Object") { + // One of the individual is global object, return immediately + return serializedIndividual; + } + else if (serializedUnion && !ts.isVoidExpression(serializedUnion)) { + // Different types + if (!ts.isIdentifier(serializedUnion) || + !ts.isIdentifier(serializedIndividual) || + serializedUnion.text !== serializedIndividual.text) { + return ts.createIdentifier("Object"); + } + } + else { + // Initialize the union type + serializedUnion = serializedIndividual; + } + } + // If we were able to find common type, use it + return serializedUnion; + } + /** + * Serializes a TypeReferenceNode to an appropriate JS constructor value for use with + * decorator type metadata. + * + * @param node The type reference node. + */ + function serializeTypeReferenceNode(node) { + switch (resolver.getTypeReferenceSerializationKind(node.typeName, currentScope)) { + case ts.TypeReferenceSerializationKind.Unknown: + var serialized = serializeEntityNameAsExpression(node.typeName, /*useFallback*/ true); + var temp = ts.createTempVariable(hoistVariableDeclaration); + 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: + return ts.createVoidZero(); + case ts.TypeReferenceSerializationKind.BooleanType: + return ts.createIdentifier("Boolean"); + case ts.TypeReferenceSerializationKind.NumberLikeType: + return ts.createIdentifier("Number"); + case ts.TypeReferenceSerializationKind.StringLikeType: + return ts.createIdentifier("String"); + case ts.TypeReferenceSerializationKind.ArrayLikeType: + return ts.createIdentifier("Array"); + case ts.TypeReferenceSerializationKind.ESSymbolType: + return languageVersion < 2 /* ES2015 */ + ? getGlobalSymbolNameWithFallback() + : ts.createIdentifier("Symbol"); + case ts.TypeReferenceSerializationKind.TypeWithCallSignature: + return ts.createIdentifier("Function"); + case ts.TypeReferenceSerializationKind.Promise: + return ts.createIdentifier("Promise"); + case ts.TypeReferenceSerializationKind.ObjectType: + default: + return ts.createIdentifier("Object"); + } + } + /** + * Serializes an entity name as an expression for decorator type metadata. + * + * @param node The entity name to serialize. + * @param useFallback A value indicating whether to use logical operators to test for the + * entity name at runtime. + */ + function serializeEntityNameAsExpression(node, useFallback) { + switch (node.kind) { + case 70 /* Identifier */: + // Create a clone of the name with a new parent, and treat it as if it were + // a source tree node for the purposes of the checker. + var name_32 = ts.getMutableClone(node); + name_32.flags &= ~8 /* Synthesized */; + name_32.original = undefined; + name_32.parent = currentScope; + if (useFallback) { + return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name_32), ts.createLiteral("undefined")), name_32); + } + return name_32; + case 141 /* QualifiedName */: + return serializeQualifiedNameAsExpression(node, useFallback); + } + } + /** + * Serializes an qualified name as an expression for decorator type metadata. + * + * @param node The qualified name to serialize. + * @param useFallback A value indicating whether to use logical operators to test for the + * qualified name at runtime. + */ + function serializeQualifiedNameAsExpression(node, useFallback) { + var left; + if (node.left.kind === 70 /* Identifier */) { + left = serializeEntityNameAsExpression(node.left, useFallback); + } + else if (useFallback) { + var temp = ts.createTempVariable(hoistVariableDeclaration); + left = ts.createLogicalAnd(ts.createAssignment(temp, serializeEntityNameAsExpression(node.left, /*useFallback*/ true)), temp); + } + else { + left = serializeEntityNameAsExpression(node.left, /*useFallback*/ false); + } + return ts.createPropertyAccess(left, node.right); + } + /** + * Gets an expression that points to the global "Symbol" constructor at runtime if it is + * available. + */ + function getGlobalSymbolNameWithFallback() { + 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 + * name is generated for the node. + * + * @param member The member whose name should be converted into an expression. + */ + function getExpressionForPropertyName(member, generateNameForComputedPropertyName) { + var name = member.name; + if (ts.isComputedPropertyName(name)) { + return generateNameForComputedPropertyName + ? ts.getGeneratedNameForNode(name) + : name.expression; + } + else if (ts.isIdentifier(name)) { + return ts.createLiteral(ts.unescapeIdentifier(name.text)); + } + else { + return ts.getSynthesizedClone(name); + } + } + /** + * Visits the property name of a class element, for use when emitting property + * initializers. For a computed property on a node with decorators, a temporary + * value is stored for later use. + * + * @param member The member whose name should be visited. + */ + function visitPropertyNameOfClassElement(member) { + var name = member.name; + if (ts.isComputedPropertyName(name)) { + var expression = ts.visitNode(name.expression, visitor, ts.isExpression); + if (member.decorators) { + var generatedName = ts.getGeneratedNameForNode(name); + hoistVariableDeclaration(generatedName); + expression = ts.createAssignment(generatedName, expression); + } + return ts.setOriginalNode(ts.createComputedPropertyName(expression, /*location*/ name), name); + } + else { + return name; + } + } + /** + * Transforms a HeritageClause with TypeScript syntax. + * + * This function will only be called when one of the following conditions are met: + * - The node is a non-`extends` heritage clause that should be elided. + * - The node is an `extends` heritage clause that should be visited, but only allow a single type. + * + * @param node The HeritageClause to transform. + */ + function visitHeritageClause(node) { + if (node.token === 84 /* ExtendsKeyword */) { + var types = ts.visitNodes(node.types, visitor, ts.isExpressionWithTypeArguments, 0, 1); + return ts.createHeritageClause(84 /* ExtendsKeyword */, types, node); + } return undefined; } - return getResolvedExternalModuleName(host, file); + /** + * Transforms an ExpressionWithTypeArguments with TypeScript syntax. + * + * This function will only be called when one of the following conditions are met: + * - The node contains type arguments that should be elided. + * + * @param node The ExpressionWithTypeArguments to transform. + */ + function visitExpressionWithTypeArguments(node) { + var expression = ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression); + return ts.createExpressionWithTypeArguments( + /*typeArguments*/ undefined, expression, node); + } + /** + * Determines whether to emit a function-like declaration. We should not emit the + * declaration if it does not have a body. + * + * @param node The declaration node. + */ + function shouldEmitFunctionLikeDeclaration(node) { + return !ts.nodeIsMissing(node.body); + } + function visitConstructor(node) { + if (!shouldEmitFunctionLikeDeclaration(node)) { + return undefined; + } + return ts.visitEachChild(node, visitor, context); + } + /** + * Visits a method declaration of a class. + * + * This function will be called when one of the following conditions are met: + * - The node is an overload + * - The node is marked as abstract, public, private, protected, or readonly + * - The node has both a decorator and a computed property name + * + * @param node The method node. + */ + function visitMethodDeclaration(node) { + if (!shouldEmitFunctionLikeDeclaration(node)) { + return undefined; + } + 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 + * declaration if it does not have a body and is abstract. + * + * @param node The declaration node. + */ + function shouldEmitAccessorDeclaration(node) { + return !(ts.nodeIsMissing(node.body) && ts.hasModifier(node, 128 /* Abstract */)); + } + /** + * Visits a get accessor declaration of a class. + * + * This function will be called when one of the following conditions are met: + * - The node is marked as abstract, public, private, or protected + * - The node has both a decorator and a computed property name + * + * @param node The get accessor node. + */ + function visitGetAccessor(node) { + if (!shouldEmitAccessorDeclaration(node)) { + return undefined; + } + 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. + * + * This function will be called when one of the following conditions are met: + * - The node is marked as abstract, public, private, or protected + * - The node has both a decorator and a computed property name + * + * @param node The set accessor node. + */ + function visitSetAccessor(node) { + if (!shouldEmitAccessorDeclaration(node)) { + return undefined; + } + 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. + * + * This function will be called when one of the following conditions are met: + * - The node is an overload + * - The node is exported from a TypeScript namespace + * - The node has decorators + * + * @param node The function node. + */ + function visitFunctionDeclaration(node) { + if (!shouldEmitFunctionLikeDeclaration(node)) { + return ts.createNotEmittedStatement(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 = [updated]; + addExportMemberAssignment(statements, node); + return statements; + } + return updated; + } + /** + * Visits a function expression node. + * + * This function will be called when one of the following conditions are met: + * - The node has type annotations + * + * @param node The function expression node. + */ + function visitFunctionExpression(node) { + if (ts.nodeIsMissing(node.body)) { + return ts.createOmittedExpression(); + } + 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 + * This function will be called when one of the following conditions are met: + * - The node has type annotations + */ + function visitArrowFunction(node) { + 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. + * + * This function will be called when one of the following conditions are met: + * - The node has an accessibility modifier. + * - The node has a questionToken. + * - The node's kind is ThisKeyword. + * + * @param node The parameter declaration node. + */ + function visitParameter(node) { + if (ts.parameterIsThisKeyword(node)) { + return undefined; + } + var parameter = ts.createParameter( + /*decorators*/ undefined, + /*modifiers*/ undefined, node.dotDotDotToken, ts.visitNode(node.name, visitor, ts.isBindingName), + /*questionToken*/ undefined, + /*type*/ undefined, ts.visitNode(node.initializer, visitor, ts.isExpression), + /*location*/ ts.moveRangePastModifiers(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(parameter, node); + ts.setCommentRange(parameter, node); + ts.setSourceMapRange(parameter, ts.moveRangePastModifiers(node)); + ts.setEmitFlags(parameter.name, 32 /* NoTrailingSourceMap */); + return parameter; + } + /** + * Visits a variable statement in a namespace. + * + * This function will be called when one of the following conditions are met: + * - The node is exported from a TypeScript namespace. + */ + function visitVariableStatement(node) { + if (isNamespaceExport(node)) { + var variables = ts.getInitializedVariables(node.declarationList); + if (variables.length === 0) { + // elide statement if there are no initialized variables. + return undefined; + } + return ts.createStatement(ts.inlineExpressions(ts.map(variables, transformInitializedVariable)), + /*location*/ node); + } + else { + return ts.visitEachChild(node, visitor, context); + } + } + function transformInitializedVariable(node) { + var name = node.name; + if (ts.isBindingPattern(name)) { + return ts.flattenDestructuringAssignment(node, visitor, context, 0 /* All */, + /*needsValue*/ false, createNamespaceExportExpression); + } + else { + return ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(name), ts.visitNode(node.initializer, visitor, ts.isExpression), + /*location*/ node); + } + } + function visitVariableDeclaration(node) { + return ts.updateVariableDeclaration(node, ts.visitNode(node.name, visitor, ts.isBindingName), + /*type*/ undefined, ts.visitNode(node.initializer, visitor, ts.isExpression)); + } + /** + * Visits a parenthesized expression that contains either a type assertion or an `as` + * expression. + * + * @param node The parenthesized expression node. + */ + function visitParenthesizedExpression(node) { + var innerExpression = ts.skipOuterExpressions(node.expression, ~2 /* Assertions */); + if (ts.isAssertionExpression(innerExpression)) { + // Make sure we consider all nested cast expressions, e.g.: + // (-A).x; + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + // We have an expression of the form: (SubExpr). Emitting this as (SubExpr) + // is really not desirable. We would like to emit the subexpression as-is. Omitting + // the parentheses, however, could cause change in the semantics of the generated + // code if the casted expression has a lower precedence than the rest of the + // expression. + // + // Due to the auto-parenthesization rules used by the visitor and factory functions + // we can safely elide the parentheses here, as a new synthetic + // ParenthesizedExpression will be inserted if we remove parentheses too + // aggressively. + // + // To preserve comments, we return a "PartiallyEmittedExpression" here which will + // preserve the position information of the original expression. + return ts.createPartiallyEmittedExpression(expression, node); + } + return ts.visitEachChild(node, visitor, context); + } + function visitAssertionExpression(node) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + return ts.createPartiallyEmittedExpression(expression, node); + } + function visitNonNullExpression(node) { + var expression = ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression); + return ts.createPartiallyEmittedExpression(expression, node); + } + function visitCallExpression(node) { + return ts.updateCall(node, ts.visitNode(node.expression, visitor, ts.isExpression), + /*typeArguments*/ undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression)); + } + function visitNewExpression(node) { + return ts.updateNew(node, ts.visitNode(node.expression, visitor, ts.isExpression), + /*typeArguments*/ undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression)); + } + /** + * Determines whether to emit an enum declaration. + * + * @param node The enum declaration node. + */ + function shouldEmitEnumDeclaration(node) { + return !ts.isConst(node) + || compilerOptions.preserveConstEnums + || compilerOptions.isolatedModules; + } + /** + * Visits an enum declaration. + * + * This function will be called any time a TypeScript enum is encountered. + * + * @param node The enum declaration node. + */ + function visitEnumDeclaration(node) { + if (!shouldEmitEnumDeclaration(node)) { + return undefined; + } + 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 = 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 |= 512 /* NoLeadingComments */; + } + } + // `parameterName` is the declaration name used inside of the enum. + var parameterName = getNamespaceParameterName(node); + // `containerName` is the expression used inside of the enum for assignments. + var containerName = getNamespaceContainerName(node); + // `exportName` is the expression used within this node's container for any exported references. + var exportName = ts.hasModifier(node, 1 /* Export */) + ? ts.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, /*allowComments*/ false, /*allowSourceMaps*/ true) + : ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true); + // x || (x = {}) + // exports.x || (exports.x = {}) + var moduleArg = ts.createLogicalOr(exportName, ts.createAssignment(exportName, ts.createObjectLiteral())); + if (hasNamespaceQualifiedExportName(node)) { + // `localName` is the expression used within this node's containing scope for any local references. + var localName = ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true); + // x = (exports.x || (exports.x = {})) + moduleArg = ts.createAssignment(localName, moduleArg); + } + // (function (x) { + // x[x["y"] = 0] = "y"; + // ... + // })(x || (x = {})); + var enumStatement = ts.createStatement(ts.createCall(ts.createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, parameterName)], + /*type*/ undefined, transformEnumBody(node, containerName)), + /*typeArguments*/ undefined, [moduleArg]), + /*location*/ node); + ts.setOriginalNode(enumStatement, node); + ts.setEmitFlags(enumStatement, emitFlags); + statements.push(enumStatement); + // Add a DeclarationMarker for the enum to preserve trailing comments and mark + // the end of the declaration. + statements.push(ts.createEndOfDeclarationMarker(node)); + return statements; + } + /** + * Transforms the body of an enum declaration. + * + * @param node The enum declaration node. + */ + function transformEnumBody(node, localName) { + var savedCurrentNamespaceLocalName = currentNamespaceContainerName; + currentNamespaceContainerName = localName; + var statements = []; + startLexicalEnvironment(); + ts.addRange(statements, ts.map(node.members, transformEnumMember)); + ts.addRange(statements, endLexicalEnvironment()); + currentNamespaceContainerName = savedCurrentNamespaceLocalName; + return ts.createBlock(ts.createNodeArray(statements, /*location*/ node.members), + /*location*/ undefined, + /*multiLine*/ true); + } + /** + * Transforms an enum member into a statement. + * + * @param member The enum member node. + */ + function transformEnumMember(member) { + // enums don't support computed properties + // we pass false as 'generateNameForComputedPropertyName' for a backward compatibility purposes + // old emitter always generate 'expression' part of the name as-is. + var name = getExpressionForPropertyName(member, /*generateNameForComputedPropertyName*/ false); + return ts.createStatement(ts.createAssignment(ts.createElementAccess(currentNamespaceContainerName, ts.createAssignment(ts.createElementAccess(currentNamespaceContainerName, name), transformEnumMemberDeclarationValue(member))), name, + /*location*/ member), + /*location*/ member); + } + /** + * Transforms the value of an enum member. + * + * @param member The enum member node. + */ + function transformEnumMemberDeclarationValue(member) { + var value = resolver.getConstantValue(member); + if (value !== undefined) { + return ts.createLiteral(value); + } + else { + enableSubstitutionForNonQualifiedEnumMembers(); + if (member.initializer) { + return ts.visitNode(member.initializer, visitor, ts.isExpression); + } + else { + return ts.createVoidZero(); + } + } + } + /** + * Determines whether to elide a module declaration. + * + * @param node The module declaration node. + */ + function shouldEmitModuleDeclaration(node) { + return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules); + } + /** + * Determines whether an exported declaration will have a qualified export name (e.g. `f.x` + * or `exports.x`). + */ + function hasNamespaceQualifiedExportName(node) { + return isNamespaceExport(node) + || (isExternalModuleExport(node) + && moduleKind !== ts.ModuleKind.ES2015 + && moduleKind !== ts.ModuleKind.System); + } + /** + * Records that a declaration was emitted in the current scope, if it was the first + * declaration for the provided symbol. + * + * NOTE: if there is ever a transformation above this one, we may not be able to rely + * on symbol names. + */ + function recordEmittedDeclarationInScope(node) { + var name = node.symbol && node.symbol.name; + if (name) { + if (!currentScopeFirstDeclarationsOfName) { + currentScopeFirstDeclarationsOfName = ts.createMap(); + } + if (!(name in currentScopeFirstDeclarationsOfName)) { + currentScopeFirstDeclarationsOfName[name] = node; + } + } + } + /** + * Determines whether a declaration is the first declaration with the same name emitted + * in the current scope. + */ + function isFirstEmittedDeclarationInScope(node) { + if (currentScopeFirstDeclarationsOfName) { + var name_33 = node.symbol && node.symbol.name; + if (name_33) { + return currentScopeFirstDeclarationsOfName[name_33] === node; + } + } + return false; + } + /** + * Adds a leading VariableStatement for a enum or module declaration. + */ + function addVarForEnumOrModuleDeclaration(statements, node) { + // Emit a variable statement for the module. + var statement = ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), [ + ts.createVariableDeclaration(ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true)) + ]); + ts.setOriginalNode(statement, node); + recordEmittedDeclarationInScope(node); + if (isFirstEmittedDeclarationInScope(node)) { + // Adjust the source map emit to match the old emitter. + if (node.kind === 229 /* EnumDeclaration */) { + ts.setSourceMapRange(statement.declarationList, node); + } + else { + ts.setSourceMapRange(statement, node); + } + // Trailing comments for module declaration should be emitted after the function closure + // instead of the variable statement: + // + // /** Module comment*/ + // module m1 { + // function foo4Export() { + // } + // } // trailing comment module + // + // Should emit: + // + // /** Module comment*/ + // var m1; + // (function (m1) { + // function foo4Export() { + // } + // })(m1 || (m1 = {})); // trailing comment module + // + ts.setCommentRange(statement, node); + ts.setEmitFlags(statement, 1024 /* NoTrailingComments */ | 2097152 /* HasEndOfDeclarationMarker */); + statements.push(statement); + return true; + } + else { + // For an EnumDeclaration or ModuleDeclaration that merges with a preceeding + // declaration we do not emit a leading variable declaration. To preserve the + // 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, 1536 /* NoComments */ | 2097152 /* HasEndOfDeclarationMarker */); + statements.push(mergeMarker); + return false; + } + } + /** + * Visits a module declaration node. + * + * This function will be called any time a TypeScript namespace (ModuleDeclaration) is encountered. + * + * @param node The module declaration node. + */ + function visitModuleDeclaration(node) { + if (!shouldEmitModuleDeclaration(node)) { + return ts.createNotEmittedStatement(node); + } + ts.Debug.assert(ts.isIdentifier(node.name), "TypeScript module should have an Identifier name."); + enableSubstitutionForNamespaceExports(); + 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 = 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 |= 512 /* NoLeadingComments */; + } + } + // `parameterName` is the declaration name used inside of the namespace. + var parameterName = getNamespaceParameterName(node); + // `containerName` is the expression used inside of the namespace for exports. + var containerName = getNamespaceContainerName(node); + // `exportName` is the expression used within this node's container for any exported references. + var exportName = ts.hasModifier(node, 1 /* Export */) + ? ts.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, /*allowComments*/ false, /*allowSourceMaps*/ true) + : ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true); + // x || (x = {}) + // exports.x || (exports.x = {}) + var moduleArg = ts.createLogicalOr(exportName, ts.createAssignment(exportName, ts.createObjectLiteral())); + if (hasNamespaceQualifiedExportName(node)) { + // `localName` is the expression used within this node's containing scope for any local references. + var localName = ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true); + // x = (exports.x || (exports.x = {})) + moduleArg = ts.createAssignment(localName, moduleArg); + } + // (function (x_1) { + // x_1.y = ...; + // })(x || (x = {})); + var moduleStatement = ts.createStatement(ts.createCall(ts.createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, parameterName)], + /*type*/ undefined, transformModuleBody(node, containerName)), + /*typeArguments*/ undefined, [moduleArg]), + /*location*/ node); + ts.setOriginalNode(moduleStatement, node); + ts.setEmitFlags(moduleStatement, emitFlags); + statements.push(moduleStatement); + // Add a DeclarationMarker for the namespace to preserve trailing comments and mark + // the end of the declaration. + statements.push(ts.createEndOfDeclarationMarker(node)); + return statements; + } + /** + * Transforms the body of a module declaration. + * + * @param node The module declaration node. + */ + function transformModuleBody(node, namespaceLocalName) { + var savedCurrentNamespaceContainerName = currentNamespaceContainerName; + var savedCurrentNamespace = currentNamespace; + var savedCurrentScopeFirstDeclarationsOfName = currentScopeFirstDeclarationsOfName; + currentNamespaceContainerName = namespaceLocalName; + currentNamespace = node; + currentScopeFirstDeclarationsOfName = undefined; + var statements = []; + startLexicalEnvironment(); + var statementsLocation; + var blockLocation; + var body = node.body; + if (body.kind === 231 /* ModuleBlock */) { + saveStateAndInvoke(body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); + statementsLocation = body.statements; + blockLocation = body; + } + else { + var result = visitModuleDeclaration(body); + if (result) { + if (ts.isArray(result)) { + ts.addRange(statements, result); + } + else { + statements.push(result); + } + } + var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; + statementsLocation = ts.moveRangePos(moduleBlock.statements, -1); + } + ts.addRange(statements, endLexicalEnvironment()); + currentNamespaceContainerName = savedCurrentNamespaceContainerName; + currentNamespace = savedCurrentNamespace; + currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName; + var block = ts.createBlock(ts.createNodeArray(statements, + /*location*/ statementsLocation), + /*location*/ blockLocation, + /*multiLine*/ true); + // namespace hello.hi.world { + // function foo() {} + // + // // TODO, blah + // } + // + // should be emitted as + // + // var hello; + // (function (hello) { + // var hi; + // (function (hi) { + // var world; + // (function (world) { + // function foo() { } + // // TODO, blah + // })(world = hi.world || (hi.world = {})); + // })(hi = hello.hi || (hello.hi = {})); + // })(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) | 1536 /* NoComments */); + } + return block; + } + function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { + if (moduleDeclaration.body.kind === 230 /* ModuleDeclaration */) { + var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); + return recursiveInnerModule || moduleDeclaration.body; + } + } + /** + * Visits an import declaration, eliding it if it is not referenced. + * + * @param node The import declaration node. + */ + function visitImportDeclaration(node) { + if (!node.importClause) { + // Do not elide a side-effect only import declaration. + // import "foo"; + return node; + } + // Elide the declaration if the import clause was elided. + var importClause = ts.visitNode(node.importClause, visitImportClause, ts.isImportClause, /*optional*/ true); + return importClause + ? ts.updateImportDeclaration(node, + /*decorators*/ undefined, + /*modifiers*/ undefined, importClause, node.moduleSpecifier) + : undefined; + } + /** + * Visits an import clause, eliding it if it is not referenced. + * + * @param node The import clause node. + */ + function visitImportClause(node) { + // Elide the import clause if we elide both its name and its named bindings. + var name = resolver.isReferencedAliasDeclaration(node) ? node.name : undefined; + var namedBindings = ts.visitNode(node.namedBindings, visitNamedImportBindings, ts.isNamedImportBindings, /*optional*/ true); + return (name || namedBindings) ? ts.updateImportClause(node, name, namedBindings) : undefined; + } + /** + * Visits named import bindings, eliding it if it is not referenced. + * + * @param node The named import bindings node. + */ + function visitNamedImportBindings(node) { + if (node.kind === 237 /* NamespaceImport */) { + // Elide a namespace import if it is not referenced. + return resolver.isReferencedAliasDeclaration(node) ? node : undefined; + } + else { + // Elide named imports if all of its import specifiers are elided. + var elements = ts.visitNodes(node.elements, visitImportSpecifier, ts.isImportSpecifier); + return ts.some(elements) ? ts.updateNamedImports(node, elements) : undefined; + } + } + /** + * Visits an import specifier, eliding it if it is not referenced. + * + * @param node The import specifier node. + */ + function visitImportSpecifier(node) { + // Elide an import specifier if it is not referenced. + return resolver.isReferencedAliasDeclaration(node) ? node : undefined; + } + /** + * Visits an export assignment, eliding it if it does not contain a clause that resolves + * to a value. + * + * @param node The export assignment node. + */ + function visitExportAssignment(node) { + // Elide the export assignment if it does not reference a value. + return resolver.isValueAliasDeclaration(node) + ? ts.visitEachChild(node, visitor, context) + : undefined; + } + /** + * Visits an export declaration, eliding it if it does not contain a clause that resolves + * to a value. + * + * @param node The export declaration node. + */ + function visitExportDeclaration(node) { + if (!node.exportClause) { + // Elide a star export if the module it references does not export a value. + return resolver.moduleExportsSomeValue(node.moduleSpecifier) ? node : undefined; + } + if (!resolver.isValueAliasDeclaration(node)) { + // Elide the export declaration if it does not export a value. + return undefined; + } + // Elide the export declaration if all of its named exports are elided. + var exportClause = ts.visitNode(node.exportClause, visitNamedExports, ts.isNamedExports, /*optional*/ true); + return exportClause + ? ts.updateExportDeclaration(node, + /*decorators*/ undefined, + /*modifiers*/ undefined, exportClause, node.moduleSpecifier) + : undefined; + } + /** + * Visits named exports, eliding it if it does not contain an export specifier that + * resolves to a value. + * + * @param node The named exports node. + */ + function visitNamedExports(node) { + // Elide the named exports if all of its export specifiers were elided. + var elements = ts.visitNodes(node.elements, visitExportSpecifier, ts.isExportSpecifier); + return ts.some(elements) ? ts.updateNamedExports(node, elements) : undefined; + } + /** + * Visits an export specifier, eliding it if it does not resolve to a value. + * + * @param node The export specifier node. + */ + function visitExportSpecifier(node) { + // Elide an export specifier if it does not reference a value. + return resolver.isValueAliasDeclaration(node) ? node : undefined; + } + /** + * Determines whether to emit an import equals declaration. + * + * @param node The import equals declaration node. + */ + function shouldEmitImportEqualsDeclaration(node) { + // preserve old compiler's behavior: emit 'var' for import declaration (even if we do not consider them referenced) when + // - current file is not external module + // - import declaration is top level and target is value imported by entity name + return resolver.isReferencedAliasDeclaration(node) + || (!ts.isExternalModule(currentSourceFile) + && resolver.isTopLevelValueImportEqualsWithEntityName(node)); + } + /** + * Visits an import equals declaration. + * + * @param node The import equals declaration node. + */ + function visitImportEqualsDeclaration(node) { + if (ts.isExternalModuleImportEqualsDeclaration(node)) { + // Elide external module `import=` if it is not referenced. + return resolver.isReferencedAliasDeclaration(node) + ? ts.visitEachChild(node, visitor, context) + : undefined; + } + if (!shouldEmitImportEqualsDeclaration(node)) { + return undefined; + } + var moduleReference = ts.createExpressionFromEntityName(node.moduleReference); + ts.setEmitFlags(moduleReference, 1536 /* NoComments */ | 2048 /* NoNestedComments */); + if (isNamedExternalModuleExport(node) || !isNamespaceExport(node)) { + // export var ${name} = ${moduleReference}; + // var ${name} = ${moduleReference}; + return ts.setOriginalNode(ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([ + ts.setOriginalNode(ts.createVariableDeclaration(node.name, + /*type*/ undefined, moduleReference), node) + ]), node), node); + } + else { + // exports.${name} = ${moduleReference}; + return ts.setOriginalNode(createNamespaceExport(node.name, moduleReference, node), node); + } + } + /** + * Gets a value indicating whether the node is exported from a namespace. + * + * @param node The node to test. + */ + function isNamespaceExport(node) { + return currentNamespace !== undefined && ts.hasModifier(node, 1 /* Export */); + } + /** + * Gets a value indicating whether the node is exported from an external module. + * + * @param node The node to test. + */ + function isExternalModuleExport(node) { + return currentNamespace === undefined && ts.hasModifier(node, 1 /* Export */); + } + /** + * Gets a value indicating whether the node is a named export from an external module. + * + * @param node The node to test. + */ + function isNamedExternalModuleExport(node) { + return isExternalModuleExport(node) + && !ts.hasModifier(node, 512 /* Default */); + } + /** + * Gets a value indicating whether the node is the default export of an external module. + * + * @param node The node to test. + */ + function isDefaultExternalModuleExport(node) { + return isExternalModuleExport(node) + && ts.hasModifier(node, 512 /* Default */); + } + /** + * Creates a statement for the provided expression. This is used in calls to `map`. + */ + function expressionToStatement(expression) { + return ts.createStatement(expression, /*location*/ undefined); + } + function addExportMemberAssignment(statements, node) { + var expression = ts.createAssignment(ts.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, /*allowComments*/ false, /*allowSourceMaps*/ true), ts.getLocalName(node)); + ts.setSourceMapRange(expression, ts.createRange(node.name.pos, node.end)); + var statement = ts.createStatement(expression); + ts.setSourceMapRange(statement, ts.createRange(-1, node.end)); + statements.push(statement); + } + function createNamespaceExport(exportName, exportValue, location) { + return ts.createStatement(ts.createAssignment(ts.getNamespaceMemberName(currentNamespaceContainerName, exportName, /*allowComments*/ false, /*allowSourceMaps*/ true), exportValue), location); + } + function createNamespaceExportExpression(exportName, exportValue, location) { + return ts.createAssignment(getNamespaceMemberNameWithSourceMapsAndWithoutComments(exportName), exportValue, location); + } + function getNamespaceMemberNameWithSourceMapsAndWithoutComments(name) { + return ts.getNamespaceMemberName(currentNamespaceContainerName, name, /*allowComments*/ false, /*allowSourceMaps*/ true); + } + /** + * Gets the declaration name used inside of a namespace or enum. + */ + function getNamespaceParameterName(node) { + var name = ts.getGeneratedNameForNode(node); + ts.setSourceMapRange(name, node.name); + return name; + } + /** + * Gets the expression used to refer to a namespace or enum within the body + * of its declaration. + */ + function getNamespaceContainerName(node) { + return ts.getGeneratedNameForNode(node); + } + /** + * Gets a local alias for a class declaration if it is a decorated class with an internal + * reference to the static side of the class. This is necessary to avoid issues with + * double-binding semantics for the class name. + */ + function getClassAliasIfNeeded(node) { + if (resolver.getNodeCheckFlags(node) & 8388608 /* ClassWithConstructorReference */) { + enableSubstitutionForClassAliases(); + var classAlias = ts.createUniqueName(node.name && !ts.isGeneratedIdentifier(node.name) ? node.name.text : "default"); + classAliases[ts.getOriginalNodeId(node)] = classAlias; + hoistVariableDeclaration(classAlias); + return classAlias; + } + } + function getClassPrototype(node) { + return ts.createPropertyAccess(ts.getDeclarationName(node), "prototype"); + } + function getClassMemberPrefix(node, member) { + return ts.hasModifier(member, 32 /* Static */) + ? ts.getDeclarationName(node) + : getClassPrototype(node); + } + function enableSubstitutionForNonQualifiedEnumMembers() { + if ((enabledSubstitutions & 8 /* NonQualifiedEnumMembers */) === 0) { + enabledSubstitutions |= 8 /* NonQualifiedEnumMembers */; + context.enableSubstitution(70 /* Identifier */); + } + } + function enableSubstitutionForClassAliases() { + if ((enabledSubstitutions & 1 /* ClassAliases */) === 0) { + enabledSubstitutions |= 1 /* ClassAliases */; + // We need to enable substitutions for identifiers. This allows us to + // substitute class names inside of a class declaration. + context.enableSubstitution(70 /* Identifier */); + // Keep track of class aliases. + classAliases = ts.createMap(); + } + } + function enableSubstitutionForNamespaceExports() { + if ((enabledSubstitutions & 2 /* NamespaceExports */) === 0) { + enabledSubstitutions |= 2 /* NamespaceExports */; + // We need to enable substitutions for identifiers and shorthand property assignments. This allows us to + // substitute the names of exported members of a namespace. + context.enableSubstitution(70 /* Identifier */); + context.enableSubstitution(258 /* ShorthandPropertyAssignment */); + // We need to be notified when entering and exiting namespaces. + context.enableEmitNotification(230 /* ModuleDeclaration */); + } + } + function isTransformedModuleDeclaration(node) { + return ts.getOriginalNode(node).kind === 230 /* ModuleDeclaration */; + } + function isTransformedEnumDeclaration(node) { + return ts.getOriginalNode(node).kind === 229 /* EnumDeclaration */; + } + /** + * 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) { + var savedApplicableSubstitutions = applicableSubstitutions; + if (enabledSubstitutions & 2 /* NamespaceExports */ && isTransformedModuleDeclaration(node)) { + applicableSubstitutions |= 2 /* NamespaceExports */; + } + if (enabledSubstitutions & 8 /* NonQualifiedEnumMembers */ && isTransformedEnumDeclaration(node)) { + applicableSubstitutions |= 8 /* NonQualifiedEnumMembers */; + } + previousOnEmitNode(emitContext, node, emitCallback); + applicableSubstitutions = savedApplicableSubstitutions; + } + /** + * 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 (emitContext === 1 /* Expression */) { + return substituteExpression(node); + } + else if (ts.isShorthandPropertyAssignment(node)) { + return substituteShorthandPropertyAssignment(node); + } + return node; + } + function substituteShorthandPropertyAssignment(node) { + if (enabledSubstitutions & 2 /* NamespaceExports */) { + var name_34 = node.name; + var exportedName = trySubstituteNamespaceExportedName(name_34); + if (exportedName) { + // A shorthand property with an assignment initializer is probably part of a + // destructuring assignment + if (node.objectAssignmentInitializer) { + var initializer = ts.createAssignment(exportedName, node.objectAssignmentInitializer); + return ts.createPropertyAssignment(name_34, initializer, /*location*/ node); + } + return ts.createPropertyAssignment(name_34, exportedName, /*location*/ node); + } + } + return node; + } + function substituteExpression(node) { + switch (node.kind) { + case 70 /* Identifier */: + return substituteExpressionIdentifier(node); + case 177 /* PropertyAccessExpression */: + return substitutePropertyAccessExpression(node); + case 178 /* ElementAccessExpression */: + return substituteElementAccessExpression(node); + } + return node; + } + function substituteExpressionIdentifier(node) { + return trySubstituteClassAlias(node) + || trySubstituteNamespaceExportedName(node) + || node; + } + function trySubstituteClassAlias(node) { + if (enabledSubstitutions & 1 /* ClassAliases */) { + if (resolver.getNodeCheckFlags(node) & 16777216 /* ConstructorReferenceInClass */) { + // Due to the emit for class decorators, any reference to the class from inside of the class body + // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind + // behavior of class names in ES6. + // Also, when emitting statics for class expressions, we must substitute a class alias for + // constructor references in static property initializers. + var declaration = resolver.getReferencedValueDeclaration(node); + if (declaration) { + var classAlias = classAliases[declaration.id]; + if (classAlias) { + var clone_2 = ts.getSynthesizedClone(classAlias); + ts.setSourceMapRange(clone_2, node); + ts.setCommentRange(clone_2, node); + return clone_2; + } + } + } + } + return undefined; + } + function trySubstituteNamespaceExportedName(node) { + // If this is explicitly a local name, do not substitute. + 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); + if (container && container.kind !== 261 /* SourceFile */) { + var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 230 /* ModuleDeclaration */) || + (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 229 /* EnumDeclaration */); + if (substitute) { + return ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node, /*location*/ node); + } + } + } + return undefined; + } + function substitutePropertyAccessExpression(node) { + return substituteConstantValue(node); + } + function substituteElementAccessExpression(node) { + return substituteConstantValue(node); + } + function substituteConstantValue(node) { + var constantValue = tryGetConstEnumValue(node); + if (constantValue !== undefined) { + var substitute = ts.createLiteral(constantValue); + ts.setSourceMapRange(substitute, node); + ts.setCommentRange(substitute, node); + if (!compilerOptions.removeComments) { + var propertyName = ts.isPropertyAccessExpression(node) + ? ts.declarationNameToString(node.name) + : ts.getTextOfNode(node.argumentExpression); + substitute.trailingComment = " " + propertyName + " "; + } + ts.setConstantValue(node, constantValue); + return substitute; + } + return node; + } + function tryGetConstEnumValue(node) { + if (compilerOptions.isolatedModules) { + return undefined; + } + return ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node) + ? resolver.getConstantValue(node) + : undefined; + } } - ts.getExternalModuleNameFromDeclaration = getExternalModuleNameFromDeclaration; - var Jump; - (function (Jump) { - Jump[Jump["Break"] = 2] = "Break"; - Jump[Jump["Continue"] = 4] = "Continue"; - Jump[Jump["Return"] = 8] = "Return"; - })(Jump || (Jump = {})); + 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 = {})); +/// +/// +/*@internal*/ +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, /*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 = {})); +/// +/// +/// +/*@internal*/ +var ts; +(function (ts) { + function transformJsx(context) { + var compilerOptions = context.getCompilerOptions(); + var currentSourceFile; + return transformSourceFile; + /** + * Transform JSX-specific syntax in a SourceFile. + * + * @param node A SourceFile node. + */ + function transformSourceFile(node) { + if (ts.isDeclarationFile(node)) { + return node; + } + currentSourceFile = node; + var visited = ts.visitEachChild(node, visitor, context); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = undefined; + return visited; + } + function visitor(node) { + if (node.transformFlags & 4 /* ContainsJsx */) { + return visitorWorker(node); + } + else { + return node; + } + } + function visitorWorker(node) { + switch (node.kind) { + case 246 /* JsxElement */: + return visitJsxElement(node, /*isChild*/ false); + case 247 /* JsxSelfClosingElement */: + return visitJsxSelfClosingElement(node, /*isChild*/ false); + case 252 /* JsxExpression */: + return visitJsxExpression(node); + default: + return ts.visitEachChild(node, visitor, context); + } + } + function transformJsxChildToExpression(node) { + switch (node.kind) { + case 10 /* JsxText */: + return visitJsxText(node); + case 252 /* JsxExpression */: + return visitJsxExpression(node); + case 246 /* JsxElement */: + return visitJsxElement(node, /*isChild*/ true); + case 247 /* JsxSelfClosingElement */: + return visitJsxSelfClosingElement(node, /*isChild*/ true); + default: + ts.Debug.failBadSyntaxKind(node); + return undefined; + } + } + function visitJsxElement(node, isChild) { + return visitJsxOpeningLikeElement(node.openingElement, node.children, isChild, /*location*/ node); + } + function visitJsxSelfClosingElement(node, isChild) { + return visitJsxOpeningLikeElement(node, /*children*/ undefined, isChild, /*location*/ node); + } + function visitJsxOpeningLikeElement(node, children, isChild, location) { + var tagName = getTagName(node); + var objectProperties; + var attrs = node.attributes; + if (attrs.length === 0) { + // When there are no attributes, React wants "null" + objectProperties = ts.createNull(); + } + else { + // Map spans of JsxAttribute nodes into object literals and spans + // of JsxSpreadAttribute nodes into expressions. + var segments = ts.flatten(ts.spanMap(attrs, ts.isJsxSpreadAttribute, function (attrs, isSpread) { return isSpread + ? ts.map(attrs, transformJsxSpreadAttributeToExpression) + : ts.createObjectLiteral(ts.map(attrs, transformJsxAttributeToObjectLiteralElement)); })); + if (ts.isJsxSpreadAttribute(attrs[0])) { + // We must always emit at least one object literal before a spread + // argument. + segments.unshift(ts.createObjectLiteral()); + } + // Either emit one big object literal (no spread attribs), or + // a call to the __assign helper. + 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) { + ts.startOnNewLine(element); + } + return element; + } + function transformJsxSpreadAttributeToExpression(node) { + return ts.visitNode(node.expression, visitor, ts.isExpression); + } + function transformJsxAttributeToObjectLiteralElement(node) { + var name = getAttributeName(node); + var expression = transformJsxAttributeInitializer(node.initializer); + return ts.createPropertyAssignment(name, expression); + } + function transformJsxAttributeInitializer(node) { + if (node === undefined) { + return ts.createLiteral(true); + } + else if (node.kind === 9 /* StringLiteral */) { + var decoded = tryDecodeEntities(node.text); + return decoded ? ts.createLiteral(decoded, /*location*/ node) : node; + } + else if (node.kind === 252 /* JsxExpression */) { + if (node.expression === undefined) { + return ts.createLiteral(true); + } + return visitJsxExpression(node); + } + else { + ts.Debug.failBadSyntaxKind(node); + } + } + function visitJsxText(node) { + var text = ts.getTextOfNode(node, /*includeTrivia*/ true); + var parts; + var firstNonWhitespace = 0; + var lastNonWhitespace = -1; + // JSX trims whitespace at the end and beginning of lines, except that the + // start/end of a tag is considered a start/end of a line only if that line is + // on the same line as the closing tag. See examples in + // tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx + for (var i = 0; i < text.length; i++) { + var c = text.charCodeAt(i); + if (ts.isLineBreak(c)) { + if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) { + var part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1); + if (!parts) { + parts = []; + } + // We do not escape the string here as that is handled by the printer + // when it emits the literal. We do, however, need to decode JSX entities. + parts.push(ts.createLiteral(decodeEntities(part))); + } + firstNonWhitespace = -1; + } + else if (!ts.isWhiteSpace(c)) { + lastNonWhitespace = i; + if (firstNonWhitespace === -1) { + firstNonWhitespace = i; + } + } + } + if (firstNonWhitespace !== -1) { + var part = text.substr(firstNonWhitespace); + if (!parts) { + parts = []; + } + // We do not escape the string here as that is handled by the printer + // when it emits the literal. We do, however, need to decode JSX entities. + parts.push(ts.createLiteral(decodeEntities(part))); + } + if (parts) { + return ts.reduceLeft(parts, aggregateJsxTextParts); + } + return undefined; + } + /** + * Aggregates two expressions by interpolating them with a whitespace literal. + */ + function aggregateJsxTextParts(left, right) { + return ts.createAdd(ts.createAdd(left, ts.createLiteral(" ")), right); + } + /** + * Replace entities like " ", "{", and "�" with the characters they encode. + * See https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references + */ + function decodeEntities(text) { + return text.replace(/&((#((\d+)|x([\da-fA-F]+)))|(\w+));/g, function (match, _all, _number, _digits, decimal, hex, word) { + if (decimal) { + return String.fromCharCode(parseInt(decimal, 10)); + } + else if (hex) { + return String.fromCharCode(parseInt(hex, 16)); + } + else { + var ch = entities[word]; + // If this is not a valid entity, then just use `match` (replace it with itself, i.e. don't replace) + return ch ? String.fromCharCode(ch) : match; + } + }); + } + /** Like `decodeEntities` but returns `undefined` if there were no entities to decode. */ + function tryDecodeEntities(text) { + var decoded = decodeEntities(text); + return decoded === text ? undefined : decoded; + } + function getTagName(node) { + if (node.kind === 246 /* JsxElement */) { + return getTagName(node.openingElement); + } + else { + var name_35 = node.tagName; + if (ts.isIdentifier(name_35) && ts.isIntrinsicJsxName(name_35.text)) { + return ts.createLiteral(name_35.text); + } + else { + return ts.createExpressionFromEntityName(name_35); + } + } + } + /** + * Emit an attribute name, which is quoted if it needs to be quoted. Because + * these emit into an object literal property name, we don't need to be worried + * about keywords, just non-identifier characters + */ + function getAttributeName(node) { + var name = node.name; + if (/^[A-Za-z_]\w*$/.test(name.text)) { + return name; + } + else { + return ts.createLiteral(name.text); + } + } + function visitJsxExpression(node) { + return ts.visitNode(node.expression, visitor, ts.isExpression); + } + } + ts.transformJsx = transformJsx; var entities = ts.createMap({ "quot": 0x0022, "amp": 0x0026, @@ -36846,56 +49020,2316 @@ var ts; "hearts": 0x2665, "diams": 0x2666 }); - // Flags enum to track count of temp variables and a few dedicated names - var TempFlags; - (function (TempFlags) { - TempFlags[TempFlags["Auto"] = 0] = "Auto"; - TempFlags[TempFlags["CountMask"] = 268435455] = "CountMask"; - TempFlags[TempFlags["_i"] = 268435456] = "_i"; - })(TempFlags || (TempFlags = {})); +})(ts || (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 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 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; + /** + * This keeps track of containers where `super` is valid, for use with + * just-in-time substitution for `super` expressions inside of async methods. + */ + var currentSuperContainer; + // Save the previous transformation hooks. + var previousOnEmitNode = context.onEmitNode; + var previousOnSubstituteNode = context.onSubstituteNode; + // Set new transformation hooks. + context.onEmitNode = onEmitNode; + context.onSubstituteNode = onSubstituteNode; + return transformSourceFile; + function transformSourceFile(node) { + if (ts.isDeclarationFile(node)) { + return node; + } + currentSourceFile = node; + var visited = ts.visitEachChild(node, visitor, context); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = undefined; + return visited; + } + function visitor(node) { + if ((node.transformFlags & 16 /* ContainsES2017 */) === 0) { + return node; + } + switch (node.kind) { + case 119 /* AsyncKeyword */: + // ES2017 async modifier should be elided for targets < ES2017 + return undefined; + case 189 /* AwaitExpression */: + // ES2017 'await' expressions must be transformed for targets < ES2017. + return visitAwaitExpression(node); + case 149 /* MethodDeclaration */: + // ES2017 method declarations may be 'async' + return visitMethodDeclaration(node); + case 225 /* FunctionDeclaration */: + // ES2017 function declarations may be 'async' + return visitFunctionDeclaration(node); + case 184 /* FunctionExpression */: + // ES2017 function expressions may be 'async' + return visitFunctionExpression(node); + case 185 /* ArrowFunction */: + // ES2017 arrow functions may be 'async' + return visitArrowFunction(node); + default: + return ts.visitEachChild(node, visitor, context); + } + } + /** + * Visits an AwaitExpression node. + * + * This function will be called any time a ES2017 await expression is encountered. + * + * @param node The node to visit. + */ + function visitAwaitExpression(node) { + return ts.setOriginalNode(ts.createYield( + /*asteriskToken*/ undefined, ts.visitNode(node.expression, visitor, ts.isExpression), + /*location*/ node), node); + } + /** + * 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 node to visit. + */ + function visitMethodDeclaration(node) { + 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 FunctionDeclaration node. + * + * 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 visitFunctionDeclaration(node) { + 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 FunctionExpression node. + * + * 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 visitFunctionExpression(node) { + if (ts.nodeIsMissing(node.body)) { + return ts.createOmittedExpression(); + } + 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)); + } + /** + * 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) { + 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; + var isArrowFunction = node.kind === 185 /* ArrowFunction */; + var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192 /* CaptureArguments */) !== 0; + // An async function is emit as an outer function that calls an inner + // generator function. To preserve lexical bindings, we pass the current + // `this` and `arguments` objects to `__awaiter`. The generator function + // passed to `__awaiter` is executed inside of the callback to the + // promise constructor. + if (!isArrowFunction) { + var statements = []; + var statementOffset = ts.addPrologueDirectives(statements, node.body.statements, /*ensureUseStrict*/ false, visitor); + 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.addEmitHelper(block, advancedAsyncSuperHelper); + } + else if (resolver.getNodeCheckFlags(node) & 2048 /* AsyncMethodWithSuper */) { + enableSubstitutionForAsyncMethodsWithSuper(); + ts.addEmitHelper(block, asyncSuperHelper); + } + } + return block; + } + else { + 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 transformFunctionBodyWorker(body, start) { + if (ts.isBlock(body)) { + return ts.updateBlock(body, ts.visitLexicalEnvironment(body.statements, visitor, context, start)); + } + else { + startLexicalEnvironment(); + var visited = ts.convertToFunctionBody(ts.visitNode(body, visitor, ts.isConciseBody)); + var declarations = endLexicalEnvironment(); + return ts.updateBlock(visited, ts.createNodeArray(ts.concatenate(visited.statements, declarations), visited.statements)); + } + } + function getPromiseConstructor(type) { + 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; + } + function enableSubstitutionForAsyncMethodsWithSuper() { + if ((enabledSubstitutions & 1 /* AsyncMethodsWithSuper */) === 0) { + enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */; + // We need to enable substitutions for call, property access, and element access + // if we need to rewrite super calls. + context.enableSubstitution(179 /* CallExpression */); + context.enableSubstitution(177 /* PropertyAccessExpression */); + context.enableSubstitution(178 /* ElementAccessExpression */); + // We need to be notified when entering and exiting declarations that bind super. + context.enableEmitNotification(226 /* ClassDeclaration */); + context.enableEmitNotification(149 /* MethodDeclaration */); + context.enableEmitNotification(151 /* GetAccessor */); + context.enableEmitNotification(152 /* SetAccessor */); + context.enableEmitNotification(150 /* Constructor */); + } + } + function substituteExpression(node) { + switch (node.kind) { + case 177 /* PropertyAccessExpression */: + return substitutePropertyAccessExpression(node); + case 178 /* ElementAccessExpression */: + return substituteElementAccessExpression(node); + case 179 /* CallExpression */: + if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */) { + return substituteCallExpression(node); + } + break; + } + return node; + } + function substitutePropertyAccessExpression(node) { + if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && node.expression.kind === 96 /* SuperKeyword */) { + var flags = getSuperContainerAsyncMethodFlags(); + if (flags) { + return createSuperAccessInAsyncMethod(ts.createLiteral(node.name.text), flags, node); + } + } + return node; + } + function substituteElementAccessExpression(node) { + if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && node.expression.kind === 96 /* SuperKeyword */) { + var flags = getSuperContainerAsyncMethodFlags(); + if (flags) { + return createSuperAccessInAsyncMethod(node.argumentExpression, flags, node); + } + } + return node; + } + function substituteCallExpression(node) { + var expression = node.expression; + if (ts.isSuperProperty(expression)) { + var flags = getSuperContainerAsyncMethodFlags(); + if (flags) { + var argumentExpression = ts.isPropertyAccessExpression(expression) + ? substitutePropertyAccessExpression(expression) + : substituteElementAccessExpression(expression); + return ts.createCall(ts.createPropertyAccess(argumentExpression, "call"), + /*typeArguments*/ undefined, [ + ts.createThis() + ].concat(node.arguments)); + } + } + return node; + } + function isSuperContainer(node) { + var kind = node.kind; + return kind === 226 /* ClassDeclaration */ + || kind === 150 /* Constructor */ + || kind === 149 /* MethodDeclaration */ + || kind === 151 /* GetAccessor */ + || kind === 152 /* SetAccessor */; + } + /** + * Hook for node emit. + * + * @param node The node to emit. + * @param emit A callback used to emit the node in the printer. + */ + function onEmitNode(emitContext, node, emitCallback) { + // 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); + } + } + /** + * Hooks node substitutions. + * + * @param node The node to substitute. + * @param isExpression A value indicating whether the node is to be used in an expression + * position. + */ + function onSubstituteNode(emitContext, node) { + node = previousOnSubstituteNode(emitContext, node); + if (emitContext === 1 /* Expression */) { + return substituteExpression(node); + } + return node; + } + function createSuperAccessInAsyncMethod(argumentExpression, flags, location) { + if (flags & 4096 /* AsyncMethodWithSuperBinding */) { + return ts.createPropertyAccess(ts.createCall(ts.createIdentifier("_super"), + /*typeArguments*/ undefined, [argumentExpression]), "value", location); + } + else { + return ts.createCall(ts.createIdentifier("_super"), + /*typeArguments*/ undefined, [argumentExpression], location); + } + } + function getSuperContainerAsyncMethodFlags() { + return currentSuperContainer !== undefined + && resolver.getNodeCheckFlags(currentSuperContainer) & (2048 /* AsyncMethodWithSuper */ | 4096 /* AsyncMethodWithSuperBinding */); + } + } + 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 = {})); +/// +/// +/*@internal*/ +var ts; +(function (ts) { + function transformES2016(context) { + var hoistVariableDeclaration = context.hoistVariableDeclaration; + return transformSourceFile; + function transformSourceFile(node) { + if (ts.isDeclarationFile(node)) { + return node; + } + return ts.visitEachChild(node, visitor, context); + } + function visitor(node) { + if ((node.transformFlags & 32 /* ContainsES2016 */) === 0) { + return node; + } + switch (node.kind) { + case 192 /* BinaryExpression */: + return visitBinaryExpression(node); + default: + return ts.visitEachChild(node, visitor, context); + } + } + function visitBinaryExpression(node) { + 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 (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); + } + 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; +})(ts || (ts = {})); +/// +/// +/*@internal*/ +var ts; +(function (ts) { + var ES2015SubstitutionFlags; + (function (ES2015SubstitutionFlags) { + /** Enables substitutions for captured `this` */ + ES2015SubstitutionFlags[ES2015SubstitutionFlags["CapturedThis"] = 1] = "CapturedThis"; + /** Enables substitutions for block-scoped bindings. */ + ES2015SubstitutionFlags[ES2015SubstitutionFlags["BlockScopedBindings"] = 2] = "BlockScopedBindings"; + })(ES2015SubstitutionFlags || (ES2015SubstitutionFlags = {})); var CopyDirection; (function (CopyDirection) { CopyDirection[CopyDirection["ToOriginal"] = 0] = "ToOriginal"; CopyDirection[CopyDirection["ToOutParameter"] = 1] = "ToOutParameter"; })(CopyDirection || (CopyDirection = {})); - // targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature - function emitFiles(resolver, host, targetSourceFile) { - // 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};"; - 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};"; - // 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};"; - 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 compilerOptions = host.getCompilerOptions(); - var languageVersion = ts.getEmitScriptTarget(compilerOptions); - var modulekind = ts.getEmitModuleKind(compilerOptions); - var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined; - var emittedFilesList = compilerOptions.listEmittedFiles ? [] : undefined; - var emitterDiagnostics = ts.createDiagnosticCollection(); - var emitSkipped = false; - var newLine = host.getNewLine(); - var emitJavaScript = createFileEmitter(); - ts.forEachExpectedEmitFile(host, emitFile, targetSourceFile); - return { - emitSkipped: emitSkipped, - diagnostics: emitterDiagnostics.getDiagnostics(), - emittedFiles: emittedFilesList, - sourceMaps: sourceMapDataList - }; - function isUniqueLocalName(name, container) { - for (var node = container; ts.isNodeDescendentOf(node, container); node = node.nextContainer) { - if (node.locals && name in node.locals) { - // We conservatively include alias symbols to cover cases where they're emitted as locals - if (node.locals[name].flags & (107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */)) { - return false; + var Jump; + (function (Jump) { + Jump[Jump["Break"] = 2] = "Break"; + Jump[Jump["Continue"] = 4] = "Continue"; + Jump[Jump["Return"] = 8] = "Return"; + })(Jump || (Jump = {})); + var SuperCaptureResult; + (function (SuperCaptureResult) { + /** + * A capture may have been added for calls to 'super', but + * the caller should emit subsequent statements normally. + */ + SuperCaptureResult[SuperCaptureResult["NoReplacement"] = 0] = "NoReplacement"; + /** + * A call to 'super()' got replaced with a capturing statement like: + * + * var _this = _super.call(...) || this; + * + * Callers should skip the current statement. + */ + SuperCaptureResult[SuperCaptureResult["ReplaceSuperCapture"] = 1] = "ReplaceSuperCapture"; + /** + * A call to 'super()' got replaced with a capturing statement like: + * + * return _super.call(...) || this; + * + * Callers should skip the current statement and avoid any returns of '_this'. + */ + SuperCaptureResult[SuperCaptureResult["ReplaceWithReturn"] = 2] = "ReplaceWithReturn"; + })(SuperCaptureResult || (SuperCaptureResult = {})); + function transformES2015(context) { + 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; + context.onEmitNode = onEmitNode; + context.onSubstituteNode = onSubstituteNode; + var currentSourceFile; + var currentText; + var currentParent; + var currentNode; + var enclosingVariableStatement; + var enclosingBlockScopeContainer; + var enclosingBlockScopeContainerParent; + var enclosingFunction; + var enclosingNonArrowFunction; + var enclosingNonAsyncFunctionBody; + var isInConstructorWithCapturedSuper; + /** + * Used to track if we are emitting body of the converted loop + */ + var convertedLoopState; + /** + * Keeps track of whether substitutions have been enabled for specific cases. + * They are persisted between each SourceFile transformation and should not + * be reset. + */ + var enabledSubstitutions; + return transformSourceFile; + function transformSourceFile(node) { + if (ts.isDeclarationFile(node)) { + return node; + } + currentSourceFile = node; + currentText = node.text; + var visited = saveStateAndInvoke(node, visitSourceFile); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = undefined; + currentText = undefined; + return visited; + } + function visitor(node) { + return saveStateAndInvoke(node, dispatcher); + } + function dispatcher(node) { + return convertedLoopState + ? visitorForConvertedLoopWorker(node) + : visitorWorker(node); + } + function saveStateAndInvoke(node, f) { + var savedEnclosingFunction = enclosingFunction; + var savedEnclosingNonArrowFunction = enclosingNonArrowFunction; + var savedEnclosingNonAsyncFunctionBody = enclosingNonAsyncFunctionBody; + var savedEnclosingBlockScopeContainer = enclosingBlockScopeContainer; + var savedEnclosingBlockScopeContainerParent = enclosingBlockScopeContainerParent; + var savedEnclosingVariableStatement = enclosingVariableStatement; + var savedCurrentParent = currentParent; + var savedCurrentNode = currentNode; + var savedConvertedLoopState = convertedLoopState; + var savedIsInConstructorWithCapturedSuper = isInConstructorWithCapturedSuper; + if (ts.nodeStartsNewLexicalEnvironment(node)) { + // don't treat content of nodes that start new lexical environment as part of converted loop copy or constructor body + isInConstructorWithCapturedSuper = false; + convertedLoopState = undefined; + } + onBeforeVisitNode(node); + var visited = f(node); + isInConstructorWithCapturedSuper = savedIsInConstructorWithCapturedSuper; + convertedLoopState = savedConvertedLoopState; + enclosingFunction = savedEnclosingFunction; + enclosingNonArrowFunction = savedEnclosingNonArrowFunction; + enclosingNonAsyncFunctionBody = savedEnclosingNonAsyncFunctionBody; + enclosingBlockScopeContainer = savedEnclosingBlockScopeContainer; + enclosingBlockScopeContainerParent = savedEnclosingBlockScopeContainerParent; + enclosingVariableStatement = savedEnclosingVariableStatement; + currentParent = savedCurrentParent; + 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); + } + function isReturnVoidStatementInConstructorWithCapturedSuper(node) { + return isInConstructorWithCapturedSuper && node.kind === 216 /* ReturnStatement */ && !node.expression; + } + function shouldCheckNode(node) { + return (node.transformFlags & 64 /* ES2015 */) !== 0 || + node.kind === 219 /* LabeledStatement */ || + (ts.isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node)); + } + function visitorWorker(node) { + if (isReturnVoidStatementInConstructorWithCapturedSuper(node)) { + return returnCapturedThis(node); + } + else if (shouldCheckNode(node)) { + return visitJavaScript(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 + return ts.visitEachChild(node, visitor, context); + } + else { + return node; + } + } + function visitorForConvertedLoopWorker(node) { + var result; + if (shouldCheckNode(node)) { + result = visitJavaScript(node); + } + else { + result = visitNodesInConvertedLoop(node); + } + return result; + } + function visitNodesInConvertedLoop(node) { + switch (node.kind) { + case 216 /* ReturnStatement */: + node = isReturnVoidStatementInConstructorWithCapturedSuper(node) ? returnCapturedThis(node) : node; + return visitReturnStatement(node); + case 205 /* VariableStatement */: + return visitVariableStatement(node); + case 218 /* SwitchStatement */: + return visitSwitchStatement(node); + case 215 /* BreakStatement */: + case 214 /* ContinueStatement */: + return visitBreakOrContinueStatement(node); + case 98 /* ThisKeyword */: + return visitThisKeyword(node); + case 70 /* Identifier */: + return visitIdentifier(node); + default: + return ts.visitEachChild(node, visitor, context); + } + } + function visitJavaScript(node) { + switch (node.kind) { + case 114 /* StaticKeyword */: + return undefined; // elide static keyword + case 226 /* ClassDeclaration */: + return visitClassDeclaration(node); + case 197 /* ClassExpression */: + return visitClassExpression(node); + case 144 /* Parameter */: + return visitParameter(node); + case 225 /* FunctionDeclaration */: + return visitFunctionDeclaration(node); + case 185 /* ArrowFunction */: + return visitArrowFunction(node); + case 184 /* FunctionExpression */: + return visitFunctionExpression(node); + case 223 /* VariableDeclaration */: + return visitVariableDeclaration(node); + case 70 /* Identifier */: + return visitIdentifier(node); + case 224 /* VariableDeclarationList */: + return visitVariableDeclarationList(node); + case 219 /* LabeledStatement */: + return visitLabeledStatement(node); + case 209 /* DoStatement */: + return visitDoStatement(node); + case 210 /* WhileStatement */: + return visitWhileStatement(node); + case 211 /* ForStatement */: + return visitForStatement(node); + case 212 /* ForInStatement */: + return visitForInStatement(node); + case 213 /* ForOfStatement */: + return visitForOfStatement(node); + case 207 /* ExpressionStatement */: + return visitExpressionStatement(node); + case 176 /* ObjectLiteralExpression */: + return visitObjectLiteralExpression(node); + case 256 /* CatchClause */: + return visitCatchClause(node); + case 258 /* ShorthandPropertyAssignment */: + return visitShorthandPropertyAssignment(node); + case 175 /* ArrayLiteralExpression */: + return visitArrayLiteralExpression(node); + case 179 /* CallExpression */: + return visitCallExpression(node); + case 180 /* NewExpression */: + return visitNewExpression(node); + case 183 /* ParenthesizedExpression */: + return visitParenthesizedExpression(node, /*needsDestructuringValue*/ true); + case 192 /* BinaryExpression */: + return visitBinaryExpression(node, /*needsDestructuringValue*/ true); + case 12 /* NoSubstitutionTemplateLiteral */: + case 13 /* TemplateHead */: + case 14 /* TemplateMiddle */: + case 15 /* TemplateTail */: + return visitTemplateLiteral(node); + case 181 /* TaggedTemplateExpression */: + return visitTaggedTemplateExpression(node); + case 194 /* TemplateExpression */: + return visitTemplateExpression(node); + case 195 /* YieldExpression */: + return visitYieldExpression(node); + case 196 /* SpreadElement */: + return visitSpreadElement(node); + case 96 /* SuperKeyword */: + return visitSuperKeyword(); + case 195 /* YieldExpression */: + // `yield` will be handled by a generators transform. + return ts.visitEachChild(node, visitor, context); + case 149 /* MethodDeclaration */: + return visitMethodDeclaration(node); + case 205 /* VariableStatement */: + return visitVariableStatement(node); + default: + ts.Debug.failBadSyntaxKind(node); + return ts.visitEachChild(node, visitor, context); + } + } + 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); + var savedAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; + // for switch statement allow only non-labeled break + convertedLoopState.allowedNonLabeledJumps |= 2 /* Break */; + var result = ts.visitEachChild(node, visitor, context); + convertedLoopState.allowedNonLabeledJumps = savedAllowedNonLabeledJumps; + return result; + } + function visitReturnStatement(node) { + ts.Debug.assert(convertedLoopState !== undefined); + convertedLoopState.nonLocalJumps |= 8 /* Return */; + return ts.createReturn(ts.createObjectLiteral([ + ts.createPropertyAssignment(ts.createIdentifier("value"), node.expression + ? ts.visitNode(node.expression, visitor, ts.isExpression) + : ts.createVoidZero()) + ])); + } + function visitThisKeyword(node) { + ts.Debug.assert(convertedLoopState !== undefined); + if (enclosingFunction && enclosingFunction.kind === 185 /* ArrowFunction */) { + // if the enclosing function is an ArrowFunction is then we use the captured 'this' keyword. + convertedLoopState.containsLexicalThis = true; + return node; + } + return convertedLoopState.thisName || (convertedLoopState.thisName = ts.createUniqueName("this")); + } + function visitIdentifier(node) { + if (!convertedLoopState) { + return node; + } + if (ts.isGeneratedIdentifier(node)) { + return node; + } + if (node.text !== "arguments" && !resolver.isArgumentsLocalBinding(node)) { + return node; + } + return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = ts.createUniqueName("arguments")); + } + function visitBreakOrContinueStatement(node) { + if (convertedLoopState) { + // check if we can emit break/continue as is + // it is possible if either + // - break/continue is labeled and label is located inside the converted loop + // - break/continue is non-labeled and located in non-converted loop/switch statement + var jump = node.kind === 215 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */; + var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) || + (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); + if (!canUseBreakOrContinue) { + var labelMarker = void 0; + if (!node.label) { + if (node.kind === 215 /* BreakStatement */) { + convertedLoopState.nonLocalJumps |= 2 /* Break */; + labelMarker = "break"; + } + else { + convertedLoopState.nonLocalJumps |= 4 /* Continue */; + // note: return value is emitted only to simplify debugging, call to converted loop body does not do any dispatching on it. + labelMarker = "continue"; + } + } + else { + if (node.kind === 215 /* BreakStatement */) { + labelMarker = "break-" + node.label.text; + setLabeledJump(convertedLoopState, /*isBreak*/ true, node.label.text, labelMarker); + } + else { + labelMarker = "continue-" + node.label.text; + setLabeledJump(convertedLoopState, /*isBreak*/ false, node.label.text, labelMarker); + } + } + var returnExpression = ts.createLiteral(labelMarker); + if (convertedLoopState.loopOutParameters.length) { + var outParams = convertedLoopState.loopOutParameters; + var expr = void 0; + for (var i = 0; i < outParams.length; i++) { + var copyExpr = copyOutParameter(outParams[i], 1 /* ToOutParameter */); + if (i === 0) { + expr = copyExpr; + } + else { + expr = ts.createBinary(expr, 25 /* CommaToken */, copyExpr); + } + } + returnExpression = ts.createBinary(expr, 25 /* CommaToken */, returnExpression); + } + return ts.createReturn(returnExpression); + } + } + return ts.visitEachChild(node, visitor, context); + } + /** + * Visits a ClassDeclaration and transforms it into a variable statement. + * + * @param node A ClassDeclaration node. + */ + function visitClassDeclaration(node) { + // [source] + // class C { } + // + // [output] + // var C = (function () { + // function C() { + // } + // return C; + // }()); + var variable = ts.createVariableDeclaration(ts.getLocalName(node, /*allowComments*/ true), + /*type*/ undefined, transformClassLikeDeclarationToExpression(node)); + ts.setOriginalNode(variable, node); + var statements = []; + var statement = ts.createVariableStatement(/*modifiers*/ undefined, ts.createVariableDeclarationList([variable]), /*location*/ node); + ts.setOriginalNode(statement, node); + ts.startOnNewLine(statement); + statements.push(statement); + // Add an `export default` statement for default exports (for `--target es5 --module es6`) + if (ts.hasModifier(node, 1 /* Export */)) { + var exportStatement = ts.hasModifier(node, 512 /* Default */) + ? ts.createExportDefault(ts.getLocalName(node)) + : ts.createExternalModuleExport(ts.getLocalName(node)); + ts.setOriginalNode(exportStatement, statement); + statements.push(exportStatement); + } + var emitFlags = ts.getEmitFlags(node); + 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 | 2097152 /* HasEndOfDeclarationMarker */); + } + return ts.singleOrMany(statements); + } + /** + * Visits a ClassExpression and transforms it into an expression. + * + * @param node A ClassExpression node. + */ + function visitClassExpression(node) { + // [source] + // C = class { } + // + // [output] + // C = (function () { + // function class_1() { + // } + // return class_1; + // }()) + return transformClassLikeDeclarationToExpression(node); + } + /** + * Transforms a ClassExpression or ClassDeclaration into an expression. + * + * @param node A ClassExpression or ClassDeclaration node. + */ + function transformClassLikeDeclarationToExpression(node) { + // [source] + // class C extends D { + // constructor() {} + // method() {} + // get prop() {} + // set prop(v) {} + // } + // + // [output] + // (function (_super) { + // __extends(C, _super); + // function C() { + // } + // C.prototype.method = function () {} + // Object.defineProperty(C.prototype, "prop", { + // get: function() {}, + // set: function() {}, + // enumerable: true, + // configurable: true + // }); + // return C; + // }(D)) + if (node.name) { + enableSubstitutionsForBlockScopedBindings(); + } + var extendsClauseElement = ts.getClassExtendsHeritageClauseElement(node); + var classFunction = ts.createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, extendsClauseElement ? [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "_super")] : [], + /*type*/ undefined, transformClassBody(node, extendsClauseElement)); + // 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) & 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, 1536 /* NoComments */); + var outer = ts.createPartiallyEmittedExpression(inner); + outer.end = ts.skipTrivia(currentText, node.pos); + ts.setEmitFlags(outer, 1536 /* NoComments */); + return ts.createParen(ts.createCall(outer, + /*typeArguments*/ undefined, extendsClauseElement + ? [ts.visitNode(extendsClauseElement.expression, visitor, ts.isExpression)] + : [])); + } + /** + * Transforms a ClassExpression or ClassDeclaration into a function body. + * + * @param node A ClassExpression or ClassDeclaration node. + * @param extendsClauseElement The expression for the class `extends` clause. + */ + function transformClassBody(node, extendsClauseElement) { + var statements = []; + startLexicalEnvironment(); + addExtendsHelperIfNeeded(statements, node, extendsClauseElement); + addConstructor(statements, node, extendsClauseElement); + addClassMembers(statements, node); + // Create a synthetic text range for the return statement. + var closingBraceLocation = ts.createTokenRange(ts.skipTrivia(currentText, node.members.end), 17 /* CloseBraceToken */); + var localName = ts.getLocalName(node); + // The following partially-emitted expression exists purely to align our sourcemap + // emit with the original emitter. + var outer = ts.createPartiallyEmittedExpression(localName); + outer.end = closingBraceLocation.end; + ts.setEmitFlags(outer, 1536 /* NoComments */); + var statement = ts.createReturn(outer); + statement.pos = closingBraceLocation.pos; + 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, 1536 /* NoComments */); + return block; + } + /** + * Adds a call to the `__extends` helper if needed for a class. + * + * @param statements The statements of the class body function. + * @param node The ClassExpression or ClassDeclaration node. + * @param extendsClauseElement The expression for the class `extends` clause. + */ + function addExtendsHelperIfNeeded(statements, node, extendsClauseElement) { + if (extendsClauseElement) { + statements.push(ts.createStatement(createExtendsHelper(context, ts.getLocalName(node)), + /*location*/ extendsClauseElement)); + } + } + /** + * Adds the constructor of the class to a class body function. + * + * @param statements The statements of the class body function. + * @param node The ClassExpression or ClassDeclaration node. + * @param extendsClauseElement The expression for the class `extends` clause. + */ + function addConstructor(statements, node, extendsClauseElement) { + var constructor = ts.getFirstConstructorWithBody(node); + var hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined); + var constructorFunction = ts.createFunctionDeclaration( + /*decorators*/ undefined, + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, ts.getDeclarationName(node), + /*typeParameters*/ undefined, transformConstructorParameters(constructor, hasSynthesizedSuper), + /*type*/ undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper), + /*location*/ constructor || node); + if (extendsClauseElement) { + ts.setEmitFlags(constructorFunction, 8 /* CapturesThis */); + } + statements.push(constructorFunction); + } + /** + * Transforms the parameters of the constructor declaration of a class. + * + * @param constructor The constructor for the class. + * @param hasSynthesizedSuper A value indicating whether the constructor starts with a + * synthesized `super` call. + */ + function transformConstructorParameters(constructor, hasSynthesizedSuper) { + // If the TypeScript transformer needed to synthesize a constructor for property + // initializers, it would have also added a synthetic `...args` parameter and + // `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. + return ts.visitParameterList(constructor && !hasSynthesizedSuper && constructor.parameters, visitor, context) + || []; + } + /** + * Transforms the body of a constructor declaration of a class. + * + * @param constructor The constructor for the class. + * @param node The node which contains the constructor. + * @param extendsClauseElement The expression for the class `extends` clause. + * @param hasSynthesizedSuper A value indicating whether the constructor starts with a + * synthesized `super` call. + */ + function transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) { + var statements = []; + 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 = 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) { + addDefaultValueAssignmentsIfNeeded(statements, constructor); + addRestParameterIfNeeded(statements, constructor, hasSynthesizedSuper); + ts.Debug.assert(statementOffset >= 0, "statementOffset not initialized correctly!"); + } + // determine whether the class is known syntactically to be a derived class (e.g. a + // class that extends a value that is not syntactically known to be `null`). + var isDerivedClass = extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 94 /* NullKeyword */; + var superCaptureStatus = declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, constructor, isDerivedClass, hasSynthesizedSuper, statementOffset); + // The last statement expression was replaced. Skip it. + if (superCaptureStatus === 1 /* ReplaceSuperCapture */ || superCaptureStatus === 2 /* ReplaceWithReturn */) { + statementOffset++; + } + if (constructor) { + var body = saveStateAndInvoke(constructor, function (constructor) { + isInConstructorWithCapturedSuper = superCaptureStatus === 1 /* ReplaceSuperCapture */; + return ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, /*start*/ statementOffset); + }); + ts.addRange(statements, body); + } + // Return `_this` unless we're sure enough that it would be pointless to add a return statement. + // If there's a constructor that we can tell returns in enough places, then we *do not* want to add a return. + if (isDerivedClass + && superCaptureStatus !== 2 /* ReplaceWithReturn */ + && !(constructor && isSufficientlyCoveredByReturnStatements(constructor.body))) { + statements.push(ts.createReturn(ts.createIdentifier("_this"))); + } + ts.addRange(statements, endLexicalEnvironment()); + var block = ts.createBlock(ts.createNodeArray(statements, + /*location*/ constructor ? constructor.body.statements : node.members), + /*location*/ constructor ? constructor.body : node, + /*multiLine*/ true); + if (!constructor) { + ts.setEmitFlags(block, 1536 /* NoComments */); + } + return block; + } + /** + * We want to try to avoid emitting a return statement in certain cases if a user already returned something. + * It would generate obviously dead code, so we'll try to make things a little bit prettier + * by doing a minimal check on whether some common patterns always explicitly return. + */ + function isSufficientlyCoveredByReturnStatements(statement) { + // A return statement is considered covered. + if (statement.kind === 216 /* ReturnStatement */) { + return true; + } + else if (statement.kind === 208 /* IfStatement */) { + var ifStatement = statement; + if (ifStatement.elseStatement) { + return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && + isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement); + } + } + else if (statement.kind === 204 /* Block */) { + var lastStatement = ts.lastOrUndefined(statement.statements); + if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { + return true; + } + } + return false; + } + /** + * Declares a `_this` variable for derived classes and for when arrow functions capture `this`. + * + * @returns The new statement offset into the `statements` array. + */ + function declareOrCaptureOrReturnThisForConstructorIfNeeded(statements, ctor, isDerivedClass, hasSynthesizedSuper, statementOffset) { + // If this isn't a derived class, just capture 'this' for arrow functions if necessary. + if (!isDerivedClass) { + if (ctor) { + addCaptureThisForNodeIfNeeded(statements, ctor); + } + return 0 /* NoReplacement */; + } + // We must be here because the user didn't write a constructor + // but we needed to call 'super(...args)' anyway as per 14.5.14 of the ES2016 spec. + // If that's the case we can just immediately return the result of a 'super()' call. + if (!ctor) { + statements.push(ts.createReturn(createDefaultSuperCallOrThis())); + return 2 /* ReplaceWithReturn */; + } + // The constructor exists, but it and the 'super()' call it contains were generated + // for something like property initializers. + // Create a captured '_this' variable and assume it will subsequently be used. + if (hasSynthesizedSuper) { + captureThisForNode(statements, ctor, createDefaultSuperCallOrThis()); + enableSubstitutionsForCapturedThis(); + return 1 /* ReplaceSuperCapture */; + } + // Most of the time, a 'super' call will be the first real statement in a constructor body. + // In these cases, we'd like to transform these into a *single* statement instead of a declaration + // followed by an assignment statement for '_this'. For instance, if we emitted without an initializer, + // we'd get: + // + // var _this; + // _this = _super.call(...) || this; + // + // instead of + // + // var _this = _super.call(...) || this; + // + // Additionally, if the 'super()' call is the last statement, we should just avoid capturing + // entirely and immediately return the result like so: + // + // return _super.call(...) || this; + // + var firstStatement; + var superCallExpression; + var ctorStatements = ctor.body.statements; + if (statementOffset < ctorStatements.length) { + firstStatement = ctorStatements[statementOffset]; + if (firstStatement.kind === 207 /* ExpressionStatement */ && ts.isSuperCall(firstStatement.expression)) { + var superCall = firstStatement.expression; + superCallExpression = ts.setOriginalNode(saveStateAndInvoke(superCall, visitImmediateSuperCallInBody), superCall); + } + } + // Return the result if we have an immediate super() call on the last statement, + // but only if the constructor itself doesn't use 'this' elsewhere. + if (superCallExpression + && statementOffset === ctorStatements.length - 1 + && !(ctor.transformFlags & (16384 /* ContainsLexicalThis */ | 32768 /* ContainsCapturedLexicalThis */))) { + var returnStatement = ts.createReturn(superCallExpression); + if (superCallExpression.kind !== 192 /* BinaryExpression */ + || superCallExpression.left.kind !== 179 /* CallExpression */) { + 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, 1536 /* NoComments */))); + statements.push(returnStatement); + return 2 /* ReplaceWithReturn */; + } + // Perform the capture. + captureThisForNode(statements, ctor, superCallExpression || createActualThis(), firstStatement); + // If we're actually replacing the original statement, we need to signal this to the caller. + if (superCallExpression) { + return 1 /* ReplaceSuperCapture */; + } + return 0 /* NoReplacement */; + } + function createActualThis() { + return ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */); + } + function createDefaultSuperCallOrThis() { + return ts.createLogicalOr(ts.createLogicalAnd(ts.createStrictInequality(ts.createIdentifier("_super"), ts.createNull()), ts.createFunctionApply(ts.createIdentifier("_super"), createActualThis(), ts.createIdentifier("arguments"))), createActualThis()); + } + /** + * Visits a parameter declaration. + * + * @param node A ParameterDeclaration node. + */ + function visitParameter(node) { + if (node.dotDotDotToken) { + // rest parameters are elided + return undefined; + } + else if (ts.isBindingPattern(node.name)) { + // 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, + /*initializer*/ undefined, + /*location*/ node), + /*original*/ node); + } + else if (node.initializer) { + // Initializers are elided + return ts.setOriginalNode(ts.createParameter( + /*decorators*/ undefined, + /*modifiers*/ undefined, + /*dotDotDotToken*/ undefined, node.name, + /*questionToken*/ undefined, + /*type*/ undefined, + /*initializer*/ undefined, + /*location*/ node), + /*original*/ node); + } + else { + return node; + } + } + /** + * 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_36 = 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_36)) { + addDefaultValueAssignmentForBindingPattern(statements, parameter, name_36, initializer); + } + else if (initializer) { + addDefaultValueAssignmentForInitializer(statements, parameter, name_36, 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. + * + * @param statements The statements for the class body function. + * @param node The ClassExpression or ClassDeclaration node. + */ + function addClassMembers(statements, node) { + for (var _i = 0, _a = node.members; _i < _a.length; _i++) { + var member = _a[_i]; + switch (member.kind) { + case 203 /* SemicolonClassElement */: + statements.push(transformSemicolonClassElementToStatement(member)); + break; + case 149 /* MethodDeclaration */: + statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member)); + break; + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + var accessors = ts.getAllAccessorDeclarations(node.members, member); + if (member === accessors.firstAccessor) { + statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors)); + } + break; + case 150 /* Constructor */: + // Constructors are handled in visitClassExpression/visitClassDeclaration + break; + default: + ts.Debug.failBadSyntaxKind(node); + break; + } + } + } + /** + * Transforms a SemicolonClassElement into a statement for a class body function. + * + * @param member The SemicolonClassElement node. + */ + function transformSemicolonClassElementToStatement(member) { + return ts.createEmptyStatement(/*location*/ member); + } + /** + * Transforms a MethodDeclaration into a statement for a class body function. + * + * @param receiver The receiver for the member. + * @param member The MethodDeclaration node. + */ + function transformClassMethodDeclarationToStatement(receiver, member) { + var commentRange = ts.getCommentRange(member); + var sourceMapRange = ts.getSourceMapRange(member); + 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, 48 /* NoSourceMap */); + return statement; + } + /** + * Transforms a set of related of get/set accessors into a statement for a class body function. + * + * @param receiver The receiver for the member. + * @param accessors The set of related get/set accessors. + */ + function transformAccessorsToStatement(receiver, accessors) { + var statement = ts.createStatement(transformAccessorsToExpression(receiver, accessors, /*startsOnNewLine*/ false), + /*location*/ ts.getSourceMapRange(accessors.firstAccessor)); + // 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, 1536 /* NoComments */); + return statement; + } + /** + * Transforms a set of related get/set accessors into an expression for either a class + * body function or an ObjectLiteralExpression with computed properties. + * + * @param receiver The receiver for the member. + */ + function transformAccessorsToExpression(receiver, _a, startsOnNewLine) { + var firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor; + // 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, 1536 /* NoComments */ | 32 /* NoTrailingSourceMap */); + ts.setSourceMapRange(target, firstAccessor.name); + var propertyName = ts.createExpressionForPropertyName(ts.visitNode(firstAccessor.name, visitor, ts.isPropertyName)); + 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, 512 /* NoLeadingComments */); + var getter = ts.createPropertyAssignment("get", getterFunction); + ts.setCommentRange(getter, ts.getCommentRange(getAccessor)); + properties.push(getter); + } + if (setAccessor) { + var setterFunction = transformFunctionLikeToExpression(setAccessor, /*location*/ undefined, /*name*/ undefined); + ts.setSourceMapRange(setterFunction, ts.getSourceMapRange(setAccessor)); + ts.setEmitFlags(setterFunction, 512 /* NoLeadingComments */); + var setter = ts.createPropertyAssignment("set", setterFunction); + ts.setCommentRange(setter, ts.getCommentRange(setAccessor)); + properties.push(setter); + } + properties.push(ts.createPropertyAssignment("enumerable", ts.createLiteral(true)), ts.createPropertyAssignment("configurable", ts.createLiteral(true))); + var call = ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), + /*typeArguments*/ undefined, [ + target, + propertyName, + ts.createObjectLiteral(properties, /*location*/ undefined, /*multiLine*/ true) + ]); + if (startsOnNewLine) { + call.startsOnNewLine = true; + } + return call; + } + /** + * Visits an ArrowFunction and transforms it into a FunctionExpression. + * + * @param node An ArrowFunction node. + */ + function visitArrowFunction(node) { + if (node.transformFlags & 16384 /* ContainsLexicalThis */) { + enableSubstitutionsForCapturedThis(); + } + 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; + } + /** + * Visits a FunctionExpression node. + * + * @param node a FunctionExpression node. + */ + function visitFunctionExpression(node) { + 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. + * + * @param node a FunctionDeclaration node. + */ + function visitFunctionDeclaration(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. + * + * @param node The function-like node to transform. + * @param location The source-map location for the new FunctionExpression. + * @param name The name of the new FunctionExpression. + */ + function transformFunctionLikeToExpression(node, location, name) { + var savedContainingNonArrowFunction = enclosingNonArrowFunction; + if (node.kind !== 185 /* ArrowFunction */) { + enclosingNonArrowFunction = node; + } + var expression = ts.setOriginalNode(ts.createFunctionExpression( + /*modifiers*/ undefined, node.asteriskToken, name, + /*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. + */ + function visitExpressionStatement(node) { + // If we are here it is most likely because our expression is a destructuring assignment. + switch (node.expression.kind) { + case 183 /* ParenthesizedExpression */: + return ts.updateStatement(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false)); + case 192 /* BinaryExpression */: + return ts.updateStatement(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false)); + } + return ts.visitEachChild(node, visitor, context); + } + /** + * Visits a ParenthesizedExpression that may contain a destructuring assignment. + * + * @param node A ParenthesizedExpression node. + * @param needsDestructuringValue A value indicating whether we need to hold onto the rhs + * of a destructuring assignment. + */ + function visitParenthesizedExpression(node, needsDestructuringValue) { + // If we are here it is most likely because our expression is a destructuring assignment. + if (!needsDestructuringValue) { + switch (node.expression.kind) { + case 183 /* ParenthesizedExpression */: + return ts.updateParen(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false)); + case 192 /* BinaryExpression */: + return ts.updateParen(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false)); + } + } + return ts.visitEachChild(node, visitor, context); + } + /** + * Visits a BinaryExpression that contains a destructuring assignment. + * + * @param node A BinaryExpression node. + * @param needsDestructuringValue A value indicating whether we need to hold onto the rhs + * of a destructuring assignment. + */ + function visitBinaryExpression(node, needsDestructuringValue) { + // If we are here it is because this is a destructuring assignment. + 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) { + // we are inside a converted loop - hoist variable declarations + var assignments = void 0; + for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + hoistVariableDeclarationDeclaredInConvertedLoop(convertedLoopState, decl); + if (decl.initializer) { + var assignment = void 0; + if (ts.isBindingPattern(decl.name)) { + assignment = ts.flattenDestructuringAssignment(decl, visitor, context, 0 /* All */); + } + else { + assignment = ts.createBinary(decl.name, 57 /* EqualsToken */, ts.visitNode(decl.initializer, visitor, ts.isExpression)); + } + (assignments || (assignments = [])).push(assignment); + } + } + if (assignments) { + return ts.createStatement(ts.reduceLeft(assignments, function (acc, v) { return ts.createBinary(v, 25 /* CommaToken */, acc); }), node); + } + else { + // none of declarations has initializer - the entire variable statement can be deleted + return undefined; + } + } + return ts.visitEachChild(node, visitor, context); + } + /** + * Visits a VariableDeclarationList that is block scoped (e.g. `let` or `const`). + * + * @param node A VariableDeclarationList node. + */ + function visitVariableDeclarationList(node) { + if (node.flags & 3 /* BlockScoped */) { + enableSubstitutionsForBlockScopedBindings(); + } + var declarations = ts.flatten(ts.map(node.declarations, node.flags & 1 /* Let */ + ? visitVariableDeclarationInLetDeclarationList + : visitVariableDeclaration)); + var declarationList = ts.createVariableDeclarationList(declarations, /*location*/ node); + ts.setOriginalNode(declarationList, node); + ts.setCommentRange(declarationList, node); + 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 + // the source map range for the declaration list. + var firstDeclaration = ts.firstOrUndefined(declarations); + var lastDeclaration = ts.lastOrUndefined(declarations); + ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); + } + return declarationList; + } + /** + * Gets a value indicating whether we should emit an explicit initializer for a variable + * declaration in a `let` declaration list. + * + * @param node A VariableDeclaration node. + */ + function shouldEmitExplicitInitializerForLetDeclaration(node) { + // Nested let bindings might need to be initialized explicitly to preserve + // ES6 semantic: + // + // { let x = 1; } + // { let x; } // x here should be undefined. not 1 + // + // Top level bindings never collide with anything and thus don't require + // explicit initialization. As for nested let bindings there are two cases: + // + // - Nested let bindings that were not renamed definitely should be + // initialized explicitly: + // + // { let x = 1; } + // { let x; if (some-condition) { x = 1}; if (x) { /*1*/ } } + // + // Without explicit initialization code in /*1*/ can be executed even if + // some-condition is evaluated to false. + // + // - Renaming introduces fresh name that should not collide with any + // existing names, however renamed bindings sometimes also should be + // explicitly initialized. One particular case: non-captured binding + // declared inside loop body (but not in loop initializer): + // + // let x; + // for (;;) { + // let x; + // } + // + // In downlevel codegen inner 'x' will be renamed so it won't collide + // with outer 'x' however it will should be reset on every iteration as + // if it was declared anew. + // + // * Why non-captured binding? + // - Because if loop contains block scoped binding captured in some + // function then loop body will be rewritten to have a fresh scope + // on every iteration so everything will just work. + // + // * Why loop initializer is excluded? + // - Since we've introduced a fresh name it already will be undefined. + var flags = resolver.getNodeCheckFlags(node); + var isCapturedInFunction = flags & 131072 /* CapturedBlockScopedBinding */; + var isDeclaredInLoop = flags & 262144 /* BlockScopedBindingInLoop */; + var emittedAsTopLevel = ts.isBlockScopedContainerTopLevel(enclosingBlockScopeContainer) + || (isCapturedInFunction + && isDeclaredInLoop + && ts.isBlock(enclosingBlockScopeContainer) + && ts.isIterationStatement(enclosingBlockScopeContainerParent, /*lookInLabeledStatements*/ false)); + var emitExplicitInitializer = !emittedAsTopLevel + && enclosingBlockScopeContainer.kind !== 212 /* ForInStatement */ + && enclosingBlockScopeContainer.kind !== 213 /* ForOfStatement */ + && (!resolver.isDeclarationWithCollidingName(node) + || (isDeclaredInLoop + && !isCapturedInFunction + && !ts.isIterationStatement(enclosingBlockScopeContainer, /*lookInLabeledStatements*/ false))); + return emitExplicitInitializer; + } + /** + * Visits a VariableDeclaration in a `let` declaration list. + * + * @param node A VariableDeclaration node. + */ + function visitVariableDeclarationInLetDeclarationList(node) { + // For binding pattern names that lack initializers there is no point to emit + // explicit initializer since downlevel codegen for destructuring will fail + // in the absence of initializer so all binding elements will say uninitialized + var name = node.name; + if (ts.isBindingPattern(name)) { + return visitVariableDeclaration(node); + } + if (!node.initializer && shouldEmitExplicitInitializerForLetDeclaration(node)) { + var clone_3 = ts.getMutableClone(node); + clone_3.initializer = ts.createVoidZero(); + return clone_3; + } + 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. + if (ts.isBindingPattern(node.name)) { + 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); + } + function visitLabeledStatement(node) { + if (convertedLoopState) { + if (!convertedLoopState.labels) { + convertedLoopState.labels = ts.createMap(); + } + convertedLoopState.labels[node.label.text] = node.label.text; + } + var result; + if (ts.isIterationStatement(node.statement, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatementBody(node.statement)) { + result = ts.visitNodes(ts.createNodeArray([node.statement]), visitor, ts.isStatement); + } + else { + result = ts.visitEachChild(node, visitor, context); + } + if (convertedLoopState) { + convertedLoopState.labels[node.label.text] = undefined; + } + return result; + } + function visitDoStatement(node) { + return convertIterationStatementBodyIfNecessary(node); + } + function visitWhileStatement(node) { + return convertIterationStatementBodyIfNecessary(node); + } + function visitForStatement(node) { + return convertIterationStatementBodyIfNecessary(node); + } + function visitForInStatement(node) { + return convertIterationStatementBodyIfNecessary(node); + } + /** + * Visits a ForOfStatement and converts it into a compatible ForStatement. + * + * @param node A ForOfStatement. + */ + function visitForOfStatement(node) { + return convertIterationStatementBodyIfNecessary(node, convertForOfToFor); + } + function convertForOfToFor(node, convertedLoopBodyStatements) { + // 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. + * + * @param node An ObjectLiteralExpression node. + */ + function visitObjectLiteralExpression(node) { + // We are here because a ComputedPropertyName was used somewhere in the expression. + var properties = node.properties; + var numProperties = properties.length; + // Find the first computed property. + // Everything until that point can be emitted as part of the initial object literal. + var numInitialProperties = numProperties; + for (var i = 0; i < numProperties; i++) { + var property = properties[i]; + if (property.transformFlags & 16777216 /* ContainsYield */ + || property.name.kind === 142 /* ComputedPropertyName */) { + numInitialProperties = i; + break; + } + } + ts.Debug.assert(numInitialProperties !== numProperties); + // For computed properties, we need to create a unique handle to the object + // literal so we can modify it without risking internal assignments tainting the object. + var temp = ts.createTempVariable(hoistVariableDeclaration); + // 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), 32768 /* Indented */)); + if (node.multiLine) { + assignment.startsOnNewLine = true; + } + expressions.push(assignment); + addObjectLiteralMembers(expressions, node, temp, numInitialProperties); + // We need to clone the temporary identifier so that we can write it on a + // new line + expressions.push(node.multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp); + return ts.inlineExpressions(expressions); + } + function shouldConvertIterationStatementBody(node) { + return (resolver.getNodeCheckFlags(node) & 65536 /* LoopWithCapturedBlockScopedBinding */) !== 0; + } + /** + * Records constituents of name for the given variable to be hoisted in the outer scope. + */ + function hoistVariableDeclarationDeclaredInConvertedLoop(state, node) { + if (!state.hoistedLocalVariables) { + state.hoistedLocalVariables = []; + } + visit(node.name); + function visit(node) { + if (node.kind === 70 /* Identifier */) { + state.hoistedLocalVariables.push(node); + } + else { + for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (!ts.isOmittedExpression(element)) { + visit(element.name); + } } } } - return true; + } + function convertIterationStatementBodyIfNecessary(node, convert) { + if (!shouldConvertIterationStatementBody(node)) { + var saveAllowedNonLabeledJumps = void 0; + if (convertedLoopState) { + // we get here if we are trying to emit normal loop loop inside converted loop + // set allowedNonLabeledJumps to Break | Continue to mark that break\continue inside the loop should be emitted as is + saveAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; + convertedLoopState.allowedNonLabeledJumps = 2 /* Break */ | 4 /* Continue */; + } + var result = convert ? convert(node, /*convertedLoopBodyStatements*/ undefined) : ts.visitEachChild(node, visitor, context); + if (convertedLoopState) { + convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps; + } + return result; + } + var functionName = ts.createUniqueName("_loop"); + var loopInitializer; + switch (node.kind) { + case 211 /* ForStatement */: + case 212 /* ForInStatement */: + case 213 /* ForOfStatement */: + var initializer = node.initializer; + if (initializer && initializer.kind === 224 /* VariableDeclarationList */) { + loopInitializer = initializer; + } + break; + } + // variables that will be passed to the loop as parameters + var loopParameters = []; + // variables declared in the loop initializer that will be changed inside the loop + var loopOutParameters = []; + if (loopInitializer && (ts.getCombinedNodeFlags(loopInitializer) & 3 /* BlockScoped */)) { + for (var _i = 0, _a = loopInitializer.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + processLoopVariableDeclaration(decl, loopParameters, loopOutParameters); + } + } + var outerConvertedLoopState = convertedLoopState; + convertedLoopState = { loopOutParameters: loopOutParameters }; + if (outerConvertedLoopState) { + // convertedOuterLoopState !== undefined means that this converted loop is nested in another converted loop. + // if outer converted loop has already accumulated some state - pass it through + if (outerConvertedLoopState.argumentsName) { + // outer loop has already used 'arguments' so we've already have some name to alias it + // use the same name in all nested loops + convertedLoopState.argumentsName = outerConvertedLoopState.argumentsName; + } + if (outerConvertedLoopState.thisName) { + // outer loop has already used 'this' so we've already have some name to alias it + // use the same name in all nested loops + convertedLoopState.thisName = outerConvertedLoopState.thisName; + } + if (outerConvertedLoopState.hoistedLocalVariables) { + // we've already collected some non-block scoped variable declarations in enclosing loop + // use the same storage in nested loop + convertedLoopState.hoistedLocalVariables = outerConvertedLoopState.hoistedLocalVariables; + } + } + startLexicalEnvironment(); + var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, ts.liftToBlock); + var lexicalEnvironment = endLexicalEnvironment(); + var currentState = convertedLoopState; + convertedLoopState = outerConvertedLoopState; + if (loopOutParameters.length || lexicalEnvironment) { + var statements_4 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody]; + if (loopOutParameters.length) { + copyOutParameters(loopOutParameters, 1 /* ToOutParameter */, statements_4); + } + ts.addRange(statements_4, lexicalEnvironment); + loopBody = ts.createBlock(statements_4, /*location*/ undefined, /*multiline*/ true); + } + if (ts.isBlock(loopBody)) { + loopBody.multiLine = true; + } + else { + loopBody = ts.createBlock([loopBody], /*location*/ undefined, /*multiline*/ true); + } + var isAsyncBlockContainingAwait = enclosingNonArrowFunction + && (ts.getEmitFlags(enclosingNonArrowFunction) & 131072 /* AsyncFunctionBody */) !== 0 + && (node.statement.transformFlags & 16777216 /* ContainsYield */) !== 0; + var loopBodyFlags = 0; + if (currentState.containsLexicalThis) { + loopBodyFlags |= 8 /* CapturesThis */; + } + if (isAsyncBlockContainingAwait) { + loopBodyFlags |= 131072 /* AsyncFunctionBody */; + } + var convertedLoopVariable = ts.createVariableStatement( + /*modifiers*/ undefined, ts.setEmitFlags(ts.createVariableDeclarationList([ + ts.createVariableDeclaration(functionName, + /*type*/ undefined, ts.setEmitFlags(ts.createFunctionExpression( + /*modifiers*/ undefined, isAsyncBlockContainingAwait ? ts.createToken(38 /* AsteriskToken */) : undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, loopParameters, + /*type*/ undefined, loopBody), loopBodyFlags)) + ]), 1048576 /* NoHoisting */)); + var statements = [convertedLoopVariable]; + var extraVariableDeclarations; + // propagate state from the inner loop to the outer loop if necessary + if (currentState.argumentsName) { + // if alias for arguments is set + if (outerConvertedLoopState) { + // pass it to outer converted loop + outerConvertedLoopState.argumentsName = currentState.argumentsName; + } + else { + // this is top level converted loop and we need to create an alias for 'arguments' object + (extraVariableDeclarations || (extraVariableDeclarations = [])).push(ts.createVariableDeclaration(currentState.argumentsName, + /*type*/ undefined, ts.createIdentifier("arguments"))); + } + } + if (currentState.thisName) { + // if alias for this is set + if (outerConvertedLoopState) { + // pass it to outer converted loop + outerConvertedLoopState.thisName = currentState.thisName; + } + else { + // this is top level converted loop so we need to create an alias for 'this' here + // NOTE: + // if converted loops were all nested in arrow function then we'll always emit '_this' so convertedLoopState.thisName will not be set. + // If it is set this means that all nested loops are not nested in arrow function and it is safe to capture 'this'. + (extraVariableDeclarations || (extraVariableDeclarations = [])).push(ts.createVariableDeclaration(currentState.thisName, + /*type*/ undefined, ts.createIdentifier("this"))); + } + } + if (currentState.hoistedLocalVariables) { + // if hoistedLocalVariables !== undefined this means that we've possibly collected some variable declarations to be hoisted later + if (outerConvertedLoopState) { + // pass them to outer converted loop + outerConvertedLoopState.hoistedLocalVariables = currentState.hoistedLocalVariables; + } + else { + if (!extraVariableDeclarations) { + extraVariableDeclarations = []; + } + // hoist collected variable declarations + for (var _b = 0, _c = currentState.hoistedLocalVariables; _b < _c.length; _b++) { + var identifier = _c[_b]; + extraVariableDeclarations.push(ts.createVariableDeclaration(identifier)); + } + } + } + // add extra variables to hold out parameters if necessary + if (loopOutParameters.length) { + if (!extraVariableDeclarations) { + extraVariableDeclarations = []; + } + for (var _d = 0, loopOutParameters_1 = loopOutParameters; _d < loopOutParameters_1.length; _d++) { + var outParam = loopOutParameters_1[_d]; + extraVariableDeclarations.push(ts.createVariableDeclaration(outParam.outParamName)); + } + } + // create variable statement to hold all introduced variable declarations + if (extraVariableDeclarations) { + statements.push(ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList(extraVariableDeclarations))); + } + var convertedLoopBodyStatements = generateCallToConvertedLoop(functionName, loopParameters, currentState, isAsyncBlockContainingAwait); + var loop; + if (convert) { + loop = convert(node, convertedLoopBodyStatements); + } + else { + loop = ts.getMutableClone(node); + // clean statement part + loop.statement = undefined; + // visit childnodes to transform initializer/condition/incrementor parts + loop = ts.visitEachChild(loop, visitor, context); + // set loop statement + loop.statement = ts.createBlock(convertedLoopBodyStatements, + /*location*/ undefined, + /*multiline*/ true); + // reset and re-aggregate the transform flags + loop.transformFlags = 0; + ts.aggregateTransformFlags(loop); + } + statements.push(currentParent.kind === 219 /* LabeledStatement */ + ? ts.createLabel(currentParent.label, loop) + : loop); + return statements; + } + function copyOutParameter(outParam, copyDirection) { + var source = copyDirection === 0 /* ToOriginal */ ? outParam.outParamName : outParam.originalName; + var target = copyDirection === 0 /* ToOriginal */ ? outParam.originalName : outParam.outParamName; + return ts.createBinary(target, 57 /* EqualsToken */, source); + } + function copyOutParameters(outParams, copyDirection, statements) { + for (var _i = 0, outParams_1 = outParams; _i < outParams_1.length; _i++) { + var outParam = outParams_1[_i]; + statements.push(ts.createStatement(copyOutParameter(outParam, copyDirection))); + } + } + function generateCallToConvertedLoop(loopFunctionExpressionName, parameters, state, isAsyncBlockContainingAwait) { + var outerConvertedLoopState = convertedLoopState; + var statements = []; + // loop is considered simple if it does not have any return statements or break\continue that transfer control outside of the loop + // simple loops are emitted as just 'loop()'; + // NOTE: if loop uses only 'continue' it still will be emitted as simple loop + var isSimpleLoop = !(state.nonLocalJumps & ~4 /* Continue */) && + !state.labeledNonLocalBreaks && + !state.labeledNonLocalContinues; + var call = ts.createCall(loopFunctionExpressionName, /*typeArguments*/ undefined, ts.map(parameters, function (p) { return p.name; })); + var callResult = isAsyncBlockContainingAwait ? ts.createYield(ts.createToken(38 /* AsteriskToken */), call) : call; + if (isSimpleLoop) { + statements.push(ts.createStatement(callResult)); + copyOutParameters(state.loopOutParameters, 0 /* ToOriginal */, statements); + } + else { + var loopResultName = ts.createUniqueName("state"); + var stateVariable = ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList([ts.createVariableDeclaration(loopResultName, /*type*/ undefined, callResult)])); + statements.push(stateVariable); + copyOutParameters(state.loopOutParameters, 0 /* ToOriginal */, statements); + if (state.nonLocalJumps & 8 /* Return */) { + var returnStatement = void 0; + if (outerConvertedLoopState) { + outerConvertedLoopState.nonLocalJumps |= 8 /* Return */; + returnStatement = ts.createReturn(loopResultName); + } + else { + returnStatement = ts.createReturn(ts.createPropertyAccess(loopResultName, "value")); + } + statements.push(ts.createIf(ts.createBinary(ts.createTypeOf(loopResultName), 33 /* EqualsEqualsEqualsToken */, ts.createLiteral("object")), returnStatement)); + } + if (state.nonLocalJumps & 2 /* Break */) { + statements.push(ts.createIf(ts.createBinary(loopResultName, 33 /* EqualsEqualsEqualsToken */, ts.createLiteral("break")), ts.createBreak())); + } + if (state.labeledNonLocalBreaks || state.labeledNonLocalContinues) { + var caseClauses = []; + processLabeledJumps(state.labeledNonLocalBreaks, /*isBreak*/ true, loopResultName, outerConvertedLoopState, caseClauses); + processLabeledJumps(state.labeledNonLocalContinues, /*isBreak*/ false, loopResultName, outerConvertedLoopState, caseClauses); + statements.push(ts.createSwitch(loopResultName, ts.createCaseBlock(caseClauses))); + } + } + return statements; } function setLabeledJump(state, isBreak, labelText, labelMarker) { if (isBreak) { @@ -36911,7050 +51345,8644 @@ var ts; state.labeledNonLocalContinues[labelText] = labelMarker; } } - function hoistVariableDeclarationFromLoop(state, declaration) { - if (!state.hoistedLocalVariables) { - state.hoistedLocalVariables = []; + function processLabeledJumps(table, isBreak, loopResultName, outerLoop, caseClauses) { + if (!table) { + return; } - visit(declaration.name); - function visit(node) { - if (node.kind === 69 /* Identifier */) { - state.hoistedLocalVariables.push(node); + for (var labelText in table) { + var labelMarker = table[labelText]; + var statements = []; + // if there are no outer converted loop or outer label in question is located inside outer converted loop + // then emit labeled break\continue + // otherwise propagate pair 'label -> marker' to outer converted loop and emit 'return labelMarker' so outer loop can later decide what to do + if (!outerLoop || (outerLoop.labels && outerLoop.labels[labelText])) { + var label = ts.createIdentifier(labelText); + statements.push(isBreak ? ts.createBreak(label) : ts.createContinue(label)); } else { - for (var _a = 0, _b = node.elements; _a < _b.length; _a++) { - var element = _b[_a]; - visit(element.name); + setLabeledJump(outerLoop, isBreak, labelText, labelMarker); + statements.push(ts.createReturn(loopResultName)); + } + caseClauses.push(ts.createCaseClause(ts.createLiteral(labelMarker), statements)); + } + } + function processLoopVariableDeclaration(decl, loopParameters, loopOutParameters) { + var name = decl.name; + if (ts.isBindingPattern(name)) { + for (var _i = 0, _a = name.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (!ts.isOmittedExpression(element)) { + processLoopVariableDeclaration(element, loopParameters, loopOutParameters); + } + } + } + else { + loopParameters.push(ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, name)); + if (resolver.getNodeCheckFlags(decl) & 2097152 /* NeedsLoopOutParameter */) { + var outParamName = ts.createUniqueName("out_" + name.text); + loopOutParameters.push({ originalName: name, outParamName: outParamName }); + } + } + } + /** + * Adds the members of an object literal to an array of expressions. + * + * @param expressions An array of expressions. + * @param node An ObjectLiteralExpression node. + * @param receiver The receiver for members of the ObjectLiteralExpression. + * @param numInitialNonComputedProperties The number of initial properties without + * computed property names. + */ + function addObjectLiteralMembers(expressions, node, receiver, start) { + var properties = node.properties; + var numProperties = properties.length; + for (var i = start; i < numProperties; i++) { + var property = properties[i]; + switch (property.kind) { + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + var accessors = ts.getAllAccessorDeclarations(node.properties, property); + if (property === accessors.firstAccessor) { + expressions.push(transformAccessorsToExpression(receiver, accessors, node.multiLine)); + } + break; + case 257 /* PropertyAssignment */: + expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); + break; + case 258 /* ShorthandPropertyAssignment */: + expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); + break; + case 149 /* MethodDeclaration */: + expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node.multiLine)); + break; + default: + ts.Debug.failBadSyntaxKind(node); + break; + } + } + } + /** + * Transforms a PropertyAssignment node into an expression. + * + * @param node The ObjectLiteralExpression that contains the PropertyAssignment. + * @param property The PropertyAssignment node. + * @param receiver The receiver for the assignment. + */ + function transformPropertyAssignmentToExpression(property, receiver, startsOnNewLine) { + var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.visitNode(property.initializer, visitor, ts.isExpression), + /*location*/ property); + if (startsOnNewLine) { + expression.startsOnNewLine = true; + } + return expression; + } + /** + * Transforms a ShorthandPropertyAssignment node into an expression. + * + * @param node The ObjectLiteralExpression that contains the ShorthandPropertyAssignment. + * @param property The ShorthandPropertyAssignment node. + * @param receiver The receiver for the assignment. + */ + function transformShorthandPropertyAssignmentToExpression(property, receiver, startsOnNewLine) { + var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(property.name, visitor, ts.isPropertyName)), ts.getSynthesizedClone(property.name), + /*location*/ property); + if (startsOnNewLine) { + expression.startsOnNewLine = true; + } + return expression; + } + /** + * Transforms a MethodDeclaration of an ObjectLiteralExpression into an expression. + * + * @param node The ObjectLiteralExpression that contains the MethodDeclaration. + * @param method The MethodDeclaration node. + * @param receiver The receiver for the assignment. + */ + function transformObjectLiteralMethodDeclarationToExpression(method, receiver, startsOnNewLine) { + var expression = ts.createAssignment(ts.createMemberAccessForPropertyName(receiver, ts.visitNode(method.name, visitor, ts.isPropertyName)), transformFunctionLikeToExpression(method, /*location*/ method, /*name*/ undefined), + /*location*/ method); + if (startsOnNewLine) { + expression.startsOnNewLine = true; + } + return expression; + } + function visitCatchClause(node) { + 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.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)); + } + function addStatementToStartOfBlock(block, statement) { + var transformedStatements = ts.visitNodes(block.statements, visitor, ts.isStatement); + return ts.updateBlock(block, [statement].concat(transformedStatements)); + } + /** + * Visits a MethodDeclaration of an ObjectLiteralExpression and transforms it into a + * PropertyAssignment. + * + * @param node A MethodDeclaration node. + */ + function visitMethodDeclaration(node) { + // We should only get here for methods on an object literal with regular identifier names. + // Methods on classes are handled in visitClassDeclaration/visitClassExpression. + // 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, 512 /* NoLeadingComments */ | ts.getEmitFlags(functionExpression)); + return ts.createPropertyAssignment(node.name, functionExpression, + /*location*/ node); + } + /** + * Visits a ShorthandPropertyAssignment and transforms it into a PropertyAssignment. + * + * @param node A ShorthandPropertyAssignment node. + */ + function visitShorthandPropertyAssignment(node) { + return ts.createPropertyAssignment(node.name, ts.getSynthesizedClone(node.name), + /*location*/ node); + } + /** + * Visits a YieldExpression node. + * + * @param node A YieldExpression node. + */ + function visitYieldExpression(node) { + // `yield` expressions are transformed using the generators transformer. + return ts.visitEachChild(node, visitor, context); + } + /** + * Visits an ArrayLiteralExpression that contains a spread element. + * + * @param node An ArrayLiteralExpression node. + */ + function visitArrayLiteralExpression(node) { + // We are here because we contain a SpreadElementExpression. + return transformAndSpreadElements(node.elements, /*needsUniqueCopy*/ true, node.multiLine, /*hasTrailingComma*/ node.elements.hasTrailingComma); + } + /** + * Visits a CallExpression that contains either a spread element or `super`. + * + * @param node a CallExpression. + */ + function visitCallExpression(node) { + return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ true); + } + function visitImmediateSuperCallInBody(node) { + return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ false); + } + function visitCallExpressionWithPotentialCapturedThisAssignment(node, assignToCapturedThis) { + // We are here either because SuperKeyword was used somewhere in the expression, or + // 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, 4 /* NoSubstitution */); + } + var resultingCall; + if (node.transformFlags & 524288 /* ContainsSpread */) { + // [source] + // f(...a, b) + // x.m(...a, b) + // super(...a, b) + // super.m(...a, b) // in static + // super.m(...a, b) // in instance + // + // [output] + // f.apply(void 0, a.concat([b])) + // (_a = x).m.apply(_a, a.concat([b])) + // _super.apply(this, a.concat([b])) + // _super.m.apply(this, a.concat([b])) + // _super.prototype.m.apply(this, a.concat([b])) + resultingCall = ts.createFunctionApply(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false)); + } + else { + // [source] + // super(a) + // super.m(a) // in static + // super.m(a) // in instance + // + // [output] + // _super.call(this, a) + // _super.m.call(this, a) + // _super.prototype.m.call(this, a) + resultingCall = ts.createFunctionCall(ts.visitNode(target, visitor, ts.isExpression), ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression), + /*location*/ node); + } + if (node.expression.kind === 96 /* SuperKeyword */) { + var actualThis = ts.createThis(); + ts.setEmitFlags(actualThis, 4 /* NoSubstitution */); + var initializer = ts.createLogicalOr(resultingCall, actualThis); + return assignToCapturedThis + ? ts.createAssignment(ts.createIdentifier("_this"), initializer) + : initializer; + } + return resultingCall; + } + /** + * Visits a NewExpression that contains a spread element. + * + * @param node A NewExpression node. + */ + function visitNewExpression(node) { + // We are here because we contain a SpreadElementExpression. + ts.Debug.assert((node.transformFlags & 524288 /* ContainsSpread */) !== 0); + // [source] + // new C(...a) + // + // [output] + // new ((_a = C).bind.apply(_a, [void 0].concat(a)))() + 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)), /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false)), + /*typeArguments*/ undefined, []); + } + /** + * Transforms an array of Expression nodes that contains a SpreadExpression. + * + * @param elements The array of Expression nodes. + * @param needsUniqueCopy A value indicating whether to ensure that the result is a fresh array. + * @param multiLine A value indicating whether the result should be emitted on multiple lines. + */ + function transformAndSpreadElements(elements, needsUniqueCopy, multiLine, hasTrailingComma) { + // [source] + // [a, ...b, c] + // + // [output] + // [a].concat(b, [c]) + // Map spans of spread expressions into their expressions and spans of other + // expressions into an array literal. + var numElements = elements.length; + var segments = ts.flatten(ts.spanMap(elements, partitionSpread, function (partition, visitPartition, _start, end) { + return visitPartition(partition, multiLine, hasTrailingComma && end === numElements); + })); + if (segments.length === 1) { + var firstElement = elements[0]; + return needsUniqueCopy && ts.isSpreadExpression(firstElement) && firstElement.expression.kind !== 175 /* ArrayLiteralExpression */ + ? ts.createArraySlice(segments[0]) + : segments[0]; + } + // Rewrite using the pattern .concat(, , ...) + return ts.createArrayConcat(segments.shift(), segments); + } + function partitionSpread(node) { + return ts.isSpreadExpression(node) + ? visitSpanOfSpreads + : visitSpanOfNonSpreads; + } + function visitSpanOfSpreads(chunk) { + return ts.map(chunk, visitExpressionOfSpread); + } + function visitSpanOfNonSpreads(chunk, multiLine, hasTrailingComma) { + 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. + * + * @param node A SpreadExpression node. + */ + function visitExpressionOfSpread(node) { + return ts.visitNode(node.expression, visitor, ts.isExpression); + } + /** + * Visits a template literal. + * + * @param node A template literal. + */ + function visitTemplateLiteral(node) { + return ts.createLiteral(node.text, /*location*/ node); + } + /** + * Visits a TaggedTemplateExpression node. + * + * @param node A TaggedTemplateExpression node. + */ + function visitTaggedTemplateExpression(node) { + // Visit the tag expression + var tag = ts.visitNode(node.tag, visitor, ts.isExpression); + // Allocate storage for the template site object + var temp = ts.createTempVariable(hoistVariableDeclaration); + // Build up the template arguments and the raw and cooked strings for the template. + var templateArguments = [temp]; + var cookedStrings = []; + var rawStrings = []; + var template = node.template; + if (ts.isNoSubstitutionTemplateLiteral(template)) { + cookedStrings.push(ts.createLiteral(template.text)); + rawStrings.push(getRawLiteral(template)); + } + else { + cookedStrings.push(ts.createLiteral(template.head.text)); + rawStrings.push(getRawLiteral(template.head)); + for (var _i = 0, _a = template.templateSpans; _i < _a.length; _i++) { + var templateSpan = _a[_i]; + cookedStrings.push(ts.createLiteral(templateSpan.literal.text)); + rawStrings.push(getRawLiteral(templateSpan.literal)); + templateArguments.push(ts.visitNode(templateSpan.expression, visitor, ts.isExpression)); + } + } + // NOTE: The parentheses here is entirely optional as we are now able to auto- + // parenthesize when rebuilding the tree. This should be removed in a + // future version. It is here for now to match our existing emit. + return ts.createParen(ts.inlineExpressions([ + ts.createAssignment(temp, ts.createArrayLiteral(cookedStrings)), + ts.createAssignment(ts.createPropertyAccess(temp, "raw"), ts.createArrayLiteral(rawStrings)), + ts.createCall(tag, /*typeArguments*/ undefined, templateArguments) + ])); + } + /** + * Creates an ES5 compatible literal from an ES6 template literal. + * + * @param node The ES6 template literal. + */ + function getRawLiteral(node) { + // Find original source text, since we need to emit the raw strings of the tagged template. + // The raw strings contain the (escaped) strings of what the user wrote. + // Examples: `\n` is converted to "\\n", a template string with a newline to "\n". + var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); + // text contains the original source, it will also contain quotes ("`"), dolar signs and braces ("${" and "}"), + // thus we need to remove those characters. + // First template piece starts with "`", others with "}" + // Last template piece ends with "`", others with "${" + var isLast = node.kind === 12 /* NoSubstitutionTemplateLiteral */ || node.kind === 15 /* TemplateTail */; + text = text.substring(1, text.length - (isLast ? 1 : 2)); + // Newline normalization: + // ES6 Spec 11.8.6.1 - Static Semantics of TV's and TRV's + // and LineTerminatorSequences are normalized to for both TV and TRV. + text = text.replace(/\r\n?/g, "\n"); + return ts.createLiteral(text, /*location*/ node); + } + /** + * Visits a TemplateExpression node. + * + * @param node A TemplateExpression node. + */ + function visitTemplateExpression(node) { + var expressions = []; + addTemplateHead(expressions, node); + addTemplateSpans(expressions, node); + // createAdd will check if each expression binds less closely than binary '+'. + // If it does, it wraps the expression in parentheses. Otherwise, something like + // `abc${ 1 << 2 }` + // becomes + // "abc" + 1 << 2 + "" + // which is really + // ("abc" + 1) << (2 + "") + // rather than + // "abc" + (1 << 2) + "" + var expression = ts.reduceLeft(expressions, ts.createAdd); + if (ts.nodeIsSynthesized(expression)) { + ts.setTextRange(expression, node); + } + return expression; + } + /** + * Gets a value indicating whether we need to include the head of a TemplateExpression. + * + * @param node A TemplateExpression node. + */ + function shouldAddTemplateHead(node) { + // If this expression has an empty head literal and the first template span has a non-empty + // literal, then emitting the empty head literal is not necessary. + // `${ foo } and ${ bar }` + // can be emitted as + // foo + " and " + bar + // This is because it is only required that one of the first two operands in the emit + // output must be a string literal, so that the other operand and all following operands + // are forced into strings. + // + // If the first template span has an empty literal, then the head must still be emitted. + // `${ foo }${ bar }` + // must still be emitted as + // "" + foo + bar + // There is always atleast one templateSpan in this code path, since + // NoSubstitutionTemplateLiterals are directly emitted via emitLiteral() + ts.Debug.assert(node.templateSpans.length !== 0); + return node.head.text.length !== 0 || node.templateSpans[0].literal.text.length === 0; + } + /** + * Adds the head of a TemplateExpression to an array of expressions. + * + * @param expressions An array of expressions. + * @param node A TemplateExpression node. + */ + function addTemplateHead(expressions, node) { + if (!shouldAddTemplateHead(node)) { + return; + } + expressions.push(ts.createLiteral(node.head.text)); + } + /** + * Visits and adds the template spans of a TemplateExpression to an array of expressions. + * + * @param expressions An array of expressions. + * @param node A TemplateExpression node. + */ + function addTemplateSpans(expressions, node) { + for (var _i = 0, _a = node.templateSpans; _i < _a.length; _i++) { + var span_6 = _a[_i]; + expressions.push(ts.visitNode(span_6.expression, visitor, ts.isExpression)); + // Only emit if the literal is non-empty. + // The binary '+' operator is left-associative, so the first string concatenation + // with the head will force the result up to this point to be a string. + // Emitting a '+ ""' has no semantic effect for middles and tails. + if (span_6.literal.text.length !== 0) { + expressions.push(ts.createLiteral(span_6.literal.text)); + } + } + } + /** + * Visits the `super` keyword + */ + function visitSuperKeyword() { + return enclosingNonAsyncFunctionBody + && ts.isClassElement(enclosingNonAsyncFunctionBody) + && !ts.hasModifier(enclosingNonAsyncFunctionBody, 32 /* Static */) + && currentParent.kind !== 179 /* CallExpression */ + ? ts.createPropertyAccess(ts.createIdentifier("_super"), "prototype") + : ts.createIdentifier("_super"); + } + /** + * Called by the printer just before a node is printed. + * + * @param node The node to be printed. + */ + function onEmitNode(emitContext, node, emitCallback) { + var savedEnclosingFunction = enclosingFunction; + if (enabledSubstitutions & 1 /* CapturedThis */ && ts.isFunctionLike(node)) { + // If we are tracking a captured `this`, keep track of the enclosing function. + enclosingFunction = node; + } + previousOnEmitNode(emitContext, node, emitCallback); + enclosingFunction = savedEnclosingFunction; + } + /** + * Enables a more costly code path for substitutions when we determine a source file + * contains block-scoped bindings (e.g. `let` or `const`). + */ + function enableSubstitutionsForBlockScopedBindings() { + if ((enabledSubstitutions & 2 /* BlockScopedBindings */) === 0) { + enabledSubstitutions |= 2 /* BlockScopedBindings */; + context.enableSubstitution(70 /* Identifier */); + } + } + /** + * Enables a more costly code path for substitutions when we determine a source file + * contains a captured `this`. + */ + function enableSubstitutionsForCapturedThis() { + if ((enabledSubstitutions & 1 /* CapturedThis */) === 0) { + enabledSubstitutions |= 1 /* CapturedThis */; + context.enableSubstitution(98 /* ThisKeyword */); + context.enableEmitNotification(150 /* Constructor */); + context.enableEmitNotification(149 /* MethodDeclaration */); + context.enableEmitNotification(151 /* GetAccessor */); + context.enableEmitNotification(152 /* SetAccessor */); + context.enableEmitNotification(185 /* ArrowFunction */); + context.enableEmitNotification(184 /* FunctionExpression */); + context.enableEmitNotification(225 /* FunctionDeclaration */); + } + } + /** + * Hooks node substitutions. + * + * @param emitContext The context for the emitter. + * @param node The node to substitute. + */ + function onSubstituteNode(emitContext, node) { + node = previousOnSubstituteNode(emitContext, node); + if (emitContext === 1 /* Expression */) { + return substituteExpression(node); + } + if (ts.isIdentifier(node)) { + return substituteIdentifier(node); + } + return node; + } + /** + * Hooks substitutions for non-expression identifiers. + */ + function substituteIdentifier(node) { + // Only substitute the identifier if we have enabled substitutions for block-scoped + // bindings. + if (enabledSubstitutions & 2 /* BlockScopedBindings */) { + var original = ts.getParseTreeNode(node, ts.isIdentifier); + if (original && isNameOfDeclarationWithCollidingName(original)) { + return ts.getGeneratedNameForNode(original); + } + } + return node; + } + /** + * Determines whether a name is the name of a declaration with a colliding name. + * NOTE: This function expects to be called with an original source tree node. + * + * @param node An original source tree node. + */ + function isNameOfDeclarationWithCollidingName(node) { + var parent = node.parent; + switch (parent.kind) { + case 174 /* BindingElement */: + case 226 /* ClassDeclaration */: + case 229 /* EnumDeclaration */: + case 223 /* VariableDeclaration */: + return parent.name === node + && resolver.isDeclarationWithCollidingName(parent); + } + return false; + } + /** + * Substitutes an expression. + * + * @param node An Expression node. + */ + function substituteExpression(node) { + switch (node.kind) { + case 70 /* Identifier */: + return substituteExpressionIdentifier(node); + case 98 /* ThisKeyword */: + return substituteThisKeyword(node); + } + return node; + } + /** + * Substitutes an expression identifier. + * + * @param node An Identifier node. + */ + function substituteExpressionIdentifier(node) { + if (enabledSubstitutions & 2 /* BlockScopedBindings */) { + var declaration = resolver.getReferencedDeclarationWithCollidingName(node); + if (declaration) { + return ts.getGeneratedNameForNode(declaration.name); + } + } + return node; + } + /** + * Substitutes `this` when contained within an arrow function. + * + * @param node The ThisKeyword node. + */ + function substituteThisKeyword(node) { + if (enabledSubstitutions & 1 /* CapturedThis */ + && enclosingFunction + && ts.getEmitFlags(enclosingFunction) & 8 /* CapturesThis */) { + return ts.createIdentifier("_this", /*location*/ node); + } + return node; + } + function getClassMemberPrefix(node, member) { + var expression = ts.getLocalName(node); + return ts.hasModifier(member, 32 /* Static */) ? expression : ts.createPropertyAccess(expression, "prototype"); + } + function hasSynthesizedDefaultSuperCall(constructor, hasExtendsClause) { + if (!constructor || !hasExtendsClause) { + return false; + } + if (ts.some(constructor.parameters)) { + return false; + } + var statement = ts.firstOrUndefined(constructor.body.statements); + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 207 /* ExpressionStatement */) { + return false; + } + var statementExpression = statement.expression; + if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 179 /* CallExpression */) { + return false; + } + var callTarget = statementExpression.expression; + if (!ts.nodeIsSynthesized(callTarget) || callTarget.kind !== 96 /* SuperKeyword */) { + return false; + } + var callArgument = ts.singleOrUndefined(statementExpression.arguments); + if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 196 /* SpreadElement */) { + return false; + } + var expression = callArgument.expression; + 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 = {})); +/// +/// +// Transforms generator functions into a compatible ES5 representation with similar runtime +// semantics. This is accomplished by first transforming the body of each generator +// function into an intermediate representation that is the compiled into a JavaScript +// switch statement. +// +// Many functions in this transformer will contain comments indicating the expected +// intermediate representation. For illustrative purposes, the following intermediate +// language is used to define this intermediate representation: +// +// .nop - Performs no operation. +// .local NAME, ... - Define local variable declarations. +// .mark LABEL - Mark the location of a label. +// .br LABEL - Jump to a label. If jumping out of a protected +// region, all .finally blocks are executed. +// .brtrue LABEL, (x) - Jump to a label IIF the expression `x` is truthy. +// If jumping out of a protected region, all .finally +// blocks are executed. +// .brfalse LABEL, (x) - Jump to a label IIF the expression `x` is falsey. +// If jumping out of a protected region, all .finally +// blocks are executed. +// .yield (x) - Yield the value of the optional expression `x`. +// Resume at the next label. +// .yieldstar (x) - Delegate yield to the value of the optional +// expression `x`. Resume at the next label. +// NOTE: `x` must be an Iterator, not an Iterable. +// .loop CONTINUE, BREAK - Marks the beginning of a loop. Any "continue" or +// "break" abrupt completions jump to the CONTINUE or +// BREAK labels, respectively. +// .endloop - Marks the end of a loop. +// .with (x) - Marks the beginning of a WithStatement block, using +// the supplied expression. +// .endwith - Marks the end of a WithStatement. +// .switch - Marks the beginning of a SwitchStatement. +// .endswitch - Marks the end of a SwitchStatement. +// .labeled NAME - Marks the beginning of a LabeledStatement with the +// supplied name. +// .endlabeled - Marks the end of a LabeledStatement. +// .try TRY, CATCH, FINALLY, END - Marks the beginning of a protected region, and the +// labels for each block. +// .catch (x) - Marks the beginning of a catch block. +// .finally - Marks the beginning of a finally block. +// .endfinally - Marks the end of a finally block. +// .endtry - Marks the end of a protected region. +// .throw (x) - Throws the value of the expression `x`. +// .return (x) - Returns the value of the expression `x`. +// +// In addition, the illustrative intermediate representation introduces some special +// variables: +// +// %sent% - Either returns the next value sent to the generator, +// returns the result of a delegated yield, or throws +// the exception sent to the generator. +// %error% - Returns the value of the current exception in a +// catch block. +// +// This intermediate representation is then compiled into JavaScript syntax. The resulting +// compilation output looks something like the following: +// +// function f() { +// var /*locals*/; +// /*functions*/ +// return __generator(function (state) { +// switch (state.label) { +// /*cases per label*/ +// } +// }); +// } +// +// Each of the above instructions corresponds to JavaScript emit similar to the following: +// +// .local NAME | var NAME; +// -------------------------------|---------------------------------------------- +// .mark LABEL | case LABEL: +// -------------------------------|---------------------------------------------- +// .br LABEL | return [3 /*break*/, LABEL]; +// -------------------------------|---------------------------------------------- +// .brtrue LABEL, (x) | if (x) return [3 /*break*/, LABEL]; +// -------------------------------|---------------------------------------------- +// .brfalse LABEL, (x) | if (!(x)) return [3, /*break*/, LABEL]; +// -------------------------------|---------------------------------------------- +// .yield (x) | return [4 /*yield*/, x]; +// .mark RESUME | case RESUME: +// a = %sent%; | a = state.sent(); +// -------------------------------|---------------------------------------------- +// .yieldstar (x) | return [5 /*yield**/, x]; +// .mark RESUME | case RESUME: +// a = %sent%; | a = state.sent(); +// -------------------------------|---------------------------------------------- +// .with (_a) | with (_a) { +// a(); | a(); +// | } +// | state.label = LABEL; +// .mark LABEL | case LABEL: +// | with (_a) { +// b(); | b(); +// | } +// .endwith | +// -------------------------------|---------------------------------------------- +// | case 0: +// | state.trys = []; +// | ... +// .try TRY, CATCH, FINALLY, END | +// .mark TRY | case TRY: +// | state.trys.push([TRY, CATCH, FINALLY, END]); +// .nop | +// a(); | a(); +// .br END | return [3 /*break*/, END]; +// .catch (e) | +// .mark CATCH | case CATCH: +// | e = state.sent(); +// b(); | b(); +// .br END | return [3 /*break*/, END]; +// .finally | +// .mark FINALLY | case FINALLY: +// c(); | c(); +// .endfinally | return [7 /*endfinally*/]; +// .endtry | +// .mark END | case END: +/*@internal*/ +var ts; +(function (ts) { + var OpCode; + (function (OpCode) { + OpCode[OpCode["Nop"] = 0] = "Nop"; + OpCode[OpCode["Statement"] = 1] = "Statement"; + OpCode[OpCode["Assign"] = 2] = "Assign"; + OpCode[OpCode["Break"] = 3] = "Break"; + OpCode[OpCode["BreakWhenTrue"] = 4] = "BreakWhenTrue"; + OpCode[OpCode["BreakWhenFalse"] = 5] = "BreakWhenFalse"; + OpCode[OpCode["Yield"] = 6] = "Yield"; + OpCode[OpCode["YieldStar"] = 7] = "YieldStar"; + OpCode[OpCode["Return"] = 8] = "Return"; + OpCode[OpCode["Throw"] = 9] = "Throw"; + OpCode[OpCode["Endfinally"] = 10] = "Endfinally"; // Marks the end of a `finally` block + })(OpCode || (OpCode = {})); + // whether a generated code block is opening or closing at the current operation for a FunctionBuilder + var BlockAction; + (function (BlockAction) { + BlockAction[BlockAction["Open"] = 0] = "Open"; + BlockAction[BlockAction["Close"] = 1] = "Close"; + })(BlockAction || (BlockAction = {})); + // the kind for a generated code block in a FunctionBuilder + var CodeBlockKind; + (function (CodeBlockKind) { + CodeBlockKind[CodeBlockKind["Exception"] = 0] = "Exception"; + CodeBlockKind[CodeBlockKind["With"] = 1] = "With"; + CodeBlockKind[CodeBlockKind["Switch"] = 2] = "Switch"; + CodeBlockKind[CodeBlockKind["Loop"] = 3] = "Loop"; + CodeBlockKind[CodeBlockKind["Labeled"] = 4] = "Labeled"; + })(CodeBlockKind || (CodeBlockKind = {})); + // the state for a generated code exception block + var ExceptionBlockState; + (function (ExceptionBlockState) { + ExceptionBlockState[ExceptionBlockState["Try"] = 0] = "Try"; + ExceptionBlockState[ExceptionBlockState["Catch"] = 1] = "Catch"; + ExceptionBlockState[ExceptionBlockState["Finally"] = 2] = "Finally"; + ExceptionBlockState[ExceptionBlockState["Done"] = 3] = "Done"; + })(ExceptionBlockState || (ExceptionBlockState = {})); + // NOTE: changes to this enum should be reflected in the __generator helper. + var Instruction; + (function (Instruction) { + Instruction[Instruction["Next"] = 0] = "Next"; + Instruction[Instruction["Throw"] = 1] = "Throw"; + Instruction[Instruction["Return"] = 2] = "Return"; + Instruction[Instruction["Break"] = 3] = "Break"; + Instruction[Instruction["Yield"] = 4] = "Yield"; + Instruction[Instruction["YieldStar"] = 5] = "YieldStar"; + Instruction[Instruction["Catch"] = 6] = "Catch"; + Instruction[Instruction["Endfinally"] = 7] = "Endfinally"; + })(Instruction || (Instruction = {})); + var instructionNames = ts.createMap((_a = {}, + _a[2 /* Return */] = "return", + _a[3 /* Break */] = "break", + _a[4 /* Yield */] = "yield", + _a[5 /* YieldStar */] = "yield*", + _a[7 /* Endfinally */] = "endfinally", + _a)); + function transformGenerators(context) { + 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(); + var previousOnSubstituteNode = context.onSubstituteNode; + context.onSubstituteNode = onSubstituteNode; + var currentSourceFile; + var renamedCatchVariables; + var renamedCatchVariableDeclarations; + var inGeneratorFunctionBody; + var inStatementContainingYield; + // The following three arrays store information about generated code blocks. + // All three arrays are correlated by their index. This approach is used over allocating + // objects to store the same information to avoid GC overhead. + // + var blocks; // Information about the code block + var blockOffsets; // The operation offset at which a code block begins or ends + var blockActions; // Whether the code block is opened or closed + var blockStack; // A stack of currently open code blocks + // Labels are used to mark locations in the code that can be the target of a Break (jump) + // operation. These are translated into case clauses in a switch statement. + // The following two arrays are correlated by their index. This approach is used over + // allocating objects to store the same information to avoid GC overhead. + // + var labelOffsets; // The operation offset at which the label is defined. + var labelExpressions; // The NumericLiteral nodes bound to each label. + var nextLabelId = 1; // The next label id to use. + // Operations store information about generated code for the function body. This + // Includes things like statements, assignments, breaks (jumps), and yields. + // The following three arrays are correlated by their index. This approach is used over + // allocating objects to store the same information to avoid GC overhead. + // + var operations; // The operation to perform. + var operationArguments; // The arguments to the operation. + var operationLocations; // The source map location for the operation. + var state; // The name of the state object used by the generator at runtime. + // The following variables store information used by the `build` function: + // + var blockIndex = 0; // The index of the current block. + var labelNumber = 0; // The current label number. + var labelNumbers; + var lastOperationWasAbrupt; // Indicates whether the last operation was abrupt (break/continue). + var lastOperationWasCompletion; // Indicates whether the last operation was a completion (return/throw). + var clauses; // The case clauses generated for labels. + var statements; // The statements for the current label. + var exceptionBlockStack; // A stack of containing exception blocks. + var currentExceptionBlock; // The current exception block. + var withBlockStack; // A stack containing `with` blocks. + return transformSourceFile; + function transformSourceFile(node) { + if (ts.isDeclarationFile(node) + || (node.transformFlags & 512 /* ContainsGenerator */) === 0) { + return node; + } + currentSourceFile = node; + var visited = ts.visitEachChild(node, visitor, context); + ts.addEmitHelpers(visited, context.readEmitHelpers()); + currentSourceFile = undefined; + return visited; + } + /** + * Visits a node. + * + * @param node The node to visit. + */ + function visitor(node) { + var transformFlags = node.transformFlags; + if (inStatementContainingYield) { + return visitJavaScriptInStatementContainingYield(node); + } + else if (inGeneratorFunctionBody) { + return visitJavaScriptInGeneratorFunctionBody(node); + } + else if (transformFlags & 256 /* Generator */) { + return visitGenerator(node); + } + else if (transformFlags & 512 /* ContainsGenerator */) { + return ts.visitEachChild(node, visitor, context); + } + else { + return node; + } + } + /** + * Visits a node that is contained within a statement that contains yield. + * + * @param node The node to visit. + */ + function visitJavaScriptInStatementContainingYield(node) { + switch (node.kind) { + case 209 /* DoStatement */: + return visitDoStatement(node); + case 210 /* WhileStatement */: + return visitWhileStatement(node); + case 218 /* SwitchStatement */: + return visitSwitchStatement(node); + case 219 /* LabeledStatement */: + return visitLabeledStatement(node); + default: + return visitJavaScriptInGeneratorFunctionBody(node); + } + } + /** + * Visits a node that is contained within a generator function. + * + * @param node The node to visit. + */ + function visitJavaScriptInGeneratorFunctionBody(node) { + switch (node.kind) { + case 225 /* FunctionDeclaration */: + return visitFunctionDeclaration(node); + case 184 /* FunctionExpression */: + return visitFunctionExpression(node); + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + return visitAccessorDeclaration(node); + case 205 /* VariableStatement */: + return visitVariableStatement(node); + case 211 /* ForStatement */: + return visitForStatement(node); + case 212 /* ForInStatement */: + return visitForInStatement(node); + case 215 /* BreakStatement */: + return visitBreakStatement(node); + case 214 /* ContinueStatement */: + return visitContinueStatement(node); + case 216 /* ReturnStatement */: + return visitReturnStatement(node); + default: + if (node.transformFlags & 16777216 /* ContainsYield */) { + return visitJavaScriptContainingYield(node); + } + else if (node.transformFlags & (512 /* ContainsGenerator */ | 33554432 /* ContainsHoistedDeclarationOrCompletion */)) { + return ts.visitEachChild(node, visitor, context); + } + else { + return node; + } + } + } + /** + * Visits a node that contains a YieldExpression. + * + * @param node The node to visit. + */ + function visitJavaScriptContainingYield(node) { + switch (node.kind) { + case 192 /* BinaryExpression */: + return visitBinaryExpression(node); + case 193 /* ConditionalExpression */: + return visitConditionalExpression(node); + case 195 /* YieldExpression */: + return visitYieldExpression(node); + case 175 /* ArrayLiteralExpression */: + return visitArrayLiteralExpression(node); + case 176 /* ObjectLiteralExpression */: + return visitObjectLiteralExpression(node); + case 178 /* ElementAccessExpression */: + return visitElementAccessExpression(node); + case 179 /* CallExpression */: + return visitCallExpression(node); + case 180 /* NewExpression */: + return visitNewExpression(node); + default: + return ts.visitEachChild(node, visitor, context); + } + } + /** + * Visits a generator function. + * + * @param node The node to visit. + */ + function visitGenerator(node) { + switch (node.kind) { + case 225 /* FunctionDeclaration */: + return visitFunctionDeclaration(node); + case 184 /* FunctionExpression */: + return visitFunctionExpression(node); + default: + ts.Debug.failBadSyntaxKind(node); + return ts.visitEachChild(node, visitor, context); + } + } + /** + * Visits a function declaration. + * + * This will be called when one of the following conditions are met: + * - The function declaration is a generator function. + * - The function declaration is contained within the body of a generator function. + * + * @param node The node to visit. + */ + function visitFunctionDeclaration(node) { + // Currently, we only support generators that were originally async functions. + if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) { + node = ts.setOriginalNode(ts.createFunctionDeclaration( + /*decorators*/ undefined, node.modifiers, + /*asteriskToken*/ undefined, node.name, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, transformGeneratorFunctionBody(node.body), + /*location*/ node), node); + } + else { + var savedInGeneratorFunctionBody = inGeneratorFunctionBody; + var savedInStatementContainingYield = inStatementContainingYield; + inGeneratorFunctionBody = false; + inStatementContainingYield = false; + node = ts.visitEachChild(node, visitor, context); + inGeneratorFunctionBody = savedInGeneratorFunctionBody; + inStatementContainingYield = savedInStatementContainingYield; + } + if (inGeneratorFunctionBody) { + // Function declarations in a generator function body are hoisted + // to the top of the lexical scope and elided from the current statement. + hoistFunctionDeclaration(node); + return undefined; + } + else { + return node; + } + } + /** + * Visits a function expression. + * + * This will be called when one of the following conditions are met: + * - The function expression is a generator function. + * - The function expression is contained within the body of a generator function. + * + * @param node The node to visit. + */ + function visitFunctionExpression(node) { + // Currently, we only support generators that were originally async functions. + if (node.asteriskToken && ts.getEmitFlags(node) & 131072 /* AsyncFunctionBody */) { + node = ts.setOriginalNode(ts.createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, node.name, + /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, transformGeneratorFunctionBody(node.body), + /*location*/ node), node); + } + else { + var savedInGeneratorFunctionBody = inGeneratorFunctionBody; + var savedInStatementContainingYield = inStatementContainingYield; + inGeneratorFunctionBody = false; + inStatementContainingYield = false; + node = ts.visitEachChild(node, visitor, context); + inGeneratorFunctionBody = savedInGeneratorFunctionBody; + inStatementContainingYield = savedInStatementContainingYield; + } + return node; + } + /** + * Visits a get or set accessor declaration. + * + * This will be called when one of the following conditions are met: + * - The accessor is contained within the body of a generator function. + * + * @param node The node to visit. + */ + function visitAccessorDeclaration(node) { + var savedInGeneratorFunctionBody = inGeneratorFunctionBody; + var savedInStatementContainingYield = inStatementContainingYield; + inGeneratorFunctionBody = false; + inStatementContainingYield = false; + node = ts.visitEachChild(node, visitor, context); + inGeneratorFunctionBody = savedInGeneratorFunctionBody; + inStatementContainingYield = savedInStatementContainingYield; + return node; + } + /** + * Transforms the body of a generator function declaration. + * + * @param node The function body to transform. + */ + function transformGeneratorFunctionBody(body) { + // Save existing generator state + var statements = []; + var savedInGeneratorFunctionBody = inGeneratorFunctionBody; + var savedInStatementContainingYield = inStatementContainingYield; + var savedBlocks = blocks; + var savedBlockOffsets = blockOffsets; + var savedBlockActions = blockActions; + var savedBlockStack = blockStack; + var savedLabelOffsets = labelOffsets; + var savedLabelExpressions = labelExpressions; + var savedNextLabelId = nextLabelId; + var savedOperations = operations; + var savedOperationArguments = operationArguments; + var savedOperationLocations = operationLocations; + var savedState = state; + // Initialize generator state + inGeneratorFunctionBody = true; + inStatementContainingYield = false; + blocks = undefined; + blockOffsets = undefined; + blockActions = undefined; + blockStack = undefined; + labelOffsets = undefined; + labelExpressions = undefined; + nextLabelId = 1; + operations = undefined; + operationArguments = undefined; + operationLocations = undefined; + state = ts.createTempVariable(/*recordTempVariable*/ undefined); + // Build the generator + resumeLexicalEnvironment(); + var statementOffset = ts.addPrologueDirectives(statements, body.statements, /*ensureUseStrict*/ false, visitor); + transformAndEmitStatements(body.statements, statementOffset); + var buildResult = build(); + ts.addRange(statements, endLexicalEnvironment()); + statements.push(ts.createReturn(buildResult)); + // Restore previous generator state + inGeneratorFunctionBody = savedInGeneratorFunctionBody; + inStatementContainingYield = savedInStatementContainingYield; + blocks = savedBlocks; + blockOffsets = savedBlockOffsets; + blockActions = savedBlockActions; + blockStack = savedBlockStack; + labelOffsets = savedLabelOffsets; + labelExpressions = savedLabelExpressions; + nextLabelId = savedNextLabelId; + operations = savedOperations; + operationArguments = savedOperationArguments; + operationLocations = savedOperationLocations; + state = savedState; + return ts.createBlock(statements, /*location*/ body, body.multiLine); + } + /** + * Visits a variable statement. + * + * This will be called when one of the following conditions are met: + * - The variable statement is contained within the body of a generator function. + * + * @param node The node to visit. + */ + function visitVariableStatement(node) { + if (node.transformFlags & 16777216 /* ContainsYield */) { + transformAndEmitVariableDeclarationList(node.declarationList); + return undefined; + } + else { + // Do not hoist custom prologues. + if (ts.getEmitFlags(node) & 524288 /* CustomPrologue */) { + return node; + } + for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { + var variable = _a[_i]; + hoistVariableDeclaration(variable.name); + } + var variables = ts.getInitializedVariables(node.declarationList); + if (variables.length === 0) { + return undefined; + } + return ts.createStatement(ts.inlineExpressions(ts.map(variables, transformInitializedVariable))); + } + } + /** + * Visits a binary expression. + * + * This will be called when one of the following conditions are met: + * - The node contains a YieldExpression. + * + * @param node The node to visit. + */ + function visitBinaryExpression(node) { + switch (ts.getExpressionAssociativity(node)) { + case 0 /* Left */: + return visitLeftAssociativeBinaryExpression(node); + case 1 /* Right */: + return visitRightAssociativeBinaryExpression(node); + default: + ts.Debug.fail("Unknown associativity."); + } + } + function isCompoundAssignment(kind) { + return kind >= 58 /* FirstCompoundAssignment */ + && kind <= 69 /* LastCompoundAssignment */; + } + function getOperatorForCompoundAssignment(kind) { + switch (kind) { + case 58 /* PlusEqualsToken */: return 36 /* PlusToken */; + case 59 /* MinusEqualsToken */: return 37 /* MinusToken */; + case 60 /* AsteriskEqualsToken */: return 38 /* AsteriskToken */; + case 61 /* AsteriskAsteriskEqualsToken */: return 39 /* AsteriskAsteriskToken */; + case 62 /* SlashEqualsToken */: return 40 /* SlashToken */; + case 63 /* PercentEqualsToken */: return 41 /* PercentToken */; + case 64 /* LessThanLessThanEqualsToken */: return 44 /* LessThanLessThanToken */; + case 65 /* GreaterThanGreaterThanEqualsToken */: return 45 /* GreaterThanGreaterThanToken */; + case 66 /* GreaterThanGreaterThanGreaterThanEqualsToken */: return 46 /* GreaterThanGreaterThanGreaterThanToken */; + case 67 /* AmpersandEqualsToken */: return 47 /* AmpersandToken */; + case 68 /* BarEqualsToken */: return 48 /* BarToken */; + case 69 /* CaretEqualsToken */: return 49 /* CaretToken */; + } + } + /** + * Visits a right-associative binary expression containing `yield`. + * + * @param node The node to visit. + */ + function visitRightAssociativeBinaryExpression(node) { + var left = node.left, right = node.right; + if (containsYield(right)) { + var target = void 0; + switch (left.kind) { + case 177 /* PropertyAccessExpression */: + // [source] + // a.b = yield; + // + // [intermediate] + // .local _a + // _a = a; + // .yield resumeLabel + // .mark resumeLabel + // _a.b = %sent%; + target = ts.updatePropertyAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name); + break; + case 178 /* ElementAccessExpression */: + // [source] + // a[b] = yield; + // + // [intermediate] + // .local _a, _b + // _a = a; + // _b = b; + // .yield resumeLabel + // .mark resumeLabel + // _a[_b] = %sent%; + target = ts.updateElementAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), cacheExpression(ts.visitNode(left.argumentExpression, visitor, ts.isExpression))); + break; + default: + target = ts.visitNode(left, visitor, ts.isExpression); + break; + } + var operator = node.operatorToken.kind; + if (isCompoundAssignment(operator)) { + return ts.createBinary(target, 57 /* EqualsToken */, ts.createBinary(cacheExpression(target), getOperatorForCompoundAssignment(operator), ts.visitNode(right, visitor, ts.isExpression), node), node); + } + else { + return ts.updateBinary(node, target, ts.visitNode(right, visitor, ts.isExpression)); + } + } + return ts.visitEachChild(node, visitor, context); + } + function visitLeftAssociativeBinaryExpression(node) { + if (containsYield(node.right)) { + if (ts.isLogicalOperator(node.operatorToken.kind)) { + return visitLogicalBinaryExpression(node); + } + else if (node.operatorToken.kind === 25 /* CommaToken */) { + return visitCommaExpression(node); + } + // [source] + // a() + (yield) + c() + // + // [intermediate] + // .local _a + // _a = a(); + // .yield resumeLabel + // _a + %sent% + c() + 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); + } + /** + * Visits a logical binary expression containing `yield`. + * + * @param node A node to visit. + */ + function visitLogicalBinaryExpression(node) { + // Logical binary expressions (`&&` and `||`) are shortcutting expressions and need + // to be transformed as such: + // + // [source] + // x = a() && yield; + // + // [intermediate] + // .local _a + // _a = a(); + // .brfalse resultLabel, (_a) + // .yield resumeLabel + // .mark resumeLabel + // _a = %sent%; + // .mark resultLabel + // x = _a; + // + // [source] + // x = a() || yield; + // + // [intermediate] + // .local _a + // _a = a(); + // .brtrue resultLabel, (_a) + // .yield resumeLabel + // .mark resumeLabel + // _a = %sent%; + // .mark resultLabel + // x = _a; + var resultLabel = defineLabel(); + var resultLocal = declareLocal(); + emitAssignment(resultLocal, ts.visitNode(node.left, visitor, ts.isExpression), /*location*/ node.left); + if (node.operatorToken.kind === 52 /* AmpersandAmpersandToken */) { + // Logical `&&` shortcuts when the left-hand operand is falsey. + emitBreakWhenFalse(resultLabel, resultLocal, /*location*/ node.left); + } + else { + // Logical `||` shortcuts when the left-hand operand is truthy. + emitBreakWhenTrue(resultLabel, resultLocal, /*location*/ node.left); + } + emitAssignment(resultLocal, ts.visitNode(node.right, visitor, ts.isExpression), /*location*/ node.right); + markLabel(resultLabel); + return resultLocal; + } + /** + * Visits a comma expression containing `yield`. + * + * @param node The node to visit. + */ + function visitCommaExpression(node) { + // [source] + // x = a(), yield, b(); + // + // [intermediate] + // a(); + // .yield resumeLabel + // .mark resumeLabel + // x = %sent%, b(); + var pendingExpressions = []; + visit(node.left); + visit(node.right); + return ts.inlineExpressions(pendingExpressions); + function visit(node) { + if (ts.isBinaryExpression(node) && node.operatorToken.kind === 25 /* CommaToken */) { + visit(node.left); + visit(node.right); + } + else { + if (containsYield(node) && pendingExpressions.length > 0) { + emitWorker(1 /* Statement */, [ts.createStatement(ts.inlineExpressions(pendingExpressions))]); + pendingExpressions = []; + } + pendingExpressions.push(ts.visitNode(node, visitor, ts.isExpression)); + } + } + } + /** + * Visits a conditional expression containing `yield`. + * + * @param node The node to visit. + */ + function visitConditionalExpression(node) { + // [source] + // x = a() ? yield : b(); + // + // [intermediate] + // .local _a + // .brfalse whenFalseLabel, (a()) + // .yield resumeLabel + // .mark resumeLabel + // _a = %sent%; + // .br resultLabel + // .mark whenFalseLabel + // _a = b(); + // .mark resultLabel + // x = _a; + // We only need to perform a specific transformation if a `yield` expression exists + // in either the `whenTrue` or `whenFalse` branches. + // A `yield` in the condition will be handled by the normal visitor. + if (containsYield(node.whenTrue) || containsYield(node.whenFalse)) { + var whenFalseLabel = defineLabel(); + var resultLabel = defineLabel(); + var resultLocal = declareLocal(); + emitBreakWhenFalse(whenFalseLabel, ts.visitNode(node.condition, visitor, ts.isExpression), /*location*/ node.condition); + emitAssignment(resultLocal, ts.visitNode(node.whenTrue, visitor, ts.isExpression), /*location*/ node.whenTrue); + emitBreak(resultLabel); + markLabel(whenFalseLabel); + emitAssignment(resultLocal, ts.visitNode(node.whenFalse, visitor, ts.isExpression), /*location*/ node.whenFalse); + markLabel(resultLabel); + return resultLocal; + } + return ts.visitEachChild(node, visitor, context); + } + /** + * Visits a `yield` expression. + * + * @param node The node to visit. + */ + function visitYieldExpression(node) { + // [source] + // x = yield a(); + // + // [intermediate] + // .yield resumeLabel, (a()) + // .mark resumeLabel + // x = %sent%; + // NOTE: we are explicitly not handling YieldStar at this time. + var resumeLabel = defineLabel(); + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + if (node.asteriskToken) { + emitYieldStar(expression, /*location*/ node); + } + else { + emitYield(expression, /*location*/ node); + } + markLabel(resumeLabel); + return createGeneratorResume(/*location*/ node); + } + /** + * Visits an ArrayLiteralExpression that contains a YieldExpression. + * + * @param node The node to visit. + */ + function visitArrayLiteralExpression(node) { + return visitElements(node.elements, /*leadingElement*/ undefined, /*location*/ undefined, node.multiLine); + } + /** + * Visits an array of expressions containing one or more YieldExpression nodes + * and returns an expression for the resulting value. + * + * @param elements The elements to visit. + * @param multiLine Whether array literals created should be emitted on multiple lines. + */ + function visitElements(elements, leadingElement, location, multiLine) { + // [source] + // ar = [1, yield, 2]; + // + // [intermediate] + // .local _a + // _a = [1]; + // .yield resumeLabel + // .mark resumeLabel + // ar = _a.concat([%sent%, 2]); + var numInitialElements = countInitialNodesWithoutYield(elements); + var temp = declareLocal(); + var hasAssignedTemp = false; + if (numInitialElements > 0) { + 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, /*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, /*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)); + return expressions; + } + } + function visitObjectLiteralExpression(node) { + // [source] + // o = { + // a: 1, + // b: yield, + // c: 2 + // }; + // + // [intermediate] + // .local _a + // _a = { + // a: 1 + // }; + // .yield resumeLabel + // .mark resumeLabel + // o = (_a.b = %sent%, + // _a.c = 2, + // _a); + var properties = node.properties; + var multiLine = node.multiLine; + var numInitialProperties = countInitialNodesWithoutYield(properties); + var temp = declareLocal(); + emitAssignment(temp, ts.createObjectLiteral(ts.visitNodes(properties, visitor, ts.isObjectLiteralElementLike, 0, numInitialProperties), + /*location*/ undefined, multiLine)); + var expressions = ts.reduceLeft(properties, reduceProperty, [], numInitialProperties); + expressions.push(multiLine ? ts.startOnNewLine(ts.getMutableClone(temp)) : temp); + return ts.inlineExpressions(expressions); + function reduceProperty(expressions, property) { + if (containsYield(property) && expressions.length > 0) { + emitStatement(ts.createStatement(ts.inlineExpressions(expressions))); + expressions = []; + } + var expression = ts.createExpressionForObjectLiteralElementLike(node, property, temp); + var visited = ts.visitNode(expression, visitor, ts.isExpression); + if (visited) { + if (multiLine) { + visited.startsOnNewLine = true; + } + expressions.push(visited); + } + return expressions; + } + } + /** + * Visits an ElementAccessExpression that contains a YieldExpression. + * + * @param node The node to visit. + */ + function visitElementAccessExpression(node) { + if (containsYield(node.argumentExpression)) { + // [source] + // a = x[yield]; + // + // [intermediate] + // .local _a + // _a = x; + // .yield resumeLabel + // .mark resumeLabel + // a = _a[%sent%] + 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); + } + function visitCallExpression(node) { + if (ts.forEach(node.arguments, containsYield)) { + // [source] + // a.b(1, yield, 2); + // + // [intermediate] + // .local _a, _b, _c + // _b = (_a = a).b; + // _c = [1]; + // .yield resumeLabel + // .mark resumeLabel + // _b.apply(_a, _c.concat([%sent%, 2])); + var _a = ts.createCallBinding(node.expression, hoistVariableDeclaration, languageVersion, /*cacheIdentifiers*/ true), target = _a.target, thisArg = _a.thisArg; + return ts.setOriginalNode(ts.createFunctionApply(cacheExpression(ts.visitNode(target, visitor, ts.isLeftHandSideExpression)), thisArg, visitElements(node.arguments), + /*location*/ node), node); + } + return ts.visitEachChild(node, visitor, context); + } + function visitNewExpression(node) { + if (ts.forEach(node.arguments, containsYield)) { + // [source] + // new a.b(1, yield, 2); + // + // [intermediate] + // .local _a, _b, _c + // _b = (_a = a.b).bind; + // _c = [1]; + // .yield resumeLabel + // .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, + /*leadingElement*/ ts.createVoidZero())), + /*typeArguments*/ undefined, [], + /*location*/ node), node); + } + return ts.visitEachChild(node, visitor, context); + } + function transformAndEmitStatements(statements, start) { + if (start === void 0) { start = 0; } + var numStatements = statements.length; + for (var i = start; i < numStatements; i++) { + transformAndEmitStatement(statements[i]); + } + } + function transformAndEmitEmbeddedStatement(node) { + if (ts.isBlock(node)) { + transformAndEmitStatements(node.statements); + } + else { + transformAndEmitStatement(node); + } + } + function transformAndEmitStatement(node) { + var savedInStatementContainingYield = inStatementContainingYield; + if (!inStatementContainingYield) { + inStatementContainingYield = containsYield(node); + } + transformAndEmitStatementWorker(node); + inStatementContainingYield = savedInStatementContainingYield; + } + function transformAndEmitStatementWorker(node) { + switch (node.kind) { + case 204 /* Block */: + return transformAndEmitBlock(node); + case 207 /* ExpressionStatement */: + return transformAndEmitExpressionStatement(node); + case 208 /* IfStatement */: + return transformAndEmitIfStatement(node); + case 209 /* DoStatement */: + return transformAndEmitDoStatement(node); + case 210 /* WhileStatement */: + return transformAndEmitWhileStatement(node); + case 211 /* ForStatement */: + return transformAndEmitForStatement(node); + case 212 /* ForInStatement */: + return transformAndEmitForInStatement(node); + case 214 /* ContinueStatement */: + return transformAndEmitContinueStatement(node); + case 215 /* BreakStatement */: + return transformAndEmitBreakStatement(node); + case 216 /* ReturnStatement */: + return transformAndEmitReturnStatement(node); + case 217 /* WithStatement */: + return transformAndEmitWithStatement(node); + case 218 /* SwitchStatement */: + return transformAndEmitSwitchStatement(node); + case 219 /* LabeledStatement */: + return transformAndEmitLabeledStatement(node); + case 220 /* ThrowStatement */: + return transformAndEmitThrowStatement(node); + case 221 /* TryStatement */: + return transformAndEmitTryStatement(node); + default: + return emitStatement(ts.visitNode(node, visitor, ts.isStatement, /*optional*/ true)); + } + } + function transformAndEmitBlock(node) { + if (containsYield(node)) { + transformAndEmitStatements(node.statements); + } + else { + emitStatement(ts.visitNode(node, visitor, ts.isStatement)); + } + } + function transformAndEmitExpressionStatement(node) { + emitStatement(ts.visitNode(node, visitor, ts.isStatement)); + } + function transformAndEmitVariableDeclarationList(node) { + for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { + var variable = _a[_i]; + var name_37 = ts.getSynthesizedClone(variable.name); + ts.setCommentRange(name_37, variable.name); + hoistVariableDeclaration(name_37); + } + var variables = ts.getInitializedVariables(node); + var numVariables = variables.length; + var variablesWritten = 0; + var pendingExpressions = []; + while (variablesWritten < numVariables) { + for (var i = variablesWritten; i < numVariables; i++) { + var variable = variables[i]; + if (containsYield(variable.initializer) && pendingExpressions.length > 0) { + break; + } + pendingExpressions.push(transformInitializedVariable(variable)); + } + if (pendingExpressions.length) { + emitStatement(ts.createStatement(ts.inlineExpressions(pendingExpressions))); + variablesWritten += pendingExpressions.length; + pendingExpressions = []; + } + } + return undefined; + } + function transformInitializedVariable(node) { + return ts.createAssignment(ts.getSynthesizedClone(node.name), ts.visitNode(node.initializer, visitor, ts.isExpression)); + } + function transformAndEmitIfStatement(node) { + if (containsYield(node)) { + // [source] + // if (x) + // /*thenStatement*/ + // else + // /*elseStatement*/ + // + // [intermediate] + // .brfalse elseLabel, (x) + // /*thenStatement*/ + // .br endLabel + // .mark elseLabel + // /*elseStatement*/ + // .mark endLabel + if (containsYield(node.thenStatement) || containsYield(node.elseStatement)) { + var endLabel = defineLabel(); + var elseLabel = node.elseStatement ? defineLabel() : undefined; + emitBreakWhenFalse(node.elseStatement ? elseLabel : endLabel, ts.visitNode(node.expression, visitor, ts.isExpression), /*location*/ node.expression); + transformAndEmitEmbeddedStatement(node.thenStatement); + if (node.elseStatement) { + emitBreak(endLabel); + markLabel(elseLabel); + transformAndEmitEmbeddedStatement(node.elseStatement); + } + markLabel(endLabel); + } + else { + emitStatement(ts.visitNode(node, visitor, ts.isStatement)); + } + } + else { + emitStatement(ts.visitNode(node, visitor, ts.isStatement)); + } + } + function transformAndEmitDoStatement(node) { + if (containsYield(node)) { + // [source] + // do { + // /*body*/ + // } + // while (i < 10); + // + // [intermediate] + // .loop conditionLabel, endLabel + // .mark loopLabel + // /*body*/ + // .mark conditionLabel + // .brtrue loopLabel, (i < 10) + // .endloop + // .mark endLabel + var conditionLabel = defineLabel(); + var loopLabel = defineLabel(); + beginLoopBlock(/*continueLabel*/ conditionLabel); + markLabel(loopLabel); + transformAndEmitEmbeddedStatement(node.statement); + markLabel(conditionLabel); + emitBreakWhenTrue(loopLabel, ts.visitNode(node.expression, visitor, ts.isExpression)); + endLoopBlock(); + } + else { + emitStatement(ts.visitNode(node, visitor, ts.isStatement)); + } + } + function visitDoStatement(node) { + if (inStatementContainingYield) { + beginScriptLoopBlock(); + node = ts.visitEachChild(node, visitor, context); + endLoopBlock(); + return node; + } + else { + return ts.visitEachChild(node, visitor, context); + } + } + function transformAndEmitWhileStatement(node) { + if (containsYield(node)) { + // [source] + // while (i < 10) { + // /*body*/ + // } + // + // [intermediate] + // .loop loopLabel, endLabel + // .mark loopLabel + // .brfalse endLabel, (i < 10) + // /*body*/ + // .br loopLabel + // .endloop + // .mark endLabel + var loopLabel = defineLabel(); + var endLabel = beginLoopBlock(loopLabel); + markLabel(loopLabel); + emitBreakWhenFalse(endLabel, ts.visitNode(node.expression, visitor, ts.isExpression)); + transformAndEmitEmbeddedStatement(node.statement); + emitBreak(loopLabel); + endLoopBlock(); + } + else { + emitStatement(ts.visitNode(node, visitor, ts.isStatement)); + } + } + function visitWhileStatement(node) { + if (inStatementContainingYield) { + beginScriptLoopBlock(); + node = ts.visitEachChild(node, visitor, context); + endLoopBlock(); + return node; + } + else { + return ts.visitEachChild(node, visitor, context); + } + } + function transformAndEmitForStatement(node) { + if (containsYield(node)) { + // [source] + // for (var i = 0; i < 10; i++) { + // /*body*/ + // } + // + // [intermediate] + // .local i + // i = 0; + // .loop incrementLabel, endLoopLabel + // .mark conditionLabel + // .brfalse endLoopLabel, (i < 10) + // /*body*/ + // .mark incrementLabel + // i++; + // .br conditionLabel + // .endloop + // .mark endLoopLabel + var conditionLabel = defineLabel(); + var incrementLabel = defineLabel(); + var endLabel = beginLoopBlock(incrementLabel); + if (node.initializer) { + var initializer = node.initializer; + if (ts.isVariableDeclarationList(initializer)) { + transformAndEmitVariableDeclarationList(initializer); + } + else { + emitStatement(ts.createStatement(ts.visitNode(initializer, visitor, ts.isExpression), + /*location*/ initializer)); + } + } + markLabel(conditionLabel); + if (node.condition) { + emitBreakWhenFalse(endLabel, ts.visitNode(node.condition, visitor, ts.isExpression)); + } + transformAndEmitEmbeddedStatement(node.statement); + markLabel(incrementLabel); + if (node.incrementor) { + emitStatement(ts.createStatement(ts.visitNode(node.incrementor, visitor, ts.isExpression), + /*location*/ node.incrementor)); + } + emitBreak(conditionLabel); + endLoopBlock(); + } + else { + emitStatement(ts.visitNode(node, visitor, ts.isStatement)); + } + } + function visitForStatement(node) { + if (inStatementContainingYield) { + beginScriptLoopBlock(); + } + var initializer = node.initializer; + if (ts.isVariableDeclarationList(initializer)) { + for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) { + var variable = _a[_i]; + hoistVariableDeclaration(variable.name); + } + var variables = ts.getInitializedVariables(initializer); + node = ts.updateFor(node, variables.length > 0 + ? ts.inlineExpressions(ts.map(variables, transformInitializedVariable)) + : undefined, ts.visitNode(node.condition, visitor, ts.isExpression, /*optional*/ true), ts.visitNode(node.incrementor, visitor, ts.isExpression, /*optional*/ true), ts.visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, ts.liftToBlock)); + } + else { + node = ts.visitEachChild(node, visitor, context); + } + if (inStatementContainingYield) { + endLoopBlock(); + } + return node; + } + function transformAndEmitForInStatement(node) { + // TODO(rbuckton): Source map locations + if (containsYield(node)) { + // [source] + // for (var p in o) { + // /*body*/ + // } + // + // [intermediate] + // .local _a, _b, _i + // _a = []; + // for (_b in o) _a.push(_b); + // _i = 0; + // .loop incrementLabel, endLoopLabel + // .mark conditionLabel + // .brfalse endLoopLabel, (_i < _a.length) + // p = _a[_i]; + // /*body*/ + // .mark incrementLabel + // _b++; + // .br conditionLabel + // .endloop + // .mark endLoopLabel + var keysArray = declareLocal(); // _a + var key = declareLocal(); // _b + var keysIndex = ts.createLoopVariable(); // _i + var initializer = node.initializer; + hoistVariableDeclaration(keysIndex); + emitAssignment(keysArray, ts.createArrayLiteral()); + emitStatement(ts.createForIn(key, ts.visitNode(node.expression, visitor, ts.isExpression), ts.createStatement(ts.createCall(ts.createPropertyAccess(keysArray, "push"), + /*typeArguments*/ undefined, [key])))); + emitAssignment(keysIndex, ts.createLiteral(0)); + var conditionLabel = defineLabel(); + var incrementLabel = defineLabel(); + var endLabel = beginLoopBlock(incrementLabel); + markLabel(conditionLabel); + emitBreakWhenFalse(endLabel, ts.createLessThan(keysIndex, ts.createPropertyAccess(keysArray, "length"))); + var variable = void 0; + if (ts.isVariableDeclarationList(initializer)) { + for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) { + var variable_1 = _a[_i]; + hoistVariableDeclaration(variable_1.name); + } + variable = ts.getSynthesizedClone(initializer.declarations[0].name); + } + else { + variable = ts.visitNode(initializer, visitor, ts.isExpression); + ts.Debug.assert(ts.isLeftHandSideExpression(variable)); + } + emitAssignment(variable, ts.createElementAccess(keysArray, keysIndex)); + transformAndEmitEmbeddedStatement(node.statement); + markLabel(incrementLabel); + emitStatement(ts.createStatement(ts.createPostfixIncrement(keysIndex))); + emitBreak(conditionLabel); + endLoopBlock(); + } + else { + emitStatement(ts.visitNode(node, visitor, ts.isStatement)); + } + } + function visitForInStatement(node) { + // [source] + // for (var x in a) { + // /*body*/ + // } + // + // [intermediate] + // .local x + // .loop + // for (x in a) { + // /*body*/ + // } + // .endloop + if (inStatementContainingYield) { + beginScriptLoopBlock(); + } + var initializer = node.initializer; + if (ts.isVariableDeclarationList(initializer)) { + for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) { + var variable = _a[_i]; + hoistVariableDeclaration(variable.name); + } + node = ts.updateForIn(node, initializer.declarations[0].name, ts.visitNode(node.expression, visitor, ts.isExpression), ts.visitNode(node.statement, visitor, ts.isStatement, /*optional*/ false, ts.liftToBlock)); + } + else { + node = ts.visitEachChild(node, visitor, context); + } + if (inStatementContainingYield) { + endLoopBlock(); + } + return node; + } + function transformAndEmitContinueStatement(node) { + var label = findContinueTarget(node.label ? node.label.text : undefined); + ts.Debug.assert(label > 0, "Expected continue statment to point to a valid Label."); + emitBreak(label, /*location*/ node); + } + function visitContinueStatement(node) { + if (inStatementContainingYield) { + var label = findContinueTarget(node.label && node.label.text); + if (label > 0) { + return createInlineBreak(label, /*location*/ node); + } + } + return ts.visitEachChild(node, visitor, context); + } + function transformAndEmitBreakStatement(node) { + var label = findBreakTarget(node.label ? node.label.text : undefined); + ts.Debug.assert(label > 0, "Expected break statment to point to a valid Label."); + emitBreak(label, /*location*/ node); + } + function visitBreakStatement(node) { + if (inStatementContainingYield) { + var label = findBreakTarget(node.label && node.label.text); + if (label > 0) { + return createInlineBreak(label, /*location*/ node); + } + } + return ts.visitEachChild(node, visitor, context); + } + function transformAndEmitReturnStatement(node) { + emitReturn(ts.visitNode(node.expression, visitor, ts.isExpression, /*optional*/ true), + /*location*/ node); + } + function visitReturnStatement(node) { + return createInlineReturn(ts.visitNode(node.expression, visitor, ts.isExpression, /*optional*/ true), + /*location*/ node); + } + function transformAndEmitWithStatement(node) { + if (containsYield(node)) { + // [source] + // with (x) { + // /*body*/ + // } + // + // [intermediate] + // .with (x) + // /*body*/ + // .endwith + beginWithBlock(cacheExpression(ts.visitNode(node.expression, visitor, ts.isExpression))); + transformAndEmitEmbeddedStatement(node.statement); + endWithBlock(); + } + else { + emitStatement(ts.visitNode(node, visitor, ts.isStatement)); + } + } + function transformAndEmitSwitchStatement(node) { + if (containsYield(node.caseBlock)) { + // [source] + // switch (x) { + // case a: + // /*caseStatements*/ + // case b: + // /*caseStatements*/ + // default: + // /*defaultStatements*/ + // } + // + // [intermediate] + // .local _a + // .switch endLabel + // _a = x; + // switch (_a) { + // case a: + // .br clauseLabels[0] + // } + // switch (_a) { + // case b: + // .br clauseLabels[1] + // } + // .br clauseLabels[2] + // .mark clauseLabels[0] + // /*caseStatements*/ + // .mark clauseLabels[1] + // /*caseStatements*/ + // .mark clauseLabels[2] + // /*caseStatements*/ + // .endswitch + // .mark endLabel + var caseBlock = node.caseBlock; + var numClauses = caseBlock.clauses.length; + var endLabel = beginSwitchBlock(); + var expression = cacheExpression(ts.visitNode(node.expression, visitor, ts.isExpression)); + // Create labels for each clause and find the index of the first default clause. + var clauseLabels = []; + var defaultClauseIndex = -1; + for (var i = 0; i < numClauses; i++) { + var clause = caseBlock.clauses[i]; + clauseLabels.push(defineLabel()); + if (clause.kind === 254 /* DefaultClause */ && defaultClauseIndex === -1) { + defaultClauseIndex = i; + } + } + // Emit switch statements for each run of case clauses either from the first case + // clause or the next case clause with a `yield` in its expression, up to the next + // case clause with a `yield` in its expression. + var clausesWritten = 0; + var pendingClauses = []; + while (clausesWritten < numClauses) { + var defaultClausesSkipped = 0; + for (var i = clausesWritten; i < numClauses; i++) { + var clause = caseBlock.clauses[i]; + if (clause.kind === 253 /* CaseClause */) { + var caseClause = clause; + if (containsYield(caseClause.expression) && pendingClauses.length > 0) { + break; + } + pendingClauses.push(ts.createCaseClause(ts.visitNode(caseClause.expression, visitor, ts.isExpression), [ + createInlineBreak(clauseLabels[i], /*location*/ caseClause.expression) + ])); + } + else { + defaultClausesSkipped++; + } + } + if (pendingClauses.length) { + emitStatement(ts.createSwitch(expression, ts.createCaseBlock(pendingClauses))); + clausesWritten += pendingClauses.length; + pendingClauses = []; + } + if (defaultClausesSkipped > 0) { + clausesWritten += defaultClausesSkipped; + defaultClausesSkipped = 0; + } + } + if (defaultClauseIndex >= 0) { + emitBreak(clauseLabels[defaultClauseIndex]); + } + else { + emitBreak(endLabel); + } + for (var i = 0; i < numClauses; i++) { + markLabel(clauseLabels[i]); + transformAndEmitStatements(caseBlock.clauses[i].statements); + } + endSwitchBlock(); + } + else { + emitStatement(ts.visitNode(node, visitor, ts.isStatement)); + } + } + function visitSwitchStatement(node) { + if (inStatementContainingYield) { + beginScriptSwitchBlock(); + } + node = ts.visitEachChild(node, visitor, context); + if (inStatementContainingYield) { + endSwitchBlock(); + } + return node; + } + function transformAndEmitLabeledStatement(node) { + if (containsYield(node)) { + // [source] + // x: { + // /*body*/ + // } + // + // [intermediate] + // .labeled "x", endLabel + // /*body*/ + // .endlabeled + // .mark endLabel + beginLabeledBlock(node.label.text); + transformAndEmitEmbeddedStatement(node.statement); + endLabeledBlock(); + } + else { + emitStatement(ts.visitNode(node, visitor, ts.isStatement)); + } + } + function visitLabeledStatement(node) { + if (inStatementContainingYield) { + beginScriptLabeledBlock(node.label.text); + } + node = ts.visitEachChild(node, visitor, context); + if (inStatementContainingYield) { + endLabeledBlock(); + } + return node; + } + function transformAndEmitThrowStatement(node) { + emitThrow(ts.visitNode(node.expression, visitor, ts.isExpression), + /*location*/ node); + } + function transformAndEmitTryStatement(node) { + if (containsYield(node)) { + // [source] + // try { + // /*tryBlock*/ + // } + // catch (e) { + // /*catchBlock*/ + // } + // finally { + // /*finallyBlock*/ + // } + // + // [intermediate] + // .local _a + // .try tryLabel, catchLabel, finallyLabel, endLabel + // .mark tryLabel + // .nop + // /*tryBlock*/ + // .br endLabel + // .catch + // .mark catchLabel + // _a = %error%; + // /*catchBlock*/ + // .br endLabel + // .finally + // .mark finallyLabel + // /*finallyBlock*/ + // .endfinally + // .endtry + // .mark endLabel + beginExceptionBlock(); + transformAndEmitEmbeddedStatement(node.tryBlock); + if (node.catchClause) { + beginCatchBlock(node.catchClause.variableDeclaration); + transformAndEmitEmbeddedStatement(node.catchClause.block); + } + if (node.finallyBlock) { + beginFinallyBlock(); + transformAndEmitEmbeddedStatement(node.finallyBlock); + } + endExceptionBlock(); + } + else { + emitStatement(ts.visitEachChild(node, visitor, context)); + } + } + function containsYield(node) { + return node && (node.transformFlags & 16777216 /* ContainsYield */) !== 0; + } + function countInitialNodesWithoutYield(nodes) { + var numNodes = nodes.length; + for (var i = 0; i < numNodes; i++) { + if (containsYield(nodes[i])) { + return i; + } + } + return -1; + } + function onSubstituteNode(emitContext, node) { + node = previousOnSubstituteNode(emitContext, node); + if (emitContext === 1 /* Expression */) { + return substituteExpression(node); + } + return node; + } + function substituteExpression(node) { + if (ts.isIdentifier(node)) { + return substituteExpressionIdentifier(node); + } + return node; + } + function substituteExpressionIdentifier(node) { + if (renamedCatchVariables && ts.hasProperty(renamedCatchVariables, node.text)) { + var original = ts.getOriginalNode(node); + if (ts.isIdentifier(original) && original.parent) { + var declaration = resolver.getReferencedValueDeclaration(original); + if (declaration) { + 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; + } + } + } + } + return node; + } + function cacheExpression(node) { + var temp; + if (ts.isGeneratedIdentifier(node)) { + return node; + } + temp = ts.createTempVariable(hoistVariableDeclaration); + emitAssignment(temp, node, /*location*/ node); + return temp; + } + function declareLocal(name) { + var temp = name + ? ts.createUniqueName(name) + : ts.createTempVariable(/*recordTempVariable*/ undefined); + hoistVariableDeclaration(temp); + return temp; + } + /** + * Defines a label, uses as the target of a Break operation. + */ + function defineLabel() { + if (!labelOffsets) { + labelOffsets = []; + } + var label = nextLabelId; + nextLabelId++; + labelOffsets[label] = -1; + return label; + } + /** + * Marks the current operation with the specified label. + */ + function markLabel(label) { + ts.Debug.assert(labelOffsets !== undefined, "No labels were defined."); + labelOffsets[label] = operations ? operations.length : 0; + } + /** + * Begins a block operation (With, Break/Continue, Try/Catch/Finally) + * + * @param block Information about the block. + */ + function beginBlock(block) { + if (!blocks) { + blocks = []; + blockActions = []; + blockOffsets = []; + blockStack = []; + } + var index = blockActions.length; + blockActions[index] = 0 /* Open */; + blockOffsets[index] = operations ? operations.length : 0; + blocks[index] = block; + blockStack.push(block); + return index; + } + /** + * Ends the current block operation. + */ + function endBlock() { + var block = peekBlock(); + ts.Debug.assert(block !== undefined, "beginBlock was never called."); + var index = blockActions.length; + blockActions[index] = 1 /* Close */; + blockOffsets[index] = operations ? operations.length : 0; + blocks[index] = block; + blockStack.pop(); + return block; + } + /** + * Gets the current open block. + */ + function peekBlock() { + return ts.lastOrUndefined(blockStack); + } + /** + * Gets the kind of the current open block. + */ + function peekBlockKind() { + var block = peekBlock(); + return block && block.kind; + } + /** + * Begins a code block for a generated `with` statement. + * + * @param expression An identifier representing expression for the `with` block. + */ + function beginWithBlock(expression) { + var startLabel = defineLabel(); + var endLabel = defineLabel(); + markLabel(startLabel); + beginBlock({ + kind: 1 /* With */, + expression: expression, + startLabel: startLabel, + endLabel: endLabel + }); + } + /** + * Ends a code block for a generated `with` statement. + */ + function endWithBlock() { + ts.Debug.assert(peekBlockKind() === 1 /* With */); + var block = endBlock(); + markLabel(block.endLabel); + } + function isWithBlock(block) { + return block.kind === 1 /* With */; + } + /** + * Begins a code block for a generated `try` statement. + */ + function beginExceptionBlock() { + var startLabel = defineLabel(); + var endLabel = defineLabel(); + markLabel(startLabel); + beginBlock({ + kind: 0 /* Exception */, + state: 0 /* Try */, + startLabel: startLabel, + endLabel: endLabel + }); + emitNop(); + return endLabel; + } + /** + * Enters the `catch` clause of a generated `try` statement. + * + * @param variable The catch variable. + */ + function beginCatchBlock(variable) { + ts.Debug.assert(peekBlockKind() === 0 /* Exception */); + var text = variable.name.text; + var name = declareLocal(text); + if (!renamedCatchVariables) { + renamedCatchVariables = ts.createMap(); + renamedCatchVariableDeclarations = ts.createMap(); + context.enableSubstitution(70 /* Identifier */); + } + renamedCatchVariables[text] = true; + renamedCatchVariableDeclarations[ts.getOriginalNodeId(variable)] = name; + var exception = peekBlock(); + ts.Debug.assert(exception.state < 1 /* Catch */); + var endLabel = exception.endLabel; + emitBreak(endLabel); + var catchLabel = defineLabel(); + markLabel(catchLabel); + exception.state = 1 /* Catch */; + exception.catchVariable = name; + exception.catchLabel = catchLabel; + emitAssignment(name, ts.createCall(ts.createPropertyAccess(state, "sent"), /*typeArguments*/ undefined, [])); + emitNop(); + } + /** + * Enters the `finally` block of a generated `try` statement. + */ + function beginFinallyBlock() { + ts.Debug.assert(peekBlockKind() === 0 /* Exception */); + var exception = peekBlock(); + ts.Debug.assert(exception.state < 2 /* Finally */); + var endLabel = exception.endLabel; + emitBreak(endLabel); + var finallyLabel = defineLabel(); + markLabel(finallyLabel); + exception.state = 2 /* Finally */; + exception.finallyLabel = finallyLabel; + } + /** + * Ends the code block for a generated `try` statement. + */ + function endExceptionBlock() { + ts.Debug.assert(peekBlockKind() === 0 /* Exception */); + var exception = endBlock(); + var state = exception.state; + if (state < 2 /* Finally */) { + emitBreak(exception.endLabel); + } + else { + emitEndfinally(); + } + markLabel(exception.endLabel); + emitNop(); + exception.state = 3 /* Done */; + } + function isExceptionBlock(block) { + return block.kind === 0 /* Exception */; + } + /** + * Begins a code block that supports `break` or `continue` statements that are defined in + * the source tree and not from generated code. + * + * @param labelText Names from containing labeled statements. + */ + function beginScriptLoopBlock() { + beginBlock({ + kind: 3 /* Loop */, + isScript: true, + breakLabel: -1, + continueLabel: -1 + }); + } + /** + * Begins a code block that supports `break` or `continue` statements that are defined in + * generated code. Returns a label used to mark the operation to which to jump when a + * `break` statement targets this block. + * + * @param continueLabel A Label used to mark the operation to which to jump when a + * `continue` statement targets this block. + */ + function beginLoopBlock(continueLabel) { + var breakLabel = defineLabel(); + beginBlock({ + kind: 3 /* Loop */, + isScript: false, + breakLabel: breakLabel, + continueLabel: continueLabel + }); + return breakLabel; + } + /** + * Ends a code block that supports `break` or `continue` statements that are defined in + * generated code or in the source tree. + */ + function endLoopBlock() { + ts.Debug.assert(peekBlockKind() === 3 /* Loop */); + var block = endBlock(); + var breakLabel = block.breakLabel; + if (!block.isScript) { + markLabel(breakLabel); + } + } + /** + * Begins a code block that supports `break` statements that are defined in the source + * tree and not from generated code. + * + */ + function beginScriptSwitchBlock() { + beginBlock({ + kind: 2 /* Switch */, + isScript: true, + breakLabel: -1 + }); + } + /** + * Begins a code block that supports `break` statements that are defined in generated code. + * Returns a label used to mark the operation to which to jump when a `break` statement + * targets this block. + */ + function beginSwitchBlock() { + var breakLabel = defineLabel(); + beginBlock({ + kind: 2 /* Switch */, + isScript: false, + breakLabel: breakLabel + }); + return breakLabel; + } + /** + * Ends a code block that supports `break` statements that are defined in generated code. + */ + function endSwitchBlock() { + ts.Debug.assert(peekBlockKind() === 2 /* Switch */); + var block = endBlock(); + var breakLabel = block.breakLabel; + if (!block.isScript) { + markLabel(breakLabel); + } + } + function beginScriptLabeledBlock(labelText) { + beginBlock({ + kind: 4 /* Labeled */, + isScript: true, + labelText: labelText, + breakLabel: -1 + }); + } + function beginLabeledBlock(labelText) { + var breakLabel = defineLabel(); + beginBlock({ + kind: 4 /* Labeled */, + isScript: false, + labelText: labelText, + breakLabel: breakLabel + }); + } + function endLabeledBlock() { + ts.Debug.assert(peekBlockKind() === 4 /* Labeled */); + var block = endBlock(); + if (!block.isScript) { + markLabel(block.breakLabel); + } + } + /** + * Indicates whether the provided block supports `break` statements. + * + * @param block A code block. + */ + function supportsUnlabeledBreak(block) { + return block.kind === 2 /* Switch */ + || block.kind === 3 /* Loop */; + } + /** + * Indicates whether the provided block supports `break` statements with labels. + * + * @param block A code block. + */ + function supportsLabeledBreakOrContinue(block) { + return block.kind === 4 /* Labeled */; + } + /** + * Indicates whether the provided block supports `continue` statements. + * + * @param block A code block. + */ + function supportsUnlabeledContinue(block) { + return block.kind === 3 /* Loop */; + } + function hasImmediateContainingLabeledBlock(labelText, start) { + for (var j = start; j >= 0; j--) { + var containingBlock = blockStack[j]; + if (supportsLabeledBreakOrContinue(containingBlock)) { + if (containingBlock.labelText === labelText) { + return true; + } + } + else { + break; + } + } + return false; + } + /** + * Finds the label that is the target for a `break` statement. + * + * @param labelText An optional name of a containing labeled statement. + */ + function findBreakTarget(labelText) { + ts.Debug.assert(blocks !== undefined); + if (labelText) { + for (var i = blockStack.length - 1; i >= 0; i--) { + var block = blockStack[i]; + if (supportsLabeledBreakOrContinue(block) && block.labelText === labelText) { + return block.breakLabel; + } + else if (supportsUnlabeledBreak(block) && hasImmediateContainingLabeledBlock(labelText, i - 1)) { + return block.breakLabel; + } + } + } + else { + for (var i = blockStack.length - 1; i >= 0; i--) { + var block = blockStack[i]; + if (supportsUnlabeledBreak(block)) { + return block.breakLabel; + } + } + } + return 0; + } + /** + * Finds the label that is the target for a `continue` statement. + * + * @param labelText An optional name of a containing labeled statement. + */ + function findContinueTarget(labelText) { + ts.Debug.assert(blocks !== undefined); + if (labelText) { + for (var i = blockStack.length - 1; i >= 0; i--) { + var block = blockStack[i]; + if (supportsUnlabeledContinue(block) && hasImmediateContainingLabeledBlock(labelText, i - 1)) { + return block.continueLabel; + } + } + } + else { + for (var i = blockStack.length - 1; i >= 0; i--) { + var block = blockStack[i]; + if (supportsUnlabeledContinue(block)) { + return block.continueLabel; + } + } + } + return 0; + } + /** + * Creates an expression that can be used to indicate the value for a label. + * + * @param label A label. + */ + function createLabel(label) { + if (label > 0) { + if (labelExpressions === undefined) { + labelExpressions = []; + } + var expression = ts.createLiteral(-1); + if (labelExpressions[label] === undefined) { + labelExpressions[label] = [expression]; + } + else { + labelExpressions[label].push(expression); + } + return expression; + } + return ts.createOmittedExpression(); + } + /** + * Creates a numeric literal for the provided instruction. + */ + function createInstruction(instruction) { + var literal = ts.createLiteral(instruction); + literal.trailingComment = instructionNames[instruction]; + return literal; + } + /** + * Creates a statement that can be used indicate a Break operation to the provided label. + * + * @param label A label. + * @param location An optional source map location for the statement. + */ + function createInlineBreak(label, location) { + ts.Debug.assert(label > 0, "Invalid label: " + label); + return ts.createReturn(ts.createArrayLiteral([ + createInstruction(3 /* Break */), + createLabel(label) + ]), location); + } + /** + * Creates a statement that can be used indicate a Return operation. + * + * @param expression The expression for the return statement. + * @param location An optional source map location for the statement. + */ + function createInlineReturn(expression, location) { + return ts.createReturn(ts.createArrayLiteral(expression + ? [createInstruction(2 /* Return */), expression] + : [createInstruction(2 /* Return */)]), location); + } + /** + * Creates an expression that can be used to resume from a Yield operation. + */ + function createGeneratorResume(location) { + return ts.createCall(ts.createPropertyAccess(state, "sent"), /*typeArguments*/ undefined, [], location); + } + /** + * Emits an empty instruction. + */ + function emitNop() { + emitWorker(0 /* Nop */); + } + /** + * Emits a Statement. + * + * @param node A statement. + */ + function emitStatement(node) { + if (node) { + emitWorker(1 /* Statement */, [node]); + } + else { + emitNop(); + } + } + /** + * Emits an Assignment operation. + * + * @param left The left-hand side of the assignment. + * @param right The right-hand side of the assignment. + * @param location An optional source map location for the assignment. + */ + function emitAssignment(left, right, location) { + emitWorker(2 /* Assign */, [left, right], location); + } + /** + * Emits a Break operation to the specified label. + * + * @param label A label. + * @param location An optional source map location for the assignment. + */ + function emitBreak(label, location) { + emitWorker(3 /* Break */, [label], location); + } + /** + * Emits a Break operation to the specified label when a condition evaluates to a truthy + * value at runtime. + * + * @param label A label. + * @param condition The condition. + * @param location An optional source map location for the assignment. + */ + function emitBreakWhenTrue(label, condition, location) { + emitWorker(4 /* BreakWhenTrue */, [label, condition], location); + } + /** + * Emits a Break to the specified label when a condition evaluates to a falsey value at + * runtime. + * + * @param label A label. + * @param condition The condition. + * @param location An optional source map location for the assignment. + */ + function emitBreakWhenFalse(label, condition, location) { + emitWorker(5 /* BreakWhenFalse */, [label, condition], location); + } + /** + * Emits a YieldStar operation for the provided expression. + * + * @param expression An optional value for the yield operation. + * @param location An optional source map location for the assignment. + */ + function emitYieldStar(expression, location) { + emitWorker(7 /* YieldStar */, [expression], location); + } + /** + * Emits a Yield operation for the provided expression. + * + * @param expression An optional value for the yield operation. + * @param location An optional source map location for the assignment. + */ + function emitYield(expression, location) { + emitWorker(6 /* Yield */, [expression], location); + } + /** + * Emits a Return operation for the provided expression. + * + * @param expression An optional value for the operation. + * @param location An optional source map location for the assignment. + */ + function emitReturn(expression, location) { + emitWorker(8 /* Return */, [expression], location); + } + /** + * Emits a Throw operation for the provided expression. + * + * @param expression A value for the operation. + * @param location An optional source map location for the assignment. + */ + function emitThrow(expression, location) { + emitWorker(9 /* Throw */, [expression], location); + } + /** + * Emits an Endfinally operation. This is used to handle `finally` block semantics. + */ + function emitEndfinally() { + emitWorker(10 /* Endfinally */); + } + /** + * Emits an operation. + * + * @param code The OpCode for the operation. + * @param args The optional arguments for the operation. + */ + function emitWorker(code, args, location) { + if (operations === undefined) { + operations = []; + operationArguments = []; + operationLocations = []; + } + if (labelOffsets === undefined) { + // mark entry point + markLabel(defineLabel()); + } + var operationIndex = operations.length; + operations[operationIndex] = code; + operationArguments[operationIndex] = args; + operationLocations[operationIndex] = location; + } + /** + * Builds the generator function body. + */ + function build() { + blockIndex = 0; + labelNumber = 0; + labelNumbers = undefined; + lastOperationWasAbrupt = false; + lastOperationWasCompletion = false; + clauses = undefined; + statements = undefined; + exceptionBlockStack = undefined; + currentExceptionBlock = undefined; + withBlockStack = undefined; + var buildResult = buildStatements(); + 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. + */ + function buildStatements() { + if (operations) { + for (var operationIndex = 0; operationIndex < operations.length; operationIndex++) { + writeOperation(operationIndex); + } + flushFinalLabel(operations.length); + } + else { + flushFinalLabel(0); + } + if (clauses) { + var labelExpression = ts.createPropertyAccess(state, "label"); + var switchStatement = ts.createSwitch(labelExpression, ts.createCaseBlock(clauses)); + switchStatement.startsOnNewLine = true; + return [switchStatement]; + } + if (statements) { + return statements; + } + return []; + } + /** + * Flush the current label and advance to a new label. + */ + function flushLabel() { + if (!statements) { + return; + } + appendLabel(/*markLabelEnd*/ !lastOperationWasAbrupt); + lastOperationWasAbrupt = false; + lastOperationWasCompletion = false; + labelNumber++; + } + /** + * Flush the final label of the generator function body. + */ + function flushFinalLabel(operationIndex) { + if (isFinalLabelReachable(operationIndex)) { + tryEnterLabel(operationIndex); + withBlockStack = undefined; + writeReturn(/*expression*/ undefined, /*operationLocation*/ undefined); + } + if (statements && clauses) { + appendLabel(/*markLabelEnd*/ false); + } + updateLabelExpressions(); + } + /** + * Tests whether the final label of the generator function body + * is reachable by user code. + */ + function isFinalLabelReachable(operationIndex) { + // if the last operation was *not* a completion (return/throw) then + // the final label is reachable. + if (!lastOperationWasCompletion) { + return true; + } + // if there are no labels defined or referenced, then the final label is + // not reachable. + if (!labelOffsets || !labelExpressions) { + return false; + } + // if the label for this offset is referenced, then the final label + // is reachable. + for (var label = 0; label < labelOffsets.length; label++) { + if (labelOffsets[label] === operationIndex && labelExpressions[label]) { + return true; + } + } + return false; + } + /** + * Appends a case clause for the last label and sets the new label. + * + * @param markLabelEnd Indicates that the transition between labels was a fall-through + * from a previous case clause and the change in labels should be + * reflected on the `state` object. + */ + function appendLabel(markLabelEnd) { + if (!clauses) { + clauses = []; + } + if (statements) { + if (withBlockStack) { + // The previous label was nested inside one or more `with` blocks, so we + // surround the statements in generated `with` blocks to create the same environment. + for (var i = withBlockStack.length - 1; i >= 0; i--) { + var withBlock = withBlockStack[i]; + statements = [ts.createWith(withBlock.expression, ts.createBlock(statements))]; + } + } + if (currentExceptionBlock) { + // The previous label was nested inside of an exception block, so we must + // indicate entry into a protected region by pushing the label numbers + // for each block in the protected region. + var startLabel = currentExceptionBlock.startLabel, catchLabel = currentExceptionBlock.catchLabel, finallyLabel = currentExceptionBlock.finallyLabel, endLabel = currentExceptionBlock.endLabel; + statements.unshift(ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createPropertyAccess(state, "trys"), "push"), + /*typeArguments*/ undefined, [ + ts.createArrayLiteral([ + createLabel(startLabel), + createLabel(catchLabel), + createLabel(finallyLabel), + createLabel(endLabel) + ]) + ]))); + currentExceptionBlock = undefined; + } + if (markLabelEnd) { + // The case clause for the last label falls through to this label, so we + // add an assignment statement to reflect the change in labels. + statements.push(ts.createStatement(ts.createAssignment(ts.createPropertyAccess(state, "label"), ts.createLiteral(labelNumber + 1)))); + } + } + clauses.push(ts.createCaseClause(ts.createLiteral(labelNumber), statements || [])); + statements = undefined; + } + /** + * Tries to enter into a new label at the current operation index. + */ + function tryEnterLabel(operationIndex) { + if (!labelOffsets) { + return; + } + for (var label = 0; label < labelOffsets.length; label++) { + if (labelOffsets[label] === operationIndex) { + flushLabel(); + if (labelNumbers === undefined) { + labelNumbers = []; + } + if (labelNumbers[labelNumber] === undefined) { + labelNumbers[labelNumber] = [label]; + } + else { + labelNumbers[labelNumber].push(label); } } } } - function createFileEmitter() { - var writer = ts.createTextWriter(newLine); - var write = writer.write, writeTextOfNode = writer.writeTextOfNode, writeLine = writer.writeLine, increaseIndent = writer.increaseIndent, decreaseIndent = writer.decreaseIndent; - var sourceMap = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? ts.createSourceMapWriter(host, writer) : ts.getNullSourceMapWriter(); - var setSourceFile = sourceMap.setSourceFile, emitStart = sourceMap.emitStart, emitEnd = sourceMap.emitEnd, emitPos = sourceMap.emitPos; - var currentSourceFile; - var currentText; - var currentLineMap; - var currentFileIdentifiers; - var renamedDependencies; - var isEs6Module; - var isCurrentFileExternalModule; - // name of an exporter function if file is a System external module - // System.register([...], function () {...}) - // exporting in System modules looks like: - // export var x; ... x = 1 - // => - // var x;... exporter("x", x = 1) - var exportFunctionForFile; - var contextObjectForFile; - var generatedNameSet; - var nodeToGeneratedName; - var computedPropertyNamesToGeneratedNames; - var decoratedClassAliases; - var convertedLoopState; - var extendsEmitted; - var assignEmitted; - var decorateEmitted; - var paramEmitted; - var awaiterEmitted; - var tempFlags = 0; - var tempVariables; - var tempParameters; - var externalImports; - var exportSpecifiers; - var exportEquals; - var hasExportStarsToExportValues; - var detachedCommentsInfo; - /** Sourcemap data that will get encoded */ - var sourceMapData; - /** Is the file being emitted into its own file */ - var isOwnFileEmit; - /** If removeComments is true, no leading-comments needed to be emitted **/ - var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfPositionWorker; - var setSourceMapWriterEmit = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? changeSourceMapEmit : function (writer) { }; - var moduleEmitDelegates = ts.createMap((_a = {}, - _a[ts.ModuleKind.ES6] = emitES6Module, - _a[ts.ModuleKind.AMD] = emitAMDModule, - _a[ts.ModuleKind.System] = emitSystemModule, - _a[ts.ModuleKind.UMD] = emitUMDModule, - _a[ts.ModuleKind.CommonJS] = emitCommonJSModule, - _a - )); - var bundleEmitDelegates = ts.createMap((_b = {}, - _b[ts.ModuleKind.ES6] = function () { }, - _b[ts.ModuleKind.AMD] = emitAMDModule, - _b[ts.ModuleKind.System] = emitSystemModule, - _b[ts.ModuleKind.UMD] = function () { }, - _b[ts.ModuleKind.CommonJS] = function () { }, - _b - )); - return doEmit; - function doEmit(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit) { - sourceMap.initialize(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit); - generatedNameSet = ts.createMap(); - nodeToGeneratedName = []; - decoratedClassAliases = []; - isOwnFileEmit = !isBundledEmit; - // Emit helpers from all the files - if (isBundledEmit && modulekind) { - ts.forEach(sourceFiles, emitEmitHelpers); + /** + * Updates literal expressions for labels with actual label numbers. + */ + function updateLabelExpressions() { + if (labelExpressions !== undefined && labelNumbers !== undefined) { + for (var labelNumber_1 = 0; labelNumber_1 < labelNumbers.length; labelNumber_1++) { + var labels = labelNumbers[labelNumber_1]; + if (labels !== undefined) { + for (var _i = 0, labels_1 = labels; _i < labels_1.length; _i++) { + var label = labels_1[_i]; + var expressions = labelExpressions[label]; + if (expressions !== undefined) { + for (var _a = 0, expressions_1 = expressions; _a < expressions_1.length; _a++) { + var expression = expressions_1[_a]; + expression.text = String(labelNumber_1); + } + } + } + } } - // Do not call emit directly. It does not set the currentSourceFile. - ts.forEach(sourceFiles, emitSourceFile); - writeLine(); - var sourceMappingURL = sourceMap.getSourceMappingURL(); - if (sourceMappingURL) { - write("//# " + "sourceMappingURL" + "=" + sourceMappingURL); // Sometimes tools can sometimes see this line as a source mapping url comment + } + } + /** + * Tries to enter or leave a code block. + */ + function tryEnterOrLeaveBlock(operationIndex) { + if (blocks) { + for (; blockIndex < blockActions.length && blockOffsets[blockIndex] <= operationIndex; blockIndex++) { + var block = blocks[blockIndex]; + var blockAction = blockActions[blockIndex]; + if (isExceptionBlock(block)) { + if (blockAction === 0 /* Open */) { + if (!exceptionBlockStack) { + exceptionBlockStack = []; + } + if (!statements) { + statements = []; + } + exceptionBlockStack.push(currentExceptionBlock); + currentExceptionBlock = block; + } + else if (blockAction === 1 /* Close */) { + currentExceptionBlock = exceptionBlockStack.pop(); + } + } + else if (isWithBlock(block)) { + if (blockAction === 0 /* Open */) { + if (!withBlockStack) { + withBlockStack = []; + } + withBlockStack.push(block); + } + else if (blockAction === 1 /* Close */) { + withBlockStack.pop(); + } + } } - writeEmittedFiles(writer.getText(), jsFilePath, sourceMapFilePath, /*writeByteOrderMark*/ compilerOptions.emitBOM, sourceFiles); - // reset the state - sourceMap.reset(); - writer.reset(); + } + } + /** + * Writes an operation as a statement to the current label's statement list. + * + * @param operation The OpCode of the operation + */ + function writeOperation(operationIndex) { + tryEnterLabel(operationIndex); + tryEnterOrLeaveBlock(operationIndex); + // early termination, nothing else to process in this label + if (lastOperationWasAbrupt) { + return; + } + lastOperationWasAbrupt = false; + lastOperationWasCompletion = false; + var opcode = operations[operationIndex]; + if (opcode === 0 /* Nop */) { + return; + } + else if (opcode === 10 /* Endfinally */) { + return writeEndfinally(); + } + var args = operationArguments[operationIndex]; + if (opcode === 1 /* Statement */) { + return writeStatement(args[0]); + } + var location = operationLocations[operationIndex]; + switch (opcode) { + case 2 /* Assign */: + return writeAssign(args[0], args[1], location); + case 3 /* Break */: + return writeBreak(args[0], location); + case 4 /* BreakWhenTrue */: + return writeBreakWhenTrue(args[0], args[1], location); + case 5 /* BreakWhenFalse */: + return writeBreakWhenFalse(args[0], args[1], location); + case 6 /* Yield */: + return writeYield(args[0], location); + case 7 /* YieldStar */: + return writeYieldStar(args[0], location); + case 8 /* Return */: + return writeReturn(args[0], location); + case 9 /* Throw */: + return writeThrow(args[0], location); + } + } + /** + * Writes a statement to the current label's statement list. + * + * @param statement A statement to write. + */ + function writeStatement(statement) { + if (statement) { + if (!statements) { + statements = [statement]; + } + else { + statements.push(statement); + } + } + } + /** + * Writes an Assign operation to the current label's statement list. + * + * @param left The left-hand side of the assignment. + * @param right The right-hand side of the assignment. + * @param operationLocation The source map location for the operation. + */ + function writeAssign(left, right, operationLocation) { + writeStatement(ts.createStatement(ts.createAssignment(left, right), operationLocation)); + } + /** + * Writes a Throw operation to the current label's statement list. + * + * @param expression The value to throw. + * @param operationLocation The source map location for the operation. + */ + function writeThrow(expression, operationLocation) { + lastOperationWasAbrupt = true; + lastOperationWasCompletion = true; + writeStatement(ts.createThrow(expression, operationLocation)); + } + /** + * Writes a Return operation to the current label's statement list. + * + * @param expression The value to return. + * @param operationLocation The source map location for the operation. + */ + function writeReturn(expression, operationLocation) { + lastOperationWasAbrupt = true; + lastOperationWasCompletion = true; + writeStatement(ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral(expression + ? [createInstruction(2 /* Return */), expression] + : [createInstruction(2 /* Return */)]), operationLocation), 384 /* NoTokenSourceMaps */)); + } + /** + * Writes a Break operation to the current label's statement list. + * + * @param label The label for the Break. + * @param operationLocation The source map location for the operation. + */ + function writeBreak(label, operationLocation) { + lastOperationWasAbrupt = true; + writeStatement(ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral([ + createInstruction(3 /* Break */), + createLabel(label) + ]), operationLocation), 384 /* NoTokenSourceMaps */)); + } + /** + * Writes a BreakWhenTrue operation to the current label's statement list. + * + * @param label The label for the Break. + * @param condition The condition for the Break. + * @param operationLocation The source map location for the operation. + */ + function writeBreakWhenTrue(label, condition, operationLocation) { + writeStatement(ts.setEmitFlags(ts.createIf(condition, ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral([ + createInstruction(3 /* Break */), + createLabel(label) + ]), operationLocation), 384 /* NoTokenSourceMaps */)), 1 /* SingleLine */)); + } + /** + * Writes a BreakWhenFalse operation to the current label's statement list. + * + * @param label The label for the Break. + * @param condition The condition for the Break. + * @param operationLocation The source map location for the operation. + */ + function writeBreakWhenFalse(label, condition, operationLocation) { + writeStatement(ts.setEmitFlags(ts.createIf(ts.createLogicalNot(condition), ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral([ + createInstruction(3 /* Break */), + createLabel(label) + ]), operationLocation), 384 /* NoTokenSourceMaps */)), 1 /* SingleLine */)); + } + /** + * Writes a Yield operation to the current label's statement list. + * + * @param expression The expression to yield. + * @param operationLocation The source map location for the operation. + */ + function writeYield(expression, operationLocation) { + lastOperationWasAbrupt = true; + writeStatement(ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral(expression + ? [createInstruction(4 /* Yield */), expression] + : [createInstruction(4 /* Yield */)]), operationLocation), 384 /* NoTokenSourceMaps */)); + } + /** + * Writes a YieldStar instruction to the current label's statement list. + * + * @param expression The expression to yield. + * @param operationLocation The source map location for the operation. + */ + function writeYieldStar(expression, operationLocation) { + lastOperationWasAbrupt = true; + writeStatement(ts.setEmitFlags(ts.createReturn(ts.createArrayLiteral([ + createInstruction(5 /* YieldStar */), + expression + ]), operationLocation), 384 /* NoTokenSourceMaps */)); + } + /** + * Writes an Endfinally instruction to the current label's statement list. + */ + function writeEndfinally() { + lastOperationWasAbrupt = true; + writeStatement(ts.createReturn(ts.createArrayLiteral([ + createInstruction(7 /* Endfinally */) + ]))); + } + } + 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 = {})); +/// +/// +/*@internal*/ +var ts; +(function (ts) { + /** + * Transforms ES5 syntax into ES3 syntax. + * + * @param context Context and state information for the transformation. + */ + function transformES5(context) { + var compilerOptions = context.getCompilerOptions(); + // enable emit notification only if using --jsx preserve + var previousOnEmitNode; + var noSubstitution; + if (compilerOptions.jsx === 1 /* Preserve */) { + previousOnEmitNode = context.onEmitNode; + context.onEmitNode = onEmitNode; + context.enableEmitNotification(248 /* JsxOpeningElement */); + context.enableEmitNotification(249 /* JsxClosingElement */); + context.enableEmitNotification(247 /* JsxSelfClosingElement */); + noSubstitution = []; + } + var previousOnSubstituteNode = context.onSubstituteNode; + context.onSubstituteNode = onSubstituteNode; + context.enableSubstitution(177 /* PropertyAccessExpression */); + context.enableSubstitution(257 /* PropertyAssignment */); + return transformSourceFile; + /** + * Transforms an ES5 source file to ES3. + * + * @param node A SourceFile + */ + function transformSourceFile(node) { + return node; + } + /** + * Called by the printer just before a node is printed. + * + * @param node The node to be printed. + */ + function onEmitNode(emitContext, node, emitCallback) { + switch (node.kind) { + case 248 /* JsxOpeningElement */: + case 249 /* JsxClosingElement */: + case 247 /* JsxSelfClosingElement */: + var tagName = node.tagName; + noSubstitution[ts.getOriginalNodeId(tagName)] = true; + break; + } + previousOnEmitNode(emitContext, node, emitCallback); + } + /** + * Hooks node substitutions. + * + * @param emitContext The context for the emitter. + * @param node The node to substitute. + */ + function onSubstituteNode(emitContext, node) { + if (node.id && noSubstitution && noSubstitution[node.id]) { + return previousOnSubstituteNode(emitContext, node); + } + node = previousOnSubstituteNode(emitContext, node); + if (ts.isPropertyAccessExpression(node)) { + return substitutePropertyAccessExpression(node); + } + else if (ts.isPropertyAssignment(node)) { + return substitutePropertyAssignment(node); + } + return node; + } + /** + * Substitutes a PropertyAccessExpression whose name is a reserved word. + * + * @param node A PropertyAccessExpression + */ + function substitutePropertyAccessExpression(node) { + var literalName = trySubstituteReservedName(node.name); + if (literalName) { + return ts.createElementAccess(node.expression, literalName, /*location*/ node); + } + return node; + } + /** + * Substitutes a PropertyAssignment whose name is a reserved word. + * + * @param node A PropertyAssignment + */ + function substitutePropertyAssignment(node) { + var literalName = ts.isIdentifier(node.name) && trySubstituteReservedName(node.name); + if (literalName) { + return ts.updatePropertyAssignment(node, literalName, node.initializer); + } + return node; + } + /** + * If an identifier name is a reserved word, returns a string literal for the name. + * + * @param name An Identifier + */ + function trySubstituteReservedName(name) { + var token = name.originalKeywordKind || (ts.nodeIsSynthesized(name) ? ts.stringToToken(name.text) : undefined); + if (token >= 71 /* FirstReservedWord */ && token <= 106 /* LastReservedWord */) { + return ts.createLiteral(name, /*location*/ name); + } + return undefined; + } + } + ts.transformES5 = transformES5; +})(ts || (ts = {})); +/// +/// +/*@internal*/ +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) { + 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; + } + function visitor(node) { + switch (node.kind) { + case 234 /* ImportEqualsDeclaration */: + // Elide `import=` as it is not legal with --module ES6 + return undefined; + case 240 /* ExportAssignment */: + return visitExportAssignment(node); + } + return node; + } + function visitExportAssignment(node) { + // 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; - currentText = undefined; - currentLineMap = undefined; - exportFunctionForFile = undefined; - contextObjectForFile = undefined; - generatedNameSet = undefined; - nodeToGeneratedName = undefined; - decoratedClassAliases = undefined; - computedPropertyNamesToGeneratedNames = undefined; - convertedLoopState = undefined; - extendsEmitted = false; - decorateEmitted = false; - paramEmitted = false; - awaiterEmitted = false; - assignEmitted = false; - tempFlags = 0; - tempVariables = undefined; - tempParameters = undefined; - externalImports = undefined; - exportSpecifiers = undefined; - exportEquals = undefined; - hasExportStarsToExportValues = undefined; - detachedCommentsInfo = undefined; - sourceMapData = undefined; - isEs6Module = false; - renamedDependencies = undefined; - isCurrentFileExternalModule = false; } - function emitSourceFile(sourceFile) { - currentSourceFile = sourceFile; - currentText = sourceFile.text; - currentLineMap = ts.getLineStarts(sourceFile); - exportFunctionForFile = undefined; - contextObjectForFile = undefined; - isEs6Module = sourceFile.symbol && sourceFile.symbol.exports && !!sourceFile.symbol.exports["___esModule"]; - renamedDependencies = sourceFile.renamedDependencies; - currentFileIdentifiers = sourceFile.identifiers; - isCurrentFileExternalModule = ts.isExternalModule(sourceFile); - setSourceFile(sourceFile); - emitNodeWithCommentsAndWithoutSourcemap(sourceFile); + else { + previousOnEmitNode(emitContext, node, emitCallback); } - function isUniqueName(name) { - return !resolver.hasGlobalName(name) && - !(name in currentFileIdentifiers) && - !(name in generatedNameSet); + } + // + // 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 the next available name in the pattern _a ... _z, _0, _1, ... - // TempFlags._i or TempFlags._n may be used to express a preference for that dedicated name. - // Note that names generated by makeTempVariableName and makeUniqueName will never conflict. - function makeTempVariableName(flags) { - if (flags && !(tempFlags & flags)) { - var name_24 = flags === 268435456 /* _i */ ? "_i" : "_n"; - if (isUniqueName(name_24)) { - tempFlags |= flags; - return name_24; - } - } - while (true) { - var count = tempFlags & 268435455 /* CountMask */; - tempFlags++; - // Skip over 'i' and 'n' - if (count !== 8 && count !== 13) { - var name_25 = count < 26 ? "_" + String.fromCharCode(97 /* a */ + count) : "_" + (count - 26); - if (isUniqueName(name_25)) { - return name_25; - } - } + return node; + } + function substituteExpressionIdentifier(node) { + if (ts.getEmitFlags(node) & 4096 /* HelperName */) { + var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile); + if (externalHelpersModuleName) { + return ts.createPropertyAccess(externalHelpersModuleName, node); } } - // Generate a name that is unique within the current file and doesn't conflict with any names - // in global scope. The name is formed by adding an '_n' suffix to the specified base name, - // where n is a positive integer. Note that names generated by makeTempVariableName and - // makeUniqueName are guaranteed to never conflict. - function makeUniqueName(baseName) { - // Find the first unique 'name_n', where n is a positive number - if (baseName.charCodeAt(baseName.length - 1) !== 95 /* _ */) { - baseName += "_"; - } - var i = 1; - while (true) { - var generatedName = baseName + i; - if (isUniqueName(generatedName)) { - return generatedNameSet[generatedName] = generatedName; - } - i++; - } + return node; + } + } + ts.transformES2015Module = transformES2015Module; +})(ts || (ts = {})); +/// +/// +/*@internal*/ +var ts; +(function (ts) { + function transformSystemModule(context) { + var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration; + var compilerOptions = context.getCompilerOptions(); + var resolver = context.getEmitResolver(); + var host = context.getEmitHost(); + var previousOnSubstituteNode = context.onSubstituteNode; + var previousOnEmitNode = context.onEmitNode; + context.onSubstituteNode = onSubstituteNode; + context.onEmitNode = onEmitNode; + context.enableSubstitution(70 /* Identifier */); // Substitutes expression identifiers for imported symbols. + context.enableSubstitution(192 /* BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(190 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableSubstitution(191 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableEmitNotification(261 /* SourceFile */); // Restore state when substituting nodes in a file. + var moduleInfoMap = ts.createMap(); // The ExternalModuleInfo for each file. + var deferredExports = ts.createMap(); // Exports to defer until an EndOfDeclarationMarker is found. + var exportFunctionsMap = ts.createMap(); // The export function associated with a source file. + var noSubstitutionMap = ts.createMap(); // Set of nodes for which substitution rules should be ignored for each file. + var currentSourceFile; // The current file. + var moduleInfo; // ExternalModuleInfo for the current file. + var exportFunction; // The export function for the current file. + var contextObject; // The context object for the current file. + var hoistedStatements; + var enclosingBlockScopedContainer; + var noSubstitution; // Set of nodes for which substitution rules should be ignored. + return transformSourceFile; + /** + * Transforms the module aspects of a SourceFile. + * + * @param node The SourceFile node. + */ + function transformSourceFile(node) { + if (ts.isDeclarationFile(node) + || !(ts.isExternalModule(node) + || compilerOptions.isolatedModules)) { + return node; } - function generateNameForModuleOrEnum(node) { - var name = node.name.text; - // Use module/enum name itself if it is unique, otherwise make a unique variation - return isUniqueLocalName(name, node) ? name : makeUniqueName(name); + var id = ts.getOriginalNodeId(node); + currentSourceFile = node; + enclosingBlockScopedContainer = node; + // System modules have the following shape: + // + // System.register(['dep-1', ... 'dep-n'], function(exports) {/* module body function */}) + // + // The parameter 'exports' here is a callback '(name: string, value: T) => T' that + // is used to publish exported values. 'exports' returns its 'value' argument so in + // most cases expressions that mutate exported values can be rewritten as: + // + // expr -> exports('name', expr) + // + // 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, 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, + /*name*/ undefined, + /*typeParameters*/ undefined, [ + ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, exportFunction), + ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, contextObject) + ], + /*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 + var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions); + var dependencies = ts.createArrayLiteral(ts.map(dependencyGroups, function (dependencyGroup) { return dependencyGroup.name; })); + var updated = ts.setEmitFlags(ts.updateSourceFileNode(node, ts.createNodeArray([ + ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("System"), "register"), + /*typeArguments*/ undefined, moduleName + ? [moduleName, dependencies, moduleBodyFunction] + : [dependencies, moduleBodyFunction])) + ], node.statements)), 1024 /* NoTrailingComments */); + if (!(compilerOptions.outFile || compilerOptions.out)) { + ts.moveEmitHelpers(updated, moduleBodyBlock, function (helper) { return !helper.scoped; }); } - function generateNameForImportOrExportDeclaration(node) { - var expr = ts.getExternalModuleName(node); - var baseName = expr.kind === 9 /* StringLiteral */ ? - ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; - return makeUniqueName(baseName); + if (noSubstitution) { + noSubstitutionMap[id] = noSubstitution; + noSubstitution = undefined; } - function generateNameForExportDefault() { - return makeUniqueName("default"); - } - function generateNameForClassExpression() { - return makeUniqueName("class"); - } - function generateNameForNode(node) { - switch (node.kind) { - case 69 /* Identifier */: - return makeUniqueName(node.text); - case 225 /* ModuleDeclaration */: - case 224 /* EnumDeclaration */: - return generateNameForModuleOrEnum(node); - case 230 /* ImportDeclaration */: - case 236 /* ExportDeclaration */: - return generateNameForImportOrExportDeclaration(node); - case 220 /* FunctionDeclaration */: - case 221 /* ClassDeclaration */: - case 235 /* ExportAssignment */: - return generateNameForExportDefault(); - case 192 /* ClassExpression */: - return generateNameForClassExpression(); - default: - ts.Debug.fail(); - } - } - function getGeneratedNameForNode(node) { - var id = ts.getNodeId(node); - return nodeToGeneratedName[id] || (nodeToGeneratedName[id] = ts.unescapeIdentifier(generateNameForNode(node))); - } - /** Write emitted output to disk */ - function writeEmittedFiles(emitOutput, jsFilePath, sourceMapFilePath, writeByteOrderMark, sourceFiles) { - if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) { - ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), /*writeByteOrderMark*/ false, sourceFiles); - } - if (sourceMapDataList) { - sourceMapDataList.push(sourceMap.getSourceMapData()); - } - ts.writeFile(host, emitterDiagnostics, jsFilePath, emitOutput, writeByteOrderMark, sourceFiles); - } - // Create a temporary variable with a unique unused name. - function createTempVariable(flags) { - var result = ts.createSynthesizedNode(69 /* Identifier */); - result.text = makeTempVariableName(flags); - return result; - } - function recordTempDeclaration(name) { - if (!tempVariables) { - tempVariables = []; - } - tempVariables.push(name); - } - function createAndRecordTempVariable(flags) { - var temp = createTempVariable(flags); - recordTempDeclaration(temp); - return temp; - } - function emitTempDeclarations(newLine) { - if (tempVariables) { - if (newLine) { - writeLine(); - } - else { - write(" "); - } - write("var "); - emitCommaList(tempVariables); - write(";"); - } - } - /** Emit the text for the given token that comes after startPos - * This by default writes the text provided with the given tokenKind - * but if optional emitFn callback is provided the text is emitted using the callback instead of default text - * @param tokenKind the kind of the token to search and emit - * @param startPos the position in the source to start searching for the token - * @param emitFn if given will be invoked to emit the text instead of actual token emit */ - function emitToken(tokenKind, startPos, emitFn) { - var tokenStartPos = ts.skipTrivia(currentText, startPos); - emitPos(tokenStartPos); - var tokenString = ts.tokenToString(tokenKind); - if (emitFn) { - emitFn(); + currentSourceFile = undefined; + moduleInfo = undefined; + exportFunction = undefined; + contextObject = undefined; + hoistedStatements = undefined; + enclosingBlockScopedContainer = undefined; + return ts.aggregateTransformFlags(updated); + } + /** + * Collects the dependency groups for this files imports. + * + * @param externalImports The imports for the file. + */ + function collectDependencyGroups(externalImports) { + var groupIndices = ts.createMap(); + var dependencyGroups = []; + for (var i = 0; i < externalImports.length; i++) { + var externalImport = externalImports[i]; + var externalModuleName = ts.getExternalModuleNameLiteral(externalImport, currentSourceFile, host, resolver, compilerOptions); + var text = externalModuleName.text; + if (ts.hasProperty(groupIndices, text)) { + // deduplicate/group entries in dependency list by the dependency name + var groupIndex = groupIndices[text]; + dependencyGroups[groupIndex].externalImports.push(externalImport); } else { - write(tokenString); - } - var tokenEndPos = tokenStartPos + tokenString.length; - emitPos(tokenEndPos); - return tokenEndPos; - } - function emitOptional(prefix, node) { - if (node) { - write(prefix); - emit(node); - } - } - function emitParenthesizedIf(node, parenthesized) { - if (parenthesized) { - write("("); - } - emit(node); - if (parenthesized) { - write(")"); - } - } - function emitLinePreservingList(parent, nodes, allowTrailingComma, spacesBetweenBraces) { - ts.Debug.assert(nodes.length > 0); - increaseIndent(); - if (nodeStartPositionsAreOnSameLine(parent, nodes[0])) { - if (spacesBetweenBraces) { - write(" "); - } - } - else { - writeLine(); - } - for (var i = 0, n = nodes.length; i < n; i++) { - if (i) { - if (nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { - write(", "); - } - else { - write(","); - writeLine(); - } - } - emit(nodes[i]); - } - if (nodes.hasTrailingComma && allowTrailingComma) { - write(","); - } - decreaseIndent(); - if (nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes))) { - if (spacesBetweenBraces) { - write(" "); - } - } - else { - writeLine(); - } - } - function emitList(nodes, start, count, multiLine, trailingComma, leadingComma, noTrailingNewLine, emitNode) { - if (!emitNode) { - emitNode = emit; - } - for (var i = 0; i < count; i++) { - if (multiLine) { - if (i || leadingComma) { - write(","); - } - writeLine(); - } - else { - if (i || leadingComma) { - write(", "); - } - } - var node = nodes[start + i]; - // This emitting is to make sure we emit following comment properly - // ...(x, /*comment1*/ y)... - // ^ => node.pos - // "comment1" is not considered leading comment for "y" but rather - // considered as trailing comment of the previous node. - emitTrailingCommentsOfPosition(node.pos); - emitNode(node); - leadingComma = true; - } - if (trailingComma) { - write(","); - } - if (multiLine && !noTrailingNewLine) { - writeLine(); - } - return count; - } - function emitCommaList(nodes) { - if (nodes) { - emitList(nodes, 0, nodes.length, /*multiLine*/ false, /*trailingComma*/ false); - } - } - function emitLines(nodes) { - emitLinesStartingAt(nodes, /*startIndex*/ 0); - } - function emitLinesStartingAt(nodes, startIndex) { - for (var i = startIndex; i < nodes.length; i++) { - writeLine(); - emit(nodes[i]); - } - } - function isBinaryOrOctalIntegerLiteral(node, text) { - if (node.kind === 8 /* NumericLiteral */ && text.length > 1) { - switch (text.charCodeAt(1)) { - case 98 /* b */: - case 66 /* B */: - case 111 /* o */: - case 79 /* O */: - return true; - } - } - return false; - } - function emitLiteral(node) { - var text = getLiteralText(node); - if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) && (node.kind === 9 /* StringLiteral */ || ts.isTemplateLiteralKind(node.kind))) { - writer.writeLiteral(text); - } - else if (languageVersion < 2 /* ES6 */ && isBinaryOrOctalIntegerLiteral(node, text)) { - write(node.text); - } - else { - write(text); - } - } - function getLiteralText(node) { - // Any template literal or string literal with an extended escape - // (e.g. "\u{0067}") will need to be downleveled as a escaped string literal. - if (languageVersion < 2 /* ES6 */ && (ts.isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) { - return getQuotedEscapedLiteralText('"', node.text, '"'); - } - // If we don't need to downlevel and we can reach the original source text using - // the node's parent reference, then simply get the text as it was originally written. - if (node.parent) { - return ts.getTextOfNodeFromSourceText(currentText, node); - } - // If we can't reach the original source text, use the canonical form if it's a number, - // or an escaped quoted form of the original text if it's string-like. - switch (node.kind) { - case 9 /* StringLiteral */: - return getQuotedEscapedLiteralText('"', node.text, '"'); - case 11 /* NoSubstitutionTemplateLiteral */: - return getQuotedEscapedLiteralText("`", node.text, "`"); - case 12 /* TemplateHead */: - return getQuotedEscapedLiteralText("`", node.text, "${"); - case 13 /* TemplateMiddle */: - return getQuotedEscapedLiteralText("}", node.text, "${"); - case 14 /* TemplateTail */: - return getQuotedEscapedLiteralText("}", node.text, "`"); - case 8 /* NumericLiteral */: - return node.text; - } - ts.Debug.fail("Literal kind '" + node.kind + "' not accounted for."); - } - function getQuotedEscapedLiteralText(leftQuote, text, rightQuote) { - return leftQuote + ts.escapeNonAsciiCharacters(ts.escapeString(text)) + rightQuote; - } - function emitDownlevelRawTemplateLiteral(node) { - // Find original source text, since we need to emit the raw strings of the tagged template. - // The raw strings contain the (escaped) strings of what the user wrote. - // Examples: `\n` is converted to "\\n", a template string with a newline to "\n". - var text = ts.getTextOfNodeFromSourceText(currentText, node); - // text contains the original source, it will also contain quotes ("`"), dollar signs and braces ("${" and "}"), - // thus we need to remove those characters. - // First template piece starts with "`", others with "}" - // Last template piece ends with "`", others with "${" - var isLast = node.kind === 11 /* NoSubstitutionTemplateLiteral */ || node.kind === 14 /* TemplateTail */; - text = text.substring(1, text.length - (isLast ? 1 : 2)); - // Newline normalization: - // ES6 Spec 11.8.6.1 - Static Semantics of TV's and TRV's - // and LineTerminatorSequences are normalized to for both TV and TRV. - text = text.replace(/\r\n?/g, "\n"); - text = ts.escapeString(text); - write("\"" + text + "\""); - } - function emitDownlevelTaggedTemplateArray(node, literalEmitter) { - write("["); - if (node.template.kind === 11 /* NoSubstitutionTemplateLiteral */) { - literalEmitter(node.template); - } - else { - literalEmitter(node.template.head); - ts.forEach(node.template.templateSpans, function (child) { - write(", "); - literalEmitter(child.literal); + groupIndices[text] = dependencyGroups.length; + dependencyGroups.push({ + name: externalModuleName, + externalImports: [externalImport] }); } - write("]"); } - function emitDownlevelTaggedTemplate(node) { - var tempVariable = createAndRecordTempVariable(0 /* Auto */); - write("("); - emit(tempVariable); - write(" = "); - emitDownlevelTaggedTemplateArray(node, emit); - write(", "); - emit(tempVariable); - write(".raw = "); - emitDownlevelTaggedTemplateArray(node, emitDownlevelRawTemplateLiteral); - write(", "); - emitParenthesizedIf(node.tag, needsParenthesisForPropertyAccessOrInvocation(node.tag)); - write("("); - emit(tempVariable); - // Now we emit the expressions - if (node.template.kind === 189 /* TemplateExpression */) { - ts.forEach(node.template.templateSpans, function (templateSpan) { - write(", "); - var needsParens = templateSpan.expression.kind === 187 /* BinaryExpression */ - && templateSpan.expression.operatorToken.kind === 24 /* CommaToken */; - emitParenthesizedIf(templateSpan.expression, needsParens); - }); - } - write("))"); + return dependencyGroups; + } + /** + * Adds the statements for the module body function for the source file. + * + * @param node The source file for the module. + * @param dependencyGroups The grouped dependencies of the module. + */ + function createSystemModuleBody(node, dependencyGroups) { + // Shape of the body in system modules: + // + // function (exports) { + // + // + // + // return { + // setters: [ + // + // ], + // execute: function() { + // + // } + // } + // + // } + // + // i.e: + // + // import {x} from 'file1' + // var y = 1; + // export function foo() { return y + x(); } + // console.log(y); + // + // Will be transformed to: + // + // function(exports) { + // function foo() { return y + file_1.x(); } + // exports("foo", foo); + // var file_1, y; + // return { + // setters: [ + // function(v) { file_1 = v } + // ], + // execute(): function() { + // y = 1; + // console.log(y); + // } + // }; + // } + var statements = []; + // We start a new lexical environment in this function body, but *not* in the + // body of the execute function. This allows us to emit temporary declarations + // only in the outer module body and not in the inner one. + startLexicalEnvironment(); + // Add any prologue directives. + var statementOffset = ts.addPrologueDirectives(statements, node.statements, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict, sourceElementVisitor); + // var __moduleName = context_1 && context_1.id; + statements.push(ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList([ + 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 + // setters. This allows us to reduce the number of times we need to loop through the + // statements of the source file. + var executeStatements = ts.visitNodes(node.statements, sourceElementVisitor, ts.isStatement, statementOffset); + // Emit early exports for function declarations. + ts.addRange(statements, hoistedStatements); + // We emit hoisted variables early to align roughly with our previous emit output. + // Two key differences in this approach are: + // - Temporary variables will appear at the top rather than at the bottom of the file + ts.addRange(statements, endLexicalEnvironment()); + var exportStarFunction = addExportStarIfNeeded(statements); + statements.push(ts.createReturn(ts.setMultiLine(ts.createObjectLiteral([ + ts.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)), + ts.createPropertyAssignment("execute", ts.createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, + /*parameters*/ [], + /*type*/ undefined, ts.createBlock(executeStatements, + /*location*/ undefined, + /*multiLine*/ true))) + ]), + /*multiLine*/ true))); + return ts.createBlock(statements, /*location*/ undefined, /*multiLine*/ true); + } + /** + * Adds an exportStar function to a statement list if it is needed for the file. + * + * @param statements A statement list. + */ + function addExportStarIfNeeded(statements) { + if (!moduleInfo.hasExportStarsToExportValues) { + return; } - function emitTemplateExpression(node) { - // In ES6 mode and above, we can simply emit each portion of a template in order, but in - // ES3 & ES5 we must convert the template expression into a series of string concatenations. - if (languageVersion >= 2 /* ES6 */) { - ts.forEachChild(node, emit); - return; - } - var emitOuterParens = ts.isExpression(node.parent) - && templateNeedsParens(node, node.parent); - if (emitOuterParens) { - write("("); - } - var headEmitted = false; - if (shouldEmitTemplateHead()) { - emitLiteral(node.head); - headEmitted = true; - } - for (var i = 0, n = node.templateSpans.length; i < n; i++) { - var templateSpan = node.templateSpans[i]; - // Check if the expression has operands and binds its operands less closely than binary '+'. - // If it does, we need to wrap the expression in parentheses. Otherwise, something like - // `abc${ 1 << 2 }` - // becomes - // "abc" + 1 << 2 + "" - // which is really - // ("abc" + 1) << (2 + "") - // rather than - // "abc" + (1 << 2) + "" - var needsParens = templateSpan.expression.kind !== 178 /* ParenthesizedExpression */ - && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1 /* GreaterThan */; - if (i > 0 || headEmitted) { - // If this is the first span and the head was not emitted, then this templateSpan's - // expression will be the first to be emitted. Don't emit the preceding ' + ' in that - // case. - write(" + "); - } - emitParenthesizedIf(templateSpan.expression, needsParens); - // Only emit if the literal is non-empty. - // The binary '+' operator is left-associative, so the first string concatenation - // with the head will force the result up to this point to be a string. - // Emitting a '+ ""' has no semantic effect for middles and tails. - if (templateSpan.literal.text.length !== 0) { - write(" + "); - emitLiteral(templateSpan.literal); + // when resolving exports local exported entries/indirect exported entries in the module + // should always win over entries with similar names that were added via star exports + // to support this we store names of local/indirect exported entries in a set. + // this set is used to filter names brought by star expors. + // local names set should only be added if we have anything exported + if (!moduleInfo.exportedNames && ts.isEmpty(moduleInfo.exportSpecifiers)) { + // no exported declarations (export var ...) or export specifiers (export {x}) + // check if we have any non star export declarations. + var hasExportDeclarationWithExportClause = false; + for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { + var externalImport = _a[_i]; + if (externalImport.kind === 241 /* ExportDeclaration */ && externalImport.exportClause) { + hasExportDeclarationWithExportClause = true; + break; } } - if (emitOuterParens) { - write(")"); - } - function shouldEmitTemplateHead() { - // If this expression has an empty head literal and the first template span has a non-empty - // literal, then emitting the empty head literal is not necessary. - // `${ foo } and ${ bar }` - // can be emitted as - // foo + " and " + bar - // This is because it is only required that one of the first two operands in the emit - // output must be a string literal, so that the other operand and all following operands - // are forced into strings. - // - // If the first template span has an empty literal, then the head must still be emitted. - // `${ foo }${ bar }` - // must still be emitted as - // "" + foo + bar - // There is always atleast one templateSpan in this code path, since - // NoSubstitutionTemplateLiterals are directly emitted via emitLiteral() - ts.Debug.assert(node.templateSpans.length !== 0); - return node.head.text.length !== 0 || node.templateSpans[0].literal.text.length === 0; - } - function templateNeedsParens(template, parent) { - switch (parent.kind) { - case 174 /* CallExpression */: - case 175 /* NewExpression */: - return parent.expression === template; - case 176 /* TaggedTemplateExpression */: - case 178 /* ParenthesizedExpression */: - return false; - default: - return comparePrecedenceToBinaryPlus(parent) !== -1 /* LessThan */; - } - } - /** - * Returns whether the expression has lesser, greater, - * or equal precedence to the binary '+' operator - */ - function comparePrecedenceToBinaryPlus(expression) { - // All binary expressions have lower precedence than '+' apart from '*', '/', and '%' - // which have greater precedence and '-' which has equal precedence. - // All unary operators have a higher precedence apart from yield. - // Arrow functions and conditionals have a lower precedence, - // although we convert the former into regular function expressions in ES5 mode, - // and in ES6 mode this function won't get called anyway. - // - // TODO (drosen): Note that we need to account for the upcoming 'yield' and - // spread ('...') unary operators that are anticipated for ES6. - switch (expression.kind) { - case 187 /* BinaryExpression */: - switch (expression.operatorToken.kind) { - case 37 /* AsteriskToken */: - case 39 /* SlashToken */: - case 40 /* PercentToken */: - return 1 /* GreaterThan */; - case 35 /* PlusToken */: - case 36 /* MinusToken */: - return 0 /* EqualTo */; - default: - return -1 /* LessThan */; - } - case 190 /* YieldExpression */: - case 188 /* ConditionalExpression */: - return -1 /* LessThan */; - default: - return 1 /* GreaterThan */; - } + if (!hasExportDeclarationWithExportClause) { + // we still need to emit exportStar helper + var exportStarFunction_1 = createExportStarFunction(/*localNames*/ undefined); + statements.push(exportStarFunction_1); + return exportStarFunction_1.name; } } - function emitTemplateSpan(span) { - emit(span.expression); - emit(span.literal); + var exportedNames = []; + if (moduleInfo.exportedNames) { + for (var _b = 0, _c = moduleInfo.exportedNames; _b < _c.length; _b++) { + var exportedLocalName = _c[_b]; + if (exportedLocalName.text === "default") { + continue; + } + // write name of exported declaration, i.e 'export var x...' + exportedNames.push(ts.createPropertyAssignment(ts.createLiteral(exportedLocalName), ts.createLiteral(true))); + } } - function jsxEmitReact(node) { - /// Emit a tag name, which is either '"div"' for lower-cased names, or - /// 'Div' for upper-cased or dotted names - function emitTagName(name) { - if (name.kind === 69 /* Identifier */ && ts.isIntrinsicJsxName(name.text)) { - write('"'); - emit(name); - write('"'); - } - else { - emit(name); - } + for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) { + var externalImport = _e[_d]; + if (externalImport.kind !== 241 /* ExportDeclaration */) { + continue; } - /// Emit an attribute name, which is quoted if it needs to be quoted. Because - /// these emit into an object literal property name, we don't need to be worried - /// about keywords, just non-identifier characters - function emitAttributeName(name) { - if (/^[A-Za-z_]\w*$/.test(name.text)) { - emit(name); - } - else { - write('"'); - emit(name); - write('"'); - } + var exportDecl = externalImport; + if (!exportDecl.exportClause) { + // export * from ... + continue; } - /// Emit an name/value pair for an attribute (e.g. "x: 3") - function emitJsxAttribute(node) { - emitAttributeName(node.name); - write(": "); - if (node.initializer) { - emit(node.initializer); - } - else { - write("true"); - } + for (var _f = 0, _g = exportDecl.exportClause.elements; _f < _g.length; _f++) { + var element = _g[_f]; + // write name of indirectly exported entry, i.e. 'export {x} from ...' + exportedNames.push(ts.createPropertyAssignment(ts.createLiteral((element.name || element.propertyName).text), ts.createLiteral(true))); } - function emitJsxElement(openingNode, children) { - var syntheticReactRef = ts.createSynthesizedNode(69 /* Identifier */); - syntheticReactRef.text = compilerOptions.reactNamespace ? compilerOptions.reactNamespace : "React"; - syntheticReactRef.parent = openingNode; - // Call React.createElement(tag, ... - emitLeadingComments(openingNode); - emitExpressionIdentifier(syntheticReactRef); - write(".createElement("); - emitTagName(openingNode.tagName); - write(", "); - // Attribute list - if (openingNode.attributes.length === 0) { - // When there are no attributes, React wants "null" - write("null"); - } - else { - // Either emit one big object literal (no spread attribs), or - // a call to the __assign helper - var attrs = openingNode.attributes; - if (ts.forEach(attrs, function (attr) { return attr.kind === 247 /* JsxSpreadAttribute */; })) { - write("__assign("); - var haveOpenedObjectLiteral = false; - for (var i = 0; i < attrs.length; i++) { - if (attrs[i].kind === 247 /* JsxSpreadAttribute */) { - // If this is the first argument, we need to emit a {} as the first argument - if (i === 0) { - write("{}, "); - } - if (haveOpenedObjectLiteral) { - write("}"); - haveOpenedObjectLiteral = false; - } - if (i > 0) { - write(", "); - } - emit(attrs[i].expression); - } - else { - ts.Debug.assert(attrs[i].kind === 246 /* JsxAttribute */); - if (haveOpenedObjectLiteral) { - write(", "); - } - else { - haveOpenedObjectLiteral = true; - if (i > 0) { - write(", "); - } - write("{"); - } - emitJsxAttribute(attrs[i]); - } + } + var exportedNamesStorageRef = ts.createUniqueName("exportedNames"); + statements.push(ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration(exportedNamesStorageRef, + /*type*/ undefined, ts.createObjectLiteral(exportedNames, /*location*/ undefined, /*multiline*/ true)) + ]))); + var exportStarFunction = createExportStarFunction(exportedNamesStorageRef); + statements.push(exportStarFunction); + return exportStarFunction.name; + } + /** + * Creates an exportStar function for the file, with an optional set of excluded local + * names. + * + * @param localNames An optional reference to an object containing a set of excluded local + * names. + */ + function createExportStarFunction(localNames) { + var exportStarFunction = ts.createUniqueName("exportStar"); + var m = ts.createIdentifier("m"); + var n = ts.createIdentifier("n"); + var exports = ts.createIdentifier("exports"); + var condition = ts.createStrictInequality(n, ts.createLiteral("default")); + if (localNames) { + condition = ts.createLogicalAnd(condition, ts.createLogicalNot(ts.createCall(ts.createPropertyAccess(localNames, "hasOwnProperty"), + /*typeArguments*/ undefined, [n]))); + } + return ts.createFunctionDeclaration( + /*decorators*/ undefined, + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, exportStarFunction, + /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, m)], + /*type*/ undefined, ts.createBlock([ + ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration(exports, + /*type*/ undefined, ts.createObjectLiteral([])) + ])), + 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)))), 1 /* SingleLine */) + ])), + ts.createStatement(ts.createCall(exportFunction, + /*typeArguments*/ undefined, [exports])) + ], + /*location*/ undefined, + /*multiline*/ true)); + } + /** + * Creates an array setter callbacks for each dependency group. + * + * @param exportStarFunction A reference to an exportStarFunction for the file. + * @param dependencyGroups An array of grouped dependencies. + */ + function createSettersArray(exportStarFunction, dependencyGroups) { + var setters = []; + for (var _i = 0, dependencyGroups_1 = dependencyGroups; _i < dependencyGroups_1.length; _i++) { + var group = dependencyGroups_1[_i]; + // derive a unique name for parameter from the first named entry in the group + var localName = ts.forEach(group.externalImports, function (i) { return ts.getLocalNameForExternalImport(i, currentSourceFile); }); + var parameterName = localName ? ts.getGeneratedNameForNode(localName) : ts.createUniqueName(""); + var statements = []; + for (var _a = 0, _b = group.externalImports; _a < _b.length; _a++) { + var entry = _b[_a]; + var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile); + switch (entry.kind) { + case 235 /* ImportDeclaration */: + if (!entry.importClause) { + // 'import "..."' case + // module is imported only for side-effects, no emit required + break; } - if (haveOpenedObjectLiteral) - write("}"); - write(")"); // closing paren to React.__spread( - } - else { - // One object literal with all the attributes in them - write("{"); - for (var i = 0, n = attrs.length; i < n; i++) { - if (i > 0) { - write(", "); + // fall-through + case 234 /* ImportEqualsDeclaration */: + ts.Debug.assert(importVariableName !== undefined); + // save import into the local + statements.push(ts.createStatement(ts.createAssignment(importVariableName, parameterName))); + break; + case 241 /* ExportDeclaration */: + ts.Debug.assert(importVariableName !== undefined); + if (entry.exportClause) { + // export {a, b as c} from 'foo' + // + // emit as: + // + // exports_({ + // "a": _["a"], + // "c": _["b"] + // }); + var properties = []; + for (var _c = 0, _d = entry.exportClause.elements; _c < _d.length; _c++) { + var e = _d[_c]; + properties.push(ts.createPropertyAssignment(ts.createLiteral(e.name.text), ts.createElementAccess(parameterName, ts.createLiteral((e.propertyName || e.name).text)))); } - emitJsxAttribute(attrs[i]); - } - write("}"); - } - } - // Children - if (children) { - var firstChild = void 0; - var multipleEmittableChildren = false; - for (var i = 0, n = children.length; i < n; i++) { - var jsxChild = children[i]; - if (isJsxChildEmittable(jsxChild)) { - // we need to decide whether to emit in single line or multiple lines as indented list - // store firstChild reference, if we see another emittable child, then emit accordingly - if (!firstChild) { - write(", "); - firstChild = jsxChild; - } - else { - // more than one emittable child, emit indented list - if (!multipleEmittableChildren) { - multipleEmittableChildren = true; - increaseIndent(); - writeLine(); - emit(firstChild); - } - write(", "); - writeLine(); - emit(jsxChild); - } - } - } - if (multipleEmittableChildren) { - decreaseIndent(); - } - else if (firstChild) { - if (firstChild.kind !== 241 /* JsxElement */ && firstChild.kind !== 242 /* JsxSelfClosingElement */) { - emit(firstChild); + statements.push(ts.createStatement(ts.createCall(exportFunction, + /*typeArguments*/ undefined, [ts.createObjectLiteral(properties, /*location*/ undefined, /*multiline*/ true)]))); } else { - // If the only child is jsx element, put it on a new indented line - increaseIndent(); - writeLine(); - emit(firstChild); - writeLine(); - decreaseIndent(); + // export * from 'foo' + // + // emit as: + // + // exportStar(foo_1_1); + statements.push(ts.createStatement(ts.createCall(exportStarFunction, + /*typeArguments*/ undefined, [parameterName]))); } - } + break; } - // Closing paren - write(")"); // closes "React.createElement(" - emitTrailingComments(openingNode); } - if (node.kind === 241 /* JsxElement */) { - emitJsxElement(node.openingElement, node.children); + setters.push(ts.createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, parameterName)], + /*type*/ undefined, ts.createBlock(statements, /*location*/ undefined, /*multiLine*/ true))); + } + return ts.createArrayLiteral(setters, /*location*/ undefined, /*multiLine*/ true); + } + // + // Top-level Source Element Visitors + // + /** + * Visit source elements at the top-level of a module. + * + * @param node The node to visit. + */ + function sourceElementVisitor(node) { + switch (node.kind) { + case 235 /* ImportDeclaration */: + return visitImportDeclaration(node); + case 234 /* ImportEqualsDeclaration */: + return visitImportEqualsDeclaration(node); + case 241 /* ExportDeclaration */: + // ExportDeclarations are elided as they are handled via + // `appendExportsOfDeclaration`. + return undefined; + case 240 /* ExportAssignment */: + return visitExportAssignment(node); + default: + return nestedElementVisitor(node); + } + } + /** + * Visits an ImportDeclaration node. + * + * @param node The node to visit. + */ + function visitImportDeclaration(node) { + var statements; + if (node.importClause) { + hoistVariableDeclaration(ts.getLocalNameForExternalImport(node, currentSourceFile)); + } + if (hasAssociatedEndOfDeclarationMarker(node)) { + // Defer exports until we encounter an EndOfDeclarationMarker node + var id = ts.getOriginalNodeId(node); + deferredExports[id] = appendExportsOfImportDeclaration(deferredExports[id], node); + } + else { + statements = appendExportsOfImportDeclaration(statements, node); + } + return ts.singleOrMany(statements); + } + /** + * Visits an ImportEqualsDeclaration node. + * + * @param node The node to visit. + */ + function visitImportEqualsDeclaration(node) { + ts.Debug.assert(ts.isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer."); + var statements; + hoistVariableDeclaration(ts.getLocalNameForExternalImport(node, currentSourceFile)); + if (hasAssociatedEndOfDeclarationMarker(node)) { + // Defer exports until we encounter an EndOfDeclarationMarker node + var id = ts.getOriginalNodeId(node); + deferredExports[id] = appendExportsOfImportEqualsDeclaration(deferredExports[id], node); + } + else { + statements = appendExportsOfImportEqualsDeclaration(statements, node); + } + return ts.singleOrMany(statements); + } + /** + * Visits an ExportAssignment node. + * + * @param node The node to visit. + */ + function visitExportAssignment(node) { + if (node.isExportEquals) { + // Elide `export=` as it is illegal in a SystemJS module. + return undefined; + } + var expression = ts.visitNode(node.expression, destructuringVisitor, ts.isExpression); + var original = node.original; + if (original && hasAssociatedEndOfDeclarationMarker(original)) { + // Defer exports until we encounter an EndOfDeclarationMarker node + var id = ts.getOriginalNodeId(node); + deferredExports[id] = appendExportStatement(deferredExports[id], ts.createIdentifier("default"), expression, /*allowComments*/ true); + } + else { + return createExportStatement(ts.createIdentifier("default"), expression, /*allowComments*/ true); + } + } + /** + * Visits a FunctionDeclaration, hoisting it to the outer module body function. + * + * @param node The node to visit. + */ + function visitFunctionDeclaration(node) { + if (ts.hasModifier(node, 1 /* Export */)) { + hoistedStatements = ts.append(hoistedStatements, ts.updateFunctionDeclaration(node, node.decorators, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.getDeclarationName(node, /*allowComments*/ true, /*allowSourceMaps*/ true), + /*typeParameters*/ undefined, ts.visitNodes(node.parameters, destructuringVisitor, ts.isParameterDeclaration), + /*type*/ undefined, ts.visitNode(node.body, destructuringVisitor, ts.isBlock))); + } + else { + hoistedStatements = ts.append(hoistedStatements, node); + } + if (hasAssociatedEndOfDeclarationMarker(node)) { + // Defer exports until we encounter an EndOfDeclarationMarker node + var id = ts.getOriginalNodeId(node); + deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node); + } + else { + hoistedStatements = appendExportsOfHoistedDeclaration(hoistedStatements, node); + } + return undefined; + } + /** + * Visits a ClassDeclaration, hoisting its name to the outer module body function. + * + * @param node The node to visit. + */ + function visitClassDeclaration(node) { + var statements; + // Hoist the name of the class declaration to the outer module body function. + var name = ts.getLocalName(node); + hoistVariableDeclaration(name); + // Rewrite the class declaration into an assignment of a class expression. + statements = ts.append(statements, ts.createStatement(ts.createAssignment(name, ts.createClassExpression( + /*modifiers*/ undefined, node.name, + /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, destructuringVisitor, ts.isHeritageClause), ts.visitNodes(node.members, destructuringVisitor, ts.isClassElement), + /*location*/ node)), + /*location*/ node)); + if (hasAssociatedEndOfDeclarationMarker(node)) { + // Defer exports until we encounter an EndOfDeclarationMarker node + var id = ts.getOriginalNodeId(node); + deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node); + } + else { + statements = appendExportsOfHoistedDeclaration(statements, node); + } + return ts.singleOrMany(statements); + } + /** + * Visits a variable statement, hoisting declared names to the top-level module body. + * Each declaration is rewritten into an assignment expression. + * + * @param node The node to visit. + */ + function visitVariableStatement(node) { + if (!shouldHoistVariableDeclarationList(node.declarationList)) { + return ts.visitNode(node, destructuringVisitor, ts.isStatement); + } + var expressions; + var isExportedDeclaration = ts.hasModifier(node, 1 /* Export */); + var isMarkedDeclaration = hasAssociatedEndOfDeclarationMarker(node); + for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { + var variable = _a[_i]; + if (variable.initializer) { + expressions = ts.append(expressions, transformInitializedVariable(variable, isExportedDeclaration && !isMarkedDeclaration)); } else { - ts.Debug.assert(node.kind === 242 /* JsxSelfClosingElement */); - emitJsxElement(node); + hoistBindingElement(variable); } } - function jsxEmitPreserve(node) { - function emitJsxAttribute(node) { - emit(node.name); - if (node.initializer) { - write("="); - emit(node.initializer); + var statements; + if (expressions) { + statements = ts.append(statements, ts.createStatement(ts.inlineExpressions(expressions), /*location*/ node)); + } + if (isMarkedDeclaration) { + // Defer exports until we encounter an EndOfDeclarationMarker node + var id = ts.getOriginalNodeId(node); + deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node, isExportedDeclaration); + } + else { + statements = appendExportsOfVariableStatement(statements, node, /*exportSelf*/ false); + } + return ts.singleOrMany(statements); + } + /** + * Hoists the declared names of a VariableDeclaration or BindingElement. + * + * @param node The declaration to hoist. + */ + function hoistBindingElement(node) { + if (ts.isBindingPattern(node.name)) { + for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (!ts.isOmittedExpression(element)) { + hoistBindingElement(element); } } - function emitJsxSpreadAttribute(node) { - write("{..."); - emit(node.expression); - write("}"); + } + else { + hoistVariableDeclaration(ts.getSynthesizedClone(node.name)); + } + } + /** + * Determines whether a VariableDeclarationList should be hoisted. + * + * @param node The node to test. + */ + function shouldHoistVariableDeclarationList(node) { + // hoist only non-block scoped declarations or block scoped declarations parented by source file + return (ts.getEmitFlags(node) & 1048576 /* NoHoisting */) === 0 + && (enclosingBlockScopedContainer.kind === 261 /* SourceFile */ + || (ts.getOriginalNode(node).flags & 3 /* BlockScoped */) === 0); + } + /** + * Transform an initialized variable declaration into an expression. + * + * @param node The node to transform. + * @param isExportedDeclaration A value indicating whether the variable is exported. + */ + function transformInitializedVariable(node, isExportedDeclaration) { + var createAssignment = isExportedDeclaration ? createExportedVariableAssignment : createNonExportedVariableAssignment; + return ts.isBindingPattern(node.name) + ? ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0 /* All */, + /*needsValue*/ false, createAssignment) + : createAssignment(node.name, ts.visitNode(node.initializer, destructuringVisitor, ts.isExpression)); + } + /** + * Creates an assignment expression for an exported variable declaration. + * + * @param name The name of the variable. + * @param value The value of the variable's initializer. + * @param location The source map location for the assignment. + */ + function createExportedVariableAssignment(name, value, location) { + return createVariableAssignment(name, value, location, /*isExportedDeclaration*/ true); + } + /** + * Creates an assignment expression for a non-exported variable declaration. + * + * @param name The name of the variable. + * @param value The value of the variable's initializer. + * @param location The source map location for the assignment. + */ + function createNonExportedVariableAssignment(name, value, location) { + return createVariableAssignment(name, value, location, /*isExportedDeclaration*/ false); + } + /** + * Creates an assignment expression for a variable declaration. + * + * @param name The name of the variable. + * @param value The value of the variable's initializer. + * @param location The source map location for the assignment. + * @param isExportedDeclaration A value indicating whether the variable is exported. + */ + function createVariableAssignment(name, value, location, isExportedDeclaration) { + hoistVariableDeclaration(ts.getSynthesizedClone(name)); + return isExportedDeclaration + ? createExportExpression(name, preventSubstitution(ts.createAssignment(name, value, location))) + : preventSubstitution(ts.createAssignment(name, value, location)); + } + /** + * Visits a MergeDeclarationMarker used as a placeholder for the beginning of a merged + * and transformed declaration. + * + * @param node The node to visit. + */ + function visitMergeDeclarationMarker(node) { + // For an EnumDeclaration or ModuleDeclaration that merges with a preceeding + // declaration we do not emit a leading variable declaration. To preserve the + // begin/end semantics of the declararation and to properly handle exports + // we wrapped the leading variable declaration in a `MergeDeclarationMarker`. + // + // To balance the declaration, we defer the exports of the elided variable + // statement until we visit this declaration's `EndOfDeclarationMarker`. + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 205 /* VariableStatement */) { + var id = ts.getOriginalNodeId(node); + var isExportedDeclaration = ts.hasModifier(node.original, 1 /* Export */); + deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); + } + return node; + } + /** + * Determines whether a node has an associated EndOfDeclarationMarker. + * + * @param node The node to test. + */ + function hasAssociatedEndOfDeclarationMarker(node) { + return (ts.getEmitFlags(node) & 2097152 /* HasEndOfDeclarationMarker */) !== 0; + } + /** + * Visits a DeclarationMarker used as a placeholder for the end of a transformed + * declaration. + * + * @param node The node to visit. + */ + function visitEndOfDeclarationMarker(node) { + // For some transformations we emit an `EndOfDeclarationMarker` to mark the actual + // end of the transformed declaration. We use this marker to emit any deferred exports + // of the declaration. + var id = ts.getOriginalNodeId(node); + var statements = deferredExports[id]; + if (statements) { + delete deferredExports[id]; + return ts.append(statements, node); + } + return node; + } + /** + * Appends the exports of an ImportDeclaration to a statement list, returning the + * statement list. + * + * @param statements A statement list to which the down-level export statements are to be + * appended. If `statements` is `undefined`, a new array is allocated if statements are + * appended. + * @param decl The declaration whose exports are to be recorded. + */ + function appendExportsOfImportDeclaration(statements, decl) { + if (moduleInfo.exportEquals) { + return statements; + } + var importClause = decl.importClause; + if (!importClause) { + return statements; + } + if (importClause.name) { + statements = appendExportsOfDeclaration(statements, importClause); + } + var namedBindings = importClause.namedBindings; + if (namedBindings) { + switch (namedBindings.kind) { + case 237 /* NamespaceImport */: + statements = appendExportsOfDeclaration(statements, namedBindings); + break; + case 238 /* NamedImports */: + for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { + var importBinding = _a[_i]; + statements = appendExportsOfDeclaration(statements, importBinding); + } + break; } - function emitAttributes(attribs) { - for (var i = 0, n = attribs.length; i < n; i++) { - if (i > 0) { - write(" "); - } - if (attribs[i].kind === 247 /* JsxSpreadAttribute */) { - emitJsxSpreadAttribute(attribs[i]); - } - else { - ts.Debug.assert(attribs[i].kind === 246 /* JsxAttribute */); - emitJsxAttribute(attribs[i]); - } + } + return statements; + } + /** + * Appends the export of an ImportEqualsDeclaration to a statement list, returning the + * statement list. + * + * @param statements A statement list to which the down-level export statements are to be + * appended. If `statements` is `undefined`, a new array is allocated if statements are + * appended. + * @param decl The declaration whose exports are to be recorded. + */ + function appendExportsOfImportEqualsDeclaration(statements, decl) { + if (moduleInfo.exportEquals) { + return statements; + } + return appendExportsOfDeclaration(statements, decl); + } + /** + * Appends the exports of a VariableStatement to a statement list, returning the statement + * list. + * + * @param statements A statement list to which the down-level export statements are to be + * appended. If `statements` is `undefined`, a new array is allocated if statements are + * appended. + * @param node The VariableStatement whose exports are to be recorded. + * @param exportSelf A value indicating whether to also export each VariableDeclaration of + * `nodes` declaration list. + */ + function appendExportsOfVariableStatement(statements, node, exportSelf) { + if (moduleInfo.exportEquals) { + return statements; + } + for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + if (decl.initializer || exportSelf) { + statements = appendExportsOfBindingElement(statements, decl, exportSelf); + } + } + return statements; + } + /** + * Appends the exports of a VariableDeclaration or BindingElement to a statement list, + * returning the statement list. + * + * @param statements A statement list to which the down-level export statements are to be + * appended. If `statements` is `undefined`, a new array is allocated if statements are + * appended. + * @param decl The declaration whose exports are to be recorded. + * @param exportSelf A value indicating whether to also export the declaration itself. + */ + function appendExportsOfBindingElement(statements, decl, exportSelf) { + if (moduleInfo.exportEquals) { + return statements; + } + 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)) { + statements = appendExportsOfBindingElement(statements, element, exportSelf); } } - function emitJsxOpeningOrSelfClosingElement(node) { - write("<"); - emit(node.tagName); - if (node.attributes.length > 0 || (node.kind === 242 /* JsxSelfClosingElement */)) { - write(" "); + } + else if (!ts.isGeneratedIdentifier(decl.name)) { + var excludeName = void 0; + if (exportSelf) { + statements = appendExportStatement(statements, decl.name, ts.getLocalName(decl)); + excludeName = decl.name.text; + } + statements = appendExportsOfDeclaration(statements, decl, excludeName); + } + return statements; + } + /** + * Appends the exports of a ClassDeclaration or FunctionDeclaration to a statement list, + * returning the statement list. + * + * @param statements A statement list to which the down-level export statements are to be + * appended. If `statements` is `undefined`, a new array is allocated if statements are + * appended. + * @param decl The declaration whose exports are to be recorded. + */ + function appendExportsOfHoistedDeclaration(statements, decl) { + if (moduleInfo.exportEquals) { + return statements; + } + var excludeName; + if (ts.hasModifier(decl, 1 /* Export */)) { + var exportName = ts.hasModifier(decl, 512 /* Default */) ? ts.createLiteral("default") : decl.name; + statements = appendExportStatement(statements, exportName, ts.getLocalName(decl)); + excludeName = exportName.text; + } + if (decl.name) { + statements = appendExportsOfDeclaration(statements, decl, excludeName); + } + return statements; + } + /** + * Appends the exports of a declaration to a statement list, returning the statement list. + * + * @param statements A statement list to which the down-level export statements are to be + * appended. If `statements` is `undefined`, a new array is allocated if statements are + * appended. + * @param decl The declaration to export. + * @param excludeName An optional name to exclude from exports. + */ + function appendExportsOfDeclaration(statements, decl, excludeName) { + if (moduleInfo.exportEquals) { + return statements; + } + var name = ts.getDeclarationName(decl); + var exportSpecifiers = moduleInfo.exportSpecifiers[name.text]; + if (exportSpecifiers) { + for (var _i = 0, exportSpecifiers_1 = exportSpecifiers; _i < exportSpecifiers_1.length; _i++) { + var exportSpecifier = exportSpecifiers_1[_i]; + if (exportSpecifier.name.text !== excludeName) { + statements = appendExportStatement(statements, exportSpecifier.name, name); } - emitAttributes(node.attributes); - if (node.kind === 242 /* JsxSelfClosingElement */) { - write("/>"); + } + } + return statements; + } + /** + * Appends the down-level representation of an export to a statement list, returning the + * statement list. + * + * @param statements A statement list to which the down-level export statements are to be + * appended. If `statements` is `undefined`, a new array is allocated if statements are + * appended. + * @param exportName The name of the export. + * @param expression The expression to export. + * @param allowComments Whether to allow comments on the export. + */ + function appendExportStatement(statements, exportName, expression, allowComments) { + statements = ts.append(statements, createExportStatement(exportName, expression, allowComments)); + return statements; + } + /** + * Creates a call to the current file's export function to export a value. + * + * @param name The bound name of the export. + * @param value The exported value. + * @param allowComments An optional value indicating whether to emit comments for the statement. + */ + function createExportStatement(name, value, allowComments) { + var statement = ts.createStatement(createExportExpression(name, value)); + ts.startOnNewLine(statement); + if (!allowComments) { + ts.setEmitFlags(statement, 1536 /* NoComments */); + } + return statement; + } + /** + * Creates a call to the current file's export function to export a value. + * + * @param name The bound name of the export. + * @param value The exported value. + */ + function createExportExpression(name, value) { + var exportName = ts.isIdentifier(name) ? ts.createLiteral(name) : name; + return ts.createCall(exportFunction, /*typeArguments*/ undefined, [exportName, value]); + } + // + // Top-Level or Nested Source Element Visitors + // + /** + * Visit nested elements at the top-level of a module. + * + * @param node The node to visit. + */ + function nestedElementVisitor(node) { + switch (node.kind) { + case 205 /* VariableStatement */: + return visitVariableStatement(node); + case 225 /* FunctionDeclaration */: + return visitFunctionDeclaration(node); + case 226 /* ClassDeclaration */: + return visitClassDeclaration(node); + case 211 /* ForStatement */: + return visitForStatement(node); + case 212 /* ForInStatement */: + return visitForInStatement(node); + case 213 /* ForOfStatement */: + return visitForOfStatement(node); + case 209 /* DoStatement */: + return visitDoStatement(node); + case 210 /* WhileStatement */: + return visitWhileStatement(node); + case 219 /* LabeledStatement */: + return visitLabeledStatement(node); + case 217 /* WithStatement */: + return visitWithStatement(node); + case 218 /* SwitchStatement */: + return visitSwitchStatement(node); + case 232 /* CaseBlock */: + return visitCaseBlock(node); + case 253 /* CaseClause */: + return visitCaseClause(node); + case 254 /* DefaultClause */: + return visitDefaultClause(node); + case 221 /* TryStatement */: + return visitTryStatement(node); + case 256 /* CatchClause */: + return visitCatchClause(node); + case 204 /* Block */: + return visitBlock(node); + case 295 /* MergeDeclarationMarker */: + return visitMergeDeclarationMarker(node); + case 296 /* EndOfDeclarationMarker */: + return visitEndOfDeclarationMarker(node); + default: + return destructuringVisitor(node); + } + } + /** + * Visits the body of a ForStatement to hoist declarations. + * + * @param node The node to visit. + */ + function visitForStatement(node) { + var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; + enclosingBlockScopedContainer = node; + node = ts.updateFor(node, visitForInitializer(node.initializer), ts.visitNode(node.condition, destructuringVisitor, ts.isExpression, /*optional*/ true), ts.visitNode(node.incrementor, destructuringVisitor, ts.isExpression, /*optional*/ true), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement)); + enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; + return node; + } + /** + * Visits the body of a ForInStatement to hoist declarations. + * + * @param node The node to visit. + */ + function visitForInStatement(node) { + var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; + enclosingBlockScopedContainer = node; + node = ts.updateForIn(node, visitForInitializer(node.initializer), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, /*optional*/ false, ts.liftToBlock)); + enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; + return node; + } + /** + * Visits the body of a ForOfStatement to hoist declarations. + * + * @param node The node to visit. + */ + function visitForOfStatement(node) { + var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; + enclosingBlockScopedContainer = node; + node = ts.updateForOf(node, visitForInitializer(node.initializer), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, /*optional*/ false, ts.liftToBlock)); + enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; + return node; + } + /** + * Determines whether to hoist the initializer of a ForStatement, ForInStatement, or + * ForOfStatement. + * + * @param node The node to test. + */ + function shouldHoistForInitializer(node) { + return ts.isVariableDeclarationList(node) + && shouldHoistVariableDeclarationList(node); + } + /** + * Visits the initializer of a ForStatement, ForInStatement, or ForOfStatement + * + * @param node The node to visit. + */ + function visitForInitializer(node) { + if (shouldHoistForInitializer(node)) { + var expressions = void 0; + for (var _i = 0, _a = node.declarations; _i < _a.length; _i++) { + var variable = _a[_i]; + expressions = ts.append(expressions, transformInitializedVariable(variable, /*isExportedDeclaration*/ false)); + } + return expressions ? ts.inlineExpressions(expressions) : ts.createOmittedExpression(); + } + else { + return ts.visitEachChild(node, nestedElementVisitor, context); + } + } + /** + * Visits the body of a DoStatement to hoist declarations. + * + * @param node The node to visit. + */ + function visitDoStatement(node) { + return ts.updateDo(node, ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, /*optional*/ false, ts.liftToBlock), ts.visitNode(node.expression, destructuringVisitor, ts.isExpression)); + } + /** + * Visits the body of a WhileStatement to hoist declarations. + * + * @param node The node to visit. + */ + function visitWhileStatement(node) { + return ts.updateWhile(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, /*optional*/ false, ts.liftToBlock)); + } + /** + * Visits the body of a LabeledStatement to hoist declarations. + * + * @param node The node to visit. + */ + function visitLabeledStatement(node) { + return ts.updateLabel(node, node.label, ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, /*optional*/ false, ts.liftToBlock)); + } + /** + * Visits the body of a WithStatement to hoist declarations. + * + * @param node The node to visit. + */ + function visitWithStatement(node) { + return ts.updateWith(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.statement, nestedElementVisitor, ts.isStatement, /*optional*/ false, ts.liftToBlock)); + } + /** + * Visits the body of a SwitchStatement to hoist declarations. + * + * @param node The node to visit. + */ + function visitSwitchStatement(node) { + return ts.updateSwitch(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNode(node.caseBlock, nestedElementVisitor, ts.isCaseBlock)); + } + /** + * Visits the body of a CaseBlock to hoist declarations. + * + * @param node The node to visit. + */ + function visitCaseBlock(node) { + var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; + enclosingBlockScopedContainer = node; + node = ts.updateCaseBlock(node, ts.visitNodes(node.clauses, nestedElementVisitor, ts.isCaseOrDefaultClause)); + enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; + return node; + } + /** + * Visits the body of a CaseClause to hoist declarations. + * + * @param node The node to visit. + */ + function visitCaseClause(node) { + return ts.updateCaseClause(node, ts.visitNode(node.expression, destructuringVisitor, ts.isExpression), ts.visitNodes(node.statements, nestedElementVisitor, ts.isStatement)); + } + /** + * Visits the body of a DefaultClause to hoist declarations. + * + * @param node The node to visit. + */ + function visitDefaultClause(node) { + return ts.visitEachChild(node, nestedElementVisitor, context); + } + /** + * Visits the body of a TryStatement to hoist declarations. + * + * @param node The node to visit. + */ + function visitTryStatement(node) { + return ts.visitEachChild(node, nestedElementVisitor, context); + } + /** + * Visits the body of a CatchClause to hoist declarations. + * + * @param node The node to visit. + */ + function visitCatchClause(node) { + var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; + enclosingBlockScopedContainer = node; + node = ts.updateCatchClause(node, node.variableDeclaration, ts.visitNode(node.block, nestedElementVisitor, ts.isBlock)); + enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; + return node; + } + /** + * Visits the body of a Block to hoist declarations. + * + * @param node The node to visit. + */ + function visitBlock(node) { + var savedEnclosingBlockScopedContainer = enclosingBlockScopedContainer; + enclosingBlockScopedContainer = node; + node = ts.visitEachChild(node, nestedElementVisitor, context); + enclosingBlockScopedContainer = savedEnclosingBlockScopedContainer; + return node; + } + // + // Destructuring Assignment Visitors + // + /** + * Visit nodes to flatten destructuring assignments to exported symbols. + * + * @param node The node to visit. + */ + function destructuringVisitor(node) { + if (node.transformFlags & 1024 /* DestructuringAssignment */ + && node.kind === 192 /* BinaryExpression */) { + return visitDestructuringAssignment(node); + } + else if (node.transformFlags & 2048 /* ContainsDestructuringAssignment */) { + return ts.visitEachChild(node, destructuringVisitor, context); + } + else { + return node; + } + } + /** + * Visits a DestructuringAssignment to flatten destructuring to exported symbols. + * + * @param node The node to visit. + */ + function visitDestructuringAssignment(node) { + if (hasExportedReferenceInDestructuringTarget(node.left)) { + return ts.flattenDestructuringAssignment(node, destructuringVisitor, context, 0 /* All */, + /*needsValue*/ true); + } + return ts.visitEachChild(node, destructuringVisitor, context); + } + /** + * Determines whether the target of a destructuring assigment refers to an exported symbol. + * + * @param node The destructuring target. + */ + function hasExportedReferenceInDestructuringTarget(node) { + if (ts.isAssignmentExpression(node)) { + return hasExportedReferenceInDestructuringTarget(node.left); + } + else if (ts.isSpreadExpression(node)) { + return hasExportedReferenceInDestructuringTarget(node.expression); + } + else if (ts.isObjectLiteralExpression(node)) { + return ts.some(node.properties, hasExportedReferenceInDestructuringTarget); + } + else if (ts.isArrayLiteralExpression(node)) { + return ts.some(node.elements, hasExportedReferenceInDestructuringTarget); + } + else if (ts.isShorthandPropertyAssignment(node)) { + return hasExportedReferenceInDestructuringTarget(node.name); + } + else if (ts.isPropertyAssignment(node)) { + return hasExportedReferenceInDestructuringTarget(node.initializer); + } + else if (ts.isIdentifier(node)) { + var container = resolver.getReferencedExportContainer(node); + return container !== undefined && container.kind === 261 /* SourceFile */; + } + else { + return false; + } + } + // + // Modifier Visitors + // + /** + * Visit nodes to elide module-specific modifiers. + * + * @param node The node to visit. + */ + function modifierVisitor(node) { + switch (node.kind) { + case 83 /* ExportKeyword */: + case 78 /* DefaultKeyword */: + return undefined; + } + return node; + } + // + // Emit Notification + // + /** + * Hook for node emit notifications. + * + * @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 (node.kind === 261 /* SourceFile */) { + var id = ts.getOriginalNodeId(node); + currentSourceFile = node; + moduleInfo = moduleInfoMap[id]; + exportFunction = exportFunctionsMap[id]; + noSubstitution = noSubstitutionMap[id]; + if (noSubstitution) { + delete noSubstitutionMap[id]; + } + previousOnEmitNode(emitContext, node, emitCallback); + currentSourceFile = undefined; + moduleInfo = undefined; + exportFunction = undefined; + noSubstitution = 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 (isSubstitutionPrevented(node)) { + return node; + } + if (emitContext === 1 /* Expression */) { + return substituteExpression(node); + } + return node; + } + /** + * Substitute the expression, if necessary. + * + * @param node The node to substitute. + */ + function substituteExpression(node) { + switch (node.kind) { + case 70 /* Identifier */: + return substituteExpressionIdentifier(node); + case 192 /* BinaryExpression */: + return substituteBinaryExpression(node); + case 190 /* PrefixUnaryExpression */: + case 191 /* PostfixUnaryExpression */: + return substituteUnaryExpression(node); + } + return node; + } + /** + * Substitution for an Identifier expression that may contain an imported or exported symbol. + * + * @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. + // + // - We do not substitute generated identifiers for any reason. + // - We do not substitute identifiers tagged with the LocalName flag. + if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { + var importDeclaration = resolver.getReferencedImportDeclaration(node); + if (importDeclaration) { + if (ts.isImportClause(importDeclaration)) { + return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default"), + /*location*/ node); + } + else if (ts.isImportSpecifier(importDeclaration)) { + return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(importDeclaration.propertyName || importDeclaration.name), + /*location*/ node); + } + } + } + return node; + } + /** + * Substitution for a BinaryExpression that may contain an imported or exported symbol. + * + * @param node The node to substitute. + */ + function substituteBinaryExpression(node) { + // When we see an assignment expression whose left-hand side is an exported symbol, + // we should ensure all exports of that symbol are updated with the correct value. + // + // - We do not substitute generated identifiers for any reason. + // - We do not substitute identifiers tagged with the LocalName flag. + // - We do not substitute identifiers that were originally the name of an enum or + // namespace due to how they are transformed in TypeScript. + // - We only substitute identifiers that are exported at the top level. + if (ts.isAssignmentOperator(node.operatorToken.kind) + && ts.isIdentifier(node.left) + && !ts.isGeneratedIdentifier(node.left) + && !ts.isLocalName(node.left) + && !ts.isDeclarationNameOfEnumOrNamespace(node.left)) { + var exportedNames = getExports(node.left); + if (exportedNames) { + // For each additional export of the declaration, apply an export assignment. + var expression = node; + for (var _i = 0, exportedNames_1 = exportedNames; _i < exportedNames_1.length; _i++) { + var exportName = exportedNames_1[_i]; + expression = createExportExpression(exportName, preventSubstitution(expression)); + } + return expression; + } + } + return node; + } + /** + * Substitution for a UnaryExpression that may contain an imported or exported symbol. + * + * @param node The node to substitute. + */ + function substituteUnaryExpression(node) { + // When we see a prefix or postfix increment expression whose operand is an exported + // symbol, we should ensure all exports of that symbol are updated with the correct + // value. + // + // - We do not substitute generated identifiers for any reason. + // - We do not substitute identifiers tagged with the LocalName flag. + // - We do not substitute identifiers that were originally the name of an enum or + // namespace due to how they are transformed in TypeScript. + // - We only substitute identifiers that are exported at the top level. + if ((node.operator === 42 /* PlusPlusToken */ || node.operator === 43 /* MinusMinusToken */) + && ts.isIdentifier(node.operand) + && !ts.isGeneratedIdentifier(node.operand) + && !ts.isLocalName(node.operand) + && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { + var exportedNames = getExports(node.operand); + if (exportedNames) { + var expression = node.kind === 191 /* PostfixUnaryExpression */ + ? ts.createPrefix(node.operator, node.operand, + /*location*/ node) + : node; + for (var _i = 0, exportedNames_2 = exportedNames; _i < exportedNames_2.length; _i++) { + var exportName = exportedNames_2[_i]; + expression = createExportExpression(exportName, preventSubstitution(expression)); + } + if (node.kind === 191 /* PostfixUnaryExpression */) { + expression = node.operator === 42 /* PlusPlusToken */ + ? ts.createSubtract(preventSubstitution(expression), ts.createLiteral(1)) + : ts.createAdd(preventSubstitution(expression), ts.createLiteral(1)); + } + return expression; + } + } + return node; + } + /** + * Gets the exports of a name. + * + * @param name The name. + */ + function getExports(name) { + var exportedNames; + if (!ts.isGeneratedIdentifier(name)) { + var valueDeclaration = resolver.getReferencedImportDeclaration(name) + || resolver.getReferencedValueDeclaration(name); + if (valueDeclaration) { + var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false); + if (exportContainer && exportContainer.kind === 261 /* SourceFile */) { + exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration)); + } + exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); + } + } + return exportedNames; + } + /** + * Prevent substitution of a node for this transformer. + * + * @param node The node which should not be substituted. + */ + function preventSubstitution(node) { + if (noSubstitution === undefined) + noSubstitution = ts.createMap(); + noSubstitution[ts.getNodeId(node)] = true; + return node; + } + /** + * Determines whether a node should not be substituted. + * + * @param node The node to test. + */ + function isSubstitutionPrevented(node) { + return noSubstitution && node.id && noSubstitution[node.id]; + } + } + ts.transformSystemModule = transformSystemModule; +})(ts || (ts = {})); +/// +/// +/*@internal*/ +var ts; +(function (ts) { + function transformModule(context) { + var transformModuleDelegates = ts.createMap((_a = {}, + _a[ts.ModuleKind.None] = transformCommonJSModule, + _a[ts.ModuleKind.CommonJS] = transformCommonJSModule, + _a[ts.ModuleKind.AMD] = transformAMDModule, + _a[ts.ModuleKind.UMD] = transformUMDModule, + _a)); + var startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment; + var compilerOptions = context.getCompilerOptions(); + var resolver = context.getEmitResolver(); + var host = context.getEmitHost(); + var languageVersion = ts.getEmitScriptTarget(compilerOptions); + var moduleKind = ts.getEmitModuleKind(compilerOptions); + var previousOnSubstituteNode = context.onSubstituteNode; + var previousOnEmitNode = context.onEmitNode; + context.onSubstituteNode = onSubstituteNode; + context.onEmitNode = onEmitNode; + context.enableSubstitution(70 /* Identifier */); // Substitutes expression identifiers with imported/exported symbols. + context.enableSubstitution(192 /* BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(190 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableSubstitution(191 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols. + context.enableSubstitution(258 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. + context.enableEmitNotification(261 /* SourceFile */); // Restore state when substituting nodes in a file. + var moduleInfoMap = ts.createMap(); // The ExternalModuleInfo for each file. + var deferredExports = ts.createMap(); // Exports to defer until an EndOfDeclarationMarker is found. + var currentSourceFile; // The current file. + var currentModuleInfo; // The ExternalModuleInfo for the current file. + var noSubstitution; // Set of nodes for which substitution rules should be ignored. + return transformSourceFile; + /** + * Transforms the module aspects of a SourceFile. + * + * @param node The SourceFile node. + */ + function transformSourceFile(node) { + if (ts.isDeclarationFile(node) + || !(ts.isExternalModule(node) + || compilerOptions.isolatedModules)) { + return node; + } + currentSourceFile = node; + 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); + currentSourceFile = undefined; + currentModuleInfo = undefined; + return ts.aggregateTransformFlags(updated); + } + /** + * Transforms a SourceFile into a CommonJS module. + * + * @param node The SourceFile node. + */ + function transformCommonJSModule(node) { + 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.addEmitHelper(updated, exportStarHelper); + } + return updated; + } + /** + * Transforms a SourceFile into an AMD module. + * + * @param node The SourceFile node. + */ + function transformAMDModule(node) { + var define = ts.createIdentifier("define"); + var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions); + // An AMD define function has the following shape: + // + // define(id?, dependencies?, factory); + // + // This has the shape of the following: + // + // define(name, ["module1", "module2"], function (module1Alias) { ... } + // + // The location of the alias in the parameter list in the factory function needs to + // match the position of the module name in the dependency list. + // + // To ensure this is true in cases of modules with no aliases, e.g.: + // + // import "module" + // + // or + // + // /// + // + // we need to add modules without alias names to the end of the dependencies list + var _a = collectAsynchronousDependencies(node, /*includeNonAmdDependencies*/ true), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; + // Create an updated SourceFile: + // + // define(moduleName?, ["module1", "module2"], function ... + return ts.updateSourceFileNode(node, ts.createNodeArray([ + ts.createStatement(ts.createCall(define, + /*typeArguments*/ undefined, (moduleName ? [moduleName] : []).concat([ + // Add the dependency array argument: + // + // ["require", "exports", module1", "module2", ...] + ts.createArrayLiteral([ + ts.createLiteral("require"), + ts.createLiteral("exports") + ].concat(aliasedModuleNames, unaliasedModuleNames)), + // Add the module body function argument: + // + // function (require, exports, module1, module2) ... + ts.createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, [ + ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "require"), + ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "exports") + ].concat(importAliasNames), + /*type*/ undefined, transformAsynchronousModuleBody(node)) + ]))) + ], + /*location*/ node.statements)); + } + /** + * Transforms a SourceFile into a UMD module. + * + * @param node The SourceFile node. + */ + function transformUMDModule(node) { + var _a = collectAsynchronousDependencies(node, /*includeNonAmdDependencies*/ false), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames; + var umdHeader = ts.createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "factory")], + /*type*/ undefined, ts.createBlock([ + ts.createIf(ts.createLogicalAnd(ts.createTypeCheck(ts.createIdentifier("module"), "object"), ts.createTypeCheck(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), "object")), ts.createBlock([ + ts.createVariableStatement( + /*modifiers*/ undefined, [ + ts.createVariableDeclaration("v", + /*type*/ undefined, ts.createCall(ts.createIdentifier("factory"), + /*typeArguments*/ undefined, [ + ts.createIdentifier("require"), + ts.createIdentifier("exports") + ])) + ]), + ts.setEmitFlags(ts.createIf(ts.createStrictInequality(ts.createIdentifier("v"), ts.createIdentifier("undefined")), ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), ts.createIdentifier("v")))), 1 /* SingleLine */) + ]), ts.createIf(ts.createLogicalAnd(ts.createTypeCheck(ts.createIdentifier("define"), "function"), ts.createPropertyAccess(ts.createIdentifier("define"), "amd")), ts.createBlock([ + ts.createStatement(ts.createCall(ts.createIdentifier("define"), + /*typeArguments*/ undefined, [ + ts.createArrayLiteral([ + ts.createLiteral("require"), + ts.createLiteral("exports") + ].concat(aliasedModuleNames, unaliasedModuleNames)), + ts.createIdentifier("factory") + ])) + ]))) + ], + /*location*/ undefined, + /*multiLine*/ true)); + // Create an updated SourceFile: + // + // (function (factory) { + // if (typeof module === "object" && typeof module.exports === "object") { + // var v = factory(require, exports); + // if (v !== undefined) module.exports = v; + // } + // else if (typeof define === 'function' && define.amd) { + // define(["require", "exports"], factory); + // } + // })(function ...) + return ts.updateSourceFileNode(node, ts.createNodeArray([ + ts.createStatement(ts.createCall(umdHeader, + /*typeArguments*/ undefined, [ + // Add the module body function argument: + // + // function (require, exports) ... + ts.createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, [ + ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "require"), + ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "exports") + ].concat(importAliasNames), + /*type*/ undefined, transformAsynchronousModuleBody(node)) + ])) + ], + /*location*/ node.statements)); + } + /** + * Collect the additional asynchronous dependencies for the module. + * + * @param node The source file. + * @param includeNonAmdDependencies A value indicating whether to include non-AMD dependencies. + */ + function collectAsynchronousDependencies(node, includeNonAmdDependencies) { + // names of modules with corresponding parameter in the factory function + var aliasedModuleNames = []; + // names of modules with no corresponding parameters in factory function + var unaliasedModuleNames = []; + // names of the parameters in the factory function; these + // parameters need to match the indexes of the corresponding + // module names in aliasedModuleNames. + var importAliasNames = []; + // Fill in amd-dependency tags + for (var _i = 0, _a = node.amdDependencies; _i < _a.length; _i++) { + var amdDependency = _a[_i]; + if (amdDependency.name) { + aliasedModuleNames.push(ts.createLiteral(amdDependency.path)); + importAliasNames.push(ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, amdDependency.name)); + } + else { + unaliasedModuleNames.push(ts.createLiteral(amdDependency.path)); + } + } + for (var _b = 0, _c = currentModuleInfo.externalImports; _b < _c.length; _b++) { + var importNode = _c[_b]; + // Find the name of the external module + var externalModuleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions); + // Find the name of the module alias, if there is one + var importAliasName = ts.getLocalNameForExternalImport(importNode, currentSourceFile); + 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, 4 /* NoSubstitution */); + aliasedModuleNames.push(externalModuleName); + importAliasNames.push(ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, importAliasName)); + } + else { + unaliasedModuleNames.push(externalModuleName); + } + } + return { aliasedModuleNames: aliasedModuleNames, unaliasedModuleNames: unaliasedModuleNames, importAliasNames: importAliasNames }; + } + /** + * Transforms a SourceFile into an AMD or UMD module body. + * + * @param node The SourceFile node. + */ + function transformAsynchronousModuleBody(node) { + startLexicalEnvironment(); + 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. + ts.addRange(statements, endLexicalEnvironment()); + // Append the 'export =' statement if provided. + addExportEqualsIfNeeded(statements, /*emitAsReturn*/ true); + var body = ts.createBlock(statements, /*location*/ undefined, /*multiLine*/ true); + if (currentModuleInfo.hasExportStarsToExportValues) { + // If we have any `export * from ...` declarations + // we need to inform the emitter to add the __export helper. + ts.addEmitHelper(body, exportStarHelper); + } + return body; + } + /** + * Adds the down-level representation of `export=` to the statement list if one exists + * in the source file. + * + * @param statements The Statement list to modify. + * @param emitAsReturn A value indicating whether to emit the `export=` statement as a + * return statement. + */ + function addExportEqualsIfNeeded(statements, emitAsReturn) { + if (currentModuleInfo.exportEquals) { + if (emitAsReturn) { + var statement = ts.createReturn(currentModuleInfo.exportEquals.expression, + /*location*/ currentModuleInfo.exportEquals); + 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, 1536 /* NoComments */); + statements.push(statement); + } + } + } + // + // Top-Level Source Element Visitors + // + /** + * Visits a node at the top level of the source file. + * + * @param node The node to visit. + */ + function sourceElementVisitor(node) { + switch (node.kind) { + case 235 /* ImportDeclaration */: + return visitImportDeclaration(node); + case 234 /* ImportEqualsDeclaration */: + return visitImportEqualsDeclaration(node); + case 241 /* ExportDeclaration */: + return visitExportDeclaration(node); + case 240 /* ExportAssignment */: + return visitExportAssignment(node); + case 205 /* VariableStatement */: + return visitVariableStatement(node); + case 225 /* FunctionDeclaration */: + return visitFunctionDeclaration(node); + case 226 /* ClassDeclaration */: + return visitClassDeclaration(node); + case 295 /* MergeDeclarationMarker */: + return visitMergeDeclarationMarker(node); + case 296 /* EndOfDeclarationMarker */: + return visitEndOfDeclarationMarker(node); + default: + // This visitor does not descend into the tree, as export/import statements + // are only transformed at the top level of a file. + return node; + } + } + /** + * Visits an ImportDeclaration node. + * + * @param node The node to visit. + */ + function visitImportDeclaration(node) { + var statements; + var namespaceDeclaration = ts.getNamespaceDeclarationNode(node); + if (moduleKind !== ts.ModuleKind.AMD) { + if (!node.importClause) { + // import "mod"; + return ts.createStatement(createRequireCall(node), /*location*/ node); + } + else { + var variables = []; + if (namespaceDeclaration && !ts.isDefaultImport(node)) { + // import * as n from "mod"; + variables.push(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), + /*type*/ undefined, createRequireCall(node))); } else { + // import d from "mod"; + // import { x, y } from "mod"; + // import d, { x, y } from "mod"; + // import d, * as n from "mod"; + variables.push(ts.createVariableDeclaration(ts.getGeneratedNameForNode(node), + /*type*/ undefined, createRequireCall(node))); + if (namespaceDeclaration && ts.isDefaultImport(node)) { + variables.push(ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), + /*type*/ undefined, ts.getGeneratedNameForNode(node))); + } + } + statements = ts.append(statements, ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList(variables, + /*location*/ undefined, languageVersion >= 2 /* ES2015 */ ? 2 /* Const */ : 0 /* None */), + /*location*/ node)); + } + } + else if (namespaceDeclaration && ts.isDefaultImport(node)) { + // import d, * as n from "mod"; + statements = ts.append(statements, ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration(ts.getSynthesizedClone(namespaceDeclaration.name), + /*type*/ undefined, ts.getGeneratedNameForNode(node), + /*location*/ node) + ], + /*location*/ undefined, languageVersion >= 2 /* ES2015 */ ? 2 /* Const */ : 0 /* None */))); + } + if (hasAssociatedEndOfDeclarationMarker(node)) { + // Defer exports until we encounter an EndOfDeclarationMarker node + var id = ts.getOriginalNodeId(node); + deferredExports[id] = appendExportsOfImportDeclaration(deferredExports[id], node); + } + else { + statements = appendExportsOfImportDeclaration(statements, node); + } + return ts.singleOrMany(statements); + } + /** + * Creates a `require()` call to import an external module. + * + * @param importNode The declararation to import. + */ + function createRequireCall(importNode) { + var moduleName = ts.getExternalModuleNameLiteral(importNode, currentSourceFile, host, resolver, compilerOptions); + var args = []; + if (moduleName) { + args.push(moduleName); + } + return ts.createCall(ts.createIdentifier("require"), /*typeArguments*/ undefined, args); + } + /** + * Visits an ImportEqualsDeclaration node. + * + * @param node The node to visit. + */ + function visitImportEqualsDeclaration(node) { + ts.Debug.assert(ts.isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer."); + var statements; + if (moduleKind !== ts.ModuleKind.AMD) { + if (ts.hasModifier(node, 1 /* Export */)) { + statements = ts.append(statements, ts.createStatement(createExportExpression(node.name, createRequireCall(node)), + /*location*/ node)); + } + else { + statements = ts.append(statements, ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration(ts.getSynthesizedClone(node.name), + /*type*/ undefined, createRequireCall(node)) + ], + /*location*/ undefined, + /*flags*/ languageVersion >= 2 /* ES2015 */ ? 2 /* Const */ : 0 /* None */), + /*location*/ node)); + } + } + else { + if (ts.hasModifier(node, 1 /* Export */)) { + statements = ts.append(statements, ts.createStatement(createExportExpression(ts.getExportName(node), ts.getLocalName(node)), + /*location*/ node)); + } + } + if (hasAssociatedEndOfDeclarationMarker(node)) { + // Defer exports until we encounter an EndOfDeclarationMarker node + var id = ts.getOriginalNodeId(node); + deferredExports[id] = appendExportsOfImportEqualsDeclaration(deferredExports[id], node); + } + else { + statements = appendExportsOfImportEqualsDeclaration(statements, node); + } + return ts.singleOrMany(statements); + } + /** + * Visits an ExportDeclaration node. + * + * @param The node to visit. + */ + function visitExportDeclaration(node) { + if (!node.moduleSpecifier) { + // Elide export declarations with no module specifier as they are handled + // elsewhere. + return undefined; + } + var generatedName = ts.getGeneratedNameForNode(node); + if (node.exportClause) { + var statements = []; + // export { x, y } from "mod"; + if (moduleKind !== ts.ModuleKind.AMD) { + statements.push(ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList([ + ts.createVariableDeclaration(generatedName, + /*type*/ undefined, createRequireCall(node)) + ]), + /*location*/ node)); + } + for (var _i = 0, _a = node.exportClause.elements; _i < _a.length; _i++) { + var specifier = _a[_i]; + var exportedValue = ts.createPropertyAccess(generatedName, specifier.propertyName || specifier.name); + statements.push(ts.createStatement(createExportExpression(ts.getExportName(specifier), exportedValue), + /*location*/ specifier)); + } + return ts.singleOrMany(statements); + } + else { + // export * from "mod"; + return ts.createStatement(ts.createCall(ts.createIdentifier("__export"), + /*typeArguments*/ undefined, [ + moduleKind !== ts.ModuleKind.AMD + ? createRequireCall(node) + : generatedName + ]), + /*location*/ node); + } + } + /** + * Visits an ExportAssignment node. + * + * @param node The node to visit. + */ + function visitExportAssignment(node) { + if (node.isExportEquals) { + return undefined; + } + var statements; + var original = node.original; + if (original && hasAssociatedEndOfDeclarationMarker(original)) { + // Defer exports until we encounter an EndOfDeclarationMarker node + var id = ts.getOriginalNodeId(node); + deferredExports[id] = appendExportStatement(deferredExports[id], ts.createIdentifier("default"), node.expression, /*location*/ node, /*allowComments*/ true); + } + else { + statements = appendExportStatement(statements, ts.createIdentifier("default"), node.expression, /*location*/ node, /*allowComments*/ true); + } + return ts.singleOrMany(statements); + } + /** + * Visits a FunctionDeclaration node. + * + * @param node The node to visit. + */ + function visitFunctionDeclaration(node) { + var statements; + if (ts.hasModifier(node, 1 /* Export */)) { + statements = ts.append(statements, ts.setOriginalNode(ts.createFunctionDeclaration( + /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, ts.getDeclarationName(node, /*allowComments*/ true, /*allowSourceMaps*/ true), + /*typeParameters*/ undefined, node.parameters, + /*type*/ undefined, node.body, + /*location*/ node), + /*original*/ node)); + } + else { + statements = ts.append(statements, node); + } + if (hasAssociatedEndOfDeclarationMarker(node)) { + // Defer exports until we encounter an EndOfDeclarationMarker node + var id = ts.getOriginalNodeId(node); + deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node); + } + else { + statements = appendExportsOfHoistedDeclaration(statements, node); + } + return ts.singleOrMany(statements); + } + /** + * Visits a ClassDeclaration node. + * + * @param node The node to visit. + */ + function visitClassDeclaration(node) { + var statements; + if (ts.hasModifier(node, 1 /* Export */)) { + statements = ts.append(statements, ts.setOriginalNode(ts.createClassDeclaration( + /*decorators*/ undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.getDeclarationName(node, /*allowComments*/ true, /*allowSourceMaps*/ true), + /*typeParameters*/ undefined, node.heritageClauses, node.members, + /*location*/ node), + /*original*/ node)); + } + else { + statements = ts.append(statements, node); + } + if (hasAssociatedEndOfDeclarationMarker(node)) { + // Defer exports until we encounter an EndOfDeclarationMarker node + var id = ts.getOriginalNodeId(node); + deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node); + } + else { + statements = appendExportsOfHoistedDeclaration(statements, node); + } + return ts.singleOrMany(statements); + } + /** + * Visits a VariableStatement node. + * + * @param node The node to visit. + */ + function visitVariableStatement(node) { + var statements; + var variables; + var expressions; + if (ts.hasModifier(node, 1 /* Export */)) { + var modifiers = void 0; + // If we're exporting these variables, then these just become assignments to 'exports.x'. + // We only want to emit assignments for variables with initializers. + for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { + var variable = _a[_i]; + if (ts.isIdentifier(variable.name) && ts.isLocalName(variable.name)) { + if (!modifiers) { + modifiers = ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier); + } + variables = ts.append(variables, variable); + } + else if (variable.initializer) { + expressions = ts.append(expressions, transformInitializedVariable(variable)); + } + } + if (variables) { + statements = ts.append(statements, ts.updateVariableStatement(node, modifiers, ts.updateVariableDeclarationList(node.declarationList, variables))); + } + if (expressions) { + statements = ts.append(statements, ts.createStatement(ts.inlineExpressions(expressions), /*location*/ node)); + } + } + else { + statements = ts.append(statements, node); + } + if (hasAssociatedEndOfDeclarationMarker(node)) { + // Defer exports until we encounter an EndOfDeclarationMarker node + var id = ts.getOriginalNodeId(node); + deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node); + } + else { + statements = appendExportsOfVariableStatement(statements, node); + } + return ts.singleOrMany(statements); + } + /** + * Transforms an exported variable with an initializer into an expression. + * + * @param node The node to transform. + */ + function transformInitializedVariable(node) { + if (ts.isBindingPattern(node.name)) { + return ts.flattenDestructuringAssignment(node, + /*visitor*/ undefined, context, 0 /* All */, + /*needsValue*/ false, createExportExpression); + } + else { + return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), node.name, + /*location*/ node.name), node.initializer); + } + } + /** + * Visits a MergeDeclarationMarker used as a placeholder for the beginning of a merged + * and transformed declaration. + * + * @param node The node to visit. + */ + function visitMergeDeclarationMarker(node) { + // For an EnumDeclaration or ModuleDeclaration that merges with a preceeding + // declaration we do not emit a leading variable declaration. To preserve the + // begin/end semantics of the declararation and to properly handle exports + // we wrapped the leading variable declaration in a `MergeDeclarationMarker`. + // + // To balance the declaration, add the exports of the elided variable + // statement. + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 205 /* VariableStatement */) { + var id = ts.getOriginalNodeId(node); + deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); + } + return node; + } + /** + * Determines whether a node has an associated EndOfDeclarationMarker. + * + * @param node The node to test. + */ + function hasAssociatedEndOfDeclarationMarker(node) { + return (ts.getEmitFlags(node) & 2097152 /* HasEndOfDeclarationMarker */) !== 0; + } + /** + * Visits a DeclarationMarker used as a placeholder for the end of a transformed + * declaration. + * + * @param node The node to visit. + */ + function visitEndOfDeclarationMarker(node) { + // For some transformations we emit an `EndOfDeclarationMarker` to mark the actual + // end of the transformed declaration. We use this marker to emit any deferred exports + // of the declaration. + var id = ts.getOriginalNodeId(node); + var statements = deferredExports[id]; + if (statements) { + delete deferredExports[id]; + return ts.append(statements, node); + } + return node; + } + /** + * Appends the exports of an ImportDeclaration to a statement list, returning the + * statement list. + * + * @param statements A statement list to which the down-level export statements are to be + * appended. If `statements` is `undefined`, a new array is allocated if statements are + * appended. + * @param decl The declaration whose exports are to be recorded. + */ + function appendExportsOfImportDeclaration(statements, decl) { + if (currentModuleInfo.exportEquals) { + return statements; + } + var importClause = decl.importClause; + if (!importClause) { + return statements; + } + if (importClause.name) { + statements = appendExportsOfDeclaration(statements, importClause); + } + var namedBindings = importClause.namedBindings; + if (namedBindings) { + switch (namedBindings.kind) { + case 237 /* NamespaceImport */: + statements = appendExportsOfDeclaration(statements, namedBindings); + break; + case 238 /* NamedImports */: + for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { + var importBinding = _a[_i]; + statements = appendExportsOfDeclaration(statements, importBinding); + } + break; + } + } + return statements; + } + /** + * Appends the exports of an ImportEqualsDeclaration to a statement list, returning the + * statement list. + * + * @param statements A statement list to which the down-level export statements are to be + * appended. If `statements` is `undefined`, a new array is allocated if statements are + * appended. + * @param decl The declaration whose exports are to be recorded. + */ + function appendExportsOfImportEqualsDeclaration(statements, decl) { + if (currentModuleInfo.exportEquals) { + return statements; + } + return appendExportsOfDeclaration(statements, decl); + } + /** + * Appends the exports of a VariableStatement to a statement list, returning the statement + * list. + * + * @param statements A statement list to which the down-level export statements are to be + * appended. If `statements` is `undefined`, a new array is allocated if statements are + * appended. + * @param node The VariableStatement whose exports are to be recorded. + */ + function appendExportsOfVariableStatement(statements, node) { + if (currentModuleInfo.exportEquals) { + return statements; + } + for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + statements = appendExportsOfBindingElement(statements, decl); + } + return statements; + } + /** + * Appends the exports of a VariableDeclaration or BindingElement to a statement list, + * returning the statement list. + * + * @param statements A statement list to which the down-level export statements are to be + * appended. If `statements` is `undefined`, a new array is allocated if statements are + * appended. + * @param decl The declaration whose exports are to be recorded. + */ + function appendExportsOfBindingElement(statements, decl) { + if (currentModuleInfo.exportEquals) { + return statements; + } + 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)) { + statements = appendExportsOfBindingElement(statements, element); + } + } + } + else if (!ts.isGeneratedIdentifier(decl.name)) { + statements = appendExportsOfDeclaration(statements, decl); + } + return statements; + } + /** + * Appends the exports of a ClassDeclaration or FunctionDeclaration to a statement list, + * returning the statement list. + * + * @param statements A statement list to which the down-level export statements are to be + * appended. If `statements` is `undefined`, a new array is allocated if statements are + * appended. + * @param decl The declaration whose exports are to be recorded. + */ + function appendExportsOfHoistedDeclaration(statements, decl) { + if (currentModuleInfo.exportEquals) { + return statements; + } + if (ts.hasModifier(decl, 1 /* Export */)) { + var exportName = ts.hasModifier(decl, 512 /* Default */) ? ts.createIdentifier("default") : decl.name; + statements = appendExportStatement(statements, exportName, ts.getLocalName(decl), /*location*/ decl); + } + if (decl.name) { + statements = appendExportsOfDeclaration(statements, decl); + } + return statements; + } + /** + * Appends the exports of a declaration to a statement list, returning the statement list. + * + * @param statements A statement list to which the down-level export statements are to be + * appended. If `statements` is `undefined`, a new array is allocated if statements are + * appended. + * @param decl The declaration to export. + */ + function appendExportsOfDeclaration(statements, decl) { + var name = ts.getDeclarationName(decl); + var exportSpecifiers = currentModuleInfo.exportSpecifiers[name.text]; + if (exportSpecifiers) { + for (var _i = 0, exportSpecifiers_2 = exportSpecifiers; _i < exportSpecifiers_2.length; _i++) { + var exportSpecifier = exportSpecifiers_2[_i]; + statements = appendExportStatement(statements, exportSpecifier.name, name, /*location*/ exportSpecifier.name); + } + } + return statements; + } + /** + * Appends the down-level representation of an export to a statement list, returning the + * statement list. + * + * @param statements A statement list to which the down-level export statements are to be + * appended. If `statements` is `undefined`, a new array is allocated if statements are + * appended. + * @param exportName The name of the export. + * @param expression The expression to export. + * @param location The location to use for source maps and comments for the export. + * @param allowComments Whether to allow comments on the export. + */ + function appendExportStatement(statements, exportName, expression, location, allowComments) { + if (exportName.text === "default") { + var sourceFile = ts.getOriginalNode(currentSourceFile, ts.isSourceFile); + if (sourceFile && !sourceFile.symbol.exports["___esModule"]) { + if (languageVersion === 0 /* ES3 */) { + statements = ts.append(statements, ts.createStatement(createExportExpression(ts.createIdentifier("__esModule"), ts.createLiteral(true)))); + } + else { + statements = ts.append(statements, ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), + /*typeArguments*/ undefined, [ + ts.createIdentifier("exports"), + ts.createLiteral("__esModule"), + ts.createObjectLiteral([ + ts.createPropertyAssignment("value", ts.createLiteral(true)) + ]) + ]))); + } + } + } + statements = ts.append(statements, createExportStatement(exportName, expression, location, allowComments)); + return statements; + } + /** + * Creates a call to the current file's export function to export a value. + * + * @param name The bound name of the export. + * @param value The exported value. + * @param location The location to use for source maps and comments for the export. + * @param allowComments An optional value indicating whether to emit comments for the statement. + */ + function createExportStatement(name, value, location, allowComments) { + var statement = ts.createStatement(createExportExpression(name, value), location); + ts.startOnNewLine(statement); + if (!allowComments) { + ts.setEmitFlags(statement, 1536 /* NoComments */); + } + return statement; + } + /** + * Creates a call to the current file's export function to export a value. + * + * @param name The bound name of the export. + * @param value The exported value. + * @param location The location to use for source maps and comments for the export. + */ + function createExportExpression(name, value, location) { + return ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(name)), value, location); + } + // + // Modifier Visitors + // + /** + * Visit nodes to elide module-specific modifiers. + * + * @param node The node to visit. + */ + function modifierVisitor(node) { + // Elide module-specific modifiers. + switch (node.kind) { + case 83 /* ExportKeyword */: + case 78 /* DefaultKeyword */: + return undefined; + } + return node; + } + // + // Emit Notification + // + /** + * Hook for node emit notifications. + * + * @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 (node.kind === 261 /* SourceFile */) { + currentSourceFile = node; + currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; + noSubstitution = ts.createMap(); + previousOnEmitNode(emitContext, node, emitCallback); + currentSourceFile = undefined; + currentModuleInfo = undefined; + noSubstitution = 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 (node.id && noSubstitution[node.id]) { + return node; + } + if (emitContext === 1 /* Expression */) { + return substituteExpression(node); + } + else if (ts.isShorthandPropertyAssignment(node)) { + return substituteShorthandPropertyAssignment(node); + } + return node; + } + /** + * Substitution for a ShorthandPropertyAssignment whose declaration name is an imported + * or exported symbol. + * + * @param node The node to substitute. + */ + function substituteShorthandPropertyAssignment(node) { + var name = node.name; + var exportedOrImportedName = substituteExpressionIdentifier(name); + if (exportedOrImportedName !== name) { + // A shorthand property with an assignment initializer is probably part of a + // destructuring assignment + if (node.objectAssignmentInitializer) { + var initializer = ts.createAssignment(exportedOrImportedName, node.objectAssignmentInitializer); + return ts.createPropertyAssignment(name, initializer, /*location*/ node); + } + return ts.createPropertyAssignment(name, exportedOrImportedName, /*location*/ node); + } + return node; + } + /** + * Substitution for an Expression that may contain an imported or exported symbol. + * + * @param node The node to substitute. + */ + function substituteExpression(node) { + switch (node.kind) { + case 70 /* Identifier */: + return substituteExpressionIdentifier(node); + case 192 /* BinaryExpression */: + return substituteBinaryExpression(node); + case 191 /* PostfixUnaryExpression */: + case 190 /* PrefixUnaryExpression */: + return substituteUnaryExpression(node); + } + return node; + } + /** + * Substitution for an Identifier expression that may contain an imported or exported + * symbol. + * + * @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 */) { + return ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node), + /*location*/ node); + } + var importDeclaration = resolver.getReferencedImportDeclaration(node); + if (importDeclaration) { + if (ts.isImportClause(importDeclaration)) { + return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent), ts.createIdentifier("default"), + /*location*/ node); + } + else if (ts.isImportSpecifier(importDeclaration)) { + var name_39 = importDeclaration.propertyName || importDeclaration.name; + return ts.createPropertyAccess(ts.getGeneratedNameForNode(importDeclaration.parent.parent.parent), ts.getSynthesizedClone(name_39), + /*location*/ node); + } + } + } + return node; + } + /** + * Substitution for a BinaryExpression that may contain an imported or exported symbol. + * + * @param node The node to substitute. + */ + function substituteBinaryExpression(node) { + // When we see an assignment expression whose left-hand side is an exported symbol, + // we should ensure all exports of that symbol are updated with the correct value. + // + // - We do not substitute generated identifiers for any reason. + // - We do not substitute identifiers tagged with the LocalName flag. + // - We do not substitute identifiers that were originally the name of an enum or + // namespace due to how they are transformed in TypeScript. + // - We only substitute identifiers that are exported at the top level. + if (ts.isAssignmentOperator(node.operatorToken.kind) + && ts.isIdentifier(node.left) + && !ts.isGeneratedIdentifier(node.left) + && !ts.isLocalName(node.left) + && !ts.isDeclarationNameOfEnumOrNamespace(node.left)) { + var exportedNames = getExports(node.left); + if (exportedNames) { + // For each additional export of the declaration, apply an export assignment. + var expression = node; + for (var _i = 0, exportedNames_3 = exportedNames; _i < exportedNames_3.length; _i++) { + var exportName = exportedNames_3[_i]; + // Mark the node to prevent triggering this rule again. + noSubstitution[ts.getNodeId(expression)] = true; + expression = createExportExpression(exportName, expression, /*location*/ node); + } + return expression; + } + } + return node; + } + /** + * Substitution for a UnaryExpression that may contain an imported or exported symbol. + * + * @param node The node to substitute. + */ + function substituteUnaryExpression(node) { + // When we see a prefix or postfix increment expression whose operand is an exported + // symbol, we should ensure all exports of that symbol are updated with the correct + // value. + // + // - We do not substitute generated identifiers for any reason. + // - We do not substitute identifiers tagged with the LocalName flag. + // - We do not substitute identifiers that were originally the name of an enum or + // namespace due to how they are transformed in TypeScript. + // - We only substitute identifiers that are exported at the top level. + if ((node.operator === 42 /* PlusPlusToken */ || node.operator === 43 /* MinusMinusToken */) + && ts.isIdentifier(node.operand) + && !ts.isGeneratedIdentifier(node.operand) + && !ts.isLocalName(node.operand) + && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { + var exportedNames = getExports(node.operand); + if (exportedNames) { + var expression = node.kind === 191 /* PostfixUnaryExpression */ + ? ts.createBinary(node.operand, ts.createToken(node.operator === 42 /* PlusPlusToken */ ? 58 /* PlusEqualsToken */ : 59 /* MinusEqualsToken */), ts.createLiteral(1), + /*location*/ node) + : node; + for (var _i = 0, exportedNames_4 = exportedNames; _i < exportedNames_4.length; _i++) { + var exportName = exportedNames_4[_i]; + // Mark the node to prevent triggering this rule again. + noSubstitution[ts.getNodeId(expression)] = true; + expression = createExportExpression(exportName, expression); + } + return expression; + } + } + return node; + } + /** + * Gets the additional exports of a name. + * + * @param name The name. + */ + function getExports(name) { + if (!ts.isGeneratedIdentifier(name)) { + var valueDeclaration = resolver.getReferencedImportDeclaration(name) + || resolver.getReferencedValueDeclaration(name); + if (valueDeclaration) { + return currentModuleInfo + && currentModuleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]; + } + } + } + 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 }" + }; +})(ts || (ts = {})); +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/* @internal */ +var ts; +(function (ts) { + var moduleTransformerMap = ts.createMap((_a = {}, + _a[ts.ModuleKind.ES2015] = ts.transformES2015Module, + _a[ts.ModuleKind.System] = ts.transformSystemModule, + _a[ts.ModuleKind.AMD] = ts.transformModule, + _a[ts.ModuleKind.CommonJS] = ts.transformModule, + _a[ts.ModuleKind.UMD] = ts.transformModule, + _a[ts.ModuleKind.None] = ts.transformModule, + _a)); + var SyntaxKindFeatureFlags; + (function (SyntaxKindFeatureFlags) { + SyntaxKindFeatureFlags[SyntaxKindFeatureFlags["Substitution"] = 1] = "Substitution"; + SyntaxKindFeatureFlags[SyntaxKindFeatureFlags["EmitNotifications"] = 2] = "EmitNotifications"; + })(SyntaxKindFeatureFlags || (SyntaxKindFeatureFlags = {})); + function getTransformers(compilerOptions) { + var jsx = compilerOptions.jsx; + var languageVersion = ts.getEmitScriptTarget(compilerOptions); + var moduleKind = ts.getEmitModuleKind(compilerOptions); + var transformers = []; + transformers.push(ts.transformTypeScript); + if (jsx === 2 /* React */) { + transformers.push(ts.transformJsx); + } + if (languageVersion < 5 /* ESNext */) { + transformers.push(ts.transformESNext); + } + if (languageVersion < 4 /* ES2017 */) { + transformers.push(ts.transformES2017); + } + if (languageVersion < 3 /* ES2016 */) { + transformers.push(ts.transformES2016); + } + if (languageVersion < 2 /* ES2015 */) { + transformers.push(ts.transformES2015); + transformers.push(ts.transformGenerators); + } + transformers.push(moduleTransformerMap[moduleKind] || moduleTransformerMap[ts.ModuleKind.None]); + // The ES5 transformer is last so that it can substitute expressions like `exports.default` + // for ES3. + if (languageVersion < 1 /* ES5 */) { + transformers.push(ts.transformES5); + } + return transformers; + } + ts.getTransformers = getTransformers; + /** + * Transforms an array of SourceFiles by passing them through each transformer. + * + * @param resolver The emit resolver provided by the checker. + * @param host The emit host. + * @param sourceFiles An array of source files + * @param transforms An array of Transformers. + */ + function transformFiles(resolver, host, sourceFiles, transformers) { + var enabledSyntaxKindFeatures = new Array(297 /* Count */); + var lexicalEnvironmentDisabled = false; + var lexicalEnvironmentVariableDeclarations; + var lexicalEnvironmentFunctionDeclarations; + var lexicalEnvironmentVariableDeclarationsStack = []; + var lexicalEnvironmentFunctionDeclarationsStack = []; + var lexicalEnvironmentStackOffset = 0; + 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; }, + 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, + onEmitNode: function (node, emitContext, emitCallback) { return emitCallback(node, emitContext); }, + enableEmitNotification: enableEmitNotification, + isEmitNotificationEnabled: isEmitNotificationEnabled + }; + // Chain together and initialize each transformer. + var transformation = ts.chain.apply(void 0, transformers)(context); + // Transform each source file. + var transformed = ts.map(sourceFiles, transformSourceFile); + // Disable modification of the lexical environment. + lexicalEnvironmentDisabled = true; + return { + transformed: transformed, + emitNodeWithSubstitution: emitNodeWithSubstitution, + emitNodeWithNotification: emitNodeWithNotification + }; + /** + * Transforms a source file. + * + * @param sourceFile The source file to transform. + */ + function transformSourceFile(sourceFile) { + if (ts.isDeclarationFile(sourceFile)) { + return sourceFile; + } + return transformation(sourceFile); + } + /** + * Enables expression substitutions in the pretty printer for the provided SyntaxKind. + */ + function enableSubstitution(kind) { + enabledSyntaxKindFeatures[kind] |= 1 /* Substitution */; + } + /** + * Determines whether expression substitutions are enabled for the provided node. + */ + function isSubstitutionEnabled(node) { + return (enabledSyntaxKindFeatures[node.kind] & 1 /* Substitution */) !== 0 + && (ts.getEmitFlags(node) & 4 /* NoSubstitution */) === 0; + } + /** + * Emits a node with possible substitution. + * + * @param emitContext The current emit context. + * @param node The node to emit. + * @param emitCallback The callback used to emit the node or its substitute. + */ + function emitNodeWithSubstitution(emitContext, node, emitCallback) { + if (node) { + if (isSubstitutionEnabled(node)) { + var substitute = context.onSubstituteNode(emitContext, node); + if (substitute && substitute !== node) { + emitCallback(emitContext, substitute); + return; + } + } + emitCallback(emitContext, node); + } + } + /** + * Enables before/after emit notifications in the pretty printer for the provided SyntaxKind. + */ + function enableEmitNotification(kind) { + enabledSyntaxKindFeatures[kind] |= 2 /* EmitNotifications */; + } + /** + * Determines whether before/after emit notifications should be raised in the pretty + * printer when it emits a node. + */ + function isEmitNotificationEnabled(node) { + return (enabledSyntaxKindFeatures[node.kind] & 2 /* EmitNotifications */) !== 0 + || (ts.getEmitFlags(node) & 2 /* AdviseOnEmitNode */) !== 0; + } + /** + * Emits a node with possible emit notification. + * + * @param emitContext The current emit context. + * @param node The node to emit. + * @param emitCallback The callback used to emit the node. + */ + function emitNodeWithNotification(emitContext, node, emitCallback) { + if (node) { + if (isEmitNotificationEnabled(node)) { + context.onEmitNode(emitContext, node, emitCallback); + } + else { + emitCallback(emitContext, node); + } + } + } + /** + * Records a hoisted variable declaration for the provided name within a lexical environment. + */ + function hoistVariableDeclaration(name) { + ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + var decl = ts.createVariableDeclaration(name); + if (!lexicalEnvironmentVariableDeclarations) { + lexicalEnvironmentVariableDeclarations = [decl]; + } + else { + lexicalEnvironmentVariableDeclarations.push(decl); + } + } + /** + * Records a hoisted function declaration within a lexical environment. + */ + function hoistFunctionDeclaration(func) { + ts.Debug.assert(!lexicalEnvironmentDisabled, "Cannot modify the lexical environment during the print phase."); + if (!lexicalEnvironmentFunctionDeclarations) { + lexicalEnvironmentFunctionDeclarations = [func]; + } + else { + lexicalEnvironmentFunctionDeclarations.push(func); + } + } + /** + * Starts a new lexical environment. Any existing hoisted variable or function declarations + * are pushed onto a stack, and the related storage variables are reset. + */ + 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] = lexicalEnvironmentVariableDeclarations; + lexicalEnvironmentFunctionDeclarationsStack[lexicalEnvironmentStackOffset] = lexicalEnvironmentFunctionDeclarations; + lexicalEnvironmentStackOffset++; + 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 + * any hoisted declarations added in this environment are returned. + */ + 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 (lexicalEnvironmentVariableDeclarations || lexicalEnvironmentFunctionDeclarations) { + if (lexicalEnvironmentFunctionDeclarations) { + statements = lexicalEnvironmentFunctionDeclarations.slice(); + } + if (lexicalEnvironmentVariableDeclarations) { + var statement = ts.createVariableStatement( + /*modifiers*/ undefined, ts.createVariableDeclarationList(lexicalEnvironmentVariableDeclarations)); + if (!statements) { + statements = [statement]; + } + else { + statements.push(statement); + } + } + } + // Restore the previous lexical environment. + 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; +})(ts || (ts = {})); +/// +/* @internal */ +var ts; +(function (ts) { + // Used for initialize lastEncodedSourceMapSpan and reset lastEncodedSourceMapSpan when updateLastEncodedAndRecordedSpans + var defaultLastEncodedSourceMapSpan = { + emittedLine: 1, + emittedColumn: 1, + sourceLine: 1, + sourceColumn: 1, + sourceIndex: 0 + }; + function createSourceMapWriter(host, writer) { + var compilerOptions = host.getCompilerOptions(); + var extendedDiagnostics = compilerOptions.extendedDiagnostics; + var currentSourceFile; + var currentSourceText; + var sourceMapDir; // The directory in which sourcemap will be + // Current source map file and its index in the sources list + var sourceMapSourceIndex; + // Last recorded and encoded spans + var lastRecordedSourceMapSpan; + var lastEncodedSourceMapSpan; + var lastEncodedNameIndex; + // Source map data + var sourceMapData; + var disabled = !(compilerOptions.sourceMap || compilerOptions.inlineSourceMap); + return { + initialize: initialize, + reset: reset, + getSourceMapData: function () { return sourceMapData; }, + setSourceFile: setSourceFile, + emitPos: emitPos, + emitNodeWithSourceMap: emitNodeWithSourceMap, + emitTokenWithSourceMap: emitTokenWithSourceMap, + getText: getText, + getSourceMappingURL: getSourceMappingURL, + }; + /** + * Initialize the SourceMapWriter for a new output file. + * + * @param filePath The path to the generated output file. + * @param sourceMapFilePath The path to the output source map file. + * @param sourceFiles The input source files for the program. + * @param isBundledEmit A value indicating whether the generated output file is a bundle. + */ + function initialize(filePath, sourceMapFilePath, sourceFiles, isBundledEmit) { + if (disabled) { + return; + } + if (sourceMapData) { + reset(); + } + currentSourceFile = undefined; + currentSourceText = undefined; + // Current source map file and its index in the sources list + sourceMapSourceIndex = -1; + // Last recorded and encoded spans + lastRecordedSourceMapSpan = undefined; + lastEncodedSourceMapSpan = defaultLastEncodedSourceMapSpan; + lastEncodedNameIndex = 0; + // Initialize source map data + sourceMapData = { + sourceMapFilePath: sourceMapFilePath, + jsSourceMappingURL: !compilerOptions.inlineSourceMap ? ts.getBaseFileName(ts.normalizeSlashes(sourceMapFilePath)) : undefined, + sourceMapFile: ts.getBaseFileName(ts.normalizeSlashes(filePath)), + sourceMapSourceRoot: compilerOptions.sourceRoot || "", + sourceMapSources: [], + inputSourceFileNames: [], + sourceMapNames: [], + sourceMapMappings: "", + sourceMapSourcesContent: compilerOptions.inlineSources ? [] : undefined, + sourceMapDecodedMappings: [] + }; + // Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the + // relative paths of the sources list in the sourcemap + sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot); + if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== 47 /* slash */) { + sourceMapData.sourceMapSourceRoot += ts.directorySeparator; + } + if (compilerOptions.mapRoot) { + sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); + if (!isBundledEmit) { + ts.Debug.assert(sourceFiles.length === 1); + // For modules or multiple emit files the mapRoot will have directory structure like the sources + // So if src\a.ts and src\lib\b.ts are compiled together user would be moving the maps into mapRoot\a.js.map and mapRoot\lib\b.js.map + sourceMapDir = ts.getDirectoryPath(ts.getSourceFilePathInNewDir(sourceFiles[0], host, sourceMapDir)); + } + if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { + // The relative paths are relative to the common directory + sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir); + sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(filePath)), // get the relative sourceMapDir path based on jsFilePath + ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), // this is where user expects to see sourceMap + host.getCurrentDirectory(), host.getCanonicalFileName, + /*isAbsolutePathAnUrl*/ true); + } + else { + sourceMapData.jsSourceMappingURL = ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL); + } + } + else { + sourceMapDir = ts.getDirectoryPath(ts.normalizePath(filePath)); + } + } + /** + * Reset the SourceMapWriter to an empty state. + */ + function reset() { + if (disabled) { + return; + } + currentSourceFile = undefined; + sourceMapDir = undefined; + sourceMapSourceIndex = undefined; + lastRecordedSourceMapSpan = undefined; + lastEncodedSourceMapSpan = undefined; + lastEncodedNameIndex = undefined; + sourceMapData = undefined; + } + // Encoding for sourcemap span + function encodeLastRecordedSourceMapSpan() { + if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) { + return; + } + var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn; + // Line/Comma delimiters + if (lastEncodedSourceMapSpan.emittedLine === lastRecordedSourceMapSpan.emittedLine) { + // Emit comma to separate the entry + if (sourceMapData.sourceMapMappings) { + sourceMapData.sourceMapMappings += ","; + } + } + else { + // Emit line delimiters + for (var encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) { + sourceMapData.sourceMapMappings += ";"; + } + prevEncodedEmittedColumn = 1; + } + // 1. Relative Column 0 based + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn); + // 2. Relative sourceIndex + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex); + // 3. Relative sourceLine 0 based + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine); + // 4. Relative sourceColumn 0 based + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn); + // 5. Relative namePosition 0 based + if (lastRecordedSourceMapSpan.nameIndex >= 0) { + ts.Debug.assert(false, "We do not support name index right now, Make sure to update updateLastEncodedAndRecordedSpans when we start using this"); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex - lastEncodedNameIndex); + lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex; + } + lastEncodedSourceMapSpan = lastRecordedSourceMapSpan; + sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan); + } + /** + * Emits a mapping. + * + * If the position is synthetic (undefined or a negative value), no mapping will be + * created. + * + * @param pos The position. + */ + function emitPos(pos) { + if (disabled || ts.positionIsSynthesized(pos)) { + return; + } + if (extendedDiagnostics) { + ts.performance.mark("beforeSourcemap"); + } + var sourceLinePos = ts.getLineAndCharacterOfPosition(currentSourceFile, pos); + // Convert the location to be one-based. + sourceLinePos.line++; + sourceLinePos.character++; + var emittedLine = writer.getLine(); + var emittedColumn = writer.getColumn(); + // If this location wasn't recorded or the location in source is going backwards, record the span + if (!lastRecordedSourceMapSpan || + lastRecordedSourceMapSpan.emittedLine !== emittedLine || + lastRecordedSourceMapSpan.emittedColumn !== emittedColumn || + (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && + (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || + (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { + // Encode the last recordedSpan before assigning new + encodeLastRecordedSourceMapSpan(); + // New span + lastRecordedSourceMapSpan = { + emittedLine: emittedLine, + emittedColumn: emittedColumn, + sourceLine: sourceLinePos.line, + sourceColumn: sourceLinePos.character, + sourceIndex: sourceMapSourceIndex + }; + } + else { + // Take the new pos instead since there is no change in emittedLine and column since last location + lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line; + lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character; + lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex; + } + if (extendedDiagnostics) { + ts.performance.mark("afterSourcemap"); + ts.performance.measure("Source Map", "beforeSourcemap", "afterSourcemap"); + } + } + /** + * Emits a node with possible leading and trailing source maps. + * + * @param node The node to emit. + * @param emitCallback The callback used to emit the node. + */ + function emitNodeWithSourceMap(emitContext, node, emitCallback) { + if (disabled) { + return emitCallback(emitContext, node); + } + if (node) { + var emitNode = node.emitNode; + var emitFlags = emitNode && emitNode.flags; + var _a = emitNode && emitNode.sourceMapRange || node, pos = _a.pos, end = _a.end; + if (node.kind !== 293 /* NotEmittedStatement */ + && (emitFlags & 16 /* NoLeadingSourceMap */) === 0 + && pos >= 0) { + emitPos(ts.skipTrivia(currentSourceText, pos)); + } + if (emitFlags & 64 /* NoNestedSourceMaps */) { + disabled = true; + emitCallback(emitContext, node); + disabled = false; + } + else { + emitCallback(emitContext, node); + } + if (node.kind !== 293 /* NotEmittedStatement */ + && (emitFlags & 32 /* NoTrailingSourceMap */) === 0 + && end >= 0) { + emitPos(end); + } + } + } + /** + * Emits a token of a node with possible leading and trailing source maps. + * + * @param node The node containing the token. + * @param token The token to emit. + * @param tokenStartPos The start pos of the token. + * @param emitCallback The callback used to emit the token. + */ + function emitTokenWithSourceMap(node, token, tokenPos, emitCallback) { + if (disabled) { + return emitCallback(token, tokenPos); + } + var emitNode = node && node.emitNode; + var emitFlags = emitNode && emitNode.flags; + var range = emitNode && emitNode.tokenSourceMapRanges && emitNode.tokenSourceMapRanges[token]; + tokenPos = ts.skipTrivia(currentSourceText, range ? range.pos : tokenPos); + if ((emitFlags & 128 /* NoTokenLeadingSourceMaps */) === 0 && tokenPos >= 0) { + emitPos(tokenPos); + } + tokenPos = emitCallback(token, tokenPos); + if (range) + tokenPos = range.end; + if ((emitFlags & 256 /* NoTokenTrailingSourceMaps */) === 0 && tokenPos >= 0) { + emitPos(tokenPos); + } + return tokenPos; + } + /** + * Set the current source file. + * + * @param sourceFile The source file. + */ + function setSourceFile(sourceFile) { + if (disabled) { + return; + } + currentSourceFile = sourceFile; + currentSourceText = currentSourceFile.text; + // Add the file to tsFilePaths + // If sourceroot option: Use the relative path corresponding to the common directory path + // otherwise source locations relative to map file location + var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir; + var source = ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, currentSourceFile.fileName, host.getCurrentDirectory(), host.getCanonicalFileName, + /*isAbsolutePathAnUrl*/ true); + sourceMapSourceIndex = ts.indexOf(sourceMapData.sourceMapSources, source); + if (sourceMapSourceIndex === -1) { + sourceMapSourceIndex = sourceMapData.sourceMapSources.length; + sourceMapData.sourceMapSources.push(source); + // The one that can be used from program to get the actual source file + sourceMapData.inputSourceFileNames.push(currentSourceFile.fileName); + if (compilerOptions.inlineSources) { + sourceMapData.sourceMapSourcesContent.push(currentSourceFile.text); + } + } + } + /** + * Gets the text for the source map. + */ + function getText() { + if (disabled) { + return; + } + encodeLastRecordedSourceMapSpan(); + return JSON.stringify({ + version: 3, + file: sourceMapData.sourceMapFile, + sourceRoot: sourceMapData.sourceMapSourceRoot, + sources: sourceMapData.sourceMapSources, + names: sourceMapData.sourceMapNames, + mappings: sourceMapData.sourceMapMappings, + sourcesContent: sourceMapData.sourceMapSourcesContent, + }); + } + /** + * Gets the SourceMappingURL for the source map. + */ + function getSourceMappingURL() { + if (disabled) { + return; + } + if (compilerOptions.inlineSourceMap) { + // Encode the sourceMap into the sourceMap url + var base64SourceMapText = ts.convertToBase64(getText()); + return sourceMapData.jsSourceMappingURL = "data:application/json;base64," + base64SourceMapText; + } + else { + return sourceMapData.jsSourceMappingURL; + } + } + } + ts.createSourceMapWriter = createSourceMapWriter; + var base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + function base64FormatEncode(inValue) { + if (inValue < 64) { + return base64Chars.charAt(inValue); + } + throw TypeError(inValue + ": not a 64 based value"); + } + function base64VLQFormatEncode(inValue) { + // Add a new least significant bit that has the sign of the value. + // if negative number the least significant bit that gets added to the number has value 1 + // else least significant bit value that gets added is 0 + // eg. -1 changes to binary : 01 [1] => 3 + // +1 changes to binary : 01 [0] => 2 + if (inValue < 0) { + inValue = ((-inValue) << 1) + 1; + } + else { + inValue = inValue << 1; + } + // Encode 5 bits at a time starting from least significant bits + var encodedStr = ""; + do { + var currentDigit = inValue & 31; // 11111 + inValue = inValue >> 5; + if (inValue > 0) { + // There are still more digits to decode, set the msb (6th bit) + currentDigit = currentDigit | 32; + } + encodedStr = encodedStr + base64FormatEncode(currentDigit); + } while (inValue > 0); + return encodedStr; + } +})(ts || (ts = {})); +/// +/* @internal */ +var ts; +(function (ts) { + function createCommentWriter(host, writer, sourceMap) { + var compilerOptions = host.getCompilerOptions(); + var extendedDiagnostics = compilerOptions.extendedDiagnostics; + var newLine = host.getNewLine(); + var emitPos = sourceMap.emitPos; + var containerPos = -1; + var containerEnd = -1; + var declarationListContainerEnd = -1; + var currentSourceFile; + var currentText; + var currentLineMap; + var detachedCommentsInfo; + var hasWrittenComment = false; + var disabled = compilerOptions.removeComments; + return { + reset: reset, + setSourceFile: setSourceFile, + emitNodeWithComments: emitNodeWithComments, + emitBodyWithDetachedComments: emitBodyWithDetachedComments, + emitTrailingCommentsOfPosition: emitTrailingCommentsOfPosition, + }; + function emitNodeWithComments(emitContext, node, emitCallback) { + if (disabled) { + emitCallback(emitContext, node); + return; + } + if (node) { + var _a = ts.getCommentRange(node), pos = _a.pos, end = _a.end; + 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 & 2048 /* NoNestedComments */) { + disabled = true; + emitCallback(emitContext, node); + disabled = false; + } + else { + emitCallback(emitContext, node); + } + } + else { + if (extendedDiagnostics) { + ts.performance.mark("preEmitNodeWithComment"); + } + 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) { + emitLeadingComments(pos, isEmittedNode); + } + // Save current container state on the stack. + var savedContainerPos = containerPos; + var savedContainerEnd = containerEnd; + var savedDeclarationListContainerEnd = declarationListContainerEnd; + if (!skipLeadingComments) { + containerPos = pos; + } + if (!skipTrailingComments) { + containerEnd = end; + // To avoid invalid comment emit in a down-level binding pattern, we + // keep track of the last declaration list container's end + if (node.kind === 224 /* VariableDeclarationList */) { + declarationListContainerEnd = end; + } + } + if (extendedDiagnostics) { + ts.performance.measure("commentTime", "preEmitNodeWithComment"); + } + if (emitFlags & 2048 /* NoNestedComments */) { + disabled = true; + emitCallback(emitContext, node); + disabled = false; + } + else { + emitCallback(emitContext, node); + } + if (extendedDiagnostics) { + ts.performance.mark("beginEmitNodeWithComment"); + } + // Restore previous container state. + containerPos = savedContainerPos; + containerEnd = savedContainerEnd; + declarationListContainerEnd = savedDeclarationListContainerEnd; + // Emit trailing comments if the position is not synthesized and the node + // has not opted out from emitting leading comments and is an emitted node. + if (!skipTrailingComments && isEmittedNode) { + emitTrailingComments(end); + } + if (extendedDiagnostics) { + ts.performance.measure("commentTime", "beginEmitNodeWithComment"); + } + } + } + } + function emitBodyWithDetachedComments(node, detachedRange, emitCallback) { + if (extendedDiagnostics) { + ts.performance.mark("preEmitBodyWithDetachedComments"); + } + var pos = detachedRange.pos, end = detachedRange.end; + var emitFlags = ts.getEmitFlags(node); + 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 & 2048 /* NoNestedComments */ && !disabled) { + disabled = true; + emitCallback(node); + disabled = false; + } + else { + emitCallback(node); + } + if (extendedDiagnostics) { + ts.performance.mark("beginEmitBodyWithDetachedCommetns"); + } + if (!skipTrailingComments) { + emitLeadingComments(detachedRange.end, /*isEmittedNode*/ true); + if (hasWrittenComment && !writer.isAtStartOfLine()) { + writer.writeLine(); + } + } + if (extendedDiagnostics) { + ts.performance.measure("commentTime", "beginEmitBodyWithDetachedCommetns"); + } + } + function emitLeadingComments(pos, isEmittedNode) { + hasWrittenComment = false; + if (isEmittedNode) { + forEachLeadingCommentToEmit(pos, emitLeadingComment); + } + else if (pos === 0) { + // If the node will not be emitted in JS, remove all the comments(normal, pinned and ///) associated with the node, + // unless it is a triple slash comment at the top of the file. + // For Example: + // /// + // declare var x; + // /// + // interface F {} + // The first /// will NOT be removed while the second one will be removed even though both node will not be emitted + forEachLeadingCommentToEmit(pos, emitTripleSlashLeadingComment); + } + } + function emitTripleSlashLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos) { + if (isTripleSlashComment(commentPos, commentEnd)) { + emitLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos); + } + } + function emitLeadingComment(commentPos, commentEnd, _kind, hasTrailingNewLine, rangePos) { + if (!hasWrittenComment) { + ts.emitNewLineBeforeLeadingCommentOfPosition(currentLineMap, writer, rangePos, commentPos); + hasWrittenComment = true; + } + // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space + emitPos(commentPos); + ts.writeCommentRange(currentText, currentLineMap, writer, commentPos, commentEnd, newLine); + emitPos(commentEnd); + if (hasTrailingNewLine) { + writer.writeLine(); + } + else { + writer.write(" "); + } + } + function emitTrailingComments(pos) { + forEachTrailingCommentToEmit(pos, emitTrailingComment); + } + function emitTrailingComment(commentPos, commentEnd, _kind, hasTrailingNewLine) { + // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment2*/ + if (!writer.isAtStartOfLine()) { + writer.write(" "); + } + emitPos(commentPos); + ts.writeCommentRange(currentText, currentLineMap, writer, commentPos, commentEnd, newLine); + emitPos(commentEnd); + if (hasTrailingNewLine) { + writer.writeLine(); + } + } + function emitTrailingCommentsOfPosition(pos) { + if (disabled) { + return; + } + if (extendedDiagnostics) { + ts.performance.mark("beforeEmitTrailingCommentsOfPosition"); + } + forEachTrailingCommentToEmit(pos, emitTrailingCommentOfPosition); + if (extendedDiagnostics) { + ts.performance.measure("commentTime", "beforeEmitTrailingCommentsOfPosition"); + } + } + function emitTrailingCommentOfPosition(commentPos, commentEnd, _kind, hasTrailingNewLine) { + // trailing comments of a position are emitted at /*trailing comment1 */space/*trailing comment*/space + emitPos(commentPos); + ts.writeCommentRange(currentText, currentLineMap, writer, commentPos, commentEnd, newLine); + emitPos(commentEnd); + if (hasTrailingNewLine) { + writer.writeLine(); + } + else { + writer.write(" "); + } + } + function forEachLeadingCommentToEmit(pos, cb) { + // Emit the leading comments only if the container's pos doesn't match because the container should take care of emitting these comments + if (containerPos === -1 || pos !== containerPos) { + if (hasDetachedComments(pos)) { + forEachLeadingCommentWithoutDetachedComments(cb); + } + else { + ts.forEachLeadingCommentRange(currentText, pos, cb, /*state*/ pos); + } + } + } + function forEachTrailingCommentToEmit(end, cb) { + // Emit the trailing comments only if the container's end doesn't match because the container should take care of emitting these comments + if (containerEnd === -1 || (end !== containerEnd && end !== declarationListContainerEnd)) { + ts.forEachTrailingCommentRange(currentText, end, cb); + } + } + function reset() { + currentSourceFile = undefined; + currentText = undefined; + currentLineMap = undefined; + detachedCommentsInfo = undefined; + } + function setSourceFile(sourceFile) { + currentSourceFile = sourceFile; + currentText = currentSourceFile.text; + currentLineMap = ts.getLineStarts(currentSourceFile); + detachedCommentsInfo = undefined; + } + function hasDetachedComments(pos) { + return detachedCommentsInfo !== undefined && ts.lastOrUndefined(detachedCommentsInfo).nodePos === pos; + } + function forEachLeadingCommentWithoutDetachedComments(cb) { + // get the leading comments from detachedPos + var pos = ts.lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos; + if (detachedCommentsInfo.length - 1) { + detachedCommentsInfo.pop(); + } + else { + detachedCommentsInfo = undefined; + } + ts.forEachLeadingCommentRange(currentText, pos, cb, /*state*/ pos); + } + function emitDetachedCommentsAndUpdateCommentsInfo(range) { + var currentDetachedCommentInfo = ts.emitDetachedComments(currentText, currentLineMap, writer, writeComment, range, newLine, disabled); + if (currentDetachedCommentInfo) { + if (detachedCommentsInfo) { + detachedCommentsInfo.push(currentDetachedCommentInfo); + } + else { + detachedCommentsInfo = [currentDetachedCommentInfo]; + } + } + } + function writeComment(text, lineMap, writer, commentPos, commentEnd, newLine) { + emitPos(commentPos); + ts.writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine); + emitPos(commentEnd); + } + /** + * Determine if the given comment is a triple-slash + * + * @return true if the comment is a triple-slash comment else false + **/ + function isTripleSlashComment(commentPos, commentEnd) { + // Verify this is /// comment, but do the regexp match only when we first can find /// in the comment text + // so that we don't end up computing comment string and doing match for all // comments + if (currentText.charCodeAt(commentPos + 1) === 47 /* slash */ && + commentPos + 2 < commentEnd && + currentText.charCodeAt(commentPos + 2) === 47 /* slash */) { + var textSubStr = currentText.substring(commentPos, commentEnd); + return textSubStr.match(ts.fullTripleSlashReferencePathRegEx) || + textSubStr.match(ts.fullTripleSlashAMDReferencePathRegEx) ? + true : false; + } + return false; + } + } + ts.createCommentWriter = createCommentWriter; +})(ts || (ts = {})); +/// +/* @internal */ +var ts; +(function (ts) { + function getDeclarationDiagnostics(host, resolver, targetSourceFile) { + var declarationDiagnostics = ts.createDiagnosticCollection(); + ts.forEachExpectedEmitFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); + return declarationDiagnostics.getDiagnostics(targetSourceFile ? targetSourceFile.fileName : undefined); + function getDeclarationDiagnosticsFromFile(_a, sources, isBundledEmit) { + var declarationFilePath = _a.declarationFilePath; + emitDeclarations(host, resolver, declarationDiagnostics, declarationFilePath, sources, isBundledEmit, /*emitOnlyDtsFiles*/ false); + } + } + ts.getDeclarationDiagnostics = getDeclarationDiagnostics; + function emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit, emitOnlyDtsFiles) { + var newLine = host.getNewLine(); + var compilerOptions = host.getCompilerOptions(); + var write; + var writeLine; + var increaseIndent; + var decreaseIndent; + var writeTextOfNode; + var writer; + createAndSetNewTextWriterWithSymbolWriter(); + var enclosingDeclaration; + var resultHasExternalModuleIndicator; + var currentText; + var currentLineMap; + var currentIdentifiers; + var isCurrentFileExternalModule; + var reportedDeclarationError = false; + var errorNameNode; + var emitJsDocComments = compilerOptions.removeComments ? ts.noop : writeJsDocComments; + var emit = compilerOptions.stripInternal ? stripInternal : emitNode; + var noDeclare; + var moduleElementDeclarationEmitInfo = []; + var asynchronousSubModuleDeclarationEmitInfo; + // Contains the reference paths that needs to go in the declaration file. + // Collecting this separately because reference paths need to be first thing in the declaration file + // and we could be collecting these paths from multiple files into single one with --out option + var referencesOutput = ""; + var usedTypeDirectiveReferences; + // Emit references corresponding to each file + var emittedReferencedFiles = []; + var addedGlobalFileReference = false; + var allSourcesModuleElementDeclarationEmitInfo = []; + ts.forEach(sourceFiles, function (sourceFile) { + // Dont emit for javascript file + if (ts.isSourceFileJavaScript(sourceFile)) { + return; + } + // Check what references need to be added + if (!compilerOptions.noResolve) { + ts.forEach(sourceFile.referencedFiles, function (fileReference) { + var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference); + // Emit reference in dts, if the file reference was not already emitted + if (referencedFile && !ts.contains(emittedReferencedFiles, referencedFile)) { + // Add a reference to generated dts file, + // global file reference is added only + // - if it is not bundled emit (because otherwise it would be self reference) + // - and it is not already added + if (writeReferencePath(referencedFile, !isBundledEmit && !addedGlobalFileReference, emitOnlyDtsFiles)) { + addedGlobalFileReference = true; + } + emittedReferencedFiles.push(referencedFile); + } + }); + } + resultHasExternalModuleIndicator = false; + if (!isBundledEmit || !ts.isExternalModule(sourceFile)) { + noDeclare = false; + emitSourceFile(sourceFile); + } + else if (ts.isExternalModule(sourceFile)) { + noDeclare = true; + write("declare module \"" + ts.getResolvedExternalModuleName(host, sourceFile) + "\" {"); + writeLine(); + increaseIndent(); + emitSourceFile(sourceFile); + decreaseIndent(); + write("}"); + writeLine(); + } + // create asynchronous output for the importDeclarations + if (moduleElementDeclarationEmitInfo.length) { + var oldWriter = writer; + ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { + if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { + ts.Debug.assert(aliasEmitInfo.node.kind === 235 /* ImportDeclaration */); + createAndSetNewTextWriterWithSymbolWriter(); + ts.Debug.assert(aliasEmitInfo.indent === 0 || (aliasEmitInfo.indent === 1 && isBundledEmit)); + for (var i = 0; i < aliasEmitInfo.indent; i++) { + increaseIndent(); + } + writeImportDeclaration(aliasEmitInfo.node); + aliasEmitInfo.asynchronousOutput = writer.getText(); + for (var i = 0; i < aliasEmitInfo.indent; i++) { + decreaseIndent(); + } + } + }); + setWriter(oldWriter); + allSourcesModuleElementDeclarationEmitInfo = allSourcesModuleElementDeclarationEmitInfo.concat(moduleElementDeclarationEmitInfo); + moduleElementDeclarationEmitInfo = []; + } + if (!isBundledEmit && ts.isExternalModule(sourceFile) && sourceFile.moduleAugmentations.length && !resultHasExternalModuleIndicator) { + // if file was external module with augmentations - this fact should be preserved in .d.ts as well. + // in case if we didn't write any external module specifiers in .d.ts we need to emit something + // that will force compiler to think that this file is an external module - 'export {}' is a reasonable choice here. + write("export {};"); + writeLine(); + } + }); + if (usedTypeDirectiveReferences) { + for (var directive in usedTypeDirectiveReferences) { + referencesOutput += "/// " + newLine; + } + } + return { + reportedDeclarationError: reportedDeclarationError, + moduleElementDeclarationEmitInfo: allSourcesModuleElementDeclarationEmitInfo, + synchronousDeclarationOutput: writer.getText(), + referencesOutput: referencesOutput, + }; + function hasInternalAnnotation(range) { + var comment = currentText.substring(range.pos, range.end); + return comment.indexOf("@internal") >= 0; + } + function stripInternal(node) { + if (node) { + var leadingCommentRanges = ts.getLeadingCommentRanges(currentText, node.pos); + if (ts.forEach(leadingCommentRanges, hasInternalAnnotation)) { + return; + } + emitNode(node); + } + } + function createAndSetNewTextWriterWithSymbolWriter() { + var writer = ts.createTextWriter(newLine); + writer.trackSymbol = trackSymbol; + writer.reportInaccessibleThisError = reportInaccessibleThisError; + writer.writeKeyword = writer.write; + writer.writeOperator = writer.write; + writer.writePunctuation = writer.write; + writer.writeSpace = writer.write; + writer.writeStringLiteral = writer.writeLiteral; + writer.writeParameter = writer.write; + writer.writeProperty = writer.write; + writer.writeSymbol = writer.write; + setWriter(writer); + } + function setWriter(newWriter) { + writer = newWriter; + write = newWriter.write; + writeTextOfNode = newWriter.writeTextOfNode; + writeLine = newWriter.writeLine; + increaseIndent = newWriter.increaseIndent; + decreaseIndent = newWriter.decreaseIndent; + } + function writeAsynchronousModuleElements(nodes) { + var oldWriter = writer; + ts.forEach(nodes, function (declaration) { + var nodeToCheck; + if (declaration.kind === 223 /* VariableDeclaration */) { + nodeToCheck = declaration.parent.parent; + } + else if (declaration.kind === 238 /* NamedImports */ || declaration.kind === 239 /* ImportSpecifier */ || declaration.kind === 236 /* ImportClause */) { + ts.Debug.fail("We should be getting ImportDeclaration instead to write"); + } + else { + nodeToCheck = declaration; + } + var moduleElementEmitInfo = ts.forEach(moduleElementDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); + if (!moduleElementEmitInfo && asynchronousSubModuleDeclarationEmitInfo) { + moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); + } + // If the alias was marked as not visible when we saw its declaration, we would have saved the aliasEmitInfo, but if we haven't yet visited the alias declaration + // then we don't need to write it at this point. We will write it when we actually see its declaration + // Eg. + // export function bar(a: foo.Foo) { } + // import foo = require("foo"); + // Writing of function bar would mark alias declaration foo as visible but we haven't yet visited that declaration so do nothing, + // we would write alias foo declaration when we visit it since it would now be marked as visible + if (moduleElementEmitInfo) { + if (moduleElementEmitInfo.node.kind === 235 /* ImportDeclaration */) { + // we have to create asynchronous output only after we have collected complete information + // because it is possible to enable multiple bindings as asynchronously visible + moduleElementEmitInfo.isVisible = true; + } + else { + createAndSetNewTextWriterWithSymbolWriter(); + for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { + increaseIndent(); + } + if (nodeToCheck.kind === 230 /* ModuleDeclaration */) { + ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); + asynchronousSubModuleDeclarationEmitInfo = []; + } + writeModuleElement(nodeToCheck); + if (nodeToCheck.kind === 230 /* ModuleDeclaration */) { + moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; + asynchronousSubModuleDeclarationEmitInfo = undefined; + } + moduleElementEmitInfo.asynchronousOutput = writer.getText(); + } + } + }); + setWriter(oldWriter); + } + function recordTypeReferenceDirectivesIfNecessary(typeReferenceDirectives) { + if (!typeReferenceDirectives) { + return; + } + if (!usedTypeDirectiveReferences) { + usedTypeDirectiveReferences = ts.createMap(); + } + for (var _i = 0, typeReferenceDirectives_1 = typeReferenceDirectives; _i < typeReferenceDirectives_1.length; _i++) { + var directive = typeReferenceDirectives_1[_i]; + if (!(directive in usedTypeDirectiveReferences)) { + usedTypeDirectiveReferences[directive] = directive; + } + } + } + function handleSymbolAccessibilityError(symbolAccessibilityResult) { + if (symbolAccessibilityResult.accessibility === 0 /* Accessible */) { + // write the aliases + if (symbolAccessibilityResult && symbolAccessibilityResult.aliasesToMakeVisible) { + writeAsynchronousModuleElements(symbolAccessibilityResult.aliasesToMakeVisible); + } + } + else { + // Report error + reportedDeclarationError = true; + var errorInfo = writer.getSymbolAccessibilityDiagnostic(symbolAccessibilityResult); + if (errorInfo) { + if (errorInfo.typeName) { + emitterDiagnostics.add(ts.createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, ts.getTextOfNodeFromSourceText(currentText, errorInfo.typeName), symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName)); + } + else { + emitterDiagnostics.add(ts.createDiagnosticForNode(symbolAccessibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, symbolAccessibilityResult.errorSymbolName, symbolAccessibilityResult.errorModuleName)); + } + } + } + } + function trackSymbol(symbol, enclosingDeclaration, meaning) { + handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning, /*shouldComputeAliasesToMakeVisible*/ true)); + recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning)); + } + function reportInaccessibleThisError() { + if (errorNameNode) { + reportedDeclarationError = true; + emitterDiagnostics.add(ts.createDiagnosticForNode(errorNameNode, ts.Diagnostics.The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary, ts.declarationNameToString(errorNameNode))); + } + } + function writeTypeOfDeclaration(declaration, type, getSymbolAccessibilityDiagnostic) { + writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; + write(": "); + if (type) { + // Write the type + emitType(type); + } + else { + errorNameNode = declaration.name; + resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */, writer); + errorNameNode = undefined; + } + } + function writeReturnTypeAtSignature(signature, getSymbolAccessibilityDiagnostic) { + writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; + write(": "); + if (signature.type) { + // Write the type + emitType(signature.type); + } + else { + errorNameNode = signature.name; + resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */, writer); + errorNameNode = undefined; + } + } + function emitLines(nodes) { + 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_5 = nodes; _i < nodes_5.length; _i++) { + var node = nodes_5[_i]; + if (!canEmitFn || canEmitFn(node)) { + if (currentWriterPos !== writer.getTextPos()) { + write(separator); + } + currentWriterPos = writer.getTextPos(); + eachNodeEmitFn(node); + } + } + } + function emitCommaList(nodes, eachNodeEmitFn, canEmitFn) { + emitSeparatedList(nodes, ", ", eachNodeEmitFn, canEmitFn); + } + function writeJsDocComments(declaration) { + if (declaration) { + 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); + } + } + function emitTypeWithNewGetSymbolAccessibilityDiagnostic(type, getSymbolAccessibilityDiagnostic) { + writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; + emitType(type); + } + function emitType(type) { + switch (type.kind) { + case 118 /* AnyKeyword */: + case 134 /* StringKeyword */: + case 132 /* NumberKeyword */: + case 121 /* BooleanKeyword */: + case 135 /* SymbolKeyword */: + case 104 /* VoidKeyword */: + case 137 /* UndefinedKeyword */: + case 94 /* NullKeyword */: + case 129 /* NeverKeyword */: + case 167 /* ThisType */: + case 171 /* LiteralType */: + return writeTextOfNode(currentText, type); + case 199 /* ExpressionWithTypeArguments */: + return emitExpressionWithTypeArguments(type); + case 157 /* TypeReference */: + return emitTypeReference(type); + case 160 /* TypeQuery */: + return emitTypeQuery(type); + case 162 /* ArrayType */: + return emitArrayType(type); + case 163 /* TupleType */: + return emitTupleType(type); + case 164 /* UnionType */: + return emitUnionType(type); + case 165 /* IntersectionType */: + return emitIntersectionType(type); + case 166 /* ParenthesizedType */: + return emitParenType(type); + case 168 /* TypeOperator */: + return emitTypeOperator(type); + case 169 /* IndexedAccessType */: + return emitIndexedAccessType(type); + case 170 /* MappedType */: + return emitMappedType(type); + case 158 /* FunctionType */: + case 159 /* ConstructorType */: + return emitSignatureDeclarationWithJsDocComments(type); + case 161 /* TypeLiteral */: + return emitTypeLiteral(type); + case 70 /* Identifier */: + return emitEntityName(type); + case 141 /* QualifiedName */: + return emitEntityName(type); + case 156 /* TypePredicate */: + return emitTypePredicate(type); + } + function writeEntityName(entityName) { + if (entityName.kind === 70 /* Identifier */) { + writeTextOfNode(currentText, entityName); + } + else { + var left = entityName.kind === 141 /* QualifiedName */ ? entityName.left : entityName.expression; + var right = entityName.kind === 141 /* QualifiedName */ ? entityName.right : entityName.name; + writeEntityName(left); + write("."); + writeTextOfNode(currentText, right); + } + } + function emitEntityName(entityName) { + var visibilityResult = resolver.isEntityNameVisible(entityName, + // Aliases can be written asynchronously so use correct enclosing declaration + entityName.parent.kind === 234 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); + handleSymbolAccessibilityError(visibilityResult); + recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName)); + writeEntityName(entityName); + } + function emitExpressionWithTypeArguments(node) { + if (ts.isEntityNameExpression(node.expression)) { + ts.Debug.assert(node.expression.kind === 70 /* Identifier */ || node.expression.kind === 177 /* PropertyAccessExpression */); + emitEntityName(node.expression); + if (node.typeArguments) { + write("<"); + emitCommaList(node.typeArguments, emitType); write(">"); } } - function emitJsxClosingElement(node) { - write(""); } - function emitJsxElement(node) { - emitJsxOpeningOrSelfClosingElement(node.openingElement); - for (var i = 0, n = node.children.length; i < n; i++) { - emit(node.children[i]); - } - emitJsxClosingElement(node.closingElement); - } - if (node.kind === 241 /* JsxElement */) { - emitJsxElement(node); - } - else { - ts.Debug.assert(node.kind === 242 /* JsxSelfClosingElement */); - emitJsxOpeningOrSelfClosingElement(node); - } } - // This function specifically handles numeric/string literals for enum and accessor 'identifiers'. - // In a sense, it does not actually emit identifiers as much as it declares a name for a specific property. - // For example, this is utilized when feeding in a result to Object.defineProperty. - function emitExpressionForPropertyName(node) { - ts.Debug.assert(node.kind !== 169 /* BindingElement */); - if (node.kind === 9 /* StringLiteral */) { - emitLiteral(node); - } - else if (node.kind === 140 /* ComputedPropertyName */) { - // if this is a decorated computed property, we will need to capture the result - // of the property expression so that we can apply decorators later. This is to ensure - // we don't introduce unintended side effects: - // - // class C { - // [_a = x]() { } - // } - // - // The emit for the decorated computed property decorator is: - // - // __decorate([dec], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a)); - // - if (ts.nodeIsDecorated(node.parent)) { - if (!computedPropertyNamesToGeneratedNames) { - computedPropertyNamesToGeneratedNames = []; - } - var generatedName = computedPropertyNamesToGeneratedNames[ts.getNodeId(node)]; - if (generatedName) { - // we have already generated a variable for this node, write that value instead. - write(generatedName); - return; - } - generatedName = createAndRecordTempVariable(0 /* Auto */).text; - computedPropertyNamesToGeneratedNames[ts.getNodeId(node)] = generatedName; - write(generatedName); - write(" = "); - } - emit(node.expression); - } - else { - write('"'); - if (node.kind === 8 /* NumericLiteral */) { - write(node.text); - } - else { - writeTextOfNode(currentText, node); - } - write('"'); - } + function emitTypePredicate(type) { + writeTextOfNode(currentText, type.parameterName); + write(" is "); + emitType(type.type); } - function isExpressionIdentifier(node) { - var parent = node.parent; - switch (parent.kind) { - case 170 /* ArrayLiteralExpression */: - case 195 /* AsExpression */: - case 184 /* AwaitExpression */: - case 187 /* BinaryExpression */: - case 174 /* CallExpression */: - case 249 /* CaseClause */: - case 140 /* ComputedPropertyName */: - case 188 /* ConditionalExpression */: - case 143 /* Decorator */: - case 181 /* DeleteExpression */: - case 204 /* DoStatement */: - case 173 /* ElementAccessExpression */: - case 235 /* ExportAssignment */: - case 202 /* ExpressionStatement */: - case 194 /* ExpressionWithTypeArguments */: - case 206 /* ForStatement */: - case 207 /* ForInStatement */: - case 208 /* ForOfStatement */: - case 203 /* IfStatement */: - case 245 /* JsxClosingElement */: - case 242 /* JsxSelfClosingElement */: - case 243 /* JsxOpeningElement */: - case 247 /* JsxSpreadAttribute */: - case 248 /* JsxExpression */: - case 175 /* NewExpression */: - case 196 /* NonNullExpression */: - case 178 /* ParenthesizedExpression */: - case 186 /* PostfixUnaryExpression */: - case 185 /* PrefixUnaryExpression */: - case 211 /* ReturnStatement */: - case 254 /* ShorthandPropertyAssignment */: - case 191 /* SpreadElementExpression */: - case 213 /* SwitchStatement */: - case 176 /* TaggedTemplateExpression */: - case 197 /* TemplateSpan */: - case 215 /* ThrowStatement */: - case 177 /* TypeAssertionExpression */: - case 182 /* TypeOfExpression */: - case 183 /* VoidExpression */: - case 205 /* WhileStatement */: - case 212 /* WithStatement */: - case 190 /* YieldExpression */: - return true; - case 169 /* BindingElement */: - case 255 /* EnumMember */: - case 142 /* Parameter */: - case 253 /* PropertyAssignment */: - case 145 /* PropertyDeclaration */: - case 218 /* VariableDeclaration */: - return parent.initializer === node; - case 172 /* PropertyAccessExpression */: - return parent.expression === node; - case 180 /* ArrowFunction */: - case 179 /* FunctionExpression */: - return parent.body === node; - case 229 /* ImportEqualsDeclaration */: - return parent.moduleReference === node; - case 139 /* QualifiedName */: - return parent.left === node; - } - return false; + function emitTypeQuery(type) { + write("typeof "); + emitEntityName(type.exprName); } - function emitExpressionIdentifier(node) { - var container = resolver.getReferencedExportContainer(node); - if (container) { - if (container.kind === 256 /* SourceFile */) { - // Identifier references module export - if (modulekind !== ts.ModuleKind.ES6 && modulekind !== ts.ModuleKind.System) { - write("exports."); - } - } - else { - // Identifier references namespace export - write(getGeneratedNameForNode(container)); - write("."); - } - } - else { - if (modulekind !== ts.ModuleKind.ES6) { - var declaration = resolver.getReferencedImportDeclaration(node); - if (declaration) { - if (declaration.kind === 231 /* ImportClause */) { - // Identifier references default import - write(getGeneratedNameForNode(declaration.parent)); - write(languageVersion === 0 /* ES3 */ ? '["default"]' : ".default"); - return; - } - else if (declaration.kind === 234 /* ImportSpecifier */) { - // Identifier references named import - write(getGeneratedNameForNode(declaration.parent.parent.parent)); - var name_26 = declaration.propertyName || declaration.name; - var identifier = ts.getTextOfNodeFromSourceText(currentText, name_26); - if (languageVersion === 0 /* ES3 */ && identifier === "default") { - write('["default"]'); - } - else { - write("."); - write(identifier); - } - return; - } - } - } - if (languageVersion < 2 /* ES6 */) { - var declaration = resolver.getReferencedDeclarationWithCollidingName(node); - if (declaration) { - write(getGeneratedNameForNode(declaration.name)); - return; - } - } - else if (resolver.getNodeCheckFlags(node) & 1048576 /* BodyScopedClassBinding */) { - // Due to the emit for class decorators, any reference to the class from inside of the class body - // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind - // behavior of class names in ES6. - var declaration = resolver.getReferencedValueDeclaration(node); - if (declaration) { - var classAlias = decoratedClassAliases[ts.getNodeId(declaration)]; - if (classAlias !== undefined) { - write(classAlias); - return; - } - } - } - } - if (ts.nodeIsSynthesized(node)) { - write(node.text); - } - else { - writeTextOfNode(currentText, node); - } + function emitArrayType(type) { + emitType(type.elementType); + write("[]"); } - function isNameOfNestedBlockScopedRedeclarationOrCapturedBinding(node) { - if (languageVersion < 2 /* ES6 */) { - var parent_13 = node.parent; - switch (parent_13.kind) { - case 169 /* BindingElement */: - case 221 /* ClassDeclaration */: - case 224 /* EnumDeclaration */: - case 218 /* VariableDeclaration */: - return parent_13.name === node && resolver.isDeclarationWithCollidingName(parent_13); - } - } - return false; - } - function getClassExpressionInPropertyAccessInStaticPropertyDeclaration(node) { - if (languageVersion >= 2 /* ES6 */) { - var parent_14 = node.parent; - if (parent_14.kind === 172 /* PropertyAccessExpression */ && parent_14.expression === node) { - parent_14 = parent_14.parent; - while (parent_14 && parent_14.kind !== 145 /* PropertyDeclaration */) { - parent_14 = parent_14.parent; - } - return parent_14 && parent_14.kind === 145 /* PropertyDeclaration */ && (parent_14.flags & 32 /* Static */) !== 0 && - parent_14.parent.kind === 192 /* ClassExpression */ ? parent_14.parent : undefined; - } - } - return undefined; - } - function emitIdentifier(node) { - if (convertedLoopState) { - if (node.text == "arguments" && resolver.isArgumentsLocalBinding(node)) { - // in converted loop body arguments cannot be used directly. - var name_27 = convertedLoopState.argumentsName || (convertedLoopState.argumentsName = makeUniqueName("arguments")); - write(name_27); - return; - } - } - if (!node.parent) { - write(node.text); - } - else if (isExpressionIdentifier(node)) { - var classExpression = getClassExpressionInPropertyAccessInStaticPropertyDeclaration(node); - if (classExpression) { - var declaration = resolver.getReferencedValueDeclaration(node); - if (declaration === classExpression) { - write(getGeneratedNameForNode(declaration.name)); - return; - } - } - emitExpressionIdentifier(node); - } - else if (isNameOfNestedBlockScopedRedeclarationOrCapturedBinding(node)) { - write(getGeneratedNameForNode(node)); - } - else if (ts.nodeIsSynthesized(node)) { - write(node.text); - } - else { - writeTextOfNode(currentText, node); - } - } - function emitThis(node) { - if (resolver.getNodeCheckFlags(node) & 2 /* LexicalThis */) { - write("_this"); - } - else if (convertedLoopState) { - write(convertedLoopState.thisName || (convertedLoopState.thisName = makeUniqueName("this"))); - } - else { - write("this"); - } - } - function emitSuper(node) { - if (languageVersion >= 2 /* ES6 */) { - write("super"); - } - else { - var flags = resolver.getNodeCheckFlags(node); - if (flags & 256 /* SuperInstance */) { - write("_super.prototype"); - } - else { - write("_super"); - } - } - } - function emitObjectBindingPattern(node) { - write("{ "); - var elements = node.elements; - emitList(elements, 0, elements.length, /*multiLine*/ false, /*trailingComma*/ elements.hasTrailingComma); - write(" }"); - } - function emitArrayBindingPattern(node) { + function emitTupleType(type) { write("["); - var elements = node.elements; - emitList(elements, 0, elements.length, /*multiLine*/ false, /*trailingComma*/ elements.hasTrailingComma); + emitCommaList(type.elementTypes, emitType); write("]"); } - function emitBindingElement(node) { - if (node.propertyName) { - emit(node.propertyName); - write(": "); - } - if (node.dotDotDotToken) { - write("..."); - } - if (ts.isBindingPattern(node.name)) { - emit(node.name); - } - else { - emitModuleMemberName(node); - } - emitOptional(" = ", node.initializer); + function emitUnionType(type) { + emitSeparatedList(type.types, " | ", emitType); } - function emitSpreadElementExpression(node) { - write("..."); - emit(node.expression); + function emitIntersectionType(type) { + emitSeparatedList(type.types, " & ", emitType); } - function emitYieldExpression(node) { - write(ts.tokenToString(114 /* YieldKeyword */)); - if (node.asteriskToken) { - write("*"); - } - if (node.expression) { - write(" "); - emit(node.expression); - } + function emitParenType(type) { + write("("); + emitType(type.type); + write(")"); } - function emitAwaitExpression(node) { - var needsParenthesis = needsParenthesisForAwaitExpressionAsYield(node); - if (needsParenthesis) { - write("("); - } - write(ts.tokenToString(114 /* YieldKeyword */)); + function emitTypeOperator(type) { + write(ts.tokenToString(type.operator)); write(" "); - emit(node.expression); - if (needsParenthesis) { - write(")"); - } + emitType(type.type); } - function needsParenthesisForAwaitExpressionAsYield(node) { - if (node.parent.kind === 187 /* BinaryExpression */ && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { - return true; - } - else if (node.parent.kind === 188 /* ConditionalExpression */ && node.parent.condition === node) { - return true; - } - else if (node.parent.kind === 185 /* PrefixUnaryExpression */ || node.parent.kind === 181 /* DeleteExpression */ || - node.parent.kind === 182 /* TypeOfExpression */ || node.parent.kind === 183 /* VoidExpression */) { - return true; - } - return false; + function emitIndexedAccessType(node) { + emitType(node.objectType); + write("["); + emitType(node.indexType); + write("]"); } - function needsParenthesisForPropertyAccessOrInvocation(node) { - switch (node.kind) { - case 69 /* Identifier */: - case 170 /* ArrayLiteralExpression */: - case 172 /* PropertyAccessExpression */: - case 173 /* ElementAccessExpression */: - case 174 /* CallExpression */: - case 178 /* ParenthesizedExpression */: - // This list is not exhaustive and only includes those cases that are relevant - // to the check in emitArrayLiteral. More cases can be added as needed. - return false; - } - return true; - } - function emitListWithSpread(elements, needsUniqueCopy, multiLine, trailingComma, useConcat) { - var pos = 0; - var group = 0; - var length = elements.length; - while (pos < length) { - // Emit using the pattern .concat(, , ...) - if (group === 1 && useConcat) { - write(".concat("); - } - else if (group > 0) { - write(", "); - } - var e = elements[pos]; - if (e.kind === 191 /* SpreadElementExpression */) { - e = e.expression; - emitParenthesizedIf(e, /*parenthesized*/ group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); - pos++; - if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 170 /* ArrayLiteralExpression */) { - write(".slice()"); - } - } - else { - var i = pos; - while (i < length && elements[i].kind !== 191 /* SpreadElementExpression */) { - i++; - } - write("["); - if (multiLine) { - increaseIndent(); - } - emitList(elements, pos, i - pos, multiLine, trailingComma && i === length); - if (multiLine) { - decreaseIndent(); - } - write("]"); - pos = i; - } - group++; - } - if (group > 1) { - if (useConcat) { - write(")"); - } - } - } - function isSpreadElementExpression(node) { - return node.kind === 191 /* SpreadElementExpression */; - } - function emitArrayLiteral(node) { - var elements = node.elements; - if (elements.length === 0) { - write("[]"); - } - else if (languageVersion >= 2 /* ES6 */ || !ts.forEach(elements, isSpreadElementExpression)) { - write("["); - emitLinePreservingList(node, node.elements, elements.hasTrailingComma, /*spacesBetweenBraces*/ false); - write("]"); - } - else { - emitListWithSpread(elements, /*needsUniqueCopy*/ true, /*multiLine*/ node.multiLine, - /*trailingComma*/ elements.hasTrailingComma, /*useConcat*/ true); - } - } - function emitObjectLiteralBody(node, numElements) { - if (numElements === 0) { - write("{}"); - return; - } + function emitMappedType(node) { + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; write("{"); - if (numElements > 0) { - var properties = node.properties; - // If we are not doing a downlevel transformation for object literals, - // then try to preserve the original shape of the object literal. - // Otherwise just try to preserve the formatting. - if (numElements === properties.length) { - emitLinePreservingList(node, properties, /*allowTrailingComma*/ languageVersion >= 1 /* ES5 */, /*spacesBetweenBraces*/ true); - } - else { - var multiLine = node.multiLine; - if (!multiLine) { - write(" "); - } - else { - increaseIndent(); - } - emitList(properties, 0, numElements, /*multiLine*/ multiLine, /*trailingComma*/ false); - if (!multiLine) { - write(" "); - } - else { - decreaseIndent(); - } - } + writeLine(); + increaseIndent(); + if (node.readonlyToken) { + write("readonly "); + } + write("["); + writeEntityName(node.typeParameter.name); + write(" in "); + emitType(node.typeParameter.constraint); + write("]"); + if (node.questionToken) { + write("?"); + } + write(": "); + emitType(node.type); + write(";"); + writeLine(); + decreaseIndent(); + write("}"); + enclosingDeclaration = prevEnclosingDeclaration; + } + function emitTypeLiteral(type) { + write("{"); + if (type.members.length) { + writeLine(); + increaseIndent(); + // write members + emitLines(type.members); + decreaseIndent(); } write("}"); } - function emitDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex) { - var multiLine = node.multiLine; - var properties = node.properties; - write("("); - if (multiLine) { - increaseIndent(); - } - // For computed properties, we need to create a unique handle to the object - // literal so we can modify it without risking internal assignments tainting the object. - var tempVar = createAndRecordTempVariable(0 /* Auto */); - // Write out the first non-computed properties - // (or all properties if none of them are computed), - // then emit the rest through indexing on the temp variable. - emit(tempVar); - write(" = "); - emitObjectLiteralBody(node, firstComputedPropertyIndex); - for (var i = firstComputedPropertyIndex, n = properties.length; i < n; i++) { - writeComma(); - var property = properties[i]; - emitStart(property); - if (property.kind === 149 /* GetAccessor */ || property.kind === 150 /* SetAccessor */) { - // TODO (drosen): Reconcile with 'emitMemberFunctions'. - var accessors = ts.getAllAccessorDeclarations(node.properties, property); - if (property !== accessors.firstAccessor) { - continue; - } - write("Object.defineProperty("); - emit(tempVar); - write(", "); - emitStart(property.name); - emitExpressionForPropertyName(property.name); - emitEnd(property.name); - write(", {"); - increaseIndent(); - if (accessors.getAccessor) { - writeLine(); - emitLeadingComments(accessors.getAccessor); - write("get: "); - emitStart(accessors.getAccessor); - write("function "); - emitSignatureAndBody(accessors.getAccessor); - emitEnd(accessors.getAccessor); - emitTrailingComments(accessors.getAccessor); - write(","); - } - if (accessors.setAccessor) { - writeLine(); - emitLeadingComments(accessors.setAccessor); - write("set: "); - emitStart(accessors.setAccessor); - write("function "); - emitSignatureAndBody(accessors.setAccessor); - emitEnd(accessors.setAccessor); - emitTrailingComments(accessors.setAccessor); - write(","); - } - writeLine(); - write("enumerable: true,"); - writeLine(); - write("configurable: true"); - decreaseIndent(); - writeLine(); - write("})"); - emitEnd(property); - } - else { - emitLeadingComments(property); - emitStart(property.name); - emit(tempVar); - emitMemberAccessForPropertyName(property.name); - emitEnd(property.name); - write(" = "); - if (property.kind === 253 /* PropertyAssignment */) { - emit(property.initializer); - } - else if (property.kind === 254 /* ShorthandPropertyAssignment */) { - emitExpressionIdentifier(property.name); - } - else if (property.kind === 147 /* MethodDeclaration */) { - emitFunctionDeclaration(property); - } - else { - ts.Debug.fail("ObjectLiteralElement type not accounted for: " + property.kind); - } - } - emitEnd(property); - } - writeComma(); - emit(tempVar); - if (multiLine) { - decreaseIndent(); - writeLine(); - } - write(")"); - function writeComma() { - if (multiLine) { - write(","); - writeLine(); - } - else { - write(", "); - } + } + function emitSourceFile(node) { + currentText = node.text; + currentLineMap = ts.getLineStarts(node); + currentIdentifiers = node.identifiers; + isCurrentFileExternalModule = ts.isExternalModule(node); + enclosingDeclaration = node; + ts.emitDetachedComments(currentText, currentLineMap, writer, ts.writeCommentRange, node, newLine, true /* remove comments */); + emitLines(node.statements); + } + // Return a temp variable name to be used in `export default` statements. + // The temp name will be of the form _default_counter. + // Note that export default is only allowed at most once in a module, so we + // do not need to keep track of created temp names. + function getExportDefaultTempVariableName() { + var baseName = "_default"; + if (!(baseName in currentIdentifiers)) { + return baseName; + } + var count = 0; + while (true) { + count++; + var name_40 = baseName + "_" + count; + if (!(name_40 in currentIdentifiers)) { + return name_40; } } - function emitObjectLiteral(node) { - var properties = node.properties; - if (languageVersion < 2 /* ES6 */) { - var numProperties = properties.length; - // Find the first computed property. - // Everything until that point can be emitted as part of the initial object literal. - var numInitialNonComputedProperties = numProperties; - for (var i = 0, n = properties.length; i < n; i++) { - if (properties[i].name.kind === 140 /* ComputedPropertyName */) { - numInitialNonComputedProperties = i; - break; - } - } - var hasComputedProperty = numInitialNonComputedProperties !== properties.length; - if (hasComputedProperty) { - emitDownlevelObjectLiteralWithComputedProperties(node, numInitialNonComputedProperties); - return; - } + } + function emitExportAssignment(node) { + if (node.expression.kind === 70 /* Identifier */) { + write(node.isExportEquals ? "export = " : "export default "); + writeTextOfNode(currentText, node.expression); + } + else { + // Expression + var tempVarName = getExportDefaultTempVariableName(); + if (!noDeclare) { + write("declare "); } - // Ordinary case: either the object has no computed properties - // or we're compiling with an ES6+ target. - emitObjectLiteralBody(node, properties.length); - } - function createBinaryExpression(left, operator, right, startsOnNewLine) { - var result = ts.createSynthesizedNode(187 /* BinaryExpression */, startsOnNewLine); - result.operatorToken = ts.createSynthesizedNode(operator); - result.left = left; - result.right = right; - return result; - } - function createPropertyAccessExpression(expression, name) { - var result = ts.createSynthesizedNode(172 /* PropertyAccessExpression */); - result.expression = parenthesizeForAccess(expression); - result.name = name; - return result; - } - function createElementAccessExpression(expression, argumentExpression) { - var result = ts.createSynthesizedNode(173 /* ElementAccessExpression */); - result.expression = parenthesizeForAccess(expression); - result.argumentExpression = argumentExpression; - return result; - } - function parenthesizeForAccess(expr) { - // When diagnosing whether the expression needs parentheses, the decision should be based - // on the innermost expression in a chain of nested type assertions. - while (expr.kind === 177 /* TypeAssertionExpression */ || - expr.kind === 195 /* AsExpression */ || - expr.kind === 196 /* NonNullExpression */) { - expr = expr.expression; - } - // isLeftHandSideExpression is almost the correct criterion for when it is not necessary - // to parenthesize the expression before a dot. The known exceptions are: - // - // NewExpression: - // new C.x -> not the same as (new C).x - // NumberLiteral - // 1.x -> not the same as (1).x - // - if (ts.isLeftHandSideExpression(expr) && - expr.kind !== 175 /* NewExpression */ && - expr.kind !== 8 /* NumericLiteral */) { - return expr; - } - var node = ts.createSynthesizedNode(178 /* ParenthesizedExpression */); - node.expression = expr; - return node; - } - function emitComputedPropertyName(node) { - write("["); - emitExpressionForPropertyName(node); - write("]"); - } - function emitMethod(node) { - if (languageVersion >= 2 /* ES6 */ && node.asteriskToken) { - write("*"); - } - emit(node.name); - if (languageVersion < 2 /* ES6 */) { - write(": function "); - } - emitSignatureAndBody(node); - } - function emitPropertyAssignment(node) { - emit(node.name); + write("var "); + write(tempVarName); write(": "); - // This is to ensure that we emit comment in the following case: - // For example: - // obj = { - // id: /*comment1*/ ()=>void - // } - // "comment1" is not considered to be leading comment for node.initializer - // but rather a trailing comment on the previous node. - emitTrailingCommentsOfPosition(node.initializer.pos); - emit(node.initializer); - } - // Return true if identifier resolves to an exported member of a namespace - function isExportReference(node) { - var container = resolver.getReferencedExportContainer(node); - return !!container; - } - // Return true if identifier resolves to an imported identifier - function isImportedReference(node) { - var declaration = resolver.getReferencedImportDeclaration(node); - return declaration && (declaration.kind === 231 /* ImportClause */ || declaration.kind === 234 /* ImportSpecifier */); - } - function emitShorthandPropertyAssignment(node) { - // The name property of a short-hand property assignment is considered an expression position, so here - // we manually emit the identifier to avoid rewriting. - writeTextOfNode(currentText, node.name); - // If emitting pre-ES6 code, or if the name requires rewriting when resolved as an expression identifier, - // we emit a normal property assignment. For example: - // module m { - // export let y; - // } - // module m { - // let obj = { y }; - // } - // Here we need to emit obj = { y : m.y } regardless of the output target. - // The same rules apply for imported identifiers when targeting module formats with indirect access to - // the imported identifiers. For example, when targeting CommonJS: - // - // import {foo} from './foo'; - // export const baz = { foo }; - // - // Must be transformed into: - // - // const foo_1 = require('./foo'); - // exports.baz = { foo: foo_1.foo }; - // - if (languageVersion < 2 /* ES6 */ || (modulekind !== ts.ModuleKind.ES6 && isImportedReference(node.name)) || isExportReference(node.name)) { - // Emit identifier as an identifier - write(": "); - emitExpressionIdentifier(node.name); - } - if (languageVersion >= 2 /* ES6 */ && node.objectAssignmentInitializer) { - write(" = "); - emit(node.objectAssignmentInitializer); - } - } - function tryEmitConstantValue(node) { - var constantValue = tryGetConstEnumValue(node); - if (constantValue !== undefined) { - write(constantValue.toString()); - if (!compilerOptions.removeComments) { - var propertyName = node.kind === 172 /* PropertyAccessExpression */ ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); - write(" /* " + propertyName + " */"); - } - return true; - } - return false; - } - function tryGetConstEnumValue(node) { - if (compilerOptions.isolatedModules) { - return undefined; - } - return node.kind === 172 /* PropertyAccessExpression */ || node.kind === 173 /* ElementAccessExpression */ - ? resolver.getConstantValue(node) - : undefined; - } - // Returns 'true' if the code was actually indented, false otherwise. - // If the code is not indented, an optional valueToWriteWhenNotIndenting will be - // emitted instead. - function indentIfOnDifferentLines(parent, node1, node2, valueToWriteWhenNotIndenting) { - var realNodesAreOnDifferentLines = !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); - // Always use a newline for synthesized code if the synthesizer desires it. - var synthesizedNodeIsOnDifferentLine = synthesizedNodeStartsOnNewLine(node2); - if (realNodesAreOnDifferentLines || synthesizedNodeIsOnDifferentLine) { - increaseIndent(); - writeLine(); - return true; - } - else { - if (valueToWriteWhenNotIndenting) { - write(valueToWriteWhenNotIndenting); - } - return false; - } - } - function emitPropertyAccess(node) { - if (tryEmitConstantValue(node)) { - return; - } - if (languageVersion === 2 /* ES6 */ && - node.expression.kind === 95 /* SuperKeyword */ && - isInAsyncMethodWithSuperInES6(node)) { - var name_28 = ts.createSynthesizedNode(9 /* StringLiteral */); - name_28.text = node.name.text; - emitSuperAccessInAsyncMethod(node.expression, name_28); - return; - } - emit(node.expression); - var dotRangeStart = ts.nodeIsSynthesized(node.expression) ? -1 : node.expression.end; - var dotRangeEnd = ts.nodeIsSynthesized(node.expression) ? -1 : ts.skipTrivia(currentText, node.expression.end) + 1; - var dotToken = { pos: dotRangeStart, end: dotRangeEnd }; - var indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, dotToken); - // 1 .toString is a valid property access, emit a space after the literal - // Also emit a space if expression is a integer const enum value - it will appear in generated code as numeric literal - var shouldEmitSpace = false; - if (!indentedBeforeDot) { - if (node.expression.kind === 8 /* NumericLiteral */) { - // check if numeric literal was originally written with a dot - var text = ts.getTextOfNodeFromSourceText(currentText, node.expression); - shouldEmitSpace = text.indexOf(ts.tokenToString(21 /* DotToken */)) < 0; - } - else { - // check if constant enum value is integer - var constantValue = tryGetConstEnumValue(node.expression); - // isFinite handles cases when constantValue is undefined - shouldEmitSpace = isFinite(constantValue) && Math.floor(constantValue) === constantValue; - } - } - if (shouldEmitSpace) { - write(" ."); - } - else { - write("."); - } - var indentedAfterDot = indentIfOnDifferentLines(node, dotToken, node.name); - emit(node.name); - decreaseIndentIf(indentedBeforeDot, indentedAfterDot); - } - function emitQualifiedName(node) { - emit(node.left); - write("."); - emit(node.right); - } - function emitQualifiedNameAsExpression(node, useFallback) { - if (node.left.kind === 69 /* Identifier */) { - emitEntityNameAsExpression(node.left, useFallback); - } - else if (useFallback) { - var temp = createAndRecordTempVariable(0 /* Auto */); - write("("); - emitNodeWithoutSourceMap(temp); - write(" = "); - emitEntityNameAsExpression(node.left, /*useFallback*/ true); - write(") && "); - emitNodeWithoutSourceMap(temp); - } - else { - emitEntityNameAsExpression(node.left, /*useFallback*/ false); - } - write("."); - emit(node.right); - } - function emitEntityNameAsExpression(node, useFallback) { - switch (node.kind) { - case 69 /* Identifier */: - if (useFallback) { - write("typeof "); - emitExpressionIdentifier(node); - write(" !== 'undefined' && "); - } - emitExpressionIdentifier(node); - break; - case 139 /* QualifiedName */: - emitQualifiedNameAsExpression(node, useFallback); - break; - default: - emitNodeWithoutSourceMap(node); - break; - } - } - function emitIndexedAccess(node) { - if (tryEmitConstantValue(node)) { - return; - } - if (languageVersion === 2 /* ES6 */ && - node.expression.kind === 95 /* SuperKeyword */ && - isInAsyncMethodWithSuperInES6(node)) { - emitSuperAccessInAsyncMethod(node.expression, node.argumentExpression); - return; - } - emit(node.expression); - write("["); - emit(node.argumentExpression); - write("]"); - } - function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { return e.kind === 191 /* SpreadElementExpression */; }); - } - function skipParentheses(node) { - while (node.kind === 178 /* ParenthesizedExpression */ || - node.kind === 177 /* TypeAssertionExpression */ || - node.kind === 195 /* AsExpression */ || - node.kind === 196 /* NonNullExpression */) { - node = node.expression; - } - return node; - } - function emitCallTarget(node) { - if (node.kind === 69 /* Identifier */ || node.kind === 97 /* ThisKeyword */ || node.kind === 95 /* SuperKeyword */) { - emit(node); - return node; - } - var temp = createAndRecordTempVariable(0 /* Auto */); - write("("); - emit(temp); - write(" = "); - emit(node); - write(")"); - return temp; - } - function emitCallWithSpread(node) { - var target; - var expr = skipParentheses(node.expression); - if (expr.kind === 172 /* PropertyAccessExpression */) { - // Target will be emitted as "this" argument - target = emitCallTarget(expr.expression); - write("."); - emit(expr.name); - } - else if (expr.kind === 173 /* ElementAccessExpression */) { - // Target will be emitted as "this" argument - target = emitCallTarget(expr.expression); - write("["); - emit(expr.argumentExpression); - write("]"); - } - else if (expr.kind === 95 /* SuperKeyword */) { - target = expr; - write("_super"); - } - else { - emit(node.expression); - } - write(".apply("); - if (target) { - if (target.kind === 95 /* SuperKeyword */) { - // Calls of form super(...) and super.foo(...) - emitThis(target); - } - else { - // Calls of form obj.foo(...) - emit(target); - } - } - else { - // Calls of form foo(...) - write("void 0"); - } - write(", "); - emitListWithSpread(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*trailingComma*/ false, /*useConcat*/ true); - write(")"); - } - function isInAsyncMethodWithSuperInES6(node) { - if (languageVersion === 2 /* ES6 */) { - var container = ts.getSuperContainer(node, /*includeFunctions*/ false); - if (container && resolver.getNodeCheckFlags(container) & (2048 /* AsyncMethodWithSuper */ | 4096 /* AsyncMethodWithSuperBinding */)) { - return true; - } - } - return false; - } - function emitSuperAccessInAsyncMethod(superNode, argumentExpression) { - var container = ts.getSuperContainer(superNode, /*includeFunctions*/ false); - var isSuperBinding = resolver.getNodeCheckFlags(container) & 4096 /* AsyncMethodWithSuperBinding */; - write("_super("); - emit(argumentExpression); - write(isSuperBinding ? ").value" : ")"); - } - function emitCallExpression(node) { - if (languageVersion < 2 /* ES6 */ && hasSpreadElement(node.arguments)) { - emitCallWithSpread(node); - return; - } - var expression = node.expression; - var superCall = false; - var isAsyncMethodWithSuper = false; - if (expression.kind === 95 /* SuperKeyword */) { - emitSuper(expression); - superCall = true; - } - else { - superCall = ts.isSuperPropertyOrElementAccess(expression); - isAsyncMethodWithSuper = superCall && isInAsyncMethodWithSuperInES6(node); - emit(expression); - } - if (superCall && (languageVersion < 2 /* ES6 */ || isAsyncMethodWithSuper)) { - write(".call("); - emitThis(expression); - if (node.arguments.length) { - write(", "); - emitCommaList(node.arguments); - } - write(")"); - } - else { - write("("); - emitCommaList(node.arguments); - write(")"); - } - } - function emitNewExpression(node) { - write("new "); - // Spread operator logic is supported in new expressions in ES5 using a combination - // of Function.prototype.bind() and Function.prototype.apply(). - // - // Example: - // - // var args = [1, 2, 3, 4, 5]; - // new Array(...args); - // - // is compiled into the following ES5: - // - // var args = [1, 2, 3, 4, 5]; - // new (Array.bind.apply(Array, [void 0].concat(args))); - // - // The 'thisArg' to 'bind' is ignored when invoking the result of 'bind' with 'new', - // Thus, we set it to undefined ('void 0'). - if (languageVersion === 1 /* ES5 */ && - node.arguments && - hasSpreadElement(node.arguments)) { - write("("); - var target = emitCallTarget(node.expression); - write(".bind.apply("); - emit(target); - write(", [void 0].concat("); - emitListWithSpread(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*trailingComma*/ false, /*useConcat*/ false); - write(")))"); - write("()"); - } - else { - emit(node.expression); - if (node.arguments) { - write("("); - emitCommaList(node.arguments); - write(")"); - } - } - } - function emitTaggedTemplateExpression(node) { - if (languageVersion >= 2 /* ES6 */) { - emit(node.tag); - write(" "); - emit(node.template); - } - else { - emitDownlevelTaggedTemplate(node); - } - } - function emitParenExpression(node) { - // If the node is synthesized, it means the emitter put the parentheses there, - // not the user. If we didn't want them, the emitter would not have put them - // there. - if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 180 /* ArrowFunction */) { - if (node.expression.kind === 177 /* TypeAssertionExpression */ || - node.expression.kind === 195 /* AsExpression */ || - node.expression.kind === 196 /* NonNullExpression */) { - var operand = node.expression.expression; - // Make sure we consider all nested cast expressions, e.g.: - // (-A).x; - while (operand.kind === 177 /* TypeAssertionExpression */ || - operand.kind === 195 /* AsExpression */ || - operand.kind === 196 /* NonNullExpression */) { - operand = operand.expression; - } - // We have an expression of the form: (SubExpr) or (SubExpr as Type) - // Emitting this as (SubExpr) is really not desirable. We would like to emit the subexpr as is. - // Omitting the parentheses, however, could cause change in the semantics of the generated - // code if the casted expression has a lower precedence than the rest of the expression, e.g.: - // (new A).foo should be emitted as (new A).foo and not new A.foo - // (typeof A).toString() should be emitted as (typeof A).toString() and not typeof A.toString() - // new (A()) should be emitted as new (A()) and not new A() - // (function foo() { })() should be emitted as an IIF (function foo(){})() and not declaration function foo(){} () - if (operand.kind !== 185 /* PrefixUnaryExpression */ && - operand.kind !== 183 /* VoidExpression */ && - operand.kind !== 182 /* TypeOfExpression */ && - operand.kind !== 181 /* DeleteExpression */ && - operand.kind !== 186 /* PostfixUnaryExpression */ && - operand.kind !== 175 /* NewExpression */ && - !(operand.kind === 187 /* BinaryExpression */ && node.expression.kind === 195 /* AsExpression */) && - !(operand.kind === 174 /* CallExpression */ && node.parent.kind === 175 /* NewExpression */) && - !(operand.kind === 179 /* FunctionExpression */ && node.parent.kind === 174 /* CallExpression */) && - !(operand.kind === 8 /* NumericLiteral */ && node.parent.kind === 172 /* PropertyAccessExpression */)) { - emit(operand); - return; - } - } - } - write("("); - emit(node.expression); - write(")"); - } - function emitDeleteExpression(node) { - write(ts.tokenToString(78 /* DeleteKeyword */)); - write(" "); - emit(node.expression); - } - function emitVoidExpression(node) { - write(ts.tokenToString(103 /* VoidKeyword */)); - write(" "); - emit(node.expression); - } - function emitTypeOfExpression(node) { - write(ts.tokenToString(101 /* TypeOfKeyword */)); - write(" "); - emit(node.expression); - } - function isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node) { - if (!isCurrentFileSystemExternalModule() || node.kind !== 69 /* Identifier */ || ts.nodeIsSynthesized(node)) { - return false; - } - var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 218 /* VariableDeclaration */ || node.parent.kind === 169 /* BindingElement */); - var targetDeclaration = isVariableDeclarationOrBindingElement - ? node.parent - : resolver.getReferencedValueDeclaration(node); - return isSourceFileLevelDeclarationInSystemJsModule(targetDeclaration, /*isExported*/ true); - } - function isNameOfExportedDeclarationInNonES6Module(node) { - if (modulekind === ts.ModuleKind.System || node.kind !== 69 /* Identifier */ || ts.nodeIsSynthesized(node)) { - return false; - } - return !exportEquals && exportSpecifiers && node.text in exportSpecifiers; - } - function emitPrefixUnaryExpression(node) { - var isPlusPlusOrMinusMinus = (node.operator === 41 /* PlusPlusToken */ - || node.operator === 42 /* MinusMinusToken */); - var externalExportChanged = isPlusPlusOrMinusMinus && - isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); - if (externalExportChanged) { - // emit - // ++x - // as - // exports('x', ++x) - write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(node.operand); - write("\", "); - } - var internalExportChanged = isPlusPlusOrMinusMinus && - isNameOfExportedDeclarationInNonES6Module(node.operand); - if (internalExportChanged) { - emitAliasEqual(node.operand); - } - write(ts.tokenToString(node.operator)); - // In some cases, we need to emit a space between the operator and the operand. One obvious case - // is when the operator is an identifier, like delete or typeof. We also need to do this for plus - // and minus expressions in certain cases. Specifically, consider the following two cases (parens - // are just for clarity of exposition, and not part of the source code): - // - // (+(+1)) - // (+(++1)) - // - // We need to emit a space in both cases. In the first case, the absence of a space will make - // the resulting expression a prefix increment operation. And in the second, it will make the resulting - // expression a prefix increment whose operand is a plus expression - (++(+x)) - // The same is true of minus of course. - if (node.operand.kind === 185 /* PrefixUnaryExpression */) { - var operand = node.operand; - if (node.operator === 35 /* PlusToken */ && (operand.operator === 35 /* PlusToken */ || operand.operator === 41 /* PlusPlusToken */)) { - write(" "); - } - else if (node.operator === 36 /* MinusToken */ && (operand.operator === 36 /* MinusToken */ || operand.operator === 42 /* MinusMinusToken */)) { - write(" "); - } - } - emit(node.operand); - if (externalExportChanged) { - write(")"); - } - } - function emitPostfixUnaryExpression(node) { - var externalExportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); - var internalExportChanged = isNameOfExportedDeclarationInNonES6Module(node.operand); - if (externalExportChanged) { - // export function returns the value that was passes as the second argument - // however for postfix unary expressions result value should be the value before modification. - // emit 'x++' as '(export('x', ++x) - 1)' and 'x--' as '(export('x', --x) + 1)' - write("(" + exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(node.operand); - write("\", "); - write(ts.tokenToString(node.operator)); - emit(node.operand); - if (node.operator === 41 /* PlusPlusToken */) { - write(") - 1)"); - } - else { - write(") + 1)"); - } - } - else if (internalExportChanged) { - emitAliasEqual(node.operand); - emit(node.operand); - if (node.operator === 41 /* PlusPlusToken */) { - write(" += 1"); - } - else { - write(" -= 1"); - } - } - else { - emit(node.operand); - write(ts.tokenToString(node.operator)); - } - } - function shouldHoistDeclarationInSystemJsModule(node) { - return isSourceFileLevelDeclarationInSystemJsModule(node, /*isExported*/ false); - } - /* - * Checks if given node is a source file level declaration (not nested in module/function). - * If 'isExported' is true - then declaration must also be exported. - * This function is used in two cases: - * - check if node is a exported source file level value to determine - * if we should also export the value after its it changed - * - check if node is a source level declaration to emit it differently, - * i.e non-exported variable statement 'var x = 1' is hoisted so - * when we emit variable statement 'var' should be dropped. - */ - function isSourceFileLevelDeclarationInSystemJsModule(node, isExported) { - if (!node || !isCurrentFileSystemExternalModule()) { - return false; - } - var current = ts.getRootDeclaration(node).parent; - while (current) { - if (current.kind === 256 /* SourceFile */) { - return !isExported || ((ts.getCombinedNodeFlags(node) & 1 /* Export */) !== 0); - } - else if (ts.isDeclaration(current)) { - return false; - } - else { - current = current.parent; - } - } - } - /** - * Emit ES7 exponentiation operator downlevel using Math.pow - * @param node a binary expression node containing exponentiationOperator (**, **=) - */ - function emitExponentiationOperator(node) { - var leftHandSideExpression = node.left; - if (node.operatorToken.kind === 60 /* AsteriskAsteriskEqualsToken */) { - var synthesizedLHS = void 0; - var shouldEmitParentheses = false; - if (ts.isElementAccessExpression(leftHandSideExpression)) { - shouldEmitParentheses = true; - write("("); - synthesizedLHS = ts.createSynthesizedNode(173 /* ElementAccessExpression */, /*startsOnNewLine*/ false); - var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, /*canDefineTempVariablesInPlace*/ false, /*shouldEmitCommaBeforeAssignment*/ false); - synthesizedLHS.expression = identifier; - if (leftHandSideExpression.argumentExpression.kind !== 8 /* NumericLiteral */ && - leftHandSideExpression.argumentExpression.kind !== 9 /* StringLiteral */) { - var tempArgumentExpression = createAndRecordTempVariable(268435456 /* _i */); - synthesizedLHS.argumentExpression = tempArgumentExpression; - emitAssignment(tempArgumentExpression, leftHandSideExpression.argumentExpression, /*shouldEmitCommaBeforeAssignment*/ true, leftHandSideExpression.expression); - } - else { - synthesizedLHS.argumentExpression = leftHandSideExpression.argumentExpression; - } - write(", "); - } - else if (ts.isPropertyAccessExpression(leftHandSideExpression)) { - shouldEmitParentheses = true; - write("("); - synthesizedLHS = ts.createSynthesizedNode(172 /* PropertyAccessExpression */, /*startsOnNewLine*/ false); - var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, /*canDefineTempVariablesInPlace*/ false, /*shouldEmitCommaBeforeAssignment*/ false); - synthesizedLHS.expression = identifier; - synthesizedLHS.name = leftHandSideExpression.name; - write(", "); - } - emit(synthesizedLHS || leftHandSideExpression); - write(" = "); - write("Math.pow("); - emit(synthesizedLHS || leftHandSideExpression); - write(", "); - emit(node.right); - write(")"); - if (shouldEmitParentheses) { - write(")"); - } - } - else { - write("Math.pow("); - emit(leftHandSideExpression); - write(", "); - emit(node.right); - write(")"); - } - } - function emitAliasEqual(name) { - for (var _a = 0, _b = exportSpecifiers[name.text]; _a < _b.length; _a++) { - var specifier = _b[_a]; - emitStart(specifier.name); - emitContainingModuleName(specifier); - if (languageVersion === 0 /* ES3 */ && name.text === "default") { - write('["default"]'); - } - else { - write("."); - emitNodeWithCommentsAndWithoutSourcemap(specifier.name); - } - emitEnd(specifier.name); - write(" = "); - } - return true; - } - function emitBinaryExpression(node) { - if (languageVersion < 2 /* ES6 */ && node.operatorToken.kind === 56 /* EqualsToken */ && - (node.left.kind === 171 /* ObjectLiteralExpression */ || node.left.kind === 170 /* ArrayLiteralExpression */)) { - emitDestructuring(node, node.parent.kind === 202 /* ExpressionStatement */); - } - else { - var isAssignment = ts.isAssignmentOperator(node.operatorToken.kind); - var externalExportChanged = isAssignment && - isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.left); - if (externalExportChanged) { - // emit assignment 'x y' as 'exports("x", x y)' - write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(node.left); - write("\", "); - } - var internalExportChanged = isAssignment && - isNameOfExportedDeclarationInNonES6Module(node.left); - if (internalExportChanged) { - // export { foo } - // emit foo = 2 as exports.foo = foo = 2 - emitAliasEqual(node.left); - } - if (node.operatorToken.kind === 38 /* AsteriskAsteriskToken */ || node.operatorToken.kind === 60 /* AsteriskAsteriskEqualsToken */) { - // Downleveled emit exponentiation operator using Math.pow - emitExponentiationOperator(node); - } - else { - emit(node.left); - // Add indentation before emit the operator if the operator is on different line - // For example: - // 3 - // + 2; - // emitted as - // 3 - // + 2; - var indentedBeforeOperator = indentIfOnDifferentLines(node, node.left, node.operatorToken, node.operatorToken.kind !== 24 /* CommaToken */ ? " " : undefined); - write(ts.tokenToString(node.operatorToken.kind)); - var indentedAfterOperator = indentIfOnDifferentLines(node, node.operatorToken, node.right, " "); - emit(node.right); - decreaseIndentIf(indentedBeforeOperator, indentedAfterOperator); - } - if (externalExportChanged) { - write(")"); - } - } - } - function synthesizedNodeStartsOnNewLine(node) { - return ts.nodeIsSynthesized(node) && node.startsOnNewLine; - } - function emitConditionalExpression(node) { - emit(node.condition); - var indentedBeforeQuestion = indentIfOnDifferentLines(node, node.condition, node.questionToken, " "); - write("?"); - var indentedAfterQuestion = indentIfOnDifferentLines(node, node.questionToken, node.whenTrue, " "); - emit(node.whenTrue); - decreaseIndentIf(indentedBeforeQuestion, indentedAfterQuestion); - var indentedBeforeColon = indentIfOnDifferentLines(node, node.whenTrue, node.colonToken, " "); - write(":"); - var indentedAfterColon = indentIfOnDifferentLines(node, node.colonToken, node.whenFalse, " "); - emit(node.whenFalse); - decreaseIndentIf(indentedBeforeColon, indentedAfterColon); - } - // Helper function to decrease the indent if we previously indented. Allows multiple - // previous indent values to be considered at a time. This also allows caller to just - // call this once, passing in all their appropriate indent values, instead of needing - // to call this helper function multiple times. - function decreaseIndentIf(value1, value2) { - if (value1) { - decreaseIndent(); - } - if (value2) { - decreaseIndent(); - } - } - function isSingleLineEmptyBlock(node) { - if (node && node.kind === 199 /* Block */) { - var block = node; - return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); - } - } - function emitBlock(node) { - if (isSingleLineEmptyBlock(node)) { - emitToken(15 /* OpenBraceToken */, node.pos); - write(" "); - emitToken(16 /* CloseBraceToken */, node.statements.end); - return; - } - emitToken(15 /* OpenBraceToken */, node.pos); - increaseIndent(); - if (node.kind === 226 /* ModuleBlock */) { - ts.Debug.assert(node.parent.kind === 225 /* ModuleDeclaration */); - emitCaptureThisForNodeIfNecessary(node.parent); - } - emitLines(node.statements); - if (node.kind === 226 /* ModuleBlock */) { - emitTempDeclarations(/*newLine*/ true); - } - decreaseIndent(); + writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic; + resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */, writer); + write(";"); writeLine(); - emitToken(16 /* CloseBraceToken */, node.statements.end); + write(node.isExportEquals ? "export = " : "export default "); + write(tempVarName); } - function emitEmbeddedStatement(node) { - if (node.kind === 199 /* Block */) { - write(" "); - emit(node); + write(";"); + writeLine(); + // Make all the declarations visible for the export name + if (node.expression.kind === 70 /* Identifier */) { + var nodes = resolver.collectLinkedAliases(node.expression); + // write each of these declarations asynchronously + writeAsynchronousModuleElements(nodes); + } + function getDefaultExportAccessibilityDiagnostic() { + return { + diagnosticMessage: ts.Diagnostics.Default_export_of_the_module_has_or_is_using_private_name_0, + errorNode: node + }; + } + } + function isModuleElementVisible(node) { + return resolver.isDeclarationVisible(node); + } + function emitModuleElement(node, isModuleElementVisible) { + if (isModuleElementVisible) { + writeModuleElement(node); + } + else if (node.kind === 234 /* ImportEqualsDeclaration */ || + (node.parent.kind === 261 /* SourceFile */ && isCurrentFileExternalModule)) { + var isVisible = void 0; + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 261 /* SourceFile */) { + // Import declaration of another module that is visited async so lets put it in right spot + asynchronousSubModuleDeclarationEmitInfo.push({ + node: node, + outputPos: writer.getTextPos(), + indent: writer.getIndent(), + isVisible: isVisible + }); } else { - increaseIndent(); - writeLine(); - emit(node); - decreaseIndent(); + if (node.kind === 235 /* ImportDeclaration */) { + var importDeclaration = node; + if (importDeclaration.importClause) { + isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || + isVisibleNamedBinding(importDeclaration.importClause.namedBindings); + } + } + moduleElementDeclarationEmitInfo.push({ + node: node, + outputPos: writer.getTextPos(), + indent: writer.getIndent(), + isVisible: isVisible + }); } } - function emitExpressionStatement(node) { - emitParenthesizedIf(node.expression, /*parenthesized*/ node.expression.kind === 180 /* ArrowFunction */); + } + function writeModuleElement(node) { + switch (node.kind) { + case 225 /* FunctionDeclaration */: + return writeFunctionDeclaration(node); + case 205 /* VariableStatement */: + return writeVariableStatement(node); + case 227 /* InterfaceDeclaration */: + return writeInterfaceDeclaration(node); + case 226 /* ClassDeclaration */: + return writeClassDeclaration(node); + case 228 /* TypeAliasDeclaration */: + return writeTypeAliasDeclaration(node); + case 229 /* EnumDeclaration */: + return writeEnumDeclaration(node); + case 230 /* ModuleDeclaration */: + return writeModuleDeclaration(node); + case 234 /* ImportEqualsDeclaration */: + return writeImportEqualsDeclaration(node); + case 235 /* ImportDeclaration */: + return writeImportDeclaration(node); + default: + ts.Debug.fail("Unknown symbol kind"); + } + } + function emitModuleElementDeclarationFlags(node) { + // If the node is parented in the current source file we need to emit export declare or just export + if (node.parent.kind === 261 /* SourceFile */) { + var modifiers = ts.getModifierFlags(node); + // If the node is exported + if (modifiers & 1 /* Export */) { + write("export "); + } + if (modifiers & 512 /* Default */) { + write("default "); + } + else if (node.kind !== 227 /* InterfaceDeclaration */ && !noDeclare) { + write("declare "); + } + } + } + function emitClassMemberDeclarationFlags(flags) { + if (flags & 8 /* Private */) { + write("private "); + } + else if (flags & 16 /* Protected */) { + write("protected "); + } + if (flags & 32 /* Static */) { + write("static "); + } + if (flags & 64 /* Readonly */) { + write("readonly "); + } + if (flags & 128 /* Abstract */) { + write("abstract "); + } + } + function writeImportEqualsDeclaration(node) { + // note usage of writer. methods instead of aliases created, just to make sure we are using + // correct writer especially to handle asynchronous alias writing + emitJsDocComments(node); + if (ts.hasModifier(node, 1 /* Export */)) { + write("export "); + } + write("import "); + writeTextOfNode(currentText, node.name); + write(" = "); + if (ts.isInternalModuleImportEqualsDeclaration(node)) { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.moduleReference, getImportEntityNameVisibilityError); write(";"); } - function emitIfStatement(node) { - var endPos = emitToken(88 /* IfKeyword */, node.pos); - write(" "); - endPos = emitToken(17 /* OpenParenToken */, endPos); - emit(node.expression); - emitToken(18 /* CloseParenToken */, node.expression.end); - emitEmbeddedStatement(node.thenStatement); - if (node.elseStatement) { - writeLine(); - emitToken(80 /* ElseKeyword */, node.thenStatement.end); - if (node.elseStatement.kind === 203 /* IfStatement */) { - write(" "); - emit(node.elseStatement); - } - else { - emitEmbeddedStatement(node.elseStatement); - } - } - } - function emitDoStatement(node) { - emitLoop(node, emitDoStatementWorker); - } - function emitDoStatementWorker(node, loop) { - write("do"); - if (loop) { - emitConvertedLoopCall(loop, /*emitAsBlock*/ true); - } - else { - emitNormalLoopBody(node, /*emitAsEmbeddedStatement*/ true); - } - if (node.statement.kind === 199 /* Block */) { - write(" "); - } - else { - writeLine(); - } - write("while ("); - emit(node.expression); + else { + write("require("); + emitExternalModuleSpecifier(node); write(");"); } - function emitWhileStatement(node) { - emitLoop(node, emitWhileStatementWorker); + writer.writeLine(); + function getImportEntityNameVisibilityError() { + return { + diagnosticMessage: ts.Diagnostics.Import_declaration_0_is_using_private_name_1, + errorNode: node, + typeName: node.name + }; } - function emitWhileStatementWorker(node, loop) { - write("while ("); - emit(node.expression); - write(")"); - if (loop) { - emitConvertedLoopCall(loop, /*emitAsBlock*/ true); + } + function isVisibleNamedBinding(namedBindings) { + if (namedBindings) { + if (namedBindings.kind === 237 /* NamespaceImport */) { + return resolver.isDeclarationVisible(namedBindings); } else { - emitNormalLoopBody(node, /*emitAsEmbeddedStatement*/ true); + return ts.forEach(namedBindings.elements, function (namedImport) { return resolver.isDeclarationVisible(namedImport); }); } } - /** - * Returns true if start of variable declaration list was emitted. - * Returns false if nothing was written - this can happen for source file level variable declarations - * in system modules where such variable declarations are hoisted. - */ - function tryEmitStartOfVariableDeclarationList(decl) { - if (shouldHoistVariable(decl, /*checkIfSourceFileLevelDecl*/ true)) { - // variables in variable declaration list were already hoisted - return false; - } - if (convertedLoopState && (ts.getCombinedNodeFlags(decl) & 3072 /* BlockScoped */) === 0) { - // we are inside a converted loop - this can only happen in downlevel scenarios - // record names for all variable declarations - for (var _a = 0, _b = decl.declarations; _a < _b.length; _a++) { - var varDecl = _b[_a]; - hoistVariableDeclarationFromLoop(convertedLoopState, varDecl); - } - return false; - } - emitStart(decl); - if (decl && languageVersion >= 2 /* ES6 */) { - if (ts.isLet(decl)) { - write("let "); - } - else if (ts.isConst(decl)) { - write("const "); - } - else { - write("var "); - } - } - else { - write("var "); - } - // Note here we specifically dont emit end so that if we are going to emit binding pattern - // we can alter the source map correctly - return true; + } + function writeImportDeclaration(node) { + emitJsDocComments(node); + if (ts.hasModifier(node, 1 /* Export */)) { + write("export "); } - function emitVariableDeclarationListSkippingUninitializedEntries(list) { - var started = false; - for (var _a = 0, _b = list.declarations; _a < _b.length; _a++) { - var decl = _b[_a]; - if (!decl.initializer) { - continue; - } - if (!started) { - started = true; - } - else { + write("import "); + if (node.importClause) { + var currentWriterPos = writer.getTextPos(); + if (node.importClause.name && resolver.isDeclarationVisible(node.importClause)) { + writeTextOfNode(currentText, node.importClause.name); + } + if (node.importClause.namedBindings && isVisibleNamedBinding(node.importClause.namedBindings)) { + if (currentWriterPos !== writer.getTextPos()) { + // If the default binding was emitted, write the separated write(", "); } - emit(decl); + if (node.importClause.namedBindings.kind === 237 /* NamespaceImport */) { + write("* as "); + writeTextOfNode(currentText, node.importClause.namedBindings.name); + } + else { + write("{ "); + emitCommaList(node.importClause.namedBindings.elements, emitImportOrExportSpecifier, resolver.isDeclarationVisible); + write(" }"); + } } - return started; + write(" from "); } - function shouldConvertLoopBody(node) { - return languageVersion < 2 /* ES6 */ && - (resolver.getNodeCheckFlags(node) & 65536 /* LoopWithCapturedBlockScopedBinding */) !== 0; + emitExternalModuleSpecifier(node); + write(";"); + writer.writeLine(); + } + function emitExternalModuleSpecifier(parent) { + // emitExternalModuleSpecifier is usually called when we emit something in the.d.ts file that will make it an external module (i.e. import/export declarations). + // the only case when it is not true is when we call it to emit correct name for module augmentation - d.ts files with just module augmentations are not considered + // external modules since they are indistinguishable from script files with ambient modules. To fix this in such d.ts files we'll emit top level 'export {}' + // so compiler will treat them as external modules. + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 230 /* ModuleDeclaration */; + var moduleSpecifier; + if (parent.kind === 234 /* ImportEqualsDeclaration */) { + var node = parent; + moduleSpecifier = ts.getExternalModuleImportEqualsDeclarationExpression(node); } - function emitLoop(node, loopEmitter) { - var shouldConvert = shouldConvertLoopBody(node); - if (!shouldConvert) { - loopEmitter(node, /* convertedLoop*/ undefined); + else if (parent.kind === 230 /* ModuleDeclaration */) { + moduleSpecifier = parent.name; + } + else { + var node = parent; + moduleSpecifier = node.moduleSpecifier; + } + if (moduleSpecifier.kind === 9 /* StringLiteral */ && isBundledEmit && (compilerOptions.out || compilerOptions.outFile)) { + var moduleName = ts.getExternalModuleNameFromDeclaration(host, resolver, parent); + if (moduleName) { + write('"'); + write(moduleName); + write('"'); + return; + } + } + writeTextOfNode(currentText, moduleSpecifier); + } + function emitImportOrExportSpecifier(node) { + if (node.propertyName) { + writeTextOfNode(currentText, node.propertyName); + write(" as "); + } + writeTextOfNode(currentText, node.name); + } + function emitExportSpecifier(node) { + emitImportOrExportSpecifier(node); + // Make all the declarations visible for the export name + var nodes = resolver.collectLinkedAliases(node.propertyName || node.name); + // write each of these declarations asynchronously + writeAsynchronousModuleElements(nodes); + } + function emitExportDeclaration(node) { + emitJsDocComments(node); + write("export "); + if (node.exportClause) { + write("{ "); + emitCommaList(node.exportClause.elements, emitExportSpecifier); + write(" }"); + } + else { + write("*"); + } + if (node.moduleSpecifier) { + write(" from "); + emitExternalModuleSpecifier(node); + } + write(";"); + writer.writeLine(); + } + function writeModuleDeclaration(node) { + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + if (ts.isGlobalScopeAugmentation(node)) { + write("global "); + } + else { + if (node.flags & 16 /* Namespace */) { + write("namespace "); } else { - var loop = convertLoopBody(node); - if (node.parent.kind === 214 /* LabeledStatement */) { - // if parent of the loop was labeled statement - attach the label to loop skipping converted loop body - emitLabelAndColon(node.parent); - } - loopEmitter(node, loop); + write("module "); + } + if (ts.isExternalModuleAugmentation(node)) { + emitExternalModuleSpecifier(node); + } + else { + writeTextOfNode(currentText, node.name); } } - function convertLoopBody(node) { - var functionName = makeUniqueName("_loop"); - var loopInitializer; - switch (node.kind) { - case 206 /* ForStatement */: - case 207 /* ForInStatement */: - case 208 /* ForOfStatement */: - var initializer = node.initializer; - if (initializer && initializer.kind === 219 /* VariableDeclarationList */) { - loopInitializer = node.initializer; - } - break; - } - var loopParameters; - var loopOutParameters; - if (loopInitializer && (ts.getCombinedNodeFlags(loopInitializer) & 3072 /* BlockScoped */)) { - // if loop initializer contains block scoped variables - they should be passed to converted loop body as parameters - loopParameters = []; - for (var _a = 0, _b = loopInitializer.declarations; _a < _b.length; _a++) { - var varDeclaration = _b[_a]; - processVariableDeclaration(varDeclaration.name); - } - } - var bodyIsBlock = node.statement.kind === 199 /* Block */; - var paramList = loopParameters ? loopParameters.join(", ") : ""; - writeLine(); - write("var " + functionName + " = function(" + paramList + ")"); - var convertedOuterLoopState = convertedLoopState; - convertedLoopState = { loopOutParameters: loopOutParameters }; - if (convertedOuterLoopState) { - // convertedOuterLoopState !== undefined means that this converted loop is nested in another converted loop. - // if outer converted loop has already accumulated some state - pass it through - if (convertedOuterLoopState.argumentsName) { - // outer loop has already used 'arguments' so we've already have some name to alias it - // use the same name in all nested loops - convertedLoopState.argumentsName = convertedOuterLoopState.argumentsName; - } - if (convertedOuterLoopState.thisName) { - // outer loop has already used 'this' so we've already have some name to alias it - // use the same name in all nested loops - convertedLoopState.thisName = convertedOuterLoopState.thisName; - } - if (convertedOuterLoopState.hoistedLocalVariables) { - // we've already collected some non-block scoped variable declarations in enclosing loop - // use the same storage in nested loop - convertedLoopState.hoistedLocalVariables = convertedOuterLoopState.hoistedLocalVariables; - } - } + while (node.body && node.body.kind !== 231 /* ModuleBlock */) { + node = node.body; + write("."); + writeTextOfNode(currentText, node.name); + } + var prevEnclosingDeclaration = enclosingDeclaration; + if (node.body) { + enclosingDeclaration = node; write(" {"); writeLine(); increaseIndent(); - if (bodyIsBlock) { - emitLines(node.statement.statements); - } - else { - emit(node.statement); - } - writeLine(); - // end of loop body -> copy out parameter - copyLoopOutParameters(convertedLoopState, 1 /* ToOutParameter */, /*emitAsStatements*/ true); - decreaseIndent(); - writeLine(); - write("};"); - writeLine(); - if (loopOutParameters) { - // declare variables to hold out params for loop body - write("var "); - for (var i = 0; i < loopOutParameters.length; i++) { - if (i !== 0) { - write(", "); - } - write(loopOutParameters[i].outParamName); - } - write(";"); - writeLine(); - } - if (convertedLoopState.argumentsName) { - // if alias for arguments is set - if (convertedOuterLoopState) { - // pass it to outer converted loop - convertedOuterLoopState.argumentsName = convertedLoopState.argumentsName; - } - else { - // this is top level converted loop and we need to create an alias for 'arguments' object - write("var " + convertedLoopState.argumentsName + " = arguments;"); - writeLine(); - } - } - if (convertedLoopState.thisName) { - // if alias for this is set - if (convertedOuterLoopState) { - // pass it to outer converted loop - convertedOuterLoopState.thisName = convertedLoopState.thisName; - } - else { - // this is top level converted loop so we need to create an alias for 'this' here - // NOTE: - // if converted loops were all nested in arrow function then we'll always emit '_this' so convertedLoopState.thisName will not be set. - // If it is set this means that all nested loops are not nested in arrow function and it is safe to capture 'this'. - write("var " + convertedLoopState.thisName + " = this;"); - writeLine(); - } - } - if (convertedLoopState.hoistedLocalVariables) { - // if hoistedLocalVariables !== undefined this means that we've possibly collected some variable declarations to be hoisted later - if (convertedOuterLoopState) { - // pass them to outer converted loop - convertedOuterLoopState.hoistedLocalVariables = convertedLoopState.hoistedLocalVariables; - } - else { - // deduplicate and hoist collected variable declarations - write("var "); - var seen = void 0; - for (var _c = 0, _d = convertedLoopState.hoistedLocalVariables; _c < _d.length; _c++) { - var id = _d[_c]; - // Don't initialize seen unless we have at least one element. - // Emit a comma to separate for all but the first element. - if (!seen) { - seen = ts.createMap(); - } - else { - write(", "); - } - if (!(id.text in seen)) { - emit(id); - seen[id.text] = id.text; - } - } - write(";"); - writeLine(); - } - } - var currentLoopState = convertedLoopState; - convertedLoopState = convertedOuterLoopState; - return { functionName: functionName, paramList: paramList, state: currentLoopState }; - function processVariableDeclaration(name) { - if (name.kind === 69 /* Identifier */) { - var nameText = isNameOfNestedBlockScopedRedeclarationOrCapturedBinding(name) - ? getGeneratedNameForNode(name) - : name.text; - loopParameters.push(nameText); - if (resolver.getNodeCheckFlags(name.parent) & 2097152 /* NeedsLoopOutParameter */) { - var reassignedVariable = { originalName: name, outParamName: makeUniqueName("out_" + nameText) }; - (loopOutParameters || (loopOutParameters = [])).push(reassignedVariable); - } - } - else { - for (var _a = 0, _b = name.elements; _a < _b.length; _a++) { - var element = _b[_a]; - processVariableDeclaration(element.name); - } - } - } - } - function emitNormalLoopBody(node, emitAsEmbeddedStatement) { - var saveAllowedNonLabeledJumps; - if (convertedLoopState) { - // we get here if we are trying to emit normal loop loop inside converted loop - // set allowedNonLabeledJumps to Break | Continue to mark that break\continue inside the loop should be emitted as is - saveAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; - convertedLoopState.allowedNonLabeledJumps = 2 /* Break */ | 4 /* Continue */; - } - if (emitAsEmbeddedStatement) { - emitEmbeddedStatement(node.statement); - } - else if (node.statement.kind === 199 /* Block */) { - emitLines(node.statement.statements); - } - else { - writeLine(); - emit(node.statement); - } - if (convertedLoopState) { - convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps; - } - } - function copyLoopOutParameters(state, copyDirection, emitAsStatements) { - if (state.loopOutParameters) { - for (var _a = 0, _b = state.loopOutParameters; _a < _b.length; _a++) { - var outParam = _b[_a]; - if (copyDirection === 0 /* ToOriginal */) { - emitIdentifier(outParam.originalName); - write(" = " + outParam.outParamName); - } - else { - write(outParam.outParamName + " = "); - emitIdentifier(outParam.originalName); - } - if (emitAsStatements) { - write(";"); - writeLine(); - } - else { - write(", "); - } - } - } - } - function emitConvertedLoopCall(loop, emitAsBlock) { - if (emitAsBlock) { - write(" {"); - writeLine(); - increaseIndent(); - } - // loop is considered simple if it does not have any return statements or break\continue that transfer control outside of the loop - // simple loops are emitted as just 'loop()'; - // NOTE: if loop uses only 'continue' it still will be emitted as simple loop - var isSimpleLoop = !(loop.state.nonLocalJumps & ~4 /* Continue */) && - !loop.state.labeledNonLocalBreaks && - !loop.state.labeledNonLocalContinues; - var loopResult = makeUniqueName("state"); - if (!isSimpleLoop) { - write("var " + loopResult + " = "); - } - write(loop.functionName + "(" + loop.paramList + ");"); - writeLine(); - copyLoopOutParameters(loop.state, 0 /* ToOriginal */, /*emitAsStatements*/ true); - if (!isSimpleLoop) { - // for non simple loops we need to store result returned from converted loop function and use it to do dispatching - // converted loop function can return: - // - object - used when body of the converted loop contains return statement. Property "value" of this object stores retuned value - // - string - used to dispatch jumps. "break" and "continue" are used to non-labeled jumps, other values are used to transfer control to - // different labels - writeLine(); - if (loop.state.nonLocalJumps & 8 /* Return */) { - write("if (typeof " + loopResult + " === \"object\") "); - if (convertedLoopState) { - // we are currently nested in another converted loop - return unwrapped result - write("return " + loopResult + ";"); - // propagate 'hasReturn' flag to outer loop - convertedLoopState.nonLocalJumps |= 8 /* Return */; - } - else { - // top level converted loop - return unwrapped value - write("return " + loopResult + ".value;"); - } - writeLine(); - } - if (loop.state.nonLocalJumps & 2 /* Break */) { - write("if (" + loopResult + " === \"break\") break;"); - writeLine(); - } - // in case of labeled breaks emit code that either breaks to some known label inside outer loop or delegates jump decision to outer loop - emitDispatchTableForLabeledJumps(loopResult, loop.state, convertedLoopState); - } - if (emitAsBlock) { - writeLine(); - decreaseIndent(); - write("}"); - } - function emitDispatchTableForLabeledJumps(loopResultVariable, currentLoop, outerLoop) { - if (!currentLoop.labeledNonLocalBreaks && !currentLoop.labeledNonLocalContinues) { - return; - } - write("switch(" + loopResultVariable + ") {"); - increaseIndent(); - emitDispatchEntriesForLabeledJumps(currentLoop.labeledNonLocalBreaks, /*isBreak*/ true, loopResultVariable, outerLoop); - emitDispatchEntriesForLabeledJumps(currentLoop.labeledNonLocalContinues, /*isBreak*/ false, loopResultVariable, outerLoop); - decreaseIndent(); - writeLine(); - write("}"); - } - function emitDispatchEntriesForLabeledJumps(table, isBreak, loopResultVariable, outerLoop) { - if (!table) { - return; - } - for (var labelText in table) { - var labelMarker = table[labelText]; - writeLine(); - write("case \"" + labelMarker + "\": "); - // if there are no outer converted loop or outer label in question is located inside outer converted loop - // then emit labeled break\continue - // otherwise propagate pair 'label -> marker' to outer converted loop and emit 'return labelMarker' so outer loop can later decide what to do - if (!outerLoop || (outerLoop.labels && outerLoop.labels[labelText])) { - if (isBreak) { - write("break "); - } - else { - write("continue "); - } - write(labelText + ";"); - } - else { - setLabeledJump(outerLoop, isBreak, labelText, labelMarker); - write("return " + loopResultVariable + ";"); - } - } - } - } - function emitForStatement(node) { - emitLoop(node, emitForStatementWorker); - } - function emitForStatementWorker(node, loop) { - var endPos = emitToken(86 /* ForKeyword */, node.pos); - write(" "); - endPos = emitToken(17 /* OpenParenToken */, endPos); - if (node.initializer && node.initializer.kind === 219 /* VariableDeclarationList */) { - var variableDeclarationList = node.initializer; - var startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList); - if (startIsEmitted) { - emitCommaList(variableDeclarationList.declarations); - } - else { - emitVariableDeclarationListSkippingUninitializedEntries(variableDeclarationList); - } - } - else if (node.initializer) { - emit(node.initializer); - } - write(";"); - emitOptional(" ", node.condition); - write(";"); - emitOptional(" ", node.incrementor); - write(")"); - if (loop) { - emitConvertedLoopCall(loop, /*emitAsBlock*/ true); - } - else { - emitNormalLoopBody(node, /*emitAsEmbeddedStatement*/ true); - } - } - function emitForInOrForOfStatement(node) { - if (languageVersion < 2 /* ES6 */ && node.kind === 208 /* ForOfStatement */) { - emitLoop(node, emitDownLevelForOfStatementWorker); - } - else { - emitLoop(node, emitForInOrForOfStatementWorker); - } - } - function emitForInOrForOfStatementWorker(node, loop) { - var endPos = emitToken(86 /* ForKeyword */, node.pos); - write(" "); - endPos = emitToken(17 /* OpenParenToken */, endPos); - if (node.initializer.kind === 219 /* VariableDeclarationList */) { - var variableDeclarationList = node.initializer; - if (variableDeclarationList.declarations.length >= 1) { - tryEmitStartOfVariableDeclarationList(variableDeclarationList); - emit(variableDeclarationList.declarations[0]); - } - } - else { - emit(node.initializer); - } - if (node.kind === 207 /* ForInStatement */) { - write(" in "); - } - else { - write(" of "); - } - emit(node.expression); - emitToken(18 /* CloseParenToken */, node.expression.end); - if (loop) { - emitConvertedLoopCall(loop, /*emitAsBlock*/ true); - } - else { - emitNormalLoopBody(node, /*emitAsEmbeddedStatement*/ true); - } - } - function emitDownLevelForOfStatementWorker(node, loop) { - // The following ES6 code: - // - // for (let v of expr) { } - // - // should be emitted as - // - // for (let _i = 0, _a = expr; _i < _a.length; _i++) { - // let 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 endPos = emitToken(86 /* ForKeyword */, node.pos); - write(" "); - endPos = emitToken(17 /* OpenParenToken */, endPos); - // Do not emit the LHS let declaration yet, because it might contain destructuring. - // Do not call recordTempDeclaration because we are declaring the temps - // right here. Recording means they will be declared later. - // In the case where the user wrote an identifier as the RHS, like this: - // - // for (let v of arr) { } - // - // we can't reuse 'arr' because it might be modified within the body of the loop. - var counter = createTempVariable(268435456 /* _i */); - var rhsReference = ts.createSynthesizedNode(69 /* Identifier */); - rhsReference.text = node.expression.kind === 69 /* Identifier */ ? - makeUniqueName(node.expression.text) : - makeTempVariableName(0 /* Auto */); - // This is the let keyword for the counter and rhsReference. The let keyword for - // the LHS will be emitted inside the body. - emitStart(node.expression); - write("var "); - // _i = 0 - emitNodeWithoutSourceMap(counter); - write(" = 0"); - emitEnd(node.expression); - // , _a = expr - write(", "); - emitStart(node.expression); - emitNodeWithoutSourceMap(rhsReference); - write(" = "); - emitNodeWithoutSourceMap(node.expression); - emitEnd(node.expression); - write("; "); - // _i < _a.length; - emitStart(node.expression); - emitNodeWithoutSourceMap(counter); - write(" < "); - emitNodeWithCommentsAndWithoutSourcemap(rhsReference); - write(".length"); - emitEnd(node.expression); - write("; "); - // _i++) - emitStart(node.expression); - emitNodeWithoutSourceMap(counter); - write("++"); - emitEnd(node.expression); - emitToken(18 /* CloseParenToken */, node.expression.end); - // Body - write(" {"); - writeLine(); - increaseIndent(); - // Initialize LHS - // let v = _a[_i]; - var rhsIterationValue = createElementAccessExpression(rhsReference, counter); - emitStart(node.initializer); - if (node.initializer.kind === 219 /* VariableDeclarationList */) { - write("var "); - var variableDeclarationList = node.initializer; - if (variableDeclarationList.declarations.length > 0) { - var declaration = variableDeclarationList.declarations[0]; - if (ts.isBindingPattern(declaration.name)) { - // This works whether the declaration is a var, let, or const. - // It will use rhsIterationValue _a[_i] as the initializer. - emitDestructuring(declaration, /*isAssignmentExpressionStatement*/ false, rhsIterationValue); - } - else { - // The following call does not include the initializer, so we have - // to emit it separately. - emitNodeWithCommentsAndWithoutSourcemap(declaration); - write(" = "); - emitNodeWithoutSourceMap(rhsIterationValue); - } - } - else { - // It's an empty declaration list. This can only happen in an error case, if the user wrote - // for (let of []) {} - emitNodeWithoutSourceMap(createTempVariable(0 /* Auto */)); - write(" = "); - emitNodeWithoutSourceMap(rhsIterationValue); - } - } - else { - // Initializer is an expression. Emit the expression in the body, so that it's - // evaluated on every iteration. - var assignmentExpression = createBinaryExpression(node.initializer, 56 /* EqualsToken */, rhsIterationValue, /*startsOnNewLine*/ false); - if (node.initializer.kind === 170 /* ArrayLiteralExpression */ || node.initializer.kind === 171 /* ObjectLiteralExpression */) { - // This is a destructuring pattern, so call emitDestructuring instead of emit. Calling emit will not work, because it will cause - // the BinaryExpression to be passed in instead of the expression statement, which will cause emitDestructuring to crash. - emitDestructuring(assignmentExpression, /*isAssignmentExpressionStatement*/ true, /*value*/ undefined); - } - else { - emitNodeWithCommentsAndWithoutSourcemap(assignmentExpression); - } - } - emitEnd(node.initializer); - write(";"); - if (loop) { - writeLine(); - emitConvertedLoopCall(loop, /*emitAsBlock*/ false); - } - else { - emitNormalLoopBody(node, /*emitAsEmbeddedStatement*/ false); - } - writeLine(); + emitLines(node.body.statements); decreaseIndent(); write("}"); + writeLine(); + enclosingDeclaration = prevEnclosingDeclaration; } - function emitBreakOrContinueStatement(node) { - if (convertedLoopState) { - // check if we can emit break\continue as is - // it is possible if either - // - break\continue is statement labeled and label is located inside the converted loop - // - break\continue is non-labeled and located in non-converted loop\switch statement - var jump = node.kind === 210 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */; - var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) || - (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); - if (!canUseBreakOrContinue) { - write("return "); - // explicit exit from loop -> copy out parameters - copyLoopOutParameters(convertedLoopState, 1 /* ToOutParameter */, /*emitAsStatements*/ false); - if (!node.label) { - if (node.kind === 210 /* BreakStatement */) { - convertedLoopState.nonLocalJumps |= 2 /* Break */; - write("\"break\";"); - } - else { - convertedLoopState.nonLocalJumps |= 4 /* Continue */; - // note: return value is emitted only to simplify debugging, call to converted loop body does not do any dispatching on it. - write("\"continue\";"); - } - } - else { - var labelMarker = void 0; - if (node.kind === 210 /* BreakStatement */) { - labelMarker = "break-" + node.label.text; - setLabeledJump(convertedLoopState, /*isBreak*/ true, node.label.text, labelMarker); - } - else { - labelMarker = "continue-" + node.label.text; - setLabeledJump(convertedLoopState, /*isBreak*/ false, node.label.text, labelMarker); - } - write("\"" + labelMarker + "\";"); - } - return; - } - } - emitToken(node.kind === 210 /* BreakStatement */ ? 70 /* BreakKeyword */ : 75 /* ContinueKeyword */, node.pos); - emitOptional(" ", node.label); + else { write(";"); } - function emitReturnStatement(node) { - if (convertedLoopState) { - convertedLoopState.nonLocalJumps |= 8 /* Return */; - write("return { value: "); - if (node.expression) { - emit(node.expression); - } - else { - write("void 0"); - } - write(" };"); - return; - } - emitToken(94 /* ReturnKeyword */, node.pos); - emitOptional(" ", node.expression); - write(";"); + } + function writeTypeAliasDeclaration(node) { + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + write("type "); + writeTextOfNode(currentText, node.name); + emitTypeParameters(node.typeParameters); + write(" = "); + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.type, getTypeAliasDeclarationVisibilityError); + write(";"); + writeLine(); + enclosingDeclaration = prevEnclosingDeclaration; + function getTypeAliasDeclarationVisibilityError() { + return { + diagnosticMessage: ts.Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1, + errorNode: node.type, + typeName: node.name + }; } - function emitWithStatement(node) { - write("with ("); - emit(node.expression); - write(")"); - emitEmbeddedStatement(node.statement); + } + function writeEnumDeclaration(node) { + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + if (ts.isConst(node)) { + write("const "); } - function emitSwitchStatement(node) { - var endPos = emitToken(96 /* SwitchKeyword */, node.pos); - write(" "); - emitToken(17 /* OpenParenToken */, endPos); - emit(node.expression); - endPos = emitToken(18 /* CloseParenToken */, node.expression.end); - write(" "); - var saveAllowedNonLabeledJumps; - if (convertedLoopState) { - saveAllowedNonLabeledJumps = convertedLoopState.allowedNonLabeledJumps; - // for switch statement allow only non-labeled break - convertedLoopState.allowedNonLabeledJumps |= 2 /* Break */; - } - emitCaseBlock(node.caseBlock, endPos); - if (convertedLoopState) { - convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps; - } + write("enum "); + writeTextOfNode(currentText, node.name); + write(" {"); + writeLine(); + increaseIndent(); + emitLines(node.members); + decreaseIndent(); + write("}"); + writeLine(); + } + function emitEnumMemberDeclaration(node) { + emitJsDocComments(node); + writeTextOfNode(currentText, node.name); + var enumMemberValue = resolver.getConstantValue(node); + if (enumMemberValue !== undefined) { + write(" = "); + write(enumMemberValue.toString()); } - function emitCaseBlock(node, startPos) { - emitToken(15 /* OpenBraceToken */, startPos); + write(","); + writeLine(); + } + function isPrivateMethodTypeParameter(node) { + return node.parent.kind === 149 /* MethodDeclaration */ && ts.hasModifier(node.parent, 8 /* Private */); + } + function emitTypeParameters(typeParameters) { + function emitTypeParameter(node) { increaseIndent(); - emitLines(node.clauses); + emitJsDocComments(node); decreaseIndent(); - writeLine(); - emitToken(16 /* CloseBraceToken */, node.clauses.end); - } - function nodeStartPositionsAreOnSameLine(node1, node2) { - return ts.getLineOfLocalPositionFromLineMap(currentLineMap, ts.skipTrivia(currentText, node1.pos)) === - ts.getLineOfLocalPositionFromLineMap(currentLineMap, ts.skipTrivia(currentText, node2.pos)); - } - function nodeEndPositionsAreOnSameLine(node1, node2) { - return ts.getLineOfLocalPositionFromLineMap(currentLineMap, node1.end) === - ts.getLineOfLocalPositionFromLineMap(currentLineMap, node2.end); - } - function nodeEndIsOnSameLineAsNodeStart(node1, node2) { - return ts.getLineOfLocalPositionFromLineMap(currentLineMap, node1.end) === - ts.getLineOfLocalPositionFromLineMap(currentLineMap, ts.skipTrivia(currentText, node2.pos)); - } - function emitCaseOrDefaultClause(node) { - if (node.kind === 249 /* CaseClause */) { - write("case "); - emit(node.expression); - write(":"); - } - else { - write("default:"); - } - if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { - write(" "); - emit(node.statements[0]); - } - else { - increaseIndent(); - emitLines(node.statements); - decreaseIndent(); - } - } - function emitThrowStatement(node) { - write("throw "); - emit(node.expression); - write(";"); - } - function emitTryStatement(node) { - write("try "); - emit(node.tryBlock); - emit(node.catchClause); - if (node.finallyBlock) { - writeLine(); - write("finally "); - emit(node.finallyBlock); - } - } - function emitCatchClause(node) { - writeLine(); - var endPos = emitToken(72 /* CatchKeyword */, node.pos); - write(" "); - emitToken(17 /* OpenParenToken */, endPos); - emit(node.variableDeclaration); - emitToken(18 /* CloseParenToken */, node.variableDeclaration ? node.variableDeclaration.end : endPos); - write(" "); - emitBlock(node.block); - } - function emitDebuggerStatement(node) { - emitToken(76 /* DebuggerKeyword */, node.pos); - write(";"); - } - function emitLabelAndColon(node) { - emit(node.label); - write(": "); - } - function emitLabeledStatement(node) { - if (!ts.isIterationStatement(node.statement, /* lookInLabeledStatements */ false) || !shouldConvertLoopBody(node.statement)) { - emitLabelAndColon(node); - } - if (convertedLoopState) { - if (!convertedLoopState.labels) { - convertedLoopState.labels = ts.createMap(); + writeTextOfNode(currentText, node.name); + // If there is constraint present and this is not a type parameter of the private method emit the constraint + if (node.constraint && !isPrivateMethodTypeParameter(node)) { + write(" extends "); + if (node.parent.kind === 158 /* FunctionType */ || + node.parent.kind === 159 /* ConstructorType */ || + (node.parent.parent && node.parent.parent.kind === 161 /* TypeLiteral */)) { + ts.Debug.assert(node.parent.kind === 149 /* MethodDeclaration */ || + node.parent.kind === 148 /* MethodSignature */ || + node.parent.kind === 158 /* FunctionType */ || + node.parent.kind === 159 /* ConstructorType */ || + node.parent.kind === 153 /* CallSignature */ || + node.parent.kind === 154 /* ConstructSignature */); + emitType(node.constraint); } - convertedLoopState.labels[node.label.text] = node.label.text; - } - emit(node.statement); - if (convertedLoopState) { - convertedLoopState.labels[node.label.text] = undefined; - } - } - function getContainingModule(node) { - do { - node = node.parent; - } while (node && node.kind !== 225 /* ModuleDeclaration */); - return node; - } - function emitContainingModuleName(node) { - var container = getContainingModule(node); - write(container ? getGeneratedNameForNode(container) : "exports"); - } - function emitModuleMemberName(node) { - emitStart(node.name); - if (ts.getCombinedNodeFlags(node) & 1 /* Export */) { - var container = getContainingModule(node); - if (container) { - write(getGeneratedNameForNode(container)); - write("."); - } - else if (modulekind !== ts.ModuleKind.ES6 && modulekind !== ts.ModuleKind.System) { - write("exports."); + else { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.constraint, getTypeParameterConstraintVisibilityError); } } - emitNodeWithCommentsAndWithoutSourcemap(node.name); - emitEnd(node.name); - } - function createVoidZero() { - var zero = ts.createSynthesizedNode(8 /* NumericLiteral */); - zero.text = "0"; - var result = ts.createSynthesizedNode(183 /* VoidExpression */); - result.expression = zero; - return result; - } - function emitEs6ExportDefaultCompat(node) { - if (node.parent.kind === 256 /* SourceFile */) { - ts.Debug.assert(!!(node.flags & 512 /* Default */) || node.kind === 235 /* ExportAssignment */); - // only allow export default at a source file level - if (modulekind === ts.ModuleKind.CommonJS || modulekind === ts.ModuleKind.AMD || modulekind === ts.ModuleKind.UMD) { - if (!isEs6Module) { - if (languageVersion !== 0 /* ES3 */) { - // default value of configurable, enumerable, writable are `false`. - write('Object.defineProperty(exports, "__esModule", { value: true });'); - writeLine(); + function getTypeParameterConstraintVisibilityError() { + // Type parameter constraints are named by user so we should always be able to name it + var diagnosticMessage; + switch (node.parent.kind) { + case 226 /* ClassDeclaration */: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; + break; + case 227 /* InterfaceDeclaration */: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; + break; + case 154 /* ConstructSignature */: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; + break; + case 153 /* CallSignature */: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + break; + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + if (ts.hasModifier(node.parent, 32 /* Static */)) { + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; + } + else if (node.parent.parent.kind === 226 /* ClassDeclaration */) { + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { - write("exports.__esModule = true;"); - writeLine(); + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - } + break; + 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); } + return { + diagnosticMessage: diagnosticMessage, + errorNode: node, + typeName: node.name + }; } } - function emitExportMemberAssignment(node) { - if (node.flags & 1 /* Export */) { - writeLine(); - emitStart(node); - // emit call to exporter only for top level nodes - if (modulekind === ts.ModuleKind.System && node.parent === currentSourceFile) { - // emit export default as - // export("default", ) - write(exportFunctionForFile + "(\""); - if (node.flags & 512 /* Default */) { - write("default"); - } - else { - emitNodeWithCommentsAndWithoutSourcemap(node.name); - } - write("\", "); - emitDeclarationName(node); - write(")"); - } - else { - if (node.flags & 512 /* Default */) { - emitEs6ExportDefaultCompat(node); - if (languageVersion === 0 /* ES3 */) { - write('exports["default"]'); - } - else { - write("exports.default"); - } - } - else { - emitModuleMemberName(node); - } - write(" = "); - emitDeclarationName(node); - } - emitEnd(node); - write(";"); - } + if (typeParameters) { + write("<"); + emitCommaList(typeParameters, emitTypeParameter); + write(">"); } - function emitExportMemberAssignments(name) { - if (modulekind === ts.ModuleKind.System) { - return; - } - if (!exportEquals && exportSpecifiers && name.text in exportSpecifiers) { - for (var _a = 0, _b = exportSpecifiers[name.text]; _a < _b.length; _a++) { - var specifier = _b[_a]; - writeLine(); - emitStart(specifier.name); - emitContainingModuleName(specifier); - write("."); - emitNodeWithCommentsAndWithoutSourcemap(specifier.name); - emitEnd(specifier.name); - write(" = "); - emitExpressionIdentifier(name); - write(";"); - } - } + } + function emitHeritageClause(typeReferences, isImplementsList) { + if (typeReferences) { + write(isImplementsList ? " implements " : " extends "); + emitCommaList(typeReferences, emitTypeOfTypeReference); } - function emitExportSpecifierInSystemModule(specifier) { - ts.Debug.assert(modulekind === ts.ModuleKind.System); - if (!resolver.getReferencedValueDeclaration(specifier.propertyName || specifier.name) && !resolver.isValueAliasDeclaration(specifier)) { - return; + function emitTypeOfTypeReference(node) { + if (ts.isEntityNameExpression(node.expression)) { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); } - writeLine(); - emitStart(specifier.name); - write(exportFunctionForFile + "(\""); - emitNodeWithCommentsAndWithoutSourcemap(specifier.name); - write("\", "); - emitExpressionIdentifier(specifier.propertyName || specifier.name); - write(")"); - emitEnd(specifier.name); - write(";"); - } - /** - * Emit an assignment to a given identifier, 'name', with a given expression, 'value'. - * @param name an identifier as a left-hand-side operand of the assignment - * @param value an expression as a right-hand-side operand of the assignment - * @param shouldEmitCommaBeforeAssignment a boolean indicating whether to prefix an assignment with comma - */ - function emitAssignment(name, value, shouldEmitCommaBeforeAssignment, nodeForSourceMap) { - if (shouldEmitCommaBeforeAssignment) { - write(", "); - } - var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(name); - if (exportChanged) { - write(exportFunctionForFile + "(\""); - emitNodeWithCommentsAndWithoutSourcemap(name); - write("\", "); - } - var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 218 /* VariableDeclaration */ || name.parent.kind === 169 /* BindingElement */); - // If this is first var declaration, we need to start at var/let/const keyword instead - // otherwise use nodeForSourceMap as the start position - emitStart(isFirstVariableDeclaration(nodeForSourceMap) ? nodeForSourceMap.parent : nodeForSourceMap); - withTemporaryNoSourceMap(function () { - if (isVariableDeclarationOrBindingElement) { - emitModuleMemberName(name.parent); - } - else { - emit(name); - } - write(" = "); - emit(value); - }); - emitEnd(nodeForSourceMap, /*stopOverridingSpan*/ true); - if (exportChanged) { - write(")"); - } - } - /** - * Create temporary variable, emit an assignment of the variable the given expression - * @param expression an expression to assign to the newly created temporary variable - * @param canDefineTempVariablesInPlace a boolean indicating whether you can define the temporary variable at an assignment location - * @param shouldEmitCommaBeforeAssignment a boolean indicating whether an assignment should prefix with comma - */ - function emitTempVariableAssignment(expression, canDefineTempVariablesInPlace, shouldEmitCommaBeforeAssignment, sourceMapNode) { - var identifier = createTempVariable(0 /* Auto */); - if (!canDefineTempVariablesInPlace) { - recordTempDeclaration(identifier); - } - emitAssignment(identifier, expression, shouldEmitCommaBeforeAssignment, sourceMapNode || expression.parent); - return identifier; - } - function isFirstVariableDeclaration(root) { - return root.kind === 218 /* VariableDeclaration */ && - root.parent.kind === 219 /* VariableDeclarationList */ && - root.parent.declarations[0] === root; - } - function emitDestructuring(root, isAssignmentExpressionStatement, value) { - var emitCount = 0; - // An exported declaration is actually emitted as an assignment (to a property on the module object), so - // temporary variables in an exported declaration need to have real declarations elsewhere - // Also temporary variables should be explicitly allocated for source level declarations when module target is system - // because actual variable declarations are hoisted - var canDefineTempVariablesInPlace = false; - if (root.kind === 218 /* VariableDeclaration */) { - var isExported = ts.getCombinedNodeFlags(root) & 1 /* Export */; - var isSourceLevelForSystemModuleKind = shouldHoistDeclarationInSystemJsModule(root); - canDefineTempVariablesInPlace = !isExported && !isSourceLevelForSystemModuleKind; - } - else if (root.kind === 142 /* Parameter */) { - canDefineTempVariablesInPlace = true; - } - if (root.kind === 187 /* BinaryExpression */) { - emitAssignmentExpression(root); + else if (!isImplementsList && node.expression.kind === 94 /* NullKeyword */) { + write("null"); } else { - ts.Debug.assert(!isAssignmentExpressionStatement); - // If first variable declaration of variable statement correct the start location - if (isFirstVariableDeclaration(root)) { - // Use emit location of "var " as next emit start entry - sourceMap.changeEmitSourcePos(); - } - emitBindingElement(root, value); + writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError; + resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2 /* UseTypeOfFunction */ | 1024 /* UseTypeAliasValue */, writer); } - /** - * Ensures that there exists a declared identifier whose value holds the given expression. - * This function is useful to ensure that the expression's value can be read from in subsequent expressions. - * Unless 'reuseIdentifierExpressions' is false, 'expr' will be returned if it is just an identifier. - * - * @param expr 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. - */ - function ensureIdentifier(expr, reuseIdentifierExpressions, sourceMapNode) { - if (expr.kind === 69 /* Identifier */ && reuseIdentifierExpressions) { - return expr; - } - var identifier = emitTempVariableAssignment(expr, canDefineTempVariablesInPlace, emitCount > 0, sourceMapNode); - emitCount++; - return identifier; - } - function createDefaultValueCheck(value, defaultValue, sourceMapNode) { - // The value expression will be evaluated twice, so for anything but a simple identifier - // we need to generate a temporary variable - // If the temporary variable needs to be emitted use the source Map node for assignment of that statement - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, sourceMapNode); - // Return the expression 'value === void 0 ? defaultValue : value' - var equals = ts.createSynthesizedNode(187 /* BinaryExpression */); - equals.left = value; - equals.operatorToken = ts.createSynthesizedNode(32 /* EqualsEqualsEqualsToken */); - equals.right = createVoidZero(); - return createConditionalExpression(equals, defaultValue, value); - } - function createConditionalExpression(condition, whenTrue, whenFalse) { - var cond = ts.createSynthesizedNode(188 /* ConditionalExpression */); - cond.condition = condition; - cond.questionToken = ts.createSynthesizedNode(53 /* QuestionToken */); - cond.whenTrue = whenTrue; - cond.colonToken = ts.createSynthesizedNode(54 /* ColonToken */); - cond.whenFalse = whenFalse; - return cond; - } - function createNumericLiteral(value) { - var node = ts.createSynthesizedNode(8 /* NumericLiteral */); - node.text = "" + value; - return node; - } - function createPropertyAccessForDestructuringProperty(object, propName) { - var index; - var nameIsComputed = propName.kind === 140 /* ComputedPropertyName */; - if (nameIsComputed) { - // TODO to handle when we look into sourcemaps for computed properties, for now use propName - index = ensureIdentifier(propName.expression, /*reuseIdentifierExpressions*/ false, propName); + function getHeritageClauseVisibilityError() { + var diagnosticMessage; + // Heritage clause is written by user so it can always be named + if (node.parent.parent.kind === 226 /* ClassDeclaration */) { + // Class or Interface implemented/extended is inaccessible + diagnosticMessage = isImplementsList ? + ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : + ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; } else { - // We create a synthetic copy of the identifier in order to avoid the rewriting that might - // otherwise occur when the identifier is emitted. - index = ts.createSynthesizedNode(propName.kind); - // We need to unescape identifier here because when parsing an identifier prefixing with "__" - // the parser need to append "_" in order to escape colliding with magic identifiers such as "__proto__" - // Therefore, in order to correctly emit identifiers that are written in original TypeScript file, - // we will unescapeIdentifier to remove additional underscore (if no underscore is added, the function will return original input string) - index.text = ts.unescapeIdentifier(propName.text); - } - return !nameIsComputed && index.kind === 69 /* Identifier */ - ? createPropertyAccessExpression(object, index) - : createElementAccessExpression(object, index); - } - function createSliceCall(value, sliceIndex) { - var call = ts.createSynthesizedNode(174 /* CallExpression */); - var sliceIdentifier = ts.createSynthesizedNode(69 /* Identifier */); - sliceIdentifier.text = "slice"; - call.expression = createPropertyAccessExpression(value, sliceIdentifier); - call.arguments = ts.createSynthesizedNodeArray(); - call.arguments[0] = createNumericLiteral(sliceIndex); - return call; - } - function emitObjectLiteralAssignment(target, value, sourceMapNode) { - 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 highlight the passed in source map node since thats the one needing this temp assignment - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, sourceMapNode); - } - for (var _a = 0, properties_5 = properties; _a < properties_5.length; _a++) { - var p = properties_5[_a]; - if (p.kind === 253 /* PropertyAssignment */ || p.kind === 254 /* ShorthandPropertyAssignment */) { - var propName = p.name; - var target_1 = p.kind === 254 /* ShorthandPropertyAssignment */ ? p : p.initializer || propName; - // Assignment for target = value.propName should highlight whole property, hence use p as source map node - emitDestructuringAssignment(target_1, createPropertyAccessForDestructuringProperty(value, propName), p); - } - } - } - function emitArrayLiteralAssignment(target, value, sourceMapNode) { - var elements = target.elements; - if (elements.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 highlight the passed in source map node since thats the one needing this temp assignment - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, sourceMapNode); - } - for (var i = 0; i < elements.length; i++) { - var e = elements[i]; - if (e.kind !== 193 /* OmittedExpression */) { - // Assignment for target = value.propName should highlight whole property, hence use e as source map node - if (e.kind !== 191 /* SpreadElementExpression */) { - emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i)), e); - } - else if (i === elements.length - 1) { - emitDestructuringAssignment(e.expression, createSliceCall(value, i), e); - } - } - } - } - function emitDestructuringAssignment(target, value, sourceMapNode) { - // When emitting target = value use source map node to highlight, including any temporary assignments needed for this - if (target.kind === 254 /* ShorthandPropertyAssignment */) { - if (target.objectAssignmentInitializer) { - value = createDefaultValueCheck(value, target.objectAssignmentInitializer, sourceMapNode); - } - target = target.name; - } - else if (target.kind === 187 /* BinaryExpression */ && target.operatorToken.kind === 56 /* EqualsToken */) { - value = createDefaultValueCheck(value, target.right, sourceMapNode); - target = target.left; - } - if (target.kind === 171 /* ObjectLiteralExpression */) { - emitObjectLiteralAssignment(target, value, sourceMapNode); - } - else if (target.kind === 170 /* ArrayLiteralExpression */) { - emitArrayLiteralAssignment(target, value, sourceMapNode); - } - else { - emitAssignment(target, value, /*shouldEmitCommaBeforeAssignment*/ emitCount > 0, sourceMapNode); - emitCount++; - } - } - function emitAssignmentExpression(root) { - var target = root.left; - var value = root.right; - if (ts.isEmptyObjectLiteralOrArrayLiteral(target)) { - emit(value); - } - else if (isAssignmentExpressionStatement) { - // Source map node for root.left = root.right is root - // but if root is synthetic, which could be in below case, use the target which is { a } - // for ({a} of {a: string}) { - // } - emitDestructuringAssignment(target, value, ts.nodeIsSynthesized(root) ? target : root); - } - else { - if (root.parent.kind !== 178 /* ParenthesizedExpression */) { - write("("); - } - // Temporary assignment needed to emit root should highlight whole binary expression - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, root); - // Source map node for root.left = root.right is root - emitDestructuringAssignment(target, value, root); - write(", "); - emit(value); - if (root.parent.kind !== 178 /* ParenthesizedExpression */) { - write(")"); - } - } - } - function emitBindingElement(target, value) { - // Any temporary assignments needed to emit target = value should point to target - if (target.initializer) { - // Combine value and initializer - value = value ? createDefaultValueCheck(value, target.initializer, target) : target.initializer; - } - else if (!value) { - // Use 'void 0' in absence of value and initializer - value = createVoidZero(); - } - if (ts.isBindingPattern(target.name)) { - var pattern = target.name; - var elements = pattern.elements; - 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. - value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ numElements !== 0, target); - } - for (var i = 0; i < numElements; i++) { - var element = elements[i]; - if (pattern.kind === 167 /* ObjectBindingPattern */) { - // Rewrite element to a declaration with an initializer that fetches property - var propName = element.propertyName || element.name; - emitBindingElement(element, createPropertyAccessForDestructuringProperty(value, propName)); - } - else if (element.kind !== 193 /* OmittedExpression */) { - if (!element.dotDotDotToken) { - // Rewrite element to a declaration that accesses array element at index i - emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); - } - else if (i === numElements - 1) { - emitBindingElement(element, createSliceCall(value, i)); - } - } - } - } - else { - emitAssignment(target.name, value, /*shouldEmitCommaBeforeAssignment*/ emitCount > 0, target); - emitCount++; + // interface is inaccessible + diagnosticMessage = ts.Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1; } + return { + diagnosticMessage: diagnosticMessage, + errorNode: node, + typeName: node.parent.parent.name + }; } } - function emitVariableDeclaration(node) { - if (ts.isBindingPattern(node.name)) { - var isExported = ts.getCombinedNodeFlags(node) & 1 /* Export */; - if (languageVersion >= 2 /* ES6 */ && (!isExported || modulekind === ts.ModuleKind.ES6)) { - // emit ES6 destructuring only if target module is ES6 or variable is not exported - // exported variables in CJS/AMD are prefixed with 'exports.' so result javascript { exports.toString } = 1; is illegal - var isTopLevelDeclarationInSystemModule = modulekind === ts.ModuleKind.System && - shouldHoistVariable(node, /*checkIfSourceFileLevelDecl*/ true); - if (isTopLevelDeclarationInSystemModule) { - // In System modules top level variables are hoisted - // so variable declarations with destructuring are turned into destructuring assignments. - // As a result, they will need parentheses to disambiguate object binding assignments from blocks. - write("("); - } - emit(node.name); - emitOptional(" = ", node.initializer); - if (isTopLevelDeclarationInSystemModule) { - write(")"); - } - } - else { - emitDestructuring(node, /*isAssignmentExpressionStatement*/ false); - } - } - else { - var initializer = node.initializer; - if (!initializer && - languageVersion < 2 /* ES6 */ && - // for names - binding patterns that lack initializer there is no point to emit explicit initializer - // since downlevel codegen for destructuring will fail in the absence of initializer so all binding elements will say uninitialized - node.name.kind === 69 /* Identifier */) { - var container = ts.getEnclosingBlockScopeContainer(node); - var flags = resolver.getNodeCheckFlags(node); - // nested let bindings might need to be initialized explicitly to preserve ES6 semantic - // { let x = 1; } - // { let x; } // x here should be undefined. not 1 - // NOTES: - // Top level bindings never collide with anything and thus don't require explicit initialization. - // As for nested let bindings there are two cases: - // - nested let bindings that were not renamed definitely should be initialized explicitly - // { let x = 1; } - // { let x; if (some-condition) { x = 1}; if (x) { /*1*/ } } - // Without explicit initialization code in /*1*/ can be executed even if some-condition is evaluated to false - // - renaming introduces fresh name that should not collide with any existing names, however renamed bindings sometimes also should be - // explicitly initialized. One particular case: non-captured binding declared inside loop body (but not in loop initializer) - // let x; - // for (;;) { - // let x; - // } - // in downlevel codegen inner 'x' will be renamed so it won't collide with outer 'x' however it will should be reset on every iteration - // as if it was declared anew. - // * Why non-captured binding - because if loop contains block scoped binding captured in some function then loop body will be rewritten - // to have a fresh scope on every iteration so everything will just work. - // * Why loop initializer is excluded - since we've introduced a fresh name it already will be undefined. - var isCapturedInFunction = flags & 131072 /* CapturedBlockScopedBinding */; - var isDeclaredInLoop = flags & 262144 /* BlockScopedBindingInLoop */; - var emittedAsTopLevel = ts.isBlockScopedContainerTopLevel(container) || - (isCapturedInFunction && isDeclaredInLoop && container.kind === 199 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false)); - var emittedAsNestedLetDeclaration = ts.getCombinedNodeFlags(node) & 1024 /* Let */ && - !emittedAsTopLevel; - var emitExplicitInitializer = emittedAsNestedLetDeclaration && - container.kind !== 207 /* ForInStatement */ && - container.kind !== 208 /* ForOfStatement */ && - (!resolver.isDeclarationWithCollidingName(node) || - (isDeclaredInLoop && !isCapturedInFunction && !ts.isIterationStatement(container, /*lookInLabeledStatements*/ false))); - if (emitExplicitInitializer) { - initializer = createVoidZero(); - } - } - var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.name); - if (exportChanged) { - write(exportFunctionForFile + "(\""); - emitNodeWithCommentsAndWithoutSourcemap(node.name); - write("\", "); - } - emitModuleMemberName(node); - emitOptional(" = ", initializer); - if (exportChanged) { - write(")"); - } - } - } - function emitExportVariableAssignments(node) { - if (node.kind === 193 /* OmittedExpression */) { - return; - } - var name = node.name; - if (name.kind === 69 /* Identifier */) { - emitExportMemberAssignments(name); - } - else if (ts.isBindingPattern(name)) { - ts.forEach(name.elements, emitExportVariableAssignments); - } - } - function isES6ExportedDeclaration(node) { - return !!(node.flags & 1 /* Export */) && - modulekind === ts.ModuleKind.ES6 && - node.parent.kind === 256 /* SourceFile */; - } - function emitVariableStatement(node) { - var startIsEmitted = false; - if (node.flags & 1 /* Export */) { - if (isES6ExportedDeclaration(node)) { - // Exported ES6 module member - write("export "); - startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); - } - } - else { - startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); - } - if (startIsEmitted) { - emitCommaList(node.declarationList.declarations); - write(";"); - } - else { - var atLeastOneItem = emitVariableDeclarationListSkippingUninitializedEntries(node.declarationList); - if (atLeastOneItem) { - write(";"); - } - } - if (modulekind !== ts.ModuleKind.ES6 && node.parent === currentSourceFile) { - ts.forEach(node.declarationList.declarations, emitExportVariableAssignments); - } - } - function shouldEmitLeadingAndTrailingCommentsForVariableStatement(node) { - // If we're not exporting the variables, there's nothing special here. - // Always emit comments for these nodes. - if (!(node.flags & 1 /* Export */)) { - return true; - } - // If we are exporting, but it's a top-level ES6 module exports, - // we'll emit the declaration list verbatim, so emit comments too. - if (isES6ExportedDeclaration(node)) { - return true; - } - // Otherwise, only emit if we have at least one initializer present. - for (var _a = 0, _b = node.declarationList.declarations; _a < _b.length; _a++) { - var declaration = _b[_a]; - if (declaration.initializer) { - return true; - } - } - return false; - } - function emitParameter(node) { - if (languageVersion < 2 /* ES6 */) { - if (ts.isBindingPattern(node.name)) { - var name_29 = createTempVariable(0 /* Auto */); - if (!tempParameters) { - tempParameters = []; - } - tempParameters.push(name_29); - emit(name_29); - } - else { - emit(node.name); - } - } - else { - if (node.dotDotDotToken) { - write("..."); - } - emit(node.name); - emitOptional(" = ", node.initializer); - } - } - function emitDefaultValueAssignments(node) { - if (languageVersion < 2 /* ES6 */) { - var tempIndex_1 = 0; - ts.forEach(node.parameters, function (parameter) { - // A rest parameter cannot have a binding pattern or an initializer, - // so let's just ignore it. - if (parameter.dotDotDotToken) { - return; - } - var paramName = parameter.name, initializer = parameter.initializer; - if (ts.isBindingPattern(paramName)) { - // 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. - var hasBindingElements = paramName.elements.length > 0; - if (hasBindingElements || initializer) { - writeLine(); - write("var "); - if (hasBindingElements) { - emitDestructuring(parameter, /*isAssignmentExpressionStatement*/ false, tempParameters[tempIndex_1]); - } - else { - emit(tempParameters[tempIndex_1]); - write(" = "); - emit(initializer); - } - write(";"); - } - // Regardless of whether we will emit a var declaration for the binding pattern, we generate the temporary - // variable for the parameter (see: emitParameter) - tempIndex_1++; - } - else if (initializer) { - writeLine(); - emitStart(parameter); - write("if ("); - emitNodeWithoutSourceMap(paramName); - write(" === void 0)"); - emitEnd(parameter); - write(" { "); - emitStart(parameter); - emitNodeWithCommentsAndWithoutSourcemap(paramName); - write(" = "); - emitNodeWithCommentsAndWithoutSourcemap(initializer); - emitEnd(parameter); - write("; }"); + } + function writeClassDeclaration(node) { + function emitParameterProperties(constructorDeclaration) { + if (constructorDeclaration) { + ts.forEach(constructorDeclaration.parameters, function (param) { + if (ts.hasModifier(param, 92 /* ParameterPropertyModifier */)) { + emitPropertyDeclaration(param); } }); } } - function emitRestParameter(node) { - if (languageVersion < 2 /* ES6 */ && ts.hasDeclaredRestParameter(node)) { - var restParam = node.parameters[node.parameters.length - 1]; - // A rest parameter cannot have a binding pattern, so let's just ignore it if it does. - if (ts.isBindingPattern(restParam.name)) { - return; - } - var skipThisCount = node.parameters.length && node.parameters[0].name.originalKeywordKind === 97 /* ThisKeyword */ ? 1 : 0; - var restIndex = node.parameters.length - 1 - skipThisCount; - var tempName = createTempVariable(268435456 /* _i */).text; - writeLine(); - emitLeadingComments(restParam); - emitStart(restParam); - write("var "); - emitNodeWithCommentsAndWithoutSourcemap(restParam.name); - write(" = [];"); - emitEnd(restParam); - emitTrailingComments(restParam); - writeLine(); - write("for ("); - emitStart(restParam); - write("var " + tempName + " = " + restIndex + ";"); - emitEnd(restParam); - write(" "); - emitStart(restParam); - write(tempName + " < arguments.length;"); - emitEnd(restParam); - write(" "); - emitStart(restParam); - write(tempName + "++"); - emitEnd(restParam); - write(") {"); - increaseIndent(); - writeLine(); - emitStart(restParam); - emitNodeWithCommentsAndWithoutSourcemap(restParam.name); - write("[" + tempName + " - " + restIndex + "] = arguments[" + tempName + "];"); - emitEnd(restParam); - decreaseIndent(); - writeLine(); - write("}"); - } + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + if (ts.hasModifier(node, 128 /* Abstract */)) { + write("abstract "); } - function emitAccessor(node) { - write(node.kind === 149 /* GetAccessor */ ? "get " : "set "); - emit(node.name); - emitSignatureAndBody(node); + write("class "); + writeTextOfNode(currentText, node.name); + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; + emitTypeParameters(node.typeParameters); + var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); + if (baseTypeNode) { + emitHeritageClause([baseTypeNode], /*isImplementsList*/ false); } - function shouldEmitAsArrowFunction(node) { - return node.kind === 180 /* ArrowFunction */ && languageVersion >= 2 /* ES6 */; + emitHeritageClause(ts.getClassImplementsHeritageClauseElements(node), /*isImplementsList*/ true); + write(" {"); + writeLine(); + increaseIndent(); + emitParameterProperties(ts.getFirstConstructorWithBody(node)); + emitLines(node.members); + decreaseIndent(); + write("}"); + writeLine(); + enclosingDeclaration = prevEnclosingDeclaration; + } + function writeInterfaceDeclaration(node) { + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + write("interface "); + writeTextOfNode(currentText, node.name); + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; + emitTypeParameters(node.typeParameters); + var interfaceExtendsTypes = ts.filter(ts.getInterfaceBaseTypeNodes(node), function (base) { return ts.isEntityNameExpression(base.expression); }); + if (interfaceExtendsTypes && interfaceExtendsTypes.length) { + emitHeritageClause(interfaceExtendsTypes, /*isImplementsList*/ false); } - function emitDeclarationName(node) { - if (node.name) { - emitNodeWithCommentsAndWithoutSourcemap(node.name); + write(" {"); + writeLine(); + increaseIndent(); + emitLines(node.members); + decreaseIndent(); + write("}"); + writeLine(); + enclosingDeclaration = prevEnclosingDeclaration; + } + function emitPropertyDeclaration(node) { + if (ts.hasDynamicName(node)) { + return; + } + emitJsDocComments(node); + emitClassMemberDeclarationFlags(ts.getModifierFlags(node)); + emitVariableDeclaration(node); + write(";"); + writeLine(); + } + function emitVariableDeclaration(node) { + // If we are emitting property it isn't moduleElement and hence we already know it needs to be emitted + // so there is no check needed to see if declaration is visible + if (node.kind !== 223 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { + if (ts.isBindingPattern(node.name)) { + emitBindingPattern(node.name); } else { - write(getGeneratedNameForNode(node)); - } - } - function shouldEmitFunctionName(node) { - if (node.kind === 179 /* FunctionExpression */) { - // Emit name if one is present - return !!node.name; - } - if (node.kind === 220 /* FunctionDeclaration */) { - // Emit name if one is present, or emit generated name in down-level case (for export default case) - return !!node.name || modulekind !== ts.ModuleKind.ES6; - } - } - function emitFunctionDeclaration(node) { - if (ts.nodeIsMissing(node.body)) { - return emitCommentsOnNotEmittedNode(node); - } - // TODO (yuisu) : we should not have special cases to condition emitting comments - // but have one place to fix check for these conditions. - var kind = node.kind, parent = node.parent; - if (kind !== 147 /* MethodDeclaration */ && - kind !== 146 /* MethodSignature */ && - parent && - parent.kind !== 253 /* PropertyAssignment */ && - parent.kind !== 174 /* CallExpression */ && - parent.kind !== 170 /* ArrayLiteralExpression */) { - // 1. Methods will emit comments at their assignment declaration sites. - // - // 2. If the function is a property of object literal, emitting leading-comments - // is done by emitNodeWithoutSourceMap which then call this function. - // In particular, we would like to avoid emit comments twice in following case: - // - // var obj = { - // id: - // /*comment*/ () => void - // } - // - // 3. If the function is an argument in call expression, emitting of comments will be - // taken care of in emit list of arguments inside of 'emitCallExpression'. - // - // 4. If the function is in an array literal, 'emitLinePreservingList' will take care - // of leading comments. - emitLeadingComments(node); - } - emitStart(node); - // For targeting below es6, emit functions-like declaration including arrow function using function keyword. - // When targeting ES6, emit arrow function natively in ES6 by omitting function keyword and using fat arrow instead - if (!shouldEmitAsArrowFunction(node)) { - if (isES6ExportedDeclaration(node)) { - write("export "); - if (node.flags & 512 /* Default */) { - write("default "); - } + // If this node is a computed name, it can only be a symbol, because we've already skipped + // it if it's not a well known symbol. In that case, the text of the name will be exactly + // what we want, namely the name expression enclosed in brackets. + writeTextOfNode(currentText, node.name); + // If optional property emit ? but in the case of parameterProperty declaration with "?" indicating optional parameter for the constructor + // we don't want to emit property declaration with "?" + if ((node.kind === 147 /* PropertyDeclaration */ || node.kind === 146 /* PropertySignature */ || + (node.kind === 144 /* Parameter */ && !ts.isParameterPropertyDeclaration(node))) && ts.hasQuestionToken(node)) { + write("?"); } - write("function"); - if (languageVersion >= 2 /* ES6 */ && node.asteriskToken) { - write("*"); + if ((node.kind === 147 /* PropertyDeclaration */ || node.kind === 146 /* PropertySignature */) && node.parent.kind === 161 /* TypeLiteral */) { + emitTypeOfVariableDeclarationFromTypeLiteral(node); } - write(" "); - } - if (shouldEmitFunctionName(node)) { - emitDeclarationName(node); - } - emitSignatureAndBody(node); - if (modulekind !== ts.ModuleKind.ES6 && kind === 220 /* FunctionDeclaration */ && parent === currentSourceFile && node.name) { - emitExportMemberAssignments(node.name); - } - emitEnd(node); - if (kind !== 147 /* MethodDeclaration */ && - kind !== 146 /* MethodSignature */ && - kind !== 180 /* ArrowFunction */) { - emitTrailingComments(node); - } - } - function emitCaptureThisForNodeIfNecessary(node) { - if (resolver.getNodeCheckFlags(node) & 4 /* CaptureThis */) { - writeLine(); - emitStart(node); - write("var _this = this;"); - emitEnd(node); - } - } - function emitSignatureParameters(node) { - increaseIndent(); - write("("); - if (node) { - var parameters = node.parameters; - var skipCount = node.parameters.length && node.parameters[0].name.originalKeywordKind === 97 /* ThisKeyword */ ? 1 : 0; - var omitCount = languageVersion < 2 /* ES6 */ && ts.hasDeclaredRestParameter(node) ? 1 : 0; - emitList(parameters, skipCount, parameters.length - omitCount - skipCount, /*multiLine*/ false, /*trailingComma*/ false); - } - write(")"); - decreaseIndent(); - } - function emitSignatureParametersForArrow(node) { - // Check whether the parameter list needs parentheses and preserve no-parenthesis - if (node.parameters.length === 1 && node.pos === node.parameters[0].pos) { - emit(node.parameters[0]); - return; - } - emitSignatureParameters(node); - } - function emitAsyncFunctionBodyForES6(node) { - var promiseConstructor = ts.getEntityNameFromTypeNode(node.type); - var isArrowFunction = node.kind === 180 /* ArrowFunction */; - var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192 /* CaptureArguments */) !== 0; - // An async function is emit as an outer function that calls an inner - // generator function. To preserve lexical bindings, we pass the current - // `this` and `arguments` objects to `__awaiter`. The generator function - // passed to `__awaiter` is executed inside of the callback to the - // promise constructor. - // - // The emit for an async arrow without a lexical `arguments` binding might be: - // - // // input - // let a = async (b) => { await b; } - // - // // output - // let a = (b) => __awaiter(this, void 0, void 0, function* () { - // yield b; - // }); - // - // The emit for an async arrow with a lexical `arguments` binding might be: - // - // // input - // let a = async (b) => { await arguments[0]; } - // - // // output - // let a = (b) => __awaiter(this, arguments, void 0, function* (arguments) { - // yield arguments[0]; - // }); - // - // The emit for an async function expression without a lexical `arguments` binding - // might be: - // - // // input - // let a = async function (b) { - // await b; - // } - // - // // output - // let a = function (b) { - // return __awaiter(this, void 0, void 0, function* () { - // yield b; - // }); - // } - // - // The emit for an async function expression with a lexical `arguments` binding - // might be: - // - // // input - // let a = async function (b) { - // await arguments[0]; - // } - // - // // output - // let a = function (b) { - // return __awaiter(this, arguments, void 0, function* (_arguments) { - // yield _arguments[0]; - // }); - // } - // - // The emit for an async function expression with a lexical `arguments` binding - // and a return type annotation might be: - // - // // input - // let a = async function (b): MyPromise { - // await arguments[0]; - // } - // - // // output - // let a = function (b) { - // return __awaiter(this, arguments, MyPromise, function* (_arguments) { - // yield _arguments[0]; - // }); - // } - // - // If this is not an async arrow, emit the opening brace of the function body - // and the start of the return statement. - if (!isArrowFunction) { - write(" {"); - increaseIndent(); - writeLine(); - if (resolver.getNodeCheckFlags(node) & 4096 /* AsyncMethodWithSuperBinding */) { - writeLines("\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);"); - writeLine(); + else if (resolver.isLiteralConstDeclaration(node)) { + write(" = "); + resolver.writeLiteralConstValue(node, writer); } - else if (resolver.getNodeCheckFlags(node) & 2048 /* AsyncMethodWithSuper */) { - write("const _super = name => super[name];"); - writeLine(); + else if (!ts.hasModifier(node, 8 /* Private */)) { + writeTypeOfDeclaration(node, node.type, getVariableDeclarationTypeVisibilityError); } - write("return"); - } - write(" __awaiter(this"); - if (hasLexicalArguments) { - write(", arguments, "); - } - else { - write(", void 0, "); - } - if (languageVersion >= 2 /* ES6 */ || !promiseConstructor) { - write("void 0"); - } - else { - emitEntityNameAsExpression(promiseConstructor, /*useFallback*/ false); - } - // Emit the call to __awaiter. - write(", function* ()"); - // Emit the signature and body for the inner generator function. - emitFunctionBody(node); - write(")"); - // If this is not an async arrow, emit the closing brace of the outer function body. - if (!isArrowFunction) { - write(";"); - decreaseIndent(); - writeLine(); - write("}"); } } - function emitFunctionBody(node) { - if (!node.body) { - // There can be no body when there are parse errors. Just emit an empty block - // in that case. - write(" { }"); + function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { + if (node.kind === 223 /* VariableDeclaration */) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? + ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } - else { - if (node.body.kind === 199 /* Block */) { - emitBlockFunctionBody(node, node.body); + else if (node.kind === 147 /* PropertyDeclaration */ || node.kind === 146 /* PropertySignature */) { + // TODO(jfreeman): Deal with computed properties in error reporting. + if (ts.hasModifier(node, 32 /* Static */)) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? + ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; + } + else if (node.parent.kind === 226 /* ClassDeclaration */) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? + ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; } else { - emitExpressionFunctionBody(node, node.body); + // Interfaces cannot have types that cannot be named + return symbolAccessibilityResult.errorModuleName ? + ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; } } } - function emitSignatureAndBody(node) { - var saveConvertedLoopState = convertedLoopState; - var saveTempFlags = tempFlags; - var saveTempVariables = tempVariables; - var saveTempParameters = tempParameters; - convertedLoopState = undefined; - tempFlags = 0; - tempVariables = undefined; - tempParameters = undefined; - // When targeting ES6, emit arrow function natively in ES6 - if (shouldEmitAsArrowFunction(node)) { - emitSignatureParametersForArrow(node); - write(" =>"); - } - else { - emitSignatureParameters(node); - } - var isAsync = ts.isAsyncFunctionLike(node); - if (isAsync) { - emitAsyncFunctionBodyForES6(node); - } - else { - emitFunctionBody(node); - } - if (!isES6ExportedDeclaration(node)) { - emitExportMemberAssignment(node); - } - ts.Debug.assert(convertedLoopState === undefined); - convertedLoopState = saveConvertedLoopState; - tempFlags = saveTempFlags; - tempVariables = saveTempVariables; - tempParameters = saveTempParameters; + function getVariableDeclarationTypeVisibilityError(symbolAccessibilityResult) { + var diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult); + return diagnosticMessage !== undefined ? { + diagnosticMessage: diagnosticMessage, + errorNode: node, + typeName: node.name + } : undefined; } - // Returns true if any preamble code was emitted. - function emitFunctionBodyPreamble(node) { - emitCaptureThisForNodeIfNecessary(node); - emitDefaultValueAssignments(node); - emitRestParameter(node); - } - function emitExpressionFunctionBody(node, body) { - if (languageVersion < 2 /* ES6 */ || node.flags & 256 /* Async */) { - emitDownLevelExpressionFunctionBody(node, body); - return; - } - // For es6 and higher we can emit the expression as is. However, in the case - // where the expression might end up looking like a block when emitted, we'll - // also wrap it in parentheses first. For example if you have: a => {} - // then we need to generate: a => ({}) - write(" "); - // Unwrap all type assertions. - var current = body; - while (current.kind === 177 /* TypeAssertionExpression */) { - current = current.expression; - } - emitParenthesizedIf(body, current.kind === 171 /* ObjectLiteralExpression */); - } - function emitDownLevelExpressionFunctionBody(node, body) { - write(" {"); - increaseIndent(); - var outPos = writer.getTextPos(); - emitDetachedCommentsAndUpdateCommentsInfo(node.body); - emitFunctionBodyPreamble(node); - var preambleEmitted = writer.getTextPos() !== outPos; - decreaseIndent(); - // If we didn't have to emit any preamble code, then attempt to keep the arrow - // function on one line. - if (!preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { - write(" "); - emitStart(body); - write("return "); - emit(body); - emitEnd(body); - write(";"); - emitTempDeclarations(/*newLine*/ false); - write(" "); - } - else { - increaseIndent(); - writeLine(); - emitLeadingComments(node.body); - emitStart(body); - write("return "); - emit(body); - emitEnd(body); - write(";"); - emitTrailingComments(node.body); - emitTempDeclarations(/*newLine*/ true); - decreaseIndent(); - writeLine(); - } - emitStart(node.body); - write("}"); - emitEnd(node.body); - } - function emitBlockFunctionBody(node, body) { - write(" {"); - var initialTextPos = writer.getTextPos(); - increaseIndent(); - emitDetachedCommentsAndUpdateCommentsInfo(body.statements); - // Emit all the directive prologues (like "use strict"). These have to come before - // any other preamble code we write (like parameter initializers). - var startIndex = emitDirectivePrologues(body.statements, /*startWithNewLine*/ true); - emitFunctionBodyPreamble(node); - decreaseIndent(); - var preambleEmitted = writer.getTextPos() !== initialTextPos; - if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { - for (var _a = 0, _b = body.statements; _a < _b.length; _a++) { - var statement = _b[_a]; - write(" "); - emit(statement); - } - emitTempDeclarations(/*newLine*/ false); - write(" "); - emitLeadingCommentsOfPosition(body.statements.end); - } - else { - increaseIndent(); - emitLinesStartingAt(body.statements, startIndex); - emitTempDeclarations(/*newLine*/ true); - writeLine(); - emitLeadingCommentsOfPosition(body.statements.end); - decreaseIndent(); - } - emitToken(16 /* CloseBraceToken */, body.statements.end); - } - /** - * Return the statement at a given index if it is a super-call statement - * @param ctor a constructor declaration - * @param index an index to constructor's body to check - */ - function getSuperCallAtGivenIndex(ctor, index) { - if (!ctor.body) { - return undefined; - } - var statements = ctor.body.statements; - if (!statements || index >= statements.length) { - return undefined; - } - var statement = statements[index]; - if (statement.kind === 202 /* ExpressionStatement */) { - return ts.isSuperCallExpression(statement.expression) ? statement : undefined; - } - } - function emitParameterPropertyAssignments(node) { - ts.forEach(node.parameters, function (param) { - if (param.flags & 92 /* ParameterPropertyModifier */) { - writeLine(); - emitStart(param); - emitStart(param.name); - write("this."); - emitNodeWithoutSourceMap(param.name); - emitEnd(param.name); - write(" = "); - emit(param.name); - write(";"); - emitEnd(param); - } - }); - } - function emitMemberAccessForPropertyName(memberName) { - // This does not emit source map because it is emitted by caller as caller - // is aware how the property name changes to the property access - // eg. public x = 10; becomes this.x and static x = 10 becomes className.x - if (memberName.kind === 9 /* StringLiteral */ || memberName.kind === 8 /* NumericLiteral */) { - write("["); - emitNodeWithCommentsAndWithoutSourcemap(memberName); - write("]"); - } - else if (memberName.kind === 140 /* ComputedPropertyName */) { - emitComputedPropertyName(memberName); - } - else { - write("."); - emitNodeWithCommentsAndWithoutSourcemap(memberName); - } - } - function getInitializedProperties(node, isStatic) { - var properties = []; - for (var _a = 0, _b = node.members; _a < _b.length; _a++) { - var member = _b[_a]; - if (member.kind === 145 /* PropertyDeclaration */ && isStatic === ((member.flags & 32 /* Static */) !== 0) && member.initializer) { - properties.push(member); + function emitBindingPattern(bindingPattern) { + // Only select non-omitted expression from the bindingPattern's elements. + // We have to do this to avoid emitting trailing commas. + // For example: + // original: var [, c,,] = [ 2,3,4] + // emitted: declare var c: number; // instead of declare var c:number, ; + var elements = []; + for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (element.kind !== 198 /* OmittedExpression */) { + elements.push(element); } } - return properties; + emitCommaList(elements, emitBindingElement); } - function emitPropertyDeclarations(node, properties) { - for (var _a = 0, properties_6 = properties; _a < properties_6.length; _a++) { - var property = properties_6[_a]; - emitPropertyDeclaration(node, property); + function emitBindingElement(bindingElement) { + function getBindingElementTypeVisibilityError(symbolAccessibilityResult) { + var diagnosticMessage = getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult); + return diagnosticMessage !== undefined ? { + diagnosticMessage: diagnosticMessage, + errorNode: bindingElement, + typeName: bindingElement.name + } : undefined; + } + if (bindingElement.name) { + if (ts.isBindingPattern(bindingElement.name)) { + emitBindingPattern(bindingElement.name); + } + else { + writeTextOfNode(currentText, bindingElement.name); + writeTypeOfDeclaration(bindingElement, /*type*/ undefined, getBindingElementTypeVisibilityError); + } } } - function emitPropertyDeclaration(node, property, receiver, isExpression) { + } + function emitTypeOfVariableDeclarationFromTypeLiteral(node) { + // if this is property of type literal, + // or is parameter of method/call/construct/index signature of type literal + // emit only if type is specified + if (node.type) { + write(": "); + emitType(node.type); + } + } + function isVariableStatementVisible(node) { + return ts.forEach(node.declarationList.declarations, function (varDeclaration) { return resolver.isDeclarationVisible(varDeclaration); }); + } + function writeVariableStatement(node) { + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + if (ts.isLet(node.declarationList)) { + write("let "); + } + else if (ts.isConst(node.declarationList)) { + write("const "); + } + else { + write("var "); + } + emitCommaList(node.declarationList.declarations, emitVariableDeclaration, resolver.isDeclarationVisible); + write(";"); + writeLine(); + } + function emitAccessorDeclaration(node) { + if (ts.hasDynamicName(node)) { + return; + } + var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); + var accessorWithTypeAnnotation; + if (node === accessors.firstAccessor) { + emitJsDocComments(accessors.getAccessor); + emitJsDocComments(accessors.setAccessor); + emitClassMemberDeclarationFlags(ts.getModifierFlags(node) | (accessors.setAccessor ? 0 : 64 /* Readonly */)); + writeTextOfNode(currentText, node.name); + if (!ts.hasModifier(node, 8 /* Private */)) { + accessorWithTypeAnnotation = node; + var type = getTypeAnnotationFromAccessor(node); + if (!type) { + // couldn't get type for the first accessor, try the another one + var anotherAccessor = node.kind === 151 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; + type = getTypeAnnotationFromAccessor(anotherAccessor); + if (type) { + accessorWithTypeAnnotation = anotherAccessor; + } + } + writeTypeOfDeclaration(node, type, getAccessorDeclarationTypeVisibilityError); + } + write(";"); writeLine(); - emitLeadingComments(property); - emitStart(property); - emitStart(property.name); - if (receiver) { - write(receiver); + } + function getTypeAnnotationFromAccessor(accessor) { + if (accessor) { + return accessor.kind === 151 /* GetAccessor */ + ? accessor.type // Getter - return type + : accessor.parameters.length > 0 + ? accessor.parameters[0].type // Setter parameter type + : undefined; } - else { - if (property.flags & 32 /* Static */) { - emitDeclarationName(node); + } + function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { + var diagnosticMessage; + if (accessorWithTypeAnnotation.kind === 152 /* SetAccessor */) { + // Setters have to have type named and cannot infer it so, the type should always be named + if (ts.hasModifier(accessorWithTypeAnnotation.parent, 32 /* Static */)) { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; } else { - write("this"); + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; } + return { + diagnosticMessage: diagnosticMessage, + errorNode: accessorWithTypeAnnotation.parameters[0], + // TODO(jfreeman): Investigate why we are passing node.name instead of node.parameters[0].name + typeName: accessorWithTypeAnnotation.name + }; } - emitMemberAccessForPropertyName(property.name); - emitEnd(property.name); - write(" = "); - emit(property.initializer); - if (!isExpression) { - write(";"); - } - emitEnd(property); - emitTrailingComments(property); - } - function emitMemberFunctionsForES5AndLower(node) { - ts.forEach(node.members, function (member) { - if (member.kind === 198 /* SemicolonClassElement */) { - writeLine(); - write(";"); + else { + if (ts.hasModifier(accessorWithTypeAnnotation, 32 /* Static */)) { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? + ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : + ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; } - else if (member.kind === 147 /* MethodDeclaration */ || node.kind === 146 /* MethodSignature */) { - if (!member.body) { - return emitCommentsOnNotEmittedNode(member); - } - writeLine(); - emitLeadingComments(member); - emitStart(member); - emitStart(member.name); - emitClassMemberPrefix(node, member); - emitMemberAccessForPropertyName(member.name); - emitEnd(member.name); - write(" = "); - emitFunctionDeclaration(member); - emitEnd(member); - write(";"); - emitTrailingComments(member); - } - else if (member.kind === 149 /* GetAccessor */ || member.kind === 150 /* SetAccessor */) { - var accessors = ts.getAllAccessorDeclarations(node.members, member); - if (member === accessors.firstAccessor) { - writeLine(); - emitStart(member); - write("Object.defineProperty("); - emitStart(member.name); - emitClassMemberPrefix(node, member); - write(", "); - emitExpressionForPropertyName(member.name); - emitEnd(member.name); - write(", {"); - increaseIndent(); - if (accessors.getAccessor) { - writeLine(); - emitLeadingComments(accessors.getAccessor); - write("get: "); - emitStart(accessors.getAccessor); - write("function "); - emitSignatureAndBody(accessors.getAccessor); - emitEnd(accessors.getAccessor); - emitTrailingComments(accessors.getAccessor); - write(","); - } - if (accessors.setAccessor) { - writeLine(); - emitLeadingComments(accessors.setAccessor); - write("set: "); - emitStart(accessors.setAccessor); - write("function "); - emitSignatureAndBody(accessors.setAccessor); - emitEnd(accessors.setAccessor); - emitTrailingComments(accessors.setAccessor); - write(","); - } - writeLine(); - write("enumerable: true,"); - writeLine(); - write("configurable: true"); - decreaseIndent(); - writeLine(); - write("});"); - emitEnd(member); - } - } - }); - } - function emitMemberFunctionsForES6AndHigher(node) { - for (var _a = 0, _b = node.members; _a < _b.length; _a++) { - var member = _b[_a]; - if ((member.kind === 147 /* MethodDeclaration */ || node.kind === 146 /* MethodSignature */) && !member.body) { - emitCommentsOnNotEmittedNode(member); - } - else if (member.kind === 147 /* MethodDeclaration */ || - member.kind === 149 /* GetAccessor */ || - member.kind === 150 /* SetAccessor */) { - writeLine(); - emitLeadingComments(member); - emitStart(member); - if (member.flags & 32 /* Static */) { - write("static "); - } - if (member.kind === 149 /* GetAccessor */) { - write("get "); - } - else if (member.kind === 150 /* SetAccessor */) { - write("set "); - } - if (member.asteriskToken) { - write("*"); - } - emit(member.name); - emitSignatureAndBody(member); - emitEnd(member); - emitTrailingComments(member); - } - else if (member.kind === 198 /* SemicolonClassElement */) { - writeLine(); - write(";"); + else { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? + ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : + ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; } + return { + diagnosticMessage: diagnosticMessage, + errorNode: accessorWithTypeAnnotation.name, + typeName: undefined + }; } } - function emitConstructor(node, baseTypeElement) { - var saveConvertedLoopState = convertedLoopState; - var saveTempFlags = tempFlags; - var saveTempVariables = tempVariables; - var saveTempParameters = tempParameters; - convertedLoopState = undefined; - tempFlags = 0; - tempVariables = undefined; - tempParameters = undefined; - emitConstructorWorker(node, baseTypeElement); - ts.Debug.assert(convertedLoopState === undefined); - convertedLoopState = saveConvertedLoopState; - tempFlags = saveTempFlags; - tempVariables = saveTempVariables; - tempParameters = saveTempParameters; + } + function writeFunctionDeclaration(node) { + if (ts.hasDynamicName(node)) { + return; } - function emitConstructorWorker(node, baseTypeElement) { - // Check if we have property assignment inside class declaration. - // If there is 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 = false; - // Emit the constructor overload pinned comments - ts.forEach(node.members, function (member) { - if (member.kind === 148 /* Constructor */ && !member.body) { - emitCommentsOnNotEmittedNode(member); - } - // Check if there is any non-static property assignment - if (member.kind === 145 /* PropertyDeclaration */ && member.initializer && (member.flags & 32 /* Static */) === 0) { - hasInstancePropertyWithInitializer = true; - } - }); - var ctor = ts.getFirstConstructorWithBody(node); - // For target ES6 and above, if there is no user-defined constructor and there is no property assignment - // do not emit constructor in class declaration. - if (languageVersion >= 2 /* ES6 */ && !ctor && !hasInstancePropertyWithInitializer) { - return; + // If we are emitting Method/Constructor it isn't moduleElement and hence already determined to be emitting + // so no need to verify if the declaration is visible + if (!resolver.isImplementationOfOverload(node)) { + emitJsDocComments(node); + if (node.kind === 225 /* FunctionDeclaration */) { + emitModuleElementDeclarationFlags(node); } - if (ctor) { - emitLeadingComments(ctor); + else if (node.kind === 149 /* MethodDeclaration */ || node.kind === 150 /* Constructor */) { + emitClassMemberDeclarationFlags(ts.getModifierFlags(node)); } - emitStart(ctor || node); - if (languageVersion < 2 /* ES6 */) { + if (node.kind === 225 /* FunctionDeclaration */) { write("function "); - emitDeclarationName(node); - emitSignatureParameters(ctor); + writeTextOfNode(currentText, node.name); } - else { + else if (node.kind === 150 /* Constructor */) { write("constructor"); - if (ctor) { - emitSignatureParameters(ctor); - } - else { - // The ES2015 spec specifies in 14.5.14. Runtime Semantics: ClassDefinitionEvaluation: - // If constructor is empty, then - // If ClassHeritag_eopt is present and protoParent is not null, then - // Let constructor be the result of parsing the source text - // constructor(...args) { super (...args);} - // using the syntactic grammar with the goal symbol MethodDefinition[~Yield]. - // Else, - // Let constructor be the result of parsing the source text - // constructor( ){ } - // using the syntactic grammar with the goal symbol MethodDefinition[~Yield]. - // - // While we could emit the '...args' rest parameter, certain later tools in the pipeline might - // 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 below. - write("()"); - } - } - var startIndex = 0; - write(" {"); - increaseIndent(); - if (ctor) { - // Emit all the directive prologues (like "use strict"). These have to come before - // any other preamble code we write (like parameter initializers). - startIndex = emitDirectivePrologues(ctor.body.statements, /*startWithNewLine*/ true); - emitDetachedCommentsAndUpdateCommentsInfo(ctor.body.statements); - } - emitCaptureThisForNodeIfNecessary(node); - var superCall; - if (ctor) { - emitDefaultValueAssignments(ctor); - emitRestParameter(ctor); - if (baseTypeElement) { - superCall = getSuperCallAtGivenIndex(ctor, startIndex); - if (superCall) { - writeLine(); - emit(superCall); - } - } - emitParameterPropertyAssignments(ctor); } else { - if (baseTypeElement) { - writeLine(); - emitStart(baseTypeElement); - if (languageVersion < 2 /* ES6 */) { - write("_super.apply(this, arguments);"); - } - else { - // See comment above on using '...arguments' instead of '...args'. - write("super(...arguments);"); - } - emitEnd(baseTypeElement); + writeTextOfNode(currentText, node.name); + if (ts.hasQuestionToken(node)) { + write("?"); } } - emitPropertyDeclarations(node, getInitializedProperties(node, /*isStatic*/ false)); - if (ctor) { - var statements = ctor.body.statements; - if (superCall) { - statements = statements.slice(1); - } - emitLinesStartingAt(statements, startIndex); - } - emitTempDeclarations(/*newLine*/ true); - writeLine(); - if (ctor) { - emitLeadingCommentsOfPosition(ctor.body.statements.end); - } - decreaseIndent(); - emitToken(16 /* CloseBraceToken */, ctor ? ctor.body.statements.end : node.members.end); - emitEnd(ctor || node); - if (ctor) { - emitTrailingComments(ctor); - } + emitSignatureDeclaration(node); } - function emitClassExpression(node) { - return emitClassLikeDeclaration(node); + } + function emitSignatureDeclarationWithJsDocComments(node) { + emitJsDocComments(node); + emitSignatureDeclaration(node); + } + function emitSignatureDeclaration(node) { + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; + var closeParenthesizedFunctionType = false; + if (node.kind === 155 /* IndexSignature */) { + // Index signature can have readonly modifier + emitClassMemberDeclarationFlags(ts.getModifierFlags(node)); + write("["); } - function emitClassDeclaration(node) { - return emitClassLikeDeclaration(node); - } - function emitClassLikeDeclaration(node) { - if (languageVersion < 2 /* ES6 */) { - emitClassLikeDeclarationBelowES6(node); + else { + // Construct signature or constructor type write new Signature + if (node.kind === 154 /* ConstructSignature */ || node.kind === 159 /* ConstructorType */) { + write("new "); } - else { - emitClassLikeDeclarationForES6AndHigher(node); - } - if (modulekind !== ts.ModuleKind.ES6 && node.parent === currentSourceFile && node.name) { - emitExportMemberAssignments(node.name); - } - } - function emitClassLikeDeclarationForES6AndHigher(node) { - var decoratedClassAlias; - var isHoistedDeclarationInSystemModule = shouldHoistDeclarationInSystemJsModule(node); - var isDecorated = ts.nodeIsDecorated(node); - var rewriteAsClassExpression = isDecorated || isHoistedDeclarationInSystemModule; - if (node.kind === 221 /* ClassDeclaration */) { - if (rewriteAsClassExpression) { - // When we emit an ES6 class that has a class decorator, we must tailor the - // emit to certain specific cases. - // - // In the simplest case, we emit the class declaration as a let declaration, and - // evaluate decorators after the close of the class body: - // - // TypeScript | Javascript - // --------------------------------|------------------------------------ - // @dec | let C = class C { - // class C { | } - // } | C = __decorate([dec], C); - // --------------------------------|------------------------------------ - // @dec | export let C = class C { - // export class C { | } - // } | C = __decorate([dec], C); - // --------------------------------------------------------------------- - // [Example 1] - // - // If a class declaration contains a reference to itself *inside* of the class body, - // this introduces two bindings to the class: One outside of the class body, and one - // inside of the class body. If we apply decorators as in [Example 1] above, there - // is the possibility that the decorator `dec` will return a new value for the - // constructor, which would result in the binding inside of the class no longer - // pointing to the same reference as the binding outside of the class. - // - // As a result, we must instead rewrite all references to the class *inside* of the - // class body to instead point to a local temporary alias for the class: - // - // TypeScript | Javascript - // --------------------------------|------------------------------------ - // @dec | let C_1 = class C { - // class C { | static x() { return C_1.y; } - // static x() { return C.y; } | } - // static y = 1; | let C = C_1; - // } | C.y = 1; - // | C = C_1 = __decorate([dec], C); - // --------------------------------|------------------------------------ - // @dec | let C_1 = class C { - // export class C { | static x() { return C_1.y; } - // static x() { return C.y; } | } - // static y = 1; | export let C = C_1; - // } | C.y = 1; - // | C = C_1 = __decorate([dec], C); - // --------------------------------------------------------------------- - // [Example 2] - // - // If a class declaration is the default export of a module, we instead emit - // the export after the decorated declaration: - // - // TypeScript | Javascript - // --------------------------------|------------------------------------ - // @dec | let default_1 = class { - // export default class { | } - // } | default_1 = __decorate([dec], default_1); - // | export default default_1; - // --------------------------------|------------------------------------ - // @dec | let C = class C { - // export default class { | } - // } | C = __decorate([dec], C); - // | export default C; - // --------------------------------------------------------------------- - // [Example 3] - // - // If the class declaration is the default export and a reference to itself - // inside of the class body, we must emit both an alias for the class *and* - // move the export after the declaration: - // - // TypeScript | Javascript - // --------------------------------|------------------------------------ - // @dec | let C_1 = class C { - // export default class C { | static x() { return C_1.y; } - // static x() { return C.y; } | }; - // static y = 1; | let C = C_1; - // } | C.y = 1; - // | C = C_1 = __decorate([dec], C); - // | export default C; - // --------------------------------------------------------------------- - // [Example 4] - // - // NOTE: we reuse the same rewriting logic for cases when targeting ES6 and module kind is System. - // Because of hoisting top level class declaration need to be emitted as class expressions. - // Double bind case is only required if node is decorated. - if (isDecorated && resolver.getNodeCheckFlags(node) & 524288 /* ClassWithBodyScopedClassBinding */) { - decoratedClassAlias = ts.unescapeIdentifier(makeUniqueName(node.name ? node.name.text : "default")); - decoratedClassAliases[ts.getNodeId(node)] = decoratedClassAlias; - } - if (isES6ExportedDeclaration(node) && !(node.flags & 512 /* Default */) && decoratedClassAlias === undefined) { - write("export "); - } - if (decoratedClassAlias !== undefined) { - write("let " + decoratedClassAlias); - } - else { - if (!isHoistedDeclarationInSystemModule) { - write("let "); - } - emitDeclarationName(node); - } - write(" = "); - } - else if (isES6ExportedDeclaration(node)) { - write("export "); - if (node.flags & 512 /* Default */) { - write("default "); - } + else if (node.kind === 158 /* FunctionType */) { + var currentOutput = writer.getText(); + // Do not generate incorrect type when function type with type parameters is type argument + // This could happen if user used space between two '<' making it error free + // e.g var x: A< (a: Tany)=>Tany>; + if (node.typeParameters && currentOutput.charAt(currentOutput.length - 1) === "<") { + closeParenthesizedFunctionType = true; + write("("); } } - // If the class has static properties, and it's a class expression, then we'll need - // to specialize the emit a bit. for a class expression of the form: - // - // (class C { static a = 1; static b = 2; ... }) - // - // We'll emit: - // - // ((C_1 = class C { - // // Normal class body - // }, - // C_1.a = 1, - // C_1.b = 2, - // C_1)); - // var C_1; - // - // This keeps the expression as an expression, while ensuring that the static parts - // of it have been initialized by the time it is used. - var staticProperties = getInitializedProperties(node, /*isStatic*/ true); - var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 192 /* ClassExpression */; - var generatedName; - if (isClassExpressionWithStaticProperties) { - generatedName = node.name ? getGeneratedNameForNode(node.name) : makeUniqueName("classExpression"); - var synthesizedNode = ts.createSynthesizedNode(69 /* Identifier */); - synthesizedNode.text = generatedName; - recordTempDeclaration(synthesizedNode); - write("("); - increaseIndent(); - emit(synthesizedNode); - write(" = "); - } - write("class"); - // emit name if - // - node has a name - // - this is default export with static initializers - if (node.name || (node.flags & 512 /* Default */ && (staticProperties.length > 0 || modulekind !== ts.ModuleKind.ES6) && !rewriteAsClassExpression)) { - write(" "); - emitDeclarationName(node); - } - var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); - if (baseTypeNode) { - write(" extends "); - emit(baseTypeNode.expression); - } - write(" {"); - increaseIndent(); - writeLine(); - emitConstructor(node, baseTypeNode); - emitMemberFunctionsForES6AndHigher(node); - decreaseIndent(); - writeLine(); - emitToken(16 /* CloseBraceToken */, node.members.end); - if (rewriteAsClassExpression) { - if (decoratedClassAlias !== undefined) { - write(";"); - writeLine(); - if (isES6ExportedDeclaration(node) && !(node.flags & 512 /* Default */)) { - write("export "); - } - write("let "); - emitDeclarationName(node); - write(" = " + decoratedClassAlias); - } - decoratedClassAliases[ts.getNodeId(node)] = undefined; - write(";"); - } - // Emit static property assignment. Because classDeclaration is lexically evaluated, - // it is safe to emit static property assignment after classDeclaration - // From ES6 specification: - // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using - // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. - if (isClassExpressionWithStaticProperties) { - for (var _a = 0, staticProperties_1 = staticProperties; _a < staticProperties_1.length; _a++) { - var property = staticProperties_1[_a]; - write(","); - writeLine(); - emitPropertyDeclaration(node, property, /*receiver*/ generatedName, /*isExpression*/ true); - } - write(","); - writeLine(); - write(generatedName); - decreaseIndent(); - write(")"); - } - else { - writeLine(); - emitPropertyDeclarations(node, staticProperties); - emitDecoratorsOfClass(node, decoratedClassAlias); - } - if (!(node.flags & 1 /* Export */)) { - return; - } - if (modulekind !== ts.ModuleKind.ES6) { - emitExportMemberAssignment(node); - } - else { - // If this is an exported class, but not on the top level (i.e. on an internal - // module), export it - if (node.flags & 512 /* Default */) { - // if this is a top level default export of decorated class, write the export after the declaration. - if (isDecorated) { - writeLine(); - write("export default "); - emitDeclarationName(node); - write(";"); - } - } - else if (node.parent.kind !== 256 /* SourceFile */) { - writeLine(); - emitStart(node); - emitModuleMemberName(node); - write(" = "); - emitDeclarationName(node); - emitEnd(node); - write(";"); - } - } - } - function emitClassLikeDeclarationBelowES6(node) { - var isES6ExportedClass = isES6ExportedDeclaration(node); - if (node.kind === 221 /* ClassDeclaration */) { - if (isES6ExportedClass && !(node.flags & 512 /* Default */)) { - write("export "); - } - // source file level classes in system modules are hoisted so 'var's for them are already defined - if (!shouldHoistDeclarationInSystemJsModule(node)) { - write("var "); - } - emitDeclarationName(node); - write(" = "); - } - write("(function ("); - var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); - if (baseTypeNode) { - write("_super"); - } - write(") {"); - var saveTempFlags = tempFlags; - var saveTempVariables = tempVariables; - var saveTempParameters = tempParameters; - var saveComputedPropertyNamesToGeneratedNames = computedPropertyNamesToGeneratedNames; - var saveConvertedLoopState = convertedLoopState; - convertedLoopState = undefined; - tempFlags = 0; - tempVariables = undefined; - tempParameters = undefined; - computedPropertyNamesToGeneratedNames = undefined; - increaseIndent(); - if (baseTypeNode) { - writeLine(); - emitStart(baseTypeNode); - write("__extends("); - emitDeclarationName(node); - write(", _super);"); - emitEnd(baseTypeNode); - } - writeLine(); - emitConstructor(node, baseTypeNode); - emitMemberFunctionsForES5AndLower(node); - emitPropertyDeclarations(node, getInitializedProperties(node, /*isStatic*/ true)); - writeLine(); - emitDecoratorsOfClass(node, /*decoratedClassAlias*/ undefined); - writeLine(); - emitToken(16 /* CloseBraceToken */, node.members.end, function () { - write("return "); - emitDeclarationName(node); - }); - write(";"); - emitTempDeclarations(/*newLine*/ true); - ts.Debug.assert(convertedLoopState === undefined); - convertedLoopState = saveConvertedLoopState; - tempFlags = saveTempFlags; - tempVariables = saveTempVariables; - tempParameters = saveTempParameters; - computedPropertyNamesToGeneratedNames = saveComputedPropertyNamesToGeneratedNames; - decreaseIndent(); - writeLine(); - emitToken(16 /* CloseBraceToken */, node.members.end); - emitStart(node); + emitTypeParameters(node.typeParameters); write("("); - if (baseTypeNode) { - emit(baseTypeNode.expression); - } - write("))"); - if (node.kind === 221 /* ClassDeclaration */) { - write(";"); - } - emitEnd(node); - if (node.kind === 221 /* ClassDeclaration */ && !isES6ExportedClass) { - emitExportMemberAssignment(node); - } - else if (isES6ExportedClass && (node.flags & 512 /* Default */)) { - writeLine(); - write("export default "); - emitDeclarationName(node); - write(";"); - } } - function emitClassMemberPrefix(node, member) { - emitDeclarationName(node); - if (!(member.flags & 32 /* Static */)) { - write(".prototype"); - } - } - function emitDecoratorsOfClass(node, decoratedClassAlias) { - emitDecoratorsOfMembers(node, /*staticFlag*/ 0); - emitDecoratorsOfMembers(node, 32 /* Static */); - emitDecoratorsOfConstructor(node, decoratedClassAlias); - } - function emitDecoratorsOfConstructor(node, decoratedClassAlias) { - var decorators = node.decorators; - var constructor = ts.getFirstConstructorWithBody(node); - var firstParameterDecorator = constructor && ts.forEach(constructor.parameters, function (parameter) { return parameter.decorators; }); - // skip decoration of the constructor if neither it nor its parameters are decorated - if (!decorators && !firstParameterDecorator) { - return; - } - // Emit the call to __decorate. Given the class: - // - // @dec - // class C { - // } - // - // The emit for the class is: - // - // C = __decorate([dec], C); - // - writeLine(); - emitStart(node.decorators || firstParameterDecorator); - emitDeclarationName(node); - if (decoratedClassAlias !== undefined) { - write(" = " + decoratedClassAlias); - } - write(" = __decorate(["); - increaseIndent(); - writeLine(); - var decoratorCount = decorators ? decorators.length : 0; - var argumentsWritten = emitList(decorators, 0, decoratorCount, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ false, /*noTrailingNewLine*/ true, function (decorator) { return emit(decorator.expression); }); - if (firstParameterDecorator) { - argumentsWritten += emitDecoratorsOfParameters(constructor, /*leadingComma*/ argumentsWritten > 0); - } - emitSerializedTypeMetadata(node, /*leadingComma*/ argumentsWritten >= 0); - decreaseIndent(); - writeLine(); - write("], "); - emitDeclarationName(node); - write(")"); - emitEnd(node.decorators || firstParameterDecorator); - write(";"); - writeLine(); - } - function emitDecoratorsOfMembers(node, staticFlag) { - for (var _a = 0, _b = node.members; _a < _b.length; _a++) { - var member = _b[_a]; - // only emit members in the correct group - if ((member.flags & 32 /* Static */) !== staticFlag) { - continue; - } - // skip members that cannot be decorated (such as the constructor) - if (!ts.nodeCanBeDecorated(member)) { - continue; - } - // skip an accessor declaration if it is not the first accessor - var decorators = void 0; - var functionLikeMember = void 0; - if (ts.isAccessor(member)) { - var accessors = ts.getAllAccessorDeclarations(node.members, member); - if (member !== accessors.firstAccessor) { - continue; - } - // get the decorators from the first accessor with decorators - decorators = accessors.firstAccessor.decorators; - if (!decorators && accessors.secondAccessor) { - decorators = accessors.secondAccessor.decorators; - } - // we only decorate parameters of the set accessor - functionLikeMember = accessors.setAccessor; - } - else { - decorators = member.decorators; - // we only decorate the parameters here if this is a method - if (member.kind === 147 /* MethodDeclaration */) { - functionLikeMember = member; - } - } - var firstParameterDecorator = functionLikeMember && ts.forEach(functionLikeMember.parameters, function (parameter) { return parameter.decorators; }); - // skip a member if it or any of its parameters are not decorated - if (!decorators && !firstParameterDecorator) { - continue; - } - // Emit the call to __decorate. Given the following: - // - // class C { - // @dec method(@dec2 x) {} - // @dec get accessor() {} - // @dec prop; - // } - // - // The emit for a method is: - // - // __decorate([ - // dec, - // __param(0, dec2), - // __metadata("design:type", Function), - // __metadata("design:paramtypes", [Object]), - // __metadata("design:returntype", void 0) - // ], C.prototype, "method", undefined); - // - // The emit for an accessor is: - // - // __decorate([ - // dec - // ], C.prototype, "accessor", undefined); - // - // The emit for a property is: - // - // __decorate([ - // dec - // ], C.prototype, "prop"); - // - writeLine(); - emitStart(decorators || firstParameterDecorator); - write("__decorate(["); - increaseIndent(); - writeLine(); - var decoratorCount = decorators ? decorators.length : 0; - var argumentsWritten = emitList(decorators, 0, decoratorCount, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ false, /*noTrailingNewLine*/ true, function (decorator) { return emit(decorator.expression); }); - if (firstParameterDecorator) { - argumentsWritten += emitDecoratorsOfParameters(functionLikeMember, argumentsWritten > 0); - } - emitSerializedTypeMetadata(member, argumentsWritten > 0); - decreaseIndent(); - writeLine(); - write("], "); - emitClassMemberPrefix(node, member); - write(", "); - emitExpressionForPropertyName(member.name); - if (languageVersion > 0 /* ES3 */) { - if (member.kind !== 145 /* PropertyDeclaration */) { - // We emit `null` here to indicate to `__decorate` that it can invoke `Object.getOwnPropertyDescriptor` directly. - // We have this extra argument here so that we can inject an explicit property descriptor at a later date. - write(", null"); - } - else { - // We emit `void 0` here to indicate to `__decorate` that it can invoke `Object.defineProperty` directly, but that it - // should not invoke `Object.getOwnPropertyDescriptor`. - write(", void 0"); - } - } - write(")"); - emitEnd(decorators || firstParameterDecorator); - write(";"); - writeLine(); - } - } - function emitDecoratorsOfParameters(node, leadingComma) { - var argumentsWritten = 0; - if (node) { - var parameterIndex_1 = 0; - for (var _a = 0, _b = node.parameters; _a < _b.length; _a++) { - var parameter = _b[_a]; - if (ts.nodeIsDecorated(parameter)) { - var decorators = parameter.decorators; - argumentsWritten += emitList(decorators, 0, decorators.length, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ leadingComma, /*noTrailingNewLine*/ true, function (decorator) { - write("__param(" + parameterIndex_1 + ", "); - emit(decorator.expression); - write(")"); - }); - leadingComma = true; - } - parameterIndex_1++; - } - } - return argumentsWritten; - } - function shouldEmitTypeMetadata(node) { - // This method determines whether to emit the "design:type" metadata based on the node's kind. - // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata - // compiler option is set. - switch (node.kind) { - case 147 /* MethodDeclaration */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - case 145 /* PropertyDeclaration */: - return true; - } - return false; - } - function shouldEmitReturnTypeMetadata(node) { - // This method determines whether to emit the "design:returntype" metadata based on the node's kind. - // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata - // compiler option is set. - switch (node.kind) { - case 147 /* MethodDeclaration */: - return true; - } - return false; - } - function shouldEmitParamTypesMetadata(node) { - // This method determines whether to emit the "design:paramtypes" metadata based on the node's kind. - // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata - // compiler option is set. - switch (node.kind) { - case 221 /* ClassDeclaration */: - case 147 /* MethodDeclaration */: - case 150 /* SetAccessor */: - return true; - } - return false; - } - /** Serializes the type of a declaration to an appropriate JS constructor value. Used by the __metadata decorator for a class member. */ - function emitSerializedTypeOfNode(node) { - // serialization of the type of a declaration uses the following rules: - // - // * The serialized type of a ClassDeclaration is "Function" - // * The serialized type of a ParameterDeclaration is the serialized type of its type annotation. - // * The serialized type of a PropertyDeclaration is the serialized type of its type annotation. - // * The serialized type of an AccessorDeclaration is the serialized type of the return type annotation of its getter or parameter type annotation of its setter. - // * The serialized type of any other FunctionLikeDeclaration is "Function". - // * The serialized type of any other node is "void 0". - // - // For rules on serializing type annotations, see `serializeTypeNode`. - switch (node.kind) { - case 221 /* ClassDeclaration */: - write("Function"); - return; - case 145 /* PropertyDeclaration */: - emitSerializedTypeNode(node.type); - return; - case 142 /* Parameter */: - emitSerializedTypeNode(node.type); - return; - case 149 /* GetAccessor */: - emitSerializedTypeNode(node.type); - return; - case 150 /* SetAccessor */: - emitSerializedTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); - return; - } - if (ts.isFunctionLike(node)) { - write("Function"); - return; - } - write("void 0"); - } - function emitSerializedTypeNode(node) { - if (node) { - switch (node.kind) { - case 103 /* VoidKeyword */: - write("void 0"); - return; - case 164 /* ParenthesizedType */: - emitSerializedTypeNode(node.type); - return; - case 156 /* FunctionType */: - case 157 /* ConstructorType */: - write("Function"); - return; - case 160 /* ArrayType */: - case 161 /* TupleType */: - write("Array"); - return; - case 154 /* TypePredicate */: - case 120 /* BooleanKeyword */: - write("Boolean"); - return; - case 132 /* StringKeyword */: - case 166 /* LiteralType */: - write("String"); - return; - case 130 /* NumberKeyword */: - write("Number"); - return; - case 133 /* SymbolKeyword */: - write("Symbol"); - return; - case 155 /* TypeReference */: - emitSerializedTypeReferenceNode(node); - return; - case 158 /* TypeQuery */: - case 159 /* TypeLiteral */: - case 162 /* UnionType */: - case 163 /* IntersectionType */: - case 117 /* AnyKeyword */: - case 165 /* ThisType */: - break; - default: - ts.Debug.fail("Cannot serialize unexpected type node."); - break; - } - } - write("Object"); - } - /** Serializes a TypeReferenceNode to an appropriate JS constructor value. Used by the __metadata decorator. */ - function emitSerializedTypeReferenceNode(node) { - var location = node.parent; - while (ts.isDeclaration(location) || ts.isTypeNode(location)) { - location = location.parent; - } - // Clone the type name and parent it to a location outside of the current declaration. - var typeName = ts.cloneEntityName(node.typeName, location); - var result = resolver.getTypeReferenceSerializationKind(typeName); - switch (result) { - case ts.TypeReferenceSerializationKind.Unknown: - var temp = createAndRecordTempVariable(0 /* Auto */); - write("(typeof ("); - emitNodeWithoutSourceMap(temp); - write(" = "); - emitEntityNameAsExpression(typeName, /*useFallback*/ true); - write(") === 'function' && "); - emitNodeWithoutSourceMap(temp); - write(") || Object"); - break; - case ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue: - emitEntityNameAsExpression(typeName, /*useFallback*/ false); - break; - case ts.TypeReferenceSerializationKind.VoidType: - write("void 0"); - break; - case ts.TypeReferenceSerializationKind.BooleanType: - write("Boolean"); - break; - case ts.TypeReferenceSerializationKind.NumberLikeType: - write("Number"); - break; - case ts.TypeReferenceSerializationKind.StringLikeType: - write("String"); - break; - case ts.TypeReferenceSerializationKind.ArrayLikeType: - write("Array"); - break; - case ts.TypeReferenceSerializationKind.ESSymbolType: - if (languageVersion < 2 /* ES6 */) { - write("typeof Symbol === 'function' ? Symbol : Object"); - } - else { - write("Symbol"); - } - break; - case ts.TypeReferenceSerializationKind.TypeWithCallSignature: - write("Function"); - break; - case ts.TypeReferenceSerializationKind.ObjectType: - write("Object"); - break; - } - } - /** Serializes the parameter types of a function or the constructor of a class. Used by the __metadata decorator for a method or set accessor. */ - function emitSerializedParameterTypesOfNode(node) { - // serialization of parameter types uses the following rules: - // - // * If the declaration is a class, the parameters of the first constructor with a body are used. - // * If the declaration is function-like and has a body, the parameters of the function are used. - // - // For the rules on serializing the type of each parameter declaration, see `serializeTypeOfDeclaration`. - if (node) { - var valueDeclaration = void 0; - if (node.kind === 221 /* ClassDeclaration */) { - valueDeclaration = ts.getFirstConstructorWithBody(node); - } - else if (ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)) { - valueDeclaration = node; - } - if (valueDeclaration) { - var parameters = valueDeclaration.parameters; - var skipThisCount = parameters.length && parameters[0].name.originalKeywordKind === 97 /* ThisKeyword */ ? 1 : 0; - var parameterCount = parameters.length; - if (parameterCount > skipThisCount) { - for (var i = skipThisCount; i < parameterCount; i++) { - if (i > skipThisCount) { - write(", "); - } - if (parameters[i].dotDotDotToken) { - var parameterType = parameters[i].type; - if (parameterType && parameterType.kind === 160 /* ArrayType */) { - parameterType = parameterType.elementType; - } - else if (parameterType && parameterType.kind === 155 /* TypeReference */ && parameterType.typeArguments && parameterType.typeArguments.length === 1) { - parameterType = parameterType.typeArguments[0]; - } - else { - parameterType = undefined; - } - emitSerializedTypeNode(parameterType); - } - else { - emitSerializedTypeOfNode(parameters[i]); - } - } - } - } - } - } - /** Serializes the return type of function. Used by the __metadata decorator for a method. */ - function emitSerializedReturnTypeOfNode(node) { - if (node && ts.isFunctionLike(node)) { - if (node.type) { - emitSerializedTypeNode(node.type); - return; - } - else if (ts.isAsyncFunctionLike(node)) { - write("Promise"); - return; - } - } - write("void 0"); - } - function emitSerializedTypeMetadata(node, writeComma) { - // This method emits the serialized type metadata for a decorator target. - // The caller should have already tested whether the node has decorators. - var argumentsWritten = 0; - if (compilerOptions.emitDecoratorMetadata) { - if (shouldEmitTypeMetadata(node)) { - if (writeComma) { - write(", "); - } - writeLine(); - write("__metadata('design:type', "); - emitSerializedTypeOfNode(node); - write(")"); - argumentsWritten++; - } - if (shouldEmitParamTypesMetadata(node)) { - if (writeComma || argumentsWritten) { - write(", "); - } - writeLine(); - write("__metadata('design:paramtypes', ["); - emitSerializedParameterTypesOfNode(node); - write("])"); - argumentsWritten++; - } - if (shouldEmitReturnTypeMetadata(node)) { - if (writeComma || argumentsWritten) { - write(", "); - } - writeLine(); - write("__metadata('design:returntype', "); - emitSerializedReturnTypeOfNode(node); - write(")"); - argumentsWritten++; - } - } - return argumentsWritten; - } - function emitInterfaceDeclaration(node) { - emitCommentsOnNotEmittedNode(node); - } - function shouldEmitEnumDeclaration(node) { - var isConstEnum = ts.isConst(node); - return !isConstEnum || compilerOptions.preserveConstEnums || compilerOptions.isolatedModules; - } - function emitEnumDeclaration(node) { - // const enums are completely erased during compilation. - if (!shouldEmitEnumDeclaration(node)) { - return; - } - if (!shouldHoistDeclarationInSystemJsModule(node)) { - // do not emit var if variable was already hoisted - var isES6ExportedEnum = isES6ExportedDeclaration(node); - if (!(node.flags & 1 /* Export */) || (isES6ExportedEnum && isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, 224 /* EnumDeclaration */))) { - emitStart(node); - if (isES6ExportedEnum) { - write("export "); - } - write("var "); - emit(node.name); - emitEnd(node); - write(";"); - } - } - writeLine(); - emitStart(node); - write("(function ("); - emitStart(node.name); - write(getGeneratedNameForNode(node)); - emitEnd(node.name); - write(") {"); - increaseIndent(); - emitLines(node.members); - decreaseIndent(); - writeLine(); - emitToken(16 /* CloseBraceToken */, node.members.end); - write(")("); - emitModuleMemberName(node); - write(" || ("); - emitModuleMemberName(node); - write(" = {}));"); - emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.flags & 1 /* Export */ && !shouldHoistDeclarationInSystemJsModule(node)) { - // do not emit var if variable was already hoisted - writeLine(); - emitStart(node); - write("var "); - emit(node.name); - write(" = "); - emitModuleMemberName(node); - emitEnd(node); - write(";"); - } - if (modulekind !== ts.ModuleKind.ES6 && node.parent === currentSourceFile) { - if (modulekind === ts.ModuleKind.System && (node.flags & 1 /* Export */)) { - // write the call to exporter for enum - writeLine(); - write(exportFunctionForFile + "(\""); - emitDeclarationName(node); - write("\", "); - emitDeclarationName(node); - write(");"); - } - emitExportMemberAssignments(node.name); - } - } - function emitEnumMember(node) { - var enumParent = node.parent; - emitStart(node); - write(getGeneratedNameForNode(enumParent)); - write("["); - write(getGeneratedNameForNode(enumParent)); - write("["); - emitExpressionForPropertyName(node.name); - write("] = "); - writeEnumMemberDeclarationValue(node); - write("] = "); - emitExpressionForPropertyName(node.name); - emitEnd(node); - write(";"); - } - function writeEnumMemberDeclarationValue(member) { - var value = resolver.getConstantValue(member); - if (value !== undefined) { - write(value.toString()); - return; - } - else if (member.initializer) { - emit(member.initializer); - } - else { - write("undefined"); - } - } - function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body && moduleDeclaration.body.kind === 225 /* ModuleDeclaration */) { - var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); - return recursiveInnerModule || moduleDeclaration.body; - } - } - function shouldEmitModuleDeclaration(node) { - return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules); - } - function isModuleMergedWithES6Class(node) { - return languageVersion === 2 /* ES6 */ && !!(resolver.getNodeCheckFlags(node) & 32768 /* LexicalModuleMergesWithClass */); - } - function isFirstDeclarationOfKind(node, declarations, kind) { - return !ts.forEach(declarations, function (declaration) { return declaration.kind === kind && declaration.pos < node.pos; }); - } - function emitModuleDeclaration(node) { - // Emit only if this module is non-ambient. - var shouldEmit = shouldEmitModuleDeclaration(node); - if (!shouldEmit) { - return emitCommentsOnNotEmittedNode(node); - } - var hoistedInDeclarationScope = shouldHoistDeclarationInSystemJsModule(node); - var emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node); - if (emitVarForModule) { - var isES6ExportedNamespace = isES6ExportedDeclaration(node); - if (!isES6ExportedNamespace || isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, 225 /* ModuleDeclaration */)) { - emitStart(node); - if (isES6ExportedNamespace) { - write("export "); - } - write("var "); - emit(node.name); - write(";"); - emitEnd(node); - writeLine(); - } - } - emitStart(node); - write("(function ("); - emitStart(node.name); - write(getGeneratedNameForNode(node)); - emitEnd(node.name); - write(") "); - ts.Debug.assert(node.body !== undefined); // node.body must exist, as this is a non-ambient module - if (node.body.kind === 226 /* ModuleBlock */) { - var saveConvertedLoopState = convertedLoopState; - var saveTempFlags = tempFlags; - var saveTempVariables = tempVariables; - convertedLoopState = undefined; - tempFlags = 0; - tempVariables = undefined; - emit(node.body); - ts.Debug.assert(convertedLoopState === undefined); - convertedLoopState = saveConvertedLoopState; - tempFlags = saveTempFlags; - tempVariables = saveTempVariables; - } - else { - write("{"); - increaseIndent(); - emitCaptureThisForNodeIfNecessary(node); - writeLine(); - emit(node.body); - decreaseIndent(); - writeLine(); - var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; - emitToken(16 /* CloseBraceToken */, moduleBlock.statements.end); - } - write(")("); - // write moduleDecl = containingModule.m only if it is not exported es6 module member - if ((node.flags & 1 /* Export */) && !isES6ExportedDeclaration(node)) { - emit(node.name); - write(" = "); - } - emitModuleMemberName(node); - write(" || ("); - emitModuleMemberName(node); - write(" = {}));"); - emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.name.kind === 69 /* Identifier */ && node.parent === currentSourceFile) { - if (modulekind === ts.ModuleKind.System && (node.flags & 1 /* Export */)) { - writeLine(); - write(exportFunctionForFile + "(\""); - emitDeclarationName(node); - write("\", "); - emitDeclarationName(node); - write(");"); - } - emitExportMemberAssignments(node.name); - } - } - /* - * Some bundlers (SystemJS builder) sometimes want to rename dependencies. - * Here we check if alternative name was provided for a given moduleName and return it if possible. - */ - function tryRenameExternalModule(moduleName) { - if (renamedDependencies && moduleName.text in renamedDependencies) { - return "\"" + renamedDependencies[moduleName.text] + "\""; - } - return undefined; - } - function emitRequire(moduleName) { - if (moduleName.kind === 9 /* StringLiteral */) { - write("require("); - var text = tryRenameExternalModule(moduleName); - if (text) { - write(text); - } - else { - emitStart(moduleName); - emitLiteral(moduleName); - emitEnd(moduleName); - } - emitToken(18 /* CloseParenToken */, moduleName.end); - } - else { - write("require()"); - } - } - function getNamespaceDeclarationNode(node) { - if (node.kind === 229 /* ImportEqualsDeclaration */) { - return node; - } - var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 232 /* NamespaceImport */) { - return importClause.namedBindings; - } - } - function isDefaultImport(node) { - return node.kind === 230 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; - } - function emitExportImportAssignments(node) { - if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { - emitExportMemberAssignments(node.name); - } - ts.forEachChild(node, emitExportImportAssignments); - } - function emitImportDeclaration(node) { - if (modulekind !== ts.ModuleKind.ES6) { - return emitExternalImportDeclaration(node); - } - // ES6 import - if (node.importClause) { - var shouldEmitDefaultBindings = resolver.isReferencedAliasDeclaration(node.importClause); - var shouldEmitNamedBindings = node.importClause.namedBindings && resolver.isReferencedAliasDeclaration(node.importClause.namedBindings, /* checkChildren */ true); - if (shouldEmitDefaultBindings || shouldEmitNamedBindings) { - write("import "); - emitStart(node.importClause); - if (shouldEmitDefaultBindings) { - emit(node.importClause.name); - if (shouldEmitNamedBindings) { - write(", "); - } - } - if (shouldEmitNamedBindings) { - emitLeadingComments(node.importClause.namedBindings); - emitStart(node.importClause.namedBindings); - if (node.importClause.namedBindings.kind === 232 /* NamespaceImport */) { - write("* as "); - emit(node.importClause.namedBindings.name); - } - else { - write("{ "); - emitExportOrImportSpecifierList(node.importClause.namedBindings.elements, resolver.isReferencedAliasDeclaration); - write(" }"); - } - emitEnd(node.importClause.namedBindings); - emitTrailingComments(node.importClause.namedBindings); - } - emitEnd(node.importClause); - write(" from "); - emit(node.moduleSpecifier); - write(";"); - } - } - else { - write("import "); - emit(node.moduleSpecifier); - write(";"); - } - } - function emitExternalImportDeclaration(node) { - if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 229 /* ImportEqualsDeclaration */ && (node.flags & 1 /* Export */) !== 0; - var namespaceDeclaration = getNamespaceDeclarationNode(node); - var varOrConst = (languageVersion <= 1 /* ES5 */) ? "var " : "const "; - if (modulekind !== ts.ModuleKind.AMD) { - emitLeadingComments(node); - emitStart(node); - if (namespaceDeclaration && !isDefaultImport(node)) { - // import x = require("foo") - // import * as x from "foo" - if (!isExportedImport) { - write(varOrConst); - } - ; - emitModuleMemberName(namespaceDeclaration); - write(" = "); - } - else { - // import "foo" - // import x from "foo" - // import { x, y } from "foo" - // import d, * as x from "foo" - // import d, { x, y } from "foo" - var isNakedImport = 230 /* ImportDeclaration */ && !node.importClause; - if (!isNakedImport) { - write(varOrConst); - write(getGeneratedNameForNode(node)); - write(" = "); - } - } - emitRequire(ts.getExternalModuleName(node)); - if (namespaceDeclaration && isDefaultImport(node)) { - // import d, * as x from "foo" - write(", "); - emitModuleMemberName(namespaceDeclaration); - write(" = "); - write(getGeneratedNameForNode(node)); - } - write(";"); - emitEnd(node); - emitExportImportAssignments(node); - emitTrailingComments(node); - } - else { - if (isExportedImport) { - emitModuleMemberName(namespaceDeclaration); - write(" = "); - emit(namespaceDeclaration.name); - write(";"); - } - else if (namespaceDeclaration && isDefaultImport(node)) { - // import d, * as x from "foo" - write(varOrConst); - emitModuleMemberName(namespaceDeclaration); - write(" = "); - write(getGeneratedNameForNode(node)); - write(";"); - } - emitExportImportAssignments(node); - } - } - } - function emitImportEqualsDeclaration(node) { - if (ts.isExternalModuleImportEqualsDeclaration(node)) { - emitExternalImportDeclaration(node); - return; - } - // preserve old compiler's behavior: emit 'var' for import declaration (even if we do not consider them referenced) when - // - current file is not external module - // - import declaration is top level and target is value imported by entity name - if (resolver.isReferencedAliasDeclaration(node) || - (!isCurrentFileExternalModule && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { - emitLeadingComments(node); - emitStart(node); - // variable declaration for import-equals declaration can be hoisted in system modules - // in this case 'var' should be omitted and emit should contain only initialization - var variableDeclarationIsHoisted = shouldHoistVariable(node, /*checkIfSourceFileLevelDecl*/ true); - // is it top level export import v = a.b.c in system module? - // if yes - it needs to be rewritten as exporter('v', v = a.b.c) - var isExported = isSourceFileLevelDeclarationInSystemJsModule(node, /*isExported*/ true); - if (!variableDeclarationIsHoisted) { - ts.Debug.assert(!isExported); - if (isES6ExportedDeclaration(node)) { - write("export "); - write("var "); - } - else if (!(node.flags & 1 /* Export */)) { - write("var "); - } - } - if (isExported) { - write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(node.name); - write("\", "); - } - emitModuleMemberName(node); - write(" = "); - emit(node.moduleReference); - if (isExported) { - write(")"); - } - write(";"); - emitEnd(node); - emitExportImportAssignments(node); - emitTrailingComments(node); - } - } - function emitExportDeclaration(node) { - ts.Debug.assert(modulekind !== ts.ModuleKind.System); - if (modulekind !== ts.ModuleKind.ES6) { - if (node.moduleSpecifier && (!node.exportClause || resolver.isValueAliasDeclaration(node))) { - emitStart(node); - var generatedName = getGeneratedNameForNode(node); - if (node.exportClause) { - // export { x, y, ... } from "foo" - if (modulekind !== ts.ModuleKind.AMD) { - write("var "); - write(generatedName); - write(" = "); - emitRequire(ts.getExternalModuleName(node)); - write(";"); - } - for (var _a = 0, _b = node.exportClause.elements; _a < _b.length; _a++) { - var specifier = _b[_a]; - if (resolver.isValueAliasDeclaration(specifier)) { - writeLine(); - emitStart(specifier); - emitContainingModuleName(specifier); - write("."); - emitNodeWithCommentsAndWithoutSourcemap(specifier.name); - write(" = "); - write(generatedName); - write("."); - emitNodeWithCommentsAndWithoutSourcemap(specifier.propertyName || specifier.name); - write(";"); - emitEnd(specifier); - } - } - } - else { - // export * from "foo" - if (hasExportStarsToExportValues && resolver.moduleExportsSomeValue(node.moduleSpecifier)) { - writeLine(); - write("__export("); - if (modulekind !== ts.ModuleKind.AMD) { - emitRequire(ts.getExternalModuleName(node)); - } - else { - write(generatedName); - } - write(");"); - } - } - emitEnd(node); - } - } - else { - if (!node.exportClause || resolver.isValueAliasDeclaration(node)) { - write("export "); - if (node.exportClause) { - // export { x, y, ... } - write("{ "); - emitExportOrImportSpecifierList(node.exportClause.elements, resolver.isValueAliasDeclaration); - write(" }"); - } - else { - write("*"); - } - if (node.moduleSpecifier) { - write(" from "); - emit(node.moduleSpecifier); - } - write(";"); - } - } - } - function emitExportOrImportSpecifierList(specifiers, shouldEmit) { - ts.Debug.assert(modulekind === ts.ModuleKind.ES6); - var needsComma = false; - for (var _a = 0, specifiers_1 = specifiers; _a < specifiers_1.length; _a++) { - var specifier = specifiers_1[_a]; - if (shouldEmit(specifier)) { - if (needsComma) { - write(", "); - } - if (specifier.propertyName) { - emit(specifier.propertyName); - write(" as "); - } - emit(specifier.name); - needsComma = true; - } - } - } - function emitExportAssignment(node) { - if (!node.isExportEquals && resolver.isValueAliasDeclaration(node)) { - if (modulekind === ts.ModuleKind.ES6) { - writeLine(); - emitStart(node); - write("export default "); - var expression = node.expression; - emit(expression); - if (expression.kind !== 220 /* FunctionDeclaration */ && - expression.kind !== 221 /* ClassDeclaration */) { - write(";"); - } - emitEnd(node); - } - else { - writeLine(); - emitStart(node); - if (modulekind === ts.ModuleKind.System) { - write(exportFunctionForFile + "(\"default\","); - emit(node.expression); - write(")"); - } - else { - emitEs6ExportDefaultCompat(node); - emitContainingModuleName(node); - if (languageVersion === 0 /* ES3 */) { - write('["default"] = '); - } - else { - write(".default = "); - } - emit(node.expression); - } - write(";"); - emitEnd(node); - } - } - } - function collectExternalModuleInfo(sourceFile) { - externalImports = []; - exportSpecifiers = ts.createMap(); - exportEquals = undefined; - hasExportStarsToExportValues = false; - for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { - var node = _b[_a]; - switch (node.kind) { - case 230 /* ImportDeclaration */: - if (!node.importClause || - resolver.isReferencedAliasDeclaration(node.importClause, /*checkChildren*/ true)) { - // import "mod" - // import x from "mod" where x is referenced - // import * as x from "mod" where x is referenced - // import { x, y } from "mod" where at least one import is referenced - externalImports.push(node); - } - break; - case 229 /* ImportEqualsDeclaration */: - if (node.moduleReference.kind === 240 /* ExternalModuleReference */ && resolver.isReferencedAliasDeclaration(node)) { - // import x = require("mod") where x is referenced - externalImports.push(node); - } - break; - case 236 /* ExportDeclaration */: - if (node.moduleSpecifier) { - if (!node.exportClause) { - // export * from "mod" - if (resolver.moduleExportsSomeValue(node.moduleSpecifier)) { - externalImports.push(node); - hasExportStarsToExportValues = true; - } - } - else if (resolver.isValueAliasDeclaration(node)) { - // export { x, y } from "mod" where at least one export is a value symbol - externalImports.push(node); - } - } - else { - // export { x, y } - for (var _c = 0, _d = node.exportClause.elements; _c < _d.length; _c++) { - var specifier = _d[_c]; - var name_30 = (specifier.propertyName || specifier.name).text; - (exportSpecifiers[name_30] || (exportSpecifiers[name_30] = [])).push(specifier); - } - } - break; - case 235 /* ExportAssignment */: - if (node.isExportEquals && !exportEquals) { - // export = x - exportEquals = node; - } - break; - } - } - } - function emitExportStarHelper() { - if (hasExportStarsToExportValues) { - writeLine(); - write("function __export(m) {"); - increaseIndent(); - writeLine(); - write("for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];"); - decreaseIndent(); - writeLine(); - write("}"); - } - } - function getLocalNameForExternalImport(node) { - var namespaceDeclaration = getNamespaceDeclarationNode(node); - if (namespaceDeclaration && !isDefaultImport(node)) { - return ts.getTextOfNodeFromSourceText(currentText, namespaceDeclaration.name); - } - if (node.kind === 230 /* ImportDeclaration */ && node.importClause) { - return getGeneratedNameForNode(node); - } - if (node.kind === 236 /* ExportDeclaration */ && node.moduleSpecifier) { - return getGeneratedNameForNode(node); - } - } - function getExternalModuleNameText(importNode, emitRelativePathAsModuleName) { - if (emitRelativePathAsModuleName) { - var name_31 = getExternalModuleNameFromDeclaration(host, resolver, importNode); - if (name_31) { - return "\"" + name_31 + "\""; - } - } - var moduleName = ts.getExternalModuleName(importNode); - if (moduleName.kind === 9 /* StringLiteral */) { - return tryRenameExternalModule(moduleName) || getLiteralText(moduleName); - } - return undefined; - } - function emitVariableDeclarationsForImports() { - if (externalImports.length === 0) { - return; - } - writeLine(); - var started = false; - for (var _a = 0, externalImports_1 = externalImports; _a < externalImports_1.length; _a++) { - var importNode = externalImports_1[_a]; - // do not create variable declaration for exports and imports that lack import clause - var skipNode = importNode.kind === 236 /* ExportDeclaration */ || - (importNode.kind === 230 /* ImportDeclaration */ && !importNode.importClause); - if (skipNode) { - continue; - } - if (!started) { - write("var "); - started = true; - } - else { - write(", "); - } - write(getLocalNameForExternalImport(importNode)); - } - if (started) { - write(";"); - } - } - function emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations) { - // when resolving exports local exported entries/indirect exported entries in the module - // should always win over entries with similar names that were added via star exports - // to support this we store names of local/indirect exported entries in a set. - // this set is used to filter names brought by star exports. - if (!hasExportStarsToExportValues) { - // local names set is needed only in presence of star exports - return undefined; - } - // local names set should only be added if we have anything exported - if (!exportedDeclarations && !ts.someProperties(exportSpecifiers)) { - // no exported declarations (export var ...) or export specifiers (export {x}) - // check if we have any non star export declarations. - var hasExportDeclarationWithExportClause = false; - for (var _a = 0, externalImports_2 = externalImports; _a < externalImports_2.length; _a++) { - var externalImport = externalImports_2[_a]; - if (externalImport.kind === 236 /* ExportDeclaration */ && externalImport.exportClause) { - hasExportDeclarationWithExportClause = true; - break; - } - } - if (!hasExportDeclarationWithExportClause) { - // we still need to emit exportStar helper - return emitExportStarFunction(/*localNames*/ undefined); - } - } - var exportedNamesStorageRef = makeUniqueName("exportedNames"); - writeLine(); - write("var " + exportedNamesStorageRef + " = {"); - increaseIndent(); - var started = false; - if (exportedDeclarations) { - for (var i = 0; i < exportedDeclarations.length; i++) { - // write name of exported declaration, i.e 'export var x...' - writeExportedName(exportedDeclarations[i]); - } - } - if (exportSpecifiers) { - for (var n in exportSpecifiers) { - for (var _b = 0, _c = exportSpecifiers[n]; _b < _c.length; _b++) { - var specifier = _c[_b]; - // write name of export specified, i.e. 'export {x}' - writeExportedName(specifier.name); - } - } - } - for (var _d = 0, externalImports_3 = externalImports; _d < externalImports_3.length; _d++) { - var externalImport = externalImports_3[_d]; - if (externalImport.kind !== 236 /* ExportDeclaration */) { - continue; - } - var exportDecl = externalImport; - if (!exportDecl.exportClause) { - // export * from ... - continue; - } - for (var _e = 0, _f = exportDecl.exportClause.elements; _e < _f.length; _e++) { - var element = _f[_e]; - // write name of indirectly exported entry, i.e. 'export {x} from ...' - writeExportedName(element.name || element.propertyName); - } - } - decreaseIndent(); - writeLine(); - write("};"); - return emitExportStarFunction(exportedNamesStorageRef); - function emitExportStarFunction(localNames) { - var exportStarFunction = makeUniqueName("exportStar"); - writeLine(); - // define an export star helper function - write("function " + exportStarFunction + "(m) {"); - increaseIndent(); - writeLine(); - write("var exports = {};"); - writeLine(); - write("for(var n in m) {"); - increaseIndent(); - writeLine(); - write("if (n !== \"default\""); - if (localNames) { - write("&& !" + localNames + ".hasOwnProperty(n)"); - } - write(") exports[n] = m[n];"); - decreaseIndent(); - writeLine(); - write("}"); - writeLine(); - write(exportFunctionForFile + "(exports);"); - decreaseIndent(); - writeLine(); - write("}"); - return exportStarFunction; - } - function writeExportedName(node) { - // do not record default exports - // they are local to module and never overwritten (explicitly skipped) by star export - if (node.kind !== 69 /* Identifier */ && node.flags & 512 /* Default */) { - return; - } - if (started) { - write(","); - } - else { - started = true; - } - writeLine(); - write("'"); - if (node.kind === 69 /* Identifier */) { - emitNodeWithCommentsAndWithoutSourcemap(node); - } - else { - emitDeclarationName(node); - } - write("': true"); - } - } - function processTopLevelVariableAndFunctionDeclarations(node) { - // per ES6 spec: - // 15.2.1.16.4 ModuleDeclarationInstantiation() Concrete Method - // - var declarations are initialized to undefined - 14.a.ii - // - function/generator declarations are instantiated - 16.a.iv - // this means that after module is instantiated but before its evaluation - // exported functions are already accessible at import sites - // in theory we should hoist only exported functions and its dependencies - // in practice to simplify things we'll hoist all source level functions and variable declaration - // including variables declarations for module and class declarations - var hoistedVars; - var hoistedFunctionDeclarations; - var exportedDeclarations; - visit(node); - if (hoistedVars) { - writeLine(); - write("var "); - var seen = ts.createMap(); - for (var i = 0; i < hoistedVars.length; i++) { - var local = hoistedVars[i]; - var name_32 = local.kind === 69 /* Identifier */ - ? local - : local.name; - if (name_32) { - // do not emit duplicate entries (in case of declaration merging) in the list of hoisted variables - var text = ts.unescapeIdentifier(name_32.text); - if (text in seen) { - continue; - } - else { - seen[text] = text; - } - } - if (i !== 0) { - write(", "); - } - if (local.kind === 221 /* ClassDeclaration */ || local.kind === 225 /* ModuleDeclaration */ || local.kind === 224 /* EnumDeclaration */) { - emitDeclarationName(local); - } - else { - emit(local); - } - var flags = ts.getCombinedNodeFlags(local.kind === 69 /* Identifier */ ? local.parent : local); - if (flags & 1 /* Export */) { - if (!exportedDeclarations) { - exportedDeclarations = []; - } - exportedDeclarations.push(local); - } - } - write(";"); - } - if (hoistedFunctionDeclarations) { - for (var _a = 0, hoistedFunctionDeclarations_1 = hoistedFunctionDeclarations; _a < hoistedFunctionDeclarations_1.length; _a++) { - var f = hoistedFunctionDeclarations_1[_a]; - writeLine(); - emit(f); - if (f.flags & 1 /* Export */) { - if (!exportedDeclarations) { - exportedDeclarations = []; - } - exportedDeclarations.push(f); - } - } - } - return exportedDeclarations; - function visit(node) { - if (node.flags & 2 /* Ambient */) { - return; - } - if (node.kind === 220 /* FunctionDeclaration */) { - if (!hoistedFunctionDeclarations) { - hoistedFunctionDeclarations = []; - } - hoistedFunctionDeclarations.push(node); - return; - } - if (node.kind === 221 /* ClassDeclaration */) { - if (!hoistedVars) { - hoistedVars = []; - } - hoistedVars.push(node); - return; - } - if (node.kind === 224 /* EnumDeclaration */) { - if (shouldEmitEnumDeclaration(node)) { - if (!hoistedVars) { - hoistedVars = []; - } - hoistedVars.push(node); - } - return; - } - if (node.kind === 225 /* ModuleDeclaration */) { - if (shouldEmitModuleDeclaration(node)) { - if (!hoistedVars) { - hoistedVars = []; - } - hoistedVars.push(node); - } - return; - } - if (node.kind === 218 /* VariableDeclaration */ || node.kind === 169 /* BindingElement */) { - if (shouldHoistVariable(node, /*checkIfSourceFileLevelDecl*/ false)) { - var name_33 = node.name; - if (name_33.kind === 69 /* Identifier */) { - if (!hoistedVars) { - hoistedVars = []; - } - hoistedVars.push(name_33); - } - else { - ts.forEachChild(name_33, visit); - } - } - return; - } - if (ts.isInternalModuleImportEqualsDeclaration(node) && resolver.isValueAliasDeclaration(node)) { - if (!hoistedVars) { - hoistedVars = []; - } - hoistedVars.push(node.name); - return; - } - if (ts.isBindingPattern(node)) { - ts.forEach(node.elements, visit); - return; - } - if (!ts.isDeclaration(node)) { - ts.forEachChild(node, visit); - } - } - } - function shouldHoistVariable(node, checkIfSourceFileLevelDecl) { - if (checkIfSourceFileLevelDecl && !shouldHoistDeclarationInSystemJsModule(node)) { - return false; - } - // hoist variable if - // - it is not block scoped - // - it is top level block scoped - // if block scoped variables are nested in some another block then - // no other functions can use them except ones that are defined at least in the same block - return (ts.getCombinedNodeFlags(node) & 3072 /* BlockScoped */) === 0 || - ts.getEnclosingBlockScopeContainer(node).kind === 256 /* SourceFile */; - } - function isCurrentFileSystemExternalModule() { - return modulekind === ts.ModuleKind.System && isCurrentFileExternalModule; - } - function emitSystemModuleBody(node, dependencyGroups, startIndex) { - // shape of the body in system modules: - // function (exports) { - // - // - // - // return { - // setters: [ - // - // ], - // execute: function() { - // - // } - // } - // - // } - // I.e: - // import {x} from 'file1' - // var y = 1; - // export function foo() { return y + x(); } - // console.log(y); - // will be transformed to - // function(exports) { - // var file1; // local alias - // var y; - // function foo() { return y + file1.x(); } - // exports("foo", foo); - // return { - // setters: [ - // function(v) { file1 = v } - // ], - // execute(): function() { - // y = 1; - // console.log(y); - // } - // }; - // } - emitVariableDeclarationsForImports(); - writeLine(); - var exportedDeclarations = processTopLevelVariableAndFunctionDeclarations(node); - var exportStarFunction = emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations); - writeLine(); - write("return {"); - increaseIndent(); - writeLine(); - emitSetters(exportStarFunction, dependencyGroups); - writeLine(); - emitExecute(node, startIndex); - decreaseIndent(); - writeLine(); - write("}"); // return - emitTempDeclarations(/*newLine*/ true); - } - function emitSetters(exportStarFunction, dependencyGroups) { - write("setters:["); - for (var i = 0; i < dependencyGroups.length; i++) { - if (i !== 0) { - write(","); - } - writeLine(); - increaseIndent(); - var group = dependencyGroups[i]; - // derive a unique name for parameter from the first named entry in the group - var parameterName = makeUniqueName(ts.forEach(group, getLocalNameForExternalImport) || ""); - write("function (" + parameterName + ") {"); - increaseIndent(); - for (var _a = 0, group_1 = group; _a < group_1.length; _a++) { - var entry = group_1[_a]; - var importVariableName = getLocalNameForExternalImport(entry) || ""; - switch (entry.kind) { - case 230 /* ImportDeclaration */: - if (!entry.importClause) { - // 'import "..."' case - // module is imported only for side-effects, no emit required - break; - } - // fall-through - case 229 /* ImportEqualsDeclaration */: - ts.Debug.assert(importVariableName !== ""); - writeLine(); - // save import into the local - write(importVariableName + " = " + parameterName + ";"); - writeLine(); - break; - case 236 /* ExportDeclaration */: - ts.Debug.assert(importVariableName !== ""); - if (entry.exportClause) { - // export {a, b as c} from 'foo' - // emit as: - // exports_({ - // "a": _["a"], - // "c": _["b"] - // }); - writeLine(); - write(exportFunctionForFile + "({"); - writeLine(); - increaseIndent(); - for (var i_1 = 0, len = entry.exportClause.elements.length; i_1 < len; i_1++) { - if (i_1 !== 0) { - write(","); - writeLine(); - } - var e = entry.exportClause.elements[i_1]; - write("\""); - emitNodeWithCommentsAndWithoutSourcemap(e.name); - write("\": " + parameterName + "[\""); - emitNodeWithCommentsAndWithoutSourcemap(e.propertyName || e.name); - write("\"]"); - } - decreaseIndent(); - writeLine(); - write("});"); - } - else { - // collectExternalModuleInfo prefilters star exports to keep only ones that export values - // this means that check 'resolver.moduleExportsSomeValue' is redundant and can be omitted here - writeLine(); - // export * from 'foo' - // emit as: - // exportStar(_foo); - write(exportStarFunction + "(" + parameterName + ");"); - } - writeLine(); - break; - } - } - decreaseIndent(); - write("}"); - decreaseIndent(); - } - write("],"); - } - function emitExecute(node, startIndex) { - write("execute: function() {"); - increaseIndent(); - writeLine(); - for (var i = startIndex; i < node.statements.length; i++) { - var statement = node.statements[i]; - switch (statement.kind) { - // - function declarations are not emitted because they were already hoisted - // - import declarations are not emitted since they are already handled in setters - // - export declarations with module specifiers are not emitted since they were already written in setters - // - export declarations without module specifiers are emitted preserving the order - case 220 /* FunctionDeclaration */: - case 230 /* ImportDeclaration */: - continue; - case 236 /* ExportDeclaration */: - if (!statement.moduleSpecifier) { - for (var _a = 0, _b = statement.exportClause.elements; _a < _b.length; _a++) { - var element = _b[_a]; - // write call to exporter function for every export specifier in exports list - emitExportSpecifierInSystemModule(element); - } - } - continue; - case 229 /* ImportEqualsDeclaration */: - if (!ts.isInternalModuleImportEqualsDeclaration(statement)) { - // - import equals declarations that import external modules are not emitted - continue; - } - // fall-though for import declarations that import internal modules - default: - writeLine(); - emit(statement); - } - } - decreaseIndent(); - writeLine(); - write("}"); // execute - } - function writeModuleName(node, emitRelativePathAsModuleName) { - var moduleName = node.moduleName; - if (moduleName || (emitRelativePathAsModuleName && (moduleName = getResolvedExternalModuleName(host, node)))) { - write("\"" + moduleName + "\", "); - } - } - function emitSystemModule(node, emitRelativePathAsModuleName) { - collectExternalModuleInfo(node); - // System modules has the following shape - // System.register(['dep-1', ... 'dep-n'], function(exports) {/* module body function */}) - // 'exports' here is a function 'exports(name: string, value: T): T' that is used to publish exported values. - // 'exports' returns its 'value' argument so in most cases expressions - // that mutate exported values can be rewritten as: - // expr -> exports('name', expr). - // The only exception in this rule is postfix unary operators, - // see comment to 'emitPostfixUnaryExpression' for more details - ts.Debug.assert(!exportFunctionForFile); - // make sure that name of 'exports' function does not conflict with existing identifiers - exportFunctionForFile = makeUniqueName("exports"); - contextObjectForFile = makeUniqueName("context"); - writeLine(); - write("System.register("); - writeModuleName(node, emitRelativePathAsModuleName); - write("["); - var groupIndices = ts.createMap(); - var dependencyGroups = []; - for (var i = 0; i < externalImports.length; i++) { - var text = getExternalModuleNameText(externalImports[i], emitRelativePathAsModuleName); - if (text === undefined) { - continue; - } - // text should be quoted string - // for deduplication purposes in key remove leading and trailing quotes so 'a' and "a" will be considered the same - var key = text.substr(1, text.length - 2); - if (key in groupIndices) { - // deduplicate/group entries in dependency list by the dependency name - var groupIndex = groupIndices[key]; - dependencyGroups[groupIndex].push(externalImports[i]); - continue; - } - else { - groupIndices[key] = dependencyGroups.length; - dependencyGroups.push([externalImports[i]]); - } - if (i !== 0) { - write(", "); - } - write(text); - } - write("], function(" + exportFunctionForFile + ", " + contextObjectForFile + ") {"); - writeLine(); - increaseIndent(); - var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict); - writeLine(); - write("var __moduleName = " + contextObjectForFile + " && " + contextObjectForFile + ".id;"); - writeLine(); - emitEmitHelpers(node); - emitCaptureThisForNodeIfNecessary(node); - emitSystemModuleBody(node, dependencyGroups, startIndex); - decreaseIndent(); - writeLine(); - write("});"); - } - function getAMDDependencyNames(node, includeNonAmdDependencies, emitRelativePathAsModuleName) { - // names of modules with corresponding parameter in the factory function - var aliasedModuleNames = []; - // names of modules with no corresponding parameters in factory function - var unaliasedModuleNames = []; - var importAliasNames = []; // names of the parameters in the factory function; these - // parameters need to match the indexes of the corresponding - // module names in aliasedModuleNames. - // Fill in amd-dependency tags - for (var _a = 0, _b = node.amdDependencies; _a < _b.length; _a++) { - var amdDependency = _b[_a]; - if (amdDependency.name) { - aliasedModuleNames.push('"' + amdDependency.path + '"'); - importAliasNames.push(amdDependency.name); - } - else { - unaliasedModuleNames.push('"' + amdDependency.path + '"'); - } - } - for (var _c = 0, externalImports_4 = externalImports; _c < externalImports_4.length; _c++) { - var importNode = externalImports_4[_c]; - // Find the name of the external module - var externalModuleName = getExternalModuleNameText(importNode, emitRelativePathAsModuleName); - // Find the name of the module alias, if there is one - var importAliasName = getLocalNameForExternalImport(importNode); - if (includeNonAmdDependencies && importAliasName) { - aliasedModuleNames.push(externalModuleName); - importAliasNames.push(importAliasName); - } - else { - unaliasedModuleNames.push(externalModuleName); - } - } - return { aliasedModuleNames: aliasedModuleNames, unaliasedModuleNames: unaliasedModuleNames, importAliasNames: importAliasNames }; - } - function emitAMDDependencies(node, includeNonAmdDependencies, emitRelativePathAsModuleName) { - // An AMD define function has the following shape: - // define(id?, dependencies?, factory); - // - // This has the shape of - // define(name, ["module1", "module2"], function (module1Alias) { - // The location of the alias in the parameter list in the factory function needs to - // match the position of the module name in the dependency list. - // - // To ensure this is true in cases of modules with no aliases, e.g.: - // `import "module"` or `` - // we need to add modules without alias names to the end of the dependencies list - var dependencyNames = getAMDDependencyNames(node, includeNonAmdDependencies, emitRelativePathAsModuleName); - emitAMDDependencyList(dependencyNames); - write(", "); - emitAMDFactoryHeader(dependencyNames); - } - function emitAMDDependencyList(_a) { - var aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames; - write('["require", "exports"'); - if (aliasedModuleNames.length) { - write(", "); - write(aliasedModuleNames.join(", ")); - } - if (unaliasedModuleNames.length) { - write(", "); - write(unaliasedModuleNames.join(", ")); - } + // Parameters + emitCommaList(node.parameters, emitParameterDeclaration); + if (node.kind === 155 /* IndexSignature */) { write("]"); } - function emitAMDFactoryHeader(_a) { - var importAliasNames = _a.importAliasNames; - write("function (require, exports"); - if (importAliasNames.length) { - write(", "); - write(importAliasNames.join(", ")); - } - write(") {"); + else { + write(")"); } - function emitAMDModule(node, emitRelativePathAsModuleName) { - emitEmitHelpers(node); - collectExternalModuleInfo(node); - writeLine(); - write("define("); - writeModuleName(node, emitRelativePathAsModuleName); - emitAMDDependencies(node, /*includeNonAmdDependencies*/ true, emitRelativePathAsModuleName); - increaseIndent(); - var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict); - emitExportStarHelper(); - emitCaptureThisForNodeIfNecessary(node); - emitLinesStartingAt(node.statements, startIndex); - emitExportEquals(/*emitAsReturn*/ true); - emitTempDeclarations(/*newLine*/ true); - decreaseIndent(); - writeLine(); - write("});"); - } - function emitCommonJSModule(node) { - var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict); - emitEmitHelpers(node); - collectExternalModuleInfo(node); - emitExportStarHelper(); - emitCaptureThisForNodeIfNecessary(node); - emitLinesStartingAt(node.statements, startIndex); - emitExportEquals(/*emitAsReturn*/ false); - emitTempDeclarations(/*newLine*/ true); - } - function emitUMDModule(node) { - emitEmitHelpers(node); - collectExternalModuleInfo(node); - var dependencyNames = getAMDDependencyNames(node, /*includeNonAmdDependencies*/ false); - // Module is detected first to support Browserify users that load into a browser with an AMD loader - writeLines("(function (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("); - emitAMDDependencyList(dependencyNames); - write(", factory);"); - writeLines(" }\n})("); - emitAMDFactoryHeader(dependencyNames); - increaseIndent(); - var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true, /*ensureUseStrict*/ !compilerOptions.noImplicitUseStrict); - emitExportStarHelper(); - emitCaptureThisForNodeIfNecessary(node); - emitLinesStartingAt(node.statements, startIndex); - emitExportEquals(/*emitAsReturn*/ true); - emitTempDeclarations(/*newLine*/ true); - decreaseIndent(); - writeLine(); - write("});"); - } - function emitES6Module(node) { - externalImports = undefined; - exportSpecifiers = undefined; - exportEquals = undefined; - hasExportStarsToExportValues = false; - var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false); - emitEmitHelpers(node); - emitCaptureThisForNodeIfNecessary(node); - emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(/*newLine*/ true); - // Emit exportDefault if it exists will happen as part - // or normal statement emit. - } - function emitExportEquals(emitAsReturn) { - if (exportEquals && resolver.isValueAliasDeclaration(exportEquals)) { - writeLine(); - emitStart(exportEquals); - write(emitAsReturn ? "return " : "module.exports = "); - emit(exportEquals.expression); - write(";"); - emitEnd(exportEquals); + // If this is not a constructor and is not private, emit the return type + var isFunctionTypeOrConstructorType = node.kind === 158 /* FunctionType */ || node.kind === 159 /* ConstructorType */; + if (isFunctionTypeOrConstructorType || node.parent.kind === 161 /* TypeLiteral */) { + // Emit type literal signature return type only if specified + if (node.type) { + write(isFunctionTypeOrConstructorType ? " => " : ": "); + emitType(node.type); } } - function emitJsxElement(node) { - switch (compilerOptions.jsx) { - case 2 /* React */: - jsxEmitReact(node); + else if (node.kind !== 150 /* Constructor */ && !ts.hasModifier(node, 8 /* Private */)) { + writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); + } + enclosingDeclaration = prevEnclosingDeclaration; + if (!isFunctionTypeOrConstructorType) { + write(";"); + writeLine(); + } + else if (closeParenthesizedFunctionType) { + write(")"); + } + function getReturnTypeVisibilityError(symbolAccessibilityResult) { + var diagnosticMessage; + switch (node.kind) { + case 154 /* ConstructSignature */: + // Interfaces cannot have return types that cannot be named + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 1 /* Preserve */: - // Fall back to preserve if None was specified (we'll error earlier) - default: - jsxEmitPreserve(node); + case 153 /* CallSignature */: + // Interfaces cannot have return types that cannot be named + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - } - } - function trimReactWhitespaceAndApplyEntities(node) { - var result = undefined; - var text = ts.getTextOfNode(node, /*includeTrivia*/ true); - var firstNonWhitespace = 0; - var lastNonWhitespace = -1; - // JSX trims whitespace at the end and beginning of lines, except that the - // start/end of a tag is considered a start/end of a line only if that line is - // on the same line as the closing tag. See examples in tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx - for (var i = 0; i < text.length; i++) { - var c = text.charCodeAt(i); - if (ts.isLineBreak(c)) { - if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) { - var part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1); - result = (result ? result + "\" + ' ' + \"" : "") + ts.escapeString(part); + case 155 /* IndexSignature */: + // Interfaces cannot have return types that cannot be named + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; + break; + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + if (ts.hasModifier(node, 32 /* Static */)) { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? + ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : + ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - firstNonWhitespace = -1; - } - else if (!ts.isWhiteSpaceSingleLine(c)) { - lastNonWhitespace = i; - if (firstNonWhitespace === -1) { - firstNonWhitespace = i; - } - } - } - if (firstNonWhitespace !== -1) { - var part = text.substr(firstNonWhitespace); - result = (result ? result + "\" + ' ' + \"" : "") + ts.escapeString(part); - } - if (result) { - // Replace entities like   - result = result.replace(/&(\w+);/g, function (s, m) { - if (entities[m] !== undefined) { - var ch = String.fromCharCode(entities[m]); - // " needs to be escaped - return ch === '"' ? "\\\"" : ch; + else if (node.parent.kind === 226 /* ClassDeclaration */) { + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? + ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : + ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; } else { - return s; + // Interfaces cannot have return types that cannot be named + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } - }); - } - return result; - } - function isJsxChildEmittable(child) { - if (child.kind === 248 /* JsxExpression */) { - // Don't emit empty expressions - return !!child.expression; - } - else if (child.kind === 244 /* JsxText */) { - // Don't emit empty strings - return !!getTextToEmit(child); - } - return true; - } - ; - function getTextToEmit(node) { - switch (compilerOptions.jsx) { - case 2 /* React */: - var text = trimReactWhitespaceAndApplyEntities(node); - if (text === undefined || text.length === 0) { - return undefined; - } - else { - return text; - } - case 1 /* Preserve */: - default: - return ts.getTextOfNode(node, /*includeTrivia*/ true); - } - } - function emitJsxText(node) { - switch (compilerOptions.jsx) { - case 2 /* React */: - write('"'); - write(trimReactWhitespaceAndApplyEntities(node)); - write('"'); break; - case 1 /* Preserve */: - default: - writer.writeLiteral(ts.getTextOfNode(node, /*includeTrivia*/ true)); + case 225 /* FunctionDeclaration */: + diagnosticMessage = symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? + ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : + ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; break; + default: + ts.Debug.fail("This is unknown kind for signature: " + node.kind); } + return { + diagnosticMessage: diagnosticMessage, + errorNode: node.name || node + }; } - function emitJsxExpression(node) { - if (node.expression) { - switch (compilerOptions.jsx) { - case 1 /* Preserve */: - default: - write("{"); - emit(node.expression); - write("}"); - break; - case 2 /* React */: - emit(node.expression); - break; - } - } - } - function isUseStrictPrologue(node) { - return (node.expression.text === "use strict"); - } - function ensureUseStrictPrologue(startWithNewLine, writeUseStrict) { - if (writeUseStrict) { - if (startWithNewLine) { - writeLine(); - } - write("\"use strict\";"); - } - } - function emitDirectivePrologues(statements, startWithNewLine, ensureUseStrict) { - var foundUseStrict = false; - for (var i = 0; i < statements.length; i++) { - if (ts.isPrologueDirective(statements[i])) { - if (isUseStrictPrologue(statements[i])) { - foundUseStrict = true; - } - if (startWithNewLine || i > 0) { - writeLine(); - } - emit(statements[i]); - } - else { - ensureUseStrictPrologue(startWithNewLine || i > 0, !foundUseStrict && ensureUseStrict); - // return index of the first non prologue directive - return i; - } - } - ensureUseStrictPrologue(startWithNewLine, !foundUseStrict && ensureUseStrict); - return statements.length; - } - function writeLines(text) { - var lines = text.split(/\r\n|\r|\n/g); - for (var i = 0; i < lines.length; i++) { - var line = lines[i]; - if (line.length) { - writeLine(); - write(line); - } - } - } - function emitEmitHelpers(node) { - // Only emit helpers if the user did not say otherwise. - if (!compilerOptions.noEmitHelpers) { - // Only Emit __extends function when target ES5. - // For target ES6 and above, we can emit classDeclaration as is. - if (languageVersion < 2 /* ES6 */ && !extendsEmitted && node.flags & 262144 /* HasClassExtends */) { - writeLines(extendsHelper); - extendsEmitted = true; - } - if (compilerOptions.jsx !== 1 /* Preserve */ && !assignEmitted && (node.flags & 1073741824 /* HasJsxSpreadAttribute */)) { - writeLines(assignHelper); - assignEmitted = true; - } - if (!decorateEmitted && node.flags & 524288 /* HasDecorators */) { - writeLines(decorateHelper); - if (compilerOptions.emitDecoratorMetadata) { - writeLines(metadataHelper); - } - decorateEmitted = true; - } - if (!paramEmitted && node.flags & 1048576 /* HasParamDecorators */) { - writeLines(paramHelper); - paramEmitted = true; - } - if (!awaiterEmitted && node.flags & 2097152 /* HasAsyncFunctions */) { - writeLines(awaiterHelper); - awaiterEmitted = true; - } - } - } - function emitSourceFileNode(node) { - // Start new file on new line - writeLine(); - emitShebang(); - emitDetachedCommentsAndUpdateCommentsInfo(node); - if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { - if (isOwnFileEmit || (!ts.isExternalModule(node) && compilerOptions.isolatedModules)) { - var emitModule = moduleEmitDelegates[modulekind] || moduleEmitDelegates[ts.ModuleKind.CommonJS]; - emitModule(node); - } - else { - bundleEmitDelegates[modulekind](node, /*emitRelativePathAsModuleName*/ true); - } - } - else { - // emit prologue directives prior to __extends - var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false); - externalImports = undefined; - exportSpecifiers = undefined; - exportEquals = undefined; - hasExportStarsToExportValues = false; - emitEmitHelpers(node); - emitCaptureThisForNodeIfNecessary(node); - emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(/*newLine*/ true); - } - emitLeadingComments(node.endOfFileToken); - } - function emit(node) { - emitNodeConsideringCommentsOption(node, emitNodeWithSourceMap); - } - function emitNodeWithCommentsAndWithoutSourcemap(node) { - emitNodeConsideringCommentsOption(node, emitNodeWithoutSourceMap); - } - function emitNodeConsideringCommentsOption(node, emitNodeConsideringSourcemap) { - if (node) { - if (node.flags & 2 /* Ambient */) { - return emitCommentsOnNotEmittedNode(node); - } - if (isSpecializedCommentHandling(node)) { - // This is the node that will handle its own comments and sourcemap - return emitNodeWithoutSourceMap(node); - } - var emitComments_1 = shouldEmitLeadingAndTrailingComments(node); - if (emitComments_1) { - emitLeadingComments(node); - } - emitNodeConsideringSourcemap(node); - if (emitComments_1) { - emitTrailingComments(node); - } - } - } - function emitNodeWithSourceMap(node) { - if (node) { - emitStart(node); - emitNodeWithoutSourceMap(node); - emitEnd(node); - } - } - function emitNodeWithoutSourceMap(node) { - if (node) { - emitJavaScriptWorker(node); - } - } - function changeSourceMapEmit(writer) { - sourceMap = writer; - emitStart = writer.emitStart; - emitEnd = writer.emitEnd; - emitPos = writer.emitPos; - setSourceFile = writer.setSourceFile; - } - function withTemporaryNoSourceMap(callback) { - var prevSourceMap = sourceMap; - setSourceMapWriterEmit(ts.getNullSourceMapWriter()); - callback(); - setSourceMapWriterEmit(prevSourceMap); - } - function isSpecializedCommentHandling(node) { - switch (node.kind) { - // All of these entities are emitted in a specialized fashion. As such, we allow - // the specialized methods for each to handle the comments on the nodes. - case 222 /* InterfaceDeclaration */: - case 220 /* FunctionDeclaration */: - case 230 /* ImportDeclaration */: - case 229 /* ImportEqualsDeclaration */: - case 223 /* TypeAliasDeclaration */: - case 235 /* ExportAssignment */: - return true; - } - } - function shouldEmitLeadingAndTrailingComments(node) { - switch (node.kind) { - case 200 /* VariableStatement */: - return shouldEmitLeadingAndTrailingCommentsForVariableStatement(node); - case 225 /* ModuleDeclaration */: - // Only emit the leading/trailing comments for a module if we're actually - // emitting the module as well. - return shouldEmitModuleDeclaration(node); - case 224 /* EnumDeclaration */: - // Only emit the leading/trailing comments for an enum if we're actually - // emitting the module as well. - return shouldEmitEnumDeclaration(node); - } - // If the node is emitted in specialized fashion, dont emit comments as this node will handle - // emitting comments when emitting itself - ts.Debug.assert(!isSpecializedCommentHandling(node)); - // If this is the expression body of an arrow function that we're down-leveling, - // then we don't want to emit comments when we emit the body. It will have already - // been taken care of when we emitted the 'return' statement for the function - // expression body. - if (node.kind !== 199 /* Block */ && - node.parent && - node.parent.kind === 180 /* ArrowFunction */ && - node.parent.body === node && - languageVersion <= 1 /* ES5 */) { - return false; - } - // Emit comments for everything else. - return true; - } - function emitJavaScriptWorker(node) { - // Check if the node can be emitted regardless of the ScriptTarget - switch (node.kind) { - case 69 /* Identifier */: - return emitIdentifier(node); - case 142 /* Parameter */: - return emitParameter(node); - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - return emitMethod(node); - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - return emitAccessor(node); - case 97 /* ThisKeyword */: - return emitThis(node); - case 95 /* SuperKeyword */: - return emitSuper(node); - case 93 /* NullKeyword */: - return write("null"); - case 99 /* TrueKeyword */: - return write("true"); - case 84 /* FalseKeyword */: - return write("false"); - case 8 /* NumericLiteral */: - case 9 /* StringLiteral */: - case 10 /* RegularExpressionLiteral */: - case 11 /* NoSubstitutionTemplateLiteral */: - case 12 /* TemplateHead */: - case 13 /* TemplateMiddle */: - case 14 /* TemplateTail */: - return emitLiteral(node); - case 189 /* TemplateExpression */: - return emitTemplateExpression(node); - case 197 /* TemplateSpan */: - return emitTemplateSpan(node); - case 241 /* JsxElement */: - case 242 /* JsxSelfClosingElement */: - return emitJsxElement(node); - case 244 /* JsxText */: - return emitJsxText(node); - case 248 /* JsxExpression */: - return emitJsxExpression(node); - case 139 /* QualifiedName */: - return emitQualifiedName(node); - case 167 /* ObjectBindingPattern */: - return emitObjectBindingPattern(node); - case 168 /* ArrayBindingPattern */: - return emitArrayBindingPattern(node); - case 169 /* BindingElement */: - return emitBindingElement(node); - case 170 /* ArrayLiteralExpression */: - return emitArrayLiteral(node); - case 171 /* ObjectLiteralExpression */: - return emitObjectLiteral(node); - case 253 /* PropertyAssignment */: - return emitPropertyAssignment(node); - case 254 /* ShorthandPropertyAssignment */: - return emitShorthandPropertyAssignment(node); - case 140 /* ComputedPropertyName */: - return emitComputedPropertyName(node); - case 172 /* PropertyAccessExpression */: - return emitPropertyAccess(node); - case 173 /* ElementAccessExpression */: - return emitIndexedAccess(node); - case 174 /* CallExpression */: - return emitCallExpression(node); - case 175 /* NewExpression */: - return emitNewExpression(node); - case 176 /* TaggedTemplateExpression */: - return emitTaggedTemplateExpression(node); - case 177 /* TypeAssertionExpression */: - case 195 /* AsExpression */: - case 196 /* NonNullExpression */: - return emit(node.expression); - case 178 /* ParenthesizedExpression */: - return emitParenExpression(node); - case 220 /* FunctionDeclaration */: - case 179 /* FunctionExpression */: - case 180 /* ArrowFunction */: - return emitFunctionDeclaration(node); - case 181 /* DeleteExpression */: - return emitDeleteExpression(node); - case 182 /* TypeOfExpression */: - return emitTypeOfExpression(node); - case 183 /* VoidExpression */: - return emitVoidExpression(node); - case 184 /* AwaitExpression */: - return emitAwaitExpression(node); - case 185 /* PrefixUnaryExpression */: - return emitPrefixUnaryExpression(node); - case 186 /* PostfixUnaryExpression */: - return emitPostfixUnaryExpression(node); - case 187 /* BinaryExpression */: - return emitBinaryExpression(node); - case 188 /* ConditionalExpression */: - return emitConditionalExpression(node); - case 191 /* SpreadElementExpression */: - return emitSpreadElementExpression(node); - case 190 /* YieldExpression */: - return emitYieldExpression(node); - case 193 /* OmittedExpression */: - return; - case 199 /* Block */: - case 226 /* ModuleBlock */: - return emitBlock(node); - case 200 /* VariableStatement */: - return emitVariableStatement(node); - case 201 /* EmptyStatement */: - return write(";"); - case 202 /* ExpressionStatement */: - return emitExpressionStatement(node); - case 203 /* IfStatement */: - return emitIfStatement(node); - case 204 /* DoStatement */: - return emitDoStatement(node); - case 205 /* WhileStatement */: - return emitWhileStatement(node); - case 206 /* ForStatement */: - return emitForStatement(node); - case 208 /* ForOfStatement */: - case 207 /* ForInStatement */: - return emitForInOrForOfStatement(node); - case 209 /* ContinueStatement */: - case 210 /* BreakStatement */: - return emitBreakOrContinueStatement(node); - case 211 /* ReturnStatement */: - return emitReturnStatement(node); - case 212 /* WithStatement */: - return emitWithStatement(node); - case 213 /* SwitchStatement */: - return emitSwitchStatement(node); - case 249 /* CaseClause */: - case 250 /* DefaultClause */: - return emitCaseOrDefaultClause(node); - case 214 /* LabeledStatement */: - return emitLabeledStatement(node); - case 215 /* ThrowStatement */: - return emitThrowStatement(node); - case 216 /* TryStatement */: - return emitTryStatement(node); - case 252 /* CatchClause */: - return emitCatchClause(node); - case 217 /* DebuggerStatement */: - return emitDebuggerStatement(node); - case 218 /* VariableDeclaration */: - return emitVariableDeclaration(node); - case 192 /* ClassExpression */: - return emitClassExpression(node); - case 221 /* ClassDeclaration */: - return emitClassDeclaration(node); - case 222 /* InterfaceDeclaration */: - return emitInterfaceDeclaration(node); - case 224 /* EnumDeclaration */: - return emitEnumDeclaration(node); - case 255 /* EnumMember */: - return emitEnumMember(node); - case 225 /* ModuleDeclaration */: - return emitModuleDeclaration(node); - case 230 /* ImportDeclaration */: - return emitImportDeclaration(node); - case 229 /* ImportEqualsDeclaration */: - return emitImportEqualsDeclaration(node); - case 236 /* ExportDeclaration */: - return emitExportDeclaration(node); - case 235 /* ExportAssignment */: - return emitExportAssignment(node); - case 256 /* SourceFile */: - return emitSourceFileNode(node); - } - } - function hasDetachedComments(pos) { - return detachedCommentsInfo !== undefined && ts.lastOrUndefined(detachedCommentsInfo).nodePos === pos; - } - function getLeadingCommentsWithoutDetachedComments() { - // get the leading comments from detachedPos - var leadingComments = ts.getLeadingCommentRanges(currentText, ts.lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos); - if (detachedCommentsInfo.length - 1) { - detachedCommentsInfo.pop(); - } - else { - detachedCommentsInfo = undefined; - } - return leadingComments; - } - /** - * Determine if the given comment is a triple-slash - * - * @return true if the comment is a triple-slash comment else false - **/ - function isTripleSlashComment(comment) { - // Verify this is /// comment, but do the regexp match only when we first can find /// in the comment text - // so that we don't end up computing comment string and doing match for all // comments - if (currentText.charCodeAt(comment.pos + 1) === 47 /* slash */ && - comment.pos + 2 < comment.end && - currentText.charCodeAt(comment.pos + 2) === 47 /* slash */) { - var textSubStr = currentText.substring(comment.pos, comment.end); - return textSubStr.match(ts.fullTripleSlashReferencePathRegEx) || - textSubStr.match(ts.fullTripleSlashAMDReferencePathRegEx) ? - true : false; - } - return false; - } - function getLeadingCommentsToEmit(node) { - // Emit the leading comments only if the parent's pos doesn't match because parent should take care of emitting these comments - if (node.parent) { - if (node.parent.kind === 256 /* SourceFile */ || node.pos !== node.parent.pos) { - if (hasDetachedComments(node.pos)) { - // get comments without detached comments - return getLeadingCommentsWithoutDetachedComments(); - } - else { - // get the leading comments from the node - return ts.getLeadingCommentRangesOfNodeFromText(node, currentText); - } - } - } - } - function getTrailingCommentsToEmit(node) { - // Emit the trailing comments only if the parent's pos doesn't match because parent should take care of emitting these comments - if (node.parent) { - if (node.parent.kind === 256 /* SourceFile */ || node.end !== node.parent.end) { - return ts.getTrailingCommentRanges(currentText, node.end); - } - } - } - /** - * Emit comments associated with node that will not be emitted into JS file - */ - function emitCommentsOnNotEmittedNode(node) { - emitLeadingCommentsWorker(node, /*isEmittedNode*/ false); - } - function emitLeadingComments(node) { - return emitLeadingCommentsWorker(node, /*isEmittedNode*/ true); - } - function emitLeadingCommentsWorker(node, isEmittedNode) { - if (compilerOptions.removeComments) { - return; - } - var leadingComments; - if (isEmittedNode) { - leadingComments = getLeadingCommentsToEmit(node); - } - else { - // If the node will not be emitted in JS, remove all the comments(normal, pinned and ///) associated with the node, - // unless it is a triple slash comment at the top of the file. - // For Example: - // /// - // declare var x; - // /// - // interface F {} - // The first /// will NOT be removed while the second one will be removed even though both node will not be emitted - if (node.pos === 0) { - leadingComments = ts.filter(getLeadingCommentsToEmit(node), isTripleSlashComment); - } - } - ts.emitNewLineBeforeLeadingComments(currentLineMap, writer, node, leadingComments); - // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space - ts.emitComments(currentText, currentLineMap, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); - } - function emitTrailingComments(node) { - if (compilerOptions.removeComments) { - return; - } - // Emit the trailing comments only if the parent's end doesn't match - var trailingComments = getTrailingCommentsToEmit(node); - // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ - ts.emitComments(currentText, currentLineMap, writer, trailingComments, /*trailingSeparator*/ false, newLine, writeComment); - } - /** - * Emit trailing comments at the position. The term trailing comment is used here to describe following comment: - * x, /comment1/ y - * ^ => pos; the function will emit "comment1" in the emitJS - */ - function emitTrailingCommentsOfPosition(pos) { - if (compilerOptions.removeComments) { - return; - } - var trailingComments = ts.getTrailingCommentRanges(currentText, pos); - // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ - ts.emitComments(currentText, currentLineMap, writer, trailingComments, /*trailingSeparator*/ true, newLine, writeComment); - } - function emitLeadingCommentsOfPositionWorker(pos) { - if (compilerOptions.removeComments) { - return; - } - var leadingComments; - if (hasDetachedComments(pos)) { - // get comments without detached comments - leadingComments = getLeadingCommentsWithoutDetachedComments(); - } - else { - // get the leading comments from the node - leadingComments = ts.getLeadingCommentRanges(currentText, pos); - } - ts.emitNewLineBeforeLeadingComments(currentLineMap, writer, { pos: pos, end: pos }, leadingComments); - // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space - ts.emitComments(currentText, currentLineMap, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); - } - function emitDetachedCommentsAndUpdateCommentsInfo(node) { - var currentDetachedCommentInfo = ts.emitDetachedComments(currentText, currentLineMap, writer, writeComment, node, newLine, compilerOptions.removeComments); - if (currentDetachedCommentInfo) { - if (detachedCommentsInfo) { - detachedCommentsInfo.push(currentDetachedCommentInfo); - } - else { - detachedCommentsInfo = [currentDetachedCommentInfo]; - } - } - } - function writeComment(text, lineMap, writer, comment, newLine) { - emitPos(comment.pos); - ts.writeCommentRange(text, lineMap, writer, comment, newLine); - emitPos(comment.end); - } - function emitShebang() { - var shebang = ts.getShebang(currentText); - if (shebang) { - write(shebang); - writeLine(); - } - } - var _a, _b; } - function emitFile(_a, sourceFiles, isBundledEmit) { - var jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath; - // Make sure not to write js File and source map file if any of them cannot be written + function emitParameterDeclaration(node) { + increaseIndent(); + emitJsDocComments(node); + if (node.dotDotDotToken) { + write("..."); + } + if (ts.isBindingPattern(node.name)) { + // For bindingPattern, we can't simply writeTextOfNode from the source file + // because we want to omit the initializer and using writeTextOfNode will result in initializer get emitted. + // Therefore, we will have to recursively emit each element in the bindingPattern. + emitBindingPattern(node.name); + } + else { + writeTextOfNode(currentText, node.name); + } + if (resolver.isOptionalParameter(node)) { + write("?"); + } + decreaseIndent(); + if (node.parent.kind === 158 /* FunctionType */ || + node.parent.kind === 159 /* ConstructorType */ || + node.parent.parent.kind === 161 /* TypeLiteral */) { + emitTypeOfVariableDeclarationFromTypeLiteral(node); + } + else if (!ts.hasModifier(node.parent, 8 /* Private */)) { + writeTypeOfDeclaration(node, node.type, getParameterDeclarationTypeVisibilityError); + } + function getParameterDeclarationTypeVisibilityError(symbolAccessibilityResult) { + var diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult); + return diagnosticMessage !== undefined ? { + diagnosticMessage: diagnosticMessage, + errorNode: node, + typeName: node.name + } : undefined; + } + function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { + switch (node.parent.kind) { + case 150 /* Constructor */: + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? + ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; + case 154 /* ConstructSignature */: + // Interfaces cannot have parameter types that cannot be named + return symbolAccessibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; + case 153 /* CallSignature */: + // Interfaces cannot have parameter types that cannot be named + return symbolAccessibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + case 155 /* IndexSignature */: + // Interfaces cannot have parameter types that cannot be named + return symbolAccessibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + if (ts.hasModifier(node.parent, 32 /* Static */)) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? + ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; + } + else if (node.parent.parent.kind === 226 /* ClassDeclaration */) { + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? + ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; + } + else { + // Interfaces cannot have parameter types that cannot be named + return symbolAccessibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; + } + case 225 /* FunctionDeclaration */: + return symbolAccessibilityResult.errorModuleName ? + symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? + ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; + default: + ts.Debug.fail("This is unknown parent for parameter: " + node.parent.kind); + } + } + function emitBindingPattern(bindingPattern) { + // We have to explicitly emit square bracket and bracket because these tokens are not store inside the node. + if (bindingPattern.kind === 172 /* ObjectBindingPattern */) { + write("{"); + emitCommaList(bindingPattern.elements, emitBindingElement); + write("}"); + } + else if (bindingPattern.kind === 173 /* ArrayBindingPattern */) { + write("["); + var elements = bindingPattern.elements; + emitCommaList(elements, emitBindingElement); + if (elements && elements.hasTrailingComma) { + write(", "); + } + write("]"); + } + } + function emitBindingElement(bindingElement) { + if (bindingElement.kind === 198 /* OmittedExpression */) { + // If bindingElement is an omittedExpression (i.e. containing elision), + // we will emit blank space (although this may differ from users' original code, + // it allows emitSeparatedList to write separator appropriately) + // Example: + // original: function foo([, x, ,]) {} + // emit : function foo([ , x, , ]) {} + write(" "); + } + else if (bindingElement.kind === 174 /* BindingElement */) { + if (bindingElement.propertyName) { + // bindingElement has propertyName property in the following case: + // { y: [a,b,c] ...} -> bindingPattern will have a property called propertyName for "y" + // We have to explicitly emit the propertyName before descending into its binding elements. + // Example: + // original: function foo({y: [a,b,c]}) {} + // emit : declare function foo({y: [a, b, c]}: { y: [any, any, any] }) void; + writeTextOfNode(currentText, bindingElement.propertyName); + write(": "); + } + if (bindingElement.name) { + if (ts.isBindingPattern(bindingElement.name)) { + // If it is a nested binding pattern, we will recursively descend into each element and emit each one separately. + // In the case of rest element, we will omit rest element. + // Example: + // original: function foo([a, [[b]], c] = [1,[["string"]], 3]) {} + // emit : declare function foo([a, [[b]], c]: [number, [[string]], number]): void; + // original with rest: function foo([a, ...c]) {} + // emit : declare function foo([a, ...c]): void; + emitBindingPattern(bindingElement.name); + } + else { + ts.Debug.assert(bindingElement.name.kind === 70 /* Identifier */); + // If the node is just an identifier, we will simply emit the text associated with the node's name + // Example: + // original: function foo({y = 10, x}) {} + // emit : declare function foo({y, x}: {number, any}): void; + if (bindingElement.dotDotDotToken) { + write("..."); + } + writeTextOfNode(currentText, bindingElement.name); + } + } + } + } + } + function emitNode(node) { + switch (node.kind) { + case 225 /* FunctionDeclaration */: + case 230 /* ModuleDeclaration */: + case 234 /* ImportEqualsDeclaration */: + case 227 /* InterfaceDeclaration */: + case 226 /* ClassDeclaration */: + case 228 /* TypeAliasDeclaration */: + case 229 /* EnumDeclaration */: + return emitModuleElement(node, isModuleElementVisible(node)); + case 205 /* VariableStatement */: + return emitModuleElement(node, isVariableStatementVisible(node)); + case 235 /* ImportDeclaration */: + // Import declaration without import clause is visible, otherwise it is not visible + return emitModuleElement(node, /*isModuleElementVisible*/ !node.importClause); + case 241 /* ExportDeclaration */: + return emitExportDeclaration(node); + case 150 /* Constructor */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + return writeFunctionDeclaration(node); + case 154 /* ConstructSignature */: + case 153 /* CallSignature */: + case 155 /* IndexSignature */: + return emitSignatureDeclarationWithJsDocComments(node); + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + return emitAccessorDeclaration(node); + case 147 /* PropertyDeclaration */: + case 146 /* PropertySignature */: + return emitPropertyDeclaration(node); + case 260 /* EnumMember */: + return emitEnumMemberDeclaration(node); + case 240 /* ExportAssignment */: + return emitExportAssignment(node); + case 261 /* SourceFile */: + return emitSourceFile(node); + } + } + /** + * Adds the reference to referenced file, returns true if global file reference was emitted + * @param referencedFile + * @param addBundledFileReference Determines if global file reference corresponding to bundled file should be emitted or not + */ + function writeReferencePath(referencedFile, addBundledFileReference, emitOnlyDtsFiles) { + var declFileName; + var addedBundledEmitReference = false; + if (ts.isDeclarationFile(referencedFile)) { + // Declaration file, use declaration file name + declFileName = referencedFile.fileName; + } + else { + // Get the declaration file path + ts.forEachExpectedEmitFile(host, getDeclFileName, referencedFile, emitOnlyDtsFiles); + } + if (declFileName) { + declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(declarationFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, + /*isAbsolutePathAnUrl*/ false); + referencesOutput += "/// " + newLine; + } + return addedBundledEmitReference; + function getDeclFileName(emitFileNames, _sourceFiles, isBundledEmit) { + // Dont add reference path to this file if it is a bundled emit and caller asked not emit bundled file path + if (isBundledEmit && !addBundledFileReference) { + return; + } + ts.Debug.assert(!!emitFileNames.declarationFilePath || ts.isSourceFileJavaScript(referencedFile), "Declaration file is not present only for javascript files"); + declFileName = emitFileNames.declarationFilePath || emitFileNames.jsFilePath; + addedBundledEmitReference = isBundledEmit; + } + } + } + /* @internal */ + function writeDeclarationFile(declarationFilePath, sourceFiles, isBundledEmit, host, resolver, emitterDiagnostics, emitOnlyDtsFiles) { + var emitDeclarationResult = emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit, emitOnlyDtsFiles); + var emitSkipped = emitDeclarationResult.reportedDeclarationError || host.isEmitBlocked(declarationFilePath) || host.getCompilerOptions().noEmit; + if (!emitSkipped) { + var declarationOutput = emitDeclarationResult.referencesOutput + + getDeclarationOutput(emitDeclarationResult.synchronousDeclarationOutput, emitDeclarationResult.moduleElementDeclarationEmitInfo); + ts.writeFile(host, emitterDiagnostics, declarationFilePath, declarationOutput, host.getCompilerOptions().emitBOM, sourceFiles); + } + return emitSkipped; + function getDeclarationOutput(synchronousDeclarationOutput, moduleElementDeclarationEmitInfo) { + var appliedSyncOutputPos = 0; + var declarationOutput = ""; + // apply asynchronous additions to the synchronous output + ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { + if (aliasEmitInfo.asynchronousOutput) { + declarationOutput += synchronousDeclarationOutput.substring(appliedSyncOutputPos, aliasEmitInfo.outputPos); + declarationOutput += getDeclarationOutput(aliasEmitInfo.asynchronousOutput, aliasEmitInfo.subModuleElementDeclarationEmitInfo); + appliedSyncOutputPos = aliasEmitInfo.outputPos; + } + }); + declarationOutput += synchronousDeclarationOutput.substring(appliedSyncOutputPos); + return declarationOutput; + } + } + ts.writeDeclarationFile = writeDeclarationFile; +})(ts || (ts = {})); +/// +/// +/// +/// +/// +/* @internal */ +var ts; +(function (ts) { + // Flags enum to track count of temp variables and a few dedicated names + var TempFlags; + (function (TempFlags) { + TempFlags[TempFlags["Auto"] = 0] = "Auto"; + TempFlags[TempFlags["CountMask"] = 268435455] = "CountMask"; + TempFlags[TempFlags["_i"] = 268435456] = "_i"; + })(TempFlags || (TempFlags = {})); + var id = function (s) { return s; }; + var nullTransformers = [function (_) { return id; }]; + // targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature + function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles) { + var delimiters = createDelimiterMap(); + var brackets = createBracketsMap(); + var compilerOptions = host.getCompilerOptions(); + var languageVersion = ts.getEmitScriptTarget(compilerOptions); + var moduleKind = ts.getEmitModuleKind(compilerOptions); + var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined; + var emittedFilesList = compilerOptions.listEmittedFiles ? [] : undefined; + var emitterDiagnostics = ts.createDiagnosticCollection(); + var newLine = host.getNewLine(); + var transformers = emitOnlyDtsFiles ? nullTransformers : ts.getTransformers(compilerOptions); + var writer = ts.createTextWriter(newLine); + var write = writer.write, writeLine = writer.writeLine, increaseIndent = writer.increaseIndent, decreaseIndent = writer.decreaseIndent; + var sourceMap = ts.createSourceMapWriter(host, writer); + var emitNodeWithSourceMap = sourceMap.emitNodeWithSourceMap, emitTokenWithSourceMap = sourceMap.emitTokenWithSourceMap; + var comments = ts.createCommentWriter(host, writer, sourceMap); + var emitNodeWithComments = comments.emitNodeWithComments, emitBodyWithDetachedComments = comments.emitBodyWithDetachedComments, emitTrailingCommentsOfPosition = comments.emitTrailingCommentsOfPosition; + var nodeIdToGeneratedName; + var autoGeneratedIdToGeneratedName; + var generatedNameSet; + var tempFlags; + var currentSourceFile; + var currentText; + var currentFileIdentifiers; + var bundledHelpers; + var isOwnFileEmit; + var emitSkipped = false; + var sourceFiles = ts.getSourceFilesToEmit(host, targetSourceFile); + // Transform the source files + ts.performance.mark("beforeTransform"); + var _a = ts.transformFiles(resolver, host, sourceFiles, transformers), transformed = _a.transformed, emitNodeWithSubstitution = _a.emitNodeWithSubstitution, emitNodeWithNotification = _a.emitNodeWithNotification; + ts.performance.measure("transformTime", "beforeTransform"); + // Emit each output file + ts.performance.mark("beforePrint"); + ts.forEachTransformedEmitFile(host, transformed, emitFile, emitOnlyDtsFiles); + ts.performance.measure("printTime", "beforePrint"); + // Clean up emit nodes on parse tree + for (var _b = 0, sourceFiles_4 = sourceFiles; _b < sourceFiles_4.length; _b++) { + var sourceFile = sourceFiles_4[_b]; + ts.disposeEmitNodes(sourceFile); + } + return { + emitSkipped: emitSkipped, + diagnostics: emitterDiagnostics.getDiagnostics(), + emittedFiles: emittedFilesList, + sourceMaps: sourceMapDataList + }; + function emitFile(jsFilePath, sourceMapFilePath, declarationFilePath, sourceFiles, isBundledEmit) { + // Make sure not to write js file and source map file if any of them cannot be written if (!host.isEmitBlocked(jsFilePath) && !compilerOptions.noEmit) { - emitJavaScript(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit); + if (!emitOnlyDtsFiles) { + printFile(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit); + } } else { emitSkipped = true; } if (declarationFilePath) { - emitSkipped = ts.writeDeclarationFile(declarationFilePath, sourceFiles, isBundledEmit, host, resolver, emitterDiagnostics) || emitSkipped; + emitSkipped = ts.writeDeclarationFile(declarationFilePath, ts.getOriginalSourceFiles(sourceFiles), isBundledEmit, host, resolver, emitterDiagnostics, emitOnlyDtsFiles) || emitSkipped; } if (!emitSkipped && emittedFilesList) { - emittedFilesList.push(jsFilePath); + if (!emitOnlyDtsFiles) { + emittedFilesList.push(jsFilePath); + } if (sourceMapFilePath) { emittedFilesList.push(sourceMapFilePath); } @@ -43963,20 +59991,2335 @@ var ts; } } } + function printFile(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit) { + sourceMap.initialize(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit); + 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]; + emitHelpers(sourceFile, /*isBundle*/ true); + } + } + // Print each transformed source file. + ts.forEach(sourceFiles, printSourceFile); + writeLine(); + var sourceMappingURL = sourceMap.getSourceMappingURL(); + if (sourceMappingURL) { + write("//# " + "sourceMappingURL" + "=" + sourceMappingURL); // Sometimes tools can sometimes see this line as a source mapping url comment + } + // Write the source map + if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) { + 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, sourceFiles); + // Reset state + sourceMap.reset(); + comments.reset(); + writer.reset(); + tempFlags = 0 /* Auto */; + currentSourceFile = undefined; + currentText = undefined; + isOwnFileEmit = false; + } + function printSourceFile(node) { + currentSourceFile = node; + currentText = node.text; + currentFileIdentifiers = node.identifiers; + sourceMap.setSourceFile(node); + comments.setSourceFile(node); + pipelineEmitWithNotification(0 /* SourceFile */, node); + } + /** + * Emits a node. + */ + function emit(node) { + pipelineEmitWithNotification(3 /* Unspecified */, node); + } + /** + * Emits an IdentifierName. + */ + function emitIdentifierName(node) { + pipelineEmitWithNotification(2 /* IdentifierName */, node); + } + /** + * Emits an expression node. + */ + function emitExpression(node) { + pipelineEmitWithNotification(1 /* Expression */, node); + } + /** + * Emits a node with possible notification. + * + * NOTE: Do not call this method directly. It is part of the emit pipeline + * and should only be called from printSourceFile, emit, emitExpression, or + * emitIdentifierName. + */ + function pipelineEmitWithNotification(emitContext, node) { + emitNodeWithNotification(emitContext, node, pipelineEmitWithComments); + } + /** + * Emits a node with comments. + * + * NOTE: Do not call this method directly. It is part of the emit pipeline + * and should only be called indirectly from pipelineEmitWithNotification. + */ + function pipelineEmitWithComments(emitContext, node) { + // Do not emit comments for SourceFile + if (emitContext === 0 /* SourceFile */) { + pipelineEmitWithSourceMap(emitContext, node); + return; + } + emitNodeWithComments(emitContext, node, pipelineEmitWithSourceMap); + } + /** + * Emits a node with source maps. + * + * NOTE: Do not call this method directly. It is part of the emit pipeline + * and should only be called indirectly from pipelineEmitWithComments. + */ + function pipelineEmitWithSourceMap(emitContext, node) { + // Do not emit source mappings for SourceFile or IdentifierName + if (emitContext === 0 /* SourceFile */ + || emitContext === 2 /* IdentifierName */) { + pipelineEmitWithSubstitution(emitContext, node); + return; + } + emitNodeWithSourceMap(emitContext, node, pipelineEmitWithSubstitution); + } + /** + * Emits a node with possible substitution. + * + * NOTE: Do not call this method directly. It is part of the emit pipeline + * and should only be called indirectly from pipelineEmitWithSourceMap or + * pipelineEmitInUnspecifiedContext (when picking a more specific context). + */ + function pipelineEmitWithSubstitution(emitContext, node) { + emitNodeWithSubstitution(emitContext, node, pipelineEmitForContext); + } + /** + * Emits a node. + * + * NOTE: Do not call this method directly. It is part of the emit pipeline + * and should only be called indirectly from pipelineEmitWithSubstitution. + */ + function pipelineEmitForContext(emitContext, node) { + switch (emitContext) { + case 0 /* SourceFile */: return pipelineEmitInSourceFileContext(node); + case 2 /* IdentifierName */: return pipelineEmitInIdentifierNameContext(node); + case 3 /* Unspecified */: return pipelineEmitInUnspecifiedContext(node); + case 1 /* Expression */: return pipelineEmitInExpressionContext(node); + } + } + /** + * Emits a node in the SourceFile EmitContext. + * + * NOTE: Do not call this method directly. It is part of the emit pipeline + * and should only be called indirectly from pipelineEmitForContext. + */ + function pipelineEmitInSourceFileContext(node) { + var kind = node.kind; + switch (kind) { + // Top-level nodes + case 261 /* SourceFile */: + return emitSourceFile(node); + } + } + /** + * Emits a node in the IdentifierName EmitContext. + * + * NOTE: Do not call this method directly. It is part of the emit pipeline + * and should only be called indirectly from pipelineEmitForContext. + */ + function pipelineEmitInIdentifierNameContext(node) { + var kind = node.kind; + switch (kind) { + // Identifiers + case 70 /* Identifier */: + return emitIdentifier(node); + } + } + /** + * Emits a node in the Unspecified EmitContext. + * + * NOTE: Do not call this method directly. It is part of the emit pipeline + * and should only be called indirectly from pipelineEmitForContext. + */ + function pipelineEmitInUnspecifiedContext(node) { + var kind = node.kind; + switch (kind) { + // Pseudo-literals + case 13 /* TemplateHead */: + case 14 /* TemplateMiddle */: + case 15 /* TemplateTail */: + return emitLiteral(node); + // Identifiers + case 70 /* Identifier */: + return emitIdentifier(node); + // Reserved words + case 75 /* ConstKeyword */: + case 78 /* DefaultKeyword */: + case 83 /* ExportKeyword */: + case 104 /* VoidKeyword */: + // Strict mode reserved words + case 111 /* PrivateKeyword */: + case 112 /* ProtectedKeyword */: + case 113 /* PublicKeyword */: + case 114 /* StaticKeyword */: + // Contextual keywords + case 116 /* AbstractKeyword */: + case 117 /* AsKeyword */: + case 118 /* AnyKeyword */: + case 119 /* AsyncKeyword */: + case 120 /* AwaitKeyword */: + case 121 /* BooleanKeyword */: + case 122 /* ConstructorKeyword */: + case 123 /* DeclareKeyword */: + case 124 /* GetKeyword */: + case 125 /* IsKeyword */: + case 127 /* ModuleKeyword */: + case 128 /* NamespaceKeyword */: + case 129 /* NeverKeyword */: + case 130 /* ReadonlyKeyword */: + case 131 /* RequireKeyword */: + case 132 /* NumberKeyword */: + case 133 /* SetKeyword */: + case 134 /* StringKeyword */: + case 135 /* SymbolKeyword */: + case 136 /* TypeKeyword */: + case 137 /* UndefinedKeyword */: + case 138 /* FromKeyword */: + case 139 /* GlobalKeyword */: + case 140 /* OfKeyword */: + writeTokenText(kind); + return; + // Parse tree nodes + // Names + case 141 /* QualifiedName */: + return emitQualifiedName(node); + case 142 /* ComputedPropertyName */: + return emitComputedPropertyName(node); + // Signature elements + case 143 /* TypeParameter */: + return emitTypeParameter(node); + case 144 /* Parameter */: + return emitParameter(node); + case 145 /* Decorator */: + return emitDecorator(node); + // Type members + case 146 /* PropertySignature */: + return emitPropertySignature(node); + case 147 /* PropertyDeclaration */: + return emitPropertyDeclaration(node); + case 148 /* MethodSignature */: + return emitMethodSignature(node); + case 149 /* MethodDeclaration */: + return emitMethodDeclaration(node); + case 150 /* Constructor */: + return emitConstructor(node); + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + return emitAccessorDeclaration(node); + case 153 /* CallSignature */: + return emitCallSignature(node); + case 154 /* ConstructSignature */: + return emitConstructSignature(node); + case 155 /* IndexSignature */: + return emitIndexSignature(node); + // Types + case 156 /* TypePredicate */: + return emitTypePredicate(node); + case 157 /* TypeReference */: + return emitTypeReference(node); + case 158 /* FunctionType */: + return emitFunctionType(node); + case 159 /* ConstructorType */: + return emitConstructorType(node); + case 160 /* TypeQuery */: + return emitTypeQuery(node); + case 161 /* TypeLiteral */: + return emitTypeLiteral(node); + case 162 /* ArrayType */: + return emitArrayType(node); + case 163 /* TupleType */: + return emitTupleType(node); + case 164 /* UnionType */: + return emitUnionType(node); + case 165 /* IntersectionType */: + return emitIntersectionType(node); + case 166 /* ParenthesizedType */: + return emitParenthesizedType(node); + case 199 /* ExpressionWithTypeArguments */: + return emitExpressionWithTypeArguments(node); + case 167 /* ThisType */: + return emitThisType(); + case 168 /* TypeOperator */: + return emitTypeOperator(node); + case 169 /* IndexedAccessType */: + return emitIndexedAccessType(node); + case 170 /* MappedType */: + return emitMappedType(node); + case 171 /* LiteralType */: + return emitLiteralType(node); + // Binding patterns + case 172 /* ObjectBindingPattern */: + return emitObjectBindingPattern(node); + case 173 /* ArrayBindingPattern */: + return emitArrayBindingPattern(node); + case 174 /* BindingElement */: + return emitBindingElement(node); + // Misc + case 202 /* TemplateSpan */: + return emitTemplateSpan(node); + case 203 /* SemicolonClassElement */: + return emitSemicolonClassElement(); + // Statements + case 204 /* Block */: + return emitBlock(node); + case 205 /* VariableStatement */: + return emitVariableStatement(node); + case 206 /* EmptyStatement */: + return emitEmptyStatement(); + case 207 /* ExpressionStatement */: + return emitExpressionStatement(node); + case 208 /* IfStatement */: + return emitIfStatement(node); + case 209 /* DoStatement */: + return emitDoStatement(node); + case 210 /* WhileStatement */: + return emitWhileStatement(node); + case 211 /* ForStatement */: + return emitForStatement(node); + case 212 /* ForInStatement */: + return emitForInStatement(node); + case 213 /* ForOfStatement */: + return emitForOfStatement(node); + case 214 /* ContinueStatement */: + return emitContinueStatement(node); + case 215 /* BreakStatement */: + return emitBreakStatement(node); + case 216 /* ReturnStatement */: + return emitReturnStatement(node); + case 217 /* WithStatement */: + return emitWithStatement(node); + case 218 /* SwitchStatement */: + return emitSwitchStatement(node); + case 219 /* LabeledStatement */: + return emitLabeledStatement(node); + case 220 /* ThrowStatement */: + return emitThrowStatement(node); + case 221 /* TryStatement */: + return emitTryStatement(node); + case 222 /* DebuggerStatement */: + return emitDebuggerStatement(node); + // Declarations + case 223 /* VariableDeclaration */: + return emitVariableDeclaration(node); + case 224 /* VariableDeclarationList */: + return emitVariableDeclarationList(node); + case 225 /* FunctionDeclaration */: + return emitFunctionDeclaration(node); + case 226 /* ClassDeclaration */: + return emitClassDeclaration(node); + case 227 /* InterfaceDeclaration */: + return emitInterfaceDeclaration(node); + case 228 /* TypeAliasDeclaration */: + return emitTypeAliasDeclaration(node); + case 229 /* EnumDeclaration */: + return emitEnumDeclaration(node); + case 230 /* ModuleDeclaration */: + return emitModuleDeclaration(node); + case 231 /* ModuleBlock */: + return emitModuleBlock(node); + case 232 /* CaseBlock */: + return emitCaseBlock(node); + case 234 /* ImportEqualsDeclaration */: + return emitImportEqualsDeclaration(node); + case 235 /* ImportDeclaration */: + return emitImportDeclaration(node); + case 236 /* ImportClause */: + return emitImportClause(node); + case 237 /* NamespaceImport */: + return emitNamespaceImport(node); + case 238 /* NamedImports */: + return emitNamedImports(node); + case 239 /* ImportSpecifier */: + return emitImportSpecifier(node); + case 240 /* ExportAssignment */: + return emitExportAssignment(node); + case 241 /* ExportDeclaration */: + return emitExportDeclaration(node); + case 242 /* NamedExports */: + return emitNamedExports(node); + case 243 /* ExportSpecifier */: + return emitExportSpecifier(node); + case 244 /* MissingDeclaration */: + return; + // Module references + case 245 /* ExternalModuleReference */: + return emitExternalModuleReference(node); + // JSX (non-expression) + case 10 /* JsxText */: + return emitJsxText(node); + case 248 /* JsxOpeningElement */: + return emitJsxOpeningElement(node); + case 249 /* JsxClosingElement */: + return emitJsxClosingElement(node); + case 250 /* JsxAttribute */: + return emitJsxAttribute(node); + case 251 /* JsxSpreadAttribute */: + return emitJsxSpreadAttribute(node); + case 252 /* JsxExpression */: + return emitJsxExpression(node); + // Clauses + case 253 /* CaseClause */: + return emitCaseClause(node); + case 254 /* DefaultClause */: + return emitDefaultClause(node); + case 255 /* HeritageClause */: + return emitHeritageClause(node); + case 256 /* CatchClause */: + return emitCatchClause(node); + // Property assignments + case 257 /* PropertyAssignment */: + return emitPropertyAssignment(node); + case 258 /* ShorthandPropertyAssignment */: + return emitShorthandPropertyAssignment(node); + case 259 /* SpreadAssignment */: + return emitSpreadAssignment(node); + // Enum + case 260 /* EnumMember */: + return emitEnumMember(node); + } + // If the node is an expression, try to emit it as an expression with + // substitution. + if (ts.isExpression(node)) { + return pipelineEmitWithSubstitution(1 /* Expression */, node); + } + } + /** + * Emits a node in the Expression EmitContext. + * + * NOTE: Do not call this method directly. It is part of the emit pipeline + * and should only be called indirectly from pipelineEmitForContext. + */ + function pipelineEmitInExpressionContext(node) { + var kind = node.kind; + switch (kind) { + // Literals + case 8 /* NumericLiteral */: + return emitNumericLiteral(node); + case 9 /* StringLiteral */: + case 11 /* RegularExpressionLiteral */: + case 12 /* NoSubstitutionTemplateLiteral */: + return emitLiteral(node); + // Identifiers + case 70 /* Identifier */: + return emitIdentifier(node); + // Reserved words + case 85 /* FalseKeyword */: + case 94 /* NullKeyword */: + case 96 /* SuperKeyword */: + case 100 /* TrueKeyword */: + case 98 /* ThisKeyword */: + writeTokenText(kind); + return; + // Expressions + case 175 /* ArrayLiteralExpression */: + return emitArrayLiteralExpression(node); + case 176 /* ObjectLiteralExpression */: + return emitObjectLiteralExpression(node); + case 177 /* PropertyAccessExpression */: + return emitPropertyAccessExpression(node); + case 178 /* ElementAccessExpression */: + return emitElementAccessExpression(node); + case 179 /* CallExpression */: + return emitCallExpression(node); + case 180 /* NewExpression */: + return emitNewExpression(node); + case 181 /* TaggedTemplateExpression */: + return emitTaggedTemplateExpression(node); + case 182 /* TypeAssertionExpression */: + return emitTypeAssertionExpression(node); + case 183 /* ParenthesizedExpression */: + return emitParenthesizedExpression(node); + case 184 /* FunctionExpression */: + return emitFunctionExpression(node); + case 185 /* ArrowFunction */: + return emitArrowFunction(node); + case 186 /* DeleteExpression */: + return emitDeleteExpression(node); + case 187 /* TypeOfExpression */: + return emitTypeOfExpression(node); + case 188 /* VoidExpression */: + return emitVoidExpression(node); + case 189 /* AwaitExpression */: + return emitAwaitExpression(node); + case 190 /* PrefixUnaryExpression */: + return emitPrefixUnaryExpression(node); + case 191 /* PostfixUnaryExpression */: + return emitPostfixUnaryExpression(node); + case 192 /* BinaryExpression */: + return emitBinaryExpression(node); + case 193 /* ConditionalExpression */: + return emitConditionalExpression(node); + case 194 /* TemplateExpression */: + return emitTemplateExpression(node); + case 195 /* YieldExpression */: + return emitYieldExpression(node); + case 196 /* SpreadElement */: + return emitSpreadExpression(node); + case 197 /* ClassExpression */: + return emitClassExpression(node); + case 198 /* OmittedExpression */: + return; + case 200 /* AsExpression */: + return emitAsExpression(node); + case 201 /* NonNullExpression */: + return emitNonNullExpression(node); + // JSX + case 246 /* JsxElement */: + return emitJsxElement(node); + case 247 /* JsxSelfClosingElement */: + return emitJsxSelfClosingElement(node); + // Transformation nodes + case 294 /* PartiallyEmittedExpression */: + return emitPartiallyEmittedExpression(node); + } + } + // + // Literals/Pseudo-literals + // + // SyntaxKind.NumericLiteral + function emitNumericLiteral(node) { + emitLiteral(node); + if (node.trailingComment) { + write(" /*" + node.trailingComment + "*/"); + } + } + // SyntaxKind.StringLiteral + // SyntaxKind.RegularExpressionLiteral + // SyntaxKind.NoSubstitutionTemplateLiteral + // SyntaxKind.TemplateHead + // SyntaxKind.TemplateMiddle + // SyntaxKind.TemplateTail + function emitLiteral(node) { + var text = getLiteralTextOfNode(node); + if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) + && (node.kind === 9 /* StringLiteral */ || ts.isTemplateLiteralKind(node.kind))) { + writer.writeLiteral(text); + } + else { + write(text); + } + } + // + // Identifiers + // + function emitIdentifier(node) { + write(getTextOfNode(node, /*includeTrivia*/ false)); + } + // + // Names + // + function emitQualifiedName(node) { + emitEntityName(node.left); + write("."); + emit(node.right); + } + function emitEntityName(node) { + if (node.kind === 70 /* Identifier */) { + emitExpression(node); + } + else { + emit(node); + } + } + function emitComputedPropertyName(node) { + write("["); + emitExpression(node.expression); + write("]"); + } + // + // Signature elements + // + function emitTypeParameter(node) { + emit(node.name); + emitWithPrefix(" extends ", node.constraint); + } + function emitParameter(node) { + emitDecorators(node, node.decorators); + emitModifiers(node, node.modifiers); + writeIfPresent(node.dotDotDotToken, "..."); + emit(node.name); + writeIfPresent(node.questionToken, "?"); + emitExpressionWithPrefix(" = ", node.initializer); + emitWithPrefix(": ", node.type); + } + function emitDecorator(decorator) { + write("@"); + emitExpression(decorator.expression); + } + // + // Type members + // + function emitPropertySignature(node) { + emitDecorators(node, node.decorators); + emitModifiers(node, node.modifiers); + emit(node.name); + writeIfPresent(node.questionToken, "?"); + emitWithPrefix(": ", node.type); + write(";"); + } + function emitPropertyDeclaration(node) { + emitDecorators(node, node.decorators); + emitModifiers(node, node.modifiers); + emit(node.name); + emitWithPrefix(": ", node.type); + emitExpressionWithPrefix(" = ", node.initializer); + write(";"); + } + function emitMethodSignature(node) { + emitDecorators(node, node.decorators); + emitModifiers(node, node.modifiers); + emit(node.name); + writeIfPresent(node.questionToken, "?"); + emitTypeParameters(node, node.typeParameters); + emitParameters(node, node.parameters); + emitWithPrefix(": ", node.type); + write(";"); + } + function emitMethodDeclaration(node) { + emitDecorators(node, node.decorators); + emitModifiers(node, node.modifiers); + writeIfPresent(node.asteriskToken, "*"); + emit(node.name); + emitSignatureAndBody(node, emitSignatureHead); + } + function emitConstructor(node) { + emitModifiers(node, node.modifiers); + write("constructor"); + emitSignatureAndBody(node, emitSignatureHead); + } + function emitAccessorDeclaration(node) { + emitDecorators(node, node.decorators); + emitModifiers(node, node.modifiers); + write(node.kind === 151 /* GetAccessor */ ? "get " : "set "); + emit(node.name); + emitSignatureAndBody(node, emitSignatureHead); + } + function emitCallSignature(node) { + emitDecorators(node, node.decorators); + emitModifiers(node, node.modifiers); + emitTypeParameters(node, node.typeParameters); + emitParameters(node, node.parameters); + emitWithPrefix(": ", node.type); + write(";"); + } + function emitConstructSignature(node) { + emitDecorators(node, node.decorators); + emitModifiers(node, node.modifiers); + write("new "); + emitTypeParameters(node, node.typeParameters); + emitParameters(node, node.parameters); + emitWithPrefix(": ", node.type); + write(";"); + } + function emitIndexSignature(node) { + emitDecorators(node, node.decorators); + emitModifiers(node, node.modifiers); + emitParametersForIndexSignature(node, node.parameters); + emitWithPrefix(": ", node.type); + write(";"); + } + function emitSemicolonClassElement() { + write(";"); + } + // + // Types + // + function emitTypePredicate(node) { + emit(node.parameterName); + write(" is "); + emit(node.type); + } + function emitTypeReference(node) { + emit(node.typeName); + emitTypeArguments(node, node.typeArguments); + } + function emitFunctionType(node) { + emitTypeParameters(node, node.typeParameters); + emitParametersForArrow(node, node.parameters); + write(" => "); + emit(node.type); + } + function emitConstructorType(node) { + write("new "); + emitTypeParameters(node, node.typeParameters); + emitParametersForArrow(node, node.parameters); + write(" => "); + emit(node.type); + } + function emitTypeQuery(node) { + write("typeof "); + emit(node.exprName); + } + function emitTypeLiteral(node) { + write("{"); + emitList(node, node.members, 65 /* TypeLiteralMembers */); + write("}"); + } + function emitArrayType(node) { + emit(node.elementType); + write("[]"); + } + function emitTupleType(node) { + write("["); + emitList(node, node.elementTypes, 336 /* TupleTypeElements */); + write("]"); + } + function emitUnionType(node) { + emitList(node, node.types, 260 /* UnionTypeConstituents */); + } + function emitIntersectionType(node) { + emitList(node, node.types, 264 /* IntersectionTypeConstituents */); + } + function emitParenthesizedType(node) { + write("("); + emit(node.type); + write(")"); + } + function emitThisType() { + write("this"); + } + function emitTypeOperator(node) { + writeTokenText(node.operator); + write(" "); + emit(node.type); + } + function emitIndexedAccessType(node) { + emit(node.objectType); + write("["); + emit(node.indexType); + write("]"); + } + function emitMappedType(node) { + write("{"); + writeLine(); + increaseIndent(); + if (node.readonlyToken) { + write("readonly "); + } + write("["); + emit(node.typeParameter.name); + write(" in "); + emit(node.typeParameter.constraint); + write("]"); + if (node.questionToken) { + write("?"); + } + write(": "); + emit(node.type); + write(";"); + writeLine(); + decreaseIndent(); + write("}"); + } + function emitLiteralType(node) { + emitExpression(node.literal); + } + // + // Binding patterns + // + function emitObjectBindingPattern(node) { + var elements = node.elements; + if (elements.length === 0) { + write("{}"); + } + else { + write("{"); + emitList(node, elements, 432 /* ObjectBindingPatternElements */); + write("}"); + } + } + function emitArrayBindingPattern(node) { + var elements = node.elements; + if (elements.length === 0) { + write("[]"); + } + else { + write("["); + emitList(node, node.elements, 304 /* ArrayBindingPatternElements */); + write("]"); + } + } + function emitBindingElement(node) { + emitWithSuffix(node.propertyName, ": "); + writeIfPresent(node.dotDotDotToken, "..."); + emit(node.name); + emitExpressionWithPrefix(" = ", node.initializer); + } + // + // Expressions + // + function emitArrayLiteralExpression(node) { + var elements = node.elements; + if (elements.length === 0) { + write("[]"); + } + else { + var preferNewLine = node.multiLine ? 32768 /* PreferNewLine */ : 0 /* None */; + emitExpressionList(node, elements, 4466 /* ArrayLiteralExpressionElements */ | preferNewLine); + } + } + function emitObjectLiteralExpression(node) { + var properties = node.properties; + if (properties.length === 0) { + write("{}"); + } + else { + var indentedFlag = ts.getEmitFlags(node) & 32768 /* Indented */; + if (indentedFlag) { + increaseIndent(); + } + var preferNewLine = node.multiLine ? 32768 /* PreferNewLine */ : 0 /* None */; + var allowTrailingComma = languageVersion >= 1 /* ES5 */ ? 32 /* AllowTrailingComma */ : 0 /* None */; + emitList(node, properties, 978 /* ObjectLiteralExpressionProperties */ | allowTrailingComma | preferNewLine); + if (indentedFlag) { + decreaseIndent(); + } + } + } + function emitPropertyAccessExpression(node) { + var indentBeforeDot = false; + var indentAfterDot = false; + 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 }; + indentBeforeDot = needsIndentation(node, node.expression, dotToken); + indentAfterDot = needsIndentation(node, dotToken, node.name); + } + emitExpression(node.expression); + increaseIndentIf(indentBeforeDot); + var shouldEmitDotDot = !indentBeforeDot && needsDotDotForPropertyAccess(node.expression); + write(shouldEmitDotDot ? ".." : "."); + increaseIndentIf(indentAfterDot); + emit(node.name); + decreaseIndentIf(indentBeforeDot, indentAfterDot); + } + // 1..toString is a valid property access, emit a dot after the literal + // Also emit a dot if expression is a integer const enum value - it will appear in generated code as numeric literal + function needsDotDotForPropertyAccess(expression) { + if (expression.kind === 8 /* NumericLiteral */) { + // check if numeric literal was originally written with a dot + var text = getLiteralTextOfNode(expression); + return text.indexOf(ts.tokenToString(22 /* DotToken */)) < 0; + } + else if (ts.isPropertyAccessExpression(expression) || ts.isElementAccessExpression(expression)) { + // check if constant enum value is integer + var constantValue = ts.getConstantValue(expression); + // isFinite handles cases when constantValue is undefined + return isFinite(constantValue) + && Math.floor(constantValue) === constantValue + && compilerOptions.removeComments; + } + } + function emitElementAccessExpression(node) { + emitExpression(node.expression); + write("["); + emitExpression(node.argumentExpression); + write("]"); + } + function emitCallExpression(node) { + emitExpression(node.expression); + emitTypeArguments(node, node.typeArguments); + emitExpressionList(node, node.arguments, 1296 /* CallExpressionArguments */); + } + function emitNewExpression(node) { + write("new "); + emitExpression(node.expression); + emitTypeArguments(node, node.typeArguments); + emitExpressionList(node, node.arguments, 9488 /* NewExpressionArguments */); + } + function emitTaggedTemplateExpression(node) { + emitExpression(node.tag); + write(" "); + emitExpression(node.template); + } + function emitTypeAssertionExpression(node) { + if (node.type) { + write("<"); + emit(node.type); + write(">"); + } + emitExpression(node.expression); + } + function emitParenthesizedExpression(node) { + write("("); + emitExpression(node.expression); + write(")"); + } + function emitFunctionExpression(node) { + emitFunctionDeclarationOrExpression(node); + } + function emitArrowFunction(node) { + emitDecorators(node, node.decorators); + emitModifiers(node, node.modifiers); + emitSignatureAndBody(node, emitArrowFunctionHead); + } + function emitArrowFunctionHead(node) { + emitTypeParameters(node, node.typeParameters); + emitParametersForArrow(node, node.parameters); + emitWithPrefix(": ", node.type); + write(" =>"); + } + function emitDeleteExpression(node) { + write("delete "); + emitExpression(node.expression); + } + function emitTypeOfExpression(node) { + write("typeof "); + emitExpression(node.expression); + } + function emitVoidExpression(node) { + write("void "); + emitExpression(node.expression); + } + function emitAwaitExpression(node) { + write("await "); + emitExpression(node.expression); + } + function emitPrefixUnaryExpression(node) { + writeTokenText(node.operator); + if (shouldEmitWhitespaceBeforeOperand(node)) { + write(" "); + } + emitExpression(node.operand); + } + function shouldEmitWhitespaceBeforeOperand(node) { + // In some cases, we need to emit a space between the operator and the operand. One obvious case + // is when the operator is an identifier, like delete or typeof. We also need to do this for plus + // and minus expressions in certain cases. Specifically, consider the following two cases (parens + // are just for clarity of exposition, and not part of the source code): + // + // (+(+1)) + // (+(++1)) + // + // We need to emit a space in both cases. In the first case, the absence of a space will make + // the resulting expression a prefix increment operation. And in the second, it will make the resulting + // expression a prefix increment whose operand is a plus expression - (++(+x)) + // The same is true of minus of course. + var operand = node.operand; + return operand.kind === 190 /* PrefixUnaryExpression */ + && ((node.operator === 36 /* PlusToken */ && (operand.operator === 36 /* PlusToken */ || operand.operator === 42 /* PlusPlusToken */)) + || (node.operator === 37 /* MinusToken */ && (operand.operator === 37 /* MinusToken */ || operand.operator === 43 /* MinusMinusToken */))); + } + function emitPostfixUnaryExpression(node) { + emitExpression(node.operand); + writeTokenText(node.operator); + } + function emitBinaryExpression(node) { + var isCommaOperator = node.operatorToken.kind !== 25 /* CommaToken */; + var indentBeforeOperator = needsIndentation(node, node.left, node.operatorToken); + var indentAfterOperator = needsIndentation(node, node.operatorToken, node.right); + emitExpression(node.left); + increaseIndentIf(indentBeforeOperator, isCommaOperator ? " " : undefined); + writeTokenText(node.operatorToken.kind); + increaseIndentIf(indentAfterOperator, " "); + emitExpression(node.right); + decreaseIndentIf(indentBeforeOperator, indentAfterOperator); + } + function emitConditionalExpression(node) { + var indentBeforeQuestion = needsIndentation(node, node.condition, node.questionToken); + var indentAfterQuestion = needsIndentation(node, node.questionToken, node.whenTrue); + var indentBeforeColon = needsIndentation(node, node.whenTrue, node.colonToken); + var indentAfterColon = needsIndentation(node, node.colonToken, node.whenFalse); + emitExpression(node.condition); + increaseIndentIf(indentBeforeQuestion, " "); + write("?"); + increaseIndentIf(indentAfterQuestion, " "); + emitExpression(node.whenTrue); + decreaseIndentIf(indentBeforeQuestion, indentAfterQuestion); + increaseIndentIf(indentBeforeColon, " "); + write(":"); + increaseIndentIf(indentAfterColon, " "); + emitExpression(node.whenFalse); + decreaseIndentIf(indentBeforeColon, indentAfterColon); + } + function emitTemplateExpression(node) { + emit(node.head); + emitList(node, node.templateSpans, 131072 /* TemplateExpressionSpans */); + } + function emitYieldExpression(node) { + write(node.asteriskToken ? "yield*" : "yield"); + emitExpressionWithPrefix(" ", node.expression); + } + function emitSpreadExpression(node) { + write("..."); + emitExpression(node.expression); + } + function emitClassExpression(node) { + emitClassDeclarationOrExpression(node); + } + function emitExpressionWithTypeArguments(node) { + emitExpression(node.expression); + emitTypeArguments(node, node.typeArguments); + } + function emitAsExpression(node) { + emitExpression(node.expression); + if (node.type) { + write(" as "); + emit(node.type); + } + } + function emitNonNullExpression(node) { + emitExpression(node.expression); + write("!"); + } + // + // Misc + // + function emitTemplateSpan(node) { + emitExpression(node.expression); + emit(node.literal); + } + // + // Statements + // + function emitBlock(node) { + if (isSingleLineEmptyBlock(node)) { + writeToken(16 /* OpenBraceToken */, node.pos, /*contextNode*/ node); + write(" "); + writeToken(17 /* CloseBraceToken */, node.statements.end, /*contextNode*/ node); + } + else { + writeToken(16 /* OpenBraceToken */, node.pos, /*contextNode*/ node); + emitBlockStatements(node); + writeToken(17 /* CloseBraceToken */, node.statements.end, /*contextNode*/ node); + } + } + function emitBlockStatements(node) { + if (ts.getEmitFlags(node) & 1 /* SingleLine */) { + emitList(node, node.statements, 384 /* SingleLineBlockStatements */); + } + else { + emitList(node, node.statements, 65 /* MultiLineBlockStatements */); + } + } + function emitVariableStatement(node) { + emitModifiers(node, node.modifiers); + emit(node.declarationList); + write(";"); + } + function emitEmptyStatement() { + write(";"); + } + function emitExpressionStatement(node) { + emitExpression(node.expression); + write(";"); + } + function emitIfStatement(node) { + var openParenPos = writeToken(89 /* IfKeyword */, node.pos, node); + write(" "); + writeToken(18 /* OpenParenToken */, openParenPos, node); + emitExpression(node.expression); + writeToken(19 /* CloseParenToken */, node.expression.end, node); + emitEmbeddedStatement(node, node.thenStatement); + if (node.elseStatement) { + writeLineOrSpace(node); + writeToken(81 /* ElseKeyword */, node.thenStatement.end, node); + if (node.elseStatement.kind === 208 /* IfStatement */) { + write(" "); + emit(node.elseStatement); + } + else { + emitEmbeddedStatement(node, node.elseStatement); + } + } + } + function emitDoStatement(node) { + write("do"); + emitEmbeddedStatement(node, node.statement); + if (ts.isBlock(node.statement)) { + write(" "); + } + else { + writeLineOrSpace(node); + } + write("while ("); + emitExpression(node.expression); + write(");"); + } + function emitWhileStatement(node) { + write("while ("); + emitExpression(node.expression); + write(")"); + emitEmbeddedStatement(node, node.statement); + } + function emitForStatement(node) { + var openParenPos = writeToken(87 /* ForKeyword */, node.pos); + write(" "); + writeToken(18 /* OpenParenToken */, openParenPos, /*contextNode*/ node); + emitForBinding(node.initializer); + write(";"); + emitExpressionWithPrefix(" ", node.condition); + write(";"); + emitExpressionWithPrefix(" ", node.incrementor); + write(")"); + emitEmbeddedStatement(node, node.statement); + } + function emitForInStatement(node) { + var openParenPos = writeToken(87 /* ForKeyword */, node.pos); + write(" "); + writeToken(18 /* OpenParenToken */, openParenPos); + emitForBinding(node.initializer); + write(" in "); + emitExpression(node.expression); + writeToken(19 /* CloseParenToken */, node.expression.end); + emitEmbeddedStatement(node, node.statement); + } + function emitForOfStatement(node) { + var openParenPos = writeToken(87 /* ForKeyword */, node.pos); + write(" "); + writeToken(18 /* OpenParenToken */, openParenPos); + emitForBinding(node.initializer); + write(" of "); + emitExpression(node.expression); + writeToken(19 /* CloseParenToken */, node.expression.end); + emitEmbeddedStatement(node, node.statement); + } + function emitForBinding(node) { + if (node !== undefined) { + if (node.kind === 224 /* VariableDeclarationList */) { + emit(node); + } + else { + emitExpression(node); + } + } + } + function emitContinueStatement(node) { + writeToken(76 /* ContinueKeyword */, node.pos); + emitWithPrefix(" ", node.label); + write(";"); + } + function emitBreakStatement(node) { + writeToken(71 /* BreakKeyword */, node.pos); + emitWithPrefix(" ", node.label); + write(";"); + } + function emitReturnStatement(node) { + writeToken(95 /* ReturnKeyword */, node.pos, /*contextNode*/ node); + emitExpressionWithPrefix(" ", node.expression); + write(";"); + } + function emitWithStatement(node) { + write("with ("); + emitExpression(node.expression); + write(")"); + emitEmbeddedStatement(node, node.statement); + } + function emitSwitchStatement(node) { + var openParenPos = writeToken(97 /* SwitchKeyword */, node.pos); + write(" "); + writeToken(18 /* OpenParenToken */, openParenPos); + emitExpression(node.expression); + writeToken(19 /* CloseParenToken */, node.expression.end); + write(" "); + emit(node.caseBlock); + } + function emitLabeledStatement(node) { + emit(node.label); + write(": "); + emit(node.statement); + } + function emitThrowStatement(node) { + write("throw"); + emitExpressionWithPrefix(" ", node.expression); + write(";"); + } + function emitTryStatement(node) { + write("try "); + emit(node.tryBlock); + if (node.catchClause) { + writeLineOrSpace(node); + emit(node.catchClause); + } + if (node.finallyBlock) { + writeLineOrSpace(node); + write("finally "); + emit(node.finallyBlock); + } + } + function emitDebuggerStatement(node) { + writeToken(77 /* DebuggerKeyword */, node.pos); + write(";"); + } + // + // Declarations + // + function emitVariableDeclaration(node) { + emit(node.name); + emitWithPrefix(": ", node.type); + emitExpressionWithPrefix(" = ", node.initializer); + } + function emitVariableDeclarationList(node) { + write(ts.isLet(node) ? "let " : ts.isConst(node) ? "const " : "var "); + emitList(node, node.declarations, 272 /* VariableDeclarationList */); + } + function emitFunctionDeclaration(node) { + emitFunctionDeclarationOrExpression(node); + } + function emitFunctionDeclarationOrExpression(node) { + emitDecorators(node, node.decorators); + emitModifiers(node, node.modifiers); + write(node.asteriskToken ? "function* " : "function "); + emitIdentifierName(node.name); + emitSignatureAndBody(node, emitSignatureHead); + } + function emitSignatureAndBody(node, emitSignatureHead) { + var body = node.body; + if (body) { + if (ts.isBlock(body)) { + var indentedFlag = ts.getEmitFlags(node) & 32768 /* Indented */; + if (indentedFlag) { + increaseIndent(); + } + if (ts.getEmitFlags(node) & 262144 /* ReuseTempVariableScope */) { + emitSignatureHead(node); + emitBlockFunctionBody(body); + } + else { + var savedTempFlags = tempFlags; + tempFlags = 0; + emitSignatureHead(node); + emitBlockFunctionBody(body); + tempFlags = savedTempFlags; + } + if (indentedFlag) { + decreaseIndent(); + } + } + else { + emitSignatureHead(node); + write(" "); + emitExpression(body); + } + } + else { + emitSignatureHead(node); + write(";"); + } + } + function emitSignatureHead(node) { + emitTypeParameters(node, node.typeParameters); + emitParameters(node, node.parameters); + emitWithPrefix(": ", node.type); + } + function shouldEmitBlockFunctionBodyOnSingleLine(body) { + // We must emit a function body as a single-line body in the following case: + // * The body has NodeEmitFlags.SingleLine specified. + // We must emit a function body as a multi-line body in the following cases: + // * 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) & 1 /* SingleLine */) { + return true; + } + if (body.multiLine) { + return false; + } + if (!ts.nodeIsSynthesized(body) && !ts.rangeIsOnSingleLine(body, currentSourceFile)) { + return false; + } + if (shouldWriteLeadingLineTerminator(body, body.statements, 2 /* PreserveLines */) + || shouldWriteClosingLineTerminator(body, body.statements, 2 /* PreserveLines */)) { + return false; + } + var previousStatement; + for (var _a = 0, _b = body.statements; _a < _b.length; _a++) { + var statement = _b[_a]; + if (shouldWriteSeparatingLineTerminator(previousStatement, statement, 2 /* PreserveLines */)) { + return false; + } + previousStatement = statement; + } + return true; + } + function emitBlockFunctionBody(body) { + write(" {"); + increaseIndent(); + emitBodyWithDetachedComments(body, body.statements, shouldEmitBlockFunctionBodyOnSingleLine(body) + ? emitBlockFunctionBodyOnSingleLine + : emitBlockFunctionBodyWorker); + decreaseIndent(); + writeToken(17 /* CloseBraceToken */, body.statements.end, body); + } + function emitBlockFunctionBodyOnSingleLine(body) { + emitBlockFunctionBodyWorker(body, /*emitBlockFunctionBodyOnSingleLine*/ true); + } + function emitBlockFunctionBodyWorker(body, emitBlockFunctionBodyOnSingleLine) { + // Emit all the prologue directives (like "use strict"). + var statementOffset = emitPrologueDirectives(body.statements, /*startWithNewLine*/ true); + var helpersEmitted = emitHelpers(body); + if (statementOffset === 0 && !helpersEmitted && emitBlockFunctionBodyOnSingleLine) { + decreaseIndent(); + emitList(body, body.statements, 384 /* SingleLineFunctionBodyStatements */); + increaseIndent(); + } + else { + emitList(body, body.statements, 1 /* MultiLineFunctionBodyStatements */, statementOffset); + } + } + function emitClassDeclaration(node) { + emitClassDeclarationOrExpression(node); + } + function emitClassDeclarationOrExpression(node) { + emitDecorators(node, node.decorators); + emitModifiers(node, node.modifiers); + write("class"); + emitNodeWithPrefix(" ", node.name, emitIdentifierName); + var indentedFlag = ts.getEmitFlags(node) & 32768 /* Indented */; + if (indentedFlag) { + increaseIndent(); + } + emitTypeParameters(node, node.typeParameters); + emitList(node, node.heritageClauses, 256 /* ClassHeritageClauses */); + var savedTempFlags = tempFlags; + tempFlags = 0; + write(" {"); + emitList(node, node.members, 65 /* ClassMembers */); + write("}"); + if (indentedFlag) { + decreaseIndent(); + } + tempFlags = savedTempFlags; + } + function emitInterfaceDeclaration(node) { + emitDecorators(node, node.decorators); + emitModifiers(node, node.modifiers); + write("interface "); + emit(node.name); + emitTypeParameters(node, node.typeParameters); + emitList(node, node.heritageClauses, 256 /* HeritageClauses */); + write(" {"); + emitList(node, node.members, 65 /* InterfaceMembers */); + write("}"); + } + function emitTypeAliasDeclaration(node) { + emitDecorators(node, node.decorators); + emitModifiers(node, node.modifiers); + write("type "); + emit(node.name); + emitTypeParameters(node, node.typeParameters); + write(" = "); + emit(node.type); + write(";"); + } + function emitEnumDeclaration(node) { + emitModifiers(node, node.modifiers); + write("enum "); + emit(node.name); + var savedTempFlags = tempFlags; + tempFlags = 0; + write(" {"); + emitList(node, node.members, 81 /* EnumMembers */); + write("}"); + tempFlags = savedTempFlags; + } + function emitModuleDeclaration(node) { + emitModifiers(node, node.modifiers); + write(node.flags & 16 /* Namespace */ ? "namespace " : "module "); + emit(node.name); + var body = node.body; + while (body.kind === 230 /* ModuleDeclaration */) { + write("."); + emit(body.name); + body = body.body; + } + write(" "); + emit(body); + } + function emitModuleBlock(node) { + if (isEmptyBlock(node)) { + write("{ }"); + } + else { + var savedTempFlags = tempFlags; + tempFlags = 0; + write("{"); + increaseIndent(); + emitBlockStatements(node); + write("}"); + tempFlags = savedTempFlags; + } + } + function emitCaseBlock(node) { + writeToken(16 /* OpenBraceToken */, node.pos); + emitList(node, node.clauses, 65 /* CaseBlockClauses */); + writeToken(17 /* CloseBraceToken */, node.clauses.end); + } + function emitImportEqualsDeclaration(node) { + emitModifiers(node, node.modifiers); + write("import "); + emit(node.name); + write(" = "); + emitModuleReference(node.moduleReference); + write(";"); + } + function emitModuleReference(node) { + if (node.kind === 70 /* Identifier */) { + emitExpression(node); + } + else { + emit(node); + } + } + function emitImportDeclaration(node) { + emitModifiers(node, node.modifiers); + write("import "); + if (node.importClause) { + emit(node.importClause); + write(" from "); + } + emitExpression(node.moduleSpecifier); + write(";"); + } + function emitImportClause(node) { + emit(node.name); + if (node.name && node.namedBindings) { + write(", "); + } + emit(node.namedBindings); + } + function emitNamespaceImport(node) { + write("* as "); + emit(node.name); + } + function emitNamedImports(node) { + emitNamedImportsOrExports(node); + } + function emitImportSpecifier(node) { + emitImportOrExportSpecifier(node); + } + function emitExportAssignment(node) { + write(node.isExportEquals ? "export = " : "export default "); + emitExpression(node.expression); + write(";"); + } + function emitExportDeclaration(node) { + write("export "); + if (node.exportClause) { + emit(node.exportClause); + } + else { + write("*"); + } + if (node.moduleSpecifier) { + write(" from "); + emitExpression(node.moduleSpecifier); + } + write(";"); + } + function emitNamedExports(node) { + emitNamedImportsOrExports(node); + } + function emitExportSpecifier(node) { + emitImportOrExportSpecifier(node); + } + function emitNamedImportsOrExports(node) { + write("{"); + emitList(node, node.elements, 432 /* NamedImportsOrExportsElements */); + write("}"); + } + function emitImportOrExportSpecifier(node) { + if (node.propertyName) { + emit(node.propertyName); + write(" as "); + } + emit(node.name); + } + // + // Module references + // + function emitExternalModuleReference(node) { + write("require("); + emitExpression(node.expression); + write(")"); + } + // + // JSX + // + function emitJsxElement(node) { + emit(node.openingElement); + emitList(node, node.children, 131072 /* JsxElementChildren */); + emit(node.closingElement); + } + function emitJsxSelfClosingElement(node) { + write("<"); + emitJsxTagName(node.tagName); + write(" "); + emitList(node, node.attributes, 131328 /* JsxElementAttributes */); + write("/>"); + } + function emitJsxOpeningElement(node) { + write("<"); + emitJsxTagName(node.tagName); + writeIfAny(node.attributes, " "); + emitList(node, node.attributes, 131328 /* JsxElementAttributes */); + write(">"); + } + function emitJsxText(node) { + writer.writeLiteral(getTextOfNode(node, /*includeTrivia*/ true)); + } + function emitJsxClosingElement(node) { + write(""); + } + function emitJsxAttribute(node) { + emit(node.name); + emitWithPrefix("=", node.initializer); + } + function emitJsxSpreadAttribute(node) { + write("{..."); + emitExpression(node.expression); + write("}"); + } + function emitJsxExpression(node) { + if (node.expression) { + write("{"); + emitExpression(node.expression); + write("}"); + } + } + function emitJsxTagName(node) { + if (node.kind === 70 /* Identifier */) { + emitExpression(node); + } + else { + emit(node); + } + } + // + // Clauses + // + function emitCaseClause(node) { + write("case "); + emitExpression(node.expression); + write(":"); + emitCaseOrDefaultClauseStatements(node, node.statements); + } + function emitDefaultClause(node) { + write("default:"); + emitCaseOrDefaultClauseStatements(node, node.statements); + } + function emitCaseOrDefaultClauseStatements(parentNode, statements) { + var emitAsSingleStatement = statements.length === 1 && + ( + // treat synthesized nodes as located on the same line for emit purposes + ts.nodeIsSynthesized(parentNode) || + ts.nodeIsSynthesized(statements[0]) || + ts.rangeStartPositionsAreOnSameLine(parentNode, statements[0], currentSourceFile)); + if (emitAsSingleStatement) { + write(" "); + emit(statements[0]); + } + else { + emitList(parentNode, statements, 81985 /* CaseOrDefaultClauseStatements */); + } + } + function emitHeritageClause(node) { + write(" "); + writeTokenText(node.token); + write(" "); + emitList(node, node.types, 272 /* HeritageClauseTypes */); + } + function emitCatchClause(node) { + writeLine(); + var openParenPos = writeToken(73 /* CatchKeyword */, node.pos); + write(" "); + writeToken(18 /* OpenParenToken */, openParenPos); + emit(node.variableDeclaration); + writeToken(19 /* CloseParenToken */, node.variableDeclaration ? node.variableDeclaration.end : openParenPos); + write(" "); + emit(node.block); + } + // + // Property assignments + // + function emitPropertyAssignment(node) { + emit(node.name); + write(": "); + // This is to ensure that we emit comment in the following case: + // For example: + // obj = { + // id: /*comment1*/ ()=>void + // } + // "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) & 512 /* NoLeadingComments */) === 0) { + var commentRange = ts.getCommentRange(initializer); + emitTrailingCommentsOfPosition(commentRange.pos); + } + emitExpression(initializer); + } + function emitShorthandPropertyAssignment(node) { + emit(node.name); + if (node.objectAssignmentInitializer) { + write(" = "); + emitExpression(node.objectAssignmentInitializer); + } + } + function emitSpreadAssignment(node) { + if (node.expression) { + write("..."); + emitExpression(node.expression); + } + } + // + // Enum + // + function emitEnumMember(node) { + emit(node.name); + emitExpressionWithPrefix(" = ", node.initializer); + } + // + // Top-level nodes + // + function emitSourceFile(node) { + writeLine(); + emitShebang(); + emitBodyWithDetachedComments(node, node.statements, emitSourceFileWorker); + } + function emitSourceFileWorker(node) { + var statements = node.statements; + var statementOffset = emitPrologueDirectives(statements); + var savedTempFlags = tempFlags; + tempFlags = 0; + emitHelpers(node); + emitList(node, statements, 1 /* MultiLine */, statementOffset); + tempFlags = savedTempFlags; + } + // Transformation nodes + function emitPartiallyEmittedExpression(node) { + emitExpression(node.expression); + } + /** + * Emits any prologue directives at the start of a Statement list, returning the + * number of prologue directives written to the output. + */ + function emitPrologueDirectives(statements, startWithNewLine) { + for (var i = 0; i < statements.length; i++) { + if (ts.isPrologueDirective(statements[i])) { + if (startWithNewLine || i > 0) { + writeLine(); + } + emit(statements[i]); + } + else { + // return index of the first non prologue directive + return i; + } + } + return statements.length; + } + 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; + 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; + } + } + if (helpersEmitted) { + writeLine(); + } + return helpersEmitted; + } + function writeLines(text) { + var lines = text.split(/\r\n?|\n/g); + var indentation = guessIndentation(lines); + for (var i = 0; i < lines.length; i++) { + var line = indentation ? lines[i].slice(indentation) : lines[i]; + if (line.length) { + if (i > 0) { + writeLine(); + } + write(line); + } + } + } + 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 + // + function emitShebang() { + var shebang = ts.getShebang(currentText); + if (shebang) { + write(shebang); + writeLine(); + } + } + function emitModifiers(node, modifiers) { + if (modifiers && modifiers.length) { + emitList(node, modifiers, 256 /* Modifiers */); + write(" "); + } + } + function emitWithPrefix(prefix, node) { + emitNodeWithPrefix(prefix, node, emit); + } + function emitExpressionWithPrefix(prefix, node) { + emitNodeWithPrefix(prefix, node, emitExpression); + } + function emitNodeWithPrefix(prefix, node, emit) { + if (node) { + write(prefix); + emit(node); + } + } + function emitWithSuffix(node, suffix) { + if (node) { + emit(node); + write(suffix); + } + } + function emitEmbeddedStatement(parent, node) { + if (ts.isBlock(node) || ts.getEmitFlags(parent) & 1 /* SingleLine */) { + write(" "); + emit(node); + } + else { + writeLine(); + increaseIndent(); + emit(node); + decreaseIndent(); + } + } + function emitDecorators(parentNode, decorators) { + emitList(parentNode, decorators, 24577 /* Decorators */); + } + function emitTypeArguments(parentNode, typeArguments) { + emitList(parentNode, typeArguments, 26960 /* TypeArguments */); + } + function emitTypeParameters(parentNode, typeParameters) { + emitList(parentNode, typeParameters, 26960 /* TypeParameters */); + } + function emitParameters(parentNode, parameters) { + emitList(parentNode, parameters, 1360 /* Parameters */); + } + function emitParametersForArrow(parentNode, parameters) { + if (parameters && + parameters.length === 1 && + parameters[0].type === undefined && + parameters[0].pos === parentNode.pos) { + emit(parameters[0]); + } + else { + emitParameters(parentNode, parameters); + } + } + function emitParametersForIndexSignature(parentNode, parameters) { + emitList(parentNode, parameters, 4432 /* IndexSignatureParameters */); + } + function emitList(parentNode, children, format, start, count) { + emitNodeList(emit, parentNode, children, format, start, count); + } + function emitExpressionList(parentNode, children, format, start, count) { + emitNodeList(emitExpression, parentNode, children, format, start, count); + } + function emitNodeList(emit, parentNode, children, format, start, count) { + if (start === void 0) { start = 0; } + if (count === void 0) { count = children ? children.length - start : 0; } + var isUndefined = children === undefined; + if (isUndefined && format & 8192 /* OptionalIfUndefined */) { + return; + } + var isEmpty = isUndefined || children.length === 0 || start >= children.length || count === 0; + if (isEmpty && format & 16384 /* OptionalIfEmpty */) { + return; + } + if (format & 7680 /* BracketsMask */) { + write(getOpeningBracket(format)); + } + if (isEmpty) { + // Write a line terminator if the parent node was multi-line + if (format & 1 /* MultiLine */) { + writeLine(); + } + else if (format & 128 /* SpaceBetweenBraces */) { + write(" "); + } + } + else { + // Write the opening line terminator or leading whitespace. + var mayEmitInterveningComments = (format & 131072 /* NoInterveningComments */) === 0; + var shouldEmitInterveningComments = mayEmitInterveningComments; + if (shouldWriteLeadingLineTerminator(parentNode, children, format)) { + writeLine(); + shouldEmitInterveningComments = false; + } + else if (format & 128 /* SpaceBetweenBraces */) { + write(" "); + } + // Increase the indent, if requested. + if (format & 64 /* Indented */) { + increaseIndent(); + } + // Emit each child. + var previousSibling = void 0; + var shouldDecreaseIndentAfterEmit = void 0; + var delimiter = getDelimiter(format); + for (var i = 0; i < count; i++) { + var child = children[start + i]; + // Write the delimiter if this is not the first node. + if (previousSibling) { + write(delimiter); + // Write either a line terminator or whitespace to separate the elements. + if (shouldWriteSeparatingLineTerminator(previousSibling, child, format)) { + // If a synthesized node in a single-line list starts on a new + // line, we should increase the indent. + if ((format & (3 /* LinesMask */ | 64 /* Indented */)) === 0 /* SingleLine */) { + increaseIndent(); + shouldDecreaseIndentAfterEmit = true; + } + writeLine(); + shouldEmitInterveningComments = false; + } + else if (previousSibling && format & 256 /* SpaceBetweenSiblings */) { + write(" "); + } + } + if (shouldEmitInterveningComments) { + var commentRange = ts.getCommentRange(child); + emitTrailingCommentsOfPosition(commentRange.pos); + } + else { + shouldEmitInterveningComments = mayEmitInterveningComments; + } + // Emit this child. + emit(child); + if (shouldDecreaseIndentAfterEmit) { + decreaseIndent(); + shouldDecreaseIndentAfterEmit = false; + } + previousSibling = child; + } + // Write a trailing comma, if requested. + var hasTrailingComma = (format & 32 /* AllowTrailingComma */) && children.hasTrailingComma; + if (format & 16 /* CommaDelimited */ && hasTrailingComma) { + write(","); + } + // Decrease the indent, if requested. + if (format & 64 /* Indented */) { + decreaseIndent(); + } + // Write the closing line terminator or closing whitespace. + if (shouldWriteClosingLineTerminator(parentNode, children, format)) { + writeLine(); + } + else if (format & 128 /* SpaceBetweenBraces */) { + write(" "); + } + } + if (format & 7680 /* BracketsMask */) { + write(getClosingBracket(format)); + } + } + function writeLineOrSpace(node) { + if (ts.getEmitFlags(node) & 1 /* SingleLine */) { + write(" "); + } + else { + writeLine(); + } + } + function writeIfAny(nodes, text) { + if (nodes && nodes.length > 0) { + write(text); + } + } + function writeIfPresent(node, text) { + if (node !== undefined) { + write(text); + } + } + function writeToken(token, pos, contextNode) { + return emitTokenWithSourceMap(contextNode, token, pos, writeTokenText); + } + function writeTokenText(token, pos) { + var tokenString = ts.tokenToString(token); + write(tokenString); + return pos < 0 ? pos : pos + tokenString.length; + } + function increaseIndentIf(value, valueToWriteWhenNotIndenting) { + if (value) { + increaseIndent(); + writeLine(); + } + else if (valueToWriteWhenNotIndenting) { + write(valueToWriteWhenNotIndenting); + } + } + // Helper function to decrease the indent if we previously indented. Allows multiple + // previous indent values to be considered at a time. This also allows caller to just + // call this once, passing in all their appropriate indent values, instead of needing + // to call this helper function multiple times. + function decreaseIndentIf(value1, value2) { + if (value1) { + decreaseIndent(); + } + if (value2) { + decreaseIndent(); + } + } + function shouldWriteLeadingLineTerminator(parentNode, children, format) { + if (format & 1 /* MultiLine */) { + return true; + } + if (format & 2 /* PreserveLines */) { + if (format & 32768 /* PreferNewLine */) { + return true; + } + var firstChild = children[0]; + if (firstChild === undefined) { + return !ts.rangeIsOnSingleLine(parentNode, currentSourceFile); + } + else if (ts.positionIsSynthesized(parentNode.pos) || ts.nodeIsSynthesized(firstChild)) { + return synthesizedNodeStartsOnNewLine(firstChild, format); + } + else { + return !ts.rangeStartPositionsAreOnSameLine(parentNode, firstChild, currentSourceFile); + } + } + else { + return false; + } + } + function shouldWriteSeparatingLineTerminator(previousNode, nextNode, format) { + if (format & 1 /* MultiLine */) { + return true; + } + else if (format & 2 /* PreserveLines */) { + if (previousNode === undefined || nextNode === undefined) { + return false; + } + else if (ts.nodeIsSynthesized(previousNode) || ts.nodeIsSynthesized(nextNode)) { + return synthesizedNodeStartsOnNewLine(previousNode, format) || synthesizedNodeStartsOnNewLine(nextNode, format); + } + else { + return !ts.rangeEndIsOnSameLineAsRangeStart(previousNode, nextNode, currentSourceFile); + } + } + else { + return nextNode.startsOnNewLine; + } + } + function shouldWriteClosingLineTerminator(parentNode, children, format) { + if (format & 1 /* MultiLine */) { + return (format & 65536 /* NoTrailingNewLine */) === 0; + } + else if (format & 2 /* PreserveLines */) { + if (format & 32768 /* PreferNewLine */) { + return true; + } + var lastChild = ts.lastOrUndefined(children); + if (lastChild === undefined) { + return !ts.rangeIsOnSingleLine(parentNode, currentSourceFile); + } + else if (ts.positionIsSynthesized(parentNode.pos) || ts.nodeIsSynthesized(lastChild)) { + return synthesizedNodeStartsOnNewLine(lastChild, format); + } + else { + return !ts.rangeEndPositionsAreOnSameLine(parentNode, lastChild, currentSourceFile); + } + } + else { + return false; + } + } + function synthesizedNodeStartsOnNewLine(node, format) { + if (ts.nodeIsSynthesized(node)) { + var startsOnNewLine = node.startsOnNewLine; + if (startsOnNewLine === undefined) { + return (format & 32768 /* PreferNewLine */) !== 0; + } + return startsOnNewLine; + } + return (format & 32768 /* PreferNewLine */) !== 0; + } + function needsIndentation(parent, node1, node2) { + parent = skipSynthesizedParentheses(parent); + node1 = skipSynthesizedParentheses(node1); + node2 = skipSynthesizedParentheses(node2); + // Always use a newline for synthesized code if the synthesizer desires it. + if (node2.startsOnNewLine) { + return true; + } + return !ts.nodeIsSynthesized(parent) + && !ts.nodeIsSynthesized(node1) + && !ts.nodeIsSynthesized(node2) + && !ts.rangeEndIsOnSameLineAsRangeStart(node1, node2, currentSourceFile); + } + function skipSynthesizedParentheses(node) { + while (node.kind === 183 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { + node = node.expression; + } + return node; + } + function getTextOfNode(node, includeTrivia) { + if (ts.isGeneratedIdentifier(node)) { + return getGeneratedIdentifier(node); + } + else if (ts.isIdentifier(node) && (ts.nodeIsSynthesized(node) || !node.parent)) { + return ts.unescapeIdentifier(node.text); + } + else if (node.kind === 9 /* StringLiteral */ && node.textSourceNode) { + return getTextOfNode(node.textSourceNode, includeTrivia); + } + else if (ts.isLiteralExpression(node) && (ts.nodeIsSynthesized(node) || !node.parent)) { + return node.text; + } + return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node, includeTrivia); + } + function getLiteralTextOfNode(node) { + if (node.kind === 9 /* StringLiteral */ && node.textSourceNode) { + var textSourceNode = node.textSourceNode; + if (ts.isIdentifier(textSourceNode)) { + return "\"" + ts.escapeNonAsciiCharacters(ts.escapeString(getTextOfNode(textSourceNode))) + "\""; + } + else { + return getLiteralTextOfNode(textSourceNode); + } + } + return ts.getLiteralText(node, currentSourceFile, languageVersion); + } + function isSingleLineEmptyBlock(block) { + return !block.multiLine + && isEmptyBlock(block); + } + function isEmptyBlock(block) { + return block.statements.length === 0 + && ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile); + } + function isUniqueName(name) { + return !resolver.hasGlobalName(name) && + !ts.hasProperty(currentFileIdentifiers, name) && + !ts.hasProperty(generatedNameSet, name); + } + function isUniqueLocalName(name, container) { + for (var node = container; ts.isNodeDescendantOf(node, container); node = node.nextContainer) { + if (node.locals && ts.hasProperty(node.locals, name)) { + // We conservatively include alias symbols to cover cases where they're emitted as locals + if (node.locals[name].flags & (107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */)) { + return false; + } + } + } + return true; + } + /** + * Return the next available name in the pattern _a ... _z, _0, _1, ... + * TempFlags._i or TempFlags._n may be used to express a preference for that dedicated name. + * Note that names generated by makeTempVariableName and makeUniqueName will never conflict. + */ + function makeTempVariableName(flags) { + if (flags && !(tempFlags & flags)) { + var name_41 = flags === 268435456 /* _i */ ? "_i" : "_n"; + if (isUniqueName(name_41)) { + tempFlags |= flags; + return name_41; + } + } + while (true) { + var count = tempFlags & 268435455 /* CountMask */; + tempFlags++; + // Skip over 'i' and 'n' + if (count !== 8 && count !== 13) { + var name_42 = count < 26 + ? "_" + String.fromCharCode(97 /* a */ + count) + : "_" + (count - 26); + if (isUniqueName(name_42)) { + return name_42; + } + } + } + } + // Generate a name that is unique within the current file and doesn't conflict with any names + // in global scope. The name is formed by adding an '_n' suffix to the specified base name, + // where n is a positive integer. Note that names generated by makeTempVariableName and + // makeUniqueName are guaranteed to never conflict. + function makeUniqueName(baseName) { + // Find the first unique 'name_n', where n is a positive number + if (baseName.charCodeAt(baseName.length - 1) !== 95 /* _ */) { + baseName += "_"; + } + var i = 1; + while (true) { + var generatedName = baseName + i; + if (isUniqueName(generatedName)) { + return generatedNameSet[generatedName] = generatedName; + } + i++; + } + } + function generateNameForModuleOrEnum(node) { + var name = getTextOfNode(node.name); + // Use module/enum name itself if it is unique, otherwise make a unique variation + return isUniqueLocalName(name, node) ? name : makeUniqueName(name); + } + function generateNameForImportOrExportDeclaration(node) { + var expr = ts.getExternalModuleName(node); + var baseName = expr.kind === 9 /* StringLiteral */ ? + ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; + return makeUniqueName(baseName); + } + function generateNameForExportDefault() { + return makeUniqueName("default"); + } + function generateNameForClassExpression() { + return makeUniqueName("class"); + } + /** + * Generates a unique name from a node. + * + * @param node A node. + */ + function generateNameForNode(node) { + switch (node.kind) { + case 70 /* Identifier */: + return makeUniqueName(getTextOfNode(node)); + case 230 /* ModuleDeclaration */: + case 229 /* EnumDeclaration */: + return generateNameForModuleOrEnum(node); + case 235 /* ImportDeclaration */: + case 241 /* ExportDeclaration */: + return generateNameForImportOrExportDeclaration(node); + case 225 /* FunctionDeclaration */: + case 226 /* ClassDeclaration */: + case 240 /* ExportAssignment */: + return generateNameForExportDefault(); + case 197 /* ClassExpression */: + return generateNameForClassExpression(); + default: + return makeTempVariableName(0 /* Auto */); + } + } + /** + * Generates a unique identifier for a node. + * + * @param name A generated name. + */ + function generateName(name) { + switch (name.autoGenerateKind) { + case 1 /* Auto */: + return makeTempVariableName(0 /* Auto */); + case 2 /* Loop */: + return makeTempVariableName(268435456 /* _i */); + case 3 /* Unique */: + return makeUniqueName(name.text); + } + ts.Debug.fail("Unsupported GeneratedIdentifierKind."); + } + /** + * Gets the node from which a name should be generated. + * + * @param name A generated name wrapper. + */ + function getNodeForGeneratedName(name) { + var autoGenerateId = name.autoGenerateId; + var node = name; + var original = node.original; + while (original) { + node = original; + // if "node" is a different generated name (having a different + // "autoGenerateId"), use it and stop traversing. + if (ts.isIdentifier(node) + && node.autoGenerateKind === 4 /* Node */ + && node.autoGenerateId !== autoGenerateId) { + break; + } + original = node.original; + } + // otherwise, return the original node for the source; + return node; + } + /** + * Gets the generated identifier text from a generated identifier. + * + * @param name The generated identifier. + */ + function getGeneratedIdentifier(name) { + if (name.autoGenerateKind === 4 /* Node */) { + // Generated names generate unique names based on their original node + // and are cached based on that node's id + var node = getNodeForGeneratedName(name); + var nodeId = ts.getNodeId(node); + return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = ts.unescapeIdentifier(generateNameForNode(node))); + } + else { + // Auto, Loop, and Unique names are cached based on their unique + // autoGenerateId. + var autoGenerateId = name.autoGenerateId; + return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = ts.unescapeIdentifier(generateName(name))); + } + } + function createDelimiterMap() { + var delimiters = []; + delimiters[0 /* None */] = ""; + delimiters[16 /* CommaDelimited */] = ","; + delimiters[4 /* BarDelimited */] = " |"; + delimiters[8 /* AmpersandDelimited */] = " &"; + return delimiters; + } + function getDelimiter(format) { + return delimiters[format & 28 /* DelimitersMask */]; + } + function createBracketsMap() { + var brackets = []; + brackets[512 /* Braces */] = ["{", "}"]; + brackets[1024 /* Parenthesis */] = ["(", ")"]; + brackets[2048 /* AngleBrackets */] = ["<", ">"]; + brackets[4096 /* SquareBrackets */] = ["[", "]"]; + return brackets; + } + function getOpeningBracket(format) { + return brackets[format & 7680 /* BracketsMask */][0]; + } + function getClosingBracket(format) { + return brackets[format & 7680 /* BracketsMask */][1]; + } } ts.emitFiles = emitFiles; + var ListFormat; + (function (ListFormat) { + ListFormat[ListFormat["None"] = 0] = "None"; + // Line separators + ListFormat[ListFormat["SingleLine"] = 0] = "SingleLine"; + ListFormat[ListFormat["MultiLine"] = 1] = "MultiLine"; + ListFormat[ListFormat["PreserveLines"] = 2] = "PreserveLines"; + ListFormat[ListFormat["LinesMask"] = 3] = "LinesMask"; + // Delimiters + ListFormat[ListFormat["NotDelimited"] = 0] = "NotDelimited"; + ListFormat[ListFormat["BarDelimited"] = 4] = "BarDelimited"; + ListFormat[ListFormat["AmpersandDelimited"] = 8] = "AmpersandDelimited"; + ListFormat[ListFormat["CommaDelimited"] = 16] = "CommaDelimited"; + ListFormat[ListFormat["DelimitersMask"] = 28] = "DelimitersMask"; + ListFormat[ListFormat["AllowTrailingComma"] = 32] = "AllowTrailingComma"; + // Whitespace + ListFormat[ListFormat["Indented"] = 64] = "Indented"; + ListFormat[ListFormat["SpaceBetweenBraces"] = 128] = "SpaceBetweenBraces"; + ListFormat[ListFormat["SpaceBetweenSiblings"] = 256] = "SpaceBetweenSiblings"; + // Brackets/Braces + ListFormat[ListFormat["Braces"] = 512] = "Braces"; + ListFormat[ListFormat["Parenthesis"] = 1024] = "Parenthesis"; + ListFormat[ListFormat["AngleBrackets"] = 2048] = "AngleBrackets"; + ListFormat[ListFormat["SquareBrackets"] = 4096] = "SquareBrackets"; + ListFormat[ListFormat["BracketsMask"] = 7680] = "BracketsMask"; + ListFormat[ListFormat["OptionalIfUndefined"] = 8192] = "OptionalIfUndefined"; + ListFormat[ListFormat["OptionalIfEmpty"] = 16384] = "OptionalIfEmpty"; + ListFormat[ListFormat["Optional"] = 24576] = "Optional"; + // Other + ListFormat[ListFormat["PreferNewLine"] = 32768] = "PreferNewLine"; + ListFormat[ListFormat["NoTrailingNewLine"] = 65536] = "NoTrailingNewLine"; + ListFormat[ListFormat["NoInterveningComments"] = 131072] = "NoInterveningComments"; + // Precomputed Formats + ListFormat[ListFormat["Modifiers"] = 256] = "Modifiers"; + ListFormat[ListFormat["HeritageClauses"] = 256] = "HeritageClauses"; + ListFormat[ListFormat["TypeLiteralMembers"] = 65] = "TypeLiteralMembers"; + ListFormat[ListFormat["TupleTypeElements"] = 336] = "TupleTypeElements"; + ListFormat[ListFormat["UnionTypeConstituents"] = 260] = "UnionTypeConstituents"; + ListFormat[ListFormat["IntersectionTypeConstituents"] = 264] = "IntersectionTypeConstituents"; + ListFormat[ListFormat["ObjectBindingPatternElements"] = 432] = "ObjectBindingPatternElements"; + ListFormat[ListFormat["ArrayBindingPatternElements"] = 304] = "ArrayBindingPatternElements"; + ListFormat[ListFormat["ObjectLiteralExpressionProperties"] = 978] = "ObjectLiteralExpressionProperties"; + ListFormat[ListFormat["ArrayLiteralExpressionElements"] = 4466] = "ArrayLiteralExpressionElements"; + ListFormat[ListFormat["CallExpressionArguments"] = 1296] = "CallExpressionArguments"; + ListFormat[ListFormat["NewExpressionArguments"] = 9488] = "NewExpressionArguments"; + ListFormat[ListFormat["TemplateExpressionSpans"] = 131072] = "TemplateExpressionSpans"; + ListFormat[ListFormat["SingleLineBlockStatements"] = 384] = "SingleLineBlockStatements"; + ListFormat[ListFormat["MultiLineBlockStatements"] = 65] = "MultiLineBlockStatements"; + ListFormat[ListFormat["VariableDeclarationList"] = 272] = "VariableDeclarationList"; + ListFormat[ListFormat["SingleLineFunctionBodyStatements"] = 384] = "SingleLineFunctionBodyStatements"; + ListFormat[ListFormat["MultiLineFunctionBodyStatements"] = 1] = "MultiLineFunctionBodyStatements"; + ListFormat[ListFormat["ClassHeritageClauses"] = 256] = "ClassHeritageClauses"; + ListFormat[ListFormat["ClassMembers"] = 65] = "ClassMembers"; + ListFormat[ListFormat["InterfaceMembers"] = 65] = "InterfaceMembers"; + ListFormat[ListFormat["EnumMembers"] = 81] = "EnumMembers"; + ListFormat[ListFormat["CaseBlockClauses"] = 65] = "CaseBlockClauses"; + ListFormat[ListFormat["NamedImportsOrExportsElements"] = 432] = "NamedImportsOrExportsElements"; + ListFormat[ListFormat["JsxElementChildren"] = 131072] = "JsxElementChildren"; + ListFormat[ListFormat["JsxElementAttributes"] = 131328] = "JsxElementAttributes"; + ListFormat[ListFormat["CaseOrDefaultClauseStatements"] = 81985] = "CaseOrDefaultClauseStatements"; + ListFormat[ListFormat["HeritageClauseTypes"] = 272] = "HeritageClauseTypes"; + ListFormat[ListFormat["SourceFileStatements"] = 65537] = "SourceFileStatements"; + ListFormat[ListFormat["Decorators"] = 24577] = "Decorators"; + ListFormat[ListFormat["TypeArguments"] = 26960] = "TypeArguments"; + ListFormat[ListFormat["TypeParameters"] = 26960] = "TypeParameters"; + ListFormat[ListFormat["Parameters"] = 1360] = "Parameters"; + ListFormat[ListFormat["IndexSignatureParameters"] = 4432] = "IndexSignatureParameters"; + })(ListFormat || (ListFormat = {})); })(ts || (ts = {})); /// /// /// var ts; (function (ts) { - /** The version of the TypeScript compiler release */ - ts.version = "2.0.3"; var emptyArray = []; - function findConfigFile(searchPath, fileExists) { + function findConfigFile(searchPath, fileExists, configName) { + if (configName === void 0) { configName = "tsconfig.json"; } while (true) { - var fileName = ts.combinePaths(searchPath, "tsconfig.json"); + var fileName = ts.combinePaths(searchPath, configName); if (fileExists(fileName)) { return fileName; } @@ -44033,694 +62376,6 @@ var ts; return ts.getNormalizedPathFromPathComponents(commonPathComponents); } ts.computeCommonSourceDirectoryOfFilenames = computeCommonSourceDirectoryOfFilenames; - function trace(host, message) { - host.trace(ts.formatMessage.apply(undefined, arguments)); - } - function isTraceEnabled(compilerOptions, host) { - return compilerOptions.traceResolution && host.trace !== undefined; - } - /* @internal */ - function hasZeroOrOneAsteriskCharacter(str) { - var seenAsterisk = false; - for (var i = 0; i < str.length; i++) { - if (str.charCodeAt(i) === 42 /* asterisk */) { - if (!seenAsterisk) { - seenAsterisk = true; - } - else { - // have already seen asterisk - return false; - } - } - } - return true; - } - ts.hasZeroOrOneAsteriskCharacter = hasZeroOrOneAsteriskCharacter; - function createResolvedModule(resolvedFileName, isExternalLibraryImport, failedLookupLocations) { - return { resolvedModule: resolvedFileName ? { resolvedFileName: resolvedFileName, isExternalLibraryImport: isExternalLibraryImport } : undefined, failedLookupLocations: failedLookupLocations }; - } - function moduleHasNonRelativeName(moduleName) { - return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName)); - } - function tryReadTypesSection(packageJsonPath, baseDirectory, state) { - var jsonContent = readJson(packageJsonPath, state.host); - function tryReadFromField(fieldName) { - if (ts.hasProperty(jsonContent, fieldName)) { - var typesFile = jsonContent[fieldName]; - if (typeof typesFile === "string") { - var typesFilePath_1 = ts.normalizePath(ts.combinePaths(baseDirectory, typesFile)); - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, typesFile, typesFilePath_1); - } - return typesFilePath_1; - } - else { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, fieldName, typeof typesFile); - } - } - } - } - var typesFilePath = tryReadFromField("typings") || tryReadFromField("types"); - if (typesFilePath) { - return typesFilePath; - } - // Use the main module for inferring types if no types package specified and the allowJs is set - if (state.compilerOptions.allowJs && jsonContent.main && typeof jsonContent.main === "string") { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.No_types_specified_in_package_json_but_allowJs_is_set_so_returning_main_value_of_0, jsonContent.main); - } - var mainFilePath = ts.normalizePath(ts.combinePaths(baseDirectory, jsonContent.main)); - return mainFilePath; - } - return undefined; - } - function readJson(path, host) { - try { - var jsonText = host.readFile(path); - return jsonText ? JSON.parse(jsonText) : {}; - } - catch (e) { - // gracefully handle if readFile fails or returns not JSON - return {}; - } - } - var typeReferenceExtensions = [".d.ts"]; - function getEffectiveTypeRoots(options, host) { - if (options.typeRoots) { - return options.typeRoots; - } - var currentDirectory; - if (options.configFilePath) { - currentDirectory = ts.getDirectoryPath(options.configFilePath); - } - else if (host.getCurrentDirectory) { - currentDirectory = host.getCurrentDirectory(); - } - return currentDirectory && getDefaultTypeRoots(currentDirectory, host); - } - /** - * Returns the path to every node_modules/@types directory from some ancestor directory. - * Returns undefined if there are none. - */ - function getDefaultTypeRoots(currentDirectory, host) { - if (!host.directoryExists) { - return [ts.combinePaths(currentDirectory, nodeModulesAtTypes)]; - } - var typeRoots; - while (true) { - var atTypes = ts.combinePaths(currentDirectory, nodeModulesAtTypes); - if (host.directoryExists(atTypes)) { - (typeRoots || (typeRoots = [])).push(atTypes); - } - var parent_15 = ts.getDirectoryPath(currentDirectory); - if (parent_15 === currentDirectory) { - break; - } - currentDirectory = parent_15; - } - return typeRoots; - } - var nodeModulesAtTypes = ts.combinePaths("node_modules", "@types"); - /** - * @param {string | undefined} containingFile - file that contains type reference directive, can be undefined if containing file is unknown. - * This is possible in case if resolution is performed for directives specified via 'types' parameter. In this case initial path for secondary lookups - * is assumed to be the same as root directory of the project. - */ - function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host) { - var traceEnabled = isTraceEnabled(options, host); - var moduleResolutionState = { - compilerOptions: options, - host: host, - skipTsx: true, - traceEnabled: traceEnabled - }; - var typeRoots = getEffectiveTypeRoots(options, host); - if (traceEnabled) { - if (containingFile === undefined) { - if (typeRoots === undefined) { - trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set, typeReferenceDirectiveName); - } - else { - trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1, typeReferenceDirectiveName, typeRoots); - } - } - else { - if (typeRoots === undefined) { - trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set, typeReferenceDirectiveName, containingFile); - } - else { - trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_2, typeReferenceDirectiveName, containingFile, typeRoots); - } - } - } - var failedLookupLocations = []; - // Check primary library paths - if (typeRoots && typeRoots.length) { - if (traceEnabled) { - trace(host, ts.Diagnostics.Resolving_with_primary_search_path_0, typeRoots.join(", ")); - } - var primarySearchPaths = typeRoots; - for (var _i = 0, primarySearchPaths_1 = primarySearchPaths; _i < primarySearchPaths_1.length; _i++) { - var typeRoot = primarySearchPaths_1[_i]; - var candidate = ts.combinePaths(typeRoot, typeReferenceDirectiveName); - var candidateDirectory = ts.getDirectoryPath(candidate); - var resolvedFile_1 = loadNodeModuleFromDirectory(typeReferenceExtensions, candidate, failedLookupLocations, !directoryProbablyExists(candidateDirectory, host), moduleResolutionState); - if (resolvedFile_1) { - if (traceEnabled) { - trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFile_1, true); - } - return { - resolvedTypeReferenceDirective: { primary: true, resolvedFileName: resolvedFile_1 }, - failedLookupLocations: failedLookupLocations - }; - } - } - } - else { - if (traceEnabled) { - trace(host, ts.Diagnostics.Root_directory_cannot_be_determined_skipping_primary_search_paths); - } - } - var resolvedFile; - var initialLocationForSecondaryLookup; - if (containingFile) { - initialLocationForSecondaryLookup = ts.getDirectoryPath(containingFile); - } - if (initialLocationForSecondaryLookup !== undefined) { - // check secondary locations - if (traceEnabled) { - trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup); - } - resolvedFile = loadModuleFromNodeModules(typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState); - if (traceEnabled) { - if (resolvedFile) { - trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFile, false); - } - else { - trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName); - } - } - } - else { - if (traceEnabled) { - trace(host, ts.Diagnostics.Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder); - } - } - return { - resolvedTypeReferenceDirective: resolvedFile - ? { primary: false, resolvedFileName: resolvedFile } - : undefined, - failedLookupLocations: failedLookupLocations - }; - } - ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective; - function resolveModuleName(moduleName, containingFile, compilerOptions, host) { - var traceEnabled = isTraceEnabled(compilerOptions, host); - if (traceEnabled) { - trace(host, ts.Diagnostics.Resolving_module_0_from_1, moduleName, containingFile); - } - var moduleResolution = compilerOptions.moduleResolution; - if (moduleResolution === undefined) { - moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; - if (traceEnabled) { - trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); - } - } - else { - if (traceEnabled) { - trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); - } - } - var result; - switch (moduleResolution) { - case ts.ModuleResolutionKind.NodeJs: - result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host); - break; - case ts.ModuleResolutionKind.Classic: - result = classicNameResolver(moduleName, containingFile, compilerOptions, host); - break; - } - if (traceEnabled) { - if (result.resolvedModule) { - trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1, moduleName, result.resolvedModule.resolvedFileName); - } - else { - trace(host, ts.Diagnostics.Module_name_0_was_not_resolved, moduleName); - } - } - return result; - } - ts.resolveModuleName = resolveModuleName; - /** - * Any module resolution kind can be augmented with optional settings: 'baseUrl', 'paths' and 'rootDirs' - they are used to - * mitigate differences between design time structure of the project and its runtime counterpart so the same import name - * can be resolved successfully by TypeScript compiler and runtime module loader. - * If these settings are set then loading procedure will try to use them to resolve module name and it can of failure it will - * fallback to standard resolution routine. - * - * - baseUrl - this setting controls how non-relative module names are resolved. If this setting is specified then non-relative - * names will be resolved relative to baseUrl: i.e. if baseUrl is '/a/b' then candidate location to resolve module name 'c/d' will - * be '/a/b/c/d' - * - paths - this setting can only be used when baseUrl is specified. allows to tune how non-relative module names - * will be resolved based on the content of the module name. - * Structure of 'paths' compiler options - * 'paths': { - * pattern-1: [...substitutions], - * pattern-2: [...substitutions], - * ... - * pattern-n: [...substitutions] - * } - * Pattern here is a string that can contain zero or one '*' character. During module resolution module name will be matched against - * all patterns in the list. Matching for patterns that don't contain '*' means that module name must be equal to pattern respecting the case. - * If pattern contains '*' then to match pattern "*" module name must start with the and end with . - * denotes part of the module name between and . - * If module name can be matches with multiple patterns then pattern with the longest prefix will be picked. - * After selecting pattern we'll use list of substitutions to get candidate locations of the module and the try to load module - * from the candidate location. - * Substitution is a string that can contain zero or one '*'. To get candidate location from substitution we'll pick every - * substitution in the list and replace '*' with string. If candidate location is not rooted it - * will be converted to absolute using baseUrl. - * For example: - * baseUrl: /a/b/c - * "paths": { - * // match all module names - * "*": [ - * "*", // use matched name as is, - * // will be looked as /a/b/c/ - * - * "folder1/*" // substitution will convert matched name to 'folder1/', - * // since it is not rooted then final candidate location will be /a/b/c/folder1/ - * ], - * // match module names that start with 'components/' - * "components/*": [ "/root/components/*" ] // substitution will convert /components/folder1/ to '/root/components/folder1/', - * // it is rooted so it will be final candidate location - * } - * - * 'rootDirs' allows the project to be spreaded across multiple locations and resolve modules with relative names as if - * they were in the same location. For example lets say there are two files - * '/local/src/content/file1.ts' - * '/shared/components/contracts/src/content/protocols/file2.ts' - * After bundling content of '/shared/components/contracts/src' will be merged with '/local/src' so - * if file1 has the following import 'import {x} from "./protocols/file2"' it will be resolved successfully in runtime. - * 'rootDirs' provides the way to tell compiler that in order to get the whole project it should behave as if content of all - * root dirs were merged together. - * I.e. for the example above 'rootDirs' will have two entries: [ '/local/src', '/shared/components/contracts/src' ]. - * Compiler will first convert './protocols/file2' into absolute path relative to the location of containing file: - * '/local/src/content/protocols/file2' and try to load it - failure. - * Then it will search 'rootDirs' looking for a longest matching prefix of this absolute path and if such prefix is found - absolute path will - * be converted to a path relative to found rootDir entry './content/protocols/file2' (*). As a last step compiler will check all remaining - * entries in 'rootDirs', use them to build absolute path out of (*) and try to resolve module from this location. - */ - function tryLoadModuleUsingOptionalResolutionSettings(moduleName, containingDirectory, loader, failedLookupLocations, supportedExtensions, state) { - if (moduleHasNonRelativeName(moduleName)) { - return tryLoadModuleUsingBaseUrl(moduleName, loader, failedLookupLocations, supportedExtensions, state); - } - else { - return tryLoadModuleUsingRootDirs(moduleName, containingDirectory, loader, failedLookupLocations, supportedExtensions, state); - } - } - function tryLoadModuleUsingRootDirs(moduleName, containingDirectory, loader, failedLookupLocations, supportedExtensions, state) { - if (!state.compilerOptions.rootDirs) { - return undefined; - } - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0, moduleName); - } - var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - var matchedRootDir; - var matchedNormalizedPrefix; - for (var _i = 0, _a = state.compilerOptions.rootDirs; _i < _a.length; _i++) { - var rootDir = _a[_i]; - // rootDirs are expected to be absolute - // in case of tsconfig.json this will happen automatically - compiler will expand relative names - // using location of tsconfig.json as base location - var normalizedRoot = ts.normalizePath(rootDir); - if (!ts.endsWith(normalizedRoot, ts.directorySeparator)) { - normalizedRoot += ts.directorySeparator; - } - var isLongestMatchingPrefix = ts.startsWith(candidate, normalizedRoot) && - (matchedNormalizedPrefix === undefined || matchedNormalizedPrefix.length < normalizedRoot.length); - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Checking_if_0_is_the_longest_matching_prefix_for_1_2, normalizedRoot, candidate, isLongestMatchingPrefix); - } - if (isLongestMatchingPrefix) { - matchedNormalizedPrefix = normalizedRoot; - matchedRootDir = rootDir; - } - } - if (matchedNormalizedPrefix) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Longest_matching_prefix_for_0_is_1, candidate, matchedNormalizedPrefix); - } - var suffix = candidate.substr(matchedNormalizedPrefix.length); - // first - try to load from a initial location - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, matchedNormalizedPrefix, candidate); - } - var resolvedFileName = loader(candidate, supportedExtensions, failedLookupLocations, !directoryProbablyExists(containingDirectory, state.host), state); - if (resolvedFileName) { - return resolvedFileName; - } - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Trying_other_entries_in_rootDirs); - } - // then try to resolve using remaining entries in rootDirs - for (var _b = 0, _c = state.compilerOptions.rootDirs; _b < _c.length; _b++) { - var rootDir = _c[_b]; - if (rootDir === matchedRootDir) { - // skip the initially matched entry - continue; - } - var candidate_1 = ts.combinePaths(ts.normalizePath(rootDir), suffix); - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, rootDir, candidate_1); - } - var baseDirectory = ts.getDirectoryPath(candidate_1); - var resolvedFileName_1 = loader(candidate_1, supportedExtensions, failedLookupLocations, !directoryProbablyExists(baseDirectory, state.host), state); - if (resolvedFileName_1) { - return resolvedFileName_1; - } - } - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Module_resolution_using_rootDirs_has_failed); - } - } - return undefined; - } - function tryLoadModuleUsingBaseUrl(moduleName, loader, failedLookupLocations, supportedExtensions, state) { - if (!state.compilerOptions.baseUrl) { - return undefined; - } - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1, state.compilerOptions.baseUrl, moduleName); - } - // string is for exact match - var matchedPattern = undefined; - if (state.compilerOptions.paths) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0, moduleName); - } - matchedPattern = matchPatternOrExact(ts.getOwnKeys(state.compilerOptions.paths), moduleName); - } - if (matchedPattern) { - var matchedStar = typeof matchedPattern === "string" ? undefined : matchedText(matchedPattern, moduleName); - var matchedPatternText = typeof matchedPattern === "string" ? matchedPattern : patternText(matchedPattern); - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Module_name_0_matched_pattern_1, moduleName, matchedPatternText); - } - for (var _i = 0, _a = state.compilerOptions.paths[matchedPatternText]; _i < _a.length; _i++) { - var subst = _a[_i]; - var path = matchedStar ? subst.replace("*", matchedStar) : subst; - var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, path)); - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Trying_substitution_0_candidate_module_location_Colon_1, subst, path); - } - var resolvedFileName = loader(candidate, supportedExtensions, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); - if (resolvedFileName) { - return resolvedFileName; - } - } - return undefined; - } - else { - var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, moduleName)); - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Resolving_module_name_0_relative_to_base_url_1_2, moduleName, state.compilerOptions.baseUrl, candidate); - } - return loader(candidate, supportedExtensions, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); - } - } - /** - * patternStrings contains both pattern strings (containing "*") and regular strings. - * Return an exact match if possible, or a pattern match, or undefined. - * (These are verified by verifyCompilerOptions to have 0 or 1 "*" characters.) - */ - function matchPatternOrExact(patternStrings, candidate) { - var patterns = []; - for (var _i = 0, patternStrings_1 = patternStrings; _i < patternStrings_1.length; _i++) { - var patternString = patternStrings_1[_i]; - var pattern = tryParsePattern(patternString); - if (pattern) { - patterns.push(pattern); - } - else if (patternString === candidate) { - // pattern was matched as is - no need to search further - return patternString; - } - } - return findBestPatternMatch(patterns, function (_) { return _; }, candidate); - } - function patternText(_a) { - var prefix = _a.prefix, suffix = _a.suffix; - return prefix + "*" + suffix; - } - /** - * Given that candidate matches pattern, returns the text matching the '*'. - * E.g.: matchedText(tryParsePattern("foo*baz"), "foobarbaz") === "bar" - */ - function matchedText(pattern, candidate) { - ts.Debug.assert(isPatternMatch(pattern, candidate)); - return candidate.substr(pattern.prefix.length, candidate.length - pattern.suffix.length); - } - /** Return the object corresponding to the best pattern to match `candidate`. */ - /* @internal */ - function findBestPatternMatch(values, getPattern, candidate) { - var matchedValue = undefined; - // use length of prefix as betterness criteria - var longestMatchPrefixLength = -1; - for (var _i = 0, values_1 = values; _i < values_1.length; _i++) { - var v = values_1[_i]; - var pattern = getPattern(v); - if (isPatternMatch(pattern, candidate) && pattern.prefix.length > longestMatchPrefixLength) { - longestMatchPrefixLength = pattern.prefix.length; - matchedValue = v; - } - } - return matchedValue; - } - ts.findBestPatternMatch = findBestPatternMatch; - function isPatternMatch(_a, candidate) { - var prefix = _a.prefix, suffix = _a.suffix; - return candidate.length >= prefix.length + suffix.length && - ts.startsWith(candidate, prefix) && - ts.endsWith(candidate, suffix); - } - /* @internal */ - function tryParsePattern(pattern) { - // This should be verified outside of here and a proper error thrown. - ts.Debug.assert(hasZeroOrOneAsteriskCharacter(pattern)); - var indexOfStar = pattern.indexOf("*"); - return indexOfStar === -1 ? undefined : { - prefix: pattern.substr(0, indexOfStar), - suffix: pattern.substr(indexOfStar + 1) - }; - } - ts.tryParsePattern = tryParsePattern; - function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host) { - var containingDirectory = ts.getDirectoryPath(containingFile); - var supportedExtensions = ts.getSupportedExtensions(compilerOptions); - var traceEnabled = isTraceEnabled(compilerOptions, host); - var failedLookupLocations = []; - var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, skipTsx: false }; - var resolvedFileName = tryLoadModuleUsingOptionalResolutionSettings(moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, supportedExtensions, state); - var isExternalLibraryImport = false; - if (!resolvedFileName) { - if (moduleHasNonRelativeName(moduleName)) { - if (traceEnabled) { - trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder, moduleName); - } - resolvedFileName = loadModuleFromNodeModules(moduleName, containingDirectory, failedLookupLocations, state); - isExternalLibraryImport = resolvedFileName !== undefined; - } - else { - var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - resolvedFileName = nodeLoadModuleByRelativeName(candidate, supportedExtensions, failedLookupLocations, /*onlyRecordFailures*/ false, state); - } - } - if (resolvedFileName && host.realpath) { - var originalFileName = resolvedFileName; - resolvedFileName = ts.normalizePath(host.realpath(resolvedFileName)); - if (traceEnabled) { - trace(host, ts.Diagnostics.Resolving_real_path_for_0_result_1, originalFileName, resolvedFileName); - } - } - return createResolvedModule(resolvedFileName, isExternalLibraryImport, failedLookupLocations); - } - ts.nodeModuleNameResolver = nodeModuleNameResolver; - function nodeLoadModuleByRelativeName(candidate, supportedExtensions, failedLookupLocations, onlyRecordFailures, state) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0, candidate); - } - var resolvedFileName = loadModuleFromFile(candidate, supportedExtensions, failedLookupLocations, onlyRecordFailures, state); - return resolvedFileName || loadNodeModuleFromDirectory(supportedExtensions, candidate, failedLookupLocations, onlyRecordFailures, state); - } - /* @internal */ - function directoryProbablyExists(directoryName, host) { - // if host does not support 'directoryExists' assume that directory will exist - return !host.directoryExists || host.directoryExists(directoryName); - } - ts.directoryProbablyExists = directoryProbablyExists; - /** - * @param {boolean} onlyRecordFailures - if true then function won't try to actually load files but instead record all attempts as failures. This flag is necessary - * in cases when we know upfront that all load attempts will fail (because containing folder does not exists) however we still need to record all failed lookup locations. - */ - function loadModuleFromFile(candidate, extensions, failedLookupLocation, onlyRecordFailures, state) { - // First, try adding an extension. An import of "foo" could be matched by a file "foo.ts", or "foo.js" by "foo.js.ts" - var resolvedByAddingExtension = tryAddingExtensions(candidate, extensions, failedLookupLocation, onlyRecordFailures, state); - if (resolvedByAddingExtension) { - return resolvedByAddingExtension; - } - // If that didn't work, try stripping a ".js" or ".jsx" extension and replacing it with a TypeScript one; - // e.g. "./foo.js" can be matched by "./foo.ts" or "./foo.d.ts" - if (ts.hasJavaScriptFileExtension(candidate)) { - var extensionless = ts.removeFileExtension(candidate); - if (state.traceEnabled) { - var extension = candidate.substring(extensionless.length); - trace(state.host, ts.Diagnostics.File_name_0_has_a_1_extension_stripping_it, candidate, extension); - } - return tryAddingExtensions(extensionless, extensions, failedLookupLocation, onlyRecordFailures, state); - } - } - /** Try to return an existing file that adds one of the `extensions` to `candidate`. */ - function tryAddingExtensions(candidate, extensions, failedLookupLocation, onlyRecordFailures, state) { - if (!onlyRecordFailures) { - // check if containing folder exists - if it doesn't then just record failures for all supported extensions without disk probing - var directory = ts.getDirectoryPath(candidate); - if (directory) { - onlyRecordFailures = !directoryProbablyExists(directory, state.host); - } - } - return ts.forEach(extensions, function (ext) { - return !(state.skipTsx && ts.isJsxOrTsxExtension(ext)) && tryFile(candidate + ext, failedLookupLocation, onlyRecordFailures, state); - }); - } - /** Return the file if it exists. */ - function tryFile(fileName, failedLookupLocation, onlyRecordFailures, state) { - if (!onlyRecordFailures && state.host.fileExists(fileName)) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); - } - return fileName; - } - else { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); - } - failedLookupLocation.push(fileName); - return undefined; - } - } - function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocation, onlyRecordFailures, state) { - var packageJsonPath = pathToPackageJson(candidate); - var directoryExists = !onlyRecordFailures && directoryProbablyExists(candidate, state.host); - if (directoryExists && state.host.fileExists(packageJsonPath)) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); - } - var typesFile = tryReadTypesSection(packageJsonPath, candidate, state); - if (typesFile) { - var onlyRecordFailures_1 = !directoryProbablyExists(ts.getDirectoryPath(typesFile), state.host); - // A package.json "typings" may specify an exact filename, or may choose to omit an extension. - var result = tryFile(typesFile, failedLookupLocation, onlyRecordFailures_1, state) || - tryAddingExtensions(typesFile, extensions, failedLookupLocation, onlyRecordFailures_1, state); - if (result) { - return result; - } - } - else { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_does_not_have_types_field); - } - } - } - else { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath); - } - // record package json as one of failed lookup locations - in the future if this file will appear it will invalidate resolution results - failedLookupLocation.push(packageJsonPath); - } - return loadModuleFromFile(ts.combinePaths(candidate, "index"), extensions, failedLookupLocation, !directoryExists, state); - } - function pathToPackageJson(directory) { - return ts.combinePaths(directory, "package.json"); - } - function loadModuleFromNodeModulesFolder(moduleName, directory, failedLookupLocations, state) { - var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); - var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); - var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); - var supportedExtensions = ts.getSupportedExtensions(state.compilerOptions); - var result = loadModuleFromFile(candidate, supportedExtensions, failedLookupLocations, !nodeModulesFolderExists, state); - if (result) { - return result; - } - result = loadNodeModuleFromDirectory(supportedExtensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state); - if (result) { - return result; - } - } - function loadModuleFromNodeModules(moduleName, directory, failedLookupLocations, state) { - directory = ts.normalizeSlashes(directory); - while (true) { - var baseName = ts.getBaseFileName(directory); - if (baseName !== "node_modules") { - // Try to load source from the package - var packageResult = loadModuleFromNodeModulesFolder(moduleName, directory, failedLookupLocations, state); - if (packageResult && ts.hasTypeScriptFileExtension(packageResult)) { - // Always prefer a TypeScript (.ts, .tsx, .d.ts) file shipped with the package - return packageResult; - } - else { - // Else prefer a types package over non-TypeScript results (e.g. JavaScript files) - var typesResult = loadModuleFromNodeModulesFolder(ts.combinePaths("@types", moduleName), directory, failedLookupLocations, state); - if (typesResult || packageResult) { - return typesResult || packageResult; - } - } - } - var parentPath = ts.getDirectoryPath(directory); - if (parentPath === directory) { - break; - } - directory = parentPath; - } - return undefined; - } - function classicNameResolver(moduleName, containingFile, compilerOptions, host) { - var traceEnabled = isTraceEnabled(compilerOptions, host); - var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, skipTsx: !compilerOptions.jsx }; - var failedLookupLocations = []; - var supportedExtensions = ts.getSupportedExtensions(compilerOptions); - var containingDirectory = ts.getDirectoryPath(containingFile); - var resolvedFileName = tryLoadModuleUsingOptionalResolutionSettings(moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, supportedExtensions, state); - if (resolvedFileName) { - return createResolvedModule(resolvedFileName, /*isExternalLibraryImport*/ false, failedLookupLocations); - } - var referencedSourceFile; - if (moduleHasNonRelativeName(moduleName)) { - while (true) { - var searchName = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - referencedSourceFile = loadModuleFromFile(searchName, supportedExtensions, failedLookupLocations, /*onlyRecordFailures*/ false, state); - if (referencedSourceFile) { - break; - } - var parentPath = ts.getDirectoryPath(containingDirectory); - if (parentPath === containingDirectory) { - break; - } - containingDirectory = parentPath; - } - } - else { - var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - referencedSourceFile = loadModuleFromFile(candidate, supportedExtensions, failedLookupLocations, /*onlyRecordFailures*/ false, state); - } - return referencedSourceFile - ? { resolvedModule: { resolvedFileName: referencedSourceFile }, failedLookupLocations: failedLookupLocations } - : { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; - } - ts.classicNameResolver = classicNameResolver; function createCompilerHost(options, setParentNodes) { var existingDirectories = ts.createMap(); function getCanonicalFileName(fileName) { @@ -44826,6 +62481,7 @@ var ts; readFile: function (fileName) { return ts.sys.readFile(fileName); }, trace: function (s) { return ts.sys.write(s + newLine); }, directoryExists: function (directoryName) { return ts.sys.directoryExists(directoryName); }, + getEnvironmentVariable: function (name) { return ts.sys.getEnvironmentVariable ? ts.sys.getEnvironmentVariable(name) : ""; }, getDirectories: function (path) { return ts.sys.getDirectories(path); }, realpath: realpath }; @@ -44841,8 +62497,8 @@ var ts; ts.getPreEmitDiagnostics = getPreEmitDiagnostics; function formatDiagnostics(diagnostics, host) { var output = ""; - for (var _i = 0, diagnostics_2 = diagnostics; _i < diagnostics_2.length; _i++) { - var diagnostic = diagnostics_2[_i]; + for (var _i = 0, diagnostics_1 = diagnostics; _i < diagnostics_1.length; _i++) { + var diagnostic = diagnostics_1[_i]; if (diagnostic.file) { var _a = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start), line = _a.line, character = _a.character; var fileName = diagnostic.file.fileName; @@ -44885,53 +62541,14 @@ var ts; var resolutions = []; var cache = ts.createMap(); for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { - var name_34 = names_1[_i]; - var result = name_34 in cache - ? cache[name_34] - : cache[name_34] = loader(name_34, 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; } - /** - * Given a set of options, returns the set of type directive names - * that should be included for this program automatically. - * This list could either come from the config file, - * or from enumerating the types root + initial secondary types lookup location. - * More type directives might appear in the program later as a result of loading actual source files; - * this list is only the set of defaults that are implicitly included. - */ - function getAutomaticTypeDirectiveNames(options, host) { - // Use explicit type list from tsconfig.json - if (options.types) { - return options.types; - } - // Walk the primary type lookup locations - var result = []; - if (host.directoryExists && host.getDirectories) { - var typeRoots = getEffectiveTypeRoots(options, host); - if (typeRoots) { - for (var _i = 0, typeRoots_1 = typeRoots; _i < typeRoots_1.length; _i++) { - var root = typeRoots_1[_i]; - if (host.directoryExists(root)) { - for (var _a = 0, _b = host.getDirectories(root); _a < _b.length; _a++) { - var typeDirectivePath = _b[_a]; - var normalized = ts.normalizePath(typeDirectivePath); - var packageJsonPath = pathToPackageJson(ts.combinePaths(root, normalized)); - // tslint:disable-next-line:no-null-keyword - var isNotNeededPackage = host.fileExists(packageJsonPath) && readJson(packageJsonPath, host).typings === null; - if (!isNotNeededPackage) { - // Return just the type directive names - result.push(ts.getBaseFileName(normalized)); - } - } - } - } - } - } - return result; - } - ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames; function createProgram(rootNames, options, host, oldProgram) { var program; var files = []; @@ -44948,7 +62565,7 @@ var ts; // - This calls resolveModuleNames, and then calls findSourceFile for each resolved module. // As all these operations happen - and are nested - within the createProgram call, they close over the below variables. // The current resolution depth is tracked by incrementing/decrementing as the depth first search progresses. - var maxNodeModulesJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0; + var maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0; var currentNodeModulesDepth = 0; // If a module has some of its imports skipped due to being at the depth limit under node_modules, then track // this, as it may be imported at a shallower depth later, and then it will need its skipped imports processed. @@ -44963,12 +62580,22 @@ var ts; var supportedExtensions = ts.getSupportedExtensions(options); // Map storing if there is emit blocking diagnostics for given input var hasEmitBlockingDiagnostics = ts.createFileMap(getCanonicalFileName); + var moduleResolutionCache; var resolveModuleNamesWorker; if (host.resolveModuleNames) { - resolveModuleNamesWorker = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }; + resolveModuleNamesWorker = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile).map(function (resolved) { + // An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName. + if (!resolved || resolved.extension !== undefined) { + return resolved; + } + var withExtension = ts.clone(resolved); + withExtension.extension = ts.extensionFromPath(resolved.resolvedFileName); + return withExtension; + }); }; } else { - var loader_1 = function (moduleName, containingFile) { return resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }; + moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, function (x) { return host.getCanonicalFileName(x); }); + var loader_1 = function (moduleName, containingFile) { return ts.resolveModuleName(moduleName, containingFile, options, host, moduleResolutionCache).resolvedModule; }; resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(moduleNames, containingFile, loader_1); }; } var resolveTypeReferenceDirectiveNamesWorker; @@ -44976,7 +62603,7 @@ var ts; resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile); }; } else { - var loader_2 = function (typesRef, containingFile) { return resolveTypeReferenceDirective(typesRef, containingFile, options, host).resolvedTypeReferenceDirective; }; + var loader_2 = function (typesRef, containingFile) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host).resolvedTypeReferenceDirective; }; resolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile) { return loadWithLocalCache(typeReferenceDirectiveNames, containingFile, loader_2); }; } var filesByName = ts.createFileMap(); @@ -44986,10 +62613,11 @@ var ts; if (!tryReuseStructureFromOldProgram()) { ts.forEach(rootNames, function (name) { return processRootFile(name, /*isDefaultLib*/ false); }); // load type declarations specified via 'types' argument or implicitly from types/ and node_modules/@types folders - var typeReferences = getAutomaticTypeDirectiveNames(options, host); - if (typeReferences) { + 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]); @@ -45013,6 +62641,8 @@ var ts; } } } + // unconditionally set moduleResolutionCache to undefined to avoid unnecessary leaks + moduleResolutionCache = undefined; // unconditionally set oldProgram to undefined to prevent it from being captured in closure oldProgram = undefined; program = { @@ -45037,20 +62667,23 @@ var ts; getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); }, getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; }, - getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; } + getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; }, + isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary, + dropDiagnosticsProducingTypeChecker: dropDiagnosticsProducingTypeChecker }; verifyCompilerOptions(); ts.performance.mark("afterProgram"); ts.performance.measure("Program", "beforeProgram", "afterProgram"); return program; function getCommonSourceDirectory() { - if (typeof commonSourceDirectory === "undefined") { - if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) { + if (commonSourceDirectory === undefined) { + var emittedFiles = ts.filterSourceFilesInDirectory(files, isSourceFileFromExternalLibrary); + if (options.rootDir && checkSourceFilesBelongToPath(emittedFiles, options.rootDir)) { // If a rootDir is specified and is valid use it as the commonSourceDirectory commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, currentDirectory); } else { - commonSourceDirectory = computeCommonSourceDirectory(files); + commonSourceDirectory = computeCommonSourceDirectory(emittedFiles); } if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== ts.directorySeparator) { // Make sure directory path ends with directory separator so this string can directly @@ -45073,6 +62706,112 @@ var ts; } return classifiableNames; } + function resolveModuleNamesReusingOldState(moduleNames, containingFile, file, oldProgramState) { + if (!oldProgramState && !file.ambientModuleNames.length) { + // if old program state is not supplied and file does not contain locally defined ambient modules + // then the best we can do is fallback to the default logic + return resolveModuleNamesWorker(moduleNames, containingFile); + } + // at this point we know that either + // - file has local declarations for ambient modules + // OR + // - old program state is available + // OR + // - both of items above + // With this it is possible that we can tell how some module names from the initial list will be resolved + // without doing actual resolution (in particular if some name was resolved to ambient module). + // Such names should be excluded from the list of module names that will be provided to `resolveModuleNamesWorker` + // since we don't want to resolve them again. + // this is a list of modules for which we cannot predict resolution so they should be actually resolved + var unknownModuleNames; + // this is a list of combined results assembles from predicted and resolved results. + // Order in this list matches the order in the original list of module names `moduleNames` which is important + // so later we can split results to resolutions of modules and resolutions of module augmentations. + var result; + // a transient placeholder that is used to mark predicted resolution in the result list + var predictedToResolveToAmbientModuleMarker = {}; + for (var i = 0; i < moduleNames.length; i++) { + var moduleName = moduleNames[i]; + // module name is known to be resolved to ambient module if + // - module name is contained in the list of ambient modules that are locally declared in the file + // - in the old program module name was resolved to ambient module whose declaration is in non-modified file + // (so the same module declaration will land in the new program) + var isKnownToResolveToAmbientModule = false; + if (ts.contains(file.ambientModuleNames, moduleName)) { + isKnownToResolveToAmbientModule = true; + if (ts.isTraceEnabled(options, host)) { + ts.trace(host, ts.Diagnostics.Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1, moduleName, containingFile); + } + } + else { + isKnownToResolveToAmbientModule = checkModuleNameResolvedToAmbientModuleInNonModifiedFile(moduleName, oldProgramState); + } + if (isKnownToResolveToAmbientModule) { + if (!unknownModuleNames) { + // found a first module name for which result can be prediced + // this means that this module name should not be passed to `resolveModuleNamesWorker`. + // We'll use a separate list for module names that are definitely unknown. + result = new Array(moduleNames.length); + // copy all module names that appear before the current one in the list + // since they are known to be unknown + unknownModuleNames = moduleNames.slice(0, i); + } + // mark prediced resolution in the result list + result[i] = predictedToResolveToAmbientModuleMarker; + } + else if (unknownModuleNames) { + // found unknown module name and we are already using separate list for those - add it to the list + unknownModuleNames.push(moduleName); + } + } + if (!unknownModuleNames) { + // we've looked throught the list but have not seen any predicted resolution + // use default logic + return resolveModuleNamesWorker(moduleNames, containingFile); + } + var resolutions = unknownModuleNames.length + ? resolveModuleNamesWorker(unknownModuleNames, containingFile) + : emptyArray; + // combine results of resolutions and predicted results + var j = 0; + for (var i = 0; i < result.length; i++) { + if (result[i] == predictedToResolveToAmbientModuleMarker) { + result[i] = undefined; + } + else { + result[i] = resolutions[j]; + j++; + } + } + ts.Debug.assert(j === resolutions.length); + return result; + function checkModuleNameResolvedToAmbientModuleInNonModifiedFile(moduleName, oldProgramState) { + if (!oldProgramState) { + return false; + } + var resolutionToFile = ts.getResolvedModule(oldProgramState.file, moduleName); + if (resolutionToFile) { + // module used to be resolved to file - ignore it + return false; + } + var ambientModule = oldProgram.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(moduleName); + if (!(ambientModule && ambientModule.declarations)) { + return false; + } + // at least one of declarations should come from non-modified source file + var firstUnmodifiedFile = ts.forEach(ambientModule.declarations, function (d) { + var f = ts.getSourceFileOfNode(d); + return !ts.contains(oldProgramState.modifiedFilePaths, f.path) && f; + }); + if (!firstUnmodifiedFile) { + return false; + } + if (ts.isTraceEnabled(options, host)) { + ts.trace(host, ts.Diagnostics.Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified, moduleName, firstUnmodifiedFile.fileName); + } + return true; + } + } function tryReuseStructureFromOldProgram() { if (!oldProgram) { return false; @@ -45080,20 +62819,7 @@ var ts; // check properties that can affect structure of the program or module resolution strategy // if any of these properties has changed - structure cannot be reused var oldOptions = oldProgram.getCompilerOptions(); - if ((oldOptions.module !== options.module) || - (oldOptions.moduleResolution !== options.moduleResolution) || - (oldOptions.noResolve !== options.noResolve) || - (oldOptions.target !== options.target) || - (oldOptions.noLib !== options.noLib) || - (oldOptions.jsx !== options.jsx) || - (oldOptions.allowJs !== options.allowJs) || - (oldOptions.rootDir !== options.rootDir) || - (oldOptions.configFilePath !== options.configFilePath) || - (oldOptions.baseUrl !== options.baseUrl) || - (oldOptions.maxNodeModuleJsDepth !== options.maxNodeModuleJsDepth) || - !ts.arrayIsEqualTo(oldOptions.typeRoots, oldOptions.typeRoots) || - !ts.arrayIsEqualTo(oldOptions.rootDirs, options.rootDirs) || - !ts.equalOwnProperties(oldOptions.paths, options.paths)) { + if (ts.changesAffectModuleResolution(oldOptions, options)) { return false; } ts.Debug.assert(!oldProgram.structureIsReused); @@ -45144,29 +62870,8 @@ var ts; // 'types' references has changed return false; } - var newSourceFilePath = ts.getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory); - if (resolveModuleNamesWorker) { - var moduleNames = ts.map(ts.concatenate(newSourceFile.imports, newSourceFile.moduleAugmentations), getTextOfLiteral); - var resolutions = resolveModuleNamesWorker(moduleNames, newSourceFilePath); - // ensure that module resolution results are still correct - var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, ts.moduleResolutionIsEqualTo); - if (resolutionsChanged) { - return false; - } - } - if (resolveTypeReferenceDirectiveNamesWorker) { - var typesReferenceDirectives = ts.map(newSourceFile.typeReferenceDirectives, function (x) { return x.fileName; }); - var resolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFilePath); - // ensure that types resolutions are still correct - var resolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, resolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, ts.typeDirectiveIsEqualTo); - if (resolutionsChanged) { - return false; - } - } - // pass the cache of module/types resolutions from the old source file - newSourceFile.resolvedModules = oldSourceFile.resolvedModules; - newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames; - modifiedSourceFiles.push(newSourceFile); + // tentatively approve the file + modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile }); } else { // file has no changes - use it as is @@ -45175,15 +62880,42 @@ var ts; // if file has passed all checks it should be safe to reuse it newSourceFiles.push(newSourceFile); } + var modifiedFilePaths = modifiedSourceFiles.map(function (f) { return f.newFile.path; }); + // try to verify results of module resolution + for (var _b = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _b < modifiedSourceFiles_1.length; _b++) { + var _c = modifiedSourceFiles_1[_b], oldSourceFile = _c.oldFile, newSourceFile = _c.newFile; + var newSourceFilePath = ts.getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory); + if (resolveModuleNamesWorker) { + var moduleNames = ts.map(ts.concatenate(newSourceFile.imports, newSourceFile.moduleAugmentations), getTextOfLiteral); + var resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFilePath, newSourceFile, { file: oldSourceFile, program: oldProgram, modifiedFilePaths: modifiedFilePaths }); + // ensure that module resolution results are still correct + var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, ts.moduleResolutionIsEqualTo); + if (resolutionsChanged) { + return false; + } + } + if (resolveTypeReferenceDirectiveNamesWorker) { + var typesReferenceDirectives = ts.map(newSourceFile.typeReferenceDirectives, function (x) { return x.fileName; }); + var resolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFilePath); + // ensure that types resolutions are still correct + var resolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, resolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, ts.typeDirectiveIsEqualTo); + if (resolutionsChanged) { + return false; + } + } + // pass the cache of module/types resolutions from the old source file + newSourceFile.resolvedModules = oldSourceFile.resolvedModules; + newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames; + } // update fileName -> file mapping for (var i = 0, len = newSourceFiles.length; i < len; i++) { filesByName.set(filePaths[i], newSourceFiles[i]); } files = newSourceFiles; fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics(); - for (var _b = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _b < modifiedSourceFiles_1.length; _b++) { - var modifiedFile = modifiedSourceFiles_1[_b]; - fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile); + for (var _d = 0, modifiedSourceFiles_2 = modifiedSourceFiles; _d < modifiedSourceFiles_2.length; _d++) { + var modifiedFile = modifiedSourceFiles_2[_d]; + fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile.newFile); } resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives(); oldProgram.structureIsReused = true; @@ -45199,24 +62931,30 @@ var ts; getSourceFile: program.getSourceFile, getSourceFileByPath: program.getSourceFileByPath, getSourceFiles: program.getSourceFiles, - isSourceFileFromExternalLibrary: function (file) { return !!sourceFilesFoundSearchingNodeModules[file.path]; }, + isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary, writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError, sourceFiles) { return host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); }), - isEmitBlocked: isEmitBlocked + isEmitBlocked: isEmitBlocked, }; } + function isSourceFileFromExternalLibrary(file) { + return sourceFilesFoundSearchingNodeModules[file.path]; + } function getDiagnosticsProducingTypeChecker() { return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = ts.createTypeChecker(program, /*produceDiagnostics:*/ true)); } + function dropDiagnosticsProducingTypeChecker() { + diagnosticsProducingTypeChecker = undefined; + } function getTypeChecker() { return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = ts.createTypeChecker(program, /*produceDiagnostics:*/ false)); } - function emit(sourceFile, writeFileCallback, cancellationToken) { - return runWithCancellationToken(function () { return emitWorker(program, sourceFile, writeFileCallback, cancellationToken); }); + function emit(sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles) { + return runWithCancellationToken(function () { return emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles); }); } function isEmitBlocked(emitFileName) { return hasEmitBlockingDiagnostics.contains(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName)); } - function emitWorker(program, sourceFile, writeFileCallback, cancellationToken) { + function emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles) { var declarationDiagnostics = []; if (options.noEmit) { return { diagnostics: declarationDiagnostics, sourceMaps: undefined, emittedFiles: undefined, emitSkipped: true }; @@ -45248,7 +62986,7 @@ var ts; // checked is to not pass the file to getEmitResolver. var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out) ? undefined : sourceFile); ts.performance.mark("beforeEmit"); - var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile); + var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, emitOnlyDtsFiles); ts.performance.mark("afterEmit"); ts.performance.measure("Emit", "beforeEmit", "afterEmit"); return emitResult; @@ -45288,7 +63026,15 @@ var ts; return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken); } } - function getSyntacticDiagnosticsForFile(sourceFile, cancellationToken) { + function getSyntacticDiagnosticsForFile(sourceFile) { + // For JavaScript files, we report semantic errors for using TypeScript-only + // constructs from within a JavaScript file as syntactic errors. + if (ts.isSourceFileJavaScript(sourceFile)) { + if (!sourceFile.additionalSyntacticDiagnostics) { + sourceFile.additionalSyntacticDiagnostics = getJavaScriptSyntacticDiagnosticsForFile(sourceFile); + } + return ts.concatenate(sourceFile.additionalSyntacticDiagnostics, sourceFile.parseDiagnostics); + } return sourceFile.parseDiagnostics; } function runWithCancellationToken(func) { @@ -45317,179 +63063,180 @@ var ts; var typeChecker = getDiagnosticsProducingTypeChecker(); ts.Debug.assert(!!sourceFile.bindDiagnostics); var bindDiagnostics = sourceFile.bindDiagnostics; - // For JavaScript files, we don't want to report the normal typescript semantic errors. - // Instead, we just report errors for using TypeScript-only constructs from within a - // JavaScript file. - var checkDiagnostics = ts.isSourceFileJavaScript(sourceFile) ? - getJavaScriptSemanticDiagnosticsForFile(sourceFile, cancellationToken) : - typeChecker.getDiagnostics(sourceFile, cancellationToken); + // For JavaScript files, we don't want to report semantic errors. + // Instead, we'll report errors for using TypeScript-only constructs from within a + // JavaScript file when we get syntactic diagnostics for the file. + var checkDiagnostics = ts.isSourceFileJavaScript(sourceFile) ? [] : typeChecker.getDiagnostics(sourceFile, cancellationToken); var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName); var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName); - return bindDiagnostics.concat(checkDiagnostics).concat(fileProcessingDiagnosticsInFile).concat(programDiagnosticsInFile); + return bindDiagnostics.concat(checkDiagnostics, fileProcessingDiagnosticsInFile, programDiagnosticsInFile); }); } - function getJavaScriptSemanticDiagnosticsForFile(sourceFile, cancellationToken) { + function getJavaScriptSyntacticDiagnosticsForFile(sourceFile) { return runWithCancellationToken(function () { var diagnostics = []; + var parent = sourceFile; walk(sourceFile); return diagnostics; function walk(node) { - if (!node) { - return false; + // Return directly from the case if the given node doesnt want to visit each child + // Otherwise break to visit each child + switch (parent.kind) { + case 144 /* Parameter */: + case 147 /* PropertyDeclaration */: + if (parent.questionToken === node) { + diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, "?")); + return; + } + // Pass through + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + case 150 /* Constructor */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + case 184 /* FunctionExpression */: + case 225 /* FunctionDeclaration */: + case 185 /* ArrowFunction */: + case 225 /* FunctionDeclaration */: + case 223 /* VariableDeclaration */: + // type annotation + if (parent.type === node) { + diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); + return; + } } switch (node.kind) { - case 229 /* ImportEqualsDeclaration */: - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); - return true; - case 235 /* ExportAssignment */: + case 234 /* ImportEqualsDeclaration */: + diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); + return; + case 240 /* ExportAssignment */: if (node.isExportEquals) { - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); - return true; + diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); + return; } break; - case 221 /* ClassDeclaration */: - var classDeclaration = node; - if (checkModifiers(classDeclaration.modifiers) || - checkTypeParameters(classDeclaration.typeParameters)) { - return true; - } - break; - case 251 /* HeritageClause */: + case 255 /* HeritageClause */: var heritageClause = node; - if (heritageClause.token === 106 /* ImplementsKeyword */) { - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); - return true; + if (heritageClause.token === 107 /* ImplementsKeyword */) { + diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); + return; } break; - case 222 /* InterfaceDeclaration */: - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); - return true; - case 225 /* ModuleDeclaration */: - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); - return true; - case 223 /* TypeAliasDeclaration */: - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); - return true; - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - case 148 /* Constructor */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - case 179 /* FunctionExpression */: - case 220 /* FunctionDeclaration */: - case 180 /* ArrowFunction */: - case 220 /* FunctionDeclaration */: - var functionDeclaration = node; - if (checkModifiers(functionDeclaration.modifiers) || - checkTypeParameters(functionDeclaration.typeParameters) || - checkTypeAnnotation(functionDeclaration.type)) { - return true; + case 227 /* InterfaceDeclaration */: + diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); + return; + case 230 /* ModuleDeclaration */: + diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); + return; + case 228 /* TypeAliasDeclaration */: + diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); + return; + case 229 /* EnumDeclaration */: + diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); + return; + case 182 /* TypeAssertionExpression */: + var typeAssertionExpression = node; + diagnostics.push(createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); + return; + } + var prevParent = parent; + parent = node; + ts.forEachChild(node, walk, walkArray); + parent = prevParent; + } + function walkArray(nodes) { + if (parent.decorators === nodes && !options.experimentalDecorators) { + diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning)); + } + switch (parent.kind) { + case 226 /* ClassDeclaration */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + case 150 /* Constructor */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + case 184 /* FunctionExpression */: + case 225 /* FunctionDeclaration */: + case 185 /* ArrowFunction */: + case 225 /* FunctionDeclaration */: + // Check type parameters + if (nodes === parent.typeParameters) { + diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); + return; + } + // pass through + case 205 /* VariableStatement */: + // Check modifiers + if (nodes === parent.modifiers) { + return checkModifiers(nodes, parent.kind === 205 /* VariableStatement */); } break; - case 200 /* VariableStatement */: - var variableStatement = node; - if (checkModifiers(variableStatement.modifiers)) { - return true; - } - break; - case 218 /* VariableDeclaration */: - var variableDeclaration = node; - if (checkTypeAnnotation(variableDeclaration.type)) { - return true; - } - break; - case 174 /* CallExpression */: - case 175 /* NewExpression */: - var expression = node; - if (expression.typeArguments && expression.typeArguments.length > 0) { - var start = expression.typeArguments.pos; - diagnostics.push(ts.createFileDiagnostic(sourceFile, start, expression.typeArguments.end - start, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file)); - return true; - } - break; - case 142 /* Parameter */: - var parameter = node; - if (parameter.modifiers) { - var start = parameter.modifiers.pos; - diagnostics.push(ts.createFileDiagnostic(sourceFile, start, parameter.modifiers.end - start, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file)); - return true; - } - if (parameter.questionToken) { - diagnostics.push(ts.createDiagnosticForNode(parameter.questionToken, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, "?")); - return true; - } - if (parameter.type) { - diagnostics.push(ts.createDiagnosticForNode(parameter.type, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); - return true; - } - break; - case 145 /* PropertyDeclaration */: - var propertyDeclaration = node; - if (propertyDeclaration.modifiers) { - for (var _i = 0, _a = propertyDeclaration.modifiers; _i < _a.length; _i++) { + case 147 /* PropertyDeclaration */: + // Check modifiers of property declaration + if (nodes === parent.modifiers) { + for (var _i = 0, _a = nodes; _i < _a.length; _i++) { var modifier = _a[_i]; - if (modifier.kind !== 113 /* StaticKeyword */) { - diagnostics.push(ts.createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind))); - return true; + if (modifier.kind !== 114 /* StaticKeyword */) { + diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind))); } } - } - if (checkTypeAnnotation(node.type)) { - return true; + return; } break; - case 224 /* EnumDeclaration */: - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); - return true; - case 177 /* TypeAssertionExpression */: - var typeAssertionExpression = node; - diagnostics.push(ts.createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); - return true; - case 143 /* Decorator */: - if (!options.experimentalDecorators) { - diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning)); + case 144 /* Parameter */: + // Check modifiers of parameter declaration + if (nodes === parent.modifiers) { + diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file)); + return; } - return true; - } - return ts.forEachChild(node, walk); - } - function checkTypeParameters(typeParameters) { - if (typeParameters) { - var start = typeParameters.pos; - diagnostics.push(ts.createFileDiagnostic(sourceFile, start, typeParameters.end - start, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); - return true; - } - return false; - } - function checkTypeAnnotation(type) { - if (type) { - diagnostics.push(ts.createDiagnosticForNode(type, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); - return true; - } - return false; - } - function checkModifiers(modifiers) { - if (modifiers) { - for (var _i = 0, modifiers_1 = modifiers; _i < modifiers_1.length; _i++) { - var modifier = modifiers_1[_i]; - switch (modifier.kind) { - case 112 /* PublicKeyword */: - case 110 /* PrivateKeyword */: - case 111 /* ProtectedKeyword */: - case 128 /* ReadonlyKeyword */: - case 122 /* DeclareKeyword */: - diagnostics.push(ts.createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind))); - return true; - // These are all legal modifiers. - case 113 /* StaticKeyword */: - case 82 /* ExportKeyword */: - case 74 /* ConstKeyword */: - case 77 /* DefaultKeyword */: - case 115 /* AbstractKeyword */: + break; + case 179 /* CallExpression */: + case 180 /* NewExpression */: + case 199 /* ExpressionWithTypeArguments */: + // Check type arguments + if (nodes === parent.typeArguments) { + diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file)); + return; } + break; + } + for (var _b = 0, nodes_6 = nodes; _b < nodes_6.length; _b++) { + var node = nodes_6[_b]; + walk(node); + } + } + function checkModifiers(modifiers, isConstValid) { + for (var _i = 0, modifiers_1 = modifiers; _i < modifiers_1.length; _i++) { + var modifier = modifiers_1[_i]; + switch (modifier.kind) { + case 75 /* ConstKeyword */: + if (isConstValid) { + continue; + } + // Fallthrough to report error + case 113 /* PublicKeyword */: + case 111 /* PrivateKeyword */: + case 112 /* ProtectedKeyword */: + case 130 /* ReadonlyKeyword */: + case 123 /* DeclareKeyword */: + case 116 /* AbstractKeyword */: + diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind))); + break; + // These are all legal modifiers. + case 114 /* StaticKeyword */: + case 83 /* ExportKeyword */: + case 78 /* DefaultKeyword */: } } - return false; + } + function createDiagnosticForNodeArray(nodes, message, arg0, arg1, arg2) { + var start = nodes.pos; + return ts.createFileDiagnostic(sourceFile, start, nodes.end - start, message, arg0, arg1, arg2); + } + // Since these are syntactic diagnostics, parent might not have been set + // this means the sourceFile cannot be infered from the node + function createDiagnosticForNode(node, message, arg0, arg1, arg2) { + return ts.createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2); } }); } @@ -45497,8 +63244,7 @@ var ts; return runWithCancellationToken(function () { var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile, cancellationToken); // Don't actually write any files since we're just getting diagnostics. - var writeFile = function () { }; - return ts.getDeclarationDiagnostics(getEmitHost(writeFile), resolver, sourceFile); + return ts.getDeclarationDiagnostics(getEmitHost(ts.noop), resolver, sourceFile); }); } function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) { @@ -45515,11 +63261,8 @@ var ts; ts.addRange(allDiagnostics, getDiagnosticsProducingTypeChecker().getGlobalDiagnostics()); return ts.sortAndDeduplicateDiagnostics(allDiagnostics); } - function hasExtension(fileName) { - return ts.getBaseFileName(fileName).indexOf(".") >= 0; - } function processRootFile(fileName, isDefaultLib) { - processSourceFile(ts.normalizePath(fileName), isDefaultLib, /*isReference*/ true); + processSourceFile(ts.normalizePath(fileName), isDefaultLib); } function fileReferenceIsEqualTo(a, b) { return a.fileName === b.fileName; @@ -45536,8 +63279,23 @@ var ts; } var isJavaScriptFile = ts.isSourceFileJavaScript(file); var isExternalModuleFile = ts.isExternalModule(file); + var isDtsFile = ts.isDeclarationFile(file); var imports; var moduleAugmentations; + var ambientModules; + // If we are importing helpers, we need to add a synthetic reference to resolve the + // helpers library. + if (options.importHelpers + && (options.isolatedModules || isExternalModuleFile) + && !file.isDeclarationFile) { + // synthesize 'import "tslib"' declaration + var externalHelpersModuleReference = ts.createSynthesizedNode(9 /* StringLiteral */); + externalHelpersModuleReference.text = ts.externalHelpersModuleNameText; + var importDecl = ts.createSynthesizedNode(235 /* ImportDeclaration */); + importDecl.parent = file; + externalHelpersModuleReference.parent = importDecl; + imports = [externalHelpersModuleReference]; + } for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var node = _a[_i]; collectModuleReferences(node, /*inAmbientModule*/ false); @@ -45547,12 +63305,13 @@ var ts; } file.imports = imports || emptyArray; file.moduleAugmentations = moduleAugmentations || emptyArray; + file.ambientModuleNames = ambientModules || emptyArray; return; function collectModuleReferences(node, inAmbientModule) { switch (node.kind) { - case 230 /* ImportDeclaration */: - case 229 /* ImportEqualsDeclaration */: - case 236 /* ExportDeclaration */: + case 235 /* ImportDeclaration */: + case 234 /* ImportEqualsDeclaration */: + case 241 /* ExportDeclaration */: var moduleNameExpr = ts.getExternalModuleName(node); if (!moduleNameExpr || moduleNameExpr.kind !== 9 /* StringLiteral */) { break; @@ -45567,8 +63326,8 @@ var ts; (imports || (imports = [])).push(moduleNameExpr); } break; - case 225 /* ModuleDeclaration */: - if (ts.isAmbientModule(node) && (inAmbientModule || node.flags & 2 /* Ambient */ || ts.isDeclarationFile(file))) { + case 230 /* ModuleDeclaration */: + if (ts.isAmbientModule(node) && (inAmbientModule || ts.hasModifier(node, 2 /* Ambient */) || ts.isDeclarationFile(file))) { var moduleName = node.name; // Ambient module declarations can be interpreted as augmentations for some existing external modules. // This will happen in two cases: @@ -45579,6 +63338,10 @@ var ts; (moduleAugmentations || (moduleAugmentations = [])).push(moduleName); } else if (!inAmbientModule) { + if (isDtsFile) { + // for global .d.ts files record name of ambient module + (ambientModules || (ambientModules = [])).push(moduleName.text); + } // An AmbientExternalModuleDeclaration declares an external module. // This type of declaration is permitted only in the global module. // The StringLiteral must specify a top - level external module name. @@ -45604,18 +63367,15 @@ var ts; } } } - /** - * 'isReference' indicates whether the file was brought in via a reference directive (rather than an import declaration) - */ - function processSourceFile(fileName, isDefaultLib, isReference, refFile, refPos, refEnd) { + function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { var diagnosticArgument; var diagnostic; - if (hasExtension(fileName)) { + if (ts.hasExtension(fileName)) { if (!options.allowNonTsExtensions && !ts.forEach(supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) { diagnostic = ts.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1; diagnosticArgument = [fileName, "'" + supportedExtensions.join("', '") + "'"]; } - else if (!findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, refFile, refPos, refEnd)) { + else if (!findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd)) { diagnostic = ts.Diagnostics.File_0_not_found; diagnosticArgument = [fileName]; } @@ -45625,13 +63385,13 @@ var ts; } } else { - var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, refFile, refPos, refEnd); + var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); if (!nonTsFile) { if (options.allowNonTsExtensions) { diagnostic = ts.Diagnostics.File_0_not_found; diagnosticArgument = [fileName]; } - else if (!ts.forEach(supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.toPath(fileName + extension, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, refFile, refPos, refEnd); })) { + else if (!ts.forEach(supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.toPath(fileName + extension, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); })) { diagnostic = ts.Diagnostics.File_0_not_found; fileName += ".ts"; diagnosticArgument = [fileName]; @@ -45656,7 +63416,7 @@ var ts; } } // Get source file from normalized fileName - function findSourceFile(fileName, path, isDefaultLib, isReference, refFile, refPos, refEnd) { + function findSourceFile(fileName, path, isDefaultLib, refFile, refPos, refEnd) { if (filesByName.contains(path)) { var file_1 = filesByName.get(path); // try to check if we've already seen this file but with a different casing in path @@ -45669,16 +63429,16 @@ var ts; if (file_1 && sourceFilesFoundSearchingNodeModules[file_1.path] && currentNodeModulesDepth == 0) { sourceFilesFoundSearchingNodeModules[file_1.path] = false; if (!options.noResolve) { - processReferencedFiles(file_1, ts.getDirectoryPath(fileName), isDefaultLib); + processReferencedFiles(file_1, isDefaultLib); processTypeReferenceDirectives(file_1); } modulesWithElidedImports[file_1.path] = false; - processImportedModules(file_1, ts.getDirectoryPath(fileName)); + processImportedModules(file_1); } else if (file_1 && modulesWithElidedImports[file_1.path]) { - if (currentNodeModulesDepth < maxNodeModulesJsDepth) { + if (currentNodeModulesDepth < maxNodeModuleJsDepth) { modulesWithElidedImports[file_1.path] = false; - processImportedModules(file_1, ts.getDirectoryPath(fileName)); + processImportedModules(file_1); } } return file_1; @@ -45707,13 +63467,12 @@ var ts; } } skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib; - var basePath = ts.getDirectoryPath(fileName); if (!options.noResolve) { - processReferencedFiles(file, basePath, isDefaultLib); + processReferencedFiles(file, isDefaultLib); processTypeReferenceDirectives(file); } // always process imported modules to record module name resolutions - processImportedModules(file, basePath); + processImportedModules(file); if (isDefaultLib) { files.unshift(file); } @@ -45723,10 +63482,10 @@ var ts; } return file; } - function processReferencedFiles(file, basePath, isDefaultLib) { + function processReferencedFiles(file, isDefaultLib) { ts.forEach(file.referencedFiles, function (ref) { var referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName); - processSourceFile(referencedFileName, isDefaultLib, /*isReference*/ true, file, ref.pos, ref.end); + processSourceFile(referencedFileName, isDefaultLib, file, ref.pos, ref.end); }); } function processTypeReferenceDirectives(file) { @@ -45752,22 +63511,25 @@ var ts; if (resolvedTypeReferenceDirective) { if (resolvedTypeReferenceDirective.primary) { // resolved from the primary path - processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, /*isDefaultLib*/ false, /*isReference*/ true, refFile, refPos, refEnd); + processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, /*isDefaultLib*/ false, refFile, refPos, refEnd); } else { // If we already resolved to this file, it must have been a secondary reference. Check file contents // for sameness and possibly issue an error if (previousResolution) { - var otherFileText = host.readFile(resolvedTypeReferenceDirective.resolvedFileName); - if (otherFileText !== getSourceFile(previousResolution.resolvedFileName).text) { - fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict, typeReferenceDirective, resolvedTypeReferenceDirective.resolvedFileName, previousResolution.resolvedFileName)); + // Don't bother reading the file again if it's the same file. + if (resolvedTypeReferenceDirective.resolvedFileName !== previousResolution.resolvedFileName) { + var otherFileText = host.readFile(resolvedTypeReferenceDirective.resolvedFileName); + if (otherFileText !== getSourceFile(previousResolution.resolvedFileName).text) { + fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict, typeReferenceDirective, resolvedTypeReferenceDirective.resolvedFileName, previousResolution.resolvedFileName)); + } } // don't overwrite previous resolution result saveResolution = false; } else { // First resolution of this library - processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, /*isDefaultLib*/ false, /*isReference*/ true, refFile, refPos, refEnd); + processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, /*isDefaultLib*/ false, refFile, refPos, refEnd); } } } @@ -45793,34 +63555,43 @@ var ts; function getCanonicalFileName(fileName) { return host.getCanonicalFileName(fileName); } - function processImportedModules(file, basePath) { + function processImportedModules(file) { collectExternalModuleReferences(file); if (file.imports.length || file.moduleAugmentations.length) { file.resolvedModules = ts.createMap(); - var moduleNames = ts.map(ts.concatenate(file.imports, file.moduleAugmentations), getTextOfLiteral); - var resolutions = resolveModuleNamesWorker(moduleNames, ts.getNormalizedAbsolutePath(file.fileName, currentDirectory)); + // Because global augmentation doesn't have string literal name, we can check for global augmentation as such. + var nonGlobalAugmentation = ts.filter(file.moduleAugmentations, function (moduleAugmentation) { return moduleAugmentation.kind === 9 /* StringLiteral */; }); + var moduleNames = ts.map(ts.concatenate(file.imports, nonGlobalAugmentation), getTextOfLiteral); + var resolutions = resolveModuleNamesReusingOldState(moduleNames, ts.getNormalizedAbsolutePath(file.fileName, currentDirectory), file); + ts.Debug.assert(resolutions.length === moduleNames.length); for (var i = 0; i < moduleNames.length; i++) { var resolution = resolutions[i]; ts.setResolvedModule(file, moduleNames[i], resolution); - var resolvedPath = resolution ? ts.toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName) : undefined; + if (!resolution) { + continue; + } + var isFromNodeModulesSearch = resolution.isExternalLibraryImport; + var isJsFileFromNodeModules = isFromNodeModulesSearch && !ts.extensionIsTypeScript(resolution.extension); + var resolvedFileName = resolution.resolvedFileName; + if (isFromNodeModulesSearch) { + currentNodeModulesDepth++; + } // add file to program only if: // - resolution was successful // - noResolve is falsy // - module name comes from the list of imports // - it's not a top level JavaScript module that exceeded the search max - var isFromNodeModulesSearch = resolution && resolution.isExternalLibraryImport; - var isJsFileFromNodeModules = isFromNodeModulesSearch && ts.hasJavaScriptFileExtension(resolution.resolvedFileName); - if (isFromNodeModulesSearch) { - currentNodeModulesDepth++; - } - var elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModulesJsDepth; - var shouldAddFile = resolution && !options.noResolve && i < file.imports.length && !elideImport; + var elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModuleJsDepth; + // Don't add the file if it has a bad extension (e.g. 'tsx' if we don't have '--allowJs') + // This may still end up being an untyped module -- the file won't be included but imports will be allowed. + var shouldAddFile = resolvedFileName && !getResolutionDiagnostic(options, resolution) && !options.noResolve && i < file.imports.length && !elideImport; if (elideImport) { modulesWithElidedImports[file.path] = true; } else if (shouldAddFile) { - findSourceFile(resolution.resolvedFileName, resolvedPath, - /*isDefaultLib*/ false, /*isReference*/ false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end); + var path = ts.toPath(resolvedFileName, currentDirectory, getCanonicalFileName); + var pos = ts.skipTrivia(file.text, file.imports[i].pos); + findSourceFile(resolvedFileName, path, /*isDefaultLib*/ false, file, pos, file.imports[i].end); } if (isFromNodeModulesSearch) { currentNodeModulesDepth--; @@ -45831,12 +63602,11 @@ var ts; // no imports - drop cached module resolutions file.resolvedModules = undefined; } - return; } function computeCommonSourceDirectory(sourceFiles) { var fileNames = []; - for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { - var file = sourceFiles_2[_i]; + for (var _i = 0, sourceFiles_6 = sourceFiles; _i < sourceFiles_6.length; _i++) { + var file = sourceFiles_6[_i]; if (!file.isDeclarationFile) { fileNames.push(file.fileName); } @@ -45847,8 +63617,8 @@ var ts; var allFilesBelongToPath = true; if (sourceFiles) { var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory)); - for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) { - var sourceFile = sourceFiles_3[_i]; + for (var _i = 0, sourceFiles_7 = sourceFiles; _i < sourceFiles_7.length; _i++) { + var sourceFile = sourceFiles_7[_i]; if (!ts.isDeclarationFile(sourceFile)) { var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { @@ -45891,7 +63661,7 @@ var ts; if (!ts.hasProperty(options.paths, key)) { continue; } - if (!hasZeroOrOneAsteriskCharacter(key)) { + if (!ts.hasZeroOrOneAsteriskCharacter(key)) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character, key)); } if (ts.isArray(options.paths[key])) { @@ -45902,7 +63672,7 @@ var ts; var subst = _a[_i]; var typeOfSubst = typeof subst; if (typeOfSubst === "string") { - if (!hasZeroOrOneAsteriskCharacter(subst)) { + if (!ts.hasZeroOrOneAsteriskCharacter(subst)) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character, subst, key)); } } @@ -45942,23 +63712,26 @@ var ts; if (options.lib && options.noLib) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "lib", "noLib")); } + if (options.noImplicitUseStrict && options.alwaysStrict) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noImplicitUseStrict", "alwaysStrict")); + } var languageVersion = options.target || 0 /* ES3 */; var outFile = options.outFile || options.out; var firstNonAmbientExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; }); if (options.isolatedModules) { - if (options.module === ts.ModuleKind.None && languageVersion < 2 /* ES6 */) { + if (options.module === ts.ModuleKind.None && languageVersion < 2 /* ES2015 */) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher)); } var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; }); if (firstNonExternalModuleSourceFile) { - var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); - programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided)); + var span_7 = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); + programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span_7.start, span_7.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided)); } } - else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 /* ES6 */ && options.module === ts.ModuleKind.None) { + else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 /* ES2015 */ && options.module === ts.ModuleKind.None) { // We cannot use createDiagnosticFromNode because nodes do not have parents yet - var span = ts.getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, firstNonAmbientExternalModuleSourceFile.externalModuleIndicator); - programDiagnostics.add(ts.createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_use_imports_exports_or_module_augmentations_when_module_is_none)); + var span_8 = ts.getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, firstNonAmbientExternalModuleSourceFile.externalModuleIndicator); + programDiagnostics.add(ts.createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span_8.start, span_8.length, ts.Diagnostics.Cannot_use_imports_exports_or_module_augmentations_when_module_is_none)); } // Cannot specify module gen that isn't amd or system with --out if (outFile) { @@ -45966,8 +63739,8 @@ var ts; programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile")); } else if (options.module === undefined && firstNonAmbientExternalModuleSourceFile) { - var span = ts.getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, firstNonAmbientExternalModuleSourceFile.externalModuleIndicator); - programDiagnostics.add(ts.createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system, options.out ? "out" : "outFile")); + var span_9 = ts.getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, firstNonAmbientExternalModuleSourceFile.externalModuleIndicator); + programDiagnostics.add(ts.createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span_9.start, span_9.length, ts.Diagnostics.Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system, options.out ? "out" : "outFile")); } } // there has to be common source directory if user specified --outdir || --sourceRoot @@ -45989,14 +63762,22 @@ var ts; !options.experimentalDecorators) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); } - if (options.reactNamespace && !ts.isIdentifier(options.reactNamespace, languageVersion)) { + if (options.jsxFactory) { + if (options.reactNamespace) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "reactNamespace", "jsxFactory")); + } + if (!ts.parseIsolatedEntityName(options.jsxFactory, languageVersion)) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name, options.jsxFactory)); + } + } + else if (options.reactNamespace && !ts.isIdentifierText(options.reactNamespace, languageVersion)) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier, options.reactNamespace)); } // If the emit is enabled make sure that every output file is unique and not overwriting any of the input files if (!options.noEmit && !options.suppressOutputPathCheck) { var emitHost = getEmitHost(); var emitFilesSeen_1 = ts.createFileMap(!host.useCaseSensitiveFileNames() ? function (key) { return key.toLocaleLowerCase(); } : undefined); - ts.forEachExpectedEmitFile(emitHost, function (emitFileNames, sourceFiles, isBundledEmit) { + ts.forEachExpectedEmitFile(emitHost, function (emitFileNames) { verifyEmitFilePath(emitFileNames.jsFilePath, emitFilesSeen_1); verifyEmitFilePath(emitFileNames.declarationFilePath, emitFilesSeen_1); }); @@ -46007,12 +63788,18 @@ var ts; var emitFilePath = ts.toPath(emitFileName, currentDirectory, getCanonicalFileName); // Report error if the output overwrites input file if (filesByName.contains(emitFilePath)) { - createEmitBlockingDiagnostics(emitFileName, emitFilePath, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file); + var chain_1; + if (!options.configFilePath) { + // The program is from either an inferred project or an external project + chain_1 = ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.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); + } + chain_1 = ts.chainDiagnosticMessages(chain_1, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file, emitFileName); + blockEmittingOfFile(emitFileName, ts.createCompilerDiagnosticFromMessageChain(chain_1)); } // Report error if multiple files write into same file if (emitFilesSeen.contains(emitFilePath)) { // Already seen the same emit file - report error - createEmitBlockingDiagnostics(emitFileName, emitFilePath, ts.Diagnostics.Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files); + blockEmittingOfFile(emitFileName, ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files, emitFileName)); } else { emitFilesSeen.set(emitFilePath, true); @@ -46020,12 +63807,40 @@ var ts; } } } - function createEmitBlockingDiagnostics(emitFileName, emitFilePath, message) { + function blockEmittingOfFile(emitFileName, diag) { hasEmitBlockingDiagnostics.set(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName), true); - programDiagnostics.add(ts.createCompilerDiagnostic(message, emitFileName)); + programDiagnostics.add(diag); } } ts.createProgram = createProgram; + /* @internal */ + /** + * Returns a DiagnosticMessage if we won't include a resolved module due to its extension. + * The DiagnosticMessage's parameters are the imported module name, and the filename it resolved to. + * This returns a diagnostic even if the module will be an untyped module. + */ + function getResolutionDiagnostic(options, _a) { + var extension = _a.extension; + switch (extension) { + case ts.Extension.Ts: + case ts.Extension.Dts: + // These are always allowed. + return undefined; + case ts.Extension.Tsx: + return needJsx(); + case ts.Extension.Jsx: + return needJsx() || needAllowJs(); + case ts.Extension.Js: + return needAllowJs(); + } + function needJsx() { + return options.jsx ? undefined : ts.Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set; + } + function needAllowJs() { + return options.allowJs ? undefined : ts.Diagnostics.Module_0_was_resolved_to_1_but_allowJs_is_not_set; + } + } + ts.getResolutionDiagnostic = getResolutionDiagnostic; })(ts || (ts = {})); /// /// @@ -46034,31 +63849,35 @@ var ts; /// var ts; (function (ts) { + /* @internal */ + ts.compileOnSaveCommandLineOption = { name: "compileOnSave", type: "boolean" }; /* @internal */ ts.optionDeclarations = [ { name: "charset", - type: "string" + type: "string", }, + ts.compileOnSaveCommandLineOption, { name: "declaration", shortName: "d", type: "boolean", - description: ts.Diagnostics.Generates_corresponding_d_ts_file + description: ts.Diagnostics.Generates_corresponding_d_ts_file, }, { name: "declarationDir", type: "string", isFilePath: true, - paramType: ts.Diagnostics.DIRECTORY + paramType: ts.Diagnostics.DIRECTORY, }, { name: "diagnostics", - type: "boolean" + type: "boolean", }, { name: "extendedDiagnostics", - type: "boolean" + type: "boolean", + experimental: true }, { name: "emitBOM", @@ -46068,7 +63887,7 @@ var ts; name: "help", shortName: "h", type: "boolean", - description: ts.Diagnostics.Print_this_message + description: ts.Diagnostics.Print_this_message, }, { name: "help", @@ -46078,15 +63897,15 @@ var ts; { name: "init", type: "boolean", - description: ts.Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file + description: ts.Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file, }, { name: "inlineSourceMap", - type: "boolean" + type: "boolean", }, { name: "inlineSources", - type: "boolean" + type: "boolean", }, { name: "jsx", @@ -46095,27 +63914,32 @@ var ts; "react": 2 /* React */ }), paramType: ts.Diagnostics.KIND, - description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react + description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react, }, { name: "reactNamespace", type: "string", description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit }, + { + name: "jsxFactory", + type: "string", + description: ts.Diagnostics.Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h + }, { name: "listFiles", - type: "boolean" + type: "boolean", }, { name: "locale", - type: "string" + type: "string", }, { name: "mapRoot", type: "string", isFilePath: true, description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, - paramType: ts.Diagnostics.LOCATION + paramType: ts.Diagnostics.LOCATION, }, { name: "module", @@ -46126,11 +63950,11 @@ var ts; "amd": ts.ModuleKind.AMD, "system": ts.ModuleKind.System, "umd": ts.ModuleKind.UMD, - "es6": ts.ModuleKind.ES6, - "es2015": ts.ModuleKind.ES2015 + "es6": ts.ModuleKind.ES2015, + "es2015": ts.ModuleKind.ES2015, }), description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015, - paramType: ts.Diagnostics.KIND + paramType: ts.Diagnostics.KIND, }, { name: "newLine", @@ -46139,12 +63963,12 @@ var ts; "lf": 1 /* LineFeed */ }), description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, - paramType: ts.Diagnostics.NEWLINE + paramType: ts.Diagnostics.NEWLINE, }, { name: "noEmit", type: "boolean", - description: ts.Diagnostics.Do_not_emit_outputs + description: ts.Diagnostics.Do_not_emit_outputs, }, { name: "noEmitHelpers", @@ -46153,7 +63977,7 @@ var ts; { name: "noEmitOnError", type: "boolean", - description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported + description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported, }, { name: "noErrorTruncation", @@ -46162,60 +63986,60 @@ var ts; { name: "noImplicitAny", type: "boolean", - description: ts.Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type + description: ts.Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type, }, { name: "noImplicitThis", type: "boolean", - description: ts.Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type + description: ts.Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type, }, { name: "noUnusedLocals", type: "boolean", - description: ts.Diagnostics.Report_errors_on_unused_locals + description: ts.Diagnostics.Report_errors_on_unused_locals, }, { name: "noUnusedParameters", type: "boolean", - description: ts.Diagnostics.Report_errors_on_unused_parameters + description: ts.Diagnostics.Report_errors_on_unused_parameters, }, { name: "noLib", - type: "boolean" + type: "boolean", }, { name: "noResolve", - type: "boolean" + type: "boolean", }, { name: "skipDefaultLibCheck", - type: "boolean" + type: "boolean", }, { name: "skipLibCheck", type: "boolean", - description: ts.Diagnostics.Skip_type_checking_of_declaration_files + description: ts.Diagnostics.Skip_type_checking_of_declaration_files, }, { name: "out", type: "string", isFilePath: false, // for correct behaviour, please use outFile - paramType: ts.Diagnostics.FILE + paramType: ts.Diagnostics.FILE, }, { name: "outFile", type: "string", isFilePath: true, description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file, - paramType: ts.Diagnostics.FILE + paramType: ts.Diagnostics.FILE, }, { name: "outDir", type: "string", isFilePath: true, description: ts.Diagnostics.Redirect_output_structure_to_the_directory, - paramType: ts.Diagnostics.DIRECTORY + paramType: ts.Diagnostics.DIRECTORY, }, { name: "preserveConstEnums", @@ -46238,30 +64062,30 @@ var ts; { name: "removeComments", type: "boolean", - description: ts.Diagnostics.Do_not_emit_comments_to_output + description: ts.Diagnostics.Do_not_emit_comments_to_output, }, { name: "rootDir", type: "string", isFilePath: true, paramType: ts.Diagnostics.LOCATION, - description: ts.Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir + description: ts.Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir, }, { name: "isolatedModules", - type: "boolean" + type: "boolean", }, { name: "sourceMap", type: "boolean", - description: ts.Diagnostics.Generates_corresponding_map_file + description: ts.Diagnostics.Generates_corresponding_map_file, }, { name: "sourceRoot", type: "string", isFilePath: true, description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, - paramType: ts.Diagnostics.LOCATION + paramType: ts.Diagnostics.LOCATION, }, { name: "suppressExcessPropertyErrors", @@ -46272,7 +64096,7 @@ var ts; { name: "suppressImplicitAnyIndexErrors", type: "boolean", - description: ts.Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures + description: ts.Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures, }, { name: "stripInternal", @@ -46286,23 +64110,26 @@ var ts; type: ts.createMap({ "es3": 0 /* ES3 */, "es5": 1 /* ES5 */, - "es6": 2 /* ES6 */, - "es2015": 2 /* ES2015 */ + "es6": 2 /* ES2015 */, + "es2015": 2 /* ES2015 */, + "es2016": 3 /* ES2016 */, + "es2017": 4 /* ES2017 */, + "esnext": 5 /* ESNext */, }), - description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015, - paramType: ts.Diagnostics.VERSION + description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT, + paramType: ts.Diagnostics.VERSION, }, { name: "version", shortName: "v", type: "boolean", - description: ts.Diagnostics.Print_the_compiler_s_version + description: ts.Diagnostics.Print_the_compiler_s_version, }, { name: "watch", shortName: "w", type: "boolean", - description: ts.Diagnostics.Watch_input_files + description: ts.Diagnostics.Watch_input_files, }, { name: "experimentalDecorators", @@ -46319,9 +64146,10 @@ var ts; name: "moduleResolution", type: ts.createMap({ "node": ts.ModuleResolutionKind.NodeJs, - "classic": ts.ModuleResolutionKind.Classic + "classic": ts.ModuleResolutionKind.Classic, }), - description: ts.Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6 + description: ts.Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, + paramType: ts.Diagnostics.STRATEGY, }, { name: "allowUnusedLabels", @@ -46435,6 +64263,7 @@ var ts; "es2017": "lib.es2017.d.ts", // Host only "dom": "lib.dom.d.ts", + "dom.iterable": "lib.dom.iterable.d.ts", "webworker": "lib.webworker.d.ts", "scripthost": "lib.scripthost.d.ts", // ES2015 Or ESNext By-feature options @@ -46449,8 +64278,9 @@ var ts; "es2015.symbol.wellknown": "lib.es2015.symbol.wellknown.d.ts", "es2016.array.include": "lib.es2016.array.include.d.ts", "es2017.object": "lib.es2017.object.d.ts", - "es2017.sharedmemory": "lib.es2017.sharedmemory.d.ts" - }) + "es2017.sharedmemory": "lib.es2017.sharedmemory.d.ts", + "es2017.string": "lib.es2017.string.d.ts", + }), }, description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon }, @@ -46462,13 +64292,30 @@ var ts; name: "strictNullChecks", type: "boolean", description: ts.Diagnostics.Enable_strict_null_checks + }, + { + name: "importHelpers", + type: "boolean", + description: ts.Diagnostics.Import_emit_helpers_from_tslib + }, + { + name: "alwaysStrict", + type: "boolean", + description: ts.Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file } ]; /* @internal */ - ts.typingOptionDeclarations = [ + ts.typeAcquisitionDeclarations = [ { + /* @deprecated typingOptions.enableAutoDiscovery + * Use typeAcquisition.enable instead. + */ name: "enableAutoDiscovery", - type: "boolean" + type: "boolean", + }, + { + name: "enable", + type: "boolean", }, { name: "include", @@ -46492,10 +64339,24 @@ var ts; module: ts.ModuleKind.CommonJS, target: 1 /* ES5 */, noImplicitAny: false, - sourceMap: false + sourceMap: false, }; 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; @@ -46514,23 +64375,13 @@ var ts; ts.getOptionNameMap = getOptionNameMap; /* @internal */ function createCompilerDiagnosticForInvalidCustomType(opt) { - var namesOfType = []; - for (var key in opt.type) { - namesOfType.push(" '" + key + "'"); - } + var namesOfType = Object.keys(opt.type).map(function (key) { return "'" + key + "'"; }).join(", "); return ts.createCompilerDiagnostic(ts.Diagnostics.Argument_for_0_option_must_be_Colon_1, "--" + opt.name, namesOfType); } ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType; /* @internal */ function parseCustomTypeOption(opt, value, errors) { - var key = trimString((value || "")).toLowerCase(); - var map = opt.type; - if (key in map) { - return map[key]; - } - else { - errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); - } + return convertJsonOptionOfCustomType(opt, trimString(value || ""), errors); } ts.parseCustomTypeOption = parseCustomTypeOption; /* @internal */ @@ -46554,7 +64405,6 @@ var ts; } } ts.parseListTypeOption = parseListTypeOption; - /* @internal */ function parseCommandLine(commandLine, readFile) { var options = {}; var fileNames = []; @@ -46596,7 +64446,13 @@ var ts; i++; break; case "boolean": - options[opt.name] = true; + // boolean flag has optional value true, false, others + var optValue = args[i]; + options[opt.name] = optValue !== "false"; + // consume next argument as boolean flag value + if (optValue === "false" || optValue === "true") { + i++; + } break; case "string": options[opt.name] = args[i] || ""; @@ -46682,10 +64538,11 @@ var ts; * @param fileName The path to the config file * @param jsonText The text of the config file */ - function parseConfigFileTextToJson(fileName, jsonText) { + function parseConfigFileTextToJson(fileName, jsonText, stripComments) { + if (stripComments === void 0) { stripComments = true; } try { - var jsonTextWithoutComments = removeComments(jsonText); - return { config: /\S/.test(jsonTextWithoutComments) ? JSON.parse(jsonTextWithoutComments) : {} }; + var jsonTextToParse = stripComments ? removeComments(jsonText) : jsonText; + return { config: /\S/.test(jsonTextToParse) ? JSON.parse(jsonTextToParse) : {} }; } catch (e) { return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Failed_to_parse_file_0_Colon_1, fileName, e.message) }; @@ -46732,11 +64589,11 @@ var ts; function serializeCompilerOptions(options) { var result = ts.createMap(); var optionsNameMap = getOptionNameMap().optionNameMap; - for (var name_35 in options) { - if (ts.hasProperty(options, name_35)) { + for (var name_44 in options) { + if (ts.hasProperty(options, name_44)) { // 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_35) { + switch (name_44) { case "init": case "watch": case "version": @@ -46744,14 +64601,14 @@ var ts; case "project": break; default: - var value = options[name_35]; - var optionDefinition = optionsNameMap[name_35.toLowerCase()]; + var value = options[name_44]; + var optionDefinition = optionsNameMap[name_44.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_35] = value; + result[name_44] = value; } else { if (optionDefinition.type === "list") { @@ -46760,11 +64617,11 @@ var ts; var element = _a[_i]; convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap)); } - result[name_35] = convertedValue; + result[name_44] = convertedValue; } else { // There is a typeMap associated with this command-line option so use it to map value back to its name - result[name_35] = getNameOfCompilerOptionValue(value, customTypeMap); + result[name_44] = getNameOfCompilerOptionValue(value, customTypeMap); } } } @@ -46807,27 +64664,100 @@ var ts; * @param basePath A root directory to resolve relative path entries in the config * file to. e.g. outDir */ - function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName) { + function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) { if (existingOptions === void 0) { existingOptions = {}; } + if (resolutionStack === void 0) { resolutionStack = []; } + if (extraFileExtensions === void 0) { extraFileExtensions = []; } var errors = []; - var compilerOptions = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName); - var options = ts.extend(existingOptions, compilerOptions); - var typingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName); + var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); + var resolvedPath = ts.toPath(configFileName || "", basePath, getCanonicalFileName); + if (resolutionStack.indexOf(resolvedPath) >= 0) { + return { + options: {}, + fileNames: [], + 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); + // 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") { + _b = (tryExtendsName(json["extends"]) || [include, exclude, files, baseOptions]), include = _b[0], exclude = _b[1], files = _b[2], baseOptions = _b[3]; + } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "extends", "string")); + } + if (include && !json["include"]) { + json["include"] = include; + } + if (exclude && !json["exclude"]) { + json["exclude"] = exclude; + } + if (files && !json["files"]) { + json["files"] = files; + } + options = ts.assign({}, baseOptions, options); + } + options = ts.extend(existingOptions, options); options.configFilePath = configFileName; - var _a = getFileNames(errors), fileNames = _a.fileNames, wildcardDirectories = _a.wildcardDirectories; + var _c = getFileNames(errors), fileNames = _c.fileNames, wildcardDirectories = _c.wildcardDirectories; + var compileOnSave = convertCompileOnSaveOptionFromJson(json, basePath, errors); return { options: options, fileNames: fileNames, - typingOptions: typingOptions, + typeAcquisition: typeAcquisition, raw: json, errors: errors, - wildcardDirectories: wildcardDirectories + wildcardDirectories: wildcardDirectories, + compileOnSave: compileOnSave }; + 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.A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not, extendedConfig)); + return; + } + var extendedConfigPath = ts.toPath(extendedConfig, basePath, getCanonicalFileName); + if (!host.fileExists(extendedConfigPath) && !ts.endsWith(extendedConfigPath, ".json")) { + extendedConfigPath = extendedConfigPath + ".json"; + if (!host.fileExists(extendedConfigPath)) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_does_not_exist, extendedConfig)); + return; + } + } + var extendedResult = readConfigFile(extendedConfigPath, function (path) { return host.readFile(path); }); + if (extendedResult.error) { + errors.push(extendedResult.error); + return; + } + var extendedDirname = ts.getDirectoryPath(extendedConfigPath); + var relativeDifference = ts.convertToRelativePath(extendedDirname, basePath, getCanonicalFileName); + var updatePath = function (path) { return ts.isRootedDiskPath(path) ? path : ts.combinePaths(relativeDifference, path); }; + // Merge configs (copy the resolution stack so it is never reused between branches in potential diamond-problem scenarios) + var result = parseJsonConfigFileContent(extendedResult.config, host, extendedDirname, /*existingOptions*/ undefined, ts.getBaseFileName(extendedConfigPath), resolutionStack.concat([resolvedPath])); + errors.push.apply(errors, result.errors); + var _a = ts.map(["include", "exclude", "files"], function (key) { + if (!json[key] && extendedResult.config[key]) { + return ts.map(extendedResult.config[key], updatePath); + } + }), include = _a[0], exclude = _a[1], files = _a[2]; + return [include, exclude, files, result.options]; + } function getFileNames(errors) { var fileNames; if (ts.hasProperty(json, "files")) { if (ts.isArray(json["files"])) { fileNames = json["files"]; + if (fileNames.length === 0) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.The_files_list_in_config_file_0_is_empty, configFileName || "tsconfig.json")); + } } else { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "files", "Array")); @@ -46855,43 +64785,59 @@ var ts; errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude)); } else { - // By default, exclude common package folders - excludeSpecs = ["node_modules", "bower_components", "jspm_packages"]; - } - // Always exclude the output directory unless explicitly included - var outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"]; - if (outDir) { - excludeSpecs.push(outDir); + // 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); + } } if (fileNames === undefined && includeSpecs === undefined) { includeSpecs = ["**/*"]; } - return matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors); + var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors, extraFileExtensions); + if (result.fileNames.length === 0 && !ts.hasProperty(json, "files") && resolutionStack.length === 0) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, configFileName || "tsconfig.json", JSON.stringify(includeSpecs || []), JSON.stringify(excludeSpecs || []))); + } + return result; } + var _b; } ts.parseJsonConfigFileContent = parseJsonConfigFileContent; + function convertCompileOnSaveOptionFromJson(jsonOption, basePath, errors) { + if (!ts.hasProperty(jsonOption, ts.compileOnSaveCommandLineOption.name)) { + return false; + } + var result = convertJsonOption(ts.compileOnSaveCommandLineOption, jsonOption["compileOnSave"], basePath, errors); + if (typeof result === "boolean" && result) { + return result; + } + return false; + } + ts.convertCompileOnSaveOptionFromJson = convertCompileOnSaveOptionFromJson; function convertCompilerOptionsFromJson(jsonOptions, basePath, configFileName) { var errors = []; var options = convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); 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 } : {}; + var options = ts.getBaseFileName(configFileName) === "jsconfig.json" + ? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true, skipLibCheck: true } + : {}; convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors); return options; } - function convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) { - var options = ts.getBaseFileName(configFileName) === "jsconfig.json" - ? { enableAutoDiscovery: true, include: [], exclude: [] } - : { enableAutoDiscovery: false, 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) { @@ -47026,7 +64972,7 @@ var ts; * @param host The host used to resolve files and directories. * @param errors An array for diagnostic reporting. */ - function matchFileNames(fileNames, include, exclude, basePath, options, host, errors) { + function matchFileNames(fileNames, include, exclude, basePath, options, host, errors, extraFileExtensions) { basePath = ts.normalizePath(basePath); // The exclude spec list is converted into a regular expression, which allows us to quickly // test whether a file or directory should be excluded before recursively traversing the @@ -47053,7 +64999,7 @@ var ts; var wildcardDirectories = getWildcardDirectories(include, exclude, basePath, host.useCaseSensitiveFileNames); // Rather than requery this for each file and filespec, we query the supported extensions // once and store it on the expansion context. - var supportedExtensions = ts.getSupportedExtensions(options); + var supportedExtensions = ts.getSupportedExtensions(options, extraFileExtensions); // Literal files are always included verbatim. An "include" or "exclude" specification cannot // remove a literal file. if (fileNames) { @@ -47122,6 +65068,7 @@ var ts; // // /a/b/**/d - Watch /a/b recursively to catch changes to any d in any subfolder recursively // /a/b/*/d - Watch /a/b recursively to catch any d in any immediate subfolder, even if a new subfolder is added + // /a/b - Watch /a/b recursively to catch changes to anything in any recursive subfoler // // We watch a directory without recursion if it contains a wildcard in the file segment of // the pattern: @@ -47135,14 +65082,13 @@ var ts; var recursiveKeys = []; for (var _i = 0, include_1 = include; _i < include_1.length; _i++) { var file = include_1[_i]; - var name_36 = ts.normalizePath(ts.combinePaths(path, file)); - if (excludeRegex && excludeRegex.test(name_36)) { + var spec = ts.normalizePath(ts.combinePaths(path, file)); + if (excludeRegex && excludeRegex.test(spec)) { continue; } - var match = wildcardDirectoryPattern.exec(name_36); + var match = getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames); if (match) { - var key = useCaseSensitiveFileNames ? match[0] : match[0].toLowerCase(); - var flags = watchRecursivePattern.test(name_36) ? 1 /* Recursive */ : 0 /* None */; + var key = match.key, flags = match.flags; var existingFlags = wildcardDirectories[key]; if (existingFlags === undefined || existingFlags < flags) { wildcardDirectories[key] = flags; @@ -47164,6 +65110,19 @@ var ts; } return wildcardDirectories; } + function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames) { + var match = wildcardDirectoryPattern.exec(spec); + if (match) { + return { + key: useCaseSensitiveFileNames ? match[0] : match[0].toLowerCase(), + flags: watchRecursivePattern.test(spec) ? 1 /* Recursive */ : 0 /* None */ + }; + } + if (ts.isImplicitGlob(spec)) { + return { key: spec, flags: 1 /* Recursive */ }; + } + return undefined; + } /** * Determines whether a literal or wildcard file has already been included that has a higher * extension priority. @@ -47228,193 +65187,6591 @@ var ts; return key.toLowerCase(); } })(ts || (ts = {})); +var ts; +(function (ts) { + var ScriptSnapshot; + (function (ScriptSnapshot) { + var StringScriptSnapshot = (function () { + function StringScriptSnapshot(text) { + this.text = text; + } + StringScriptSnapshot.prototype.getText = function (start, end) { + return start === 0 && end === this.text.length + ? this.text + : this.text.substring(start, end); + }; + StringScriptSnapshot.prototype.getLength = function () { + return this.text.length; + }; + StringScriptSnapshot.prototype.getChangeRange = function () { + // Text-based snapshots do not support incremental parsing. Return undefined + // to signal that to the caller. + return undefined; + }; + return StringScriptSnapshot; + }()); + function fromString(text) { + return new StringScriptSnapshot(text); + } + ScriptSnapshot.fromString = fromString; + })(ScriptSnapshot = ts.ScriptSnapshot || (ts.ScriptSnapshot = {})); + var TextChange = (function () { + function TextChange() { + } + return TextChange; + }()); + ts.TextChange = TextChange; + var HighlightSpanKind; + (function (HighlightSpanKind) { + HighlightSpanKind.none = "none"; + HighlightSpanKind.definition = "definition"; + HighlightSpanKind.reference = "reference"; + HighlightSpanKind.writtenReference = "writtenReference"; + })(HighlightSpanKind = ts.HighlightSpanKind || (ts.HighlightSpanKind = {})); + var IndentStyle; + (function (IndentStyle) { + IndentStyle[IndentStyle["None"] = 0] = "None"; + IndentStyle[IndentStyle["Block"] = 1] = "Block"; + IndentStyle[IndentStyle["Smart"] = 2] = "Smart"; + })(IndentStyle = ts.IndentStyle || (ts.IndentStyle = {})); + var SymbolDisplayPartKind; + (function (SymbolDisplayPartKind) { + SymbolDisplayPartKind[SymbolDisplayPartKind["aliasName"] = 0] = "aliasName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["className"] = 1] = "className"; + SymbolDisplayPartKind[SymbolDisplayPartKind["enumName"] = 2] = "enumName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["fieldName"] = 3] = "fieldName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["interfaceName"] = 4] = "interfaceName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["keyword"] = 5] = "keyword"; + SymbolDisplayPartKind[SymbolDisplayPartKind["lineBreak"] = 6] = "lineBreak"; + SymbolDisplayPartKind[SymbolDisplayPartKind["numericLiteral"] = 7] = "numericLiteral"; + SymbolDisplayPartKind[SymbolDisplayPartKind["stringLiteral"] = 8] = "stringLiteral"; + SymbolDisplayPartKind[SymbolDisplayPartKind["localName"] = 9] = "localName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["methodName"] = 10] = "methodName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["moduleName"] = 11] = "moduleName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["operator"] = 12] = "operator"; + SymbolDisplayPartKind[SymbolDisplayPartKind["parameterName"] = 13] = "parameterName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["propertyName"] = 14] = "propertyName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["punctuation"] = 15] = "punctuation"; + SymbolDisplayPartKind[SymbolDisplayPartKind["space"] = 16] = "space"; + SymbolDisplayPartKind[SymbolDisplayPartKind["text"] = 17] = "text"; + SymbolDisplayPartKind[SymbolDisplayPartKind["typeParameterName"] = 18] = "typeParameterName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["enumMemberName"] = 19] = "enumMemberName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["functionName"] = 20] = "functionName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["regularExpressionLiteral"] = 21] = "regularExpressionLiteral"; + })(SymbolDisplayPartKind = ts.SymbolDisplayPartKind || (ts.SymbolDisplayPartKind = {})); + var OutputFileType; + (function (OutputFileType) { + OutputFileType[OutputFileType["JavaScript"] = 0] = "JavaScript"; + OutputFileType[OutputFileType["SourceMap"] = 1] = "SourceMap"; + OutputFileType[OutputFileType["Declaration"] = 2] = "Declaration"; + })(OutputFileType = ts.OutputFileType || (ts.OutputFileType = {})); + var EndOfLineState; + (function (EndOfLineState) { + EndOfLineState[EndOfLineState["None"] = 0] = "None"; + EndOfLineState[EndOfLineState["InMultiLineCommentTrivia"] = 1] = "InMultiLineCommentTrivia"; + EndOfLineState[EndOfLineState["InSingleQuoteStringLiteral"] = 2] = "InSingleQuoteStringLiteral"; + EndOfLineState[EndOfLineState["InDoubleQuoteStringLiteral"] = 3] = "InDoubleQuoteStringLiteral"; + EndOfLineState[EndOfLineState["InTemplateHeadOrNoSubstitutionTemplate"] = 4] = "InTemplateHeadOrNoSubstitutionTemplate"; + EndOfLineState[EndOfLineState["InTemplateMiddleOrTail"] = 5] = "InTemplateMiddleOrTail"; + EndOfLineState[EndOfLineState["InTemplateSubstitutionPosition"] = 6] = "InTemplateSubstitutionPosition"; + })(EndOfLineState = ts.EndOfLineState || (ts.EndOfLineState = {})); + var TokenClass; + (function (TokenClass) { + TokenClass[TokenClass["Punctuation"] = 0] = "Punctuation"; + TokenClass[TokenClass["Keyword"] = 1] = "Keyword"; + TokenClass[TokenClass["Operator"] = 2] = "Operator"; + TokenClass[TokenClass["Comment"] = 3] = "Comment"; + TokenClass[TokenClass["Whitespace"] = 4] = "Whitespace"; + TokenClass[TokenClass["Identifier"] = 5] = "Identifier"; + TokenClass[TokenClass["NumberLiteral"] = 6] = "NumberLiteral"; + TokenClass[TokenClass["StringLiteral"] = 7] = "StringLiteral"; + TokenClass[TokenClass["RegExpLiteral"] = 8] = "RegExpLiteral"; + })(TokenClass = ts.TokenClass || (ts.TokenClass = {})); + // TODO: move these to enums + var ScriptElementKind; + (function (ScriptElementKind) { + ScriptElementKind.unknown = ""; + ScriptElementKind.warning = "warning"; + /** predefined type (void) or keyword (class) */ + ScriptElementKind.keyword = "keyword"; + /** top level script node */ + ScriptElementKind.scriptElement = "script"; + /** module foo {} */ + ScriptElementKind.moduleElement = "module"; + /** class X {} */ + ScriptElementKind.classElement = "class"; + /** var x = class X {} */ + ScriptElementKind.localClassElement = "local class"; + /** interface Y {} */ + ScriptElementKind.interfaceElement = "interface"; + /** type T = ... */ + ScriptElementKind.typeElement = "type"; + /** enum E */ + ScriptElementKind.enumElement = "enum"; + // TODO: GH#9983 + ScriptElementKind.enumMemberElement = "const"; + /** + * Inside module and script only + * const v = .. + */ + ScriptElementKind.variableElement = "var"; + /** Inside function */ + ScriptElementKind.localVariableElement = "local var"; + /** + * Inside module and script only + * function f() { } + */ + ScriptElementKind.functionElement = "function"; + /** Inside function */ + ScriptElementKind.localFunctionElement = "local function"; + /** class X { [public|private]* foo() {} } */ + ScriptElementKind.memberFunctionElement = "method"; + /** class X { [public|private]* [get|set] foo:number; } */ + ScriptElementKind.memberGetAccessorElement = "getter"; + ScriptElementKind.memberSetAccessorElement = "setter"; + /** + * class X { [public|private]* foo:number; } + * interface Y { foo:number; } + */ + ScriptElementKind.memberVariableElement = "property"; + /** class X { constructor() { } } */ + ScriptElementKind.constructorImplementationElement = "constructor"; + /** interface Y { ():number; } */ + ScriptElementKind.callSignatureElement = "call"; + /** interface Y { []:number; } */ + ScriptElementKind.indexSignatureElement = "index"; + /** interface Y { new():Y; } */ + ScriptElementKind.constructSignatureElement = "construct"; + /** function foo(*Y*: string) */ + ScriptElementKind.parameterElement = "parameter"; + ScriptElementKind.typeParameterElement = "type parameter"; + ScriptElementKind.primitiveType = "primitive type"; + ScriptElementKind.label = "label"; + ScriptElementKind.alias = "alias"; + ScriptElementKind.constElement = "const"; + ScriptElementKind.letElement = "let"; + ScriptElementKind.directory = "directory"; + ScriptElementKind.externalModuleName = "external module name"; + })(ScriptElementKind = ts.ScriptElementKind || (ts.ScriptElementKind = {})); + var ScriptElementKindModifier; + (function (ScriptElementKindModifier) { + ScriptElementKindModifier.none = ""; + ScriptElementKindModifier.publicMemberModifier = "public"; + ScriptElementKindModifier.privateMemberModifier = "private"; + ScriptElementKindModifier.protectedMemberModifier = "protected"; + ScriptElementKindModifier.exportedModifier = "export"; + ScriptElementKindModifier.ambientModifier = "declare"; + ScriptElementKindModifier.staticModifier = "static"; + ScriptElementKindModifier.abstractModifier = "abstract"; + })(ScriptElementKindModifier = ts.ScriptElementKindModifier || (ts.ScriptElementKindModifier = {})); + var ClassificationTypeNames = (function () { + function ClassificationTypeNames() { + } + return ClassificationTypeNames; + }()); + ClassificationTypeNames.comment = "comment"; + ClassificationTypeNames.identifier = "identifier"; + ClassificationTypeNames.keyword = "keyword"; + ClassificationTypeNames.numericLiteral = "number"; + ClassificationTypeNames.operator = "operator"; + ClassificationTypeNames.stringLiteral = "string"; + ClassificationTypeNames.whiteSpace = "whitespace"; + ClassificationTypeNames.text = "text"; + ClassificationTypeNames.punctuation = "punctuation"; + ClassificationTypeNames.className = "class name"; + ClassificationTypeNames.enumName = "enum name"; + ClassificationTypeNames.interfaceName = "interface name"; + ClassificationTypeNames.moduleName = "module name"; + ClassificationTypeNames.typeParameterName = "type parameter name"; + ClassificationTypeNames.typeAliasName = "type alias name"; + ClassificationTypeNames.parameterName = "parameter name"; + ClassificationTypeNames.docCommentTagName = "doc comment tag name"; + ClassificationTypeNames.jsxOpenTagName = "jsx open tag name"; + ClassificationTypeNames.jsxCloseTagName = "jsx close tag name"; + ClassificationTypeNames.jsxSelfClosingTagName = "jsx self closing tag name"; + ClassificationTypeNames.jsxAttribute = "jsx attribute"; + ClassificationTypeNames.jsxText = "jsx text"; + ClassificationTypeNames.jsxAttributeStringLiteralValue = "jsx attribute string literal value"; + ts.ClassificationTypeNames = ClassificationTypeNames; + var ClassificationType; + (function (ClassificationType) { + ClassificationType[ClassificationType["comment"] = 1] = "comment"; + ClassificationType[ClassificationType["identifier"] = 2] = "identifier"; + ClassificationType[ClassificationType["keyword"] = 3] = "keyword"; + ClassificationType[ClassificationType["numericLiteral"] = 4] = "numericLiteral"; + ClassificationType[ClassificationType["operator"] = 5] = "operator"; + ClassificationType[ClassificationType["stringLiteral"] = 6] = "stringLiteral"; + ClassificationType[ClassificationType["regularExpressionLiteral"] = 7] = "regularExpressionLiteral"; + ClassificationType[ClassificationType["whiteSpace"] = 8] = "whiteSpace"; + ClassificationType[ClassificationType["text"] = 9] = "text"; + ClassificationType[ClassificationType["punctuation"] = 10] = "punctuation"; + ClassificationType[ClassificationType["className"] = 11] = "className"; + ClassificationType[ClassificationType["enumName"] = 12] = "enumName"; + ClassificationType[ClassificationType["interfaceName"] = 13] = "interfaceName"; + ClassificationType[ClassificationType["moduleName"] = 14] = "moduleName"; + ClassificationType[ClassificationType["typeParameterName"] = 15] = "typeParameterName"; + ClassificationType[ClassificationType["typeAliasName"] = 16] = "typeAliasName"; + ClassificationType[ClassificationType["parameterName"] = 17] = "parameterName"; + ClassificationType[ClassificationType["docCommentTagName"] = 18] = "docCommentTagName"; + ClassificationType[ClassificationType["jsxOpenTagName"] = 19] = "jsxOpenTagName"; + ClassificationType[ClassificationType["jsxCloseTagName"] = 20] = "jsxCloseTagName"; + ClassificationType[ClassificationType["jsxSelfClosingTagName"] = 21] = "jsxSelfClosingTagName"; + ClassificationType[ClassificationType["jsxAttribute"] = 22] = "jsxAttribute"; + ClassificationType[ClassificationType["jsxText"] = 23] = "jsxText"; + ClassificationType[ClassificationType["jsxAttributeStringLiteralValue"] = 24] = "jsxAttributeStringLiteralValue"; + })(ClassificationType = ts.ClassificationType || (ts.ClassificationType = {})); +})(ts || (ts = {})); +// These utilities are common to multiple language service features. /* @internal */ var ts; (function (ts) { - var OutliningElementsCollector; - (function (OutliningElementsCollector) { - function collectElements(sourceFile) { - var elements = []; - var collapseText = "..."; - function addOutliningSpan(hintSpanNode, startElement, endElement, autoCollapse) { - if (hintSpanNode && startElement && endElement) { - var span = { - textSpan: ts.createTextSpanFromBounds(startElement.pos, endElement.end), - hintSpan: ts.createTextSpanFromBounds(hintSpanNode.getStart(), hintSpanNode.end), - bannerText: collapseText, - autoCollapse: autoCollapse - }; - elements.push(span); + ts.scanner = ts.createScanner(5 /* Latest */, /*skipTrivia*/ true); + ts.emptyArray = []; + var SemanticMeaning; + (function (SemanticMeaning) { + SemanticMeaning[SemanticMeaning["None"] = 0] = "None"; + SemanticMeaning[SemanticMeaning["Value"] = 1] = "Value"; + SemanticMeaning[SemanticMeaning["Type"] = 2] = "Type"; + SemanticMeaning[SemanticMeaning["Namespace"] = 4] = "Namespace"; + SemanticMeaning[SemanticMeaning["All"] = 7] = "All"; + })(SemanticMeaning = ts.SemanticMeaning || (ts.SemanticMeaning = {})); + function getMeaningFromDeclaration(node) { + switch (node.kind) { + case 144 /* Parameter */: + case 223 /* VariableDeclaration */: + case 174 /* BindingElement */: + case 147 /* PropertyDeclaration */: + case 146 /* PropertySignature */: + case 257 /* PropertyAssignment */: + case 258 /* ShorthandPropertyAssignment */: + case 260 /* EnumMember */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + case 150 /* Constructor */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + case 225 /* FunctionDeclaration */: + case 184 /* FunctionExpression */: + case 185 /* ArrowFunction */: + case 256 /* CatchClause */: + return 1 /* Value */; + case 143 /* TypeParameter */: + case 227 /* InterfaceDeclaration */: + case 228 /* TypeAliasDeclaration */: + case 161 /* TypeLiteral */: + return 2 /* Type */; + case 226 /* ClassDeclaration */: + case 229 /* EnumDeclaration */: + return 1 /* Value */ | 2 /* Type */; + case 230 /* ModuleDeclaration */: + if (ts.isAmbientModule(node)) { + return 4 /* Namespace */ | 1 /* Value */; } - } - function addOutliningSpanComments(commentSpan, autoCollapse) { - if (commentSpan) { - var span = { - textSpan: ts.createTextSpanFromBounds(commentSpan.pos, commentSpan.end), - hintSpan: ts.createTextSpanFromBounds(commentSpan.pos, commentSpan.end), - bannerText: collapseText, - autoCollapse: autoCollapse - }; - elements.push(span); + else if (ts.getModuleInstanceState(node) === 1 /* Instantiated */) { + return 4 /* Namespace */ | 1 /* Value */; } + else { + return 4 /* Namespace */; + } + case 238 /* NamedImports */: + case 239 /* ImportSpecifier */: + case 234 /* ImportEqualsDeclaration */: + case 235 /* ImportDeclaration */: + case 240 /* ExportAssignment */: + case 241 /* ExportDeclaration */: + return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; + // An external module can be a Value + case 261 /* SourceFile */: + return 4 /* Namespace */ | 1 /* Value */; + } + return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; + } + ts.getMeaningFromDeclaration = getMeaningFromDeclaration; + function getMeaningFromLocation(node) { + if (node.parent.kind === 240 /* ExportAssignment */) { + return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; + } + else if (isInRightSideOfImport(node)) { + return getMeaningFromRightHandSideOfImportEquals(node); + } + else if (ts.isDeclarationName(node)) { + return getMeaningFromDeclaration(node.parent); + } + else if (isTypeReference(node)) { + return 2 /* Type */; + } + else if (isNamespaceReference(node)) { + return 4 /* Namespace */; + } + else { + return 1 /* Value */; + } + } + ts.getMeaningFromLocation = getMeaningFromLocation; + function getMeaningFromRightHandSideOfImportEquals(node) { + ts.Debug.assert(node.kind === 70 /* Identifier */); + // import a = |b|; // Namespace + // import a = |b.c|; // Value, type, namespace + // import a = |b.c|.d; // Namespace + if (node.parent.kind === 141 /* QualifiedName */ && + node.parent.right === node && + node.parent.parent.kind === 234 /* ImportEqualsDeclaration */) { + return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; + } + return 4 /* Namespace */; + } + function isInRightSideOfImport(node) { + while (node.parent.kind === 141 /* QualifiedName */) { + node = node.parent; + } + return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; + } + function isNamespaceReference(node) { + return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node); + } + function isQualifiedNameNamespaceReference(node) { + var root = node; + var isLastClause = true; + if (root.parent.kind === 141 /* QualifiedName */) { + while (root.parent && root.parent.kind === 141 /* QualifiedName */) { + root = root.parent; } - function addOutliningForLeadingCommentsForNode(n) { - var comments = ts.getLeadingCommentRangesOfNode(n, sourceFile); - if (comments) { - var firstSingleLineCommentStart = -1; - var lastSingleLineCommentEnd = -1; - var isFirstSingleLineComment = true; - var singleLineCommentCount = 0; - for (var _i = 0, comments_2 = comments; _i < comments_2.length; _i++) { - var currentComment = comments_2[_i]; - // For single line comments, combine consecutive ones (2 or more) into - // a single span from the start of the first till the end of the last - if (currentComment.kind === 2 /* SingleLineCommentTrivia */) { - if (isFirstSingleLineComment) { - firstSingleLineCommentStart = currentComment.pos; - } - isFirstSingleLineComment = false; - lastSingleLineCommentEnd = currentComment.end; - singleLineCommentCount++; + isLastClause = root.right === node; + } + return root.parent.kind === 157 /* TypeReference */ && !isLastClause; + } + function isPropertyAccessNamespaceReference(node) { + var root = node; + var isLastClause = true; + if (root.parent.kind === 177 /* PropertyAccessExpression */) { + while (root.parent && root.parent.kind === 177 /* PropertyAccessExpression */) { + root = root.parent; + } + isLastClause = root.name === node; + } + if (!isLastClause && root.parent.kind === 199 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 255 /* HeritageClause */) { + var decl = root.parent.parent.parent; + return (decl.kind === 226 /* ClassDeclaration */ && root.parent.parent.token === 107 /* ImplementsKeyword */) || + (decl.kind === 227 /* InterfaceDeclaration */ && root.parent.parent.token === 84 /* ExtendsKeyword */); + } + return false; + } + function isTypeReference(node) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { + node = node.parent; + } + return node.parent.kind === 157 /* TypeReference */ || + (node.parent.kind === 199 /* ExpressionWithTypeArguments */ && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || + (node.kind === 98 /* ThisKeyword */ && !ts.isPartOfExpression(node)) || + node.kind === 167 /* ThisType */; + } + function isCallExpressionTarget(node) { + return isCallOrNewExpressionTarget(node, 179 /* CallExpression */); + } + ts.isCallExpressionTarget = isCallExpressionTarget; + function isNewExpressionTarget(node) { + return isCallOrNewExpressionTarget(node, 180 /* NewExpression */); + } + ts.isNewExpressionTarget = isNewExpressionTarget; + function isCallOrNewExpressionTarget(node, kind) { + var target = climbPastPropertyAccess(node); + return target && target.parent && target.parent.kind === kind && target.parent.expression === target; + } + function climbPastPropertyAccess(node) { + return isRightSideOfPropertyAccess(node) ? node.parent : node; + } + ts.climbPastPropertyAccess = climbPastPropertyAccess; + function getTargetLabel(referenceNode, labelName) { + while (referenceNode) { + if (referenceNode.kind === 219 /* LabeledStatement */ && referenceNode.label.text === labelName) { + return referenceNode.label; + } + referenceNode = referenceNode.parent; + } + return undefined; + } + ts.getTargetLabel = getTargetLabel; + function isJumpStatementTarget(node) { + return node.kind === 70 /* Identifier */ && + (node.parent.kind === 215 /* BreakStatement */ || node.parent.kind === 214 /* ContinueStatement */) && + node.parent.label === node; + } + ts.isJumpStatementTarget = isJumpStatementTarget; + function isLabelOfLabeledStatement(node) { + return node.kind === 70 /* Identifier */ && + node.parent.kind === 219 /* LabeledStatement */ && + node.parent.label === node; + } + function isLabelName(node) { + return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node); + } + ts.isLabelName = isLabelName; + function isRightSideOfQualifiedName(node) { + return node.parent.kind === 141 /* QualifiedName */ && node.parent.right === node; + } + ts.isRightSideOfQualifiedName = isRightSideOfQualifiedName; + function isRightSideOfPropertyAccess(node) { + return node && node.parent && node.parent.kind === 177 /* PropertyAccessExpression */ && node.parent.name === node; + } + ts.isRightSideOfPropertyAccess = isRightSideOfPropertyAccess; + function isNameOfModuleDeclaration(node) { + return node.parent.kind === 230 /* ModuleDeclaration */ && node.parent.name === node; + } + ts.isNameOfModuleDeclaration = isNameOfModuleDeclaration; + function isNameOfFunctionDeclaration(node) { + return node.kind === 70 /* Identifier */ && + ts.isFunctionLike(node.parent) && node.parent.name === node; + } + ts.isNameOfFunctionDeclaration = isNameOfFunctionDeclaration; + function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { + if (node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) { + switch (node.parent.kind) { + case 147 /* PropertyDeclaration */: + case 146 /* PropertySignature */: + case 257 /* PropertyAssignment */: + case 260 /* EnumMember */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + case 230 /* ModuleDeclaration */: + return node.parent.name === node; + case 178 /* ElementAccessExpression */: + return node.parent.argumentExpression === node; + case 142 /* ComputedPropertyName */: + return true; + } + } + return false; + } + ts.isLiteralNameOfPropertyDeclarationOrIndexAccess = isLiteralNameOfPropertyDeclarationOrIndexAccess; + function isExpressionOfExternalModuleImportEqualsDeclaration(node) { + return ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && + ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node; + } + ts.isExpressionOfExternalModuleImportEqualsDeclaration = isExpressionOfExternalModuleImportEqualsDeclaration; + /** Returns true if the position is within a comment */ + function isInsideComment(sourceFile, token, position) { + // The position has to be: 1. in the leading trivia (before token.getStart()), and 2. within a comment + return position <= token.getStart(sourceFile) && + (isInsideCommentRange(ts.getTrailingCommentRanges(sourceFile.text, token.getFullStart())) || + isInsideCommentRange(ts.getLeadingCommentRanges(sourceFile.text, token.getFullStart()))); + function isInsideCommentRange(comments) { + return ts.forEach(comments, function (comment) { + // either we are 1. completely inside the comment, or 2. at the end of the comment + if (comment.pos < position && position < comment.end) { + return true; + } + else if (position === comment.end) { + var text = sourceFile.text; + var width = comment.end - comment.pos; + // is single line comment or just /* + if (width <= 2 || text.charCodeAt(comment.pos + 1) === 47 /* slash */) { + return true; + } + else { + // is unterminated multi-line comment + return !(text.charCodeAt(comment.end - 1) === 47 /* slash */ && + text.charCodeAt(comment.end - 2) === 42 /* asterisk */); + } + } + return false; + }); + } + } + ts.isInsideComment = isInsideComment; + function getContainerNode(node) { + while (true) { + node = node.parent; + if (!node) { + return undefined; + } + switch (node.kind) { + case 261 /* SourceFile */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + case 225 /* FunctionDeclaration */: + case 184 /* FunctionExpression */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + case 226 /* ClassDeclaration */: + case 227 /* InterfaceDeclaration */: + case 229 /* EnumDeclaration */: + case 230 /* ModuleDeclaration */: + return node; + } + } + } + ts.getContainerNode = getContainerNode; + function getNodeKind(node) { + switch (node.kind) { + case 261 /* SourceFile */: + return ts.isExternalModule(node) ? ts.ScriptElementKind.moduleElement : ts.ScriptElementKind.scriptElement; + case 230 /* ModuleDeclaration */: + return ts.ScriptElementKind.moduleElement; + case 226 /* ClassDeclaration */: + case 197 /* ClassExpression */: + return ts.ScriptElementKind.classElement; + case 227 /* InterfaceDeclaration */: return ts.ScriptElementKind.interfaceElement; + case 228 /* TypeAliasDeclaration */: return ts.ScriptElementKind.typeElement; + case 229 /* EnumDeclaration */: return ts.ScriptElementKind.enumElement; + case 223 /* VariableDeclaration */: + return getKindOfVariableDeclaration(node); + case 174 /* BindingElement */: + return getKindOfVariableDeclaration(ts.getRootDeclaration(node)); + case 185 /* ArrowFunction */: + case 225 /* FunctionDeclaration */: + case 184 /* FunctionExpression */: + return ts.ScriptElementKind.functionElement; + case 151 /* GetAccessor */: return ts.ScriptElementKind.memberGetAccessorElement; + case 152 /* SetAccessor */: return ts.ScriptElementKind.memberSetAccessorElement; + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + return ts.ScriptElementKind.memberFunctionElement; + case 147 /* PropertyDeclaration */: + case 146 /* PropertySignature */: + return ts.ScriptElementKind.memberVariableElement; + case 155 /* IndexSignature */: return ts.ScriptElementKind.indexSignatureElement; + case 154 /* ConstructSignature */: return ts.ScriptElementKind.constructSignatureElement; + case 153 /* CallSignature */: return ts.ScriptElementKind.callSignatureElement; + case 150 /* Constructor */: return ts.ScriptElementKind.constructorImplementationElement; + case 143 /* TypeParameter */: return ts.ScriptElementKind.typeParameterElement; + case 260 /* EnumMember */: return ts.ScriptElementKind.enumMemberElement; + case 144 /* Parameter */: return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) ? ts.ScriptElementKind.memberVariableElement : ts.ScriptElementKind.parameterElement; + case 234 /* ImportEqualsDeclaration */: + case 239 /* ImportSpecifier */: + case 236 /* ImportClause */: + case 243 /* ExportSpecifier */: + case 237 /* NamespaceImport */: + return ts.ScriptElementKind.alias; + case 285 /* JSDocTypedefTag */: + return ts.ScriptElementKind.typeElement; + default: + return ts.ScriptElementKind.unknown; + } + function getKindOfVariableDeclaration(v) { + return ts.isConst(v) + ? ts.ScriptElementKind.constElement + : ts.isLet(v) + ? ts.ScriptElementKind.letElement + : ts.ScriptElementKind.variableElement; + } + } + ts.getNodeKind = getNodeKind; + function getStringLiteralTypeForNode(node, typeChecker) { + var searchNode = node.parent.kind === 171 /* LiteralType */ ? node.parent : node; + var type = typeChecker.getTypeAtLocation(searchNode); + if (type && type.flags & 32 /* StringLiteral */) { + return type; + } + return undefined; + } + ts.getStringLiteralTypeForNode = getStringLiteralTypeForNode; + function isThis(node) { + switch (node.kind) { + case 98 /* ThisKeyword */: + // case SyntaxKind.ThisType: TODO: GH#9267 + return true; + case 70 /* Identifier */: + // 'this' as a parameter + return ts.identifierIsThisKeyword(node) && node.parent.kind === 144 /* Parameter */; + default: + return false; + } + } + ts.isThis = isThis; + // Matches the beginning of a triple slash directive + var tripleSlashDirectivePrefixRegex = /^\/\/\/\s*= range.end; + } + ts.startEndContainsRange = startEndContainsRange; + function rangeContainsStartEnd(range, start, end) { + return range.pos <= start && range.end >= end; + } + ts.rangeContainsStartEnd = rangeContainsStartEnd; + function rangeOverlapsWithStartEnd(r1, start, end) { + return startEndOverlapsWithStartEnd(r1.pos, r1.end, start, end); + } + ts.rangeOverlapsWithStartEnd = rangeOverlapsWithStartEnd; + function startEndOverlapsWithStartEnd(start1, end1, start2, end2) { + var start = Math.max(start1, start2); + var end = Math.min(end1, end2); + return start < end; + } + ts.startEndOverlapsWithStartEnd = startEndOverlapsWithStartEnd; + function positionBelongsToNode(candidate, position, sourceFile) { + return candidate.end > position || !isCompletedNode(candidate, sourceFile); + } + ts.positionBelongsToNode = positionBelongsToNode; + function isCompletedNode(n, sourceFile) { + if (ts.nodeIsMissing(n)) { + return false; + } + switch (n.kind) { + case 226 /* ClassDeclaration */: + case 227 /* InterfaceDeclaration */: + case 229 /* EnumDeclaration */: + case 176 /* ObjectLiteralExpression */: + case 172 /* ObjectBindingPattern */: + case 161 /* TypeLiteral */: + case 204 /* Block */: + case 231 /* ModuleBlock */: + case 232 /* CaseBlock */: + case 238 /* NamedImports */: + case 242 /* NamedExports */: + return nodeEndsWith(n, 17 /* CloseBraceToken */, sourceFile); + case 256 /* CatchClause */: + return isCompletedNode(n.block, sourceFile); + case 180 /* NewExpression */: + if (!n.arguments) { + return true; + } + // fall through + case 179 /* CallExpression */: + case 183 /* ParenthesizedExpression */: + case 166 /* ParenthesizedType */: + return nodeEndsWith(n, 19 /* CloseParenToken */, sourceFile); + case 158 /* FunctionType */: + case 159 /* ConstructorType */: + return isCompletedNode(n.type, sourceFile); + case 150 /* Constructor */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + case 225 /* FunctionDeclaration */: + case 184 /* FunctionExpression */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + case 154 /* ConstructSignature */: + case 153 /* CallSignature */: + case 185 /* ArrowFunction */: + if (n.body) { + return isCompletedNode(n.body, sourceFile); + } + if (n.type) { + return isCompletedNode(n.type, sourceFile); + } + // Even though type parameters can be unclosed, we can get away with + // having at least a closing paren. + return hasChildOfKind(n, 19 /* CloseParenToken */, sourceFile); + case 230 /* ModuleDeclaration */: + return n.body && isCompletedNode(n.body, sourceFile); + case 208 /* IfStatement */: + if (n.elseStatement) { + return isCompletedNode(n.elseStatement, sourceFile); + } + return isCompletedNode(n.thenStatement, sourceFile); + case 207 /* ExpressionStatement */: + return isCompletedNode(n.expression, sourceFile) || + hasChildOfKind(n, 24 /* SemicolonToken */); + case 175 /* ArrayLiteralExpression */: + case 173 /* ArrayBindingPattern */: + case 178 /* ElementAccessExpression */: + case 142 /* ComputedPropertyName */: + case 163 /* TupleType */: + return nodeEndsWith(n, 21 /* CloseBracketToken */, sourceFile); + case 155 /* IndexSignature */: + if (n.type) { + return isCompletedNode(n.type, sourceFile); + } + return hasChildOfKind(n, 21 /* CloseBracketToken */, sourceFile); + case 253 /* CaseClause */: + case 254 /* DefaultClause */: + // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed + return false; + case 211 /* ForStatement */: + case 212 /* ForInStatement */: + case 213 /* ForOfStatement */: + case 210 /* WhileStatement */: + return isCompletedNode(n.statement, sourceFile); + case 209 /* DoStatement */: + // rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')'; + var hasWhileKeyword = findChildOfKind(n, 105 /* WhileKeyword */, sourceFile); + if (hasWhileKeyword) { + return nodeEndsWith(n, 19 /* CloseParenToken */, sourceFile); + } + return isCompletedNode(n.statement, sourceFile); + case 160 /* TypeQuery */: + return isCompletedNode(n.exprName, sourceFile); + case 187 /* TypeOfExpression */: + case 186 /* DeleteExpression */: + case 188 /* VoidExpression */: + case 195 /* YieldExpression */: + case 196 /* SpreadElement */: + var unaryWordExpression = n; + return isCompletedNode(unaryWordExpression.expression, sourceFile); + case 181 /* TaggedTemplateExpression */: + return isCompletedNode(n.template, sourceFile); + case 194 /* TemplateExpression */: + var lastSpan = ts.lastOrUndefined(n.templateSpans); + return isCompletedNode(lastSpan, sourceFile); + case 202 /* TemplateSpan */: + return ts.nodeIsPresent(n.literal); + case 241 /* ExportDeclaration */: + case 235 /* ImportDeclaration */: + return ts.nodeIsPresent(n.moduleSpecifier); + case 190 /* PrefixUnaryExpression */: + return isCompletedNode(n.operand, sourceFile); + case 192 /* BinaryExpression */: + return isCompletedNode(n.right, sourceFile); + case 193 /* ConditionalExpression */: + return isCompletedNode(n.whenFalse, sourceFile); + default: + return true; + } + } + ts.isCompletedNode = isCompletedNode; + /* + * Checks if node ends with 'expectedLastToken'. + * If child at position 'length - 1' is 'SemicolonToken' it is skipped and 'expectedLastToken' is compared with child at position 'length - 2'. + */ + function nodeEndsWith(n, expectedLastToken, sourceFile) { + var children = n.getChildren(sourceFile); + if (children.length) { + var last = ts.lastOrUndefined(children); + if (last.kind === expectedLastToken) { + return true; + } + else if (last.kind === 24 /* SemicolonToken */ && children.length !== 1) { + return children[children.length - 2].kind === expectedLastToken; + } + } + return false; + } + function findListItemInfo(node) { + var list = findContainingList(node); + // It is possible at this point for syntaxList to be undefined, either if + // node.parent had no list child, or if none of its list children contained + // the span of node. If this happens, return undefined. The caller should + // handle this case. + if (!list) { + return undefined; + } + var children = list.getChildren(); + var listItemIndex = ts.indexOf(children, node); + return { + listItemIndex: listItemIndex, + list: list + }; + } + ts.findListItemInfo = findListItemInfo; + function hasChildOfKind(n, kind, sourceFile) { + return !!findChildOfKind(n, kind, sourceFile); + } + ts.hasChildOfKind = hasChildOfKind; + function findChildOfKind(n, kind, sourceFile) { + return ts.forEach(n.getChildren(sourceFile), function (c) { return c.kind === kind && c; }); + } + ts.findChildOfKind = findChildOfKind; + function findContainingList(node) { + // The node might be a list element (nonsynthetic) or a comma (synthetic). Either way, it will + // be parented by the container of the SyntaxList, not the SyntaxList itself. + // In order to find the list item index, we first need to locate SyntaxList itself and then search + // 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 === 292 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { + return c; + } + }); + // Either we didn't find an appropriate list, or the list must contain us. + ts.Debug.assert(!syntaxList || ts.contains(syntaxList.getChildren(), node)); + return syntaxList; + } + ts.findContainingList = findContainingList; + /* Gets the token whose text has range [start, end) and + * position >= start and (position < end or (position === end && token is keyword or identifier)) + */ + function getTouchingWord(sourceFile, position, includeJsDocComment) { + if (includeJsDocComment === void 0) { includeJsDocComment = false; } + return getTouchingToken(sourceFile, position, function (n) { return isWord(n.kind); }, includeJsDocComment); + } + ts.getTouchingWord = getTouchingWord; + /* Gets the token whose text has range [start, end) and position >= start + * and (position < end or (position === end && token is keyword or identifier or numeric/string literal)) + */ + function getTouchingPropertyName(sourceFile, position, includeJsDocComment) { + if (includeJsDocComment === void 0) { includeJsDocComment = false; } + return getTouchingToken(sourceFile, position, function (n) { return isPropertyName(n.kind); }, includeJsDocComment); + } + ts.getTouchingPropertyName = getTouchingPropertyName; + /** Returns the token if position is in [start, end) or if position === end and includeItemAtEndPosition(token) === true */ + function getTouchingToken(sourceFile, position, includeItemAtEndPosition, includeJsDocComment) { + if (includeJsDocComment === void 0) { includeJsDocComment = false; } + return getTokenAtPositionWorker(sourceFile, position, /*allowPositionInLeadingTrivia*/ false, includeItemAtEndPosition, includeJsDocComment); + } + ts.getTouchingToken = getTouchingToken; + /** Returns a token if position is in [start-of-leading-trivia, end) */ + function getTokenAtPosition(sourceFile, position, includeJsDocComment) { + if (includeJsDocComment === void 0) { includeJsDocComment = false; } + return getTokenAtPositionWorker(sourceFile, position, /*allowPositionInLeadingTrivia*/ true, /*includeItemAtEndPosition*/ undefined, includeJsDocComment); + } + ts.getTokenAtPosition = getTokenAtPosition; + /** Get the token whose text contains the position */ + function getTokenAtPositionWorker(sourceFile, position, allowPositionInLeadingTrivia, includeItemAtEndPosition, includeJsDocComment) { + if (includeJsDocComment === void 0) { includeJsDocComment = false; } + var current = sourceFile; + outer: while (true) { + if (isToken(current)) { + // exit early + return current; + } + if (includeJsDocComment) { + var jsDocChildren = ts.filter(current.getChildren(), ts.isJSDocNode); + for (var _i = 0, jsDocChildren_1 = jsDocChildren; _i < jsDocChildren_1.length; _i++) { + var jsDocChild = jsDocChildren_1[_i]; + var start = allowPositionInLeadingTrivia ? jsDocChild.getFullStart() : jsDocChild.getStart(sourceFile, includeJsDocComment); + if (start <= position) { + var end = jsDocChild.getEnd(); + if (position < end || (position === end && jsDocChild.kind === 1 /* EndOfFileToken */)) { + current = jsDocChild; + continue outer; } - else if (currentComment.kind === 3 /* MultiLineCommentTrivia */) { - combineAndAddMultipleSingleLineComments(singleLineCommentCount, firstSingleLineCommentStart, lastSingleLineCommentEnd); - addOutliningSpanComments(currentComment, /*autoCollapse*/ false); - singleLineCommentCount = 0; - lastSingleLineCommentEnd = -1; - isFirstSingleLineComment = true; + else if (includeItemAtEndPosition && end === position) { + var previousToken = findPrecedingToken(position, sourceFile, jsDocChild); + if (previousToken && includeItemAtEndPosition(previousToken)) { + return previousToken; + } } } - combineAndAddMultipleSingleLineComments(singleLineCommentCount, firstSingleLineCommentStart, lastSingleLineCommentEnd); } } - function combineAndAddMultipleSingleLineComments(count, start, end) { - // Only outline spans of two or more consecutive single line comments - if (count > 1) { - var multipleSingleLineComments = { - pos: start, - end: end, - kind: 2 /* SingleLineCommentTrivia */ - }; - addOutliningSpanComments(multipleSingleLineComments, /*autoCollapse*/ false); + // find the child that contains 'position' + for (var i = 0, n = current.getChildCount(sourceFile); i < n; i++) { + var child = current.getChildAt(i); + // all jsDocComment nodes were already visited + if (ts.isJSDocNode(child)) { + continue; + } + var start = allowPositionInLeadingTrivia ? child.getFullStart() : child.getStart(sourceFile, includeJsDocComment); + if (start <= position) { + var end = child.getEnd(); + if (position < end || (position === end && child.kind === 1 /* EndOfFileToken */)) { + current = child; + continue outer; + } + else if (includeItemAtEndPosition && end === position) { + var previousToken = findPrecedingToken(position, sourceFile, child); + if (previousToken && includeItemAtEndPosition(previousToken)) { + return previousToken; + } + } } } - function autoCollapse(node) { - return ts.isFunctionBlock(node) && node.parent.kind !== 180 /* ArrowFunction */; + return current; + } + } + /** + * The token on the left of the position is the token that strictly includes the position + * or sits to the left of the cursor if it is on a boundary. For example + * + * fo|o -> will return foo + * foo |bar -> will return foo + * + */ + function findTokenOnLeftOfPosition(file, position) { + // Ideally, getTokenAtPosition should return a token. However, it is currently + // broken, so we do a check to make sure the result was indeed a token. + var tokenAtPosition = getTokenAtPosition(file, position); + if (isToken(tokenAtPosition) && position > tokenAtPosition.getStart(file) && position < tokenAtPosition.getEnd()) { + return tokenAtPosition; + } + return findPrecedingToken(position, file); + } + ts.findTokenOnLeftOfPosition = findTokenOnLeftOfPosition; + function findNextToken(previousToken, parent) { + return find(parent); + function find(n) { + if (isToken(n) && n.pos === previousToken.end) { + // this is token that starts at the end of previous token - return it + return n; } - var depth = 0; - var maxDepth = 20; - function walk(n) { - if (depth > maxDepth) { + var children = n.getChildren(); + for (var _i = 0, children_2 = children; _i < children_2.length; _i++) { + var child = children_2[_i]; + var shouldDiveInChildNode = + // previous token is enclosed somewhere in the child + (child.pos <= previousToken.pos && child.end > previousToken.end) || + // previous token ends exactly at the beginning of child + (child.pos === previousToken.end); + if (shouldDiveInChildNode && nodeHasTokens(child)) { + return find(child); + } + } + return undefined; + } + } + ts.findNextToken = findNextToken; + function findPrecedingToken(position, sourceFile, startNode) { + return find(startNode || sourceFile); + function findRightmostToken(n) { + if (isToken(n)) { + return n; + } + var children = n.getChildren(); + var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length); + return candidate && findRightmostToken(candidate); + } + function find(n) { + if (isToken(n)) { + return n; + } + var children = n.getChildren(); + for (var i = 0, len = children.length; i < len; i++) { + var child = children[i]; + // condition 'position < child.end' checks if child node end after the position + // in the example below this condition will be false for 'aaaa' and 'bbbb' and true for 'ccc' + // aaaa___bbbb___$__ccc + // after we found child node with end after the position we check if start of the node is after the position. + // if yes - then position is in the trivia and we need to look into the previous child to find the token in question. + // if no - position is in the node itself so we should recurse in it. + // NOTE: JsxText is a weird kind of node that can contain only whitespaces (since they are not counted as trivia). + // if this is the case - then we should assume that token in question is located in previous child. + if (position < child.end && (nodeHasTokens(child) || child.kind === 10 /* JsxText */)) { + var start = child.getStart(sourceFile); + var lookInPreviousChild = (start >= position) || + (child.kind === 10 /* JsxText */ && start === child.end); // whitespace only JsxText + if (lookInPreviousChild) { + // actual start of the node is past the position - previous token should be at the end of previous child + var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i); + return candidate && findRightmostToken(candidate); + } + else { + // candidate should be in this node + return find(child); + } + } + } + ts.Debug.assert(startNode !== undefined || n.kind === 261 /* SourceFile */); + // Here we know that none of child token nodes embrace the position, + // the only known case is when position is at the end of the file. + // Try to find the rightmost token in the file without filtering. + // Namely we are skipping the check: 'position < node.end' + if (children.length) { + var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length); + return candidate && findRightmostToken(candidate); + } + } + /// finds last node that is considered as candidate for search (isCandidate(node) === true) starting from 'exclusiveStartPosition' + function findRightmostChildNodeWithTokens(children, exclusiveStartPosition) { + for (var i = exclusiveStartPosition - 1; i >= 0; i--) { + if (nodeHasTokens(children[i])) { + return children[i]; + } + } + } + } + ts.findPrecedingToken = findPrecedingToken; + function isInString(sourceFile, position) { + var previousToken = findPrecedingToken(position, sourceFile); + if (previousToken && previousToken.kind === 9 /* StringLiteral */) { + var start = previousToken.getStart(); + var end = previousToken.getEnd(); + // To be "in" one of these literals, the position has to be: + // 1. entirely within the token text. + // 2. at the end position of an unterminated token. + // 3. at the end of a regular expression (due to trailing flags like '/foo/g'). + if (start < position && position < end) { + return true; + } + if (position === end) { + return !!previousToken.isUnterminated; + } + } + return false; + } + ts.isInString = isInString; + function isInComment(sourceFile, position) { + return isInCommentHelper(sourceFile, position, /*predicate*/ undefined); + } + ts.isInComment = isInComment; + /** + * returns true if the position is in between the open and close elements of an JSX expression. + */ + function isInsideJsxElementOrAttribute(sourceFile, position) { + var token = getTokenAtPosition(sourceFile, position); + if (!token) { + return false; + } + if (token.kind === 10 /* JsxText */) { + return true; + } + //
Hello |
+ if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 10 /* JsxText */) { + return true; + } + //
{ |
or
+ if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 252 /* JsxExpression */) { + return true; + } + //
{ + // | + // } < /div> + if (token && token.kind === 17 /* CloseBraceToken */ && token.parent.kind === 252 /* JsxExpression */) { + return true; + } + //
|
+ if (token.kind === 26 /* LessThanToken */ && token.parent.kind === 249 /* JsxClosingElement */) { + return true; + } + return false; + } + ts.isInsideJsxElementOrAttribute = isInsideJsxElementOrAttribute; + function isInTemplateString(sourceFile, position) { + var token = getTokenAtPosition(sourceFile, position); + return ts.isTemplateLiteralKind(token.kind) && position > token.getStart(sourceFile); + } + ts.isInTemplateString = isInTemplateString; + /** + * Returns true if the cursor at position in sourceFile is within a comment that additionally + * satisfies predicate, and false otherwise. + */ + function isInCommentHelper(sourceFile, position, predicate) { + var token = getTokenAtPosition(sourceFile, position); + if (token && position <= token.getStart(sourceFile)) { + var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos); + // The end marker of a single-line comment does not include the newline character. + // In the following case, we are inside a comment (^ denotes the cursor position): + // + // // asdf ^\n + // + // But for multi-line comments, we don't want to be inside the comment in the following case: + // + // /* asdf */^ + // + // Internally, we represent the end of the comment at the newline and closing '/', respectively. + return predicate ? + ts.forEach(commentRanges, function (c) { return c.pos < position && + (c.kind == 2 /* SingleLineCommentTrivia */ ? position <= c.end : position < c.end) && + predicate(c); }) : + ts.forEach(commentRanges, function (c) { return c.pos < position && + (c.kind == 2 /* SingleLineCommentTrivia */ ? position <= c.end : position < c.end); }); + } + return false; + } + ts.isInCommentHelper = isInCommentHelper; + function hasDocComment(sourceFile, position) { + var token = getTokenAtPosition(sourceFile, position); + // First, we have to see if this position actually landed in a comment. + var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos); + return ts.forEach(commentRanges, jsDocPrefix); + function jsDocPrefix(c) { + var text = sourceFile.text; + return text.length >= c.pos + 3 && text[c.pos] === "/" && text[c.pos + 1] === "*" && text[c.pos + 2] === "*"; + } + } + ts.hasDocComment = hasDocComment; + /** + * Get the corresponding JSDocTag node if the position is in a jsDoc comment + */ + function getJsDocTagAtPosition(sourceFile, position) { + var node = ts.getTokenAtPosition(sourceFile, position); + if (isToken(node)) { + switch (node.kind) { + case 103 /* VarKeyword */: + case 109 /* LetKeyword */: + case 75 /* ConstKeyword */: + // if the current token is var, let or const, skip the VariableDeclarationList + node = node.parent === undefined ? undefined : node.parent.parent; + break; + default: + node = node.parent; + break; + } + } + if (node) { + 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; + } + } + } + } + } + } + return undefined; + } + ts.getJsDocTagAtPosition = getJsDocTagAtPosition; + function nodeHasTokens(n) { + // If we have a token or node that has a non-zero width, it must have tokens. + // Note, that getWidth() does not take trivia into account. + return n.getWidth() !== 0; + } + function getNodeModifiers(node) { + var flags = ts.getCombinedModifierFlags(node); + var result = []; + if (flags & 8 /* Private */) + result.push(ts.ScriptElementKindModifier.privateMemberModifier); + if (flags & 16 /* Protected */) + result.push(ts.ScriptElementKindModifier.protectedMemberModifier); + if (flags & 4 /* Public */) + result.push(ts.ScriptElementKindModifier.publicMemberModifier); + if (flags & 32 /* Static */) + result.push(ts.ScriptElementKindModifier.staticModifier); + if (flags & 128 /* Abstract */) + result.push(ts.ScriptElementKindModifier.abstractModifier); + if (flags & 1 /* Export */) + result.push(ts.ScriptElementKindModifier.exportedModifier); + if (ts.isInAmbientContext(node)) + result.push(ts.ScriptElementKindModifier.ambientModifier); + return result.length > 0 ? result.join(",") : ts.ScriptElementKindModifier.none; + } + ts.getNodeModifiers = getNodeModifiers; + function getTypeArgumentOrTypeParameterList(node) { + if (node.kind === 157 /* TypeReference */ || node.kind === 179 /* CallExpression */) { + return node.typeArguments; + } + if (ts.isFunctionLike(node) || node.kind === 226 /* ClassDeclaration */ || node.kind === 227 /* InterfaceDeclaration */) { + return node.typeParameters; + } + return undefined; + } + ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; + function isToken(n) { + return n.kind >= 0 /* FirstToken */ && n.kind <= 140 /* LastToken */; + } + ts.isToken = isToken; + function isWord(kind) { + return kind === 70 /* Identifier */ || ts.isKeyword(kind); + } + ts.isWord = isWord; + function isPropertyName(kind) { + return kind === 9 /* StringLiteral */ || kind === 8 /* NumericLiteral */ || isWord(kind); + } + function isComment(kind) { + return kind === 2 /* SingleLineCommentTrivia */ || kind === 3 /* MultiLineCommentTrivia */; + } + ts.isComment = isComment; + function isStringOrRegularExpressionOrTemplateLiteral(kind) { + if (kind === 9 /* StringLiteral */ + || kind === 11 /* RegularExpressionLiteral */ + || ts.isTemplateLiteralKind(kind)) { + return true; + } + return false; + } + ts.isStringOrRegularExpressionOrTemplateLiteral = isStringOrRegularExpressionOrTemplateLiteral; + function isPunctuation(kind) { + return 16 /* FirstPunctuation */ <= kind && kind <= 69 /* LastPunctuation */; + } + ts.isPunctuation = isPunctuation; + function isInsideTemplateLiteral(node, position) { + return ts.isTemplateLiteralKind(node.kind) + && (node.getStart() < position && position < node.getEnd()) || (!!node.isUnterminated && position === node.getEnd()); + } + ts.isInsideTemplateLiteral = isInsideTemplateLiteral; + function isAccessibilityModifier(kind) { + switch (kind) { + case 113 /* PublicKeyword */: + case 111 /* PrivateKeyword */: + case 112 /* ProtectedKeyword */: + return true; + } + return false; + } + ts.isAccessibilityModifier = isAccessibilityModifier; + function compareDataObjects(dst, src) { + for (var e in dst) { + if (typeof dst[e] === "object") { + if (!compareDataObjects(dst[e], src[e])) { + return false; + } + } + else if (typeof dst[e] !== "function") { + if (dst[e] !== src[e]) { + return false; + } + } + } + return true; + } + ts.compareDataObjects = compareDataObjects; + function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { + if (node.kind === 175 /* ArrayLiteralExpression */ || + node.kind === 176 /* ObjectLiteralExpression */) { + // [a,b,c] from: + // [a, b, c] = someExpression; + if (node.parent.kind === 192 /* BinaryExpression */ && + node.parent.left === node && + node.parent.operatorToken.kind === 57 /* EqualsToken */) { + return true; + } + // [a, b, c] from: + // for([a, b, c] of expression) + if (node.parent.kind === 213 /* ForOfStatement */ && + node.parent.initializer === node) { + return true; + } + // [a, b, c] of + // [x, [a, b, c] ] = someExpression + // or + // {x, a: {a, b, c} } = someExpression + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 257 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { + return true; + } + } + return false; + } + ts.isArrayLiteralOrObjectLiteralDestructuringPattern = isArrayLiteralOrObjectLiteralDestructuringPattern; + function hasTrailingDirectorySeparator(path) { + var lastCharacter = path.charAt(path.length - 1); + return lastCharacter === "/" || lastCharacter === "\\"; + } + ts.hasTrailingDirectorySeparator = hasTrailingDirectorySeparator; + function isInReferenceComment(sourceFile, position) { + return isInCommentHelper(sourceFile, position, isReferenceComment); + function isReferenceComment(c) { + var commentText = sourceFile.text.substring(c.pos, c.end); + return tripleSlashDirectivePrefixRegex.test(commentText); + } + } + ts.isInReferenceComment = isInReferenceComment; + function isInNonReferenceComment(sourceFile, position) { + return isInCommentHelper(sourceFile, position, isNonReferenceComment); + function isNonReferenceComment(c) { + var commentText = sourceFile.text.substring(c.pos, c.end); + return !tripleSlashDirectivePrefixRegex.test(commentText); + } + } + ts.isInNonReferenceComment = isInNonReferenceComment; +})(ts || (ts = {})); +// Display-part writer helpers +/* @internal */ +(function (ts) { + function isFirstDeclarationOfSymbolParameter(symbol) { + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 144 /* Parameter */; + } + ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; + var displayPartWriter = getDisplayPartWriter(); + function getDisplayPartWriter() { + var displayParts; + var lineStart; + var indent; + resetWriter(); + return { + displayParts: function () { return displayParts; }, + writeKeyword: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.keyword); }, + writeOperator: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.operator); }, + writePunctuation: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.punctuation); }, + writeSpace: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.space); }, + writeStringLiteral: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.stringLiteral); }, + writeParameter: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.parameterName); }, + writeProperty: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.propertyName); }, + writeSymbol: writeSymbol, + writeLine: writeLine, + increaseIndent: function () { indent++; }, + decreaseIndent: function () { indent--; }, + clear: resetWriter, + trackSymbol: ts.noop, + reportInaccessibleThisError: ts.noop + }; + function writeIndent() { + if (lineStart) { + var indentString = ts.getIndentString(indent); + if (indentString) { + displayParts.push(displayPart(indentString, ts.SymbolDisplayPartKind.space)); + } + lineStart = false; + } + } + function writeKind(text, kind) { + writeIndent(); + displayParts.push(displayPart(text, kind)); + } + function writeSymbol(text, symbol) { + writeIndent(); + displayParts.push(symbolPart(text, symbol)); + } + function writeLine() { + displayParts.push(lineBreakPart()); + lineStart = true; + } + function resetWriter() { + displayParts = []; + lineStart = true; + indent = 0; + } + } + function symbolPart(text, symbol) { + return displayPart(text, displayPartKind(symbol)); + function displayPartKind(symbol) { + var flags = symbol.flags; + if (flags & 3 /* Variable */) { + return isFirstDeclarationOfSymbolParameter(symbol) ? ts.SymbolDisplayPartKind.parameterName : ts.SymbolDisplayPartKind.localName; + } + else if (flags & 4 /* Property */) { + return ts.SymbolDisplayPartKind.propertyName; + } + else if (flags & 32768 /* GetAccessor */) { + return ts.SymbolDisplayPartKind.propertyName; + } + else if (flags & 65536 /* SetAccessor */) { + return ts.SymbolDisplayPartKind.propertyName; + } + else if (flags & 8 /* EnumMember */) { + return ts.SymbolDisplayPartKind.enumMemberName; + } + else if (flags & 16 /* Function */) { + return ts.SymbolDisplayPartKind.functionName; + } + else if (flags & 32 /* Class */) { + return ts.SymbolDisplayPartKind.className; + } + else if (flags & 64 /* Interface */) { + return ts.SymbolDisplayPartKind.interfaceName; + } + else if (flags & 384 /* Enum */) { + return ts.SymbolDisplayPartKind.enumName; + } + else if (flags & 1536 /* Module */) { + return ts.SymbolDisplayPartKind.moduleName; + } + else if (flags & 8192 /* Method */) { + return ts.SymbolDisplayPartKind.methodName; + } + else if (flags & 262144 /* TypeParameter */) { + return ts.SymbolDisplayPartKind.typeParameterName; + } + else if (flags & 524288 /* TypeAlias */) { + return ts.SymbolDisplayPartKind.aliasName; + } + else if (flags & 8388608 /* Alias */) { + return ts.SymbolDisplayPartKind.aliasName; + } + return ts.SymbolDisplayPartKind.text; + } + } + ts.symbolPart = symbolPart; + function displayPart(text, kind) { + return { + text: text, + kind: ts.SymbolDisplayPartKind[kind] + }; + } + ts.displayPart = displayPart; + function spacePart() { + return displayPart(" ", ts.SymbolDisplayPartKind.space); + } + ts.spacePart = spacePart; + function keywordPart(kind) { + return displayPart(ts.tokenToString(kind), ts.SymbolDisplayPartKind.keyword); + } + ts.keywordPart = keywordPart; + function punctuationPart(kind) { + return displayPart(ts.tokenToString(kind), ts.SymbolDisplayPartKind.punctuation); + } + ts.punctuationPart = punctuationPart; + function operatorPart(kind) { + return displayPart(ts.tokenToString(kind), ts.SymbolDisplayPartKind.operator); + } + ts.operatorPart = operatorPart; + function textOrKeywordPart(text) { + var kind = ts.stringToToken(text); + return kind === undefined + ? textPart(text) + : keywordPart(kind); + } + ts.textOrKeywordPart = textOrKeywordPart; + function textPart(text) { + return displayPart(text, ts.SymbolDisplayPartKind.text); + } + ts.textPart = textPart; + var carriageReturnLineFeed = "\r\n"; + /** + * The default is CRLF. + */ + function getNewLineOrDefaultFromHost(host) { + return host.getNewLine ? host.getNewLine() : carriageReturnLineFeed; + } + ts.getNewLineOrDefaultFromHost = getNewLineOrDefaultFromHost; + function lineBreakPart() { + return displayPart("\n", ts.SymbolDisplayPartKind.lineBreak); + } + ts.lineBreakPart = lineBreakPart; + function mapToDisplayParts(writeDisplayParts) { + writeDisplayParts(displayPartWriter); + var result = displayPartWriter.displayParts(); + displayPartWriter.clear(); + return result; + } + ts.mapToDisplayParts = mapToDisplayParts; + function typeToDisplayParts(typechecker, type, enclosingDeclaration, flags) { + return mapToDisplayParts(function (writer) { + typechecker.getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); + }); + } + ts.typeToDisplayParts = typeToDisplayParts; + function symbolToDisplayParts(typeChecker, symbol, enclosingDeclaration, meaning, flags) { + return mapToDisplayParts(function (writer) { + typeChecker.getSymbolDisplayBuilder().buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning, flags); + }); + } + ts.symbolToDisplayParts = symbolToDisplayParts; + function signatureToDisplayParts(typechecker, signature, enclosingDeclaration, flags) { + return mapToDisplayParts(function (writer) { + typechecker.getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags); + }); + } + ts.signatureToDisplayParts = signatureToDisplayParts; + function getDeclaredName(typeChecker, symbol, location) { + // If this is an export or import specifier it could have been renamed using the 'as' syntax. + // If so we want to search for whatever is under the cursor. + if (isImportOrExportSpecifierName(location)) { + return location.getText(); + } + else if (ts.isStringOrNumericLiteral(location) && + location.parent.kind === 142 /* ComputedPropertyName */) { + return location.text; + } + // Try to get the local symbol if we're dealing with an 'export default' + // since that symbol has the "true" name. + var localExportDefaultSymbol = ts.getLocalSymbolForExportDefault(symbol); + var name = typeChecker.symbolToString(localExportDefaultSymbol || symbol); + return name; + } + ts.getDeclaredName = getDeclaredName; + function isImportOrExportSpecifierName(location) { + return location.parent && + (location.parent.kind === 239 /* ImportSpecifier */ || location.parent.kind === 243 /* ExportSpecifier */) && + location.parent.propertyName === location; + } + ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName; + /** + * Strip off existed single quotes or double quotes from a given string + * + * @return non-quoted string + */ + function stripQuotes(name) { + var length = name.length; + if (length >= 2 && + name.charCodeAt(0) === name.charCodeAt(length - 1) && + (name.charCodeAt(0) === 34 /* doubleQuote */ || name.charCodeAt(0) === 39 /* singleQuote */)) { + return name.substring(1, length - 1); + } + ; + return name; + } + ts.stripQuotes = stripQuotes; + function scriptKindIs(fileName, host) { + var scriptKinds = []; + for (var _i = 2; _i < arguments.length; _i++) { + scriptKinds[_i - 2] = arguments[_i]; + } + var scriptKind = getScriptKind(fileName, host); + return ts.forEach(scriptKinds, function (k) { return k === scriptKind; }); + } + ts.scriptKindIs = scriptKindIs; + function getScriptKind(fileName, host) { + // First check to see if the script kind was specified by the host. Chances are the host + // may override the default script kind for the file extension. + var scriptKind; + if (host && host.getScriptKind) { + scriptKind = host.getScriptKind(fileName); + } + if (!scriptKind) { + scriptKind = ts.getScriptKindFromFileName(fileName); + } + return ts.ensureScriptKind(fileName, scriptKind); + } + ts.getScriptKind = getScriptKind; + function sanitizeConfigFile(configFileName, content) { + var options = { + fileName: "config.js", + compilerOptions: { + target: 2 /* ES2015 */, + removeComments: true + }, + reportDiagnostics: true + }; + var _a = ts.transpileModule("(" + content + ")", options), outputText = _a.outputText, diagnostics = _a.diagnostics; + // Becasue the content was wrapped in "()", the start position of diagnostics needs to be subtract by 1 + // also, the emitted result will have "(" in the beginning and ");" in the end. We need to strip these + // as well + var trimmedOutput = outputText.trim(); + for (var _i = 0, diagnostics_2 = diagnostics; _i < diagnostics_2.length; _i++) { + var diagnostic = diagnostics_2[_i]; + diagnostic.start = diagnostic.start - 1; + } + var _b = ts.parseConfigFileTextToJson(configFileName, trimmedOutput.substring(1, trimmedOutput.length - 2), /*stripComments*/ false), config = _b.config, error = _b.error; + return { + configJsonObject: config || {}, + diagnostics: error ? ts.concatenate(diagnostics, [error]) : diagnostics + }; + } + ts.sanitizeConfigFile = sanitizeConfigFile; +})(ts || (ts = {})); +var ts; +(function (ts) { + /// Classifier + function createClassifier() { + var scanner = ts.createScanner(5 /* Latest */, /*skipTrivia*/ false); + /// We do not have a full parser support to know when we should parse a regex or not + /// If we consider every slash token to be a regex, we could be missing cases like "1/2/3", where + /// we have a series of divide operator. this list allows us to be more accurate by ruling out + /// locations where a regexp cannot exist. + var noRegexTable = []; + noRegexTable[70 /* Identifier */] = true; + noRegexTable[9 /* StringLiteral */] = true; + noRegexTable[8 /* NumericLiteral */] = true; + noRegexTable[11 /* RegularExpressionLiteral */] = true; + noRegexTable[98 /* ThisKeyword */] = true; + noRegexTable[42 /* PlusPlusToken */] = true; + noRegexTable[43 /* MinusMinusToken */] = true; + noRegexTable[19 /* CloseParenToken */] = true; + noRegexTable[21 /* CloseBracketToken */] = true; + noRegexTable[17 /* CloseBraceToken */] = true; + noRegexTable[100 /* TrueKeyword */] = true; + noRegexTable[85 /* FalseKeyword */] = true; + // Just a stack of TemplateHeads and OpenCurlyBraces, used to perform rudimentary (inexact) + // classification on template strings. Because of the context free nature of templates, + // the only precise way to classify a template portion would be by propagating the stack across + // lines, just as we do with the end-of-line state. However, this is a burden for implementers, + // and the behavior is entirely subsumed by the syntactic classifier anyway, so we instead + // flatten any nesting when the template stack is non-empty and encode it in the end-of-line state. + // Situations in which this fails are + // 1) When template strings are nested across different lines: + // `hello ${ `world + // ` }` + // + // Where on the second line, you will get the closing of a template, + // a closing curly, and a new template. + // + // 2) When substitution expressions have curly braces and the curly brace falls on the next line: + // `hello ${ () => { + // return "world" } } ` + // + // Where on the second line, you will get the 'return' keyword, + // a string literal, and a template end consisting of '} } `'. + var templateStack = []; + /** Returns true if 'keyword2' can legally follow 'keyword1' in any language construct. */ + function canFollow(keyword1, keyword2) { + if (ts.isAccessibilityModifier(keyword1)) { + if (keyword2 === 124 /* GetKeyword */ || + keyword2 === 133 /* SetKeyword */ || + keyword2 === 122 /* ConstructorKeyword */ || + keyword2 === 114 /* StaticKeyword */) { + // Allow things like "public get", "public constructor" and "public static". + // These are all legal. + return true; + } + // Any other keyword following "public" is actually an identifier an not a real + // keyword. + return false; + } + // Assume any other keyword combination is legal. This can be refined in the future + // if there are more cases we want the classifier to be better at. + return true; + } + function convertClassifications(classifications, text) { + var entries = []; + var dense = classifications.spans; + var lastEnd = 0; + for (var i = 0, n = dense.length; i < n; i += 3) { + var start = dense[i]; + var length_4 = dense[i + 1]; + var type = dense[i + 2]; + // Make a whitespace entry between the last item and this one. + if (lastEnd >= 0) { + var whitespaceLength_1 = start - lastEnd; + if (whitespaceLength_1 > 0) { + entries.push({ length: whitespaceLength_1, classification: ts.TokenClass.Whitespace }); + } + } + entries.push({ length: length_4, classification: convertClassification(type) }); + lastEnd = start + length_4; + } + var whitespaceLength = text.length - lastEnd; + if (whitespaceLength > 0) { + entries.push({ length: whitespaceLength, classification: ts.TokenClass.Whitespace }); + } + return { entries: entries, finalLexState: classifications.endOfLineState }; + } + function convertClassification(type) { + switch (type) { + case 1 /* comment */: return ts.TokenClass.Comment; + case 3 /* keyword */: return ts.TokenClass.Keyword; + case 4 /* numericLiteral */: return ts.TokenClass.NumberLiteral; + case 5 /* operator */: return ts.TokenClass.Operator; + case 6 /* stringLiteral */: return ts.TokenClass.StringLiteral; + case 8 /* whiteSpace */: return ts.TokenClass.Whitespace; + case 10 /* punctuation */: return ts.TokenClass.Punctuation; + case 2 /* identifier */: + case 11 /* className */: + case 12 /* enumName */: + case 13 /* interfaceName */: + case 14 /* moduleName */: + case 15 /* typeParameterName */: + case 16 /* typeAliasName */: + case 9 /* text */: + case 17 /* parameterName */: + default: + return ts.TokenClass.Identifier; + } + } + function getClassificationsForLine(text, lexState, syntacticClassifierAbsent) { + return convertClassifications(getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent), text); + } + // If there is a syntactic classifier ('syntacticClassifierAbsent' is false), + // we will be more conservative in order to avoid conflicting with the syntactic classifier. + function getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent) { + var offset = 0; + var token = 0 /* Unknown */; + var lastNonTriviaToken = 0 /* Unknown */; + // Empty out the template stack for reuse. + while (templateStack.length > 0) { + templateStack.pop(); + } + // If we're in a string literal, then prepend: "\ + // (and a newline). That way when we lex we'll think we're still in a string literal. + // + // If we're in a multiline comment, then prepend: /* + // (and a newline). That way when we lex we'll think we're still in a multiline comment. + switch (lexState) { + case 3 /* InDoubleQuoteStringLiteral */: + text = "\"\\\n" + text; + offset = 3; + break; + case 2 /* InSingleQuoteStringLiteral */: + text = "'\\\n" + text; + offset = 3; + break; + case 1 /* InMultiLineCommentTrivia */: + text = "/*\n" + text; + offset = 3; + break; + case 4 /* InTemplateHeadOrNoSubstitutionTemplate */: + text = "`\n" + text; + offset = 2; + break; + case 5 /* InTemplateMiddleOrTail */: + text = "}\n" + text; + offset = 2; + // fallthrough + case 6 /* InTemplateSubstitutionPosition */: + templateStack.push(13 /* TemplateHead */); + break; + } + scanner.setText(text); + var result = { + endOfLineState: 0 /* None */, + spans: [] + }; + // We can run into an unfortunate interaction between the lexical and syntactic classifier + // when the user is typing something generic. Consider the case where the user types: + // + // Foo tokens. It's a weak heuristic, but should + // work well enough in practice. + var angleBracketStack = 0; + do { + token = scanner.scan(); + if (!ts.isTrivia(token)) { + if ((token === 40 /* SlashToken */ || token === 62 /* SlashEqualsToken */) && !noRegexTable[lastNonTriviaToken]) { + if (scanner.reScanSlashToken() === 11 /* RegularExpressionLiteral */) { + token = 11 /* RegularExpressionLiteral */; + } + } + else if (lastNonTriviaToken === 22 /* DotToken */ && isKeyword(token)) { + token = 70 /* Identifier */; + } + else if (isKeyword(lastNonTriviaToken) && isKeyword(token) && !canFollow(lastNonTriviaToken, token)) { + // We have two keywords in a row. Only treat the second as a keyword if + // it's a sequence that could legally occur in the language. Otherwise + // treat it as an identifier. This way, if someone writes "private var" + // we recognize that 'var' is actually an identifier here. + token = 70 /* Identifier */; + } + else if (lastNonTriviaToken === 70 /* Identifier */ && + token === 26 /* LessThanToken */) { + // Could be the start of something generic. Keep track of that by bumping + // up the current count of generic contexts we may be in. + angleBracketStack++; + } + else if (token === 28 /* GreaterThanToken */ && angleBracketStack > 0) { + // If we think we're currently in something generic, then mark that that + // generic entity is complete. + angleBracketStack--; + } + else if (token === 118 /* AnyKeyword */ || + token === 134 /* StringKeyword */ || + token === 132 /* NumberKeyword */ || + token === 121 /* BooleanKeyword */ || + token === 135 /* SymbolKeyword */) { + if (angleBracketStack > 0 && !syntacticClassifierAbsent) { + // If it looks like we're could be in something generic, don't classify this + // as a keyword. We may just get overwritten by the syntactic classifier, + // causing a noisy experience for the user. + token = 70 /* Identifier */; + } + } + else if (token === 13 /* TemplateHead */) { + templateStack.push(token); + } + else if (token === 16 /* OpenBraceToken */) { + // If we don't have anything on the template stack, + // then we aren't trying to keep track of a previously scanned template head. + if (templateStack.length > 0) { + templateStack.push(token); + } + } + else if (token === 17 /* CloseBraceToken */) { + // If we don't have anything on the template stack, + // then we aren't trying to keep track of a previously scanned template head. + if (templateStack.length > 0) { + var lastTemplateStackToken = ts.lastOrUndefined(templateStack); + if (lastTemplateStackToken === 13 /* TemplateHead */) { + token = scanner.reScanTemplateToken(); + // Only pop on a TemplateTail; a TemplateMiddle indicates there is more for us. + if (token === 15 /* TemplateTail */) { + templateStack.pop(); + } + else { + ts.Debug.assert(token === 14 /* TemplateMiddle */, "Should have been a template middle. Was " + token); + } + } + else { + ts.Debug.assert(lastTemplateStackToken === 16 /* OpenBraceToken */, "Should have been an open brace. Was: " + token); + templateStack.pop(); + } + } + } + lastNonTriviaToken = token; + } + processToken(); + } while (token !== 1 /* EndOfFileToken */); + return result; + function processToken() { + var start = scanner.getTokenPos(); + var end = scanner.getTextPos(); + addResult(start, end, classFromKind(token)); + if (end >= text.length) { + if (token === 9 /* StringLiteral */) { + // Check to see if we finished up on a multiline string literal. + var tokenText = scanner.getTokenText(); + if (scanner.isUnterminated()) { + var lastCharIndex = tokenText.length - 1; + var numBackslashes = 0; + while (tokenText.charCodeAt(lastCharIndex - numBackslashes) === 92 /* backslash */) { + numBackslashes++; + } + // If we have an odd number of backslashes, then the multiline string is unclosed + if (numBackslashes & 1) { + var quoteChar = tokenText.charCodeAt(0); + result.endOfLineState = quoteChar === 34 /* doubleQuote */ + ? 3 /* InDoubleQuoteStringLiteral */ + : 2 /* InSingleQuoteStringLiteral */; + } + } + } + else if (token === 3 /* MultiLineCommentTrivia */) { + // Check to see if the multiline comment was unclosed. + if (scanner.isUnterminated()) { + result.endOfLineState = 1 /* InMultiLineCommentTrivia */; + } + } + else if (ts.isTemplateLiteralKind(token)) { + if (scanner.isUnterminated()) { + if (token === 15 /* TemplateTail */) { + result.endOfLineState = 5 /* InTemplateMiddleOrTail */; + } + else if (token === 12 /* NoSubstitutionTemplateLiteral */) { + result.endOfLineState = 4 /* InTemplateHeadOrNoSubstitutionTemplate */; + } + else { + ts.Debug.fail("Only 'NoSubstitutionTemplateLiteral's and 'TemplateTail's can be unterminated; got SyntaxKind #" + token); + } + } + } + else if (templateStack.length > 0 && ts.lastOrUndefined(templateStack) === 13 /* TemplateHead */) { + result.endOfLineState = 6 /* InTemplateSubstitutionPosition */; + } + } + } + function addResult(start, end, classification) { + if (classification === 8 /* whiteSpace */) { + // Don't bother with whitespace classifications. They're not needed. return; } - if (ts.isDeclaration(n)) { - addOutliningForLeadingCommentsForNode(n); + if (start === 0 && offset > 0) { + // We're classifying the first token, and this was a case where we prepended + // text. We should consider the start of this token to be at the start of + // the original text. + start += offset; } - switch (n.kind) { - case 199 /* Block */: - if (!ts.isFunctionBlock(n)) { - var parent_16 = n.parent; - var openBrace = ts.findChildOfKind(n, 15 /* OpenBraceToken */, sourceFile); - var closeBrace = ts.findChildOfKind(n, 16 /* 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_16.kind === 204 /* DoStatement */ || - parent_16.kind === 207 /* ForInStatement */ || - parent_16.kind === 208 /* ForOfStatement */ || - parent_16.kind === 206 /* ForStatement */ || - parent_16.kind === 203 /* IfStatement */ || - parent_16.kind === 205 /* WhileStatement */ || - parent_16.kind === 212 /* WithStatement */ || - parent_16.kind === 252 /* CatchClause */) { - addOutliningSpan(parent_16, openBrace, closeBrace, autoCollapse(n)); - break; + // All our tokens are in relation to the augmented text. Move them back to be + // relative to the original text. + start -= offset; + end -= offset; + var length = end - start; + if (length > 0) { + result.spans.push(start); + result.spans.push(length); + result.spans.push(classification); + } + } + } + function isBinaryExpressionOperatorToken(token) { + switch (token) { + case 38 /* AsteriskToken */: + case 40 /* SlashToken */: + case 41 /* PercentToken */: + case 36 /* PlusToken */: + case 37 /* MinusToken */: + case 44 /* LessThanLessThanToken */: + case 45 /* GreaterThanGreaterThanToken */: + case 46 /* GreaterThanGreaterThanGreaterThanToken */: + case 26 /* LessThanToken */: + case 28 /* GreaterThanToken */: + case 29 /* LessThanEqualsToken */: + case 30 /* GreaterThanEqualsToken */: + case 92 /* InstanceOfKeyword */: + case 91 /* InKeyword */: + case 117 /* AsKeyword */: + case 31 /* EqualsEqualsToken */: + case 32 /* ExclamationEqualsToken */: + case 33 /* EqualsEqualsEqualsToken */: + case 34 /* ExclamationEqualsEqualsToken */: + case 47 /* AmpersandToken */: + case 49 /* CaretToken */: + case 48 /* BarToken */: + case 52 /* AmpersandAmpersandToken */: + case 53 /* BarBarToken */: + case 68 /* BarEqualsToken */: + case 67 /* AmpersandEqualsToken */: + case 69 /* CaretEqualsToken */: + case 64 /* LessThanLessThanEqualsToken */: + case 65 /* GreaterThanGreaterThanEqualsToken */: + case 66 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 58 /* PlusEqualsToken */: + case 59 /* MinusEqualsToken */: + case 60 /* AsteriskEqualsToken */: + case 62 /* SlashEqualsToken */: + case 63 /* PercentEqualsToken */: + case 57 /* EqualsToken */: + case 25 /* CommaToken */: + return true; + default: + return false; + } + } + function isPrefixUnaryExpressionOperatorToken(token) { + switch (token) { + case 36 /* PlusToken */: + case 37 /* MinusToken */: + case 51 /* TildeToken */: + case 50 /* ExclamationToken */: + case 42 /* PlusPlusToken */: + case 43 /* MinusMinusToken */: + return true; + default: + return false; + } + } + function isKeyword(token) { + return token >= 71 /* FirstKeyword */ && token <= 140 /* LastKeyword */; + } + function classFromKind(token) { + if (isKeyword(token)) { + return 3 /* keyword */; + } + else if (isBinaryExpressionOperatorToken(token) || isPrefixUnaryExpressionOperatorToken(token)) { + return 5 /* operator */; + } + else if (token >= 16 /* FirstPunctuation */ && token <= 69 /* LastPunctuation */) { + return 10 /* punctuation */; + } + switch (token) { + case 8 /* NumericLiteral */: + return 4 /* numericLiteral */; + case 9 /* StringLiteral */: + return 6 /* stringLiteral */; + case 11 /* RegularExpressionLiteral */: + return 7 /* regularExpressionLiteral */; + case 7 /* ConflictMarkerTrivia */: + case 3 /* MultiLineCommentTrivia */: + case 2 /* SingleLineCommentTrivia */: + return 1 /* comment */; + case 5 /* WhitespaceTrivia */: + case 4 /* NewLineTrivia */: + return 8 /* whiteSpace */; + case 70 /* Identifier */: + default: + if (ts.isTemplateLiteralKind(token)) { + return 6 /* stringLiteral */; + } + return 2 /* identifier */; + } + } + return { + getClassificationsForLine: getClassificationsForLine, + getEncodedLexicalClassifications: getEncodedLexicalClassifications + }; + } + ts.createClassifier = createClassifier; + /* @internal */ + function getSemanticClassifications(typeChecker, cancellationToken, sourceFile, classifiableNames, span) { + return convertClassifications(getEncodedSemanticClassifications(typeChecker, cancellationToken, sourceFile, classifiableNames, span)); + } + ts.getSemanticClassifications = getSemanticClassifications; + function checkForClassificationCancellation(cancellationToken, kind) { + // We don't want to actually call back into our host on every node to find out if we've + // been canceled. That would be an enormous amount of chattyness, along with the all + // the overhead of marshalling the data to/from the host. So instead we pick a few + // reasonable node kinds to bother checking on. These node kinds represent high level + // constructs that we would expect to see commonly, but just at a far less frequent + // interval. + // + // For example, in checker.ts (around 750k) we only have around 600 of these constructs. + // That means we're calling back into the host around every 1.2k of the file we process. + // Lib.d.ts has similar numbers. + switch (kind) { + case 230 /* ModuleDeclaration */: + case 226 /* ClassDeclaration */: + case 227 /* InterfaceDeclaration */: + case 225 /* FunctionDeclaration */: + cancellationToken.throwIfCancellationRequested(); + } + } + /* @internal */ + function getEncodedSemanticClassifications(typeChecker, cancellationToken, sourceFile, classifiableNames, span) { + var result = []; + processNode(sourceFile); + return { spans: result, endOfLineState: 0 /* None */ }; + function pushClassification(start, length, type) { + result.push(start); + result.push(length); + result.push(type); + } + function classifySymbol(symbol, meaningAtPosition) { + var flags = symbol.getFlags(); + if ((flags & 788448 /* Classifiable */) === 0 /* None */) { + return; + } + if (flags & 32 /* Class */) { + return 11 /* className */; + } + else if (flags & 384 /* Enum */) { + return 12 /* enumName */; + } + else if (flags & 524288 /* TypeAlias */) { + return 16 /* typeAliasName */; + } + else if (meaningAtPosition & 2 /* Type */) { + if (flags & 64 /* Interface */) { + return 13 /* interfaceName */; + } + else if (flags & 262144 /* TypeParameter */) { + return 15 /* typeParameterName */; + } + } + else if (flags & 1536 /* Module */) { + // Only classify a module as such if + // - It appears in a namespace context. + // - There exists a module declaration which actually impacts the value side. + if (meaningAtPosition & 4 /* Namespace */ || + (meaningAtPosition & 1 /* Value */ && hasValueSideModule(symbol))) { + return 14 /* moduleName */; + } + } + return undefined; + /** + * Returns true if there exists a module that introduces entities on the value side. + */ + function hasValueSideModule(symbol) { + return ts.forEach(symbol.declarations, function (declaration) { + return declaration.kind === 230 /* ModuleDeclaration */ && + ts.getModuleInstanceState(declaration) === 1 /* Instantiated */; + }); + } + } + function processNode(node) { + // Only walk into nodes that intersect the requested span. + if (node && ts.textSpanIntersectsWith(span, node.getFullStart(), node.getFullWidth())) { + var kind = node.kind; + checkForClassificationCancellation(cancellationToken, kind); + if (kind === 70 /* Identifier */ && !ts.nodeIsMissing(node)) { + var identifier = node; + // Only bother calling into the typechecker if this is an identifier that + // could possibly resolve to a type name. This makes classification run + // in a third of the time it would normally take. + if (classifiableNames[identifier.text]) { + var symbol = typeChecker.getSymbolAtLocation(node); + if (symbol) { + var type = classifySymbol(symbol, ts.getMeaningFromLocation(node)); + if (type) { + pushClassification(node.getStart(), node.getWidth(), type); } - if (parent_16.kind === 216 /* TryStatement */) { - // Could be the try-block, or the finally-block. - var tryStatement = parent_16; - if (tryStatement.tryBlock === n) { - addOutliningSpan(parent_16, openBrace, closeBrace, autoCollapse(n)); - break; + } + } + } + ts.forEachChild(node, processNode); + } + } + } + ts.getEncodedSemanticClassifications = getEncodedSemanticClassifications; + function getClassificationTypeName(type) { + switch (type) { + case 1 /* comment */: return ts.ClassificationTypeNames.comment; + case 2 /* identifier */: return ts.ClassificationTypeNames.identifier; + case 3 /* keyword */: return ts.ClassificationTypeNames.keyword; + case 4 /* numericLiteral */: return ts.ClassificationTypeNames.numericLiteral; + case 5 /* operator */: return ts.ClassificationTypeNames.operator; + case 6 /* stringLiteral */: return ts.ClassificationTypeNames.stringLiteral; + case 8 /* whiteSpace */: return ts.ClassificationTypeNames.whiteSpace; + case 9 /* text */: return ts.ClassificationTypeNames.text; + case 10 /* punctuation */: return ts.ClassificationTypeNames.punctuation; + case 11 /* className */: return ts.ClassificationTypeNames.className; + case 12 /* enumName */: return ts.ClassificationTypeNames.enumName; + case 13 /* interfaceName */: return ts.ClassificationTypeNames.interfaceName; + case 14 /* moduleName */: return ts.ClassificationTypeNames.moduleName; + case 15 /* typeParameterName */: return ts.ClassificationTypeNames.typeParameterName; + case 16 /* typeAliasName */: return ts.ClassificationTypeNames.typeAliasName; + case 17 /* parameterName */: return ts.ClassificationTypeNames.parameterName; + case 18 /* docCommentTagName */: return ts.ClassificationTypeNames.docCommentTagName; + case 19 /* jsxOpenTagName */: return ts.ClassificationTypeNames.jsxOpenTagName; + case 20 /* jsxCloseTagName */: return ts.ClassificationTypeNames.jsxCloseTagName; + case 21 /* jsxSelfClosingTagName */: return ts.ClassificationTypeNames.jsxSelfClosingTagName; + case 22 /* jsxAttribute */: return ts.ClassificationTypeNames.jsxAttribute; + case 23 /* jsxText */: return ts.ClassificationTypeNames.jsxText; + case 24 /* jsxAttributeStringLiteralValue */: return ts.ClassificationTypeNames.jsxAttributeStringLiteralValue; + } + } + function convertClassifications(classifications) { + ts.Debug.assert(classifications.spans.length % 3 === 0); + var dense = classifications.spans; + var result = []; + for (var i = 0, n = dense.length; i < n; i += 3) { + result.push({ + textSpan: ts.createTextSpan(dense[i], dense[i + 1]), + classificationType: getClassificationTypeName(dense[i + 2]) + }); + } + return result; + } + /* @internal */ + function getSyntacticClassifications(cancellationToken, sourceFile, span) { + return convertClassifications(getEncodedSyntacticClassifications(cancellationToken, sourceFile, span)); + } + ts.getSyntacticClassifications = getSyntacticClassifications; + /* @internal */ + function getEncodedSyntacticClassifications(cancellationToken, sourceFile, span) { + var spanStart = span.start; + var spanLength = span.length; + // Make a scanner we can get trivia from. + var triviaScanner = ts.createScanner(5 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text); + var mergeConflictScanner = ts.createScanner(5 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text); + var result = []; + processElement(sourceFile); + return { spans: result, endOfLineState: 0 /* None */ }; + function pushClassification(start, length, type) { + result.push(start); + result.push(length); + result.push(type); + } + function classifyLeadingTriviaAndGetTokenStart(token) { + triviaScanner.setTextPos(token.pos); + while (true) { + var start = triviaScanner.getTextPos(); + // only bother scanning if we have something that could be trivia. + if (!ts.couldStartTrivia(sourceFile.text, start)) { + return start; + } + var kind = triviaScanner.scan(); + var end = triviaScanner.getTextPos(); + var width = end - start; + // The moment we get something that isn't trivia, then stop processing. + if (!ts.isTrivia(kind)) { + return start; + } + // Don't bother with newlines/whitespace. + if (kind === 4 /* NewLineTrivia */ || kind === 5 /* WhitespaceTrivia */) { + continue; + } + // Only bother with the trivia if it at least intersects the span of interest. + if (ts.isComment(kind)) { + classifyComment(token, kind, start, width); + // Classifying a comment might cause us to reuse the trivia scanner + // (because of jsdoc comments). So after we classify the comment make + // sure we set the scanner position back to where it needs to be. + triviaScanner.setTextPos(end); + continue; + } + if (kind === 7 /* ConflictMarkerTrivia */) { + var text = sourceFile.text; + var ch = text.charCodeAt(start); + // for the <<<<<<< and >>>>>>> markers, we just add them in as comments + // in the classification stream. + if (ch === 60 /* lessThan */ || ch === 62 /* greaterThan */) { + pushClassification(start, width, 1 /* comment */); + continue; + } + // for the ======== add a comment for the first line, and then lex all + // subsequent lines up until the end of the conflict marker. + ts.Debug.assert(ch === 61 /* equals */); + classifyDisabledMergeCode(text, start, end); + } + } + } + function classifyComment(token, kind, start, width) { + if (kind === 3 /* MultiLineCommentTrivia */) { + // See if this is a doc comment. If so, we'll classify certain portions of it + // specially. + var docCommentAndDiagnostics = ts.parseIsolatedJSDocComment(sourceFile.text, start, width); + if (docCommentAndDiagnostics && docCommentAndDiagnostics.jsDoc) { + docCommentAndDiagnostics.jsDoc.parent = token; + classifyJSDocComment(docCommentAndDiagnostics.jsDoc); + return; + } + } + // Simple comment. Just add as is. + pushCommentRange(start, width); + } + function pushCommentRange(start, width) { + pushClassification(start, width, 1 /* comment */); + } + function classifyJSDocComment(docComment) { + var pos = docComment.pos; + if (docComment.tags) { + for (var _i = 0, _a = docComment.tags; _i < _a.length; _i++) { + var tag = _a[_i]; + // As we walk through each tag, classify the portion of text from the end of + // the last tag (or the start of the entire doc comment) as 'comment'. + if (tag.pos !== pos) { + pushCommentRange(pos, tag.pos - pos); + } + pushClassification(tag.atToken.pos, tag.atToken.end - tag.atToken.pos, 10 /* punctuation */); + pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); + pos = tag.tagName.end; + switch (tag.kind) { + case 281 /* JSDocParameterTag */: + processJSDocParameterTag(tag); + break; + case 284 /* JSDocTemplateTag */: + processJSDocTemplateTag(tag); + break; + case 283 /* JSDocTypeTag */: + processElement(tag.typeExpression); + break; + case 282 /* JSDocReturnTag */: + processElement(tag.typeExpression); + break; + } + pos = tag.end; + } + } + if (pos !== docComment.end) { + pushCommentRange(pos, docComment.end - pos); + } + return; + function processJSDocParameterTag(tag) { + if (tag.preParameterName) { + pushCommentRange(pos, tag.preParameterName.pos - pos); + pushClassification(tag.preParameterName.pos, tag.preParameterName.end - tag.preParameterName.pos, 17 /* parameterName */); + pos = tag.preParameterName.end; + } + if (tag.typeExpression) { + pushCommentRange(pos, tag.typeExpression.pos - pos); + processElement(tag.typeExpression); + pos = tag.typeExpression.end; + } + if (tag.postParameterName) { + pushCommentRange(pos, tag.postParameterName.pos - pos); + pushClassification(tag.postParameterName.pos, tag.postParameterName.end - tag.postParameterName.pos, 17 /* parameterName */); + pos = tag.postParameterName.end; + } + } + } + function processJSDocTemplateTag(tag) { + for (var _i = 0, _a = tag.getChildren(); _i < _a.length; _i++) { + var child = _a[_i]; + processElement(child); + } + } + function classifyDisabledMergeCode(text, start, end) { + // Classify the line that the ======= marker is on as a comment. Then just lex + // all further tokens and add them to the result. + var i; + for (i = start; i < end; i++) { + if (ts.isLineBreak(text.charCodeAt(i))) { + break; + } + } + pushClassification(start, i - start, 1 /* comment */); + mergeConflictScanner.setTextPos(i); + while (mergeConflictScanner.getTextPos() < end) { + classifyDisabledCodeToken(); + } + } + function classifyDisabledCodeToken() { + var start = mergeConflictScanner.getTextPos(); + var tokenKind = mergeConflictScanner.scan(); + var end = mergeConflictScanner.getTextPos(); + var type = classifyTokenType(tokenKind); + if (type) { + pushClassification(start, end - start, type); + } + } + /** + * Returns true if node should be treated as classified and no further processing is required. + * False will mean that node is not classified and traverse routine should recurse into node contents. + */ + function tryClassifyNode(node) { + if (ts.isJSDocTag(node)) { + return true; + } + if (ts.nodeIsMissing(node)) { + return true; + } + var classifiedElementName = tryClassifyJsxElementName(node); + if (!ts.isToken(node) && node.kind !== 10 /* JsxText */ && classifiedElementName === undefined) { + return false; + } + var tokenStart = node.kind === 10 /* JsxText */ ? node.pos : classifyLeadingTriviaAndGetTokenStart(node); + var tokenWidth = node.end - tokenStart; + ts.Debug.assert(tokenWidth >= 0); + if (tokenWidth > 0) { + var type = classifiedElementName || classifyTokenType(node.kind, node); + if (type) { + pushClassification(tokenStart, tokenWidth, type); + } + } + return true; + } + function tryClassifyJsxElementName(token) { + switch (token.parent && token.parent.kind) { + case 248 /* JsxOpeningElement */: + if (token.parent.tagName === token) { + return 19 /* jsxOpenTagName */; + } + break; + case 249 /* JsxClosingElement */: + if (token.parent.tagName === token) { + return 20 /* jsxCloseTagName */; + } + break; + case 247 /* JsxSelfClosingElement */: + if (token.parent.tagName === token) { + return 21 /* jsxSelfClosingTagName */; + } + break; + case 250 /* JsxAttribute */: + if (token.parent.name === token) { + return 22 /* jsxAttribute */; + } + break; + } + return undefined; + } + // for accurate classification, the actual token should be passed in. however, for + // cases like 'disabled merge code' classification, we just get the token kind and + // classify based on that instead. + function classifyTokenType(tokenKind, token) { + if (ts.isKeyword(tokenKind)) { + return 3 /* keyword */; + } + // Special case < and > If they appear in a generic context they are punctuation, + // not operators. + if (tokenKind === 26 /* LessThanToken */ || tokenKind === 28 /* GreaterThanToken */) { + // If the node owning the token has a type argument list or type parameter list, then + // we can effectively assume that a '<' and '>' belong to those lists. + if (token && ts.getTypeArgumentOrTypeParameterList(token.parent)) { + return 10 /* punctuation */; + } + } + if (ts.isPunctuation(tokenKind)) { + if (token) { + if (tokenKind === 57 /* EqualsToken */) { + // the '=' in a variable declaration is special cased here. + if (token.parent.kind === 223 /* VariableDeclaration */ || + token.parent.kind === 147 /* PropertyDeclaration */ || + token.parent.kind === 144 /* Parameter */ || + token.parent.kind === 250 /* JsxAttribute */) { + return 5 /* operator */; + } + } + if (token.parent.kind === 192 /* BinaryExpression */ || + token.parent.kind === 190 /* PrefixUnaryExpression */ || + token.parent.kind === 191 /* PostfixUnaryExpression */ || + token.parent.kind === 193 /* ConditionalExpression */) { + return 5 /* operator */; + } + } + return 10 /* punctuation */; + } + else if (tokenKind === 8 /* NumericLiteral */) { + return 4 /* numericLiteral */; + } + else if (tokenKind === 9 /* StringLiteral */) { + return token.parent.kind === 250 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; + } + else if (tokenKind === 11 /* RegularExpressionLiteral */) { + // TODO: we should get another classification type for these literals. + return 6 /* stringLiteral */; + } + else if (ts.isTemplateLiteralKind(tokenKind)) { + // TODO (drosen): we should *also* get another classification type for these literals. + return 6 /* stringLiteral */; + } + else if (tokenKind === 10 /* JsxText */) { + return 23 /* jsxText */; + } + else if (tokenKind === 70 /* Identifier */) { + if (token) { + switch (token.parent.kind) { + case 226 /* ClassDeclaration */: + if (token.parent.name === token) { + return 11 /* className */; + } + return; + case 143 /* TypeParameter */: + if (token.parent.name === token) { + return 15 /* typeParameterName */; + } + return; + case 227 /* InterfaceDeclaration */: + if (token.parent.name === token) { + return 13 /* interfaceName */; + } + return; + case 229 /* EnumDeclaration */: + if (token.parent.name === token) { + return 12 /* enumName */; + } + return; + case 230 /* ModuleDeclaration */: + if (token.parent.name === token) { + return 14 /* moduleName */; + } + return; + case 144 /* Parameter */: + if (token.parent.name === token) { + return ts.isThisIdentifier(token) ? 3 /* keyword */ : 17 /* parameterName */; + } + return; + } + } + return 2 /* identifier */; + } + } + function processElement(element) { + if (!element) { + return; + } + // Ignore nodes that don't intersect the original span to classify. + if (ts.decodedTextSpanIntersectsWith(spanStart, spanLength, element.pos, element.getFullWidth())) { + checkForClassificationCancellation(cancellationToken, element.kind); + var children = element.getChildren(sourceFile); + for (var i = 0, n = children.length; i < n; i++) { + var child = children[i]; + if (!tryClassifyNode(child)) { + // Recurse into our child nodes. + processElement(child); + } + } + } + } + } + ts.getEncodedSyntacticClassifications = getEncodedSyntacticClassifications; +})(ts || (ts = {})); +/// +/* @internal */ +var ts; +(function (ts) { + var Completions; + (function (Completions) { + function getCompletionsAtPosition(host, typeChecker, log, compilerOptions, sourceFile, position) { + if (ts.isInReferenceComment(sourceFile, position)) { + return getTripleSlashReferenceCompletion(sourceFile, position); + } + if (ts.isInString(sourceFile, position)) { + return getStringLiteralCompletionEntries(sourceFile, position); + } + var completionData = getCompletionData(typeChecker, log, sourceFile, position); + if (!completionData) { + return undefined; + } + var symbols = completionData.symbols, isGlobalCompletion = completionData.isGlobalCompletion, isMemberCompletion = completionData.isMemberCompletion, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, isJsDocTagName = completionData.isJsDocTagName; + if (isJsDocTagName) { + // If the current position is a jsDoc tag name, only tag names should be provided for completion + return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: ts.JsDoc.getAllJsDocCompletionEntries() }; + } + var entries = []; + if (ts.isSourceFileJavaScript(sourceFile)) { + var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, /*performCharacterChecks*/ true); + ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames)); + } + else { + if (!symbols || symbols.length === 0) { + if (sourceFile.languageVariant === 1 /* JSX */ && + location.parent && location.parent.kind === 249 /* JsxClosingElement */) { + // In the TypeScript JSX element, if such element is not defined. When users query for completion at closing tag, + // instead of simply giving unknown value, the completion will return the tag-name of an associated opening-element. + // For example: + // var x =
completion list at "1" will contain "div" with type any + var tagName = location.parent.parent.openingElement.tagName; + entries.push({ + name: tagName.text, + kind: undefined, + kindModifiers: undefined, + sortText: "0", + }); + } + else { + return undefined; + } + } + getCompletionEntriesFromSymbols(symbols, entries, location, /*performCharacterChecks*/ true); + } + // Add keywords if this is not a member completion list + if (!isMemberCompletion && !isJsDocTagName) { + ts.addRange(entries, keywordCompletions); + } + return { isGlobalCompletion: isGlobalCompletion, isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, entries: entries }; + function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) { + var entries = []; + var nameTable = ts.getNameTable(sourceFile); + for (var name_45 in nameTable) { + // Skip identifiers produced only from the current location + if (nameTable[name_45] === position) { + continue; + } + if (!uniqueNames[name_45]) { + uniqueNames[name_45] = name_45; + var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_45), compilerOptions.target, /*performCharacterChecks*/ true); + if (displayName) { + var entry = { + name: displayName, + kind: ts.ScriptElementKind.warning, + kindModifiers: "", + sortText: "1" + }; + entries.push(entry); + } + } + } + return entries; + } + function createCompletionEntry(symbol, location, performCharacterChecks) { + // Try to get a valid display name for this symbol, if we could not find one, then ignore it. + // We would like to only show things that can be added after a dot, so for instance numeric properties can + // not be accessed with a dot (a.1 <- invalid) + var displayName = getCompletionEntryDisplayNameForSymbol(typeChecker, symbol, compilerOptions.target, performCharacterChecks, location); + if (!displayName) { + return undefined; + } + // TODO(drosen): Right now we just permit *all* semantic meanings when calling + // 'getSymbolKind' which is permissible given that it is backwards compatible; but + // really we should consider passing the meaning for the node so that we don't report + // that a suggestion for a value is an interface. We COULD also just do what + // 'getSymbolModifiers' does, which is to use the first declaration. + // Use a 'sortText' of 0' so that all symbol completion entries come before any other + // entries (like JavaScript identifier entries). + return { + name: displayName, + kind: ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location), + kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), + sortText: "0", + }; + } + function getCompletionEntriesFromSymbols(symbols, entries, location, performCharacterChecks) { + var start = ts.timestamp(); + var uniqueNames = ts.createMap(); + if (symbols) { + for (var _i = 0, symbols_4 = symbols; _i < symbols_4.length; _i++) { + var symbol = symbols_4[_i]; + var entry = createCompletionEntry(symbol, location, performCharacterChecks); + if (entry) { + var id = ts.escapeIdentifier(entry.name); + if (!uniqueNames[id]) { + entries.push(entry); + uniqueNames[id] = id; + } + } + } + } + log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (ts.timestamp() - start)); + return uniqueNames; + } + function getStringLiteralCompletionEntries(sourceFile, position) { + var node = ts.findPrecedingToken(position, sourceFile); + if (!node || node.kind !== 9 /* StringLiteral */) { + return undefined; + } + if (node.parent.kind === 257 /* PropertyAssignment */ && + node.parent.parent.kind === 176 /* ObjectLiteralExpression */ && + node.parent.name === node) { + // Get quoted name of properties of the object literal expression + // i.e. interface ConfigFiles { + // 'jspm:dev': string + // } + // let files: ConfigFiles = { + // '/*completion position*/' + // } + // + // function foo(c: ConfigFiles) {} + // foo({ + // '/*completion position*/' + // }); + return getStringLiteralCompletionEntriesFromPropertyAssignment(node.parent); + } + else if (ts.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node) { + // Get all names of properties on the expression + // i.e. interface A { + // 'prop1': string + // } + // let a: A; + // a['/*completion position*/'] + return getStringLiteralCompletionEntriesFromElementAccess(node.parent); + } + else if (node.parent.kind === 235 /* ImportDeclaration */ || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node) || ts.isRequireCall(node.parent, false)) { + // Get all known external module names or complete a path to a module + // i.e. import * as ns from "/*completion position*/"; + // import x = require("/*completion position*/"); + // var y = require("/*completion position*/"); + return getStringLiteralCompletionEntriesFromModuleNames(node); + } + else { + var argumentInfo = ts.SignatureHelp.getContainingArgumentInfo(node, position, sourceFile); + if (argumentInfo) { + // Get string literal completions from specialized signatures of the target + // i.e. declare function f(a: 'A'); + // f("/*completion position*/") + return getStringLiteralCompletionEntriesFromCallExpression(argumentInfo); + } + // Get completion for string literal from string literal type + // i.e. var x: "hi" | "hello" = "/*completion position*/" + return getStringLiteralCompletionEntriesFromContextualType(node); + } + } + function getStringLiteralCompletionEntriesFromPropertyAssignment(element) { + var type = typeChecker.getContextualType(element.parent); + var entries = []; + if (type) { + getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, element, /*performCharacterChecks*/ false); + if (entries.length) { + return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries }; + } + } + } + function getStringLiteralCompletionEntriesFromCallExpression(argumentInfo) { + var candidates = []; + var entries = []; + typeChecker.getResolvedSignature(argumentInfo.invocation, candidates); + for (var _i = 0, candidates_3 = candidates; _i < candidates_3.length; _i++) { + var candidate = candidates_3[_i]; + if (candidate.parameters.length > argumentInfo.argumentIndex) { + var parameter = candidate.parameters[argumentInfo.argumentIndex]; + addStringLiteralCompletionsFromType(typeChecker.getTypeAtLocation(parameter.valueDeclaration), entries); + } + } + if (entries.length) { + return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: true, entries: entries }; + } + return undefined; + } + function getStringLiteralCompletionEntriesFromElementAccess(node) { + var type = typeChecker.getTypeAtLocation(node.expression); + var entries = []; + if (type) { + getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, node, /*performCharacterChecks*/ false); + if (entries.length) { + return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries }; + } + } + return undefined; + } + function getStringLiteralCompletionEntriesFromContextualType(node) { + var type = typeChecker.getContextualType(node); + if (type) { + var entries_2 = []; + addStringLiteralCompletionsFromType(type, entries_2); + if (entries_2.length) { + return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries_2 }; + } + } + return undefined; + } + function addStringLiteralCompletionsFromType(type, result) { + if (!type) { + return; + } + if (type.flags & 65536 /* Union */) { + ts.forEach(type.types, function (t) { return addStringLiteralCompletionsFromType(t, result); }); + } + else { + if (type.flags & 32 /* StringLiteral */) { + result.push({ + name: type.text, + kindModifiers: ts.ScriptElementKindModifier.none, + kind: ts.ScriptElementKind.variableElement, + sortText: "0" + }); + } + } + } + function getStringLiteralCompletionEntriesFromModuleNames(node) { + var literalValue = ts.normalizeSlashes(node.text); + var scriptPath = node.getSourceFile().path; + var scriptDirectory = ts.getDirectoryPath(scriptPath); + var span = getDirectoryFragmentTextSpan(node.text, node.getStart() + 1); + var entries; + if (isPathRelativeToScript(literalValue) || ts.isRootedDiskPath(literalValue)) { + if (compilerOptions.rootDirs) { + entries = getCompletionEntriesForDirectoryFragmentWithRootDirs(compilerOptions.rootDirs, literalValue, scriptDirectory, ts.getSupportedExtensions(compilerOptions), /*includeExtensions*/ false, span, scriptPath); + } + else { + entries = getCompletionEntriesForDirectoryFragment(literalValue, scriptDirectory, ts.getSupportedExtensions(compilerOptions), /*includeExtensions*/ false, span, scriptPath); + } + } + else { + // Check for node modules + entries = getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, span); + } + return { + isGlobalCompletion: false, + isMemberCompletion: false, + isNewIdentifierLocation: true, + entries: entries + }; + } + /** + * Takes a script path and returns paths for all potential folders that could be merged with its + * containing folder via the "rootDirs" compiler option + */ + function getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase) { + // Make all paths absolute/normalized if they are not already + rootDirs = ts.map(rootDirs, function (rootDirectory) { return ts.normalizePath(ts.isRootedDiskPath(rootDirectory) ? rootDirectory : ts.combinePaths(basePath, rootDirectory)); }); + // Determine the path to the directory containing the script relative to the root directory it is contained within + var relativeDirectory; + for (var _i = 0, rootDirs_1 = rootDirs; _i < rootDirs_1.length; _i++) { + var rootDirectory = rootDirs_1[_i]; + if (ts.containsPath(rootDirectory, scriptPath, basePath, ignoreCase)) { + relativeDirectory = scriptPath.substr(rootDirectory.length); + break; + } + } + // Now find a path for each potential directory that is to be merged with the one containing the script + return ts.deduplicate(ts.map(rootDirs, function (rootDirectory) { return ts.combinePaths(rootDirectory, relativeDirectory); })); + } + function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptPath, extensions, includeExtensions, span, exclude) { + var basePath = compilerOptions.project || host.getCurrentDirectory(); + var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); + var baseDirectories = getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase); + var result = []; + for (var _i = 0, baseDirectories_1 = baseDirectories; _i < baseDirectories_1.length; _i++) { + var baseDirectory = baseDirectories_1[_i]; + getCompletionEntriesForDirectoryFragment(fragment, baseDirectory, extensions, includeExtensions, span, exclude, result); + } + return result; + } + /** + * Given a path ending at a directory, gets the completions for the path, and filters for those entries containing the basename. + */ + function getCompletionEntriesForDirectoryFragment(fragment, scriptPath, extensions, includeExtensions, span, exclude, result) { + if (result === void 0) { result = []; } + if (fragment === undefined) { + fragment = ""; + } + fragment = ts.normalizeSlashes(fragment); + /** + * Remove the basename from the path. Note that we don't use the basename to filter completions; + * the client is responsible for refining completions. + */ + fragment = ts.getDirectoryPath(fragment); + if (fragment === "") { + fragment = "." + ts.directorySeparator; + } + fragment = ts.ensureTrailingDirectorySeparator(fragment); + var absolutePath = normalizeAndPreserveTrailingSlash(ts.isRootedDiskPath(fragment) ? fragment : ts.combinePaths(scriptPath, fragment)); + var baseDirectory = ts.getDirectoryPath(absolutePath); + var ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames()); + if (tryDirectoryExists(host, baseDirectory)) { + // Enumerate the available files if possible + var files = tryReadDirectory(host, baseDirectory, extensions, /*exclude*/ undefined, /*include*/ ["./*"]); + if (files) { + /** + * Multiple file entries might map to the same truncated name once we remove extensions + * (happens iff includeExtensions === false)so we use a set-like data structure. Eg: + * + * both foo.ts and foo.tsx become foo + */ + var foundFiles = ts.createMap(); + for (var _i = 0, files_3 = files; _i < files_3.length; _i++) { + var filePath = files_3[_i]; + filePath = ts.normalizePath(filePath); + if (exclude && ts.comparePaths(filePath, exclude, scriptPath, ignoreCase) === 0 /* EqualTo */) { + continue; + } + var foundFileName = includeExtensions ? ts.getBaseFileName(filePath) : ts.removeFileExtension(ts.getBaseFileName(filePath)); + if (!foundFiles[foundFileName]) { + foundFiles[foundFileName] = true; + } + } + for (var foundFile in foundFiles) { + result.push(createCompletionEntryForModule(foundFile, ts.ScriptElementKind.scriptElement, span)); + } + } + // If possible, get folder completion as well + var directories = tryGetDirectories(host, baseDirectory); + if (directories) { + for (var _a = 0, directories_2 = directories; _a < directories_2.length; _a++) { + var directory = directories_2[_a]; + var directoryName = ts.getBaseFileName(ts.normalizePath(directory)); + result.push(createCompletionEntryForModule(directoryName, ts.ScriptElementKind.directory, span)); + } + } + } + return result; + } + /** + * Check all of the declared modules and those in node modules. Possible sources of modules: + * Modules that are found by the type checker + * Modules found relative to "baseUrl" compliler options (including patterns from "paths" compiler option) + * Modules from node_modules (i.e. those listed in package.json) + * This includes all files that are found in node_modules/moduleName/ with acceptable file extensions + */ + function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, span) { + var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths; + var result; + if (baseUrl) { + var fileExtensions = ts.getSupportedExtensions(compilerOptions); + var projectDir = compilerOptions.project || host.getCurrentDirectory(); + var absolute = ts.isRootedDiskPath(baseUrl) ? baseUrl : ts.combinePaths(projectDir, baseUrl); + result = getCompletionEntriesForDirectoryFragment(fragment, ts.normalizePath(absolute), fileExtensions, /*includeExtensions*/ false, span); + if (paths) { + for (var path in paths) { + if (paths.hasOwnProperty(path)) { + if (path === "*") { + if (paths[path]) { + for (var _i = 0, _a = paths[path]; _i < _a.length; _i++) { + var pattern = _a[_i]; + for (var _b = 0, _c = getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions); _b < _c.length; _b++) { + var match = _c[_b]; + result.push(createCompletionEntryForModule(match, ts.ScriptElementKind.externalModuleName, span)); + } + } + } } - else if (tryStatement.finallyBlock === n) { - var finallyKeyword = ts.findChildOfKind(tryStatement, 85 /* FinallyKeyword */, sourceFile); - if (finallyKeyword) { - addOutliningSpan(finallyKeyword, openBrace, closeBrace, autoCollapse(n)); - break; + else if (ts.startsWith(path, fragment)) { + var entry = paths[path] && paths[path].length === 1 && paths[path][0]; + if (entry) { + result.push(createCompletionEntryForModule(path, ts.ScriptElementKind.externalModuleName, span)); } } } - // Block was a standalone block. In this case we want to only collapse - // the span of the block, independent of any parent span. - var span = ts.createTextSpanFromBounds(n.getStart(), n.end); - elements.push({ - textSpan: span, - hintSpan: span, - bannerText: collapseText, - autoCollapse: autoCollapse(n) - }); + } + } + } + else { + result = []; + } + getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span, result); + for (var _d = 0, _e = enumeratePotentialNonRelativeModules(fragment, scriptPath, compilerOptions); _d < _e.length; _d++) { + var moduleName = _e[_d]; + result.push(createCompletionEntryForModule(moduleName, ts.ScriptElementKind.externalModuleName, span)); + } + return result; + } + function getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions) { + if (host.readDirectory) { + var parsed = ts.hasZeroOrOneAsteriskCharacter(pattern) ? ts.tryParsePattern(pattern) : undefined; + if (parsed) { + // The prefix has two effective parts: the directory path and the base component after the filepath that is not a + // full directory component. For example: directory/path/of/prefix/base* + var normalizedPrefix = normalizeAndPreserveTrailingSlash(parsed.prefix); + var normalizedPrefixDirectory = ts.getDirectoryPath(normalizedPrefix); + var normalizedPrefixBase = ts.getBaseFileName(normalizedPrefix); + var fragmentHasPath = fragment.indexOf(ts.directorySeparator) !== -1; + // Try and expand the prefix to include any path from the fragment so that we can limit the readDirectory call + var expandedPrefixDirectory = fragmentHasPath ? ts.combinePaths(normalizedPrefixDirectory, normalizedPrefixBase + ts.getDirectoryPath(fragment)) : normalizedPrefixDirectory; + var normalizedSuffix = ts.normalizePath(parsed.suffix); + var baseDirectory = ts.combinePaths(baseUrl, expandedPrefixDirectory); + var completePrefix = fragmentHasPath ? baseDirectory : ts.ensureTrailingDirectorySeparator(baseDirectory) + normalizedPrefixBase; + // If we have a suffix, then we need to read the directory all the way down. We could create a glob + // that encodes the suffix, but we would have to escape the character "?" which readDirectory + // doesn't support. For now, this is safer but slower + var includeGlob = normalizedSuffix ? "**/*" : "./*"; + var matches = tryReadDirectory(host, baseDirectory, fileExtensions, undefined, [includeGlob]); + if (matches) { + var result = []; + // Trim away prefix and suffix + for (var _i = 0, matches_1 = matches; _i < matches_1.length; _i++) { + var match = matches_1[_i]; + var normalizedMatch = ts.normalizePath(match); + if (!ts.endsWith(normalizedMatch, normalizedSuffix) || !ts.startsWith(normalizedMatch, completePrefix)) { + continue; + } + var start = completePrefix.length; + var length_5 = normalizedMatch.length - start - normalizedSuffix.length; + result.push(ts.removeFileExtension(normalizedMatch.substr(start, length_5))); + } + return result; + } + } + } + return undefined; + } + function enumeratePotentialNonRelativeModules(fragment, scriptPath, options) { + // Check If this is a nested module + var isNestedModule = fragment.indexOf(ts.directorySeparator) !== -1; + var moduleNameFragment = isNestedModule ? fragment.substr(0, fragment.lastIndexOf(ts.directorySeparator)) : undefined; + // Get modules that the type checker picked up + var ambientModules = ts.map(typeChecker.getAmbientModules(), function (sym) { return ts.stripQuotes(sym.name); }); + var nonRelativeModules = ts.filter(ambientModules, function (moduleName) { return ts.startsWith(moduleName, fragment); }); + // Nested modules of the form "module-name/sub" need to be adjusted to only return the string + // after the last '/' that appears in the fragment because that's where the replacement span + // starts + if (isNestedModule) { + var moduleNameWithSeperator_1 = ts.ensureTrailingDirectorySeparator(moduleNameFragment); + nonRelativeModules = ts.map(nonRelativeModules, function (moduleName) { + if (ts.startsWith(fragment, moduleNameWithSeperator_1)) { + return moduleName.substr(moduleNameWithSeperator_1.length); + } + return moduleName; + }); + } + if (!options.moduleResolution || options.moduleResolution === ts.ModuleResolutionKind.NodeJs) { + for (var _i = 0, _a = enumerateNodeModulesVisibleToScript(host, scriptPath); _i < _a.length; _i++) { + var visibleModule = _a[_i]; + if (!isNestedModule) { + nonRelativeModules.push(visibleModule.moduleName); + } + else if (ts.startsWith(visibleModule.moduleName, moduleNameFragment)) { + var nestedFiles = tryReadDirectory(host, visibleModule.moduleDir, ts.supportedTypeScriptExtensions, /*exclude*/ undefined, /*include*/ ["./*"]); + if (nestedFiles) { + for (var _b = 0, nestedFiles_1 = nestedFiles; _b < nestedFiles_1.length; _b++) { + var f = nestedFiles_1[_b]; + f = ts.normalizePath(f); + var nestedModule = ts.removeFileExtension(ts.getBaseFileName(f)); + nonRelativeModules.push(nestedModule); + } + } + } + } + } + return ts.deduplicate(nonRelativeModules); + } + function getTripleSlashReferenceCompletion(sourceFile, position) { + var token = ts.getTokenAtPosition(sourceFile, position); + if (!token) { + return undefined; + } + var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos); + if (!commentRanges || !commentRanges.length) { + return undefined; + } + var range = ts.forEach(commentRanges, function (commentRange) { return position >= commentRange.pos && position <= commentRange.end && commentRange; }); + if (!range) { + return undefined; + } + var completionInfo = { + /** + * We don't want the editor to offer any other completions, such as snippets, inside a comment. + */ + isGlobalCompletion: false, + isMemberCompletion: false, + /** + * The user may type in a path that doesn't yet exist, creating a "new identifier" + * with respect to the collection of identifiers the server is aware of. + */ + isNewIdentifierLocation: true, + entries: [] + }; + var text = sourceFile.text.substr(range.pos, position - range.pos); + var match = tripleSlashDirectiveFragmentRegex.exec(text); + if (match) { + var prefix = match[1]; + var kind = match[2]; + var toComplete = match[3]; + var scriptPath = ts.getDirectoryPath(sourceFile.path); + if (kind === "path") { + // Give completions for a relative path + var span_10 = getDirectoryFragmentTextSpan(toComplete, range.pos + prefix.length); + completionInfo.entries = getCompletionEntriesForDirectoryFragment(toComplete, scriptPath, ts.getSupportedExtensions(compilerOptions), /*includeExtensions*/ true, span_10, sourceFile.path); + } + else { + // Give completions based on the typings available + var span_11 = { start: range.pos + prefix.length, length: match[0].length - prefix.length }; + completionInfo.entries = getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span_11); + } + } + return completionInfo; + } + function getCompletionEntriesFromTypings(host, options, scriptPath, span, result) { + if (result === void 0) { result = []; } + // Check for typings specified in compiler options + if (options.types) { + for (var _i = 0, _a = options.types; _i < _a.length; _i++) { + var moduleName = _a[_i]; + result.push(createCompletionEntryForModule(moduleName, ts.ScriptElementKind.externalModuleName, span)); + } + } + else if (host.getDirectories) { + var typeRoots = void 0; + try { + // Wrap in try catch because getEffectiveTypeRoots touches the filesystem + typeRoots = ts.getEffectiveTypeRoots(options, host); + } + catch (e) { } + if (typeRoots) { + for (var _b = 0, typeRoots_2 = typeRoots; _b < typeRoots_2.length; _b++) { + var root = typeRoots_2[_b]; + getCompletionEntriesFromDirectories(host, root, span, result); + } + } + } + if (host.getDirectories) { + // Also get all @types typings installed in visible node_modules directories + for (var _c = 0, _d = findPackageJsons(scriptPath); _c < _d.length; _c++) { + var packageJson = _d[_c]; + var typesDir = ts.combinePaths(ts.getDirectoryPath(packageJson), "node_modules/@types"); + getCompletionEntriesFromDirectories(host, typesDir, span, result); + } + } + return result; + } + function getCompletionEntriesFromDirectories(host, directory, span, result) { + if (host.getDirectories && tryDirectoryExists(host, directory)) { + var directories = tryGetDirectories(host, directory); + if (directories) { + for (var _i = 0, directories_3 = directories; _i < directories_3.length; _i++) { + var typeDirectory = directories_3[_i]; + typeDirectory = ts.normalizePath(typeDirectory); + result.push(createCompletionEntryForModule(ts.getBaseFileName(typeDirectory), ts.ScriptElementKind.externalModuleName, span)); + } + } + } + } + function findPackageJsons(currentDir) { + var paths = []; + var currentConfigPath; + while (true) { + currentConfigPath = ts.findConfigFile(currentDir, function (f) { return tryFileExists(host, f); }, "package.json"); + if (currentConfigPath) { + paths.push(currentConfigPath); + currentDir = ts.getDirectoryPath(currentConfigPath); + var parent_14 = ts.getDirectoryPath(currentDir); + if (currentDir === parent_14) { break; } - // Fallthrough. - case 226 /* ModuleBlock */: { - var openBrace = ts.findChildOfKind(n, 15 /* OpenBraceToken */, sourceFile); - var closeBrace = ts.findChildOfKind(n, 16 /* CloseBraceToken */, sourceFile); - addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); + currentDir = parent_14; + } + else { break; } - case 221 /* ClassDeclaration */: - case 222 /* InterfaceDeclaration */: - case 224 /* EnumDeclaration */: - case 171 /* ObjectLiteralExpression */: - case 227 /* CaseBlock */: { - var openBrace = ts.findChildOfKind(n, 15 /* OpenBraceToken */, sourceFile); - var closeBrace = ts.findChildOfKind(n, 16 /* CloseBraceToken */, sourceFile); - addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); - break; - } - case 170 /* ArrayLiteralExpression */: - var openBracket = ts.findChildOfKind(n, 19 /* OpenBracketToken */, sourceFile); - var closeBracket = ts.findChildOfKind(n, 20 /* CloseBracketToken */, sourceFile); - addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); - break; } - depth++; - ts.forEachChild(n, walk); - depth--; + return paths; + } + function enumerateNodeModulesVisibleToScript(host, scriptPath) { + var result = []; + if (host.readFile && host.fileExists) { + for (var _i = 0, _a = findPackageJsons(scriptPath); _i < _a.length; _i++) { + var packageJson = _a[_i]; + var contents = tryReadingPackageJson(packageJson); + if (!contents) { + return; + } + var nodeModulesDir = ts.combinePaths(ts.getDirectoryPath(packageJson), "node_modules"); + var foundModuleNames = []; + // Provide completions for all non @types dependencies + for (var _b = 0, nodeModulesDependencyKeys_1 = nodeModulesDependencyKeys; _b < nodeModulesDependencyKeys_1.length; _b++) { + var key = nodeModulesDependencyKeys_1[_b]; + addPotentialPackageNames(contents[key], foundModuleNames); + } + for (var _c = 0, foundModuleNames_1 = foundModuleNames; _c < foundModuleNames_1.length; _c++) { + var moduleName = foundModuleNames_1[_c]; + var moduleDir = ts.combinePaths(nodeModulesDir, moduleName); + result.push({ + moduleName: moduleName, + moduleDir: moduleDir + }); + } + } + } + return result; + function tryReadingPackageJson(filePath) { + try { + var fileText = tryReadFile(host, filePath); + return fileText ? JSON.parse(fileText) : undefined; + } + catch (e) { + return undefined; + } + } + function addPotentialPackageNames(dependencies, result) { + if (dependencies) { + for (var dep in dependencies) { + if (dependencies.hasOwnProperty(dep) && !ts.startsWith(dep, "@types/")) { + result.push(dep); + } + } + } + } + } + function createCompletionEntryForModule(name, kind, replacementSpan) { + return { name: name, kind: kind, kindModifiers: ts.ScriptElementKindModifier.none, sortText: name, replacementSpan: replacementSpan }; + } + // Replace everything after the last directory seperator that appears + function getDirectoryFragmentTextSpan(text, textStart) { + var index = text.lastIndexOf(ts.directorySeparator); + var offset = index !== -1 ? index + 1 : 0; + return { start: textStart + offset, length: text.length - offset }; + } + // Returns true if the path is explicitly relative to the script (i.e. relative to . or ..) + function isPathRelativeToScript(path) { + if (path && path.length >= 2 && path.charCodeAt(0) === 46 /* dot */) { + var slashIndex = path.length >= 3 && path.charCodeAt(1) === 46 /* dot */ ? 2 : 1; + var slashCharCode = path.charCodeAt(slashIndex); + return slashCharCode === 47 /* slash */ || slashCharCode === 92 /* backslash */; + } + return false; + } + function normalizeAndPreserveTrailingSlash(path) { + return ts.hasTrailingDirectorySeparator(path) ? ts.ensureTrailingDirectorySeparator(ts.normalizePath(path)) : ts.normalizePath(path); } - walk(sourceFile); - return elements; } - OutliningElementsCollector.collectElements = collectElements; - })(OutliningElementsCollector = ts.OutliningElementsCollector || (ts.OutliningElementsCollector = {})); + Completions.getCompletionsAtPosition = getCompletionsAtPosition; + function getCompletionEntryDetails(typeChecker, log, compilerOptions, sourceFile, position, entryName) { + // Compute all the completion symbols again. + var completionData = getCompletionData(typeChecker, log, sourceFile, position); + if (completionData) { + 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_3) === entryName ? s : undefined; }); + if (symbol) { + var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_3, location_3, 7 /* All */), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind, tags = _a.tags; + return { + name: entryName, + kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), + kind: symbolKind, + displayParts: displayParts, + documentation: documentation, + tags: tags + }; + } + } + // Didn't find a symbol with this name. See if we can find a keyword instead. + var keywordCompletion = ts.forEach(keywordCompletions, function (c) { return c.name === entryName; }); + if (keywordCompletion) { + return { + name: entryName, + kind: ts.ScriptElementKind.keyword, + kindModifiers: ts.ScriptElementKindModifier.none, + displayParts: [ts.displayPart(entryName, ts.SymbolDisplayPartKind.keyword)], + documentation: undefined, + tags: undefined + }; + } + return undefined; + } + Completions.getCompletionEntryDetails = getCompletionEntryDetails; + function getCompletionEntrySymbol(typeChecker, log, compilerOptions, sourceFile, position, entryName) { + // Compute all the completion symbols again. + var completionData = getCompletionData(typeChecker, log, sourceFile, position); + if (completionData) { + 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_4) === entryName ? s : undefined; }); + } + return undefined; + } + Completions.getCompletionEntrySymbol = getCompletionEntrySymbol; + function getCompletionData(typeChecker, log, sourceFile, position) { + var isJavaScriptFile = ts.isSourceFileJavaScript(sourceFile); + var isJsDocTagName = false; + var start = ts.timestamp(); + var currentToken = ts.getTokenAtPosition(sourceFile, position); + log("getCompletionData: Get current token: " + (ts.timestamp() - start)); + start = ts.timestamp(); + // Completion not allowed inside comments, bail out if this is the case + var insideComment = ts.isInsideComment(sourceFile, currentToken, position); + log("getCompletionData: Is inside comment: " + (ts.timestamp() - start)); + if (insideComment) { + // The current position is next to the '@' sign, when no tag name being provided yet. + // Provide a full list of tag names + if (ts.hasDocComment(sourceFile, position) && sourceFile.text.charCodeAt(position - 1) === 64 /* at */) { + isJsDocTagName = true; + } + // Completion should work inside certain JsDoc tags. For example: + // /** @type {number | string} */ + // Completion should work in the brackets + var insideJsDocTagExpression = false; + var tag = ts.getJsDocTagAtPosition(sourceFile, position); + if (tag) { + if (tag.tagName.pos <= position && position <= tag.tagName.end) { + isJsDocTagName = true; + } + switch (tag.kind) { + case 283 /* JSDocTypeTag */: + case 281 /* JSDocParameterTag */: + case 282 /* JSDocReturnTag */: + var tagWithExpression = tag; + if (tagWithExpression.typeExpression) { + insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end; + } + break; + } + } + if (isJsDocTagName) { + return { symbols: undefined, isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, location: undefined, isRightOfDot: false, isJsDocTagName: isJsDocTagName }; + } + if (!insideJsDocTagExpression) { + // Proceed if the current position is in jsDoc tag expression; otherwise it is a normal + // comment or the plain text part of a jsDoc comment, so no completion should be available + log("Returning an empty list because completion was inside a regular comment or plain text part of a JsDoc comment."); + return undefined; + } + } + start = ts.timestamp(); + var previousToken = ts.findPrecedingToken(position, sourceFile); + log("getCompletionData: Get previous token 1: " + (ts.timestamp() - start)); + // The decision to provide completion depends on the contextToken, which is determined through the previousToken. + // Note: 'previousToken' (and thus 'contextToken') can be undefined if we are the beginning of the file + var contextToken = previousToken; + // Check if the caret is at the end of an identifier; this is a partial identifier that we want to complete: e.g. a.toS| + // Skip this partial identifier and adjust the contextToken to the token that precedes it. + if (contextToken && position <= contextToken.end && ts.isWord(contextToken.kind)) { + var start_2 = ts.timestamp(); + contextToken = ts.findPrecedingToken(contextToken.getFullStart(), sourceFile); + log("getCompletionData: Get previous token 2: " + (ts.timestamp() - start_2)); + } + // Find the node where completion is requested on. + // Also determine whether we are trying to complete with members of that node + // or attributes of a JSX tag. + var node = currentToken; + var isRightOfDot = false; + var isRightOfOpenTag = false; + var isStartingCloseTag = false; + var location = ts.getTouchingPropertyName(sourceFile, position); + if (contextToken) { + // Bail out if this is a known invalid completion location + if (isCompletionListBlocker(contextToken)) { + log("Returning an empty list because completion was requested in an invalid position."); + return undefined; + } + var parent_15 = contextToken.parent, kind = contextToken.kind; + if (kind === 22 /* DotToken */) { + if (parent_15.kind === 177 /* PropertyAccessExpression */) { + node = contextToken.parent.expression; + isRightOfDot = true; + } + else if (parent_15.kind === 141 /* QualifiedName */) { + node = contextToken.parent.left; + isRightOfDot = true; + } + else { + // There is nothing that precedes the dot, so this likely just a stray character + // or leading into a '...' token. Just bail out instead. + return undefined; + } + } + else if (sourceFile.languageVariant === 1 /* JSX */) { + if (kind === 26 /* LessThanToken */) { + isRightOfOpenTag = true; + location = contextToken; + } + else if (kind === 40 /* SlashToken */ && contextToken.parent.kind === 249 /* JsxClosingElement */) { + isStartingCloseTag = true; + location = contextToken; + } + } + } + var semanticStart = ts.timestamp(); + var isGlobalCompletion = false; + var isMemberCompletion; + var isNewIdentifierLocation; + var symbols = []; + if (isRightOfDot) { + getTypeScriptMemberSymbols(); + } + else if (isRightOfOpenTag) { + var tagSymbols = typeChecker.getJsxIntrinsicTagNames(); + if (tryGetGlobalSymbols()) { + symbols = tagSymbols.concat(symbols.filter(function (s) { return !!(s.flags & (107455 /* Value */ | 8388608 /* Alias */)); })); + } + else { + symbols = tagSymbols; + } + isMemberCompletion = true; + isNewIdentifierLocation = false; + } + else if (isStartingCloseTag) { + var tagName = contextToken.parent.parent.openingElement.tagName; + var tagSymbol = typeChecker.getSymbolAtLocation(tagName); + if (!typeChecker.isUnknownSymbol(tagSymbol)) { + symbols = [tagSymbol]; + } + isMemberCompletion = true; + isNewIdentifierLocation = false; + } + else { + // For JavaScript or TypeScript, if we're not after a dot, then just try to get the + // global symbols in scope. These results should be valid for either language as + // the set of symbols that can be referenced from this location. + if (!tryGetGlobalSymbols()) { + return undefined; + } + } + log("getCompletionData: Semantic work: " + (ts.timestamp() - semanticStart)); + return { symbols: symbols, isGlobalCompletion: isGlobalCompletion, isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, location: location, isRightOfDot: (isRightOfDot || isRightOfOpenTag), isJsDocTagName: isJsDocTagName }; + function getTypeScriptMemberSymbols() { + // Right of dot member completion list + isGlobalCompletion = false; + isMemberCompletion = true; + isNewIdentifierLocation = false; + if (node.kind === 70 /* Identifier */ || node.kind === 141 /* QualifiedName */ || node.kind === 177 /* PropertyAccessExpression */) { + var symbol = typeChecker.getSymbolAtLocation(node); + // This is an alias, follow what it aliases + if (symbol && symbol.flags & 8388608 /* Alias */) { + symbol = typeChecker.getAliasedSymbol(symbol); + } + if (symbol && symbol.flags & 1952 /* HasExports */) { + // Extract module or enum members + var exportedSymbols = typeChecker.getExportsOfModule(symbol); + ts.forEach(exportedSymbols, function (symbol) { + if (typeChecker.isValidPropertyAccess((node.parent), symbol.name)) { + symbols.push(symbol); + } + }); + } + } + var type = typeChecker.getTypeAtLocation(node); + addTypeProperties(type); + } + function addTypeProperties(type) { + if (type) { + // Filter private properties + for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) { + var symbol = _a[_i]; + if (typeChecker.isValidPropertyAccess((node.parent), symbol.name)) { + symbols.push(symbol); + } + } + if (isJavaScriptFile && type.flags & 65536 /* Union */) { + // In javascript files, for union types, we don't just get the members that + // the individual types have in common, we also include all the members that + // each individual type has. This is because we're going to add all identifiers + // anyways. So we might as well elevate the members that were at least part + // of the individual types to a higher status since we know what they are. + var unionType = type; + for (var _b = 0, _c = unionType.types; _b < _c.length; _b++) { + var elementType = _c[_b]; + addTypeProperties(elementType); + } + } + } + } + function tryGetGlobalSymbols() { + var objectLikeContainer; + var namedImportsOrExports; + var jsxContainer; + if (objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken)) { + return tryGetObjectLikeCompletionSymbols(objectLikeContainer); + } + if (namedImportsOrExports = tryGetNamedImportsOrExportsForCompletion(contextToken)) { + // cursor is in an import clause + // try to show exported member for imported module + return tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports); + } + if (jsxContainer = tryGetContainingJsxElement(contextToken)) { + var attrsType = void 0; + if ((jsxContainer.kind === 247 /* JsxSelfClosingElement */) || (jsxContainer.kind === 248 /* JsxOpeningElement */)) { + // Cursor is inside a JSX self-closing element or opening element + attrsType = typeChecker.getJsxElementAttributesType(jsxContainer); + if (attrsType) { + symbols = filterJsxAttributes(typeChecker.getPropertiesOfType(attrsType), jsxContainer.attributes); + isMemberCompletion = true; + isNewIdentifierLocation = false; + return true; + } + } + } + // Get all entities in the current scope. + isMemberCompletion = false; + isNewIdentifierLocation = isNewIdentifierDefinitionLocation(contextToken); + if (previousToken !== contextToken) { + ts.Debug.assert(!!previousToken, "Expected 'contextToken' to be defined when different from 'previousToken'."); + } + // We need to find the node that will give us an appropriate scope to begin + // aggregating completion candidates. This is achieved in 'getScopeNode' + // by finding the first node that encompasses a position, accounting for whether a node + // is "complete" to decide whether a position belongs to the node. + // + // However, at the end of an identifier, we are interested in the scope of the identifier + // itself, but fall outside of the identifier. For instance: + // + // xyz => x$ + // + // the cursor is outside of both the 'x' and the arrow function 'xyz => x', + // so 'xyz' is not returned in our results. + // + // We define 'adjustedPosition' so that we may appropriately account for + // being at the end of an identifier. The intention is that if requesting completion + // at the end of an identifier, it should be effectively equivalent to requesting completion + // anywhere inside/at the beginning of the identifier. So in the previous case, the + // 'adjustedPosition' will work as if requesting completion in the following: + // + // xyz => $x + // + // If previousToken !== contextToken, then + // - 'contextToken' was adjusted to the token prior to 'previousToken' + // because we were at the end of an identifier. + // - 'previousToken' is defined. + var adjustedPosition = previousToken !== contextToken ? + previousToken.getStart() : + position; + var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile; + if (scopeNode) { + isGlobalCompletion = + scopeNode.kind === 261 /* SourceFile */ || + scopeNode.kind === 194 /* TemplateExpression */ || + scopeNode.kind === 252 /* JsxExpression */ || + ts.isStatement(scopeNode); + } + /// TODO filter meaning based on the current context + var symbolMeanings = 793064 /* Type */ | 107455 /* Value */ | 1920 /* Namespace */ | 8388608 /* Alias */; + symbols = typeChecker.getSymbolsInScope(scopeNode, symbolMeanings); + return true; + } + /** + * Finds the first node that "embraces" the position, so that one may + * accurately aggregate locals from the closest containing scope. + */ + function getScopeNode(initialToken, position, sourceFile) { + var scope = initialToken; + while (scope && !ts.positionBelongsToNode(scope, position, sourceFile)) { + scope = scope.parent; + } + return scope; + } + function isCompletionListBlocker(contextToken) { + var start = ts.timestamp(); + var result = isInStringOrRegularExpressionOrTemplateLiteral(contextToken) || + isSolelyIdentifierDefinitionLocation(contextToken) || + isDotOfNumericLiteral(contextToken) || + isInJsxText(contextToken); + log("getCompletionsAtPosition: isCompletionListBlocker: " + (ts.timestamp() - start)); + return result; + } + function isInJsxText(contextToken) { + if (contextToken.kind === 10 /* JsxText */) { + return true; + } + if (contextToken.kind === 28 /* GreaterThanToken */ && contextToken.parent) { + if (contextToken.parent.kind === 248 /* JsxOpeningElement */) { + return true; + } + if (contextToken.parent.kind === 249 /* JsxClosingElement */ || contextToken.parent.kind === 247 /* JsxSelfClosingElement */) { + return contextToken.parent.parent && contextToken.parent.parent.kind === 246 /* JsxElement */; + } + } + return false; + } + function isNewIdentifierDefinitionLocation(previousToken) { + if (previousToken) { + var containingNodeKind = previousToken.parent.kind; + switch (previousToken.kind) { + case 25 /* CommaToken */: + return containingNodeKind === 179 /* CallExpression */ // func( a, | + || containingNodeKind === 150 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ + || containingNodeKind === 180 /* NewExpression */ // new C(a, | + || containingNodeKind === 175 /* ArrayLiteralExpression */ // [a, | + || containingNodeKind === 192 /* BinaryExpression */ // const x = (a, | + || containingNodeKind === 158 /* FunctionType */; // var x: (s: string, list| + case 18 /* OpenParenToken */: + return containingNodeKind === 179 /* CallExpression */ // func( | + || containingNodeKind === 150 /* Constructor */ // constructor( | + || containingNodeKind === 180 /* NewExpression */ // new C(a| + || containingNodeKind === 183 /* ParenthesizedExpression */ // const x = (a| + || containingNodeKind === 166 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ + case 20 /* OpenBracketToken */: + return containingNodeKind === 175 /* ArrayLiteralExpression */ // [ | + || containingNodeKind === 155 /* IndexSignature */ // [ | : string ] + || containingNodeKind === 142 /* ComputedPropertyName */; // [ | /* this can become an index signature */ + case 127 /* ModuleKeyword */: // module | + case 128 /* NamespaceKeyword */: + return true; + case 22 /* DotToken */: + return containingNodeKind === 230 /* ModuleDeclaration */; // module A.| + case 16 /* OpenBraceToken */: + return containingNodeKind === 226 /* ClassDeclaration */; // class A{ | + case 57 /* EqualsToken */: + return containingNodeKind === 223 /* VariableDeclaration */ // const x = a| + || containingNodeKind === 192 /* BinaryExpression */; // x = a| + case 13 /* TemplateHead */: + return containingNodeKind === 194 /* TemplateExpression */; // `aa ${| + case 14 /* TemplateMiddle */: + return containingNodeKind === 202 /* TemplateSpan */; // `aa ${10} dd ${| + case 113 /* PublicKeyword */: + case 111 /* PrivateKeyword */: + case 112 /* ProtectedKeyword */: + return containingNodeKind === 147 /* PropertyDeclaration */; // class A{ public | + } + // Previous token may have been a keyword that was converted to an identifier. + switch (previousToken.getText()) { + case "public": + case "protected": + case "private": + return true; + } + } + return false; + } + function isInStringOrRegularExpressionOrTemplateLiteral(contextToken) { + if (contextToken.kind === 9 /* StringLiteral */ + || contextToken.kind === 11 /* RegularExpressionLiteral */ + || ts.isTemplateLiteralKind(contextToken.kind)) { + var start_3 = contextToken.getStart(); + var end = contextToken.getEnd(); + // To be "in" one of these literals, the position has to be: + // 1. entirely within the token text. + // 2. at the end position of an unterminated token. + // 3. at the end of a regular expression (due to trailing flags like '/foo/g'). + if (start_3 < position && position < end) { + return true; + } + if (position === end) { + return !!contextToken.isUnterminated + || contextToken.kind === 11 /* RegularExpressionLiteral */; + } + } + return false; + } + /** + * Aggregates relevant symbols for completion in object literals and object binding patterns. + * Relevant symbols are stored in the captured 'symbols' variable. + * + * @returns true if 'symbols' was successfully populated; false otherwise. + */ + function tryGetObjectLikeCompletionSymbols(objectLikeContainer) { + // We're looking up possible property names from contextual/inferred/declared type. + isMemberCompletion = true; + var typeForObject; + var existingMembers; + if (objectLikeContainer.kind === 176 /* ObjectLiteralExpression */) { + // We are completing on contextual types, but may also include properties + // other than those within the declared type. + isNewIdentifierLocation = true; + // If the object literal is being assigned to something of type 'null | { hello: string }', + // it clearly isn't trying to satisfy the 'null' type. So we grab the non-nullable type if possible. + typeForObject = typeChecker.getContextualType(objectLikeContainer); + typeForObject = typeForObject && typeForObject.getNonNullableType(); + existingMembers = objectLikeContainer.properties; + } + else if (objectLikeContainer.kind === 172 /* ObjectBindingPattern */) { + // We are *only* completing on properties from the type being destructured. + isNewIdentifierLocation = false; + var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); + if (ts.isVariableLike(rootDeclaration)) { + // We don't want to complete using the type acquired by the shape + // of the binding pattern; we are only interested in types acquired + // through type declaration or inference. + // Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed - + // type of parameter will flow in from the contextual type of the function + var canGetType = !!(rootDeclaration.initializer || rootDeclaration.type); + if (!canGetType && rootDeclaration.kind === 144 /* Parameter */) { + if (ts.isExpression(rootDeclaration.parent)) { + canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); + } + else if (rootDeclaration.parent.kind === 149 /* MethodDeclaration */ || rootDeclaration.parent.kind === 152 /* SetAccessor */) { + canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent); + } + } + if (canGetType) { + typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer); + existingMembers = objectLikeContainer.elements; + } + } + else { + ts.Debug.fail("Root declaration is not variable-like."); + } + } + else { + ts.Debug.fail("Expected object literal or binding pattern, got " + objectLikeContainer.kind); + } + if (!typeForObject) { + return false; + } + var typeMembers = typeChecker.getPropertiesOfType(typeForObject); + if (typeMembers && typeMembers.length > 0) { + // Add filtered items to the completion list + symbols = filterObjectMembersList(typeMembers, existingMembers); + } + return true; + } + /** + * Aggregates relevant symbols for completion in import clauses and export clauses + * whose declarations have a module specifier; for instance, symbols will be aggregated for + * + * import { | } from "moduleName"; + * export { a as foo, | } from "moduleName"; + * + * but not for + * + * export { | }; + * + * Relevant symbols are stored in the captured 'symbols' variable. + * + * @returns true if 'symbols' was successfully populated; false otherwise. + */ + function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) { + var declarationKind = namedImportsOrExports.kind === 238 /* NamedImports */ ? + 235 /* ImportDeclaration */ : + 241 /* ExportDeclaration */; + var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind); + var moduleSpecifier = importOrExportDeclaration.moduleSpecifier; + if (!moduleSpecifier) { + return false; + } + isMemberCompletion = true; + isNewIdentifierLocation = false; + var exports; + var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(importOrExportDeclaration.moduleSpecifier); + if (moduleSpecifierSymbol) { + exports = typeChecker.getExportsOfModule(moduleSpecifierSymbol); + } + symbols = exports ? filterNamedImportOrExportCompletionItems(exports, namedImportsOrExports.elements) : ts.emptyArray; + return true; + } + /** + * Returns the immediate owning object literal or binding pattern of a context token, + * on the condition that one exists and that the context implies completion should be given. + */ + function tryGetObjectLikeCompletionContainer(contextToken) { + if (contextToken) { + 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; + } + break; + } + } + return undefined; + } + /** + * Returns the containing list of named imports or exports of a context token, + * on the condition that one exists and that the context implies completion should be given. + */ + function tryGetNamedImportsOrExportsForCompletion(contextToken) { + if (contextToken) { + switch (contextToken.kind) { + case 16 /* OpenBraceToken */: // import { | + case 25 /* CommaToken */: + switch (contextToken.parent.kind) { + case 238 /* NamedImports */: + case 242 /* NamedExports */: + return contextToken.parent; + } + } + } + return undefined; + } + function tryGetContainingJsxElement(contextToken) { + if (contextToken) { + var parent_17 = 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; + } + else if (parent_17.kind === 250 /* JsxAttribute */) { + return parent_17.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; + } + 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_17 && parent_17.kind === 251 /* JsxSpreadAttribute */) { + return parent_17.parent; + } + break; + } + } + return undefined; + } + function isFunction(kind) { + switch (kind) { + case 184 /* FunctionExpression */: + case 185 /* ArrowFunction */: + case 225 /* FunctionDeclaration */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + case 153 /* CallSignature */: + case 154 /* ConstructSignature */: + case 155 /* IndexSignature */: + return true; + } + return false; + } + /** + * @returns true if we are certain that the currently edited location must define a new location; false otherwise. + */ + function isSolelyIdentifierDefinitionLocation(contextToken) { + var containingNodeKind = contextToken.parent.kind; + switch (contextToken.kind) { + case 25 /* CommaToken */: + return containingNodeKind === 223 /* VariableDeclaration */ || + containingNodeKind === 224 /* VariableDeclarationList */ || + containingNodeKind === 205 /* VariableStatement */ || + containingNodeKind === 229 /* EnumDeclaration */ || + isFunction(containingNodeKind) || + containingNodeKind === 226 /* ClassDeclaration */ || + containingNodeKind === 197 /* ClassExpression */ || + containingNodeKind === 227 /* InterfaceDeclaration */ || + containingNodeKind === 173 /* ArrayBindingPattern */ || + containingNodeKind === 228 /* TypeAliasDeclaration */; // type Map, K, | + case 22 /* DotToken */: + return containingNodeKind === 173 /* ArrayBindingPattern */; // var [.| + case 55 /* ColonToken */: + return containingNodeKind === 174 /* BindingElement */; // var {x :html| + case 20 /* OpenBracketToken */: + return containingNodeKind === 173 /* ArrayBindingPattern */; // var [x| + case 18 /* OpenParenToken */: + return containingNodeKind === 256 /* CatchClause */ || + isFunction(containingNodeKind); + case 16 /* OpenBraceToken */: + return containingNodeKind === 229 /* EnumDeclaration */ || + containingNodeKind === 227 /* InterfaceDeclaration */ || + containingNodeKind === 161 /* TypeLiteral */; // const x : { | + case 24 /* SemicolonToken */: + return containingNodeKind === 146 /* PropertySignature */ && + contextToken.parent && contextToken.parent.parent && + (contextToken.parent.parent.kind === 227 /* InterfaceDeclaration */ || + contextToken.parent.parent.kind === 161 /* TypeLiteral */); // const x : { a; | + case 26 /* LessThanToken */: + return containingNodeKind === 226 /* ClassDeclaration */ || + containingNodeKind === 197 /* ClassExpression */ || + containingNodeKind === 227 /* InterfaceDeclaration */ || + containingNodeKind === 228 /* TypeAliasDeclaration */ || + isFunction(containingNodeKind); + case 114 /* StaticKeyword */: + return containingNodeKind === 147 /* PropertyDeclaration */; + case 23 /* DotDotDotToken */: + return containingNodeKind === 144 /* Parameter */ || + (contextToken.parent && contextToken.parent.parent && + contextToken.parent.parent.kind === 173 /* ArrayBindingPattern */); // var [...z| + case 113 /* PublicKeyword */: + case 111 /* PrivateKeyword */: + case 112 /* ProtectedKeyword */: + return containingNodeKind === 144 /* Parameter */; + case 117 /* AsKeyword */: + return containingNodeKind === 239 /* ImportSpecifier */ || + containingNodeKind === 243 /* ExportSpecifier */ || + containingNodeKind === 237 /* NamespaceImport */; + case 74 /* ClassKeyword */: + case 82 /* EnumKeyword */: + case 108 /* InterfaceKeyword */: + case 88 /* FunctionKeyword */: + case 103 /* VarKeyword */: + case 124 /* GetKeyword */: + case 133 /* SetKeyword */: + case 90 /* ImportKeyword */: + case 109 /* LetKeyword */: + case 75 /* ConstKeyword */: + case 115 /* YieldKeyword */: + case 136 /* TypeKeyword */: + return true; + } + // Previous token may have been a keyword that was converted to an identifier. + switch (contextToken.getText()) { + case "abstract": + case "async": + case "class": + case "const": + case "declare": + case "enum": + case "function": + case "interface": + case "let": + case "private": + case "protected": + case "public": + case "static": + case "var": + case "yield": + return true; + } + return false; + } + function isDotOfNumericLiteral(contextToken) { + if (contextToken.kind === 8 /* NumericLiteral */) { + var text = contextToken.getFullText(); + return text.charAt(text.length - 1) === "."; + } + return false; + } + /** + * Filters out completion suggestions for named imports or exports. + * + * @param exportsOfModule The list of symbols which a module exposes. + * @param namedImportsOrExports The list of existing import/export specifiers in the import/export clause. + * + * @returns Symbols to be suggested at an import/export clause, barring those whose named imports/exports + * do not occur at the current position and have not otherwise been typed. + */ + function filterNamedImportOrExportCompletionItems(exportsOfModule, namedImportsOrExports) { + var existingImportsOrExports = ts.createMap(); + for (var _i = 0, namedImportsOrExports_1 = namedImportsOrExports; _i < namedImportsOrExports_1.length; _i++) { + var element = namedImportsOrExports_1[_i]; + // If this is the current item we are editing right now, do not filter it out + if (element.getStart() <= position && position <= element.getEnd()) { + continue; + } + var name_46 = element.propertyName || element.name; + existingImportsOrExports[name_46.text] = true; + } + if (!ts.someProperties(existingImportsOrExports)) { + return ts.filter(exportsOfModule, function (e) { return e.name !== "default"; }); + } + return ts.filter(exportsOfModule, function (e) { return e.name !== "default" && !existingImportsOrExports[e.name]; }); + } + /** + * Filters out completion suggestions for named imports or exports. + * + * @returns Symbols to be suggested in an object binding pattern or object literal expression, barring those whose declarations + * do not occur at the current position and have not otherwise been typed. + */ + function filterObjectMembersList(contextualMemberSymbols, existingMembers) { + if (!existingMembers || existingMembers.length === 0) { + return contextualMemberSymbols; + } + var existingMemberNames = ts.createMap(); + for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { + var m = existingMembers_1[_i]; + // Ignore omitted expressions for missing members + if (m.kind !== 257 /* PropertyAssignment */ && + m.kind !== 258 /* ShorthandPropertyAssignment */ && + m.kind !== 174 /* BindingElement */ && + m.kind !== 149 /* MethodDeclaration */ && + m.kind !== 151 /* GetAccessor */ && + m.kind !== 152 /* SetAccessor */) { + continue; + } + // If this is the current item we are editing right now, do not filter it out + if (m.getStart() <= position && position <= m.getEnd()) { + continue; + } + var existingName = void 0; + if (m.kind === 174 /* BindingElement */ && m.propertyName) { + // include only identifiers in completion list + if (m.propertyName.kind === 70 /* Identifier */) { + existingName = m.propertyName.text; + } + } + else { + // TODO(jfreeman): Account for computed property name + // NOTE: if one only performs this step when m.name is an identifier, + // things like '__proto__' are not filtered out. + existingName = m.name.text; + } + existingMemberNames[existingName] = true; + } + return ts.filter(contextualMemberSymbols, function (m) { return !existingMemberNames[m.name]; }); + } + /** + * Filters out completion suggestions from 'symbols' according to existing JSX attributes. + * + * @returns Symbols to be suggested in a JSX element, barring those whose attributes + * do not occur at the current position and have not otherwise been typed. + */ + function filterJsxAttributes(symbols, attributes) { + var seenNames = ts.createMap(); + for (var _i = 0, attributes_1 = attributes; _i < attributes_1.length; _i++) { + var attr = attributes_1[_i]; + // If this is the current item we are editing right now, do not filter it out + if (attr.getStart() <= position && position <= attr.getEnd()) { + continue; + } + if (attr.kind === 250 /* JsxAttribute */) { + seenNames[attr.name.text] = true; + } + } + return ts.filter(symbols, function (a) { return !seenNames[a.name]; }); + } + } + /** + * Get the name to be display in completion from a given symbol. + * + * @return undefined if the name is of external module otherwise a name with striped of any quote + */ + function getCompletionEntryDisplayNameForSymbol(typeChecker, symbol, target, performCharacterChecks, location) { + var displayName = ts.getDeclaredName(typeChecker, symbol, location); + if (displayName) { + var firstCharCode = displayName.charCodeAt(0); + // First check of the displayName is not external module; if it is an external module, it is not valid entry + if ((symbol.flags & 1920 /* Namespace */) && (firstCharCode === 39 /* singleQuote */ || firstCharCode === 34 /* doubleQuote */)) { + // If the symbol is external module, don't show it in the completion list + // (i.e declare module "http" { const x; } | // <= request completion here, "http" should not be there) + return undefined; + } + } + return getCompletionEntryDisplayName(displayName, target, performCharacterChecks); + } + /** + * Get a displayName from a given for completion list, performing any necessary quotes stripping + * and checking whether the name is valid identifier name. + */ + function getCompletionEntryDisplayName(name, target, performCharacterChecks) { + if (!name) { + return undefined; + } + name = ts.stripQuotes(name); + if (!name) { + return undefined; + } + // If the user entered name for the symbol was quoted, removing the quotes is not enough, as the name could be an + // invalid identifier name. We need to check if whatever was inside the quotes is actually a valid identifier name. + // e.g "b a" is valid quoted name but when we strip off the quotes, it is invalid. + // We, thus, need to check if whatever was inside the quotes is actually a valid identifier name. + if (performCharacterChecks) { + if (!ts.isIdentifierText(name, target)) { + return undefined; + } + } + return name; + } + // A cache of completion entries for keywords, these do not change between sessions + var keywordCompletions = []; + for (var i = 71 /* FirstKeyword */; i <= 140 /* LastKeyword */; i++) { + keywordCompletions.push({ + name: ts.tokenToString(i), + kind: ts.ScriptElementKind.keyword, + kindModifiers: ts.ScriptElementKindModifier.none, + sortText: "0" + }); + } + /** + * Matches a triple slash reference directive with an incomplete string literal for its path. Used + * to determine if the caret is currently within the string literal and capture the literal fragment + * for completions. + * For example, this matches + * + * /// = 0; i--) { + if (pushKeywordIf(keywords, loopTokens[i], 105 /* WhileKeyword */)) { + break; + } + } + } + } + var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); + ts.forEach(breaksAndContinues, function (statement) { + if (ownsBreakOrContinueStatement(loopNode, statement)) { + pushKeywordIf(keywords, statement.getFirstToken(), 71 /* BreakKeyword */, 76 /* ContinueKeyword */); + } + }); + return ts.map(keywords, getHighlightSpanForNode); + } + function getBreakOrContinueStatementOccurrences(breakOrContinueStatement) { + var owner = getBreakOrContinueOwner(breakOrContinueStatement); + if (owner) { + switch (owner.kind) { + case 211 /* ForStatement */: + case 212 /* ForInStatement */: + case 213 /* ForOfStatement */: + case 209 /* DoStatement */: + case 210 /* WhileStatement */: + return getLoopBreakContinueOccurrences(owner); + case 218 /* SwitchStatement */: + return getSwitchCaseDefaultOccurrences(owner); + } + } + return undefined; + } + function getSwitchCaseDefaultOccurrences(switchStatement) { + var keywords = []; + pushKeywordIf(keywords, switchStatement.getFirstToken(), 97 /* SwitchKeyword */); + // Go through each clause in the switch statement, collecting the 'case'/'default' keywords. + ts.forEach(switchStatement.caseBlock.clauses, function (clause) { + pushKeywordIf(keywords, clause.getFirstToken(), 72 /* CaseKeyword */, 78 /* DefaultKeyword */); + var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); + ts.forEach(breaksAndContinues, function (statement) { + if (ownsBreakOrContinueStatement(switchStatement, statement)) { + pushKeywordIf(keywords, statement.getFirstToken(), 71 /* BreakKeyword */); + } + }); + }); + return ts.map(keywords, getHighlightSpanForNode); + } + function getTryCatchFinallyOccurrences(tryStatement) { + var keywords = []; + pushKeywordIf(keywords, tryStatement.getFirstToken(), 101 /* TryKeyword */); + if (tryStatement.catchClause) { + pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 73 /* CatchKeyword */); + } + if (tryStatement.finallyBlock) { + var finallyKeyword = ts.findChildOfKind(tryStatement, 86 /* FinallyKeyword */, sourceFile); + pushKeywordIf(keywords, finallyKeyword, 86 /* FinallyKeyword */); + } + return ts.map(keywords, getHighlightSpanForNode); + } + function getThrowOccurrences(throwStatement) { + var owner = getThrowStatementOwner(throwStatement); + if (!owner) { + return undefined; + } + var keywords = []; + ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { + pushKeywordIf(keywords, throwStatement.getFirstToken(), 99 /* ThrowKeyword */); + }); + // If the "owner" is a function, then we equate 'return' and 'throw' statements in their + // ability to "jump out" of the function, and include occurrences for both. + if (ts.isFunctionBlock(owner)) { + ts.forEachReturnStatement(owner, function (returnStatement) { + pushKeywordIf(keywords, returnStatement.getFirstToken(), 95 /* ReturnKeyword */); + }); + } + return ts.map(keywords, getHighlightSpanForNode); + } + function getReturnOccurrences(returnStatement) { + var func = ts.getContainingFunction(returnStatement); + // If we didn't find a containing function with a block body, bail out. + if (!(func && hasKind(func.body, 204 /* Block */))) { + return undefined; + } + var keywords = []; + ts.forEachReturnStatement(func.body, function (returnStatement) { + pushKeywordIf(keywords, returnStatement.getFirstToken(), 95 /* ReturnKeyword */); + }); + // Include 'throw' statements that do not occur within a try block. + ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) { + pushKeywordIf(keywords, throwStatement.getFirstToken(), 99 /* ThrowKeyword */); + }); + return ts.map(keywords, getHighlightSpanForNode); + } + function getIfElseOccurrences(ifStatement) { + var keywords = []; + // Traverse upwards through all parent if-statements linked by their else-branches. + while (hasKind(ifStatement.parent, 208 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { + ifStatement = ifStatement.parent; + } + // Now traverse back down through the else branches, aggregating if/else keywords of if-statements. + while (ifStatement) { + var children = ifStatement.getChildren(); + pushKeywordIf(keywords, children[0], 89 /* IfKeyword */); + // Generally the 'else' keyword is second-to-last, so we traverse backwards. + for (var i = children.length - 1; i >= 0; i--) { + if (pushKeywordIf(keywords, children[i], 81 /* ElseKeyword */)) { + break; + } + } + if (!hasKind(ifStatement.elseStatement, 208 /* IfStatement */)) { + break; + } + ifStatement = ifStatement.elseStatement; + } + var result = []; + // We'd like to highlight else/ifs together if they are only separated by whitespace + // (i.e. the keywords are separated by no comments, no newlines). + for (var i = 0; i < keywords.length; i++) { + if (keywords[i].kind === 81 /* ElseKeyword */ && i < keywords.length - 1) { + var elseKeyword = keywords[i]; + var ifKeyword = keywords[i + 1]; // this *should* always be an 'if' keyword. + var shouldCombindElseAndIf = true; + // Avoid recalculating getStart() by iterating backwards. + for (var j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) { + if (!ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(j))) { + shouldCombindElseAndIf = false; + break; + } + } + if (shouldCombindElseAndIf) { + result.push({ + fileName: fileName, + textSpan: ts.createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end), + kind: ts.HighlightSpanKind.reference + }); + i++; // skip the next keyword + continue; + } + } + // Ordinary case: just highlight the keyword. + result.push(getHighlightSpanForNode(keywords[i])); + } + return result; + } + } + } + DocumentHighlights.getDocumentHighlights = getDocumentHighlights; + /** + * Whether or not a 'node' is preceded by a label of the given string. + * Note: 'node' cannot be a SourceFile. + */ + function isLabeledBy(node, labelName) { + for (var owner = node.parent; owner.kind === 219 /* LabeledStatement */; owner = owner.parent) { + if (owner.label.text === labelName) { + return true; + } + } + return false; + } + })(DocumentHighlights = ts.DocumentHighlights || (ts.DocumentHighlights = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + function createDocumentRegistry(useCaseSensitiveFileNames, currentDirectory) { + if (currentDirectory === void 0) { currentDirectory = ""; } + // Maps from compiler setting target (ES3, ES5, etc.) to all the cached documents we have + // for those settings. + var buckets = ts.createMap(); + var getCanonicalFileName = ts.createGetCanonicalFileName(!!useCaseSensitiveFileNames); + function getKeyForCompilationSettings(settings) { + return "_" + settings.target + "|" + settings.module + "|" + settings.noResolve + "|" + settings.jsx + "|" + settings.allowJs + "|" + settings.baseUrl + "|" + JSON.stringify(settings.typeRoots) + "|" + JSON.stringify(settings.rootDirs) + "|" + JSON.stringify(settings.paths); + } + function getBucketForCompilationSettings(key, createIfMissing) { + var bucket = buckets[key]; + if (!bucket && createIfMissing) { + buckets[key] = bucket = ts.createFileMap(); + } + return bucket; + } + function reportStats() { + var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === "_"; }).map(function (name) { + var entries = buckets[name]; + var sourceFiles = []; + entries.forEachValue(function (key, entry) { + sourceFiles.push({ + name: key, + refCount: entry.languageServiceRefCount, + references: entry.owners.slice(0) + }); + }); + sourceFiles.sort(function (x, y) { return y.refCount - x.refCount; }); + return { + bucket: name, + sourceFiles: sourceFiles + }; + }); + return JSON.stringify(bucketInfoArray, undefined, 2); + } + function acquireDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) { + var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); + var key = getKeyForCompilationSettings(compilationSettings); + return acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind); + } + function acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) { + return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, /*acquiring*/ true, scriptKind); + } + function updateDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) { + var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); + var key = getKeyForCompilationSettings(compilationSettings); + return updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind); + } + function updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) { + return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, /*acquiring*/ false, scriptKind); + } + function acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, acquiring, scriptKind) { + var bucket = getBucketForCompilationSettings(key, /*createIfMissing*/ true); + var entry = bucket.get(path); + if (!entry) { + ts.Debug.assert(acquiring, "How could we be trying to update a document that the registry doesn't have?"); + // Have never seen this file with these settings. Create a new source file for it. + var sourceFile = ts.createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, /*setNodeParents*/ false, scriptKind); + entry = { + sourceFile: sourceFile, + languageServiceRefCount: 0, + owners: [] + }; + bucket.set(path, entry); + } + else { + // We have an entry for this file. However, it may be for a different version of + // the script snapshot. If so, update it appropriately. Otherwise, we can just + // return it as is. + if (entry.sourceFile.version !== version) { + entry.sourceFile = ts.updateLanguageServiceSourceFile(entry.sourceFile, scriptSnapshot, version, scriptSnapshot.getChangeRange(entry.sourceFile.scriptSnapshot)); + } + } + // If we're acquiring, then this is the first time this LS is asking for this document. + // Increase our ref count so we know there's another LS using the document. If we're + // not acquiring, then that means the LS is 'updating' the file instead, and that means + // it has already acquired the document previously. As such, we do not need to increase + // the ref count. + if (acquiring) { + entry.languageServiceRefCount++; + } + return entry.sourceFile; + } + function releaseDocument(fileName, compilationSettings) { + var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); + var key = getKeyForCompilationSettings(compilationSettings); + return releaseDocumentWithKey(path, key); + } + function releaseDocumentWithKey(path, key) { + var bucket = getBucketForCompilationSettings(key, /*createIfMissing*/ false); + ts.Debug.assert(bucket !== undefined); + var entry = bucket.get(path); + entry.languageServiceRefCount--; + ts.Debug.assert(entry.languageServiceRefCount >= 0); + if (entry.languageServiceRefCount === 0) { + bucket.remove(path); + } + } + return { + acquireDocument: acquireDocument, + acquireDocumentWithKey: acquireDocumentWithKey, + updateDocument: updateDocument, + updateDocumentWithKey: updateDocumentWithKey, + releaseDocument: releaseDocument, + releaseDocumentWithKey: releaseDocumentWithKey, + reportStats: reportStats, + getKeyForCompilationSettings: getKeyForCompilationSettings + }; + } + ts.createDocumentRegistry = createDocumentRegistry; +})(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var FindAllReferences; + (function (FindAllReferences) { + function findReferencedSymbols(typeChecker, cancellationToken, sourceFiles, sourceFile, position, findInStrings, findInComments) { + var node = ts.getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true); + if (node === sourceFile) { + return undefined; + } + switch (node.kind) { + case 8 /* NumericLiteral */: + if (!ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { + break; + } + // Fallthrough + case 70 /* Identifier */: + case 98 /* ThisKeyword */: + // case SyntaxKind.SuperKeyword: TODO:GH#9268 + case 122 /* ConstructorKeyword */: + case 9 /* StringLiteral */: + return getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, /*implementations*/ false); + } + return undefined; + } + FindAllReferences.findReferencedSymbols = findReferencedSymbols; + function getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, findInStrings, findInComments, implementations) { + if (!implementations) { + // Labels + if (ts.isLabelName(node)) { + if (ts.isJumpStatementTarget(node)) { + var labelDefinition = ts.getTargetLabel(node.parent, node.text); + // if we have a label definition, look within its statement for references, if not, then + // the label is undefined and we have no results.. + return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : undefined; + } + else { + // it is a label definition and not a target, search within the parent labeledStatement + return getLabelReferencesInNode(node.parent, node); + } + } + if (ts.isThis(node)) { + return getReferencesForThisKeyword(node, sourceFiles); + } + if (node.kind === 96 /* SuperKeyword */) { + return getReferencesForSuperKeyword(node); + } + } + // `getSymbolAtLocation` normally returns the symbol of the class when given the constructor keyword, + // so we have to specify that we want the constructor symbol. + var symbol = typeChecker.getSymbolAtLocation(node); + if (!implementations && !symbol && node.kind === 9 /* StringLiteral */) { + return getReferencesForStringLiteral(node, sourceFiles); + } + // Could not find a symbol e.g. unknown identifier + if (!symbol) { + // Can't have references to something that we have no symbol for. + return undefined; + } + var declarations = symbol.declarations; + // The symbol was an internal symbol and does not have a declaration e.g. undefined symbol + if (!declarations || !declarations.length) { + return undefined; + } + var result; + // Compute the meaning from the location and the symbol it references + var searchMeaning = getIntersectingMeaningFromDeclarations(ts.getMeaningFromLocation(node), declarations); + // Get the text to search for. + // Note: if this is an external module symbol, the name doesn't include quotes. + var declaredName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); + // Try to get the smallest valid scope that we can limit our search to; + // otherwise we'll need to search globally (i.e. include each file). + var scope = getSymbolScope(symbol); + // Maps from a symbol ID to the ReferencedSymbol entry in 'result'. + var symbolToIndex = []; + if (scope) { + result = []; + getReferencesInNode(scope, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex); + } + else { + var internedName = getInternedName(symbol, node); + for (var _i = 0, sourceFiles_8 = sourceFiles; _i < sourceFiles_8.length; _i++) { + var sourceFile = sourceFiles_8[_i]; + cancellationToken.throwIfCancellationRequested(); + var nameTable = ts.getNameTable(sourceFile); + if (nameTable[internedName] !== undefined) { + result = result || []; + getReferencesInNode(sourceFile, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex); + } + } + } + return result; + function getDefinition(symbol) { + var info = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, node.getSourceFile(), ts.getContainerNode(node), node); + var name = ts.map(info.displayParts, function (p) { return p.text; }).join(""); + var declarations = symbol.declarations; + if (!declarations || declarations.length === 0) { + return undefined; + } + return { + containerKind: "", + containerName: "", + name: name, + kind: info.symbolKind, + fileName: declarations[0].getSourceFile().fileName, + textSpan: ts.createTextSpan(declarations[0].getStart(), 0), + displayParts: info.displayParts + }; + } + function getAliasSymbolForPropertyNameSymbol(symbol, location) { + if (symbol.flags & 8388608 /* Alias */) { + // Default import get alias + var defaultImport = ts.getDeclarationOfKind(symbol, 236 /* ImportClause */); + if (defaultImport) { + return typeChecker.getAliasedSymbol(symbol); + } + var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 239 /* ImportSpecifier */ || + declaration.kind === 243 /* ExportSpecifier */) ? declaration : undefined; }); + if (importOrExportSpecifier && + // export { a } + (!importOrExportSpecifier.propertyName || + // export {a as class } where a is location + importOrExportSpecifier.propertyName === location)) { + // If Import specifier -> get alias + // else Export specifier -> get local target + return importOrExportSpecifier.kind === 239 /* ImportSpecifier */ ? + typeChecker.getAliasedSymbol(symbol) : + typeChecker.getExportSpecifierLocalTargetSymbol(importOrExportSpecifier); + } + } + return undefined; + } + function followAliasIfNecessary(symbol, location) { + return getAliasSymbolForPropertyNameSymbol(symbol, location) || symbol; + } + function getPropertySymbolOfDestructuringAssignment(location) { + return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(location.parent.parent) && + typeChecker.getPropertySymbolOfDestructuringAssignment(location); + } + function isObjectBindingPatternElementWithoutPropertyName(symbol) { + var bindingElement = ts.getDeclarationOfKind(symbol, 174 /* BindingElement */); + return bindingElement && + bindingElement.parent.kind === 172 /* ObjectBindingPattern */ && + !bindingElement.propertyName; + } + function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol) { + if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { + var bindingElement = ts.getDeclarationOfKind(symbol, 174 /* BindingElement */); + var typeOfPattern = typeChecker.getTypeAtLocation(bindingElement.parent); + return typeOfPattern && typeChecker.getPropertyOfType(typeOfPattern, bindingElement.name.text); + } + return undefined; + } + function getInternedName(symbol, location) { + // If this is an export or import specifier it could have been renamed using the 'as' syntax. + // If so we want to search for whatever under the cursor. + if (ts.isImportOrExportSpecifierName(location)) { + return location.getText(); + } + // Try to get the local symbol if we're dealing with an 'export default' + // since that symbol has the "true" name. + var localExportDefaultSymbol = ts.getLocalSymbolForExportDefault(symbol); + symbol = localExportDefaultSymbol || symbol; + return ts.stripQuotes(symbol.name); + } + /** + * Determines the smallest scope in which a symbol may have named references. + * Note that not every construct has been accounted for. This function can + * probably be improved. + * + * @returns undefined if the scope cannot be determined, implying that + * a reference to a symbol can occur anywhere. + */ + function getSymbolScope(symbol) { + // If this is the symbol of a named function expression or named class expression, + // then named references are limited to its own scope. + var valueDeclaration = symbol.valueDeclaration; + if (valueDeclaration && (valueDeclaration.kind === 184 /* FunctionExpression */ || valueDeclaration.kind === 197 /* ClassExpression */)) { + return valueDeclaration; + } + // If this is private property or method, the scope is the containing class + if (symbol.flags & (4 /* Property */ | 8192 /* Method */)) { + var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (ts.getModifierFlags(d) & 8 /* Private */) ? d : undefined; }); + if (privateDeclaration) { + return ts.getAncestor(privateDeclaration, 226 /* ClassDeclaration */); + } + } + // If the symbol is an import we would like to find it if we are looking for what it imports. + // So consider it visible outside its declaration scope. + if (symbol.flags & 8388608 /* Alias */) { + return undefined; + } + // If symbol is of object binding pattern element without property name we would want to + // look for property too and that could be anywhere + if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { + return undefined; + } + // if this symbol is visible from its parent container, e.g. exported, then bail out + // if symbol correspond to the union property - bail out + if (symbol.parent || (symbol.flags & 268435456 /* SyntheticProperty */)) { + return undefined; + } + var scope; + var declarations = symbol.getDeclarations(); + if (declarations) { + for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { + var declaration = declarations_7[_i]; + var container = ts.getContainerNode(declaration); + if (!container) { + return undefined; + } + if (scope && scope !== container) { + // Different declarations have different containers, bail out + return undefined; + } + if (container.kind === 261 /* SourceFile */ && !ts.isExternalModule(container)) { + // This is a global variable and not an external module, any declaration defined + // within this scope is visible outside the file + return undefined; + } + // The search scope is the container node + scope = container; + } + } + return scope; + } + function getPossibleSymbolReferencePositions(sourceFile, symbolName, start, end) { + var positions = []; + /// TODO: Cache symbol existence for files to save text search + // Also, need to make this work for unicode escapes. + // Be resilient in the face of a symbol with no name or zero length name + if (!symbolName || !symbolName.length) { + return positions; + } + var text = sourceFile.text; + var sourceLength = text.length; + var symbolNameLength = symbolName.length; + var position = text.indexOf(symbolName, start); + while (position >= 0) { + cancellationToken.throwIfCancellationRequested(); + // If we are past the end, stop looking + if (position > end) + break; + // We found a match. Make sure it's not part of a larger word (i.e. the char + // before and after it have to be a non-identifier char). + var endPosition = position + symbolNameLength; + if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 5 /* Latest */)) && + (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 5 /* Latest */))) { + // Found a real match. Keep searching. + positions.push(position); + } + position = text.indexOf(symbolName, position + symbolNameLength + 1); + } + return positions; + } + function getLabelReferencesInNode(container, targetLabel) { + var references = []; + var sourceFile = container.getSourceFile(); + var labelName = targetLabel.text; + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container.getStart(), container.getEnd()); + ts.forEach(possiblePositions, function (position) { + cancellationToken.throwIfCancellationRequested(); + var node = ts.getTouchingWord(sourceFile, position); + if (!node || node.getWidth() !== labelName.length) { + return; + } + // Only pick labels that are either the target label, or have a target that is the target label + if (node === targetLabel || + (ts.isJumpStatementTarget(node) && ts.getTargetLabel(node, labelName) === targetLabel)) { + references.push(getReferenceEntryFromNode(node)); + } + }); + var definition = { + containerKind: "", + containerName: "", + fileName: targetLabel.getSourceFile().fileName, + kind: ts.ScriptElementKind.label, + name: labelName, + textSpan: ts.createTextSpanFromBounds(targetLabel.getStart(), targetLabel.getEnd()), + displayParts: [ts.displayPart(labelName, ts.SymbolDisplayPartKind.text)] + }; + return [{ definition: definition, references: references }]; + } + function isValidReferencePosition(node, searchSymbolName) { + if (node) { + // Compare the length so we filter out strict superstrings of the symbol we are looking for + switch (node.kind) { + case 70 /* Identifier */: + return node.getWidth() === searchSymbolName.length; + case 9 /* StringLiteral */: + if (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || + isNameOfExternalModuleImportOrDeclaration(node)) { + // For string literals we have two additional chars for the quotes + return node.getWidth() === searchSymbolName.length + 2; + } + break; + case 8 /* NumericLiteral */: + if (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { + return node.getWidth() === searchSymbolName.length; + } + break; + } + } + return false; + } + /** Search within node "container" for references for a search value, where the search value is defined as a + * tuple of(searchSymbol, searchText, searchLocation, and searchMeaning). + * searchLocation: a node where the search value + */ + function getReferencesInNode(container, searchSymbol, searchText, searchLocation, searchMeaning, findInStrings, findInComments, result, symbolToIndex) { + var sourceFile = container.getSourceFile(); + var start = findInComments ? container.getFullStart() : container.getStart(); + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, start, container.getEnd()); + var parents = getParentSymbolsOfPropertyAccess(); + var inheritsFromCache = ts.createMap(); + if (possiblePositions.length) { + // Build the set of symbols to search for, initially it has only the current symbol + var searchSymbols_1 = populateSearchSymbolSet(searchSymbol, searchLocation); + ts.forEach(possiblePositions, function (position) { + cancellationToken.throwIfCancellationRequested(); + var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); + if (!isValidReferencePosition(referenceLocation, searchText)) { + // This wasn't the start of a token. Check to see if it might be a + // match in a comment or string if that's what the caller is asking + // for. + if (!implementations && ((findInStrings && ts.isInString(sourceFile, position)) || + (findInComments && ts.isInNonReferenceComment(sourceFile, position)))) { + // In the case where we're looking inside comments/strings, we don't have + // an actual definition. So just use 'undefined' here. Features like + // 'Rename' won't care (as they ignore the definitions), and features like + // 'FindReferences' will just filter out these results. + result.push({ + definition: undefined, + references: [{ + fileName: sourceFile.fileName, + textSpan: ts.createTextSpan(position, searchText.length), + isWriteAccess: false, + isDefinition: false + }] + }); + } + return; + } + if (!(ts.getMeaningFromLocation(referenceLocation) & searchMeaning)) { + return; + } + var referenceSymbol = typeChecker.getSymbolAtLocation(referenceLocation); + if (referenceSymbol) { + var referenceSymbolDeclaration = referenceSymbol.valueDeclaration; + var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(referenceSymbolDeclaration); + var relatedSymbol = getRelatedSymbol(searchSymbols_1, referenceSymbol, referenceLocation, + /*searchLocationIsConstructor*/ searchLocation.kind === 122 /* ConstructorKeyword */, parents, inheritsFromCache); + if (relatedSymbol) { + addReferenceToRelatedSymbol(referenceLocation, relatedSymbol); + } + else if (!(referenceSymbol.flags & 67108864 /* Transient */) && searchSymbols_1.indexOf(shorthandValueSymbol) >= 0) { + addReferenceToRelatedSymbol(referenceSymbolDeclaration.name, shorthandValueSymbol); + } + else if (searchLocation.kind === 122 /* ConstructorKeyword */) { + findAdditionalConstructorReferences(referenceSymbol, referenceLocation); + } + } + }); + } + return; + /* If we are just looking for implementations and this is a property access expression, we need to get the + * symbol of the local type of the symbol the property is being accessed on. This is because our search + * symbol may have a different parent symbol if the local type's symbol does not declare the property + * being accessed (i.e. it is declared in some parent class or interface) + */ + function getParentSymbolsOfPropertyAccess() { + if (implementations) { + var propertyAccessExpression = getPropertyAccessExpressionFromRightHandSide(searchLocation); + if (propertyAccessExpression) { + var localParentType = typeChecker.getTypeAtLocation(propertyAccessExpression.expression); + if (localParentType) { + if (localParentType.symbol && localParentType.symbol.flags & (32 /* Class */ | 64 /* Interface */) && localParentType.symbol !== searchSymbol.parent) { + return [localParentType.symbol]; + } + else if (localParentType.flags & 196608 /* UnionOrIntersection */) { + return getSymbolsForClassAndInterfaceComponents(localParentType); + } + } + } + } + } + function getPropertyAccessExpressionFromRightHandSide(node) { + return ts.isRightSideOfPropertyAccess(node) && node.parent; + } + /** Adds references when a constructor is used with `new this()` in its own class and `super()` calls in subclasses. */ + function findAdditionalConstructorReferences(referenceSymbol, referenceLocation) { + ts.Debug.assert(ts.isClassLike(searchSymbol.valueDeclaration)); + var referenceClass = referenceLocation.parent; + if (referenceSymbol === searchSymbol && ts.isClassLike(referenceClass)) { + ts.Debug.assert(referenceClass.name === referenceLocation); + // This is the class declaration containing the constructor. + addReferences(findOwnConstructorCalls(searchSymbol)); + } + else { + // If this class appears in `extends C`, then the extending class' "super" calls are references. + var classExtending = tryGetClassByExtendingIdentifier(referenceLocation); + if (classExtending && ts.isClassLike(classExtending) && followAliasIfNecessary(referenceSymbol, referenceLocation) === searchSymbol) { + addReferences(superConstructorAccesses(classExtending)); + } + } + } + function addReferences(references) { + if (references.length) { + var referencedSymbol = getReferencedSymbol(searchSymbol); + ts.addRange(referencedSymbol.references, ts.map(references, getReferenceEntryFromNode)); + } + } + /** `classSymbol` is the class where the constructor was defined. + * Reference the constructor and all calls to `new this()`. + */ + function findOwnConstructorCalls(classSymbol) { + var result = []; + for (var _i = 0, _a = classSymbol.members["__constructor"].declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + ts.Debug.assert(decl.kind === 150 /* Constructor */); + var ctrKeyword = decl.getChildAt(0); + ts.Debug.assert(ctrKeyword.kind === 122 /* ConstructorKeyword */); + result.push(ctrKeyword); + } + ts.forEachProperty(classSymbol.exports, function (member) { + var decl = member.valueDeclaration; + if (decl && decl.kind === 149 /* MethodDeclaration */) { + var body = decl.body; + if (body) { + forEachDescendantOfKind(body, 98 /* ThisKeyword */, function (thisKeyword) { + if (ts.isNewExpressionTarget(thisKeyword)) { + result.push(thisKeyword); + } + }); + } + } + }); + return result; + } + /** Find references to `super` in the constructor of an extending class. */ + function superConstructorAccesses(cls) { + var symbol = cls.symbol; + var ctr = symbol.members["__constructor"]; + if (!ctr) { + return []; + } + var result = []; + for (var _i = 0, _a = ctr.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + ts.Debug.assert(decl.kind === 150 /* Constructor */); + var body = decl.body; + if (body) { + forEachDescendantOfKind(body, 96 /* SuperKeyword */, function (node) { + if (ts.isCallExpressionTarget(node)) { + result.push(node); + } + }); + } + } + ; + return result; + } + function getReferencedSymbol(symbol) { + var symbolId = ts.getSymbolId(symbol); + var index = symbolToIndex[symbolId]; + if (index === undefined) { + index = result.length; + symbolToIndex[symbolId] = index; + result.push({ + definition: getDefinition(symbol), + references: [] + }); + } + return result[index]; + } + function addReferenceToRelatedSymbol(node, relatedSymbol) { + var references = getReferencedSymbol(relatedSymbol).references; + if (implementations) { + getImplementationReferenceEntryForNode(node, references); + } + else { + references.push(getReferenceEntryFromNode(node)); + } + } + } + function getImplementationReferenceEntryForNode(refNode, result) { + // Check if we found a function/propertyAssignment/method with an implementation or initializer + if (ts.isDeclarationName(refNode) && isImplementation(refNode.parent)) { + result.push(getReferenceEntryFromNode(refNode.parent)); + } + else if (refNode.kind === 70 /* Identifier */) { + if (refNode.parent.kind === 258 /* ShorthandPropertyAssignment */) { + // Go ahead and dereference the shorthand assignment by going to its definition + getReferenceEntriesForShorthandPropertyAssignment(refNode, typeChecker, result); + } + // Check if the node is within an extends or implements clause + var containingClass = getContainingClassIfInHeritageClause(refNode); + if (containingClass) { + result.push(getReferenceEntryFromNode(containingClass)); + return; + } + // 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)); + } + 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) { + if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) { + maybeAdd(getReferenceEntryFromNode(returnStatement.expression)); + } + }); + } + else if (isImplementationExpression(parent_19.body)) { + maybeAdd(getReferenceEntryFromNode(parent_19.body)); + } + } + else if (ts.isAssertionExpression(parent_19) && isImplementationExpression(parent_19.expression)) { + maybeAdd(getReferenceEntryFromNode(parent_19.expression)); + } + } + } + // Type nodes can contain multiple references to the same type. For example: + // let x: Foo & (Foo & Bar) = ... + // Because we are returning the implementation locations and not the identifier locations, + // duplicate entries would be returned here as each of the type references is part of + // the same implementation. For that reason, check before we add a new entry + function maybeAdd(a) { + if (!ts.forEach(result, function (b) { return a.fileName === b.fileName && a.textSpan.start === b.textSpan.start && a.textSpan.length === b.textSpan.length; })) { + result.push(a); + } + } + } + function getSymbolsForClassAndInterfaceComponents(type, result) { + if (result === void 0) { result = []; } + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var componentType = _a[_i]; + if (componentType.symbol && componentType.symbol.getFlags() & (32 /* Class */ | 64 /* Interface */)) { + result.push(componentType.symbol); + } + if (componentType.getFlags() & 196608 /* UnionOrIntersection */) { + getSymbolsForClassAndInterfaceComponents(componentType, result); + } + } + return result; + } + function getContainingTypeReference(node) { + var topLevelTypeReference = undefined; + while (node) { + if (ts.isTypeNode(node)) { + topLevelTypeReference = node; + } + node = node.parent; + } + return topLevelTypeReference; + } + function getContainingClassIfInHeritageClause(node) { + if (node && node.parent) { + if (node.kind === 199 /* ExpressionWithTypeArguments */ + && node.parent.kind === 255 /* HeritageClause */ + && ts.isClassLike(node.parent.parent)) { + return node.parent.parent; + } + else if (node.kind === 70 /* Identifier */ || node.kind === 177 /* PropertyAccessExpression */) { + return getContainingClassIfInHeritageClause(node.parent); + } + } + return undefined; + } + /** + * Returns true if this is an expression that can be considered an implementation + */ + function isImplementationExpression(node) { + // Unwrap parentheses + if (node.kind === 183 /* ParenthesizedExpression */) { + return isImplementationExpression(node.expression); + } + return node.kind === 185 /* ArrowFunction */ || + node.kind === 184 /* FunctionExpression */ || + node.kind === 176 /* ObjectLiteralExpression */ || + node.kind === 197 /* ClassExpression */ || + node.kind === 175 /* ArrayLiteralExpression */; + } + /** + * Determines if the parent symbol occurs somewhere in the child's ancestry. If the parent symbol + * is an interface, determines if some ancestor of the child symbol extends or inherits from it. + * Also takes in a cache of previous results which makes this slightly more efficient and is + * necessary to avoid potential loops like so: + * class A extends B { } + * class B extends A { } + * + * We traverse the AST rather than using the type checker because users are typically only interested + * in explicit implementations of an interface/class when calling "Go to Implementation". Sibling + * implementations of types that share a common ancestor with the type whose implementation we are + * searching for need to be filtered out of the results. The type checker doesn't let us make the + * distinction between structurally compatible implementations and explicit implementations, so we + * must use the AST. + * + * @param child A class or interface Symbol + * @param parent Another class or interface Symbol + * @param cachedResults A map of symbol id pairs (i.e. "child,parent") to booleans indicating previous results + */ + function explicitlyInheritsFrom(child, parent, cachedResults) { + var parentIsInterface = parent.getFlags() & 64 /* Interface */; + return searchHierarchy(child); + function searchHierarchy(symbol) { + if (symbol === parent) { + return true; + } + var key = ts.getSymbolId(symbol) + "," + ts.getSymbolId(parent); + if (key in cachedResults) { + return cachedResults[key]; + } + // Set the key so that we don't infinitely recurse + cachedResults[key] = false; + var inherits = ts.forEach(symbol.getDeclarations(), function (declaration) { + if (ts.isClassLike(declaration)) { + if (parentIsInterface) { + var interfaceReferences = ts.getClassImplementsHeritageClauseElements(declaration); + if (interfaceReferences) { + for (var _i = 0, interfaceReferences_1 = interfaceReferences; _i < interfaceReferences_1.length; _i++) { + var typeReference = interfaceReferences_1[_i]; + if (searchTypeReference(typeReference)) { + return true; + } + } + } + } + return searchTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); + } + else if (declaration.kind === 227 /* InterfaceDeclaration */) { + if (parentIsInterface) { + return ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), searchTypeReference); + } + } + return false; + }); + cachedResults[key] = inherits; + return inherits; + } + function searchTypeReference(typeReference) { + if (typeReference) { + var type = typeChecker.getTypeAtLocation(typeReference); + if (type && type.symbol) { + return searchHierarchy(type.symbol); + } + } + return false; + } + } + function getReferencesForSuperKeyword(superKeyword) { + var searchSpaceNode = ts.getSuperContainer(superKeyword, /*stopOnFunctions*/ false); + if (!searchSpaceNode) { + return undefined; + } + // Whether 'super' occurs in a static context within a class. + var staticFlag = 32 /* Static */; + switch (searchSpaceNode.kind) { + case 147 /* PropertyDeclaration */: + case 146 /* PropertySignature */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + case 150 /* Constructor */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + staticFlag &= ts.getModifierFlags(searchSpaceNode); + searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class + break; + default: + return undefined; + } + var references = []; + var sourceFile = searchSpaceNode.getSourceFile(); + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); + ts.forEach(possiblePositions, function (position) { + cancellationToken.throwIfCancellationRequested(); + var node = ts.getTouchingWord(sourceFile, position); + if (!node || node.kind !== 96 /* SuperKeyword */) { + return; + } + var container = ts.getSuperContainer(node, /*stopOnFunctions*/ false); + // If we have a 'super' container, we must have an enclosing class. + // Now make sure the owning class is the same as the search-space + // and has the same static qualifier as the original 'super's owner. + if (container && (32 /* Static */ & ts.getModifierFlags(container)) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { + references.push(getReferenceEntryFromNode(node)); + } + }); + var definition = getDefinition(searchSpaceNode.symbol); + return [{ definition: definition, references: references }]; + } + function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles) { + var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false); + // Whether 'this' occurs in a static context within a class. + var staticFlag = 32 /* Static */; + switch (searchSpaceNode.kind) { + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + if (ts.isObjectLiteralMethod(searchSpaceNode)) { + break; + } + // fall through + case 147 /* PropertyDeclaration */: + case 146 /* PropertySignature */: + case 150 /* Constructor */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + staticFlag &= ts.getModifierFlags(searchSpaceNode); + searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class + break; + case 261 /* SourceFile */: + if (ts.isExternalModule(searchSpaceNode)) { + return undefined; + } + // Fall through + case 225 /* FunctionDeclaration */: + case 184 /* FunctionExpression */: + break; + // Computed properties in classes are not handled here because references to this are illegal, + // so there is no point finding references to them. + default: + return undefined; + } + var references = []; + var possiblePositions; + if (searchSpaceNode.kind === 261 /* SourceFile */) { + ts.forEach(sourceFiles, function (sourceFile) { + possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); + getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); + }); + } + else { + var sourceFile = searchSpaceNode.getSourceFile(); + possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); + getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, references); + } + var thisOrSuperSymbol = typeChecker.getSymbolAtLocation(thisOrSuperKeyword); + var displayParts = thisOrSuperSymbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, thisOrSuperSymbol, thisOrSuperKeyword.getSourceFile(), ts.getContainerNode(thisOrSuperKeyword), thisOrSuperKeyword).displayParts; + return [{ + definition: { + containerKind: "", + containerName: "", + fileName: node.getSourceFile().fileName, + kind: ts.ScriptElementKind.variableElement, + name: "this", + textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()), + displayParts: displayParts + }, + references: references + }]; + function getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result) { + ts.forEach(possiblePositions, function (position) { + cancellationToken.throwIfCancellationRequested(); + var node = ts.getTouchingWord(sourceFile, position); + if (!node || !ts.isThis(node)) { + return; + } + var container = ts.getThisContainer(node, /* includeArrowFunctions */ false); + switch (searchSpaceNode.kind) { + case 184 /* FunctionExpression */: + case 225 /* FunctionDeclaration */: + if (searchSpaceNode.symbol === container.symbol) { + result.push(getReferenceEntryFromNode(node)); + } + break; + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { + result.push(getReferenceEntryFromNode(node)); + } + break; + case 197 /* ClassExpression */: + case 226 /* ClassDeclaration */: + // Make sure the container belongs to the same class + // and has the appropriate static modifier from the original container. + if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (ts.getModifierFlags(container) & 32 /* Static */) === staticFlag) { + result.push(getReferenceEntryFromNode(node)); + } + break; + case 261 /* SourceFile */: + if (container.kind === 261 /* SourceFile */ && !ts.isExternalModule(container)) { + result.push(getReferenceEntryFromNode(node)); + } + break; + } + }); + } + } + function getReferencesForStringLiteral(node, sourceFiles) { + var type = ts.getStringLiteralTypeForNode(node, typeChecker); + if (!type) { + // nothing to do here. moving on + return undefined; + } + var references = []; + for (var _i = 0, sourceFiles_9 = sourceFiles; _i < sourceFiles_9.length; _i++) { + var sourceFile = sourceFiles_9[_i]; + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, type.text, sourceFile.getStart(), sourceFile.getEnd()); + getReferencesForStringLiteralInFile(sourceFile, type, possiblePositions, references); + } + return [{ + definition: { + containerKind: "", + containerName: "", + fileName: node.getSourceFile().fileName, + kind: ts.ScriptElementKind.variableElement, + name: type.text, + textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()), + displayParts: [ts.displayPart(ts.getTextOfNode(node), ts.SymbolDisplayPartKind.stringLiteral)] + }, + references: references + }]; + function getReferencesForStringLiteralInFile(sourceFile, searchType, possiblePositions, references) { + for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) { + var position = possiblePositions_1[_i]; + cancellationToken.throwIfCancellationRequested(); + var node_2 = ts.getTouchingWord(sourceFile, position); + if (!node_2 || node_2.kind !== 9 /* StringLiteral */) { + return; + } + var type_1 = ts.getStringLiteralTypeForNode(node_2, typeChecker); + if (type_1 === searchType) { + references.push(getReferenceEntryFromNode(node_2)); + } + } + } + } + function populateSearchSymbolSet(symbol, location) { + // The search set contains at least the current symbol + var result = [symbol]; + // If the location is name of property symbol from object literal destructuring pattern + // Search the property symbol + // for ( { property: p2 } of elems) { } + var containingObjectLiteralElement = getContainingObjectLiteralElement(location); + if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 258 /* ShorthandPropertyAssignment */) { + var propertySymbol = getPropertySymbolOfDestructuringAssignment(location); + if (propertySymbol) { + result.push(propertySymbol); + } + } + // If the symbol is an alias, add what it aliases to the list + // import {a} from "mod"; + // export {a} + // If the symbol is an alias to default declaration, add what it aliases to the list + // declare "mod" { export default class B { } } + // import B from "mod"; + //// For export specifiers, the exported name can be referring to a local symbol, e.g.: + //// import {a} from "mod"; + //// export {a as somethingElse} + //// We want the *local* declaration of 'a' as declared in the import, + //// *not* as declared within "mod" (or farther) + var aliasSymbol = getAliasSymbolForPropertyNameSymbol(symbol, location); + if (aliasSymbol) { + result = result.concat(populateSearchSymbolSet(aliasSymbol, location)); + } + // If the location is in a context sensitive location (i.e. in an object literal) try + // to get a contextual type for it, and add the property symbol from the contextual + // type to the search set + if (containingObjectLiteralElement) { + ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) { + ts.addRange(result, typeChecker.getRootSymbols(contextualSymbol)); + }); + /* Because in short-hand property assignment, location has two meaning : property name and as value of the property + * When we do findAllReference at the position of the short-hand property assignment, we would want to have references to position of + * property name and variable declaration of the identifier. + * Like in below example, when querying for all references for an identifier 'name', of the property assignment, the language service + * should show both 'name' in 'obj' and 'name' in variable declaration + * const name = "Foo"; + * const obj = { name }; + * In order to do that, we will populate the search set with the value symbol of the identifier as a value of the property assignment + * so that when matching with potential reference symbol, both symbols from property declaration and variable declaration + * will be included correctly. + */ + var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(location.parent); + if (shorthandValueSymbol) { + result.push(shorthandValueSymbol); + } + } + // If the symbol.valueDeclaration is a property parameter declaration, + // we should include both parameter declaration symbol and property declaration symbol + // Parameter Declaration symbol is only visible within function scope, so the symbol is stored in constructor.locals. + // Property Declaration symbol is a member of the class, so the symbol is stored in its class Declaration.symbol.members + if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 144 /* Parameter */ && + ts.isParameterPropertyDeclaration(symbol.valueDeclaration)) { + result = result.concat(typeChecker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name)); + } + // If this is symbol of binding element without propertyName declaration in Object binding pattern + // Include the property in the search + var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol); + if (bindingElementPropertySymbol) { + result.push(bindingElementPropertySymbol); + } + // If this is a union property, add all the symbols from all its source symbols in all unioned types. + // If the symbol is an instantiation from a another symbol (e.g. widened symbol) , add the root the list + ts.forEach(typeChecker.getRootSymbols(symbol), function (rootSymbol) { + if (rootSymbol !== symbol) { + result.push(rootSymbol); + } + // Add symbol of properties/methods of the same name in base classes and implemented interfaces definitions + if (!implementations && rootSymbol.parent && rootSymbol.parent.flags & (32 /* Class */ | 64 /* Interface */)) { + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, /*previousIterationSymbolsCache*/ ts.createMap()); + } + }); + return result; + } + /** + * Find symbol of the given property-name and add the symbol to the given result array + * @param symbol a symbol to start searching for the given propertyName + * @param propertyName a name of property to search for + * @param result an array of symbol of found property symbols + * @param previousIterationSymbolsCache a cache of symbol from previous iterations of calling this function to prevent infinite revisiting of the same symbol. + * The value of previousIterationSymbol is undefined when the function is first called. + */ + function getPropertySymbolsFromBaseTypes(symbol, propertyName, result, previousIterationSymbolsCache) { + if (!symbol) { + return; + } + // If the current symbol is the same as the previous-iteration symbol, we can just return the symbol that has already been visited + // This is particularly important for the following cases, so that we do not infinitely visit the same symbol. + // For example: + // interface C extends C { + // /*findRef*/propName: string; + // } + // The first time getPropertySymbolsFromBaseTypes is called when finding-all-references at propName, + // the symbol argument will be the symbol of an interface "C" and previousIterationSymbol is undefined, + // the function will add any found symbol of the property-name, then its sub-routine will call + // getPropertySymbolsFromBaseTypes again to walk up any base types to prevent revisiting already + // visited symbol, interface "C", the sub-routine will pass the current symbol as previousIterationSymbol. + if (symbol.name in previousIterationSymbolsCache) { + return; + } + if (symbol.flags & (32 /* Class */ | 64 /* Interface */)) { + ts.forEach(symbol.getDeclarations(), function (declaration) { + if (ts.isClassLike(declaration)) { + getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); + ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); + } + else if (declaration.kind === 227 /* InterfaceDeclaration */) { + ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); + } + }); + } + return; + function getPropertySymbolFromTypeReference(typeReference) { + if (typeReference) { + var type = typeChecker.getTypeAtLocation(typeReference); + if (type) { + var propertySymbol = typeChecker.getPropertyOfType(type, propertyName); + if (propertySymbol) { + result.push.apply(result, typeChecker.getRootSymbols(propertySymbol)); + } + // Visit the typeReference as well to see if it directly or indirectly use that property + previousIterationSymbolsCache[symbol.name] = symbol; + getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache); + } + } + } + } + function getRelatedSymbol(searchSymbols, referenceSymbol, referenceLocation, searchLocationIsConstructor, parents, cache) { + if (ts.contains(searchSymbols, referenceSymbol)) { + // If we are searching for constructor uses, they must be 'new' expressions. + return (!searchLocationIsConstructor || ts.isNewExpressionTarget(referenceLocation)) && referenceSymbol; + } + // If the reference symbol is an alias, check if what it is aliasing is one of the search + // symbols but by looking up for related symbol of this alias so it can handle multiple level of indirectness. + var aliasSymbol = getAliasSymbolForPropertyNameSymbol(referenceSymbol, referenceLocation); + if (aliasSymbol) { + return getRelatedSymbol(searchSymbols, aliasSymbol, referenceLocation, searchLocationIsConstructor, parents, cache); + } + // If the reference location is in an object literal, try to get the contextual type for the + // object literal, lookup the property symbol in the contextual type, and use this symbol to + // compare to our searchSymbol + var containingObjectLiteralElement = getContainingObjectLiteralElement(referenceLocation); + if (containingObjectLiteralElement) { + var contextualSymbol = ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) { + return ts.forEach(typeChecker.getRootSymbols(contextualSymbol), function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); + }); + if (contextualSymbol) { + return contextualSymbol; + } + // If the reference location is the name of property from object literal destructuring pattern + // Get the property symbol from the object literal's type and look if thats the search symbol + // In below eg. get 'property' from type of elems iterating type + // for ( { property: p2 } of elems) { } + var propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation); + if (propertySymbol && searchSymbols.indexOf(propertySymbol) >= 0) { + return propertySymbol; + } + } + // If the reference location is the binding element and doesn't have property name + // then include the binding element in the related symbols + // let { a } : { a }; + var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol); + if (bindingElementPropertySymbol && searchSymbols.indexOf(bindingElementPropertySymbol) >= 0) { + return bindingElementPropertySymbol; + } + // Unwrap symbols to get to the root (e.g. transient symbols as a result of widening) + // Or a union property, use its underlying unioned symbols + return ts.forEach(typeChecker.getRootSymbols(referenceSymbol), function (rootSymbol) { + // if it is in the list, then we are done + if (searchSymbols.indexOf(rootSymbol) >= 0) { + return rootSymbol; + } + // Finally, try all properties with the same name in any type the containing type extended or implemented, and + // see if any is in the list. If we were passed a parent symbol, only include types that are subtypes of the + // parent symbol + if (rootSymbol.parent && rootSymbol.parent.flags & (32 /* Class */ | 64 /* Interface */)) { + // Parents will only be defined if implementations is true + if (parents) { + if (!ts.forEach(parents, function (parent) { return explicitlyInheritsFrom(rootSymbol.parent, parent, cache); })) { + return 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; + }); + } + function getNameFromObjectLiteralElement(node) { + 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)) { + return nameExpression.text; + } + return undefined; + } + return node.name.text; + } + function getPropertySymbolsFromContextualType(node) { + var objectLiteral = node.parent; + var contextualType = typeChecker.getContextualType(objectLiteral); + var name = getNameFromObjectLiteralElement(node); + if (name && contextualType) { + var result_5 = []; + var symbol_2 = contextualType.getProperty(name); + if (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_5.push(symbol); + } + }); + } + return result_5; + } + return undefined; + } + /** Given an initial searchMeaning, extracted from a location, widen the search scope based on the declarations + * of the corresponding symbol. e.g. if we are searching for "Foo" in value position, but "Foo" references a class + * then we need to widen the search to include type positions as well. + * On the contrary, if we are searching for "Bar" in type position and we trace bar to an interface, and an uninstantiated + * module, we want to keep the search limited to only types, as the two declarations (interface and uninstantiated module) + * do not intersect in any of the three spaces. + */ + function getIntersectingMeaningFromDeclarations(meaning, declarations) { + if (declarations) { + var lastIterationMeaning = void 0; + do { + // The result is order-sensitive, for instance if initialMeaning === Namespace, and declarations = [class, instantiated module] + // we need to consider both as they initialMeaning intersects with the module in the namespace space, and the module + // intersects with the class in the value space. + // To achieve that we will keep iterating until the result stabilizes. + // Remember the last meaning + lastIterationMeaning = meaning; + for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { + var declaration = declarations_8[_i]; + var declarationMeaning = ts.getMeaningFromDeclaration(declaration); + if (declarationMeaning & meaning) { + meaning |= declarationMeaning; + } + } + } while (meaning !== lastIterationMeaning); + } + return meaning; + } + } + FindAllReferences.getReferencedSymbolsForNode = getReferencedSymbolsForNode; + function convertReferences(referenceSymbols) { + if (!referenceSymbols) { + return undefined; + } + var referenceEntries = []; + for (var _i = 0, referenceSymbols_1 = referenceSymbols; _i < referenceSymbols_1.length; _i++) { + var referenceSymbol = referenceSymbols_1[_i]; + ts.addRange(referenceEntries, referenceSymbol.references); + } + return referenceEntries; + } + FindAllReferences.convertReferences = convertReferences; + function isImplementation(node) { + if (!node) { + return false; + } + else if (ts.isVariableLike(node)) { + if (node.initializer) { + return true; + } + else if (node.kind === 223 /* VariableDeclaration */) { + var parentStatement = getParentStatementOfVariableDeclaration(node); + return parentStatement && ts.hasModifier(parentStatement, 2 /* Ambient */); + } + } + else if (ts.isFunctionLike(node)) { + return !!node.body || ts.hasModifier(node, 2 /* Ambient */); + } + else { + switch (node.kind) { + case 226 /* ClassDeclaration */: + case 197 /* ClassExpression */: + case 229 /* EnumDeclaration */: + case 230 /* ModuleDeclaration */: + return true; + } + } + return false; + } + function getParentStatementOfVariableDeclaration(node) { + if (node.parent && node.parent.parent && node.parent.parent.kind === 205 /* VariableStatement */) { + ts.Debug.assert(node.parent.kind === 224 /* VariableDeclarationList */); + return node.parent.parent; + } + } + function getReferenceEntriesForShorthandPropertyAssignment(node, typeChecker, result) { + var refSymbol = typeChecker.getSymbolAtLocation(node); + var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(refSymbol.valueDeclaration); + if (shorthandSymbol) { + for (var _i = 0, _a = shorthandSymbol.getDeclarations(); _i < _a.length; _i++) { + var declaration = _a[_i]; + if (ts.getMeaningFromDeclaration(declaration) & 1 /* Value */) { + result.push(getReferenceEntryFromNode(declaration)); + } + } + } + } + FindAllReferences.getReferenceEntriesForShorthandPropertyAssignment = getReferenceEntriesForShorthandPropertyAssignment; + function getReferenceEntryFromNode(node) { + var start = node.getStart(); + var end = node.getEnd(); + if (node.kind === 9 /* StringLiteral */) { + start += 1; + end -= 1; + } + return { + fileName: node.getSourceFile().fileName, + textSpan: ts.createTextSpanFromBounds(start, end), + isWriteAccess: isWriteAccess(node), + isDefinition: ts.isDeclarationName(node) || ts.isLiteralComputedPropertyDeclarationName(node) + }; + } + FindAllReferences.getReferenceEntryFromNode = getReferenceEntryFromNode; + /** A node is considered a writeAccess iff it is a name of a declaration or a target of an assignment */ + function isWriteAccess(node) { + if (node.kind === 70 /* Identifier */ && ts.isDeclarationName(node)) { + return true; + } + var parent = node.parent; + if (parent) { + if (parent.kind === 191 /* PostfixUnaryExpression */ || parent.kind === 190 /* PrefixUnaryExpression */) { + return true; + } + else if (parent.kind === 192 /* BinaryExpression */ && parent.left === node) { + var operator = parent.operatorToken.kind; + return 57 /* FirstAssignment */ <= operator && operator <= 69 /* LastAssignment */; + } + } + return false; + } + function forEachDescendantOfKind(node, kind, action) { + ts.forEachChild(node, function (child) { + if (child.kind === kind) { + action(child); + } + forEachDescendantOfKind(child, kind, action); + }); + } + /** + * Returns the containing object literal property declaration given a possible name node, e.g. "a" in x = { "a": 1 } + */ + function getContainingObjectLiteralElement(node) { + switch (node.kind) { + case 9 /* StringLiteral */: + case 8 /* NumericLiteral */: + if (node.parent.kind === 142 /* ComputedPropertyName */) { + return isObjectLiteralPropertyDeclaration(node.parent.parent) ? node.parent.parent : undefined; + } + // intential fall through + case 70 /* Identifier */: + return isObjectLiteralPropertyDeclaration(node.parent) && node.parent.name === node ? node.parent : undefined; + } + return undefined; + } + function isObjectLiteralPropertyDeclaration(node) { + switch (node.kind) { + case 257 /* PropertyAssignment */: + case 258 /* ShorthandPropertyAssignment */: + case 149 /* MethodDeclaration */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + return true; + } + return false; + } + /** Get `C` given `N` if `N` is in the position `class C extends N` or `class C extends foo.N` where `N` is an identifier. */ + function tryGetClassByExtendingIdentifier(node) { + return ts.tryGetClassExtendingExpressionWithTypeArguments(ts.climbPastPropertyAccess(node).parent); + } + function isNameOfExternalModuleImportOrDeclaration(node) { + if (node.kind === 9 /* StringLiteral */) { + return ts.isNameOfModuleDeclaration(node) || ts.isExpressionOfExternalModuleImportEqualsDeclaration(node); + } + return false; + } + })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var GoToDefinition; + (function (GoToDefinition) { + function getDefinitionAtPosition(program, sourceFile, position) { + /// Triple slash reference comments + var comment = findReferenceInPosition(sourceFile.referencedFiles, position); + if (comment) { + var referenceFile = ts.tryResolveScriptReference(program, sourceFile, comment); + if (referenceFile) { + return [getDefinitionInfoForFileReference(comment.fileName, referenceFile.fileName)]; + } + return undefined; + } + // Type reference directives + var typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position); + if (typeReferenceDirective) { + var referenceFile = program.getResolvedTypeReferenceDirectives()[typeReferenceDirective.fileName]; + if (referenceFile && referenceFile.resolvedFileName) { + return [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)]; + } + return undefined; + } + var node = ts.getTouchingPropertyName(sourceFile, position); + if (node === sourceFile) { + return undefined; + } + // Labels + if (ts.isJumpStatementTarget(node)) { + var labelName = node.text; + var label = ts.getTargetLabel(node.parent, node.text); + return label ? [createDefinitionInfo(label, ts.ScriptElementKind.label, labelName, /*containerName*/ undefined)] : undefined; + } + var typeChecker = program.getTypeChecker(); + var calledDeclaration = tryGetSignatureDeclaration(typeChecker, node); + if (calledDeclaration) { + return [createDefinitionFromSignatureDeclaration(typeChecker, calledDeclaration)]; + } + var symbol = typeChecker.getSymbolAtLocation(node); + // Could not find a symbol e.g. node is string or number keyword, + // or the symbol was an internal symbol and does not have a declaration e.g. undefined symbol + if (!symbol) { + return undefined; + } + // If this is an alias, and the request came at the declaration location + // get the aliased symbol instead. This allows for goto def on an import e.g. + // import {A, B} from "mod"; + // to jump to the implementation directly. + if (symbol.flags & 8388608 /* Alias */) { + var declaration = symbol.declarations[0]; + // Go to the original declaration for cases: + // + // (1) when the aliased symbol was declared in the location(parent). + // (2) when the aliased symbol is originating from a named import. + // + if (node.kind === 70 /* Identifier */ && + (node.parent === declaration || + (declaration.kind === 239 /* ImportSpecifier */ && declaration.parent && declaration.parent.kind === 238 /* NamedImports */))) { + symbol = typeChecker.getAliasedSymbol(symbol); + } + } + // Because name in short-hand property assignment has two different meanings: property name and property value, + // using go-to-definition at such position should go to the variable declaration of the property value rather than + // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition + // is performed at the location of property access, we would like to go to definition of the property in the short-hand + // assignment. This case and others are handled by the following code. + if (node.parent.kind === 258 /* ShorthandPropertyAssignment */) { + var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); + if (!shorthandSymbol) { + return []; + } + var shorthandDeclarations = shorthandSymbol.getDeclarations(); + var shorthandSymbolKind_1 = ts.SymbolDisplay.getSymbolKind(typeChecker, shorthandSymbol, node); + var shorthandSymbolName_1 = typeChecker.symbolToString(shorthandSymbol); + var shorthandContainerName_1 = typeChecker.symbolToString(symbol.parent, node); + return ts.map(shorthandDeclarations, function (declaration) { return createDefinitionInfo(declaration, shorthandSymbolKind_1, shorthandSymbolName_1, shorthandContainerName_1); }); + } + return getDefinitionFromSymbol(typeChecker, symbol, node); + } + GoToDefinition.getDefinitionAtPosition = getDefinitionAtPosition; + /// Goto type + function getTypeDefinitionAtPosition(typeChecker, sourceFile, position) { + var node = ts.getTouchingPropertyName(sourceFile, position); + if (node === sourceFile) { + return undefined; + } + var symbol = typeChecker.getSymbolAtLocation(node); + if (!symbol) { + return undefined; + } + var type = typeChecker.getTypeOfSymbolAtLocation(symbol, node); + if (!type) { + return undefined; + } + if (type.flags & 65536 /* Union */ && !(type.flags & 16 /* Enum */)) { + var result_6 = []; + ts.forEach(type.types, function (t) { + if (t.symbol) { + ts.addRange(/*to*/ result_6, /*from*/ getDefinitionFromSymbol(typeChecker, t.symbol, node)); + } + }); + return result_6; + } + if (!type.symbol) { + return undefined; + } + return getDefinitionFromSymbol(typeChecker, type.symbol, node); + } + GoToDefinition.getTypeDefinitionAtPosition = getTypeDefinitionAtPosition; + function getDefinitionFromSymbol(typeChecker, symbol, node) { + var result = []; + var declarations = symbol.getDeclarations(); + var _a = getSymbolInfo(typeChecker, symbol, node), symbolName = _a.symbolName, symbolKind = _a.symbolKind, containerName = _a.containerName; + if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) && + !tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) { + // Just add all the declarations. + ts.forEach(declarations, function (declaration) { + result.push(createDefinitionInfo(declaration, symbolKind, symbolName, containerName)); + }); + } + return result; + function tryAddConstructSignature(symbol, location, symbolKind, symbolName, containerName, result) { + // Applicable only if we are in a new expression, or we are on a constructor declaration + // and in either case the symbol has a construct signature definition, i.e. class + if (ts.isNewExpressionTarget(location) || location.kind === 122 /* ConstructorKeyword */) { + if (symbol.flags & 32 /* Class */) { + // Find the first class-like declaration and try to get the construct signature. + for (var _i = 0, _a = symbol.getDeclarations(); _i < _a.length; _i++) { + var declaration = _a[_i]; + if (ts.isClassLike(declaration)) { + return tryAddSignature(declaration.members, + /*selectConstructors*/ true, symbolKind, symbolName, containerName, result); + } + } + ts.Debug.fail("Expected declaration to have at least one class-like declaration"); + } + } + return false; + } + function tryAddCallSignature(symbol, location, symbolKind, symbolName, containerName, result) { + if (ts.isCallExpressionTarget(location) || ts.isNewExpressionTarget(location) || ts.isNameOfFunctionDeclaration(location)) { + return tryAddSignature(symbol.declarations, /*selectConstructors*/ false, symbolKind, symbolName, containerName, result); + } + return false; + } + function tryAddSignature(signatureDeclarations, selectConstructors, symbolKind, symbolName, containerName, result) { + var declarations = []; + var definition; + ts.forEach(signatureDeclarations, function (d) { + if ((selectConstructors && d.kind === 150 /* Constructor */) || + (!selectConstructors && (d.kind === 225 /* FunctionDeclaration */ || d.kind === 149 /* MethodDeclaration */ || d.kind === 148 /* MethodSignature */))) { + declarations.push(d); + if (d.body) + definition = d; + } + }); + if (definition) { + result.push(createDefinitionInfo(definition, symbolKind, symbolName, containerName)); + return true; + } + else if (declarations.length) { + result.push(createDefinitionInfo(ts.lastOrUndefined(declarations), symbolKind, symbolName, containerName)); + return true; + } + return false; + } + } + function createDefinitionInfo(node, symbolKind, symbolName, containerName) { + return { + fileName: node.getSourceFile().fileName, + textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()), + kind: symbolKind, + name: symbolName, + containerKind: undefined, + containerName: containerName + }; + } + function getSymbolInfo(typeChecker, symbol, node) { + return { + symbolName: typeChecker.symbolToString(symbol), + symbolKind: ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node), + containerName: symbol.parent ? typeChecker.symbolToString(symbol.parent, node) : "" + }; + } + function createDefinitionFromSignatureDeclaration(typeChecker, decl) { + var _a = getSymbolInfo(typeChecker, decl.symbol, decl), symbolName = _a.symbolName, symbolKind = _a.symbolKind, containerName = _a.containerName; + return createDefinitionInfo(decl, symbolKind, symbolName, containerName); + } + function findReferenceInPosition(refs, pos) { + for (var _i = 0, refs_1 = refs; _i < refs_1.length; _i++) { + var ref = refs_1[_i]; + if (ref.pos <= pos && pos < ref.end) { + return ref; + } + } + return undefined; + } + function getDefinitionInfoForFileReference(name, targetFileName) { + return { + fileName: targetFileName, + textSpan: ts.createTextSpanFromBounds(0, 0), + kind: ts.ScriptElementKind.scriptElement, + name: name, + containerName: undefined, + containerKind: undefined + }; + } + /** Returns a CallLikeExpression where `node` is the target being invoked. */ + function getAncestorCallLikeExpression(node) { + var target = climbPastManyPropertyAccesses(node); + var callLike = target.parent; + return callLike && ts.isCallLikeExpression(callLike) && ts.getInvokedExpression(callLike) === target && callLike; + } + function climbPastManyPropertyAccesses(node) { + return ts.isRightSideOfPropertyAccess(node) ? climbPastManyPropertyAccesses(node.parent) : node; + } + function tryGetSignatureDeclaration(typeChecker, node) { + var callLike = getAncestorCallLikeExpression(node); + return callLike && typeChecker.getResolvedSignature(callLike).declaration; + } + })(GoToDefinition = ts.GoToDefinition || (ts.GoToDefinition = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var GoToImplementation; + (function (GoToImplementation) { + function getImplementationAtPosition(typeChecker, cancellationToken, sourceFiles, node) { + // If invoked directly on a shorthand property assignment, then return + // the declaration of the symbol being assigned (not the symbol being assigned to). + if (node.parent.kind === 258 /* ShorthandPropertyAssignment */) { + var result = []; + ts.FindAllReferences.getReferenceEntriesForShorthandPropertyAssignment(node, typeChecker, result); + return result.length > 0 ? result : undefined; + } + else if (node.kind === 96 /* SuperKeyword */ || ts.isSuperProperty(node.parent)) { + // References to and accesses on the super keyword only have one possible implementation, so no + // need to "Find all References" + var symbol = typeChecker.getSymbolAtLocation(node); + return symbol.valueDeclaration && [ts.FindAllReferences.getReferenceEntryFromNode(symbol.valueDeclaration)]; + } + else { + // Perform "Find all References" and retrieve only those that are implementations + var referencedSymbols = ts.FindAllReferences.getReferencedSymbolsForNode(typeChecker, cancellationToken, node, sourceFiles, /*findInStrings*/ false, /*findInComments*/ false, /*implementations*/ true); + var result = ts.flatMap(referencedSymbols, function (symbol) { + return ts.map(symbol.references, function (_a) { + var textSpan = _a.textSpan, fileName = _a.fileName; + return ({ textSpan: textSpan, fileName: fileName }); + }); + }); + return result && result.length > 0 ? result : undefined; + } + } + GoToImplementation.getImplementationAtPosition = getImplementationAtPosition; + })(GoToImplementation = ts.GoToImplementation || (ts.GoToImplementation = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var JsDoc; + (function (JsDoc) { + var jsDocTagNames = [ + "augments", + "author", + "argument", + "borrows", + "class", + "constant", + "constructor", + "constructs", + "default", + "deprecated", + "description", + "event", + "example", + "extends", + "field", + "fileOverview", + "function", + "ignore", + "inner", + "lends", + "link", + "memberOf", + "method", + "name", + "namespace", + "param", + "private", + "property", + "public", + "requires", + "returns", + "see", + "since", + "static", + "throws", + "type", + "typedef", + "property", + "prop", + "version" + ]; + var jsDocCompletionEntries; + function getJsDocCommentsFromDeclarations(declarations) { + // Only collect doc comments from duplicate declarations once: + // In case of a union property there might be same declaration multiple times + // which only varies in type parameter + // Eg. const a: Array | Array; a.length + // The property length will have two declarations of property length coming + // from Array - Array and Array + var documentationComment = []; + forEachUnique(declarations, function (declaration) { + var comments = ts.getCommentsFromJSDoc(declaration); + if (!comments) { + return; + } + for (var _i = 0, comments_3 = comments; _i < comments_3.length; _i++) { + var comment = comments_3[_i]; + if (comment) { + if (documentationComment.length) { + documentationComment.push(ts.lineBreakPart()); + } + documentationComment.push(ts.textPart(comment)); + } + } + }); + return documentationComment; + } + JsDoc.getJsDocCommentsFromDeclarations = getJsDocCommentsFromDeclarations; + function getJsDocTagsFromDeclarations(declarations) { + // Only collect doc comments from duplicate declarations once. + var tags = []; + forEachUnique(declarations, function (declaration) { + var jsDocs = ts.getJSDocs(declaration); + if (!jsDocs) { + return; + } + for (var _i = 0, jsDocs_1 = jsDocs; _i < jsDocs_1.length; _i++) { + var doc = jsDocs_1[_i]; + var tagsForDoc = doc.tags; + if (tagsForDoc) { + tags.push.apply(tags, tagsForDoc.filter(function (tag) { return tag.kind === 279 /* JSDocTag */; }).map(function (jsDocTag) { + return { + name: jsDocTag.tagName.text, + text: jsDocTag.comment + }; + })); + } + } + }); + return tags; + } + JsDoc.getJsDocTagsFromDeclarations = getJsDocTagsFromDeclarations; + /** + * Iterates through 'array' by index and performs the callback on each element of array until the callback + * returns a truthy value, then returns that value. + * If no such value is found, the callback is applied to each element of array and undefined is returned. + */ + function forEachUnique(array, callback) { + if (array) { + for (var i = 0, len = array.length; i < len; i++) { + if (ts.indexOf(array, array[i]) === i) { + var result = callback(array[i], i); + if (result) { + return result; + } + } + } + } + return undefined; + } + function getAllJsDocCompletionEntries() { + return jsDocCompletionEntries || (jsDocCompletionEntries = ts.map(jsDocTagNames, function (tagName) { + return { + name: tagName, + kind: ts.ScriptElementKind.keyword, + kindModifiers: "", + sortText: "0", + }; + })); + } + JsDoc.getAllJsDocCompletionEntries = getAllJsDocCompletionEntries; + /** + * Checks if position points to a valid position to add JSDoc comments, and if so, + * returns the appropriate template. Otherwise returns an empty string. + * Valid positions are + * - outside of comments, statements, and expressions, and + * - preceding a: + * - function/constructor/method declaration + * - class declarations + * - variable statements + * - namespace declarations + * + * Hosts should ideally check that: + * - The line is all whitespace up to 'position' before performing the insertion. + * - If the keystroke sequence "/\*\*" induced the call, we also check that the next + * non-whitespace character is '*', which (approximately) indicates whether we added + * the second '*' to complete an existing (JSDoc) comment. + * @param fileName The file in which to perform the check. + * @param position The (character-indexed) position in the file where the check should + * be performed. + */ + function getDocCommentTemplateAtPosition(newLine, sourceFile, position) { + // Check if in a context where we don't want to perform any insertion + if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position) || ts.hasDocComment(sourceFile, position)) { + return undefined; + } + var tokenAtPos = ts.getTokenAtPosition(sourceFile, position); + var tokenStart = tokenAtPos.getStart(); + if (!tokenAtPos || tokenStart < position) { + return undefined; + } + // TODO: add support for: + // - enums/enum members + // - interfaces + // - property declarations + // - potentially property assignments + var commentOwner; + findOwner: for (commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) { + switch (commentOwner.kind) { + case 225 /* FunctionDeclaration */: + case 149 /* MethodDeclaration */: + case 150 /* Constructor */: + case 226 /* ClassDeclaration */: + case 205 /* VariableStatement */: + break findOwner; + case 261 /* SourceFile */: + return undefined; + case 230 /* ModuleDeclaration */: + // If in walking up the tree, we hit a a nested namespace declaration, + // then we must be somewhere within a dotted namespace name; however we don't + // want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'. + if (commentOwner.parent.kind === 230 /* ModuleDeclaration */) { + return undefined; + } + break findOwner; + } + } + if (!commentOwner || commentOwner.getStart() < position) { + return undefined; + } + var parameters = getParametersForJsDocOwningNode(commentOwner); + var posLineAndChar = sourceFile.getLineAndCharacterOfPosition(position); + var lineStart = sourceFile.getLineStarts()[posLineAndChar.line]; + var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character); + var isJavaScriptFile = ts.hasJavaScriptFileExtension(sourceFile.fileName); + var docParams = ""; + for (var i = 0, numParams = parameters.length; i < numParams; i++) { + var currentName = parameters[i].name; + var paramName = currentName.kind === 70 /* Identifier */ ? + currentName.text : + "param" + i; + if (isJavaScriptFile) { + docParams += indentationStr + " * @param {any} " + paramName + newLine; + } + else { + docParams += indentationStr + " * @param " + paramName + newLine; + } + } + // A doc comment consists of the following + // * The opening comment line + // * the first line (without a param) for the object's untagged info (this is also where the caret ends up) + // * the '@param'-tagged lines + // * TODO: other tags. + // * the closing comment line + // * if the caret was directly in front of the object, then we add an extra line and indentation. + var preamble = "/**" + newLine + + indentationStr + " * "; + var result = preamble + newLine + + docParams + + indentationStr + " */" + + (tokenStart === position ? newLine + indentationStr : ""); + return { newText: result, caretOffset: preamble.length }; + } + JsDoc.getDocCommentTemplateAtPosition = getDocCommentTemplateAtPosition; + function getParametersForJsDocOwningNode(commentOwner) { + if (ts.isFunctionLike(commentOwner)) { + return commentOwner.parameters; + } + if (commentOwner.kind === 205 /* VariableStatement */) { + var varStatement = commentOwner; + var varDeclarations = varStatement.declarationList.declarations; + if (varDeclarations.length === 1 && varDeclarations[0].initializer) { + return getParametersFromRightHandSideOfAssignment(varDeclarations[0].initializer); + } + } + return ts.emptyArray; + } + /** + * Digs into an an initializer or RHS operand of an assignment operation + * to get the parameters of an apt signature corresponding to a + * function expression or a class expression. + * + * @param rightHandSide the expression which may contain an appropriate set of parameters + * @returns the parameters of a signature found on the RHS if one exists; otherwise 'emptyArray'. + */ + function getParametersFromRightHandSideOfAssignment(rightHandSide) { + while (rightHandSide.kind === 183 /* ParenthesizedExpression */) { + rightHandSide = rightHandSide.expression; + } + switch (rightHandSide.kind) { + case 184 /* FunctionExpression */: + case 185 /* ArrowFunction */: + return rightHandSide.parameters; + case 197 /* ClassExpression */: + for (var _i = 0, _a = rightHandSide.members; _i < _a.length; _i++) { + var member = _a[_i]; + if (member.kind === 150 /* Constructor */) { + return member.parameters; + } + } + break; + } + return ts.emptyArray; + } + })(JsDoc = ts.JsDoc || (ts.JsDoc = {})); +})(ts || (ts = {})); +// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. +// See LICENSE.txt in the project root for complete license information. +/// +/// +/// +/* @internal */ +var ts; +(function (ts) { + var JsTyping; + (function (JsTyping) { + ; + ; + // A map of loose file names to library names + // that we are confident require typings + var safeList; + var EmptySafeList = ts.createMap(); + /* @internal */ + JsTyping.nodeCoreModuleList = [ + "buffer", "querystring", "events", "http", "cluster", + "zlib", "os", "https", "punycode", "repl", "readline", + "vm", "child_process", "url", "dns", "net", + "dgram", "fs", "path", "string_decoder", "tls", + "crypto", "stream", "util", "assert", "tty", "domain", + "constants", "process", "v8", "timers", "console" + ]; + var nodeCoreModules = ts.arrayToMap(JsTyping.nodeCoreModuleList, function (x) { return x; }); + /** + * @param host is the object providing I/O related operations. + * @param fileNames are the file names that belong to the same project + * @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 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, typeAcquisition, unresolvedImports) { + // A typing name to typing file path mapping + var inferredTypings = ts.createMap(); + if (!typeAcquisition || !typeAcquisition.enable) { + return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] }; + } + // Only infer typings for .js and .jsx files + fileNames = ts.filter(ts.map(fileNames, ts.normalizePath), function (f) { + var kind = ts.ensureScriptKind(f, ts.getScriptKindFromFileName(f)); + return kind === 1 /* JS */ || kind === 2 /* JSX */; + }); + if (!safeList) { + var result = ts.readConfigFile(safeListPath, function (path) { return host.readFile(path); }); + safeList = result.config ? ts.createMap(result.config) : EmptySafeList; + } + var filesToWatch = []; + // Directories to search for package.json, bower.json and other typing information + var searchDirs = []; + var exclude = []; + mergeTypings(typeAcquisition.include); + exclude = typeAcquisition.exclude || []; + var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath); + if (projectRootPath) { + possibleSearchDirs.push(projectRootPath); + } + searchDirs = ts.deduplicate(possibleSearchDirs); + for (var _i = 0, searchDirs_1 = searchDirs; _i < searchDirs_1.length; _i++) { + var searchDir = searchDirs_1[_i]; + var packageJsonPath = ts.combinePaths(searchDir, "package.json"); + getTypingNamesFromJson(packageJsonPath, filesToWatch); + var bowerJsonPath = ts.combinePaths(searchDir, "bower.json"); + getTypingNamesFromJson(bowerJsonPath, filesToWatch); + var nodeModulesPath = ts.combinePaths(searchDir, "node_modules"); + getTypingNamesFromNodeModuleFolder(nodeModulesPath); + } + getTypingNamesFromSourceFileNames(fileNames); + // add typings for unresolved imports + if (unresolvedImports) { + for (var _a = 0, unresolvedImports_1 = unresolvedImports; _a < unresolvedImports_1.length; _a++) { + var moduleId = unresolvedImports_1[_a]; + var typingName = moduleId in nodeCoreModules ? "node" : moduleId; + if (!(typingName in inferredTypings)) { + inferredTypings[typingName] = undefined; + } + } + } + // Add the cached typing locations for inferred typings that are already installed + for (var name_47 in packageNameToTypingLocation) { + if (name_47 in inferredTypings && !inferredTypings[name_47]) { + inferredTypings[name_47] = packageNameToTypingLocation[name_47]; + } + } + // Remove typings that the user has added to the exclude list + for (var _b = 0, exclude_1 = exclude; _b < exclude_1.length; _b++) { + var excludeTypingName = exclude_1[_b]; + delete inferredTypings[excludeTypingName]; + } + var newTypingNames = []; + var cachedTypingPaths = []; + for (var typing in inferredTypings) { + if (inferredTypings[typing] !== undefined) { + cachedTypingPaths.push(inferredTypings[typing]); + } + else { + newTypingNames.push(typing); + } + } + return { cachedTypingPaths: cachedTypingPaths, newTypingNames: newTypingNames, filesToWatch: filesToWatch }; + /** + * Merge a given list of typingNames to the inferredTypings map + */ + function mergeTypings(typingNames) { + if (!typingNames) { + return; + } + for (var _i = 0, typingNames_1 = typingNames; _i < typingNames_1.length; _i++) { + var typing = typingNames_1[_i]; + if (!(typing in inferredTypings)) { + inferredTypings[typing] = undefined; + } + } + } + /** + * Get the typing info from common package manager json files like package.json or bower.json + */ + function getTypingNamesFromJson(jsonPath, filesToWatch) { + if (host.fileExists(jsonPath)) { + filesToWatch.push(jsonPath); + } + var result = ts.readConfigFile(jsonPath, function (path) { return host.readFile(path); }); + if (result.config) { + var jsonConfig = result.config; + if (jsonConfig.dependencies) { + mergeTypings(ts.getOwnKeys(jsonConfig.dependencies)); + } + if (jsonConfig.devDependencies) { + mergeTypings(ts.getOwnKeys(jsonConfig.devDependencies)); + } + if (jsonConfig.optionalDependencies) { + mergeTypings(ts.getOwnKeys(jsonConfig.optionalDependencies)); + } + if (jsonConfig.peerDependencies) { + mergeTypings(ts.getOwnKeys(jsonConfig.peerDependencies)); + } + } + } + /** + * Infer typing names from given file names. For example, the file name "jquery-min.2.3.4.js" + * should be inferred to the 'jquery' typing name; and "angular-route.1.2.3.js" should be inferred + * to the 'angular-route' typing name. + * @param fileNames are the names for source files in the project + */ + function getTypingNamesFromSourceFileNames(fileNames) { + var jsFileNames = ts.filter(fileNames, ts.hasJavaScriptFileExtension); + var inferredTypingNames = ts.map(jsFileNames, function (f) { return ts.removeFileExtension(ts.getBaseFileName(f.toLowerCase())); }); + var cleanedTypingNames = ts.map(inferredTypingNames, function (f) { return f.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, ""); }); + if (safeList !== EmptySafeList) { + mergeTypings(ts.filter(cleanedTypingNames, function (f) { return f in safeList; })); + } + var hasJsxFile = ts.forEach(fileNames, function (f) { return ts.ensureScriptKind(f, ts.getScriptKindFromFileName(f)) === 2 /* JSX */; }); + if (hasJsxFile) { + mergeTypings(["react"]); + } + } + /** + * Infer typing names from node_module folder + * @param nodeModulesPath is the path to the "node_modules" folder + */ + function getTypingNamesFromNodeModuleFolder(nodeModulesPath) { + // Todo: add support for ModuleResolutionHost too + if (!host.directoryExists(nodeModulesPath)) { + return; + } + var typingNames = []; + var fileNames = host.readDirectory(nodeModulesPath, [".json"], /*excludes*/ undefined, /*includes*/ undefined, /*depth*/ 2); + for (var _i = 0, fileNames_2 = fileNames; _i < fileNames_2.length; _i++) { + var fileName = fileNames_2[_i]; + var normalizedFileName = ts.normalizePath(fileName); + if (ts.getBaseFileName(normalizedFileName) !== "package.json") { + continue; + } + var result = ts.readConfigFile(normalizedFileName, function (path) { return host.readFile(path); }); + if (!result.config) { + continue; + } + var packageJson = result.config; + // npm 3's package.json contains a "_requiredBy" field + // we should include all the top level module names for npm 2, and only module names whose + // "_requiredBy" field starts with "#" or equals "/" for npm 3. + if (packageJson._requiredBy && + ts.filter(packageJson._requiredBy, function (r) { return r[0] === "#" || r === "/"; }).length === 0) { + continue; + } + // If the package has its own d.ts typings, those will take precedence. Otherwise the package name will be used + // to download d.ts files from DefinitelyTyped + if (!packageJson.name) { + continue; + } + if (packageJson.typings) { + var absolutePath = ts.getNormalizedAbsolutePath(packageJson.typings, ts.getDirectoryPath(normalizedFileName)); + inferredTypings[packageJson.name] = absolutePath; + } + else { + typingNames.push(packageJson.name); + } + } + mergeTypings(typingNames); + } + } + JsTyping.discoverTypings = discoverTypings; + })(JsTyping = ts.JsTyping || (ts.JsTyping = {})); })(ts || (ts = {})); /* @internal */ var ts; (function (ts) { var NavigateTo; (function (NavigateTo) { - function getNavigateToItems(program, checker, cancellationToken, searchValue, maxResultCount) { + function getNavigateToItems(sourceFiles, checker, cancellationToken, searchValue, maxResultCount, excludeDtsFiles) { var patternMatcher = ts.createPatternMatcher(searchValue); var rawItems = []; - // This means "compare in a case insensitive manner." - var baseSensitivity = { sensitivity: "base" }; // Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[] - ts.forEach(program.getSourceFiles(), function (sourceFile) { + ts.forEach(sourceFiles, function (sourceFile) { cancellationToken.throwIfCancellationRequested(); + if (excludeDtsFiles && ts.fileExtensionIs(sourceFile.fileName, ".d.ts")) { + return; + } var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_37 in nameToDeclarations) { - var declarations = nameToDeclarations[name_37]; + for (var name_48 in nameToDeclarations) { + var declarations = nameToDeclarations[name_48]; 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_37); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_48); if (!matches) { continue; } - for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { - var declaration = declarations_7[_i]; + for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { + var declaration = declarations_9[_i]; // It was a match! If the pattern has dots in it, then also see if the // declaration container matches as well. if (patternMatcher.patternContainsDots) { @@ -47422,14 +71779,14 @@ var ts; if (!containers) { return undefined; } - matches = patternMatcher.getMatches(containers, name_37); + matches = patternMatcher.getMatches(containers, name_48); if (!matches) { continue; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_37, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name_48, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } } @@ -47437,7 +71794,7 @@ var ts; // Remove imports when the imported declaration is already in the list and has the same name. rawItems = ts.filter(rawItems, function (item) { var decl = item.declaration; - if (decl.kind === 231 /* ImportClause */ || decl.kind === 234 /* ImportSpecifier */ || decl.kind === 229 /* ImportEqualsDeclaration */) { + if (decl.kind === 236 /* ImportClause */ || decl.kind === 239 /* ImportSpecifier */ || decl.kind === 234 /* ImportEqualsDeclaration */) { var importer = checker.getSymbolAtLocation(decl.name); var imported = checker.getAliasedSymbol(importer); return importer.name !== imported.name; @@ -47455,8 +71812,8 @@ var ts; function allMatchesAreCaseSensitive(matches) { ts.Debug.assert(matches.length > 0); // This is a case sensitive match, only if all the submatches were case sensitive. - for (var _i = 0, matches_1 = matches; _i < matches_1.length; _i++) { - var match = matches_1[_i]; + for (var _i = 0, matches_2 = matches; _i < matches_2.length; _i++) { + var match = matches_2[_i]; if (!match.isCaseSensitive) { return false; } @@ -47465,7 +71822,7 @@ var ts; } function getTextOfIdentifierOrLiteral(node) { if (node) { - if (node.kind === 69 /* Identifier */ || + if (node.kind === 70 /* Identifier */ || node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) { return node.text; @@ -47479,7 +71836,7 @@ var ts; if (text !== undefined) { containers.unshift(text); } - else if (declaration.name.kind === 140 /* ComputedPropertyName */) { + else if (declaration.name.kind === 142 /* ComputedPropertyName */) { return tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion*/ true); } else { @@ -47500,7 +71857,7 @@ var ts; } return true; } - if (expression.kind === 172 /* PropertyAccessExpression */) { + if (expression.kind === 177 /* PropertyAccessExpression */) { var propertyAccess = expression; if (includeLastPortion) { containers.unshift(propertyAccess.name.text); @@ -47513,7 +71870,7 @@ var ts; var containers = []; // First, if we started with a computed property name, then add all but the last // portion into the container array. - if (declaration.name.kind === 140 /* ComputedPropertyName */) { + if (declaration.name.kind === 142 /* ComputedPropertyName */) { if (!tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion*/ false)) { return undefined; } @@ -47531,8 +71888,8 @@ var ts; function bestMatchKind(matches) { ts.Debug.assert(matches.length > 0); var bestMatchKind = ts.PatternMatchKind.camelCase; - for (var _i = 0, matches_2 = matches; _i < matches_2.length; _i++) { - var match = matches_2[_i]; + for (var _i = 0, matches_3 = matches; _i < matches_3.length; _i++) { + var match = matches_3[_i]; var kind = match.kind; if (kind < bestMatchKind) { bestMatchKind = kind; @@ -47546,8 +71903,8 @@ var ts; // We first sort case insensitively. So "Aaa" will come before "bar". // Then we sort case sensitively, so "aaa" will come before "Aaa". return i1.matchKind - i2.matchKind || - i1.name.localeCompare(i2.name, undefined, baseSensitivity) || - i1.name.localeCompare(i2.name); + ts.compareStringsCaseInsensitive(i1.name, i2.name) || + ts.compareStrings(i1.name, i2.name); } function createNavigateToItem(rawItem) { var declaration = rawItem.declaration; @@ -47582,6 +71939,13 @@ var ts; return result; } NavigationBar.getNavigationBarItems = getNavigationBarItems; + function getNavigationTree(sourceFile) { + curSourceFile = sourceFile; + var result = convertToTree(rootNavigationBarNode(sourceFile)); + curSourceFile = undefined; + return result; + } + NavigationBar.getNavigationTree = getNavigationTree; // Keep sourceFile handy so we don't have to search for it every time we need to call `getText`. var curSourceFile; function nodeText(node) { @@ -47659,7 +72023,7 @@ var ts; return; } switch (node.kind) { - case 148 /* Constructor */: + case 150 /* Constructor */: // Get parameter properties, and treat them as being on the *same* level as the constructor, not under it. var ctr = node; addNodeWithRecursiveChild(ctr, ctr.body); @@ -47671,21 +72035,21 @@ var ts; } } break; - case 147 /* MethodDeclaration */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - case 146 /* MethodSignature */: + case 149 /* MethodDeclaration */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + case 148 /* MethodSignature */: if (!ts.hasDynamicName(node)) { addNodeWithRecursiveChild(node, node.body); } break; - case 145 /* PropertyDeclaration */: - case 144 /* PropertySignature */: + case 147 /* PropertyDeclaration */: + case 146 /* PropertySignature */: if (!ts.hasDynamicName(node)) { addLeafNode(node); } break; - case 231 /* ImportClause */: + case 236 /* ImportClause */: var importClause = node; // Handle default import case e.g.: // import d from "mod"; @@ -47697,7 +72061,7 @@ var ts; // import {a, b as B} from "mod"; var namedBindings = importClause.namedBindings; if (namedBindings) { - if (namedBindings.kind === 232 /* NamespaceImport */) { + if (namedBindings.kind === 237 /* NamespaceImport */) { addLeafNode(namedBindings); } else { @@ -47708,12 +72072,12 @@ var ts; } } break; - case 169 /* BindingElement */: - case 218 /* VariableDeclaration */: + case 174 /* BindingElement */: + case 223 /* VariableDeclaration */: var decl = node; - var name_38 = decl.name; - if (ts.isBindingPattern(name_38)) { - addChildrenRecursively(name_38); + var name_49 = decl.name; + if (ts.isBindingPattern(name_49)) { + addChildrenRecursively(name_49); } else if (decl.initializer && isFunctionOrClassExpression(decl.initializer)) { // For `const x = function() {}`, just use the function node, not the const. @@ -47723,12 +72087,12 @@ var ts; addNodeWithRecursiveChild(decl, decl.initializer); } break; - case 180 /* ArrowFunction */: - case 220 /* FunctionDeclaration */: - case 179 /* FunctionExpression */: + case 185 /* ArrowFunction */: + case 225 /* FunctionDeclaration */: + case 184 /* FunctionExpression */: addNodeWithRecursiveChild(node, node.body); break; - case 224 /* EnumDeclaration */: + case 229 /* EnumDeclaration */: startNode(node); for (var _d = 0, _e = node.members; _d < _e.length; _d++) { var member = _e[_d]; @@ -47738,9 +72102,9 @@ var ts; } endNode(); break; - case 221 /* ClassDeclaration */: - case 192 /* ClassExpression */: - case 222 /* InterfaceDeclaration */: + case 226 /* ClassDeclaration */: + case 197 /* ClassExpression */: + case 227 /* InterfaceDeclaration */: startNode(node); for (var _f = 0, _g = node.members; _f < _g.length; _f++) { var member = _g[_f]; @@ -47748,29 +72112,25 @@ var ts; } endNode(); break; - case 225 /* ModuleDeclaration */: + case 230 /* ModuleDeclaration */: addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; - case 238 /* ExportSpecifier */: - case 229 /* ImportEqualsDeclaration */: - case 153 /* IndexSignature */: - case 151 /* CallSignature */: - case 152 /* ConstructSignature */: - case 223 /* TypeAliasDeclaration */: + case 243 /* ExportSpecifier */: + case 234 /* ImportEqualsDeclaration */: + case 155 /* IndexSignature */: + case 153 /* CallSignature */: + case 154 /* ConstructSignature */: + case 228 /* TypeAliasDeclaration */: addLeafNode(node); break; default: - if (node.jsDocComments) { - for (var _h = 0, _j = node.jsDocComments; _h < _j.length; _h++) { - var jsDocComment = _j[_h]; - for (var _k = 0, _l = jsDocComment.tags; _k < _l.length; _k++) { - var tag = _l[_k]; - if (tag.kind === 279 /* JSDocTypedefTag */) { - addLeafNode(tag); - } + ts.forEach(node.jsDoc, function (jsDoc) { + ts.forEach(jsDoc.tags, function (tag) { + if (tag.kind === 285 /* JSDocTypedefTag */) { + addLeafNode(tag); } - } - } + }); + }); ts.forEachChild(node, addChildrenRecursively); } } @@ -47817,14 +72177,14 @@ var ts; }); /** a and b have the same name, but they may not be mergeable. */ function shouldReallyMerge(a, b) { - return a.kind === b.kind && (a.kind !== 225 /* ModuleDeclaration */ || areSameModule(a, b)); + return a.kind === b.kind && (a.kind !== 230 /* ModuleDeclaration */ || areSameModule(a, b)); // We use 1 NavNode to represent 'A.B.C', but there are multiple source nodes. // Only merge module nodes that have the same chain. Don't merge 'A.B.C' with 'A'! function areSameModule(a, b) { if (a.body.kind !== b.body.kind) { return false; } - if (a.body.kind !== 225 /* ModuleDeclaration */) { + if (a.body.kind !== 230 /* ModuleDeclaration */) { return true; } return areSameModule(a.body, b.body); @@ -47859,11 +72219,9 @@ var ts; return name1 ? 1 : name2 ? -1 : navigationBarNodeKind(child1) - navigationBarNodeKind(child2); } } - // More efficient to create a collator once and use its `compare` than to call `a.localeCompare(b)` many times. - var collator = typeof Intl === "undefined" ? undefined : new Intl.Collator(); // Intl is missing in Safari, and node 0.10 treats "a" as greater than "B". - var localeCompareIsCorrect = collator && collator.compare("a", "B") < 0; - var localeCompareFix = localeCompareIsCorrect ? collator.compare : function (a, b) { + var localeCompareIsCorrect = ts.collator && ts.collator.compare("a", "B") < 0; + var localeCompareFix = localeCompareIsCorrect ? ts.collator.compare : function (a, b) { // This isn't perfect, but it passes all of our tests. for (var i = 0; i < Math.min(a.length, b.length); i++) { var chA = a.charAt(i), chB = b.charAt(i); @@ -47873,7 +72231,7 @@ var ts; if (chA === "'" && chB === "\"") { return -1; } - var cmp = chA.toLocaleLowerCase().localeCompare(chB.toLocaleLowerCase()); + var cmp = ts.compareStrings(chA.toLocaleLowerCase(), chB.toLocaleLowerCase()); if (cmp !== 0) { return cmp; } @@ -47886,7 +72244,7 @@ var ts; * So `new()` can still come before an `aardvark` method. */ function tryGetName(node) { - if (node.kind === 225 /* ModuleDeclaration */) { + if (node.kind === 230 /* ModuleDeclaration */) { return getModuleName(node); } var decl = node; @@ -47894,18 +72252,18 @@ var ts; return ts.getPropertyNameForPropertyNameNode(decl.name); } switch (node.kind) { - case 179 /* FunctionExpression */: - case 180 /* ArrowFunction */: - case 192 /* ClassExpression */: + case 184 /* FunctionExpression */: + case 185 /* ArrowFunction */: + case 197 /* ClassExpression */: return getFunctionOrClassName(node); - case 279 /* JSDocTypedefTag */: + case 285 /* JSDocTypedefTag */: return getJSDocTypedefTagName(node); default: return undefined; } } function getItemName(node) { - if (node.kind === 225 /* ModuleDeclaration */) { + if (node.kind === 230 /* ModuleDeclaration */) { return getModuleName(node); } var name = node.name; @@ -47916,29 +72274,32 @@ var ts; } } switch (node.kind) { - case 256 /* SourceFile */: + case 261 /* SourceFile */: var sourceFile = node; return ts.isExternalModule(sourceFile) ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\"" : ""; - case 180 /* ArrowFunction */: - case 220 /* FunctionDeclaration */: - case 179 /* FunctionExpression */: - case 221 /* ClassDeclaration */: - case 192 /* ClassExpression */: - if (node.flags & 512 /* Default */) { + case 185 /* ArrowFunction */: + case 225 /* FunctionDeclaration */: + case 184 /* FunctionExpression */: + case 226 /* ClassDeclaration */: + case 197 /* ClassExpression */: + if (ts.getModifierFlags(node) & 512 /* Default */) { return "default"; } + // We may get a string with newlines or other whitespace in the case of an object dereference + // (eg: "app\n.onactivated"), so we should remove the whitespace for readabiltiy in the + // navigation bar. return getFunctionOrClassName(node); - case 148 /* Constructor */: + case 150 /* Constructor */: return "constructor"; - case 152 /* ConstructSignature */: + case 154 /* ConstructSignature */: return "new()"; - case 151 /* CallSignature */: + case 153 /* CallSignature */: return "()"; - case 153 /* IndexSignature */: + case 155 /* IndexSignature */: return "[]"; - case 279 /* JSDocTypedefTag */: + case 285 /* JSDocTypedefTag */: return getJSDocTypedefTagName(node); default: return ""; @@ -47950,10 +72311,10 @@ var ts; } else { var parentNode = node.parent && node.parent.parent; - if (parentNode && parentNode.kind === 200 /* VariableStatement */) { + if (parentNode && parentNode.kind === 205 /* VariableStatement */) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; - if (nameIdentifier.kind === 69 /* Identifier */) { + if (nameIdentifier.kind === 70 /* Identifier */) { return nameIdentifier.text; } } @@ -47979,23 +72340,24 @@ var ts; return topLevel; function isTopLevel(item) { switch (navigationBarNodeKind(item)) { - case 221 /* ClassDeclaration */: - case 192 /* ClassExpression */: - case 224 /* EnumDeclaration */: - case 222 /* InterfaceDeclaration */: - case 225 /* ModuleDeclaration */: - case 256 /* SourceFile */: - case 223 /* TypeAliasDeclaration */: - case 279 /* JSDocTypedefTag */: + case 226 /* ClassDeclaration */: + case 197 /* ClassExpression */: + case 229 /* EnumDeclaration */: + case 227 /* InterfaceDeclaration */: + case 230 /* ModuleDeclaration */: + case 261 /* SourceFile */: + case 228 /* TypeAliasDeclaration */: + case 285 /* JSDocTypedefTag */: return true; - case 148 /* Constructor */: - case 147 /* MethodDeclaration */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: + case 150 /* Constructor */: + case 149 /* MethodDeclaration */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + case 223 /* VariableDeclaration */: return hasSomeImportantChild(item); - case 180 /* ArrowFunction */: - case 220 /* FunctionDeclaration */: - case 179 /* FunctionExpression */: + case 185 /* ArrowFunction */: + case 225 /* FunctionDeclaration */: + case 184 /* FunctionExpression */: return isTopLevelFunctionDeclaration(item); default: return false; @@ -48005,10 +72367,10 @@ var ts; return false; } switch (navigationBarNodeKind(item.parent)) { - case 226 /* ModuleBlock */: - case 256 /* SourceFile */: - case 147 /* MethodDeclaration */: - case 148 /* Constructor */: + case 231 /* ModuleBlock */: + case 261 /* SourceFile */: + case 149 /* MethodDeclaration */: + case 150 /* Constructor */: return true; default: return hasSomeImportantChild(item); @@ -48017,13 +72379,22 @@ var ts; function hasSomeImportantChild(item) { return ts.forEach(item.children, function (child) { var childKind = navigationBarNodeKind(child); - return childKind !== 218 /* VariableDeclaration */ && childKind !== 169 /* BindingElement */; + return childKind !== 223 /* VariableDeclaration */ && childKind !== 174 /* BindingElement */; }); } } } // NavigationBarItem requires an array, but will not mutate it, so just give it this for performance. var emptyChildItemArray = []; + function convertToTree(n) { + return { + text: getItemName(n.node), + kind: ts.getNodeKind(n.node), + kindModifiers: ts.getNodeModifiers(n.node), + spans: getSpans(n), + childItems: ts.map(n.children, convertToTree) + }; + } function convertToTopLevelItem(n) { return { text: getItemName(n.node), @@ -48047,16 +72418,16 @@ var ts; grayed: false }; } - function getSpans(n) { - var spans = [getNodeSpan(n.node)]; - if (n.additionalNodes) { - for (var _i = 0, _a = n.additionalNodes; _i < _a.length; _i++) { - var node = _a[_i]; - spans.push(getNodeSpan(node)); - } + } + function getSpans(n) { + var spans = [getNodeSpan(n.node)]; + if (n.additionalNodes) { + for (var _i = 0, _a = n.additionalNodes; _i < _a.length; _i++) { + var node = _a[_i]; + spans.push(getNodeSpan(node)); } - return spans; } + return spans; } function getModuleName(moduleDeclaration) { // We want to maintain quotation marks. @@ -48066,7 +72437,7 @@ var ts; // Otherwise, we need to aggregate each identifier to build up the qualified name. var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 225 /* ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 230 /* ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -48077,13 +72448,13 @@ var ts; * We store 'A' as associated with a NavNode, and use getModuleName to traverse down again. */ function getInteriorModule(decl) { - return decl.body.kind === 225 /* ModuleDeclaration */ ? getInteriorModule(decl.body) : decl; + return decl.body.kind === 230 /* ModuleDeclaration */ ? getInteriorModule(decl.body) : decl; } function isComputedProperty(member) { - return !member.name || member.name.kind === 140 /* ComputedPropertyName */; + return !member.name || member.name.kind === 142 /* ComputedPropertyName */; } function getNodeSpan(node) { - return node.kind === 256 /* SourceFile */ + return node.kind === 261 /* SourceFile */ ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(curSourceFile), node.getEnd()); } @@ -48091,17 +72462,17 @@ var ts; if (node.name && ts.getFullWidth(node.name) > 0) { return ts.declarationNameToString(node.name); } - else if (node.parent.kind === 218 /* VariableDeclaration */) { + else if (node.parent.kind === 223 /* VariableDeclaration */) { return ts.declarationNameToString(node.parent.name); } - else if (node.parent.kind === 187 /* BinaryExpression */ && - node.parent.operatorToken.kind === 56 /* EqualsToken */) { - return nodeText(node.parent.left); + else if (node.parent.kind === 192 /* BinaryExpression */ && + node.parent.operatorToken.kind === 57 /* EqualsToken */) { + return nodeText(node.parent.left).replace(whiteSpaceRegex, ""); } - else if (node.parent.kind === 253 /* PropertyAssignment */ && node.parent.name) { + else if (node.parent.kind === 257 /* PropertyAssignment */ && node.parent.name) { return nodeText(node.parent.name); } - else if (node.flags & 512 /* Default */) { + else if (ts.getModifierFlags(node) & 512 /* Default */) { return "default"; } else { @@ -48109,21 +72480,197 @@ var ts; } } function isFunctionOrClassExpression(node) { - return node.kind === 179 /* FunctionExpression */ || node.kind === 180 /* ArrowFunction */ || node.kind === 192 /* ClassExpression */; + return node.kind === 184 /* FunctionExpression */ || node.kind === 185 /* ArrowFunction */ || node.kind === 197 /* ClassExpression */; } + /** + * Matches all whitespace characters in a string. Eg: + * + * "app. + * + * onactivated" + * + * matches because of the newline, whereas + * + * "app.onactivated" + * + * does not match. + */ + var whiteSpaceRegex = /\s+/g; })(NavigationBar = ts.NavigationBar || (ts.NavigationBar = {})); })(ts || (ts = {})); /* @internal */ var ts; +(function (ts) { + var OutliningElementsCollector; + (function (OutliningElementsCollector) { + function collectElements(sourceFile) { + var elements = []; + var collapseText = "..."; + function addOutliningSpan(hintSpanNode, startElement, endElement, autoCollapse) { + if (hintSpanNode && startElement && endElement) { + var span_12 = { + textSpan: ts.createTextSpanFromBounds(startElement.pos, endElement.end), + hintSpan: ts.createTextSpanFromBounds(hintSpanNode.getStart(), hintSpanNode.end), + bannerText: collapseText, + autoCollapse: autoCollapse + }; + elements.push(span_12); + } + } + function addOutliningSpanComments(commentSpan, autoCollapse) { + if (commentSpan) { + var span_13 = { + textSpan: ts.createTextSpanFromBounds(commentSpan.pos, commentSpan.end), + hintSpan: ts.createTextSpanFromBounds(commentSpan.pos, commentSpan.end), + bannerText: collapseText, + autoCollapse: autoCollapse + }; + elements.push(span_13); + } + } + function addOutliningForLeadingCommentsForNode(n) { + var comments = ts.getLeadingCommentRangesOfNode(n, sourceFile); + if (comments) { + var firstSingleLineCommentStart = -1; + var lastSingleLineCommentEnd = -1; + var isFirstSingleLineComment = true; + var singleLineCommentCount = 0; + for (var _i = 0, comments_4 = comments; _i < comments_4.length; _i++) { + var currentComment = comments_4[_i]; + // For single line comments, combine consecutive ones (2 or more) into + // a single span from the start of the first till the end of the last + if (currentComment.kind === 2 /* SingleLineCommentTrivia */) { + if (isFirstSingleLineComment) { + firstSingleLineCommentStart = currentComment.pos; + } + isFirstSingleLineComment = false; + lastSingleLineCommentEnd = currentComment.end; + singleLineCommentCount++; + } + else if (currentComment.kind === 3 /* MultiLineCommentTrivia */) { + combineAndAddMultipleSingleLineComments(singleLineCommentCount, firstSingleLineCommentStart, lastSingleLineCommentEnd); + addOutliningSpanComments(currentComment, /*autoCollapse*/ false); + singleLineCommentCount = 0; + lastSingleLineCommentEnd = -1; + isFirstSingleLineComment = true; + } + } + combineAndAddMultipleSingleLineComments(singleLineCommentCount, firstSingleLineCommentStart, lastSingleLineCommentEnd); + } + } + function combineAndAddMultipleSingleLineComments(count, start, end) { + // Only outline spans of two or more consecutive single line comments + if (count > 1) { + var multipleSingleLineComments = { + pos: start, + end: end, + kind: 2 /* SingleLineCommentTrivia */ + }; + addOutliningSpanComments(multipleSingleLineComments, /*autoCollapse*/ false); + } + } + function autoCollapse(node) { + return ts.isFunctionBlock(node) && node.parent.kind !== 185 /* ArrowFunction */; + } + var depth = 0; + var maxDepth = 20; + function walk(n) { + if (depth > maxDepth) { + return; + } + if (ts.isDeclaration(n)) { + addOutliningForLeadingCommentsForNode(n); + } + switch (n.kind) { + case 204 /* Block */: + if (!ts.isFunctionBlock(n)) { + var parent_20 = 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)); + break; + } + if (parent_20.kind === 221 /* TryStatement */) { + // Could be the try-block, or the finally-block. + var tryStatement = parent_20; + if (tryStatement.tryBlock === n) { + addOutliningSpan(parent_20, openBrace, closeBrace, autoCollapse(n)); + break; + } + else if (tryStatement.finallyBlock === n) { + var finallyKeyword = ts.findChildOfKind(tryStatement, 86 /* FinallyKeyword */, sourceFile); + if (finallyKeyword) { + addOutliningSpan(finallyKeyword, openBrace, closeBrace, autoCollapse(n)); + break; + } + } + } + // Block was a standalone block. In this case we want to only collapse + // the span of the block, independent of any parent span. + var span_14 = ts.createTextSpanFromBounds(n.getStart(), n.end); + elements.push({ + textSpan: span_14, + hintSpan: span_14, + bannerText: collapseText, + autoCollapse: autoCollapse(n) + }); + break; + } + // Fallthrough. + case 231 /* ModuleBlock */: { + var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile); + var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile); + addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); + break; + } + case 226 /* ClassDeclaration */: + case 227 /* InterfaceDeclaration */: + case 229 /* EnumDeclaration */: + case 176 /* ObjectLiteralExpression */: + case 232 /* CaseBlock */: { + var openBrace = ts.findChildOfKind(n, 16 /* OpenBraceToken */, sourceFile); + var closeBrace = ts.findChildOfKind(n, 17 /* CloseBraceToken */, sourceFile); + addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); + break; + } + case 175 /* ArrayLiteralExpression */: + var openBracket = ts.findChildOfKind(n, 20 /* OpenBracketToken */, sourceFile); + var closeBracket = ts.findChildOfKind(n, 21 /* CloseBracketToken */, sourceFile); + addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); + break; + } + depth++; + ts.forEachChild(n, walk); + depth--; + } + walk(sourceFile); + return elements; + } + OutliningElementsCollector.collectElements = collectElements; + })(OutliningElementsCollector = ts.OutliningElementsCollector || (ts.OutliningElementsCollector = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; (function (ts) { // Note(cyrusn): this enum is ordered from strongest match type to weakest match type. + var PatternMatchKind; (function (PatternMatchKind) { PatternMatchKind[PatternMatchKind["exact"] = 0] = "exact"; PatternMatchKind[PatternMatchKind["prefix"] = 1] = "prefix"; PatternMatchKind[PatternMatchKind["substring"] = 2] = "substring"; PatternMatchKind[PatternMatchKind["camelCase"] = 3] = "camelCase"; - })(ts.PatternMatchKind || (ts.PatternMatchKind = {})); - var PatternMatchKind = ts.PatternMatchKind; + })(PatternMatchKind = ts.PatternMatchKind || (ts.PatternMatchKind = {})); function createPatternMatch(kind, punctuationStripped, isCaseSensitive, camelCaseWeight) { return { kind: kind, @@ -48224,10 +72771,10 @@ var ts; // But we would match 'FooAttribute' (since 'Attribute' starts with 'a'). var wordSpans = getWordSpans(candidate); for (var _i = 0, wordSpans_1 = wordSpans; _i < wordSpans_1.length; _i++) { - var span = wordSpans_1[_i]; - if (partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ true)) { - return createPatternMatch(PatternMatchKind.substring, punctuationStripped, - /*isCaseSensitive:*/ partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ false)); + var span_15 = wordSpans_1[_i]; + if (partStartsWith(candidate, span_15, chunk.text, /*ignoreCase:*/ true)) { + return createPatternMatch(PatternMatchKind.substring, punctuationStripped, + /*isCaseSensitive:*/ partStartsWith(candidate, span_15, chunk.text, /*ignoreCase:*/ false)); } } } @@ -48454,7 +73001,7 @@ var ts; if (ch >= 65 /* A */ && ch <= 90 /* Z */) { return true; } - if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 2 /* Latest */)) { + if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 5 /* Latest */)) { return false; } // TODO: find a way to determine this for any unicode characters in a @@ -48467,7 +73014,7 @@ var ts; if (ch >= 97 /* a */ && ch <= 122 /* z */) { return true; } - if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 2 /* Latest */)) { + if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 5 /* Latest */)) { return false; } // TODO: find a way to determine this for any unicode characters in a @@ -48672,6 +73219,434 @@ var ts; return transition; } })(ts || (ts = {})); +var ts; +(function (ts) { + function preProcessFile(sourceText, readImportFiles, detectJavaScriptImports) { + if (readImportFiles === void 0) { readImportFiles = true; } + if (detectJavaScriptImports === void 0) { detectJavaScriptImports = false; } + var referencedFiles = []; + var typeReferenceDirectives = []; + var importedFiles = []; + var ambientExternalModules; + var isNoDefaultLib = false; + var braceNesting = 0; + // assume that text represent an external module if it contains at least one top level import/export + // ambient modules that are found inside external modules are interpreted as module augmentations + var externalModule = false; + function nextToken() { + var token = ts.scanner.scan(); + if (token === 16 /* OpenBraceToken */) { + braceNesting++; + } + else if (token === 17 /* CloseBraceToken */) { + braceNesting--; + } + return token; + } + function processTripleSlashDirectives() { + var commentRanges = ts.getLeadingCommentRanges(sourceText, 0); + ts.forEach(commentRanges, function (commentRange) { + var comment = sourceText.substring(commentRange.pos, commentRange.end); + var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, commentRange); + if (referencePathMatchResult) { + isNoDefaultLib = referencePathMatchResult.isNoDefaultLib; + var fileReference = referencePathMatchResult.fileReference; + if (fileReference) { + var collection = referencePathMatchResult.isTypeReferenceDirective + ? typeReferenceDirectives + : referencedFiles; + collection.push(fileReference); + } + } + }); + } + function getFileReference() { + var file = ts.scanner.getTokenValue(); + var pos = ts.scanner.getTokenPos(); + return { + fileName: file, + pos: pos, + end: pos + file.length + }; + } + function recordAmbientExternalModule() { + if (!ambientExternalModules) { + ambientExternalModules = []; + } + ambientExternalModules.push({ ref: getFileReference(), depth: braceNesting }); + } + function recordModuleName() { + importedFiles.push(getFileReference()); + markAsExternalModuleIfTopLevel(); + } + function markAsExternalModuleIfTopLevel() { + if (braceNesting === 0) { + externalModule = true; + } + } + /** + * Returns true if at least one token was consumed from the stream + */ + function tryConsumeDeclare() { + var token = ts.scanner.getToken(); + if (token === 123 /* DeclareKeyword */) { + // declare module "mod" + token = nextToken(); + if (token === 127 /* ModuleKeyword */) { + token = nextToken(); + if (token === 9 /* StringLiteral */) { + recordAmbientExternalModule(); + } + } + return true; + } + return false; + } + /** + * Returns true if at least one token was consumed from the stream + */ + function tryConsumeImport() { + var token = ts.scanner.getToken(); + if (token === 90 /* ImportKeyword */) { + token = nextToken(); + if (token === 9 /* StringLiteral */) { + // import "mod"; + recordModuleName(); + return true; + } + else { + if (token === 70 /* Identifier */ || ts.isKeyword(token)) { + token = nextToken(); + if (token === 138 /* FromKeyword */) { + token = nextToken(); + if (token === 9 /* StringLiteral */) { + // import d from "mod"; + recordModuleName(); + return true; + } + } + else if (token === 57 /* EqualsToken */) { + if (tryConsumeRequireCall(/*skipCurrentToken*/ true)) { + return true; + } + } + else if (token === 25 /* CommaToken */) { + // consume comma and keep going + token = nextToken(); + } + else { + // unknown syntax + return true; + } + } + if (token === 16 /* OpenBraceToken */) { + token = nextToken(); + // consume "{ a as B, c, d as D}" clauses + // make sure that it stops on EOF + while (token !== 17 /* CloseBraceToken */ && token !== 1 /* EndOfFileToken */) { + token = nextToken(); + } + if (token === 17 /* CloseBraceToken */) { + token = nextToken(); + if (token === 138 /* FromKeyword */) { + token = nextToken(); + if (token === 9 /* StringLiteral */) { + // import {a as A} from "mod"; + // import d, {a, b as B} from "mod" + recordModuleName(); + } + } + } + } + else if (token === 38 /* AsteriskToken */) { + token = nextToken(); + if (token === 117 /* AsKeyword */) { + token = nextToken(); + if (token === 70 /* Identifier */ || ts.isKeyword(token)) { + token = nextToken(); + if (token === 138 /* FromKeyword */) { + token = nextToken(); + if (token === 9 /* StringLiteral */) { + // import * as NS from "mod" + // import d, * as NS from "mod" + recordModuleName(); + } + } + } + } + } + } + return true; + } + return false; + } + function tryConsumeExport() { + var token = ts.scanner.getToken(); + if (token === 83 /* ExportKeyword */) { + markAsExternalModuleIfTopLevel(); + token = nextToken(); + if (token === 16 /* OpenBraceToken */) { + token = nextToken(); + // consume "{ a as B, c, d as D}" clauses + // make sure it stops on EOF + while (token !== 17 /* CloseBraceToken */ && token !== 1 /* EndOfFileToken */) { + token = nextToken(); + } + if (token === 17 /* CloseBraceToken */) { + token = nextToken(); + if (token === 138 /* FromKeyword */) { + token = nextToken(); + if (token === 9 /* StringLiteral */) { + // export {a as A} from "mod"; + // export {a, b as B} from "mod" + recordModuleName(); + } + } + } + } + else if (token === 38 /* AsteriskToken */) { + token = nextToken(); + if (token === 138 /* FromKeyword */) { + token = nextToken(); + if (token === 9 /* StringLiteral */) { + // export * from "mod" + recordModuleName(); + } + } + } + else if (token === 90 /* ImportKeyword */) { + token = nextToken(); + if (token === 70 /* Identifier */ || ts.isKeyword(token)) { + token = nextToken(); + if (token === 57 /* EqualsToken */) { + if (tryConsumeRequireCall(/*skipCurrentToken*/ true)) { + return true; + } + } + } + } + return true; + } + return false; + } + function tryConsumeRequireCall(skipCurrentToken) { + var token = skipCurrentToken ? nextToken() : ts.scanner.getToken(); + if (token === 131 /* RequireKeyword */) { + token = nextToken(); + if (token === 18 /* OpenParenToken */) { + token = nextToken(); + if (token === 9 /* StringLiteral */) { + // require("mod"); + recordModuleName(); + } + } + return true; + } + return false; + } + function tryConsumeDefine() { + var token = ts.scanner.getToken(); + if (token === 70 /* Identifier */ && ts.scanner.getTokenValue() === "define") { + token = nextToken(); + if (token !== 18 /* OpenParenToken */) { + return true; + } + token = nextToken(); + if (token === 9 /* StringLiteral */) { + // looks like define ("modname", ... - skip string literal and comma + token = nextToken(); + if (token === 25 /* CommaToken */) { + token = nextToken(); + } + else { + // unexpected token + return true; + } + } + // should be start of dependency list + if (token !== 20 /* OpenBracketToken */) { + return true; + } + // skip open bracket + token = nextToken(); + var i = 0; + // scan until ']' or EOF + while (token !== 21 /* CloseBracketToken */ && token !== 1 /* EndOfFileToken */) { + // record string literals as module names + if (token === 9 /* StringLiteral */) { + recordModuleName(); + i++; + } + token = nextToken(); + } + return true; + } + return false; + } + function processImports() { + ts.scanner.setText(sourceText); + nextToken(); + // Look for: + // import "mod"; + // import d from "mod" + // import {a as A } from "mod"; + // import * as NS from "mod" + // import d, {a, b as B} from "mod" + // import i = require("mod"); + // + // export * from "mod" + // export {a as b} from "mod" + // export import i = require("mod") + // (for JavaScript files) require("mod") + while (true) { + if (ts.scanner.getToken() === 1 /* EndOfFileToken */) { + break; + } + // check if at least one of alternative have moved scanner forward + if (tryConsumeDeclare() || + tryConsumeImport() || + tryConsumeExport() || + (detectJavaScriptImports && (tryConsumeRequireCall(/*skipCurrentToken*/ false) || tryConsumeDefine()))) { + continue; + } + else { + nextToken(); + } + } + ts.scanner.setText(undefined); + } + if (readImportFiles) { + processImports(); + } + processTripleSlashDirectives(); + if (externalModule) { + // for external modules module all nested ambient modules are augmentations + if (ambientExternalModules) { + // move all detected ambient modules to imported files since they need to be resolved + for (var _i = 0, ambientExternalModules_1 = ambientExternalModules; _i < ambientExternalModules_1.length; _i++) { + var decl = ambientExternalModules_1[_i]; + importedFiles.push(decl.ref); + } + } + return { referencedFiles: referencedFiles, typeReferenceDirectives: typeReferenceDirectives, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: undefined }; + } + else { + // for global scripts ambient modules still can have augmentations - look for ambient modules with depth > 0 + var ambientModuleNames = void 0; + if (ambientExternalModules) { + for (var _a = 0, ambientExternalModules_2 = ambientExternalModules; _a < ambientExternalModules_2.length; _a++) { + var decl = ambientExternalModules_2[_a]; + if (decl.depth === 0) { + if (!ambientModuleNames) { + ambientModuleNames = []; + } + ambientModuleNames.push(decl.ref.fileName); + } + else { + importedFiles.push(decl.ref); + } + } + } + return { referencedFiles: referencedFiles, typeReferenceDirectives: typeReferenceDirectives, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: ambientModuleNames }; + } + } + ts.preProcessFile = preProcessFile; +})(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var Rename; + (function (Rename) { + function getRenameInfo(typeChecker, defaultLibFileName, getCanonicalFileName, sourceFile, position) { + var canonicalDefaultLibName = getCanonicalFileName(ts.normalizePath(defaultLibFileName)); + var node = ts.getTouchingWord(sourceFile, position, /*includeJsDocComment*/ true); + if (node) { + if (node.kind === 70 /* Identifier */ || + node.kind === 9 /* StringLiteral */ || + ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || + ts.isThis(node)) { + var symbol = typeChecker.getSymbolAtLocation(node); + // Only allow a symbol to be renamed if it actually has at least one declaration. + if (symbol) { + var declarations = symbol.getDeclarations(); + if (declarations && declarations.length > 0) { + // Disallow rename for elements that are defined in the standard TypeScript library. + if (ts.forEach(declarations, isDefinedInLibraryFile)) { + return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); + } + var displayName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); + var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node); + if (kind) { + return { + canRename: true, + kind: kind, + displayName: displayName, + localizedErrorMessage: undefined, + fullDisplayName: typeChecker.getFullyQualifiedName(symbol), + kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), + triggerSpan: createTriggerSpanForNode(node, sourceFile) + }; + } + } + } + else if (node.kind === 9 /* StringLiteral */) { + var type = ts.getStringLiteralTypeForNode(node, typeChecker); + if (type) { + if (isDefinedInLibraryFile(node)) { + return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); + } + else { + var displayName = ts.stripQuotes(type.text); + return { + canRename: true, + kind: ts.ScriptElementKind.variableElement, + displayName: displayName, + localizedErrorMessage: undefined, + fullDisplayName: displayName, + kindModifiers: ts.ScriptElementKindModifier.none, + triggerSpan: createTriggerSpanForNode(node, sourceFile) + }; + } + } + } + } + } + return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_this_element)); + function getRenameInfoError(localizedErrorMessage) { + return { + canRename: false, + localizedErrorMessage: localizedErrorMessage, + displayName: undefined, + fullDisplayName: undefined, + kind: undefined, + kindModifiers: undefined, + triggerSpan: undefined + }; + } + function isDefinedInLibraryFile(declaration) { + if (defaultLibFileName) { + var sourceFile_1 = declaration.getSourceFile(); + var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile_1.fileName)); + if (canonicalName === canonicalDefaultLibName) { + return true; + } + } + return false; + } + function createTriggerSpanForNode(node, sourceFile) { + var start = node.getStart(sourceFile); + var width = node.getWidth(sourceFile); + if (node.kind === 9 /* StringLiteral */) { + // Exclude the quotes + start += 1; + width -= 2; + } + return ts.createTextSpan(start, width); + } + } + Rename.getRenameInfo = getRenameInfo; + })(Rename = ts.Rename || (ts.Rename = {})); +})(ts || (ts = {})); /// /* @internal */ var ts; @@ -48811,12 +73786,12 @@ var ts; // return null; // } var emptyArray = []; + var ArgumentListKind; (function (ArgumentListKind) { ArgumentListKind[ArgumentListKind["TypeArguments"] = 0] = "TypeArguments"; ArgumentListKind[ArgumentListKind["CallArguments"] = 1] = "CallArguments"; ArgumentListKind[ArgumentListKind["TaggedTemplateArguments"] = 2] = "TaggedTemplateArguments"; - })(SignatureHelp.ArgumentListKind || (SignatureHelp.ArgumentListKind = {})); - var ArgumentListKind = SignatureHelp.ArgumentListKind; + })(ArgumentListKind = SignatureHelp.ArgumentListKind || (SignatureHelp.ArgumentListKind = {})); function getSignatureHelpItems(program, sourceFile, position, cancellationToken) { var typeChecker = program.getTypeChecker(); // Decide whether to show signature help @@ -48847,15 +73822,15 @@ var ts; } SignatureHelp.getSignatureHelpItems = getSignatureHelpItems; function createJavaScriptSignatureHelpItems(argumentInfo, program) { - if (argumentInfo.invocation.kind !== 174 /* CallExpression */) { + if (argumentInfo.invocation.kind !== 179 /* CallExpression */) { return undefined; } // See if we can find some symbol with the call expression name that has call signatures. var callExpression = argumentInfo.invocation; var expression = callExpression.expression; - var name = expression.kind === 69 /* Identifier */ + var name = expression.kind === 70 /* Identifier */ ? expression - : expression.kind === 172 /* PropertyAccessExpression */ + : expression.kind === 177 /* PropertyAccessExpression */ ? expression.name : undefined; if (!name || !name.text) { @@ -48867,8 +73842,8 @@ var ts; var nameToDeclarations = sourceFile.getNamedDeclarations(); var declarations = nameToDeclarations[name.text]; if (declarations) { - for (var _b = 0, declarations_8 = declarations; _b < declarations_8.length; _b++) { - var declaration = declarations_8[_b]; + for (var _b = 0, declarations_10 = declarations; _b < declarations_10.length; _b++) { + var declaration = declarations_10[_b]; var symbol = declaration.symbol; if (symbol) { var type = typeChecker.getTypeOfSymbolAtLocation(symbol, declaration); @@ -48888,7 +73863,7 @@ var ts; * in the argument of an invocation; returns undefined otherwise. */ function getImmediatelyContainingArgumentInfo(node, position, sourceFile) { - if (node.parent.kind === 174 /* CallExpression */ || node.parent.kind === 175 /* NewExpression */) { + if (node.parent.kind === 179 /* CallExpression */ || node.parent.kind === 180 /* NewExpression */) { var callExpression = node.parent; // There are 3 cases to handle: // 1. The token introduces a list, and should begin a sig help session @@ -48904,8 +73879,8 @@ var ts; // Case 3: // foo(a#, #b#) -> The token is buried inside a list, and should give sig help // Find out if 'node' is an argument, a type argument, or neither - if (node.kind === 25 /* LessThanToken */ || - node.kind === 17 /* OpenParenToken */) { + if (node.kind === 26 /* LessThanToken */ || + node.kind === 18 /* OpenParenToken */) { // Find the list that starts right *after* the < or ( token. // If the user has just opened a list, consider this item 0. var list = getChildListThatStartsWithOpenerToken(callExpression, node, sourceFile); @@ -48942,27 +73917,27 @@ var ts; } return undefined; } - else if (node.kind === 11 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 176 /* TaggedTemplateExpression */) { + else if (node.kind === 12 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 181 /* TaggedTemplateExpression */) { // Check if we're actually inside the template; // otherwise we'll fall out and return undefined. if (ts.isInsideTemplateLiteral(node, position)) { return getArgumentListInfoForTemplate(node.parent, /*argumentIndex*/ 0, sourceFile); } } - else if (node.kind === 12 /* TemplateHead */ && node.parent.parent.kind === 176 /* TaggedTemplateExpression */) { + else if (node.kind === 13 /* TemplateHead */ && node.parent.parent.kind === 181 /* TaggedTemplateExpression */) { var templateExpression = node.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 189 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 194 /* TemplateExpression */); var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } - else if (node.parent.kind === 197 /* TemplateSpan */ && node.parent.parent.parent.kind === 176 /* TaggedTemplateExpression */) { + else if (node.parent.kind === 202 /* TemplateSpan */ && node.parent.parent.parent.kind === 181 /* TaggedTemplateExpression */) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 189 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 194 /* TemplateExpression */); // If we're just after a template tail, don't show signature help. - if (node.kind === 14 /* TemplateTail */ && !ts.isInsideTemplateLiteral(node, position)) { + if (node.kind === 15 /* TemplateTail */ && !ts.isInsideTemplateLiteral(node, position)) { return undefined; } var spanIndex = templateExpression.templateSpans.indexOf(templateSpan); @@ -48990,7 +73965,7 @@ var ts; if (child === node) { break; } - if (child.kind !== 24 /* CommaToken */) { + if (child.kind !== 25 /* CommaToken */) { argumentIndex++; } } @@ -49009,8 +73984,8 @@ var ts; // That will give us 2 non-commas. We then add one for the last comma, givin us an // arg count of 3. var listChildren = argumentsList.getChildren(); - var argumentCount = ts.countWhere(listChildren, function (arg) { return arg.kind !== 24 /* CommaToken */; }); - if (listChildren.length > 0 && ts.lastOrUndefined(listChildren).kind === 24 /* CommaToken */) { + var argumentCount = ts.countWhere(listChildren, function (arg) { return arg.kind !== 25 /* CommaToken */; }); + if (listChildren.length > 0 && ts.lastOrUndefined(listChildren).kind === 25 /* CommaToken */) { argumentCount++; } return argumentCount; @@ -49040,7 +74015,7 @@ var ts; } function getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile) { // argumentCount is either 1 or (numSpans + 1) to account for the template strings array argument. - var argumentCount = tagExpression.template.kind === 11 /* NoSubstitutionTemplateLiteral */ + var argumentCount = tagExpression.template.kind === 12 /* NoSubstitutionTemplateLiteral */ ? 1 : tagExpression.template.templateSpans.length + 1; ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, "argumentCount < argumentIndex, " + argumentCount + " < " + argumentIndex); @@ -49078,7 +74053,7 @@ var ts; // // This is because a Missing node has no width. However, what we actually want is to include trivia // leading up to the next token in case the user is about to type in a TemplateMiddle or TemplateTail. - if (template.kind === 189 /* TemplateExpression */) { + if (template.kind === 194 /* TemplateExpression */) { var lastSpan = ts.lastOrUndefined(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false); @@ -49087,7 +74062,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node, position, sourceFile) { - for (var n = node; n.kind !== 256 /* SourceFile */; n = n.parent) { + for (var n = node; n.kind !== 261 /* SourceFile */; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -49147,37 +74122,41 @@ var ts; if (callTargetDisplayParts) { ts.addRange(prefixDisplayParts, callTargetDisplayParts); } + var isVariadic; if (isTypeParameterList) { - prefixDisplayParts.push(ts.punctuationPart(25 /* LessThanToken */)); + isVariadic = false; // type parameter lists are not variadic + prefixDisplayParts.push(ts.punctuationPart(26 /* LessThanToken */)); var typeParameters = candidateSignature.typeParameters; signatureHelpParameters = typeParameters && typeParameters.length > 0 ? ts.map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray; - suffixDisplayParts.push(ts.punctuationPart(27 /* GreaterThanToken */)); + suffixDisplayParts.push(ts.punctuationPart(28 /* GreaterThanToken */)); var parameterParts = ts.mapToDisplayParts(function (writer) { return typeChecker.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.thisParameter, candidateSignature.parameters, writer, invocation); }); ts.addRange(suffixDisplayParts, parameterParts); } else { + isVariadic = candidateSignature.hasRestParameter; var typeParameterParts = ts.mapToDisplayParts(function (writer) { return typeChecker.getSymbolDisplayBuilder().buildDisplayForTypeParametersAndDelimiters(candidateSignature.typeParameters, writer, invocation); }); ts.addRange(prefixDisplayParts, typeParameterParts); - prefixDisplayParts.push(ts.punctuationPart(17 /* OpenParenToken */)); + prefixDisplayParts.push(ts.punctuationPart(18 /* OpenParenToken */)); var parameters = candidateSignature.parameters; signatureHelpParameters = parameters.length > 0 ? ts.map(parameters, createSignatureHelpParameterForParameter) : emptyArray; - suffixDisplayParts.push(ts.punctuationPart(18 /* CloseParenToken */)); + suffixDisplayParts.push(ts.punctuationPart(19 /* CloseParenToken */)); } var returnTypeParts = ts.mapToDisplayParts(function (writer) { return typeChecker.getSymbolDisplayBuilder().buildReturnTypeDisplay(candidateSignature, writer, invocation); }); ts.addRange(suffixDisplayParts, returnTypeParts); return { - isVariadic: candidateSignature.hasRestParameter, + isVariadic: isVariadic, prefixDisplayParts: prefixDisplayParts, suffixDisplayParts: suffixDisplayParts, - separatorDisplayParts: [ts.punctuationPart(24 /* CommaToken */), ts.spacePart()], + separatorDisplayParts: [ts.punctuationPart(25 /* CommaToken */), ts.spacePart()], parameters: signatureHelpParameters, - documentation: candidateSignature.getDocumentationComment() + documentation: candidateSignature.getDocumentationComment(), + tags: candidateSignature.getJsDocTags() }; }); var argumentIndex = argumentListInfo.argumentIndex; @@ -49220,1098 +74199,646 @@ var ts; } })(SignatureHelp = ts.SignatureHelp || (ts.SignatureHelp = {})); })(ts || (ts = {})); -// These utilities are common to multiple language service features. /* @internal */ var ts; (function (ts) { - function getLineStartPositionForPosition(position, sourceFile) { - var lineStarts = sourceFile.getLineStarts(); - var line = sourceFile.getLineAndCharacterOfPosition(position).line; - return lineStarts[line]; - } - ts.getLineStartPositionForPosition = getLineStartPositionForPosition; - function rangeContainsRange(r1, r2) { - return startEndContainsRange(r1.pos, r1.end, r2); - } - ts.rangeContainsRange = rangeContainsRange; - function startEndContainsRange(start, end, range) { - return start <= range.pos && end >= range.end; - } - ts.startEndContainsRange = startEndContainsRange; - function rangeContainsStartEnd(range, start, end) { - return range.pos <= start && range.end >= end; - } - ts.rangeContainsStartEnd = rangeContainsStartEnd; - function rangeOverlapsWithStartEnd(r1, start, end) { - return startEndOverlapsWithStartEnd(r1.pos, r1.end, start, end); - } - ts.rangeOverlapsWithStartEnd = rangeOverlapsWithStartEnd; - function startEndOverlapsWithStartEnd(start1, end1, start2, end2) { - var start = Math.max(start1, start2); - var end = Math.min(end1, end2); - return start < end; - } - ts.startEndOverlapsWithStartEnd = startEndOverlapsWithStartEnd; - function positionBelongsToNode(candidate, position, sourceFile) { - return candidate.end > position || !isCompletedNode(candidate, sourceFile); - } - ts.positionBelongsToNode = positionBelongsToNode; - function isCompletedNode(n, sourceFile) { - if (ts.nodeIsMissing(n)) { - return false; - } - switch (n.kind) { - case 221 /* ClassDeclaration */: - case 222 /* InterfaceDeclaration */: - case 224 /* EnumDeclaration */: - case 171 /* ObjectLiteralExpression */: - case 167 /* ObjectBindingPattern */: - case 159 /* TypeLiteral */: - case 199 /* Block */: - case 226 /* ModuleBlock */: - case 227 /* CaseBlock */: - case 233 /* NamedImports */: - case 237 /* NamedExports */: - return nodeEndsWith(n, 16 /* CloseBraceToken */, sourceFile); - case 252 /* CatchClause */: - return isCompletedNode(n.block, sourceFile); - case 175 /* NewExpression */: - if (!n.arguments) { - return true; - } - // fall through - case 174 /* CallExpression */: - case 178 /* ParenthesizedExpression */: - case 164 /* ParenthesizedType */: - return nodeEndsWith(n, 18 /* CloseParenToken */, sourceFile); - case 156 /* FunctionType */: - case 157 /* ConstructorType */: - return isCompletedNode(n.type, sourceFile); - case 148 /* Constructor */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - case 220 /* FunctionDeclaration */: - case 179 /* FunctionExpression */: - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - case 152 /* ConstructSignature */: - case 151 /* CallSignature */: - case 180 /* ArrowFunction */: - if (n.body) { - return isCompletedNode(n.body, sourceFile); - } - if (n.type) { - return isCompletedNode(n.type, sourceFile); - } - // Even though type parameters can be unclosed, we can get away with - // having at least a closing paren. - return hasChildOfKind(n, 18 /* CloseParenToken */, sourceFile); - case 225 /* ModuleDeclaration */: - return n.body && isCompletedNode(n.body, sourceFile); - case 203 /* IfStatement */: - if (n.elseStatement) { - return isCompletedNode(n.elseStatement, sourceFile); - } - return isCompletedNode(n.thenStatement, sourceFile); - case 202 /* ExpressionStatement */: - return isCompletedNode(n.expression, sourceFile) || - hasChildOfKind(n, 23 /* SemicolonToken */); - case 170 /* ArrayLiteralExpression */: - case 168 /* ArrayBindingPattern */: - case 173 /* ElementAccessExpression */: - case 140 /* ComputedPropertyName */: - case 161 /* TupleType */: - return nodeEndsWith(n, 20 /* CloseBracketToken */, sourceFile); - case 153 /* IndexSignature */: - if (n.type) { - return isCompletedNode(n.type, sourceFile); - } - return hasChildOfKind(n, 20 /* CloseBracketToken */, sourceFile); - case 249 /* CaseClause */: - case 250 /* DefaultClause */: - // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed - return false; - case 206 /* ForStatement */: - case 207 /* ForInStatement */: - case 208 /* ForOfStatement */: - case 205 /* WhileStatement */: - return isCompletedNode(n.statement, sourceFile); - case 204 /* DoStatement */: - // rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')'; - var hasWhileKeyword = findChildOfKind(n, 104 /* WhileKeyword */, sourceFile); - if (hasWhileKeyword) { - return nodeEndsWith(n, 18 /* CloseParenToken */, sourceFile); - } - return isCompletedNode(n.statement, sourceFile); - case 158 /* TypeQuery */: - return isCompletedNode(n.exprName, sourceFile); - case 182 /* TypeOfExpression */: - case 181 /* DeleteExpression */: - case 183 /* VoidExpression */: - case 190 /* YieldExpression */: - case 191 /* SpreadElementExpression */: - var unaryWordExpression = n; - return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 176 /* TaggedTemplateExpression */: - return isCompletedNode(n.template, sourceFile); - case 189 /* TemplateExpression */: - var lastSpan = ts.lastOrUndefined(n.templateSpans); - return isCompletedNode(lastSpan, sourceFile); - case 197 /* TemplateSpan */: - return ts.nodeIsPresent(n.literal); - case 236 /* ExportDeclaration */: - case 230 /* ImportDeclaration */: - return ts.nodeIsPresent(n.moduleSpecifier); - case 185 /* PrefixUnaryExpression */: - return isCompletedNode(n.operand, sourceFile); - case 187 /* BinaryExpression */: - return isCompletedNode(n.right, sourceFile); - case 188 /* ConditionalExpression */: - return isCompletedNode(n.whenFalse, sourceFile); - default: - return true; - } - } - ts.isCompletedNode = isCompletedNode; - /* - * Checks if node ends with 'expectedLastToken'. - * If child at position 'length - 1' is 'SemicolonToken' it is skipped and 'expectedLastToken' is compared with child at position 'length - 2'. - */ - function nodeEndsWith(n, expectedLastToken, sourceFile) { - var children = n.getChildren(sourceFile); - if (children.length) { - var last = ts.lastOrUndefined(children); - if (last.kind === expectedLastToken) { - return true; - } - else if (last.kind === 23 /* SemicolonToken */ && children.length !== 1) { - return children[children.length - 2].kind === expectedLastToken; + var SymbolDisplay; + (function (SymbolDisplay) { + // TODO(drosen): use contextual SemanticMeaning. + function getSymbolKind(typeChecker, symbol, location) { + var flags = symbol.getFlags(); + if (flags & 32 /* Class */) + return ts.getDeclarationOfKind(symbol, 197 /* ClassExpression */) ? + ts.ScriptElementKind.localClassElement : ts.ScriptElementKind.classElement; + if (flags & 384 /* Enum */) + return ts.ScriptElementKind.enumElement; + if (flags & 524288 /* TypeAlias */) + return ts.ScriptElementKind.typeElement; + if (flags & 64 /* Interface */) + return ts.ScriptElementKind.interfaceElement; + if (flags & 262144 /* TypeParameter */) + return ts.ScriptElementKind.typeParameterElement; + var result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, flags, location); + if (result === ts.ScriptElementKind.unknown) { + if (flags & 262144 /* TypeParameter */) + return ts.ScriptElementKind.typeParameterElement; + if (flags & 8 /* EnumMember */) + return ts.ScriptElementKind.variableElement; + if (flags & 8388608 /* Alias */) + return ts.ScriptElementKind.alias; + if (flags & 1536 /* Module */) + return ts.ScriptElementKind.moduleElement; } + return result; } - return false; - } - function findListItemInfo(node) { - var list = findContainingList(node); - // It is possible at this point for syntaxList to be undefined, either if - // node.parent had no list child, or if none of its list children contained - // the span of node. If this happens, return undefined. The caller should - // handle this case. - if (!list) { - return undefined; - } - var children = list.getChildren(); - var listItemIndex = ts.indexOf(children, node); - return { - listItemIndex: listItemIndex, - list: list - }; - } - ts.findListItemInfo = findListItemInfo; - function hasChildOfKind(n, kind, sourceFile) { - return !!findChildOfKind(n, kind, sourceFile); - } - ts.hasChildOfKind = hasChildOfKind; - function findChildOfKind(n, kind, sourceFile) { - return ts.forEach(n.getChildren(sourceFile), function (c) { return c.kind === kind && c; }); - } - ts.findChildOfKind = findChildOfKind; - function findContainingList(node) { - // The node might be a list element (nonsynthetic) or a comma (synthetic). Either way, it will - // be parented by the container of the SyntaxList, not the SyntaxList itself. - // In order to find the list item index, we first need to locate SyntaxList itself and then search - // 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 === 286 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { - return c; + SymbolDisplay.getSymbolKind = getSymbolKind; + function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, flags, location) { + if (typeChecker.isUndefinedSymbol(symbol)) { + return ts.ScriptElementKind.variableElement; } - }); - // Either we didn't find an appropriate list, or the list must contain us. - ts.Debug.assert(!syntaxList || ts.contains(syntaxList.getChildren(), node)); - return syntaxList; - } - ts.findContainingList = findContainingList; - /* Gets the token whose text has range [start, end) and - * position >= start and (position < end or (position === end && token is keyword or identifier)) - */ - function getTouchingWord(sourceFile, position, includeJsDocComment) { - if (includeJsDocComment === void 0) { includeJsDocComment = false; } - return getTouchingToken(sourceFile, position, function (n) { return isWord(n.kind); }, includeJsDocComment); - } - ts.getTouchingWord = getTouchingWord; - /* Gets the token whose text has range [start, end) and position >= start - * and (position < end or (position === end && token is keyword or identifier or numeric/string literal)) - */ - function getTouchingPropertyName(sourceFile, position, includeJsDocComment) { - if (includeJsDocComment === void 0) { includeJsDocComment = false; } - return getTouchingToken(sourceFile, position, function (n) { return isPropertyName(n.kind); }, includeJsDocComment); - } - ts.getTouchingPropertyName = getTouchingPropertyName; - /** Returns the token if position is in [start, end) or if position === end and includeItemAtEndPosition(token) === true */ - function getTouchingToken(sourceFile, position, includeItemAtEndPosition, includeJsDocComment) { - if (includeJsDocComment === void 0) { includeJsDocComment = false; } - return getTokenAtPositionWorker(sourceFile, position, /*allowPositionInLeadingTrivia*/ false, includeItemAtEndPosition, includeJsDocComment); - } - ts.getTouchingToken = getTouchingToken; - /** Returns a token if position is in [start-of-leading-trivia, end) */ - function getTokenAtPosition(sourceFile, position, includeJsDocComment) { - if (includeJsDocComment === void 0) { includeJsDocComment = false; } - return getTokenAtPositionWorker(sourceFile, position, /*allowPositionInLeadingTrivia*/ true, /*includeItemAtEndPosition*/ undefined, includeJsDocComment); - } - ts.getTokenAtPosition = getTokenAtPosition; - /** Get the token whose text contains the position */ - function getTokenAtPositionWorker(sourceFile, position, allowPositionInLeadingTrivia, includeItemAtEndPosition, includeJsDocComment) { - if (includeJsDocComment === void 0) { includeJsDocComment = false; } - var current = sourceFile; - outer: while (true) { - if (isToken(current)) { - // exit early - return current; + if (typeChecker.isArgumentsSymbol(symbol)) { + return ts.ScriptElementKind.localVariableElement; } - if (includeJsDocComment) { - var jsDocChildren = ts.filter(current.getChildren(), ts.isJSDocNode); - for (var _i = 0, jsDocChildren_1 = jsDocChildren; _i < jsDocChildren_1.length; _i++) { - var jsDocChild = jsDocChildren_1[_i]; - var start = allowPositionInLeadingTrivia ? jsDocChild.getFullStart() : jsDocChild.getStart(sourceFile, includeJsDocComment); - if (start <= position) { - var end = jsDocChild.getEnd(); - if (position < end || (position === end && jsDocChild.kind === 1 /* EndOfFileToken */)) { - current = jsDocChild; - continue outer; + if (location.kind === 98 /* ThisKeyword */ && ts.isExpression(location)) { + return ts.ScriptElementKind.parameterElement; + } + if (flags & 3 /* Variable */) { + if (ts.isFirstDeclarationOfSymbolParameter(symbol)) { + return ts.ScriptElementKind.parameterElement; + } + else if (symbol.valueDeclaration && ts.isConst(symbol.valueDeclaration)) { + return ts.ScriptElementKind.constElement; + } + else if (ts.forEach(symbol.declarations, ts.isLet)) { + return ts.ScriptElementKind.letElement; + } + return isLocalVariableOrFunction(symbol) ? ts.ScriptElementKind.localVariableElement : ts.ScriptElementKind.variableElement; + } + if (flags & 16 /* Function */) + return isLocalVariableOrFunction(symbol) ? ts.ScriptElementKind.localFunctionElement : ts.ScriptElementKind.functionElement; + if (flags & 32768 /* GetAccessor */) + return ts.ScriptElementKind.memberGetAccessorElement; + if (flags & 65536 /* SetAccessor */) + return ts.ScriptElementKind.memberSetAccessorElement; + if (flags & 8192 /* Method */) + return ts.ScriptElementKind.memberFunctionElement; + if (flags & 16384 /* Constructor */) + return ts.ScriptElementKind.constructorImplementationElement; + if (flags & 4 /* Property */) { + if (flags & 268435456 /* SyntheticProperty */) { + // If union property is result of union of non method (property/accessors/variables), it is labeled as property + var unionPropertyKind = ts.forEach(typeChecker.getRootSymbols(symbol), function (rootSymbol) { + var rootSymbolFlags = rootSymbol.getFlags(); + if (rootSymbolFlags & (98308 /* PropertyOrAccessor */ | 3 /* Variable */)) { + return ts.ScriptElementKind.memberVariableElement; } - else if (includeItemAtEndPosition && end === position) { - var previousToken = findPrecedingToken(position, sourceFile, jsDocChild); - if (previousToken && includeItemAtEndPosition(previousToken)) { - return previousToken; + ts.Debug.assert(!!(rootSymbolFlags & 8192 /* Method */)); + }); + if (!unionPropertyKind) { + // If this was union of all methods, + // make sure it has call signatures before we can label it as method + var typeOfUnionProperty = typeChecker.getTypeOfSymbolAtLocation(symbol, location); + if (typeOfUnionProperty.getCallSignatures().length) { + return ts.ScriptElementKind.memberFunctionElement; + } + return ts.ScriptElementKind.memberVariableElement; + } + return unionPropertyKind; + } + return ts.ScriptElementKind.memberVariableElement; + } + return ts.ScriptElementKind.unknown; + } + function getSymbolModifiers(symbol) { + return symbol && symbol.declarations && symbol.declarations.length > 0 + ? ts.getNodeModifiers(symbol.declarations[0]) + : ts.ScriptElementKindModifier.none; + } + SymbolDisplay.getSymbolModifiers = getSymbolModifiers; + // TODO(drosen): Currently completion entry details passes the SemanticMeaning.All instead of using semanticMeaning of location + function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, enclosingDeclaration, location, semanticMeaning) { + if (semanticMeaning === void 0) { semanticMeaning = ts.getMeaningFromLocation(location); } + var displayParts = []; + var documentation; + var tags; + var symbolFlags = symbol.flags; + var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, symbolFlags, location); + var hasAddedSymbolInfo; + var isThisExpression = location.kind === 98 /* ThisKeyword */ && ts.isExpression(location); + var type; + // Class at constructor site need to be shown as constructor apart from property,method, vars + if (symbolKind !== ts.ScriptElementKind.unknown || symbolFlags & 32 /* Class */ || symbolFlags & 8388608 /* Alias */) { + // If it is accessor they are allowed only if location is at name of the accessor + if (symbolKind === ts.ScriptElementKind.memberGetAccessorElement || symbolKind === ts.ScriptElementKind.memberSetAccessorElement) { + symbolKind = ts.ScriptElementKind.memberVariableElement; + } + var signature = void 0; + type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location); + if (type) { + if (location.parent && location.parent.kind === 177 /* PropertyAccessExpression */) { + var right = location.parent.name; + // Either the location is on the right of a property access, or on the left and the right is missing + if (right === location || (right && right.getFullWidth() === 0)) { + location = location.parent; + } + } + // try get the call/construct signature from the type if it matches + var callExpression = void 0; + if (location.kind === 179 /* CallExpression */ || location.kind === 180 /* NewExpression */) { + callExpression = location; + } + else if (ts.isCallExpressionTarget(location) || ts.isNewExpressionTarget(location)) { + callExpression = location.parent; + } + if (callExpression) { + var candidateSignatures = []; + signature = typeChecker.getResolvedSignature(callExpression, candidateSignatures); + if (!signature && candidateSignatures.length) { + // Use the first candidate: + signature = candidateSignatures[0]; + } + var useConstructSignatures = callExpression.kind === 180 /* NewExpression */ || callExpression.expression.kind === 96 /* SuperKeyword */; + var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); + if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { + // Get the first signature if there is one -- allSignatures may contain + // either the original signature or its target, so check for either + signature = allSignatures.length ? allSignatures[0] : undefined; + } + if (signature) { + if (useConstructSignatures && (symbolFlags & 32 /* Class */)) { + // Constructor + symbolKind = ts.ScriptElementKind.constructorImplementationElement; + addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); + } + else if (symbolFlags & 8388608 /* Alias */) { + symbolKind = ts.ScriptElementKind.alias; + pushTypePart(symbolKind); + displayParts.push(ts.spacePart()); + if (useConstructSignatures) { + displayParts.push(ts.keywordPart(93 /* NewKeyword */)); + displayParts.push(ts.spacePart()); + } + addFullSymbolName(symbol); + } + else { + addPrefixForAnyFunctionOrVar(symbol, symbolKind); + } + switch (symbolKind) { + case ts.ScriptElementKind.memberVariableElement: + case ts.ScriptElementKind.variableElement: + case ts.ScriptElementKind.constElement: + case ts.ScriptElementKind.letElement: + case ts.ScriptElementKind.parameterElement: + case ts.ScriptElementKind.localVariableElement: + // If it is call or construct signature of lambda's write type name + displayParts.push(ts.punctuationPart(55 /* ColonToken */)); + displayParts.push(ts.spacePart()); + if (useConstructSignatures) { + displayParts.push(ts.keywordPart(93 /* NewKeyword */)); + displayParts.push(ts.spacePart()); + } + if (!(type.flags & 32768 /* Object */ && type.objectFlags & 16 /* Anonymous */) && type.symbol) { + ts.addRange(displayParts, ts.symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, /*meaning*/ undefined, 1 /* WriteTypeParametersOrArguments */)); + } + addSignatureDisplayParts(signature, allSignatures, 8 /* WriteArrowStyleSignature */); + break; + default: + // Just signature + addSignatureDisplayParts(signature, allSignatures); + } + hasAddedSymbolInfo = true; + } + } + else if ((ts.isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304 /* Accessor */)) || + (location.kind === 122 /* ConstructorKeyword */ && location.parent.kind === 150 /* Constructor */)) { + // get the signature from the declaration and write it + var functionDeclaration = location.parent; + var allSignatures = functionDeclaration.kind === 150 /* Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); + if (!typeChecker.isImplementationOfOverload(functionDeclaration)) { + signature = typeChecker.getSignatureFromDeclaration(functionDeclaration); + } + else { + signature = allSignatures[0]; + } + if (functionDeclaration.kind === 150 /* Constructor */) { + // show (constructor) Type(...) signature + symbolKind = ts.ScriptElementKind.constructorImplementationElement; + addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); + } + else { + // (function/method) symbol(..signature) + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 153 /* CallSignature */ && + !(type.symbol.flags & 2048 /* TypeLiteral */ || type.symbol.flags & 4096 /* ObjectLiteral */) ? type.symbol : symbol, symbolKind); + } + addSignatureDisplayParts(signature, allSignatures); + hasAddedSymbolInfo = true; + } + } + } + if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo && !isThisExpression) { + if (ts.getDeclarationOfKind(symbol, 197 /* ClassExpression */)) { + // Special case for class expressions because we would like to indicate that + // the class name is local to the class body (similar to function expression) + // (local class) class + pushTypePart(ts.ScriptElementKind.localClassElement); + } + else { + // Class declaration has name which is not local. + displayParts.push(ts.keywordPart(74 /* ClassKeyword */)); + } + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + writeTypeParametersOfSymbol(symbol, sourceFile); + } + if ((symbolFlags & 64 /* Interface */) && (semanticMeaning & 2 /* Type */)) { + addNewLineIfDisplayPartsExist(); + displayParts.push(ts.keywordPart(108 /* InterfaceKeyword */)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + writeTypeParametersOfSymbol(symbol, sourceFile); + } + if (symbolFlags & 524288 /* TypeAlias */) { + addNewLineIfDisplayPartsExist(); + displayParts.push(ts.keywordPart(136 /* TypeKeyword */)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + writeTypeParametersOfSymbol(symbol, sourceFile); + displayParts.push(ts.spacePart()); + displayParts.push(ts.operatorPart(57 /* EqualsToken */)); + displayParts.push(ts.spacePart()); + ts.addRange(displayParts, ts.typeToDisplayParts(typeChecker, typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration, 512 /* InTypeAlias */)); + } + if (symbolFlags & 384 /* Enum */) { + addNewLineIfDisplayPartsExist(); + if (ts.forEach(symbol.declarations, ts.isConstEnumDeclaration)) { + displayParts.push(ts.keywordPart(75 /* ConstKeyword */)); + displayParts.push(ts.spacePart()); + } + displayParts.push(ts.keywordPart(82 /* EnumKeyword */)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + } + if (symbolFlags & 1536 /* Module */) { + addNewLineIfDisplayPartsExist(); + var declaration = ts.getDeclarationOfKind(symbol, 230 /* ModuleDeclaration */); + var isNamespace = declaration && declaration.name && declaration.name.kind === 70 /* Identifier */; + displayParts.push(ts.keywordPart(isNamespace ? 128 /* NamespaceKeyword */ : 127 /* ModuleKeyword */)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + } + if ((symbolFlags & 262144 /* TypeParameter */) && (semanticMeaning & 2 /* Type */)) { + addNewLineIfDisplayPartsExist(); + displayParts.push(ts.punctuationPart(18 /* OpenParenToken */)); + displayParts.push(ts.textPart("type parameter")); + displayParts.push(ts.punctuationPart(19 /* CloseParenToken */)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + if (symbol.parent) { + // Class/Interface type parameter + addInPrefix(); + addFullSymbolName(symbol.parent, enclosingDeclaration); + writeTypeParametersOfSymbol(symbol.parent, enclosingDeclaration); + } + else { + // Method/function type parameter + var declaration = ts.getDeclarationOfKind(symbol, 143 /* TypeParameter */); + ts.Debug.assert(declaration !== undefined); + declaration = declaration.parent; + if (declaration) { + if (ts.isFunctionLikeKind(declaration.kind)) { + addInPrefix(); + var signature = typeChecker.getSignatureFromDeclaration(declaration); + if (declaration.kind === 154 /* ConstructSignature */) { + displayParts.push(ts.keywordPart(93 /* NewKeyword */)); + displayParts.push(ts.spacePart()); + } + else if (declaration.kind !== 153 /* CallSignature */ && declaration.name) { + addFullSymbolName(declaration.symbol); + } + ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */)); + } + else if (declaration.kind === 228 /* TypeAliasDeclaration */) { + // Type alias type parameter + // For example + // type list = T[]; // Both T will go through same code path + addInPrefix(); + displayParts.push(ts.keywordPart(136 /* TypeKeyword */)); + displayParts.push(ts.spacePart()); + addFullSymbolName(declaration.symbol); + writeTypeParametersOfSymbol(declaration.symbol, sourceFile); + } + } + } + } + if (symbolFlags & 8 /* EnumMember */) { + addPrefixForAnyFunctionOrVar(symbol, "enum member"); + var declaration = symbol.declarations[0]; + if (declaration.kind === 260 /* EnumMember */) { + var constantValue = typeChecker.getConstantValue(declaration); + if (constantValue !== undefined) { + displayParts.push(ts.spacePart()); + displayParts.push(ts.operatorPart(57 /* EqualsToken */)); + displayParts.push(ts.spacePart()); + displayParts.push(ts.displayPart(constantValue.toString(), ts.SymbolDisplayPartKind.numericLiteral)); + } + } + } + if (symbolFlags & 8388608 /* Alias */) { + addNewLineIfDisplayPartsExist(); + if (symbol.declarations[0].kind === 233 /* NamespaceExportDeclaration */) { + displayParts.push(ts.keywordPart(83 /* ExportKeyword */)); + displayParts.push(ts.spacePart()); + displayParts.push(ts.keywordPart(128 /* NamespaceKeyword */)); + } + else { + displayParts.push(ts.keywordPart(90 /* ImportKeyword */)); + } + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + ts.forEach(symbol.declarations, function (declaration) { + if (declaration.kind === 234 /* ImportEqualsDeclaration */) { + var importEqualsDeclaration = declaration; + if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { + displayParts.push(ts.spacePart()); + displayParts.push(ts.operatorPart(57 /* EqualsToken */)); + displayParts.push(ts.spacePart()); + displayParts.push(ts.keywordPart(131 /* RequireKeyword */)); + displayParts.push(ts.punctuationPart(18 /* OpenParenToken */)); + displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), ts.SymbolDisplayPartKind.stringLiteral)); + displayParts.push(ts.punctuationPart(19 /* CloseParenToken */)); + } + else { + var internalAliasSymbol = typeChecker.getSymbolAtLocation(importEqualsDeclaration.moduleReference); + if (internalAliasSymbol) { + displayParts.push(ts.spacePart()); + displayParts.push(ts.operatorPart(57 /* EqualsToken */)); + displayParts.push(ts.spacePart()); + addFullSymbolName(internalAliasSymbol, enclosingDeclaration); + } + } + return true; + } + }); + } + if (!hasAddedSymbolInfo) { + if (symbolKind !== ts.ScriptElementKind.unknown) { + if (type) { + if (isThisExpression) { + addNewLineIfDisplayPartsExist(); + displayParts.push(ts.keywordPart(98 /* ThisKeyword */)); + } + else { + addPrefixForAnyFunctionOrVar(symbol, symbolKind); + } + // For properties, variables and local vars: show the type + if (symbolKind === ts.ScriptElementKind.memberVariableElement || + symbolFlags & 3 /* Variable */ || + symbolKind === ts.ScriptElementKind.localVariableElement || + isThisExpression) { + displayParts.push(ts.punctuationPart(55 /* ColonToken */)); + displayParts.push(ts.spacePart()); + // If the type is type parameter, format it specially + if (type.symbol && type.symbol.flags & 262144 /* TypeParameter */) { + var typeParameterParts = ts.mapToDisplayParts(function (writer) { + typeChecker.getSymbolDisplayBuilder().buildTypeParameterDisplay(type, writer, enclosingDeclaration); + }); + ts.addRange(displayParts, typeParameterParts); + } + else { + ts.addRange(displayParts, ts.typeToDisplayParts(typeChecker, type, enclosingDeclaration)); + } + } + else if (symbolFlags & 16 /* Function */ || + symbolFlags & 8192 /* Method */ || + symbolFlags & 16384 /* Constructor */ || + symbolFlags & 131072 /* Signature */ || + symbolFlags & 98304 /* Accessor */ || + symbolKind === ts.ScriptElementKind.memberFunctionElement) { + var allSignatures = type.getNonNullableType().getCallSignatures(); + addSignatureDisplayParts(allSignatures[0], allSignatures); + } + } + } + else { + symbolKind = getSymbolKind(typeChecker, symbol, location); + } + } + if (!documentation) { + documentation = symbol.getDocumentationComment(); + tags = symbol.getJsDocTags(); + if (documentation.length === 0 && symbol.flags & 4 /* Property */) { + // For some special property access expressions like `experts.foo = foo` or `module.exports.foo = foo` + // there documentation comments might be attached to the right hand side symbol of their declarations. + // The pattern of such special property access is that the parent symbol is the symbol of the file. + if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 261 /* SourceFile */; })) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + if (!declaration.parent || declaration.parent.kind !== 192 /* BinaryExpression */) { + continue; + } + var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right); + if (!rhsSymbol) { + continue; + } + documentation = rhsSymbol.getDocumentationComment(); + tags = rhsSymbol.getJsDocTags(); + if (documentation.length > 0) { + break; } } } } } - // find the child that contains 'position' - for (var i = 0, n = current.getChildCount(sourceFile); i < n; i++) { - var child = current.getChildAt(i); - // all jsDocComment nodes were already visited - if (ts.isJSDocNode(child)) { - continue; - } - var start = allowPositionInLeadingTrivia ? child.getFullStart() : child.getStart(sourceFile, includeJsDocComment); - if (start <= position) { - var end = child.getEnd(); - if (position < end || (position === end && child.kind === 1 /* EndOfFileToken */)) { - current = child; - continue outer; - } - else if (includeItemAtEndPosition && end === position) { - var previousToken = findPrecedingToken(position, sourceFile, child); - if (previousToken && includeItemAtEndPosition(previousToken)) { - return previousToken; - } - } + return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind, tags: tags }; + function addNewLineIfDisplayPartsExist() { + if (displayParts.length) { + displayParts.push(ts.lineBreakPart()); } } - return current; - } - } - /** - * The token on the left of the position is the token that strictly includes the position - * or sits to the left of the cursor if it is on a boundary. For example - * - * fo|o -> will return foo - * foo |bar -> will return foo - * - */ - function findTokenOnLeftOfPosition(file, position) { - // Ideally, getTokenAtPosition should return a token. However, it is currently - // broken, so we do a check to make sure the result was indeed a token. - var tokenAtPosition = getTokenAtPosition(file, position); - if (isToken(tokenAtPosition) && position > tokenAtPosition.getStart(file) && position < tokenAtPosition.getEnd()) { - return tokenAtPosition; - } - return findPrecedingToken(position, file); - } - ts.findTokenOnLeftOfPosition = findTokenOnLeftOfPosition; - function findNextToken(previousToken, parent) { - return find(parent); - function find(n) { - if (isToken(n) && n.pos === previousToken.end) { - // this is token that starts at the end of previous token - return it - return n; + function addInPrefix() { + displayParts.push(ts.spacePart()); + displayParts.push(ts.keywordPart(91 /* InKeyword */)); + displayParts.push(ts.spacePart()); } - var children = n.getChildren(); - for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { - var child = children_1[_i]; - var shouldDiveInChildNode = - // previous token is enclosed somewhere in the child - (child.pos <= previousToken.pos && child.end > previousToken.end) || - // previous token ends exactly at the beginning of child - (child.pos === previousToken.end); - if (shouldDiveInChildNode && nodeHasTokens(child)) { - return find(child); + function addFullSymbolName(symbol, enclosingDeclaration) { + var fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbol, enclosingDeclaration || sourceFile, /*meaning*/ undefined, 1 /* WriteTypeParametersOrArguments */ | 2 /* UseOnlyExternalAliasing */); + ts.addRange(displayParts, fullSymbolDisplayParts); + } + function addPrefixForAnyFunctionOrVar(symbol, symbolKind) { + addNewLineIfDisplayPartsExist(); + if (symbolKind) { + pushTypePart(symbolKind); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); } } - return undefined; - } - } - ts.findNextToken = findNextToken; - function findPrecedingToken(position, sourceFile, startNode) { - return find(startNode || sourceFile); - function findRightmostToken(n) { - if (isToken(n) || n.kind === 244 /* JsxText */) { - return n; - } - var children = n.getChildren(); - var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length); - return candidate && findRightmostToken(candidate); - } - function find(n) { - if (isToken(n) || n.kind === 244 /* JsxText */) { - return n; - } - var children = n.getChildren(); - for (var i = 0, len = children.length; i < len; i++) { - var child = children[i]; - // condition 'position < child.end' checks if child node end after the position - // in the example below this condition will be false for 'aaaa' and 'bbbb' and true for 'ccc' - // aaaa___bbbb___$__ccc - // after we found child node with end after the position we check if start of the node is after the position. - // if yes - then position is in the trivia and we need to look into the previous child to find the token in question. - // if no - position is in the node itself so we should recurse in it. - // NOTE: JsxText is a weird kind of node that can contain only whitespaces (since they are not counted as trivia). - // if this is the case - then we should assume that token in question is located in previous child. - if (position < child.end && (nodeHasTokens(child) || child.kind === 244 /* JsxText */)) { - var start = child.getStart(sourceFile); - var lookInPreviousChild = (start >= position) || - (child.kind === 244 /* JsxText */ && start === child.end); // whitespace only JsxText - if (lookInPreviousChild) { - // actual start of the node is past the position - previous token should be at the end of previous child - var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i); - return candidate && findRightmostToken(candidate); - } - else { - // candidate should be in this node - return find(child); - } + function pushTypePart(symbolKind) { + switch (symbolKind) { + case ts.ScriptElementKind.variableElement: + case ts.ScriptElementKind.functionElement: + case ts.ScriptElementKind.letElement: + case ts.ScriptElementKind.constElement: + case ts.ScriptElementKind.constructorImplementationElement: + displayParts.push(ts.textOrKeywordPart(symbolKind)); + return; + default: + displayParts.push(ts.punctuationPart(18 /* OpenParenToken */)); + displayParts.push(ts.textOrKeywordPart(symbolKind)); + displayParts.push(ts.punctuationPart(19 /* CloseParenToken */)); + return; } } - ts.Debug.assert(startNode !== undefined || n.kind === 256 /* SourceFile */); - // Here we know that none of child token nodes embrace the position, - // the only known case is when position is at the end of the file. - // Try to find the rightmost token in the file without filtering. - // Namely we are skipping the check: 'position < node.end' - if (children.length) { - var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length); - return candidate && findRightmostToken(candidate); - } - } - /// finds last node that is considered as candidate for search (isCandidate(node) === true) starting from 'exclusiveStartPosition' - function findRightmostChildNodeWithTokens(children, exclusiveStartPosition) { - for (var i = exclusiveStartPosition - 1; i >= 0; i--) { - if (nodeHasTokens(children[i])) { - return children[i]; + function addSignatureDisplayParts(signature, allSignatures, flags) { + ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, enclosingDeclaration, flags | 32 /* WriteTypeArgumentsOfSignature */)); + if (allSignatures.length > 1) { + displayParts.push(ts.spacePart()); + displayParts.push(ts.punctuationPart(18 /* OpenParenToken */)); + displayParts.push(ts.operatorPart(36 /* PlusToken */)); + displayParts.push(ts.displayPart((allSignatures.length - 1).toString(), ts.SymbolDisplayPartKind.numericLiteral)); + displayParts.push(ts.spacePart()); + displayParts.push(ts.textPart(allSignatures.length === 2 ? "overload" : "overloads")); + displayParts.push(ts.punctuationPart(19 /* CloseParenToken */)); } + documentation = signature.getDocumentationComment(); + tags = signature.getJsDocTags(); + } + function writeTypeParametersOfSymbol(symbol, enclosingDeclaration) { + var typeParameterParts = ts.mapToDisplayParts(function (writer) { + typeChecker.getSymbolDisplayBuilder().buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaration); + }); + ts.addRange(displayParts, typeParameterParts); } } - } - ts.findPrecedingToken = findPrecedingToken; - function isInString(sourceFile, position) { - var previousToken = findPrecedingToken(position, sourceFile); - if (previousToken && previousToken.kind === 9 /* StringLiteral */) { - var start = previousToken.getStart(); - var end = previousToken.getEnd(); - // To be "in" one of these literals, the position has to be: - // 1. entirely within the token text. - // 2. at the end position of an unterminated token. - // 3. at the end of a regular expression (due to trailing flags like '/foo/g'). - if (start < position && position < end) { - return true; + SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind = getSymbolDisplayPartsDocumentationAndSymbolKind; + function isLocalVariableOrFunction(symbol) { + if (symbol.parent) { + return false; // This is exported symbol } - if (position === end) { - return !!previousToken.isUnterminated; - } - } - return false; - } - ts.isInString = isInString; - function isInComment(sourceFile, position) { - return isInCommentHelper(sourceFile, position, /*predicate*/ undefined); - } - ts.isInComment = isInComment; - /** - * returns true if the position is in between the open and close elements of an JSX expression. - */ - function isInsideJsxElementOrAttribute(sourceFile, position) { - var token = getTokenAtPosition(sourceFile, position); - if (!token) { - return false; - } - if (token.kind === 244 /* JsxText */) { - return true; - } - //
Hello |
- if (token.kind === 25 /* LessThanToken */ && token.parent.kind === 244 /* JsxText */) { - return true; - } - //
{ |
or
- if (token.kind === 25 /* LessThanToken */ && token.parent.kind === 248 /* JsxExpression */) { - return true; - } - //
{ - // | - // } < /div> - if (token && token.kind === 16 /* CloseBraceToken */ && token.parent.kind === 248 /* JsxExpression */) { - return true; - } - //
|
- if (token.kind === 25 /* LessThanToken */ && token.parent.kind === 245 /* JsxClosingElement */) { - return true; - } - return false; - } - ts.isInsideJsxElementOrAttribute = isInsideJsxElementOrAttribute; - function isInTemplateString(sourceFile, position) { - var token = getTokenAtPosition(sourceFile, position); - return ts.isTemplateLiteralKind(token.kind) && position > token.getStart(sourceFile); - } - ts.isInTemplateString = isInTemplateString; - /** - * Returns true if the cursor at position in sourceFile is within a comment that additionally - * satisfies predicate, and false otherwise. - */ - function isInCommentHelper(sourceFile, position, predicate) { - var token = getTokenAtPosition(sourceFile, position); - if (token && position <= token.getStart(sourceFile)) { - var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos); - // The end marker of a single-line comment does not include the newline character. - // In the following case, we are inside a comment (^ denotes the cursor position): - // - // // asdf ^\n - // - // But for multi-line comments, we don't want to be inside the comment in the following case: - // - // /* asdf */^ - // - // Internally, we represent the end of the comment at the newline and closing '/', respectively. - return predicate ? - ts.forEach(commentRanges, function (c) { return c.pos < position && - (c.kind == 2 /* SingleLineCommentTrivia */ ? position <= c.end : position < c.end) && - predicate(c); }) : - ts.forEach(commentRanges, function (c) { return c.pos < position && - (c.kind == 2 /* SingleLineCommentTrivia */ ? position <= c.end : position < c.end); }); - } - return false; - } - ts.isInCommentHelper = isInCommentHelper; - function hasDocComment(sourceFile, position) { - var token = getTokenAtPosition(sourceFile, position); - // First, we have to see if this position actually landed in a comment. - var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos); - return ts.forEach(commentRanges, jsDocPrefix); - function jsDocPrefix(c) { - var text = sourceFile.text; - return text.length >= c.pos + 3 && text[c.pos] === "/" && text[c.pos + 1] === "*" && text[c.pos + 2] === "*"; - } - } - ts.hasDocComment = hasDocComment; - /** - * Get the corresponding JSDocTag node if the position is in a jsDoc comment - */ - function getJsDocTagAtPosition(sourceFile, position) { - var node = ts.getTokenAtPosition(sourceFile, position); - if (isToken(node)) { - switch (node.kind) { - case 102 /* VarKeyword */: - case 108 /* LetKeyword */: - case 74 /* ConstKeyword */: - // if the current token is var, let or const, skip the VariableDeclarationList - node = node.parent === undefined ? undefined : node.parent.parent; - break; - default: - node = node.parent; - break; - } - } - if (node) { - if (node.jsDocComments) { - for (var _i = 0, _a = node.jsDocComments; _i < _a.length; _i++) { - var jsDocComment = _a[_i]; - for (var _b = 0, _c = jsDocComment.tags; _b < _c.length; _b++) { - var tag = _c[_b]; - if (tag.pos <= position && position <= tag.end) { - return tag; - } - } + return ts.forEach(symbol.declarations, function (declaration) { + // Function expressions are local + if (declaration.kind === 184 /* FunctionExpression */) { + return true; } - } - } - return undefined; - } - ts.getJsDocTagAtPosition = getJsDocTagAtPosition; - function nodeHasTokens(n) { - // If we have a token or node that has a non-zero width, it must have tokens. - // Note, that getWidth() does not take trivia into account. - return n.getWidth() !== 0; - } - function getNodeModifiers(node) { - var flags = ts.getCombinedNodeFlags(node); - var result = []; - if (flags & 8 /* Private */) - result.push(ts.ScriptElementKindModifier.privateMemberModifier); - if (flags & 16 /* Protected */) - result.push(ts.ScriptElementKindModifier.protectedMemberModifier); - if (flags & 4 /* Public */) - result.push(ts.ScriptElementKindModifier.publicMemberModifier); - if (flags & 32 /* Static */) - result.push(ts.ScriptElementKindModifier.staticModifier); - if (flags & 128 /* Abstract */) - result.push(ts.ScriptElementKindModifier.abstractModifier); - if (flags & 1 /* Export */) - result.push(ts.ScriptElementKindModifier.exportedModifier); - if (ts.isInAmbientContext(node)) - result.push(ts.ScriptElementKindModifier.ambientModifier); - return result.length > 0 ? result.join(",") : ts.ScriptElementKindModifier.none; - } - ts.getNodeModifiers = getNodeModifiers; - function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 155 /* TypeReference */ || node.kind === 174 /* CallExpression */) { - return node.typeArguments; - } - if (ts.isFunctionLike(node) || node.kind === 221 /* ClassDeclaration */ || node.kind === 222 /* InterfaceDeclaration */) { - return node.typeParameters; - } - return undefined; - } - ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; - function isToken(n) { - return n.kind >= 0 /* FirstToken */ && n.kind <= 138 /* LastToken */; - } - ts.isToken = isToken; - function isWord(kind) { - return kind === 69 /* Identifier */ || ts.isKeyword(kind); - } - ts.isWord = isWord; - function isPropertyName(kind) { - return kind === 9 /* StringLiteral */ || kind === 8 /* NumericLiteral */ || isWord(kind); - } - function isComment(kind) { - return kind === 2 /* SingleLineCommentTrivia */ || kind === 3 /* MultiLineCommentTrivia */; - } - ts.isComment = isComment; - function isStringOrRegularExpressionOrTemplateLiteral(kind) { - if (kind === 9 /* StringLiteral */ - || kind === 10 /* RegularExpressionLiteral */ - || ts.isTemplateLiteralKind(kind)) { - return true; - } - return false; - } - ts.isStringOrRegularExpressionOrTemplateLiteral = isStringOrRegularExpressionOrTemplateLiteral; - function isPunctuation(kind) { - return 15 /* FirstPunctuation */ <= kind && kind <= 68 /* LastPunctuation */; - } - ts.isPunctuation = isPunctuation; - function isInsideTemplateLiteral(node, position) { - return ts.isTemplateLiteralKind(node.kind) - && (node.getStart() < position && position < node.getEnd()) || (!!node.isUnterminated && position === node.getEnd()); - } - ts.isInsideTemplateLiteral = isInsideTemplateLiteral; - function isAccessibilityModifier(kind) { - switch (kind) { - case 112 /* PublicKeyword */: - case 110 /* PrivateKeyword */: - case 111 /* ProtectedKeyword */: - return true; - } - return false; - } - ts.isAccessibilityModifier = isAccessibilityModifier; - function compareDataObjects(dst, src) { - for (var e in dst) { - if (typeof dst[e] === "object") { - if (!compareDataObjects(dst[e], src[e])) { + if (declaration.kind !== 223 /* VariableDeclaration */ && declaration.kind !== 225 /* FunctionDeclaration */) { return false; } - } - else if (typeof dst[e] !== "function") { - if (dst[e] !== src[e]) { - 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) { + // Reached source file or module block + if (parent_21.kind === 261 /* SourceFile */ || parent_21.kind === 231 /* ModuleBlock */) { + return false; + } } - } + // parent is in function block + return true; + }); } - return true; - } - ts.compareDataObjects = compareDataObjects; - function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { - if (node.kind === 170 /* ArrayLiteralExpression */ || - node.kind === 171 /* ObjectLiteralExpression */) { - // [a,b,c] from: - // [a, b, c] = someExpression; - if (node.parent.kind === 187 /* BinaryExpression */ && - node.parent.left === node && - node.parent.operatorToken.kind === 56 /* EqualsToken */) { - return true; - } - // [a, b, c] from: - // for([a, b, c] of expression) - if (node.parent.kind === 208 /* ForOfStatement */ && - node.parent.initializer === node) { - return true; - } - // [a, b, c] of - // [x, [a, b, c] ] = someExpression - // or - // {x, a: {a, b, c} } = someExpression - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 253 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { - return true; - } - } - return false; - } - ts.isArrayLiteralOrObjectLiteralDestructuringPattern = isArrayLiteralOrObjectLiteralDestructuringPattern; + })(SymbolDisplay = ts.SymbolDisplay || (ts.SymbolDisplay = {})); })(ts || (ts = {})); -// Display-part writer helpers -/* @internal */ var ts; (function (ts) { - function isFirstDeclarationOfSymbolParameter(symbol) { - return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 142 /* Parameter */; - } - ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; - var displayPartWriter = getDisplayPartWriter(); - function getDisplayPartWriter() { - var displayParts; - var lineStart; - var indent; - resetWriter(); - return { - displayParts: function () { return displayParts; }, - writeKeyword: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.keyword); }, - writeOperator: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.operator); }, - writePunctuation: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.punctuation); }, - writeSpace: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.space); }, - writeStringLiteral: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.stringLiteral); }, - writeParameter: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.parameterName); }, - writeSymbol: writeSymbol, - writeLine: writeLine, - increaseIndent: function () { indent++; }, - decreaseIndent: function () { indent--; }, - clear: resetWriter, - trackSymbol: function () { }, - reportInaccessibleThisError: function () { } - }; - function writeIndent() { - if (lineStart) { - var indentString = ts.getIndentString(indent); - if (indentString) { - displayParts.push(displayPart(indentString, ts.SymbolDisplayPartKind.space)); + /* + * This function will compile source text from 'input' argument using specified compiler options. + * If not options are provided - it will use a set of default compiler options. + * Extra compiler options that will unconditionally be used by this function are: + * - isolatedModules = true + * - allowNonTsExtensions = true + * - noLib = true + * - noResolve = true + */ + function transpileModule(input, transpileOptions) { + var diagnostics = []; + var options = transpileOptions.compilerOptions ? fixupCompilerOptions(transpileOptions.compilerOptions, diagnostics) : ts.getDefaultCompilerOptions(); + options.isolatedModules = true; + // transpileModule does not write anything to disk so there is no need to verify that there are no conflicts between input and output paths. + options.suppressOutputPathCheck = true; + // Filename can be non-ts file. + options.allowNonTsExtensions = true; + // We are not returning a sourceFile for lib file when asked by the program, + // so pass --noLib to avoid reporting a file not found error. + options.noLib = true; + // Clear out other settings that would not be used in transpiling this module + options.lib = undefined; + options.types = undefined; + options.noEmit = undefined; + options.noEmitOnError = undefined; + options.paths = undefined; + options.rootDirs = undefined; + options.declaration = undefined; + options.declarationDir = undefined; + options.out = undefined; + options.outFile = undefined; + // We are not doing a full typecheck, we are not resolving the whole context, + // so pass --noResolve to avoid reporting missing file errors. + options.noResolve = true; + // if jsx is specified then treat file as .tsx + var inputFileName = transpileOptions.fileName || (options.jsx ? "module.tsx" : "module.ts"); + var sourceFile = ts.createSourceFile(inputFileName, input, options.target); + if (transpileOptions.moduleName) { + sourceFile.moduleName = transpileOptions.moduleName; + } + if (transpileOptions.renamedDependencies) { + sourceFile.renamedDependencies = ts.createMap(transpileOptions.renamedDependencies); + } + var newLine = ts.getNewLineCharacter(options); + // Output + var outputText; + var sourceMapText; + // Create a compilerHost object to allow the compiler to read and write files + var compilerHost = { + getSourceFile: function (fileName) { return fileName === ts.normalizePath(inputFileName) ? sourceFile : undefined; }, + writeFile: function (name, text) { + if (ts.fileExtensionIs(name, ".map")) { + ts.Debug.assert(sourceMapText === undefined, "Unexpected multiple source map outputs for the file '" + name + "'"); + sourceMapText = text; + } + else { + ts.Debug.assert(outputText === undefined, "Unexpected multiple outputs for the file: '" + name + "'"); + outputText = text; } - lineStart = false; - } - } - function writeKind(text, kind) { - writeIndent(); - displayParts.push(displayPart(text, kind)); - } - function writeSymbol(text, symbol) { - writeIndent(); - displayParts.push(symbolPart(text, symbol)); - } - function writeLine() { - displayParts.push(lineBreakPart()); - lineStart = true; - } - function resetWriter() { - displayParts = []; - lineStart = true; - indent = 0; - } - } - function symbolPart(text, symbol) { - return displayPart(text, displayPartKind(symbol), symbol); - function displayPartKind(symbol) { - var flags = symbol.flags; - if (flags & 3 /* Variable */) { - return isFirstDeclarationOfSymbolParameter(symbol) ? ts.SymbolDisplayPartKind.parameterName : ts.SymbolDisplayPartKind.localName; - } - else if (flags & 4 /* Property */) { - return ts.SymbolDisplayPartKind.propertyName; - } - else if (flags & 32768 /* GetAccessor */) { - return ts.SymbolDisplayPartKind.propertyName; - } - else if (flags & 65536 /* SetAccessor */) { - return ts.SymbolDisplayPartKind.propertyName; - } - else if (flags & 8 /* EnumMember */) { - return ts.SymbolDisplayPartKind.enumMemberName; - } - else if (flags & 16 /* Function */) { - return ts.SymbolDisplayPartKind.functionName; - } - else if (flags & 32 /* Class */) { - return ts.SymbolDisplayPartKind.className; - } - else if (flags & 64 /* Interface */) { - return ts.SymbolDisplayPartKind.interfaceName; - } - else if (flags & 384 /* Enum */) { - return ts.SymbolDisplayPartKind.enumName; - } - else if (flags & 1536 /* Module */) { - return ts.SymbolDisplayPartKind.moduleName; - } - else if (flags & 8192 /* Method */) { - return ts.SymbolDisplayPartKind.methodName; - } - else if (flags & 262144 /* TypeParameter */) { - return ts.SymbolDisplayPartKind.typeParameterName; - } - else if (flags & 524288 /* TypeAlias */) { - return ts.SymbolDisplayPartKind.aliasName; - } - else if (flags & 8388608 /* Alias */) { - return ts.SymbolDisplayPartKind.aliasName; - } - return ts.SymbolDisplayPartKind.text; - } - } - ts.symbolPart = symbolPart; - function displayPart(text, kind, symbol) { - return { - text: text, - kind: ts.SymbolDisplayPartKind[kind] - }; - } - ts.displayPart = displayPart; - function spacePart() { - return displayPart(" ", ts.SymbolDisplayPartKind.space); - } - ts.spacePart = spacePart; - function keywordPart(kind) { - return displayPart(ts.tokenToString(kind), ts.SymbolDisplayPartKind.keyword); - } - ts.keywordPart = keywordPart; - function punctuationPart(kind) { - return displayPart(ts.tokenToString(kind), ts.SymbolDisplayPartKind.punctuation); - } - ts.punctuationPart = punctuationPart; - function operatorPart(kind) { - return displayPart(ts.tokenToString(kind), ts.SymbolDisplayPartKind.operator); - } - ts.operatorPart = operatorPart; - function textOrKeywordPart(text) { - var kind = ts.stringToToken(text); - return kind === undefined - ? textPart(text) - : keywordPart(kind); - } - ts.textOrKeywordPart = textOrKeywordPart; - function textPart(text) { - return displayPart(text, ts.SymbolDisplayPartKind.text); - } - ts.textPart = textPart; - var carriageReturnLineFeed = "\r\n"; - /** - * The default is CRLF. - */ - function getNewLineOrDefaultFromHost(host) { - return host.getNewLine ? host.getNewLine() : carriageReturnLineFeed; - } - ts.getNewLineOrDefaultFromHost = getNewLineOrDefaultFromHost; - function lineBreakPart() { - return displayPart("\n", ts.SymbolDisplayPartKind.lineBreak); - } - ts.lineBreakPart = lineBreakPart; - function mapToDisplayParts(writeDisplayParts) { - writeDisplayParts(displayPartWriter); - var result = displayPartWriter.displayParts(); - displayPartWriter.clear(); - return result; - } - ts.mapToDisplayParts = mapToDisplayParts; - function typeToDisplayParts(typechecker, type, enclosingDeclaration, flags) { - return mapToDisplayParts(function (writer) { - typechecker.getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); - }); - } - ts.typeToDisplayParts = typeToDisplayParts; - function symbolToDisplayParts(typeChecker, symbol, enclosingDeclaration, meaning, flags) { - return mapToDisplayParts(function (writer) { - typeChecker.getSymbolDisplayBuilder().buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning, flags); - }); - } - ts.symbolToDisplayParts = symbolToDisplayParts; - function signatureToDisplayParts(typechecker, signature, enclosingDeclaration, flags) { - return mapToDisplayParts(function (writer) { - typechecker.getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags); - }); - } - ts.signatureToDisplayParts = signatureToDisplayParts; - function getDeclaredName(typeChecker, symbol, location) { - // If this is an export or import specifier it could have been renamed using the 'as' syntax. - // If so we want to search for whatever is under the cursor. - if (isImportOrExportSpecifierName(location)) { - return location.getText(); - } - else if (ts.isStringOrNumericLiteral(location.kind) && - location.parent.kind === 140 /* ComputedPropertyName */) { - return location.text; - } - // Try to get the local symbol if we're dealing with an 'export default' - // since that symbol has the "true" name. - var localExportDefaultSymbol = ts.getLocalSymbolForExportDefault(symbol); - var name = typeChecker.symbolToString(localExportDefaultSymbol || symbol); - return name; - } - ts.getDeclaredName = getDeclaredName; - function isImportOrExportSpecifierName(location) { - return location.parent && - (location.parent.kind === 234 /* ImportSpecifier */ || location.parent.kind === 238 /* ExportSpecifier */) && - location.parent.propertyName === location; - } - ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName; - /** - * Strip off existed single quotes or double quotes from a given string - * - * @return non-quoted string - */ - function stripQuotes(name) { - var length = name.length; - if (length >= 2 && - name.charCodeAt(0) === name.charCodeAt(length - 1) && - (name.charCodeAt(0) === 34 /* doubleQuote */ || name.charCodeAt(0) === 39 /* singleQuote */)) { - return name.substring(1, length - 1); - } - ; - return name; - } - ts.stripQuotes = stripQuotes; - function scriptKindIs(fileName, host) { - var scriptKinds = []; - for (var _i = 2; _i < arguments.length; _i++) { - scriptKinds[_i - 2] = arguments[_i]; - } - var scriptKind = getScriptKind(fileName, host); - return ts.forEach(scriptKinds, function (k) { return k === scriptKind; }); - } - ts.scriptKindIs = scriptKindIs; - function getScriptKind(fileName, host) { - // First check to see if the script kind was specified by the host. Chances are the host - // may override the default script kind for the file extension. - var scriptKind; - if (host && host.getScriptKind) { - scriptKind = host.getScriptKind(fileName); - } - if (!scriptKind) { - scriptKind = ts.getScriptKindFromFileName(fileName); - } - return ts.ensureScriptKind(fileName, scriptKind); - } - ts.getScriptKind = getScriptKind; - function parseAndReEmitConfigJSONFile(content) { - var options = { - fileName: "config.js", - compilerOptions: { - target: 2 /* ES6 */, - removeComments: true }, - reportDiagnostics: true + getDefaultLibFileName: function () { return "lib.d.ts"; }, + useCaseSensitiveFileNames: function () { return false; }, + getCanonicalFileName: function (fileName) { return fileName; }, + getCurrentDirectory: function () { return ""; }, + getNewLine: function () { return newLine; }, + fileExists: function (fileName) { return fileName === inputFileName; }, + readFile: function () { return ""; }, + directoryExists: function () { return true; }, + getDirectories: function () { return []; } }; - var _a = ts.transpileModule("(" + content + ")", options), outputText = _a.outputText, diagnostics = _a.diagnostics; - // Becasue the content was wrapped in "()", the start position of diagnostics needs to be subtract by 1 - // also, the emitted result will have "(" in the beginning and ");" in the end. We need to strip these - // as well - var trimmedOutput = outputText.trim(); - var configJsonObject = JSON.parse(trimmedOutput.substring(1, trimmedOutput.length - 2)); - for (var _i = 0, diagnostics_3 = diagnostics; _i < diagnostics_3.length; _i++) { - var diagnostic = diagnostics_3[_i]; - diagnostic.start = diagnostic.start - 1; + var program = ts.createProgram([inputFileName], options, compilerHost); + if (transpileOptions.reportDiagnostics) { + ts.addRange(/*to*/ diagnostics, /*from*/ program.getSyntacticDiagnostics(sourceFile)); + ts.addRange(/*to*/ diagnostics, /*from*/ program.getOptionsDiagnostics()); } - return { configJsonObject: configJsonObject, diagnostics: diagnostics }; + // Emit + program.emit(); + ts.Debug.assert(outputText !== undefined, "Output generation failed"); + return { outputText: outputText, diagnostics: diagnostics, sourceMapText: sourceMapText }; } - ts.parseAndReEmitConfigJSONFile = parseAndReEmitConfigJSONFile; -})(ts || (ts = {})); -// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. -// See LICENSE.txt in the project root for complete license information. -/// -/* @internal */ -var ts; -(function (ts) { - var JsTyping; - (function (JsTyping) { - ; - ; - // A map of loose file names to library names - // that we are confident require typings - var safeList; - /** - * @param host is the object providing I/O related operations. - * @param fileNames are the file names that belong to the same project - * @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 compilerOptions are used as a source for typing inference - */ - function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typingOptions, compilerOptions) { - // A typing name to typing file path mapping - var inferredTypings = ts.createMap(); - if (!typingOptions || !typingOptions.enableAutoDiscovery) { - return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] }; + ts.transpileModule = transpileModule; + /* + * This is a shortcut function for transpileModule - it accepts transpileOptions as parameters and returns only outputText part of the result. + */ + function transpile(input, compilerOptions, fileName, diagnostics, moduleName) { + var output = transpileModule(input, { compilerOptions: compilerOptions, fileName: fileName, reportDiagnostics: !!diagnostics, moduleName: moduleName }); + // addRange correctly handles cases when wither 'from' or 'to' argument is missing + ts.addRange(diagnostics, output.diagnostics); + return output.outputText; + } + ts.transpile = transpile; + var commandLineOptionsStringToEnum; + /** JS users may pass in string values for enum compiler options (such as ModuleKind), so convert. */ + function fixupCompilerOptions(options, diagnostics) { + // Lazily create this value to fix module loading errors. + commandLineOptionsStringToEnum = commandLineOptionsStringToEnum || ts.filter(ts.optionDeclarations, function (o) { + return typeof o.type === "object" && !ts.forEachProperty(o.type, function (v) { return typeof v !== "number"; }); + }); + options = ts.clone(options); + var _loop_3 = function (opt) { + if (!ts.hasProperty(options, opt.name)) { + return "continue"; } - // Only infer typings for .js and .jsx files - fileNames = ts.filter(ts.map(fileNames, ts.normalizePath), function (f) { return ts.scriptKindIs(f, /*LanguageServiceHost*/ undefined, 1 /* JS */, 2 /* JSX */); }); - if (!safeList) { - var result = ts.readConfigFile(safeListPath, function (path) { return host.readFile(path); }); - safeList = ts.createMap(result.config); + var value = options[opt.name]; + // Value should be a key of opt.type + if (typeof value === "string") { + // If value is not a string, this will fail + options[opt.name] = ts.parseCustomTypeOption(opt, value, diagnostics); } - var filesToWatch = []; - // Directories to search for package.json, bower.json and other typing information - var searchDirs = []; - var exclude = []; - mergeTypings(typingOptions.include); - exclude = typingOptions.exclude || []; - var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath); - if (projectRootPath !== undefined) { - possibleSearchDirs.push(projectRootPath); - } - searchDirs = ts.deduplicate(possibleSearchDirs); - for (var _i = 0, searchDirs_1 = searchDirs; _i < searchDirs_1.length; _i++) { - var searchDir = searchDirs_1[_i]; - var packageJsonPath = ts.combinePaths(searchDir, "package.json"); - getTypingNamesFromJson(packageJsonPath, filesToWatch); - var bowerJsonPath = ts.combinePaths(searchDir, "bower.json"); - getTypingNamesFromJson(bowerJsonPath, filesToWatch); - var nodeModulesPath = ts.combinePaths(searchDir, "node_modules"); - getTypingNamesFromNodeModuleFolder(nodeModulesPath); - } - getTypingNamesFromSourceFileNames(fileNames); - // Add the cached typing locations for inferred typings that are already installed - for (var name_39 in packageNameToTypingLocation) { - if (name_39 in inferredTypings && !inferredTypings[name_39]) { - inferredTypings[name_39] = packageNameToTypingLocation[name_39]; + else { + if (!ts.forEachProperty(opt.type, function (v) { return v === value; })) { + // Supplied value isn't a valid enum value. + diagnostics.push(ts.createCompilerDiagnosticForInvalidCustomType(opt)); } } - // Remove typings that the user has added to the exclude list - for (var _a = 0, exclude_1 = exclude; _a < exclude_1.length; _a++) { - var excludeTypingName = exclude_1[_a]; - delete inferredTypings[excludeTypingName]; - } - var newTypingNames = []; - var cachedTypingPaths = []; - for (var typing in inferredTypings) { - if (inferredTypings[typing] !== undefined) { - cachedTypingPaths.push(inferredTypings[typing]); - } - else { - newTypingNames.push(typing); - } - } - return { cachedTypingPaths: cachedTypingPaths, newTypingNames: newTypingNames, filesToWatch: filesToWatch }; - /** - * Merge a given list of typingNames to the inferredTypings map - */ - function mergeTypings(typingNames) { - if (!typingNames) { - return; - } - for (var _i = 0, typingNames_1 = typingNames; _i < typingNames_1.length; _i++) { - var typing = typingNames_1[_i]; - if (!(typing in inferredTypings)) { - inferredTypings[typing] = undefined; - } - } - } - /** - * Get the typing info from common package manager json files like package.json or bower.json - */ - function getTypingNamesFromJson(jsonPath, filesToWatch) { - var result = ts.readConfigFile(jsonPath, function (path) { return host.readFile(path); }); - if (result.config) { - var jsonConfig = result.config; - filesToWatch.push(jsonPath); - if (jsonConfig.dependencies) { - mergeTypings(ts.getOwnKeys(jsonConfig.dependencies)); - } - if (jsonConfig.devDependencies) { - mergeTypings(ts.getOwnKeys(jsonConfig.devDependencies)); - } - if (jsonConfig.optionalDependencies) { - mergeTypings(ts.getOwnKeys(jsonConfig.optionalDependencies)); - } - if (jsonConfig.peerDependencies) { - mergeTypings(ts.getOwnKeys(jsonConfig.peerDependencies)); - } - } - } - /** - * Infer typing names from given file names. For example, the file name "jquery-min.2.3.4.js" - * should be inferred to the 'jquery' typing name; and "angular-route.1.2.3.js" should be inferred - * to the 'angular-route' typing name. - * @param fileNames are the names for source files in the project - */ - function getTypingNamesFromSourceFileNames(fileNames) { - var jsFileNames = ts.filter(fileNames, ts.hasJavaScriptFileExtension); - var inferredTypingNames = ts.map(jsFileNames, function (f) { return ts.removeFileExtension(ts.getBaseFileName(f.toLowerCase())); }); - var cleanedTypingNames = ts.map(inferredTypingNames, function (f) { return f.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, ""); }); - if (safeList === undefined) { - mergeTypings(cleanedTypingNames); - } - else { - mergeTypings(ts.filter(cleanedTypingNames, function (f) { return f in safeList; })); - } - var hasJsxFile = ts.forEach(fileNames, function (f) { return ts.scriptKindIs(f, /*LanguageServiceHost*/ undefined, 2 /* JSX */); }); - if (hasJsxFile) { - mergeTypings(["react"]); - } - } - /** - * Infer typing names from node_module folder - * @param nodeModulesPath is the path to the "node_modules" folder - */ - function getTypingNamesFromNodeModuleFolder(nodeModulesPath) { - // Todo: add support for ModuleResolutionHost too - if (!host.directoryExists(nodeModulesPath)) { - return; - } - var typingNames = []; - var fileNames = host.readDirectory(nodeModulesPath, ["*.json"], /*excludes*/ undefined, /*includes*/ undefined, /*depth*/ 2); - for (var _i = 0, fileNames_2 = fileNames; _i < fileNames_2.length; _i++) { - var fileName = fileNames_2[_i]; - var normalizedFileName = ts.normalizePath(fileName); - if (ts.getBaseFileName(normalizedFileName) !== "package.json") { - continue; - } - var result = ts.readConfigFile(normalizedFileName, function (path) { return host.readFile(path); }); - if (!result.config) { - continue; - } - var packageJson = result.config; - // npm 3's package.json contains a "_requiredBy" field - // we should include all the top level module names for npm 2, and only module names whose - // "_requiredBy" field starts with "#" or equals "/" for npm 3. - if (packageJson._requiredBy && - ts.filter(packageJson._requiredBy, function (r) { return r[0] === "#" || r === "/"; }).length === 0) { - continue; - } - // If the package has its own d.ts typings, those will take precedence. Otherwise the package name will be used - // to download d.ts files from DefinitelyTyped - if (!packageJson.name) { - continue; - } - if (packageJson.typings) { - var absolutePath = ts.getNormalizedAbsolutePath(packageJson.typings, ts.getDirectoryPath(normalizedFileName)); - inferredTypings[packageJson.name] = absolutePath; - } - else { - typingNames.push(packageJson.name); - } - } - mergeTypings(typingNames); - } + }; + for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) { + var opt = commandLineOptionsStringToEnum_1[_i]; + _loop_3(opt); } - JsTyping.discoverTypings = discoverTypings; - })(JsTyping = ts.JsTyping || (ts.JsTyping = {})); + return options; + } })(ts || (ts = {})); /// /// @@ -50320,8 +74847,8 @@ var ts; (function (ts) { var formatting; (function (formatting) { - var standardScanner = ts.createScanner(2 /* Latest */, /*skipTrivia*/ false, 0 /* Standard */); - var jsxScanner = ts.createScanner(2 /* Latest */, /*skipTrivia*/ false, 1 /* JSX */); + var standardScanner = ts.createScanner(5 /* Latest */, /*skipTrivia*/ false, 0 /* Standard */); + var jsxScanner = ts.createScanner(5 /* Latest */, /*skipTrivia*/ false, 1 /* JSX */); /** * Scanner that is currently used for formatting */ @@ -50336,7 +74863,7 @@ var ts; ScanAction[ScanAction["RescanJsxText"] = 5] = "RescanJsxText"; })(ScanAction || (ScanAction = {})); function getFormattingScanner(sourceFile, startPos, endPos) { - ts.Debug.assert(scanner === undefined); + ts.Debug.assert(scanner === undefined, "Scanner should be undefined"); scanner = sourceFile.languageVariant === 1 /* JSX */ ? jsxScanner : standardScanner; scanner.setText(sourceFile.text); scanner.setTextPos(startPos); @@ -50361,7 +74888,7 @@ var ts; } }; function advance() { - ts.Debug.assert(scanner !== undefined); + ts.Debug.assert(scanner !== undefined, "Scanner should be present"); lastTokenInfo = undefined; var isStarted = scanner.getStartPos() !== startPos; if (isStarted) { @@ -50403,11 +74930,11 @@ var ts; function shouldRescanGreaterThanToken(node) { if (node) { switch (node.kind) { - case 29 /* GreaterThanEqualsToken */: - case 64 /* GreaterThanGreaterThanEqualsToken */: - case 65 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 45 /* GreaterThanGreaterThanGreaterThanToken */: - case 44 /* GreaterThanGreaterThanToken */: + case 30 /* GreaterThanEqualsToken */: + case 65 /* GreaterThanGreaterThanEqualsToken */: + case 66 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 46 /* GreaterThanGreaterThanGreaterThanToken */: + case 45 /* GreaterThanGreaterThanToken */: return true; } } @@ -50416,27 +74943,27 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 246 /* JsxAttribute */: - case 243 /* JsxOpeningElement */: - case 245 /* JsxClosingElement */: - case 242 /* JsxSelfClosingElement */: - return node.kind === 69 /* Identifier */; + case 250 /* JsxAttribute */: + case 248 /* JsxOpeningElement */: + case 249 /* JsxClosingElement */: + case 247 /* JsxSelfClosingElement */: + return node.kind === 70 /* Identifier */; } } return false; } function shouldRescanJsxText(node) { - return node && node.kind === 244 /* JsxText */; + return node && node.kind === 10 /* JsxText */; } function shouldRescanSlashToken(container) { - return container.kind === 10 /* RegularExpressionLiteral */; + return container.kind === 11 /* RegularExpressionLiteral */; } function shouldRescanTemplateToken(container) { - return container.kind === 13 /* TemplateMiddle */ || - container.kind === 14 /* TemplateTail */; + return container.kind === 14 /* TemplateMiddle */ || + container.kind === 15 /* TemplateTail */; } function startsWithSlashToken(t) { - return t === 39 /* SlashToken */ || t === 61 /* SlashEqualsToken */; + return t === 40 /* SlashToken */ || t === 62 /* SlashEqualsToken */; } function readTokenInfo(n) { ts.Debug.assert(scanner !== undefined); @@ -50477,7 +75004,7 @@ var ts; scanner.scan(); } var currentToken = scanner.getToken(); - if (expectedScanAction === 1 /* RescanGreaterThanToken */ && currentToken === 27 /* GreaterThanToken */) { + if (expectedScanAction === 1 /* RescanGreaterThanToken */ && currentToken === 28 /* GreaterThanToken */) { currentToken = scanner.reScanGreaterToken(); ts.Debug.assert(n.kind === currentToken); lastScanAction = 1 /* RescanGreaterThanToken */; @@ -50487,11 +75014,11 @@ var ts; ts.Debug.assert(n.kind === currentToken); lastScanAction = 2 /* RescanSlashToken */; } - else if (expectedScanAction === 3 /* RescanTemplateToken */ && currentToken === 16 /* CloseBraceToken */) { + else if (expectedScanAction === 3 /* RescanTemplateToken */ && currentToken === 17 /* CloseBraceToken */) { currentToken = scanner.reScanTemplateToken(); lastScanAction = 3 /* RescanTemplateToken */; } - else if (expectedScanAction === 4 /* RescanJsxIdentifier */ && currentToken === 69 /* Identifier */) { + else if (expectedScanAction === 4 /* RescanJsxIdentifier */ && currentToken === 70 /* Identifier */) { currentToken = scanner.scanJsxIdentifier(); lastScanAction = 4 /* RescanJsxIdentifier */; } @@ -50634,8 +75161,8 @@ var ts; return startLine === endLine; }; FormattingContext.prototype.BlockIsOnOneLine = function (node) { - var openBrace = ts.findChildOfKind(node, 15 /* OpenBraceToken */, this.sourceFile); - var closeBrace = ts.findChildOfKind(node, 16 /* CloseBraceToken */, this.sourceFile); + var openBrace = ts.findChildOfKind(node, 16 /* OpenBraceToken */, this.sourceFile); + var closeBrace = ts.findChildOfKind(node, 17 /* CloseBraceToken */, this.sourceFile); if (openBrace && closeBrace) { var startLine = this.sourceFile.getLineAndCharacterOfPosition(openBrace.getEnd()).line; var endLine = this.sourceFile.getLineAndCharacterOfPosition(closeBrace.getStart(this.sourceFile)).line; @@ -50654,14 +75181,14 @@ var ts; (function (ts) { var formatting; (function (formatting) { + var FormattingRequestKind; (function (FormattingRequestKind) { FormattingRequestKind[FormattingRequestKind["FormatDocument"] = 0] = "FormatDocument"; FormattingRequestKind[FormattingRequestKind["FormatSelection"] = 1] = "FormatSelection"; FormattingRequestKind[FormattingRequestKind["FormatOnEnter"] = 2] = "FormatOnEnter"; FormattingRequestKind[FormattingRequestKind["FormatOnSemicolon"] = 3] = "FormatOnSemicolon"; FormattingRequestKind[FormattingRequestKind["FormatOnClosingCurlyBrace"] = 4] = "FormatOnClosingCurlyBrace"; - })(formatting.FormattingRequestKind || (formatting.FormattingRequestKind = {})); - var FormattingRequestKind = formatting.FormattingRequestKind; + })(FormattingRequestKind = formatting.FormattingRequestKind || (formatting.FormattingRequestKind = {})); })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); /// @@ -50693,13 +75220,13 @@ var ts; (function (ts) { var formatting; (function (formatting) { + var RuleAction; (function (RuleAction) { RuleAction[RuleAction["Ignore"] = 1] = "Ignore"; RuleAction[RuleAction["Space"] = 2] = "Space"; RuleAction[RuleAction["NewLine"] = 4] = "NewLine"; RuleAction[RuleAction["Delete"] = 8] = "Delete"; - })(formatting.RuleAction || (formatting.RuleAction = {})); - var RuleAction = formatting.RuleAction; + })(RuleAction = formatting.RuleAction || (formatting.RuleAction = {})); })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); /// @@ -50740,11 +75267,11 @@ var ts; (function (ts) { var formatting; (function (formatting) { + var RuleFlags; (function (RuleFlags) { RuleFlags[RuleFlags["None"] = 0] = "None"; RuleFlags[RuleFlags["CanDeleteNewLines"] = 1] = "CanDeleteNewLines"; - })(formatting.RuleFlags || (formatting.RuleFlags = {})); - var RuleFlags = formatting.RuleFlags; + })(RuleFlags = formatting.RuleFlags || (formatting.RuleFlags = {})); })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); /// @@ -50783,7 +75310,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; } @@ -50802,9 +75329,9 @@ var ts; } return true; }; - RuleOperationContext.Any = new RuleOperationContext(); return RuleOperationContext; }()); + RuleOperationContext.Any = new RuleOperationContext(); formatting.RuleOperationContext = RuleOperationContext; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -50823,124 +75350,127 @@ var ts; this.IgnoreBeforeComment = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.Comments), formatting.RuleOperation.create1(1 /* Ignore */)); this.IgnoreAfterLineComment = new formatting.Rule(formatting.RuleDescriptor.create3(2 /* SingleLineCommentTrivia */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create1(1 /* Ignore */)); // Space after keyword but not before ; or : or ? - this.NoSpaceBeforeSemicolon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 23 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeColon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 54 /* ColonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); - this.NoSpaceBeforeQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 53 /* QuestionToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); - this.SpaceAfterColon = new formatting.Rule(formatting.RuleDescriptor.create3(54 /* ColonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 2 /* Space */)); - this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(53 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsConditionalOperatorContext), 2 /* Space */)); - this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(53 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); - this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(23 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.NoSpaceBeforeSemicolon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 24 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeColon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 55 /* ColonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); + this.NoSpaceBeforeQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 54 /* QuestionToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); + this.SpaceAfterColon = new formatting.Rule(formatting.RuleDescriptor.create3(55 /* ColonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 2 /* Space */)); + this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(54 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsConditionalOperatorContext), 2 /* Space */)); + this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(54 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(24 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // Space after }. - this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* CloseBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2 /* Space */)); + this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* CloseBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2 /* Space */)); // Special case for (}, else) and (}, while) since else & while tokens are not part of the tree which makes SpaceAfterCloseBrace rule not applied - this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* CloseBraceToken */, 80 /* ElseKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); - this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* CloseBraceToken */, 104 /* WhileKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); - this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* CloseBraceToken */, formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 20 /* CloseBracketToken */, 24 /* CommaToken */, 23 /* SemicolonToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(17 /* CloseBraceToken */, 81 /* ElseKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(17 /* CloseBraceToken */, 105 /* WhileKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* CloseBraceToken */, formatting.Shared.TokenRange.FromTokens([19 /* CloseParenToken */, 21 /* CloseBracketToken */, 25 /* CommaToken */, 24 /* SemicolonToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // No space for dot - this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 21 /* DotToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(21 /* DotToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 22 /* DotToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(22 /* DotToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // No space before and after indexer - this.NoSpaceBeforeOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 19 /* OpenBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create3(20 /* CloseBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext), 8 /* Delete */)); + this.NoSpaceBeforeOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20 /* OpenBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create3(21 /* CloseBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext), 8 /* Delete */)); // Place a space before open brace in a function declaration this.FunctionOpenBraceLeftTokenRange = formatting.Shared.TokenRange.AnyIncludingMultilineComments; - this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); + this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); // Place a space before open brace in a TypeScript declaration that has braces as children (class, module, enum, etc) - this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([69 /* Identifier */, 3 /* MultiLineCommentTrivia */, 73 /* ClassKeyword */, 82 /* ExportKeyword */, 89 /* ImportKeyword */]); - this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); + this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([70 /* Identifier */, 3 /* MultiLineCommentTrivia */, 74 /* ClassKeyword */, 83 /* ExportKeyword */, 90 /* ImportKeyword */]); + this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); // Place a space before open brace in a control flow construct - this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 79 /* DoKeyword */, 100 /* TryKeyword */, 85 /* FinallyKeyword */, 80 /* ElseKeyword */]); - this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); + this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([19 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 80 /* DoKeyword */, 101 /* TryKeyword */, 86 /* FinallyKeyword */, 81 /* ElseKeyword */]); + this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); // Insert a space after { and before } in single-line contexts, but remove space from empty object literals {}. - this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2 /* Space */)); - this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2 /* Space */)); - this.NoSpaceBetweenEmptyBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(15 /* OpenBraceToken */, 16 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectContext), 8 /* Delete */)); + this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2 /* Space */)); + this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2 /* Space */)); + this.NoSpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 8 /* Delete */)); + this.NoSpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 8 /* Delete */)); + this.NoSpaceBetweenEmptyBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* OpenBraceToken */, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectContext), 8 /* Delete */)); // Insert new line after { and before } in multi-line contexts. - this.NewLineAfterOpenBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create3(15 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4 /* NewLine */)); + this.NewLineAfterOpenBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4 /* NewLine */)); // For functions and control block place } on a new line [multi-line rule] - this.NewLineBeforeCloseBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.AnyIncludingMultilineComments, 16 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4 /* NewLine */)); + this.NewLineBeforeCloseBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.AnyIncludingMultilineComments, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4 /* NewLine */)); // Special handling of unary operators. // Prefix operators generally shouldn't have a space between // them and their target unary expression. this.NoSpaceAfterUnaryPrefixOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.UnaryPrefixOperators, formatting.Shared.TokenRange.UnaryPrefixExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); - this.NoSpaceAfterUnaryPreincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(41 /* PlusPlusToken */, formatting.Shared.TokenRange.UnaryPreincrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterUnaryPredecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(42 /* MinusMinusToken */, formatting.Shared.TokenRange.UnaryPredecrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeUnaryPostincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostincrementExpressions, 41 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeUnaryPostdecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 42 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterUnaryPreincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(42 /* PlusPlusToken */, formatting.Shared.TokenRange.UnaryPreincrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterUnaryPredecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(43 /* MinusMinusToken */, formatting.Shared.TokenRange.UnaryPredecrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeUnaryPostincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostincrementExpressions, 42 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeUnaryPostdecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 43 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // More unary operator special-casing. // DevDiv 181814: Be careful when removing leading whitespace // around unary operators. Examples: // 1 - -2 --X--> 1--2 // a + ++b --X--> a+++b - this.SpaceAfterPostincrementWhenFollowedByAdd = new formatting.Rule(formatting.RuleDescriptor.create1(41 /* PlusPlusToken */, 35 /* PlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterAddWhenFollowedByUnaryPlus = new formatting.Rule(formatting.RuleDescriptor.create1(35 /* PlusToken */, 35 /* PlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterAddWhenFollowedByPreincrement = new formatting.Rule(formatting.RuleDescriptor.create1(35 /* PlusToken */, 41 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterPostdecrementWhenFollowedBySubtract = new formatting.Rule(formatting.RuleDescriptor.create1(42 /* MinusMinusToken */, 36 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(36 /* MinusToken */, 36 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(36 /* MinusToken */, 42 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 24 /* CommaToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); - this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([102 /* VarKeyword */, 98 /* ThrowKeyword */, 92 /* NewKeyword */, 78 /* DeleteKeyword */, 94 /* ReturnKeyword */, 101 /* TypeOfKeyword */, 119 /* AwaitKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); - this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([108 /* LetKeyword */, 74 /* ConstKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2 /* Space */)); - this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8 /* Delete */)); - this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(87 /* FunctionKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); - this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), 8 /* Delete */)); - this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(103 /* VoidKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsVoidOpContext), 2 /* Space */)); - this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(94 /* ReturnKeyword */, 23 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterPostincrementWhenFollowedByAdd = new formatting.Rule(formatting.RuleDescriptor.create1(42 /* PlusPlusToken */, 36 /* PlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterAddWhenFollowedByUnaryPlus = new formatting.Rule(formatting.RuleDescriptor.create1(36 /* PlusToken */, 36 /* PlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterAddWhenFollowedByPreincrement = new formatting.Rule(formatting.RuleDescriptor.create1(36 /* PlusToken */, 42 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterPostdecrementWhenFollowedBySubtract = new formatting.Rule(formatting.RuleDescriptor.create1(43 /* MinusMinusToken */, 37 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(37 /* MinusToken */, 37 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(37 /* MinusToken */, 43 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 25 /* CommaToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([103 /* VarKeyword */, 99 /* ThrowKeyword */, 93 /* NewKeyword */, 79 /* DeleteKeyword */, 95 /* ReturnKeyword */, 102 /* TypeOfKeyword */, 120 /* AwaitKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([109 /* LetKeyword */, 75 /* ConstKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2 /* Space */)); + this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8 /* Delete */)); + this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(88 /* FunctionKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.SpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), 2 /* Space */)); + this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsFunctionDeclContext), 8 /* Delete */)); + this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(104 /* VoidKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsVoidOpContext), 2 /* Space */)); + this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(95 /* ReturnKeyword */, 24 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // Add a space between statements. All keywords except (do,else,case) has open/close parens after them. // So, we have a rule to add a space for [),Any], [do,Any], [else,Any], and [case,Any] - this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 79 /* DoKeyword */, 80 /* ElseKeyword */, 71 /* CaseKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonJsxElementContext, Rules.IsNotForContext), 2 /* Space */)); + this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([19 /* CloseParenToken */, 80 /* DoKeyword */, 81 /* ElseKeyword */, 72 /* CaseKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonJsxElementContext, Rules.IsNotForContext), 2 /* Space */)); // This low-pri rule takes care of "try {" and "finally {" in case the rule SpaceBeforeOpenBraceInControl didn't execute on FormatOnEnter. - this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([100 /* TryKeyword */, 85 /* FinallyKeyword */]), 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([101 /* TryKeyword */, 86 /* FinallyKeyword */]), 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // get x() {} // set x(val) {} - this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([123 /* GetKeyword */, 131 /* SetKeyword */]), 69 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([124 /* GetKeyword */, 133 /* SetKeyword */]), 70 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); // Special case for binary operators (that are keywords). For these we have to add a space and shouldn't follow any user options. this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); // TypeScript-specific higher priority rules // Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses - this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(121 /* ConstructorKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(122 /* ConstructorKeyword */, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(122 /* ConstructorKeyword */, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // Use of module as a function call. e.g.: import m2 = module("m2"); - this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([125 /* ModuleKeyword */, 129 /* RequireKeyword */]), 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([127 /* ModuleKeyword */, 131 /* RequireKeyword */]), 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // Add a space around certain TypeScript keywords - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([115 /* AbstractKeyword */, 73 /* ClassKeyword */, 122 /* DeclareKeyword */, 77 /* DefaultKeyword */, 81 /* EnumKeyword */, 82 /* ExportKeyword */, 83 /* ExtendsKeyword */, 123 /* GetKeyword */, 106 /* ImplementsKeyword */, 89 /* ImportKeyword */, 107 /* InterfaceKeyword */, 125 /* ModuleKeyword */, 126 /* NamespaceKeyword */, 110 /* PrivateKeyword */, 112 /* PublicKeyword */, 111 /* ProtectedKeyword */, 131 /* SetKeyword */, 113 /* StaticKeyword */, 134 /* TypeKeyword */, 136 /* FromKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); - this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([83 /* ExtendsKeyword */, 106 /* ImplementsKeyword */, 136 /* FromKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([116 /* AbstractKeyword */, 74 /* ClassKeyword */, 123 /* DeclareKeyword */, 78 /* DefaultKeyword */, 82 /* EnumKeyword */, 83 /* ExportKeyword */, 84 /* ExtendsKeyword */, 124 /* GetKeyword */, 107 /* ImplementsKeyword */, 90 /* ImportKeyword */, 108 /* InterfaceKeyword */, 127 /* ModuleKeyword */, 128 /* NamespaceKeyword */, 111 /* PrivateKeyword */, 113 /* PublicKeyword */, 112 /* ProtectedKeyword */, 130 /* ReadonlyKeyword */, 133 /* SetKeyword */, 114 /* StaticKeyword */, 136 /* TypeKeyword */, 138 /* FromKeyword */, 126 /* KeyOfKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([84 /* ExtendsKeyword */, 107 /* ImplementsKeyword */, 138 /* FromKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" { - this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9 /* StringLiteral */, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2 /* Space */)); + this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9 /* StringLiteral */, 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2 /* Space */)); // Lambda expressions - this.SpaceBeforeArrow = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 34 /* EqualsGreaterThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); - this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(34 /* EqualsGreaterThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceBeforeArrow = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 35 /* EqualsGreaterThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(35 /* EqualsGreaterThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // Optional parameters and let args - this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(22 /* DotDotDotToken */, 69 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(53 /* QuestionToken */, formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 24 /* CommaToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); + this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(23 /* DotDotDotToken */, 70 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(54 /* QuestionToken */, formatting.Shared.TokenRange.FromTokens([19 /* CloseParenToken */, 25 /* CommaToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); // generics and type assertions - this.NoSpaceBeforeOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.TypeNames, 25 /* LessThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); - this.NoSpaceBetweenCloseParenAndAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create1(18 /* CloseParenToken */, 25 /* LessThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); - this.NoSpaceAfterOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(25 /* LessThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); - this.NoSpaceBeforeCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 27 /* GreaterThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); - this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(27 /* GreaterThanToken */, formatting.Shared.TokenRange.FromTokens([17 /* OpenParenToken */, 19 /* OpenBracketToken */, 27 /* GreaterThanToken */, 24 /* CommaToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); - this.NoSpaceAfterTypeAssertion = new formatting.Rule(formatting.RuleDescriptor.create3(27 /* GreaterThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeAssertionContext), 8 /* Delete */)); + this.NoSpaceBeforeOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.TypeNames, 26 /* LessThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); + this.NoSpaceBetweenCloseParenAndAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create1(19 /* CloseParenToken */, 26 /* LessThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); + this.NoSpaceAfterOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(26 /* LessThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); + this.NoSpaceBeforeCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 28 /* GreaterThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); + this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(28 /* GreaterThanToken */, formatting.Shared.TokenRange.FromTokens([18 /* OpenParenToken */, 20 /* OpenBracketToken */, 28 /* GreaterThanToken */, 25 /* CommaToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); // Remove spaces in empty interface literals. e.g.: x: {} - this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(15 /* OpenBraceToken */, 16 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectTypeContext), 8 /* Delete */)); + this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* OpenBraceToken */, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectTypeContext), 8 /* Delete */)); // decorators - this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 55 /* AtToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); - this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(55 /* AtToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); - this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([115 /* AbstractKeyword */, 69 /* Identifier */, 82 /* ExportKeyword */, 77 /* DefaultKeyword */, 73 /* ClassKeyword */, 113 /* StaticKeyword */, 112 /* PublicKeyword */, 110 /* PrivateKeyword */, 111 /* ProtectedKeyword */, 123 /* GetKeyword */, 131 /* SetKeyword */, 19 /* OpenBracketToken */, 37 /* AsteriskToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2 /* Space */)); - this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(87 /* FunctionKeyword */, 37 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8 /* Delete */)); - this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(37 /* AsteriskToken */, formatting.Shared.TokenRange.FromTokens([69 /* Identifier */, 17 /* OpenParenToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2 /* Space */)); - this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(114 /* YieldKeyword */, 37 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8 /* Delete */)); - this.SpaceBetweenYieldOrYieldStarAndOperand = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([114 /* YieldKeyword */, 37 /* AsteriskToken */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 2 /* Space */)); + this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 56 /* AtToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(56 /* AtToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([116 /* AbstractKeyword */, 70 /* Identifier */, 83 /* ExportKeyword */, 78 /* DefaultKeyword */, 74 /* ClassKeyword */, 114 /* StaticKeyword */, 113 /* PublicKeyword */, 111 /* PrivateKeyword */, 112 /* ProtectedKeyword */, 124 /* GetKeyword */, 133 /* SetKeyword */, 20 /* OpenBracketToken */, 38 /* AsteriskToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2 /* Space */)); + this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(88 /* FunctionKeyword */, 38 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8 /* Delete */)); + this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(38 /* AsteriskToken */, formatting.Shared.TokenRange.FromTokens([70 /* Identifier */, 18 /* OpenParenToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2 /* Space */)); + this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(115 /* YieldKeyword */, 38 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8 /* Delete */)); + this.SpaceBetweenYieldOrYieldStarAndOperand = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([115 /* YieldKeyword */, 38 /* AsteriskToken */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 2 /* Space */)); // Async-await - this.SpaceBetweenAsyncAndOpenParen = new formatting.Rule(formatting.RuleDescriptor.create1(118 /* AsyncKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsArrowFunctionContext, Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); - this.SpaceBetweenAsyncAndFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(118 /* AsyncKeyword */, 87 /* FunctionKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceBetweenAsyncAndOpenParen = new formatting.Rule(formatting.RuleDescriptor.create1(119 /* AsyncKeyword */, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsArrowFunctionContext, Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceBetweenAsyncAndFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(119 /* AsyncKeyword */, 88 /* FunctionKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // template string - this.NoSpaceBetweenTagAndTemplateString = new formatting.Rule(formatting.RuleDescriptor.create3(69 /* Identifier */, formatting.Shared.TokenRange.FromTokens([11 /* NoSubstitutionTemplateLiteral */, 12 /* TemplateHead */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBetweenTagAndTemplateString = new formatting.Rule(formatting.RuleDescriptor.create3(70 /* Identifier */, formatting.Shared.TokenRange.FromTokens([12 /* NoSubstitutionTemplateLiteral */, 13 /* TemplateHead */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // jsx opening element - this.SpaceBeforeJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 69 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNextTokenParentJsxAttribute, Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); - this.SpaceBeforeSlashInJsxOpeningElement = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 39 /* SlashToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxSelfClosingElementContext, Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); - this.NoSpaceBeforeGreaterThanTokenInJsxOpeningElement = new formatting.Rule(formatting.RuleDescriptor.create1(39 /* SlashToken */, 27 /* GreaterThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxSelfClosingElementContext, Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeEqualInJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 56 /* EqualsToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxAttributeContext, Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterEqualInJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create3(56 /* EqualsToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxAttributeContext, Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.SpaceBeforeJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 70 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNextTokenParentJsxAttribute, Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceBeforeSlashInJsxOpeningElement = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 40 /* SlashToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxSelfClosingElementContext, Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.NoSpaceBeforeGreaterThanTokenInJsxOpeningElement = new formatting.Rule(formatting.RuleDescriptor.create1(40 /* SlashToken */, 28 /* GreaterThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxSelfClosingElementContext, Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeEqualInJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 57 /* EqualsToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxAttributeContext, Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterEqualInJsxAttribute = new formatting.Rule(formatting.RuleDescriptor.create3(57 /* EqualsToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsJsxAttributeContext, Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // These rules are higher in priority than user-configurable rules. this.HighPriorityCommonRules = [ this.IgnoreBeforeComment, this.IgnoreAfterLineComment, @@ -50955,7 +75485,7 @@ var ts; this.SpaceAfterPostdecrementWhenFollowedBySubtract, this.SpaceAfterSubtractWhenFollowedByUnaryMinus, this.SpaceAfterSubtractWhenFollowedByPredecrement, this.NoSpaceAfterCloseBrace, - this.SpaceAfterOpenBrace, this.SpaceBeforeCloseBrace, this.NewLineBeforeCloseBraceInBlockContext, + this.NewLineBeforeCloseBraceInBlockContext, this.SpaceAfterCloseBrace, this.SpaceBetweenCloseBraceAndElse, this.SpaceBetweenCloseBraceAndWhile, this.NoSpaceBetweenEmptyBraceBrackets, this.NoSpaceBetweenFunctionKeywordAndStar, this.SpaceAfterStarInGeneratorDeclaration, this.SpaceAfterFunctionInFuncDecl, this.NewLineAfterOpenBraceInBlockContext, this.SpaceAfterGetSetInMember, @@ -50971,7 +75501,7 @@ var ts; this.SpaceBeforeJsxAttribute, this.SpaceBeforeSlashInJsxOpeningElement, this.NoSpaceBeforeGreaterThanTokenInJsxOpeningElement, this.NoSpaceBeforeEqualInJsxAttribute, this.NoSpaceAfterEqualInJsxAttribute, // TypeScript-specific rules - this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, + this.NoSpaceAfterModuleImport, this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, this.SpaceAfterModuleName, this.SpaceBeforeArrow, this.SpaceAfterArrow, @@ -50983,7 +75513,6 @@ var ts; this.NoSpaceAfterOpenAngularBracket, this.NoSpaceBeforeCloseAngularBracket, this.NoSpaceAfterCloseAngularBracket, - this.NoSpaceAfterTypeAssertion, this.SpaceBeforeAt, this.NoSpaceAfterAt, this.SpaceAfterDecorator, @@ -50996,64 +75525,66 @@ var ts; this.NoSpaceBeforeOpenBracket, this.NoSpaceAfterCloseBracket, this.SpaceAfterSemicolon, - this.NoSpaceBeforeOpenParenInFuncDecl, this.SpaceBetweenStatements, this.SpaceAfterTryFinally ]; /// /// Rules controlled by user options /// // Insert space after comma delimiter - this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(24 /* CommaToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonJsxElementContext, Rules.IsNextTokenNotCloseBracket), 2 /* Space */)); - this.NoSpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(24 /* CommaToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonJsxElementContext), 8 /* Delete */)); + this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(25 /* CommaToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonJsxElementContext, Rules.IsNextTokenNotCloseBracket), 2 /* Space */)); + this.NoSpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(25 /* CommaToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNonJsxElementContext), 8 /* Delete */)); // Insert space before and after binary operators this.SpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); this.SpaceAfterBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); this.NoSpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 8 /* Delete */)); this.NoSpaceAfterBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsBinaryOpContext), 8 /* Delete */)); // Insert space after keywords in control flow statements - this.SpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 2 /* Space */)); - this.NoSpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 8 /* Delete */)); + this.SpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 2 /* Space */)); + this.NoSpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 8 /* Delete */)); // Open Brace braces after function // TypeScript: Function can have return types, which can be made of tons of different token kinds - this.NewLineBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeMultilineBlockContext), 4 /* NewLine */), 1 /* CanDeleteNewLines */); + this.NewLineBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeMultilineBlockContext), 4 /* NewLine */), 1 /* CanDeleteNewLines */); // Open Brace braces after TypeScript module/class/interface - this.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsBeforeMultilineBlockContext), 4 /* NewLine */), 1 /* CanDeleteNewLines */); + this.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsBeforeMultilineBlockContext), 4 /* NewLine */), 1 /* CanDeleteNewLines */); // Open Brace braces after control block - this.NewLineBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsBeforeMultilineBlockContext), 4 /* NewLine */), 1 /* CanDeleteNewLines */); + this.NewLineBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 16 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsBeforeMultilineBlockContext), 4 /* NewLine */), 1 /* CanDeleteNewLines */); // Insert space after semicolon in for statement - this.SpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(23 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsForContext), 2 /* Space */)); - this.NoSpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(23 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsForContext), 8 /* Delete */)); + this.SpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(24 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsForContext), 2 /* Space */)); + this.NoSpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(24 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsForContext), 8 /* Delete */)); // Insert space after opening and before closing nonempty parenthesis - this.SpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* OpenParenToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); - this.SpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); - this.NoSpaceBetweenParens = new formatting.Rule(formatting.RuleDescriptor.create1(17 /* OpenParenToken */, 18 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* OpenParenToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(18 /* OpenParenToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 19 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.NoSpaceBetweenParens = new formatting.Rule(formatting.RuleDescriptor.create1(18 /* OpenParenToken */, 19 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(18 /* OpenParenToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 19 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // Insert space after opening and before closing nonempty brackets - this.SpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19 /* OpenBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); - this.SpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); - this.NoSpaceBetweenBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(19 /* OpenBracketToken */, 20 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19 /* OpenBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(20 /* OpenBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.SpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 21 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.NoSpaceBetweenBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(20 /* OpenBracketToken */, 21 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(20 /* OpenBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 21 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); // Insert space after opening and before closing template string braces - this.NoSpaceAfterTemplateHeadAndMiddle = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([12 /* TemplateHead */, 13 /* TemplateMiddle */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); - this.SpaceAfterTemplateHeadAndMiddle = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([12 /* TemplateHead */, 13 /* TemplateMiddle */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); - this.NoSpaceBeforeTemplateMiddleAndTail = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([13 /* TemplateMiddle */, 14 /* TemplateTail */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); - this.SpaceBeforeTemplateMiddleAndTail = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([13 /* TemplateMiddle */, 14 /* TemplateTail */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.NoSpaceAfterTemplateHeadAndMiddle = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([13 /* TemplateHead */, 14 /* TemplateMiddle */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterTemplateHeadAndMiddle = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([13 /* TemplateHead */, 14 /* TemplateMiddle */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); + this.NoSpaceBeforeTemplateMiddleAndTail = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([14 /* TemplateMiddle */, 15 /* TemplateTail */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8 /* Delete */)); + this.SpaceBeforeTemplateMiddleAndTail = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([14 /* TemplateMiddle */, 15 /* TemplateTail */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 2 /* Space */)); // No space after { and before } in JSX expression - this.NoSpaceAfterOpenBraceInJsxExpression = new formatting.Rule(formatting.RuleDescriptor.create3(15 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsJsxExpressionContext), 8 /* Delete */)); - this.SpaceAfterOpenBraceInJsxExpression = new formatting.Rule(formatting.RuleDescriptor.create3(15 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsJsxExpressionContext), 2 /* Space */)); - this.NoSpaceBeforeCloseBraceInJsxExpression = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsJsxExpressionContext), 8 /* Delete */)); - this.SpaceBeforeCloseBraceInJsxExpression = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsJsxExpressionContext), 2 /* Space */)); + this.NoSpaceAfterOpenBraceInJsxExpression = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsJsxExpressionContext), 8 /* Delete */)); + this.SpaceAfterOpenBraceInJsxExpression = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsJsxExpressionContext), 2 /* Space */)); + this.NoSpaceBeforeCloseBraceInJsxExpression = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsJsxExpressionContext), 8 /* Delete */)); + this.SpaceBeforeCloseBraceInJsxExpression = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsJsxExpressionContext), 2 /* Space */)); // Insert space after function keyword for anonymous functions - this.SpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(87 /* FunctionKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); - this.NoSpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(87 /* FunctionKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 8 /* Delete */)); + this.SpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(88 /* FunctionKeyword */, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.NoSpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(88 /* FunctionKeyword */, 18 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 8 /* Delete */)); + // No space after type assertion + this.NoSpaceAfterTypeAssertion = new formatting.Rule(formatting.RuleDescriptor.create3(28 /* GreaterThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeAssertionContext), 8 /* Delete */)); + this.SpaceAfterTypeAssertion = new formatting.Rule(formatting.RuleDescriptor.create3(28 /* GreaterThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsTypeAssertionContext), 2 /* Space */)); } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_40 in o) { - if (o[name_40] === rule) { - return name_40; + for (var name_50 in o) { + if (o[name_50] === rule) { + return name_50; } } throw new Error("Unknown rule"); @@ -51062,42 +75593,44 @@ var ts; /// Contexts /// Rules.IsForContext = function (context) { - return context.contextNode.kind === 206 /* ForStatement */; + return context.contextNode.kind === 211 /* ForStatement */; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); }; Rules.IsBinaryOpContext = function (context) { switch (context.contextNode.kind) { - case 187 /* BinaryExpression */: - case 188 /* ConditionalExpression */: - case 195 /* AsExpression */: - case 238 /* ExportSpecifier */: - case 234 /* ImportSpecifier */: - case 154 /* TypePredicate */: - case 162 /* UnionType */: - case 163 /* IntersectionType */: + case 192 /* BinaryExpression */: + case 193 /* ConditionalExpression */: + case 200 /* AsExpression */: + case 243 /* ExportSpecifier */: + case 239 /* ImportSpecifier */: + case 156 /* TypePredicate */: + case 164 /* UnionType */: + case 165 /* IntersectionType */: return true; // equals in binding elements: function foo([[x, y] = [1, 2]]) - case 169 /* BindingElement */: + case 174 /* BindingElement */: // equals in type X = ... - case 223 /* TypeAliasDeclaration */: + case 228 /* TypeAliasDeclaration */: // equal in import a = module('a'); - case 229 /* ImportEqualsDeclaration */: + case 234 /* ImportEqualsDeclaration */: // equal in let a = 0; - case 218 /* VariableDeclaration */: + case 223 /* VariableDeclaration */: // equal in p = 0; - case 142 /* Parameter */: - case 255 /* EnumMember */: - case 145 /* PropertyDeclaration */: - case 144 /* PropertySignature */: - return context.currentTokenSpan.kind === 56 /* EqualsToken */ || context.nextTokenSpan.kind === 56 /* EqualsToken */; + case 144 /* Parameter */: + case 260 /* EnumMember */: + case 147 /* PropertyDeclaration */: + case 146 /* PropertySignature */: + return context.currentTokenSpan.kind === 57 /* EqualsToken */ || context.nextTokenSpan.kind === 57 /* EqualsToken */; // "in" keyword in for (let x in []) { } - case 207 /* ForInStatement */: - return context.currentTokenSpan.kind === 90 /* InKeyword */ || context.nextTokenSpan.kind === 90 /* InKeyword */; + case 212 /* ForInStatement */: + // "in" keyword in [P in keyof T]: T[P] + case 143 /* TypeParameter */: + return context.currentTokenSpan.kind === 91 /* InKeyword */ || context.nextTokenSpan.kind === 91 /* InKeyword */; // Technically, "of" is not a binary operator, but format it the same way as "in" - case 208 /* ForOfStatement */: - return context.currentTokenSpan.kind === 138 /* OfKeyword */ || context.nextTokenSpan.kind === 138 /* OfKeyword */; + case 213 /* ForOfStatement */: + return context.currentTokenSpan.kind === 140 /* OfKeyword */ || context.nextTokenSpan.kind === 140 /* OfKeyword */; } return false; }; @@ -51105,7 +75638,7 @@ var ts; return !Rules.IsBinaryOpContext(context); }; Rules.IsConditionalOperatorContext = function (context) { - return context.contextNode.kind === 188 /* ConditionalExpression */; + return context.contextNode.kind === 193 /* ConditionalExpression */; }; Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { //// This check is mainly used inside SpaceBeforeOpenBraceInControl and SpaceBeforeOpenBraceInFunction. @@ -51149,127 +75682,133 @@ var ts; return true; } switch (node.kind) { - case 199 /* Block */: - case 227 /* CaseBlock */: - case 171 /* ObjectLiteralExpression */: - case 226 /* ModuleBlock */: + case 204 /* Block */: + case 232 /* CaseBlock */: + case 176 /* ObjectLiteralExpression */: + case 231 /* ModuleBlock */: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 220 /* FunctionDeclaration */: - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: + case 225 /* FunctionDeclaration */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: // case SyntaxKind.MemberFunctionDeclaration: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: // case SyntaxKind.MethodSignature: - case 151 /* CallSignature */: - case 179 /* FunctionExpression */: - case 148 /* Constructor */: - case 180 /* ArrowFunction */: + case 153 /* CallSignature */: + case 184 /* FunctionExpression */: + case 150 /* Constructor */: + case 185 /* ArrowFunction */: // case SyntaxKind.ConstructorDeclaration: // case SyntaxKind.SimpleArrowFunctionExpression: // case SyntaxKind.ParenthesizedArrowFunctionExpression: - case 222 /* InterfaceDeclaration */: + case 227 /* InterfaceDeclaration */: return true; } return false; }; Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) { - return context.contextNode.kind === 220 /* FunctionDeclaration */ || context.contextNode.kind === 179 /* FunctionExpression */; + return context.contextNode.kind === 225 /* FunctionDeclaration */ || context.contextNode.kind === 184 /* FunctionExpression */; }; Rules.IsTypeScriptDeclWithBlockContext = function (context) { return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode); }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 221 /* ClassDeclaration */: - case 192 /* ClassExpression */: - case 222 /* InterfaceDeclaration */: - case 224 /* EnumDeclaration */: - case 159 /* TypeLiteral */: - case 225 /* ModuleDeclaration */: - case 236 /* ExportDeclaration */: - case 237 /* NamedExports */: - case 230 /* ImportDeclaration */: - case 233 /* NamedImports */: + case 226 /* ClassDeclaration */: + case 197 /* ClassExpression */: + case 227 /* InterfaceDeclaration */: + case 229 /* EnumDeclaration */: + case 161 /* TypeLiteral */: + case 230 /* ModuleDeclaration */: + case 241 /* ExportDeclaration */: + case 242 /* NamedExports */: + case 235 /* ImportDeclaration */: + case 238 /* NamedImports */: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 221 /* ClassDeclaration */: - case 225 /* ModuleDeclaration */: - case 224 /* EnumDeclaration */: - case 199 /* Block */: - case 252 /* CatchClause */: - case 226 /* ModuleBlock */: - case 213 /* SwitchStatement */: + case 226 /* ClassDeclaration */: + case 230 /* ModuleDeclaration */: + case 229 /* EnumDeclaration */: + case 256 /* CatchClause */: + case 231 /* ModuleBlock */: + case 218 /* SwitchStatement */: return true; + case 204 /* Block */: { + var blockParent = context.currentTokenParent.parent; + if (blockParent.kind !== 185 /* ArrowFunction */ && + blockParent.kind !== 184 /* FunctionExpression */) { + return true; + } + } } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 203 /* IfStatement */: - case 213 /* SwitchStatement */: - case 206 /* ForStatement */: - case 207 /* ForInStatement */: - case 208 /* ForOfStatement */: - case 205 /* WhileStatement */: - case 216 /* TryStatement */: - case 204 /* DoStatement */: - case 212 /* WithStatement */: + case 208 /* IfStatement */: + case 218 /* SwitchStatement */: + case 211 /* ForStatement */: + case 212 /* ForInStatement */: + case 213 /* ForOfStatement */: + case 210 /* WhileStatement */: + case 221 /* TryStatement */: + case 209 /* DoStatement */: + case 217 /* WithStatement */: // TODO // case SyntaxKind.ElseClause: - case 252 /* CatchClause */: + case 256 /* CatchClause */: return true; default: return false; } }; Rules.IsObjectContext = function (context) { - return context.contextNode.kind === 171 /* ObjectLiteralExpression */; + return context.contextNode.kind === 176 /* ObjectLiteralExpression */; }; Rules.IsFunctionCallContext = function (context) { - return context.contextNode.kind === 174 /* CallExpression */; + return context.contextNode.kind === 179 /* CallExpression */; }; Rules.IsNewContext = function (context) { - return context.contextNode.kind === 175 /* NewExpression */; + return context.contextNode.kind === 180 /* NewExpression */; }; Rules.IsFunctionCallOrNewContext = function (context) { return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); }; Rules.IsPreviousTokenNotComma = function (context) { - return context.currentTokenSpan.kind !== 24 /* CommaToken */; + return context.currentTokenSpan.kind !== 25 /* CommaToken */; }; Rules.IsNextTokenNotCloseBracket = function (context) { - return context.nextTokenSpan.kind !== 20 /* CloseBracketToken */; + return context.nextTokenSpan.kind !== 21 /* CloseBracketToken */; }; Rules.IsArrowFunctionContext = function (context) { - return context.contextNode.kind === 180 /* ArrowFunction */; + return context.contextNode.kind === 185 /* ArrowFunction */; }; Rules.IsNonJsxSameLineTokenContext = function (context) { - return context.TokensAreOnSameLine() && context.contextNode.kind !== 244 /* JsxText */; + return context.TokensAreOnSameLine() && context.contextNode.kind !== 10 /* JsxText */; }; Rules.IsNonJsxElementContext = function (context) { - return context.contextNode.kind !== 241 /* JsxElement */; + return context.contextNode.kind !== 246 /* JsxElement */; }; Rules.IsJsxExpressionContext = function (context) { - return context.contextNode.kind === 248 /* JsxExpression */; + return context.contextNode.kind === 252 /* JsxExpression */; }; Rules.IsNextTokenParentJsxAttribute = function (context) { - return context.nextTokenParent.kind === 246 /* JsxAttribute */; + return context.nextTokenParent.kind === 250 /* JsxAttribute */; }; Rules.IsJsxAttributeContext = function (context) { - return context.contextNode.kind === 246 /* JsxAttribute */; + return context.contextNode.kind === 250 /* JsxAttribute */; }; Rules.IsJsxSelfClosingElementContext = function (context) { - return context.contextNode.kind === 242 /* JsxSelfClosingElement */; + return context.contextNode.kind === 247 /* JsxSelfClosingElement */; }; Rules.IsNotBeforeBlockInFunctionDeclarationContext = function (context) { return !Rules.IsFunctionDeclContext(context) && !Rules.IsBeforeBlockContext(context); @@ -51281,44 +75820,45 @@ var ts; !Rules.NodeIsInDecoratorContext(context.nextTokenParent); }; Rules.NodeIsInDecoratorContext = function (node) { - while (ts.isExpression(node)) { + while (ts.isPartOfExpression(node)) { node = node.parent; } - return node.kind === 143 /* Decorator */; + return node.kind === 145 /* Decorator */; }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 219 /* VariableDeclarationList */ && + return context.currentTokenParent.kind === 224 /* VariableDeclarationList */ && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind !== 2 /* FormatOnEnter */; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 225 /* ModuleDeclaration */; + return context.contextNode.kind === 230 /* ModuleDeclaration */; }; Rules.IsObjectTypeContext = function (context) { - return context.contextNode.kind === 159 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; + return context.contextNode.kind === 161 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; }; Rules.IsTypeArgumentOrParameterOrAssertion = function (token, parent) { - if (token.kind !== 25 /* LessThanToken */ && token.kind !== 27 /* GreaterThanToken */) { + if (token.kind !== 26 /* LessThanToken */ && token.kind !== 28 /* GreaterThanToken */) { return false; } switch (parent.kind) { - case 155 /* TypeReference */: - case 177 /* TypeAssertionExpression */: - case 221 /* ClassDeclaration */: - case 192 /* ClassExpression */: - case 222 /* InterfaceDeclaration */: - case 220 /* FunctionDeclaration */: - case 179 /* FunctionExpression */: - case 180 /* ArrowFunction */: - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - case 151 /* CallSignature */: - case 152 /* ConstructSignature */: - case 174 /* CallExpression */: - case 175 /* NewExpression */: - case 194 /* ExpressionWithTypeArguments */: + case 157 /* TypeReference */: + case 182 /* TypeAssertionExpression */: + case 228 /* TypeAliasDeclaration */: + case 226 /* ClassDeclaration */: + case 197 /* ClassExpression */: + case 227 /* InterfaceDeclaration */: + case 225 /* FunctionDeclaration */: + case 184 /* FunctionExpression */: + case 185 /* ArrowFunction */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + case 153 /* CallSignature */: + case 154 /* ConstructSignature */: + case 179 /* CallExpression */: + case 180 /* NewExpression */: + case 199 /* ExpressionWithTypeArguments */: return true; default: return false; @@ -51329,13 +75869,13 @@ var ts; Rules.IsTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); }; Rules.IsTypeAssertionContext = function (context) { - return context.contextNode.kind === 177 /* TypeAssertionExpression */; + return context.contextNode.kind === 182 /* TypeAssertionExpression */; }; Rules.IsVoidOpContext = function (context) { - return context.currentTokenSpan.kind === 103 /* VoidKeyword */ && context.currentTokenParent.kind === 183 /* VoidExpression */; + return context.currentTokenSpan.kind === 104 /* VoidKeyword */ && context.currentTokenParent.kind === 188 /* VoidExpression */; }; Rules.IsYieldOrYieldStarWithOperand = function (context) { - return context.contextNode.kind === 190 /* YieldExpression */ && context.contextNode.expression !== undefined; + return context.contextNode.kind === 195 /* YieldExpression */ && context.contextNode.expression !== undefined; }; return Rules; }()); @@ -51359,7 +75899,7 @@ var ts; return result; }; RulesMap.prototype.Initialize = function (rules) { - this.mapRowLength = 138 /* LastToken */ + 1; + this.mapRowLength = 140 /* LastToken */ + 1; this.map = new Array(this.mapRowLength * this.mapRowLength); // new Array(this.mapRowLength * this.mapRowLength); // This array is used only during construction of the rulesbucket in the map var rulesBucketConstructionStateList = new Array(this.map.length); // new Array(this.map.length); @@ -51373,8 +75913,8 @@ var ts; }); }; RulesMap.prototype.GetRuleBucketIndex = function (row, column) { + ts.Debug.assert(row <= 140 /* LastKeyword */ && column <= 140 /* LastKeyword */, "Must compute formatting context from tokens"); var rulesBucketIndex = (row * this.mapRowLength) + column; - // Debug.Assert(rulesBucketIndex < this.map.Length, "Trying to access an index outside the array."); return rulesBucketIndex; }; RulesMap.prototype.FillRule = function (rule, rulesBucketConstructionStateList) { @@ -51410,6 +75950,7 @@ var ts; formatting.RulesMap = RulesMap; var MaskBitSize = 5; var Mask = 0x1f; + var RulesPosition; (function (RulesPosition) { RulesPosition[RulesPosition["IgnoreRulesSpecific"] = 0] = "IgnoreRulesSpecific"; RulesPosition[RulesPosition["IgnoreRulesAny"] = MaskBitSize * 1] = "IgnoreRulesAny"; @@ -51417,8 +75958,7 @@ var ts; RulesPosition[RulesPosition["ContextRulesAny"] = MaskBitSize * 3] = "ContextRulesAny"; RulesPosition[RulesPosition["NoContextRulesSpecific"] = MaskBitSize * 4] = "NoContextRulesSpecific"; RulesPosition[RulesPosition["NoContextRulesAny"] = MaskBitSize * 5] = "NoContextRulesAny"; - })(formatting.RulesPosition || (formatting.RulesPosition = {})); - var RulesPosition = formatting.RulesPosition; + })(RulesPosition = formatting.RulesPosition || (formatting.RulesPosition = {})); var RulesBucketConstructionState = (function () { function RulesBucketConstructionState() { //// The Rules list contains all the inserted rules into a rulebucket in the following order: @@ -51554,12 +76094,12 @@ var ts; } TokenAllAccess.prototype.GetTokens = function () { var result = []; - for (var token = 0 /* FirstToken */; token <= 138 /* LastToken */; token++) { + for (var token = 0 /* FirstToken */; token <= 140 /* LastToken */; token++) { result.push(token); } return result; }; - TokenAllAccess.prototype.Contains = function (tokenValue) { + TokenAllAccess.prototype.Contains = function () { return true; }; TokenAllAccess.prototype.toString = function () { @@ -51594,21 +76134,21 @@ var ts; TokenRange.prototype.toString = function () { return this.tokenAccess.toString(); }; - TokenRange.Any = TokenRange.AllTokens(); - TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3 /* MultiLineCommentTrivia */])); - TokenRange.Keywords = TokenRange.FromRange(70 /* FirstKeyword */, 138 /* LastKeyword */); - TokenRange.BinaryOperators = TokenRange.FromRange(25 /* FirstBinaryOperator */, 68 /* LastBinaryOperator */); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([90 /* InKeyword */, 91 /* InstanceOfKeyword */, 138 /* OfKeyword */, 116 /* AsKeyword */, 124 /* IsKeyword */]); - TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([41 /* PlusPlusToken */, 42 /* MinusMinusToken */, 50 /* TildeToken */, 49 /* ExclamationToken */]); - TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([8 /* NumericLiteral */, 69 /* Identifier */, 17 /* OpenParenToken */, 19 /* OpenBracketToken */, 15 /* OpenBraceToken */, 97 /* ThisKeyword */, 92 /* NewKeyword */]); - TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([69 /* Identifier */, 17 /* OpenParenToken */, 97 /* ThisKeyword */, 92 /* NewKeyword */]); - TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([69 /* Identifier */, 18 /* CloseParenToken */, 20 /* CloseBracketToken */, 92 /* NewKeyword */]); - TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([69 /* Identifier */, 17 /* OpenParenToken */, 97 /* ThisKeyword */, 92 /* NewKeyword */]); - TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([69 /* Identifier */, 18 /* CloseParenToken */, 20 /* CloseBracketToken */, 92 /* NewKeyword */]); - TokenRange.Comments = TokenRange.FromTokens([2 /* SingleLineCommentTrivia */, 3 /* MultiLineCommentTrivia */]); - TokenRange.TypeNames = TokenRange.FromTokens([69 /* Identifier */, 130 /* NumberKeyword */, 132 /* StringKeyword */, 120 /* BooleanKeyword */, 133 /* SymbolKeyword */, 103 /* VoidKeyword */, 117 /* AnyKeyword */]); return TokenRange; }()); + TokenRange.Any = TokenRange.AllTokens(); + TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3 /* MultiLineCommentTrivia */])); + TokenRange.Keywords = TokenRange.FromRange(71 /* FirstKeyword */, 140 /* LastKeyword */); + TokenRange.BinaryOperators = TokenRange.FromRange(26 /* FirstBinaryOperator */, 69 /* LastBinaryOperator */); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([91 /* InKeyword */, 92 /* InstanceOfKeyword */, 140 /* OfKeyword */, 117 /* AsKeyword */, 125 /* IsKeyword */]); + TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([42 /* PlusPlusToken */, 43 /* MinusMinusToken */, 51 /* TildeToken */, 50 /* ExclamationToken */]); + TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([8 /* NumericLiteral */, 70 /* Identifier */, 18 /* OpenParenToken */, 20 /* OpenBracketToken */, 16 /* OpenBraceToken */, 98 /* ThisKeyword */, 93 /* NewKeyword */]); + TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([70 /* Identifier */, 18 /* OpenParenToken */, 98 /* ThisKeyword */, 93 /* NewKeyword */]); + TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([70 /* Identifier */, 19 /* CloseParenToken */, 21 /* CloseBracketToken */, 93 /* NewKeyword */]); + TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([70 /* Identifier */, 18 /* OpenParenToken */, 98 /* ThisKeyword */, 93 /* NewKeyword */]); + TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([70 /* Identifier */, 19 /* CloseParenToken */, 21 /* CloseBracketToken */, 93 /* NewKeyword */]); + TokenRange.Comments = TokenRange.FromTokens([2 /* SingleLineCommentTrivia */, 3 /* MultiLineCommentTrivia */]); + TokenRange.TypeNames = TokenRange.FromTokens([70 /* Identifier */, 132 /* NumberKeyword */, 134 /* StringKeyword */, 121 /* BooleanKeyword */, 135 /* SymbolKeyword */, 104 /* VoidKeyword */, 118 /* AnyKeyword */]); Shared.TokenRange = TokenRange; })(Shared = formatting.Shared || (formatting.Shared = {})); })(formatting = ts.formatting || (ts.formatting = {})); @@ -51624,7 +76164,7 @@ var ts; /// /// /// -/// +/// /// /* @internal */ var ts; @@ -51655,25 +76195,31 @@ var ts; }; RulesProvider.prototype.createActiveRules = function (options) { var rules = this.globalRules.HighPriorityCommonRules.slice(0); - if (options.InsertSpaceAfterCommaDelimiter) { + if (options.insertSpaceAfterConstructor) { + rules.push(this.globalRules.SpaceAfterConstructor); + } + else { + rules.push(this.globalRules.NoSpaceAfterConstructor); + } + if (options.insertSpaceAfterCommaDelimiter) { rules.push(this.globalRules.SpaceAfterComma); } else { rules.push(this.globalRules.NoSpaceAfterComma); } - if (options.InsertSpaceAfterFunctionKeywordForAnonymousFunctions) { + if (options.insertSpaceAfterFunctionKeywordForAnonymousFunctions) { rules.push(this.globalRules.SpaceAfterAnonymousFunctionKeyword); } else { rules.push(this.globalRules.NoSpaceAfterAnonymousFunctionKeyword); } - if (options.InsertSpaceAfterKeywordsInControlFlowStatements) { + if (options.insertSpaceAfterKeywordsInControlFlowStatements) { rules.push(this.globalRules.SpaceAfterKeywordInControl); } else { rules.push(this.globalRules.NoSpaceAfterKeywordInControl); } - if (options.InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis) { + if (options.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis) { rules.push(this.globalRules.SpaceAfterOpenParen); rules.push(this.globalRules.SpaceBeforeCloseParen); rules.push(this.globalRules.NoSpaceBetweenParens); @@ -51683,7 +76229,7 @@ var ts; rules.push(this.globalRules.NoSpaceBeforeCloseParen); rules.push(this.globalRules.NoSpaceBetweenParens); } - if (options.InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets) { + if (options.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets) { rules.push(this.globalRules.SpaceAfterOpenBracket); rules.push(this.globalRules.SpaceBeforeCloseBracket); rules.push(this.globalRules.NoSpaceBetweenBrackets); @@ -51693,7 +76239,19 @@ var ts; rules.push(this.globalRules.NoSpaceBeforeCloseBracket); rules.push(this.globalRules.NoSpaceBetweenBrackets); } - if (options.InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces) { + // The default value of InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces is true + // so if the option is undefined, we should treat it as true as well + if (options.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces !== false) { + rules.push(this.globalRules.SpaceAfterOpenBrace); + rules.push(this.globalRules.SpaceBeforeCloseBrace); + rules.push(this.globalRules.NoSpaceBetweenEmptyBraceBrackets); + } + else { + rules.push(this.globalRules.NoSpaceAfterOpenBrace); + rules.push(this.globalRules.NoSpaceBeforeCloseBrace); + rules.push(this.globalRules.NoSpaceBetweenEmptyBraceBrackets); + } + if (options.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces) { rules.push(this.globalRules.SpaceAfterTemplateHeadAndMiddle); rules.push(this.globalRules.SpaceBeforeTemplateMiddleAndTail); } @@ -51701,7 +76259,7 @@ var ts; rules.push(this.globalRules.NoSpaceAfterTemplateHeadAndMiddle); rules.push(this.globalRules.NoSpaceBeforeTemplateMiddleAndTail); } - if (options.InsertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces) { + if (options.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces) { rules.push(this.globalRules.SpaceAfterOpenBraceInJsxExpression); rules.push(this.globalRules.SpaceBeforeCloseBraceInJsxExpression); } @@ -51709,13 +76267,13 @@ var ts; rules.push(this.globalRules.NoSpaceAfterOpenBraceInJsxExpression); rules.push(this.globalRules.NoSpaceBeforeCloseBraceInJsxExpression); } - if (options.InsertSpaceAfterSemicolonInForStatements) { + if (options.insertSpaceAfterSemicolonInForStatements) { rules.push(this.globalRules.SpaceAfterSemicolonInFor); } else { rules.push(this.globalRules.NoSpaceAfterSemicolonInFor); } - if (options.InsertSpaceBeforeAndAfterBinaryOperators) { + if (options.insertSpaceBeforeAndAfterBinaryOperators) { rules.push(this.globalRules.SpaceBeforeBinaryOperator); rules.push(this.globalRules.SpaceAfterBinaryOperator); } @@ -51723,13 +76281,25 @@ var ts; rules.push(this.globalRules.NoSpaceBeforeBinaryOperator); rules.push(this.globalRules.NoSpaceAfterBinaryOperator); } - if (options.PlaceOpenBraceOnNewLineForControlBlocks) { + if (options.insertSpaceBeforeFunctionParenthesis) { + rules.push(this.globalRules.SpaceBeforeOpenParenInFuncDecl); + } + else { + rules.push(this.globalRules.NoSpaceBeforeOpenParenInFuncDecl); + } + if (options.placeOpenBraceOnNewLineForControlBlocks) { rules.push(this.globalRules.NewLineBeforeOpenBraceInControl); } - if (options.PlaceOpenBraceOnNewLineForFunctions) { + if (options.placeOpenBraceOnNewLineForFunctions) { rules.push(this.globalRules.NewLineBeforeOpenBraceInFunction); rules.push(this.globalRules.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock); } + if (options.insertSpaceAfterTypeAssertion) { + rules.push(this.globalRules.SpaceAfterTypeAssertion); + } + else { + rules.push(this.globalRules.NoSpaceAfterTypeAssertion); + } rules = rules.concat(this.globalRules.LowPriorityCommonRules); return rules; }; @@ -51781,11 +76351,11 @@ var ts; } formatting.formatOnEnter = formatOnEnter; function formatOnSemicolon(position, sourceFile, rulesProvider, options) { - return formatOutermostParent(position, 23 /* SemicolonToken */, sourceFile, options, rulesProvider, 3 /* FormatOnSemicolon */); + return formatOutermostParent(position, 24 /* SemicolonToken */, sourceFile, options, rulesProvider, 3 /* FormatOnSemicolon */); } formatting.formatOnSemicolon = formatOnSemicolon; function formatOnClosingCurly(position, sourceFile, rulesProvider, options) { - return formatOutermostParent(position, 16 /* CloseBraceToken */, sourceFile, options, rulesProvider, 4 /* FormatOnClosingCurlyBrace */); + return formatOutermostParent(position, 17 /* CloseBraceToken */, sourceFile, options, rulesProvider, 4 /* FormatOnClosingCurlyBrace */); } formatting.formatOnClosingCurly = formatOnClosingCurly; function formatDocument(sourceFile, rulesProvider, options) { @@ -51849,17 +76419,17 @@ var ts; // i.e. parent is class declaration with the list of members and node is one of members. function isListElement(parent, node) { switch (parent.kind) { - case 221 /* ClassDeclaration */: - case 222 /* InterfaceDeclaration */: + case 226 /* ClassDeclaration */: + case 227 /* InterfaceDeclaration */: return ts.rangeContainsRange(parent.members, node); - case 225 /* ModuleDeclaration */: + case 230 /* ModuleDeclaration */: var body = parent.body; - return body && body.kind === 199 /* Block */ && ts.rangeContainsRange(body.statements, node); - case 256 /* SourceFile */: - case 199 /* Block */: - case 226 /* ModuleBlock */: + return body && body.kind === 231 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node); + case 261 /* SourceFile */: + case 204 /* Block */: + case 231 /* ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 252 /* CatchClause */: + case 256 /* CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -51914,7 +76484,7 @@ var ts; index++; } }; - function rangeHasNoErrors(r) { + function rangeHasNoErrors() { return false; } } @@ -51964,7 +76534,7 @@ var ts; break; } if (formatting.SmartIndenter.shouldIndentChildNode(n, child)) { - return options.IndentSize; + return options.indentSize; } previousLine = line; child = n; @@ -52036,7 +76606,7 @@ var ts; } function computeIndentation(node, startLine, inheritedIndentation, parent, parentDynamicIndentation, effectiveParentStartLine) { var indentation = inheritedIndentation; - var delta = formatting.SmartIndenter.shouldIndentChildNode(node) ? options.IndentSize : 0; + var delta = formatting.SmartIndenter.shouldIndentChildNode(node) ? options.indentSize : 0; if (effectiveParentStartLine === startLine) { // if node is located on the same line with the parent // - inherit indentation from the parent @@ -52044,7 +76614,7 @@ var ts; indentation = startLine === lastIndentedLine ? indentationOnLastIndentedLine : parentDynamicIndentation.getIndentation(); - delta = Math.min(options.IndentSize, parentDynamicIndentation.getDelta(node) + delta); + delta = Math.min(options.indentSize, parentDynamicIndentation.getDelta(node) + delta); } else if (indentation === -1 /* Unknown */) { if (formatting.SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement(parent, node, startLine, sourceFile)) { @@ -52064,20 +76634,20 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 221 /* ClassDeclaration */: return 73 /* ClassKeyword */; - case 222 /* InterfaceDeclaration */: return 107 /* InterfaceKeyword */; - case 220 /* FunctionDeclaration */: return 87 /* FunctionKeyword */; - case 224 /* EnumDeclaration */: return 224 /* EnumDeclaration */; - case 149 /* GetAccessor */: return 123 /* GetKeyword */; - case 150 /* SetAccessor */: return 131 /* SetKeyword */; - case 147 /* MethodDeclaration */: + case 226 /* ClassDeclaration */: return 74 /* ClassKeyword */; + case 227 /* InterfaceDeclaration */: return 108 /* InterfaceKeyword */; + case 225 /* FunctionDeclaration */: return 88 /* FunctionKeyword */; + case 229 /* EnumDeclaration */: return 229 /* EnumDeclaration */; + case 151 /* GetAccessor */: return 124 /* GetKeyword */; + case 152 /* SetAccessor */: return 133 /* SetKeyword */; + case 149 /* MethodDeclaration */: if (node.asteriskToken) { - return 37 /* AsteriskToken */; + return 38 /* AsteriskToken */; } /* fall-through */ - case 145 /* PropertyDeclaration */: - case 142 /* Parameter */: + case 147 /* PropertyDeclaration */: + case 144 /* Parameter */: return node.name.kind; } } @@ -52089,9 +76659,9 @@ var ts; // .. { // // comment // } - case 16 /* CloseBraceToken */: - case 20 /* CloseBracketToken */: - case 18 /* CloseParenToken */: + case 17 /* CloseBraceToken */: + case 21 /* CloseBracketToken */: + case 19 /* CloseParenToken */: return indentation + getEffectiveDelta(delta, container); } return tokenIndentation !== -1 /* Unknown */ ? tokenIndentation : indentation; @@ -52105,33 +76675,46 @@ var ts; } switch (kind) { // open and close brace, 'else' and 'while' (in do statement) tokens has indentation of the parent - case 15 /* OpenBraceToken */: - case 16 /* CloseBraceToken */: - case 19 /* OpenBracketToken */: - case 20 /* CloseBracketToken */: - case 17 /* OpenParenToken */: - case 18 /* CloseParenToken */: - case 80 /* ElseKeyword */: - case 104 /* WhileKeyword */: - case 55 /* AtToken */: + case 16 /* OpenBraceToken */: + case 17 /* CloseBraceToken */: + case 18 /* OpenParenToken */: + case 19 /* CloseParenToken */: + case 81 /* ElseKeyword */: + case 105 /* WhileKeyword */: + case 56 /* AtToken */: return indentation; - default: - // if token line equals to the line of containing node (this is a first token in the node) - use node indentation - return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation; + case 40 /* SlashToken */: + case 28 /* GreaterThanToken */: { + if (container.kind === 248 /* JsxOpeningElement */ || + container.kind === 249 /* JsxClosingElement */ || + container.kind === 247 /* JsxSelfClosingElement */) { + return indentation; + } + break; + } + case 20 /* OpenBracketToken */: + case 21 /* CloseBracketToken */: { + if (container.kind !== 170 /* MappedType */) { + return indentation; + } + break; + } } + // if token line equals to the line of containing node (this is a first token in the node) - use node indentation + return nodeStartLine !== line ? indentation + getEffectiveDelta(delta, container) : indentation; }, getIndentation: function () { return indentation; }, getDelta: function (child) { return getEffectiveDelta(delta, child); }, recomputeIndentation: function (lineAdded) { if (node.parent && formatting.SmartIndenter.shouldIndentChildNode(node.parent, node)) { if (lineAdded) { - indentation += options.IndentSize; + indentation += options.indentSize; } else { - indentation -= options.IndentSize; + indentation -= options.indentSize; } if (formatting.SmartIndenter.shouldIndentChildNode(node)) { - delta = options.IndentSize; + delta = options.indentSize; } else { delta = 0; @@ -52174,7 +76757,7 @@ var ts; if (tokenInfo.token.end > node.end) { break; } - consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation, node); } function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) { var childStartPos = child.getStart(sourceFile); @@ -52208,23 +76791,24 @@ var ts; // stop when formatting scanner advances past the beginning of the child break; } - consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, node); } if (!formattingScanner.isOnToken()) { return inheritedIndentation; } - if (ts.isToken(child)) { + // JSX text shouldn't affect indenting + if (ts.isToken(child) && child.kind !== 10 /* JsxText */) { // if child node is a token, it does not impact indentation, proceed it using parent indentation scope rules var tokenInfo = formattingScanner.readTokenInfo(child); - ts.Debug.assert(tokenInfo.token.end === child.end); + ts.Debug.assert(tokenInfo.token.end === child.end, "Token end is child end"); consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child); return inheritedIndentation; } - var effectiveParentStartLine = child.kind === 143 /* Decorator */ ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 145 /* Decorator */ ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; - if (isFirstListItem && parent.kind === 170 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) { + if (isFirstListItem && parent.kind === 175 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) { inheritedIndentation = childIndentation.indentation; } return inheritedIndentation; @@ -52247,11 +76831,11 @@ var ts; startLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line; var indentation_1 = computeIndentation(tokenInfo.token, startLine, -1 /* Unknown */, parent, parentDynamicIndentation, parentStartLine); listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, indentation_1.indentation, indentation_1.delta); - consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent); } else { // consume any tokens that precede the list as child elements of 'node' using its indentation scope - consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation, parent); } } } @@ -52269,7 +76853,7 @@ var ts; // without this check close paren will be interpreted as list end token for function expression which is wrong if (tokenInfo.token.kind === listEndToken && ts.rangeContainsRange(parent, tokenInfo.token)) { // consume list end token - consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent); } } } @@ -52422,11 +77006,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); } @@ -52551,7 +77147,7 @@ var ts; // edit should not be applied only if we have one line feed between elements var lineDelta = currentStartLine - previousStartLine; if (lineDelta !== 1) { - recordReplace(previousRange.end, currentRange.pos - previousRange.end, options.NewLineCharacter); + recordReplace(previousRange.end, currentRange.pos - previousRange.end, options.newLineCharacter); } break; case 2 /* Space */: @@ -52569,41 +77165,41 @@ var ts; } function getOpenTokenForList(node, list) { switch (node.kind) { - case 148 /* Constructor */: - case 220 /* FunctionDeclaration */: - case 179 /* FunctionExpression */: - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - case 180 /* ArrowFunction */: + case 150 /* Constructor */: + case 225 /* FunctionDeclaration */: + case 184 /* FunctionExpression */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + case 185 /* ArrowFunction */: if (node.typeParameters === list) { - return 25 /* LessThanToken */; + return 26 /* LessThanToken */; } else if (node.parameters === list) { - return 17 /* OpenParenToken */; + return 18 /* OpenParenToken */; } break; - case 174 /* CallExpression */: - case 175 /* NewExpression */: + case 179 /* CallExpression */: + case 180 /* NewExpression */: if (node.typeArguments === list) { - return 25 /* LessThanToken */; + return 26 /* LessThanToken */; } else if (node.arguments === list) { - return 17 /* OpenParenToken */; + return 18 /* OpenParenToken */; } break; - case 155 /* TypeReference */: + case 157 /* TypeReference */: if (node.typeArguments === list) { - return 25 /* LessThanToken */; + return 26 /* LessThanToken */; } } return 0 /* Unknown */; } function getCloseTokenForOpenToken(kind) { switch (kind) { - case 17 /* OpenParenToken */: - return 18 /* CloseParenToken */; - case 25 /* LessThanToken */: - return 27 /* GreaterThanToken */; + case 18 /* OpenParenToken */: + return 19 /* CloseParenToken */; + case 26 /* LessThanToken */: + return 28 /* GreaterThanToken */; } return 0 /* Unknown */; } @@ -52612,14 +77208,14 @@ var ts; var internedSpacesIndentation; function getIndentationString(indentation, options) { // reset interned strings if FormatCodeOptions were changed - var resetInternedStrings = !internedSizes || (internedSizes.tabSize !== options.TabSize || internedSizes.indentSize !== options.IndentSize); + var resetInternedStrings = !internedSizes || (internedSizes.tabSize !== options.tabSize || internedSizes.indentSize !== options.indentSize); if (resetInternedStrings) { - internedSizes = { tabSize: options.TabSize, indentSize: options.IndentSize }; + internedSizes = { tabSize: options.tabSize, indentSize: options.indentSize }; internedTabsIndentation = internedSpacesIndentation = undefined; } - if (!options.ConvertTabsToSpaces) { - var tabs = Math.floor(indentation / options.TabSize); - var spaces = indentation - tabs * options.TabSize; + if (!options.convertTabsToSpaces) { + var tabs = Math.floor(indentation / options.tabSize); + var spaces = indentation - tabs * options.tabSize; var tabString = void 0; if (!internedTabsIndentation) { internedTabsIndentation = []; @@ -52634,13 +77230,13 @@ var ts; } else { var spacesString = void 0; - var quotient = Math.floor(indentation / options.IndentSize); - var remainder = indentation % options.IndentSize; + var quotient = Math.floor(indentation / options.indentSize); + var remainder = indentation % options.indentSize; if (!internedSpacesIndentation) { internedSpacesIndentation = []; } if (internedSpacesIndentation[quotient] === undefined) { - spacesString = repeat(" ", options.IndentSize * quotient); + spacesString = repeat(" ", options.indentSize * quotient); internedSpacesIndentation[quotient] = spacesString; } else { @@ -52677,7 +77273,7 @@ var ts; } // no indentation when the indent style is set to none, // so we can return fast - if (options.IndentStyle === ts.IndentStyle.None) { + if (options.indentStyle === ts.IndentStyle.None) { return 0; } var precedingToken = ts.findPrecedingToken(position, sourceFile); @@ -52693,7 +77289,7 @@ var ts; // indentation is first non-whitespace character in a previous line // for block indentation, we should look for a line which contains something that's not // whitespace. - if (options.IndentStyle === ts.IndentStyle.Block) { + if (options.indentStyle === ts.IndentStyle.Block) { // move backwards until we find a line with a non-whitespace character, // then find the first non-whitespace character for that line. var current_1 = position; @@ -52707,7 +77303,7 @@ var ts; var lineStart = ts.getLineStartPositionForPosition(current_1, sourceFile); return SmartIndenter.findFirstNonWhitespaceColumn(lineStart, current_1, sourceFile, options); } - if (precedingToken.kind === 24 /* CommaToken */ && precedingToken.parent.kind !== 187 /* BinaryExpression */) { + if (precedingToken.kind === 25 /* CommaToken */ && precedingToken.parent.kind !== 192 /* BinaryExpression */) { // previous token is comma that separates items in list - find the previous item and try to derive indentation from it var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1 /* Unknown */) { @@ -52727,7 +77323,7 @@ var ts; indentationDelta = 0; } else { - indentationDelta = lineAtPosition !== currentStart.line ? options.IndentSize : 0; + indentationDelta = lineAtPosition !== currentStart.line ? options.indentSize : 0; } break; } @@ -52738,7 +77334,7 @@ var ts; } actualIndentation = getLineIndentationWhenExpressionIsInMultiLine(current, sourceFile, options); if (actualIndentation !== -1 /* Unknown */) { - return actualIndentation + options.IndentSize; + return actualIndentation + options.indentSize; } previous = current; current = current.parent; @@ -52750,15 +77346,15 @@ var ts; return getIndentationForNodeWorker(current, currentStart, /*ignoreActualIndentationRange*/ undefined, indentationDelta, sourceFile, options); } SmartIndenter.getIndentation = getIndentation; - function getBaseIndentation(options) { - return options.BaseIndentSize || 0; - } - SmartIndenter.getBaseIndentation = getBaseIndentation; function getIndentationForNode(n, ignoreActualIndentationRange, sourceFile, options) { var start = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); return getIndentationForNodeWorker(n, start, ignoreActualIndentationRange, /*indentationDelta*/ 0, sourceFile, options); } SmartIndenter.getIndentationForNode = getIndentationForNode; + function getBaseIndentation(options) { + return options.baseIndentSize || 0; + } + SmartIndenter.getBaseIndentation = getBaseIndentation; function getIndentationForNodeWorker(current, currentStart, ignoreActualIndentationRange, indentationDelta, sourceFile, options) { var parent = current.parent; var parentStart; @@ -52793,7 +77389,7 @@ var ts; } // increase indentation if parent node wants its content to be indented and parent and child nodes don't start on the same line if (shouldIndentChildNode(parent, current) && !parentAndChildShareLine) { - indentationDelta += options.IndentSize; + indentationDelta += options.indentSize; } current = parent; currentStart = parentStart; @@ -52829,8 +77425,8 @@ var ts; // actual indentation is used for statements\declarations if one of cases below is true: // - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually // - parent and child are not on the same line - var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && - (parent.kind === 256 /* SourceFile */ || !parentAndChildShareLine); + var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) && + (parent.kind === 261 /* SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Unknown */; } @@ -52841,11 +77437,11 @@ var ts; if (!nextToken) { return false; } - if (nextToken.kind === 15 /* OpenBraceToken */) { + if (nextToken.kind === 16 /* OpenBraceToken */) { // open braces are always indented at the parent level return true; } - else if (nextToken.kind === 16 /* CloseBraceToken */) { + else if (nextToken.kind === 17 /* CloseBraceToken */) { // close braces are indented at the parent level if they are located on the same line with cursor // this means that if new line will be added at $ position, this case will be indented // class A { @@ -52863,8 +77459,8 @@ var ts; return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 203 /* IfStatement */ && parent.elseStatement === child) { - var elseKeyword = ts.findChildOfKind(parent, 80 /* ElseKeyword */, sourceFile); + if (parent.kind === 208 /* IfStatement */ && parent.elseStatement === child) { + var elseKeyword = ts.findChildOfKind(parent, 81 /* ElseKeyword */, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; return elseKeywordStartLine === childStartLine; @@ -52875,23 +77471,23 @@ var ts; function getContainingList(node, sourceFile) { if (node.parent) { switch (node.parent.kind) { - case 155 /* TypeReference */: + case 157 /* TypeReference */: if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { return node.parent.typeArguments; } break; - case 171 /* ObjectLiteralExpression */: + case 176 /* ObjectLiteralExpression */: return node.parent.properties; - case 170 /* ArrayLiteralExpression */: + case 175 /* ArrayLiteralExpression */: return node.parent.elements; - case 220 /* FunctionDeclaration */: - case 179 /* FunctionExpression */: - case 180 /* ArrowFunction */: - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - case 151 /* CallSignature */: - case 152 /* ConstructSignature */: { + case 225 /* FunctionDeclaration */: + case 184 /* FunctionExpression */: + case 185 /* ArrowFunction */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + case 153 /* CallSignature */: + case 154 /* ConstructSignature */: { var start = node.getStart(sourceFile); if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { @@ -52902,8 +77498,8 @@ var ts; } break; } - case 175 /* NewExpression */: - case 174 /* CallExpression */: { + case 180 /* NewExpression */: + case 179 /* CallExpression */: { var start = node.getStart(sourceFile); if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { @@ -52930,11 +77526,11 @@ var ts; function getLineIndentationWhenExpressionIsInMultiLine(node, sourceFile, options) { // actual indentation should not be used when: // - node is close parenthesis - this is the end of the expression - if (node.kind === 18 /* CloseParenToken */) { + if (node.kind === 19 /* CloseParenToken */) { return -1 /* Unknown */; } - if (node.parent && (node.parent.kind === 174 /* CallExpression */ || - node.parent.kind === 175 /* NewExpression */) && + if (node.parent && (node.parent.kind === 179 /* CallExpression */ || + node.parent.kind === 180 /* NewExpression */) && node.parent.expression !== node) { var fullCallOrNewExpression = node.parent.expression; var startingExpression = getStartingExpression(fullCallOrNewExpression); @@ -52952,10 +77548,10 @@ var ts; function getStartingExpression(node) { while (true) { switch (node.kind) { - case 174 /* CallExpression */: - case 175 /* NewExpression */: - case 172 /* PropertyAccessExpression */: - case 173 /* ElementAccessExpression */: + case 179 /* CallExpression */: + case 180 /* NewExpression */: + case 177 /* PropertyAccessExpression */: + case 178 /* ElementAccessExpression */: node = node.expression; break; default: @@ -52971,7 +77567,7 @@ var ts; // if end line for item [i - 1] differs from the start line for item [i] - find column of the first non-whitespace character on the line of item [i] var lineAndCharacter = getStartLineAndCharacterForNode(node, sourceFile); for (var i = index - 1; i >= 0; i--) { - if (list[i].kind === 24 /* CommaToken */) { + if (list[i].kind === 25 /* CommaToken */) { continue; } // skip list items that ends on the same line with the current list element @@ -53003,7 +77599,7 @@ var ts; break; } if (ch === 9 /* tab */) { - column += options.TabSize + (column % options.TabSize); + column += options.tabSize + (column % options.tabSize); } else { column++; @@ -53019,48 +77615,49 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 202 /* ExpressionStatement */: - case 221 /* ClassDeclaration */: - case 192 /* ClassExpression */: - case 222 /* InterfaceDeclaration */: - case 224 /* EnumDeclaration */: - case 223 /* TypeAliasDeclaration */: - case 170 /* ArrayLiteralExpression */: - case 199 /* Block */: - case 226 /* ModuleBlock */: - case 171 /* ObjectLiteralExpression */: - case 159 /* TypeLiteral */: - case 161 /* TupleType */: - case 227 /* CaseBlock */: - case 250 /* DefaultClause */: - case 249 /* CaseClause */: - case 178 /* ParenthesizedExpression */: - case 172 /* PropertyAccessExpression */: - case 174 /* CallExpression */: - case 175 /* NewExpression */: - case 200 /* VariableStatement */: - case 218 /* VariableDeclaration */: - case 235 /* ExportAssignment */: - case 211 /* ReturnStatement */: - case 188 /* ConditionalExpression */: - case 168 /* ArrayBindingPattern */: - case 167 /* ObjectBindingPattern */: - case 243 /* JsxOpeningElement */: - case 242 /* JsxSelfClosingElement */: - case 248 /* JsxExpression */: - case 146 /* MethodSignature */: - case 151 /* CallSignature */: - case 152 /* ConstructSignature */: - case 142 /* Parameter */: - case 156 /* FunctionType */: - case 157 /* ConstructorType */: - case 164 /* ParenthesizedType */: - case 176 /* TaggedTemplateExpression */: - case 184 /* AwaitExpression */: - case 237 /* NamedExports */: - case 233 /* NamedImports */: - case 238 /* ExportSpecifier */: - case 234 /* ImportSpecifier */: + case 207 /* ExpressionStatement */: + case 226 /* ClassDeclaration */: + case 197 /* ClassExpression */: + case 227 /* InterfaceDeclaration */: + case 229 /* EnumDeclaration */: + case 228 /* TypeAliasDeclaration */: + case 175 /* ArrayLiteralExpression */: + case 204 /* Block */: + case 231 /* ModuleBlock */: + case 176 /* ObjectLiteralExpression */: + case 161 /* TypeLiteral */: + case 170 /* MappedType */: + case 163 /* TupleType */: + case 232 /* CaseBlock */: + case 254 /* DefaultClause */: + case 253 /* CaseClause */: + case 183 /* ParenthesizedExpression */: + case 177 /* PropertyAccessExpression */: + case 179 /* CallExpression */: + case 180 /* NewExpression */: + case 205 /* VariableStatement */: + case 223 /* VariableDeclaration */: + case 240 /* ExportAssignment */: + case 216 /* ReturnStatement */: + case 193 /* ConditionalExpression */: + case 173 /* ArrayBindingPattern */: + case 172 /* ObjectBindingPattern */: + case 248 /* JsxOpeningElement */: + case 247 /* JsxSelfClosingElement */: + case 252 /* JsxExpression */: + case 148 /* MethodSignature */: + case 153 /* CallSignature */: + case 154 /* ConstructSignature */: + case 144 /* Parameter */: + case 158 /* FunctionType */: + case 159 /* ConstructorType */: + case 166 /* ParenthesizedType */: + case 181 /* TaggedTemplateExpression */: + case 189 /* AwaitExpression */: + case 242 /* NamedExports */: + case 238 /* NamedImports */: + case 243 /* ExportSpecifier */: + case 239 /* ImportSpecifier */: return true; } return false; @@ -53069,27 +77666,27 @@ var ts; function nodeWillIndentChild(parent, child, indentByDefault) { var childKind = child ? child.kind : 0 /* Unknown */; switch (parent.kind) { - case 204 /* DoStatement */: - case 205 /* WhileStatement */: - case 207 /* ForInStatement */: - case 208 /* ForOfStatement */: - case 206 /* ForStatement */: - case 203 /* IfStatement */: - case 220 /* FunctionDeclaration */: - case 179 /* FunctionExpression */: - case 147 /* MethodDeclaration */: - case 180 /* ArrowFunction */: - case 148 /* Constructor */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - return childKind !== 199 /* Block */; - case 236 /* ExportDeclaration */: - return childKind !== 237 /* NamedExports */; - case 230 /* ImportDeclaration */: - return childKind !== 231 /* ImportClause */ || - (child.namedBindings && child.namedBindings.kind !== 233 /* NamedImports */); - case 241 /* JsxElement */: - return childKind !== 245 /* JsxClosingElement */; + case 209 /* DoStatement */: + case 210 /* WhileStatement */: + case 212 /* ForInStatement */: + case 213 /* ForOfStatement */: + case 211 /* ForStatement */: + case 208 /* IfStatement */: + case 225 /* FunctionDeclaration */: + case 184 /* FunctionExpression */: + case 149 /* MethodDeclaration */: + case 185 /* ArrowFunction */: + case 150 /* Constructor */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + return childKind !== 204 /* Block */; + case 241 /* ExportDeclaration */: + return childKind !== 242 /* NamedExports */; + case 235 /* ImportDeclaration */: + return childKind !== 236 /* ImportClause */ || + (child.namedBindings && child.namedBindings.kind !== 238 /* NamedImports */); + case 246 /* JsxElement */: + return childKind !== 249 /* JsxClosingElement */; } // No explicit rule for given nodes so the result will follow the default value argument return indentByDefault; @@ -53105,93 +77702,823 @@ var ts; })(SmartIndenter = formatting.SmartIndenter || (formatting.SmartIndenter = {})); })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var codefix; + (function (codefix) { + var codeFixes = ts.createMap(); + function registerCodeFix(action) { + ts.forEach(action.errorCodes, function (error) { + var fixes = codeFixes[error]; + if (!fixes) { + fixes = []; + codeFixes[error] = fixes; + } + fixes.push(action); + }); + } + codefix.registerCodeFix = registerCodeFix; + function getSupportedErrorCodes() { + return Object.keys(codeFixes); + } + codefix.getSupportedErrorCodes = getSupportedErrorCodes; + function getFixes(context) { + var fixes = codeFixes[context.errorCode]; + var allActions = []; + ts.forEach(fixes, function (f) { + var actions = f.getCodeActions(context); + if (actions && actions.length > 0) { + allActions = allActions.concat(actions); + } + }); + return allActions; + } + codefix.getFixes = getFixes; + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; +(function (ts) { + var codefix; + (function (codefix) { + function getOpenBraceEnd(constructor, sourceFile) { + // First token is the open curly, this is where we want to put the 'super' call. + return constructor.body.getFirstToken(sourceFile).getEnd(); + } + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var token = ts.getTokenAtPosition(sourceFile, context.span.start); + if (token.kind !== 122 /* ConstructorKeyword */) { + return undefined; + } + var newPosition = getOpenBraceEnd(token.parent, sourceFile); + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Add_missing_super_call), + changes: [{ fileName: sourceFile.fileName, textChanges: [{ newText: "super();", span: { start: newPosition, length: 0 } }] }] + }]; + } + }); + codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var token = ts.getTokenAtPosition(sourceFile, context.span.start); + if (token.kind !== 98 /* ThisKeyword */) { + return undefined; + } + var constructor = ts.getContainingFunction(token); + var superCall = findSuperCall(constructor.body); + if (!superCall) { + return undefined; + } + // figure out if the this access is actuall inside the supercall + // i.e. super(this.a), since in that case we won't suggest a fix + if (superCall.expression && superCall.expression.kind == 179 /* CallExpression */) { + var arguments_1 = superCall.expression.arguments; + for (var i = 0; i < arguments_1.length; i++) { + if (arguments_1[i].expression === token) { + return undefined; + } + } + } + var newPosition = getOpenBraceEnd(constructor, sourceFile); + var changes = [{ + fileName: sourceFile.fileName, textChanges: [{ + newText: superCall.getText(sourceFile), + span: { start: newPosition, length: 0 } + }, + { + newText: "", + span: { start: superCall.getStart(sourceFile), length: superCall.getWidth(sourceFile) } + }] + }]; + return [{ + description: ts.getLocaleSpecificMessage(ts.Diagnostics.Make_super_call_the_first_statement_in_the_constructor), + changes: changes + }]; + function findSuperCall(n) { + if (n.kind === 207 /* ExpressionStatement */ && ts.isSuperCall(n.expression)) { + return n; + } + if (ts.isFunctionLike(n)) { + return undefined; + } + return ts.forEachChild(n, findSuperCall); + } + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +// /* @internal */ +// namespace ts.codefix { +// type ImportCodeActionKind = "CodeChange" | "InsertingIntoExistingImport" | "NewImport"; +// interface ImportCodeAction extends CodeAction { +// kind: ImportCodeActionKind, +// moduleSpecifier?: string +// } +// enum ModuleSpecifierComparison { +// Better, +// Equal, +// Worse +// } +// class ImportCodeActionMap { +// private symbolIdToActionMap = createMap(); +// addAction(symbolId: number, newAction: ImportCodeAction) { +// if (!newAction) { +// return; +// } +// if (!this.symbolIdToActionMap[symbolId]) { +// this.symbolIdToActionMap[symbolId] = [newAction]; +// return; +// } +// if (newAction.kind === "CodeChange") { +// this.symbolIdToActionMap[symbolId].push(newAction); +// return; +// } +// const updatedNewImports: ImportCodeAction[] = []; +// for (const existingAction of this.symbolIdToActionMap[symbolId]) { +// 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; +// } +// addActions(symbolId: number, newActions: ImportCodeAction[]) { +// for (const newAction of newActions) { +// this.addAction(symbolId, newAction); +// } +// } +// getAllActions() { +// let result: ImportCodeAction[] = []; +// for (const symbolId in this.symbolIdToActionMap) { +// result = concatenate(result, this.symbolIdToActionMap[symbolId]); +// } +// return result; +// } +// private compareModuleSpecifiers(moduleSpecifier1: string, moduleSpecifier2: string): ModuleSpecifierComparison { +// 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 (isExternalModuleNameRelative(moduleSpecifier1) && isExternalModuleNameRelative(moduleSpecifier2)) { +// const regex = new RegExp(directorySeparator, "g"); +// const moduleSpecifier1LevelCount = (moduleSpecifier1.match(regex) || []).length; +// const 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; +// } +// } +// registerCodeFix({ +// errorCodes: [Diagnostics.Cannot_find_name_0.code], +// getCodeActions: (context: CodeFixContext) => { +// const sourceFile = context.sourceFile; +// const checker = context.program.getTypeChecker(); +// const allSourceFiles = context.program.getSourceFiles(); +// const useCaseSensitiveFileNames = context.host.useCaseSensitiveFileNames ? context.host.useCaseSensitiveFileNames() : false; +// const token = getTokenAtPosition(sourceFile, context.span.start); +// const name = token.getText(); +// const symbolIdActionMap = new ImportCodeActionMap(); +// // this is a module id -> module import declaration map +// const cachedImportDeclarations = createMap<(ImportDeclaration | ImportEqualsDeclaration)[]>(); +// let cachedNewImportInsertPosition: number; +// const allPotentialModules = checker.getAmbientModules(); +// for (const otherSourceFile of allSourceFiles) { +// if (otherSourceFile !== sourceFile && isExternalOrCommonJsModule(otherSourceFile)) { +// allPotentialModules.push(otherSourceFile.symbol); +// } +// } +// const currentTokenMeaning = getMeaningFromLocation(token); +// for (const moduleSymbol of allPotentialModules) { +// context.cancellationToken.throwIfCancellationRequested(); +// // check the default export +// const defaultExport = checker.tryGetMemberInModuleExports("default", moduleSymbol); +// if (defaultExport) { +// const localSymbol = getLocalSymbolForExportDefault(defaultExport); +// if (localSymbol && localSymbol.name === name && checkSymbolHasMeaning(localSymbol, currentTokenMeaning)) { +// // check if this symbol is already used +// const symbolId = getUniqueSymbolId(localSymbol); +// symbolIdActionMap.addActions(symbolId, getCodeActionForImport(moduleSymbol, /*isDefault*/ true)); +// } +// } +// // check exports with the same name +// const exportSymbolWithIdenticalName = checker.tryGetMemberInModuleExports(name, moduleSymbol); +// if (exportSymbolWithIdenticalName && checkSymbolHasMeaning(exportSymbolWithIdenticalName, currentTokenMeaning)) { +// const symbolId = getUniqueSymbolId(exportSymbolWithIdenticalName); +// symbolIdActionMap.addActions(symbolId, getCodeActionForImport(moduleSymbol)); +// } +// } +// return symbolIdActionMap.getAllActions(); +// function getImportDeclarations(moduleSymbol: Symbol) { +// const moduleSymbolId = getUniqueSymbolId(moduleSymbol); +// if (cachedImportDeclarations[moduleSymbolId]) { +// return cachedImportDeclarations[moduleSymbolId]; +// } +// const existingDeclarations: (ImportDeclaration | ImportEqualsDeclaration)[] = []; +// for (const importModuleSpecifier of sourceFile.imports) { +// const importSymbol = checker.getSymbolAtLocation(importModuleSpecifier); +// if (importSymbol === moduleSymbol) { +// existingDeclarations.push(getImportDeclaration(importModuleSpecifier)); +// } +// } +// cachedImportDeclarations[moduleSymbolId] = existingDeclarations; +// return existingDeclarations; +// function getImportDeclaration(moduleSpecifier: LiteralExpression) { +// let node: Node = moduleSpecifier; +// while (node) { +// if (node.kind === SyntaxKind.ImportDeclaration) { +// return node; +// } +// if (node.kind === SyntaxKind.ImportEqualsDeclaration) { +// return node; +// } +// node = node.parent; +// } +// return undefined; +// } +// } +// function getUniqueSymbolId(symbol: Symbol) { +// if (symbol.flags & SymbolFlags.Alias) { +// return getSymbolId(checker.getAliasedSymbol(symbol)); +// } +// return getSymbolId(symbol); +// } +// function checkSymbolHasMeaning(symbol: Symbol, meaning: SemanticMeaning) { +// const declarations = symbol.getDeclarations(); +// return declarations ? some(symbol.declarations, decl => !!(getMeaningFromDeclaration(decl) & meaning)) : false; +// } +// function getCodeActionForImport(moduleSymbol: Symbol, isDefault?: boolean): ImportCodeAction[] { +// const 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: (ImportDeclaration | ImportEqualsDeclaration)[]): ImportCodeAction[] { +// const actions: ImportCodeAction[] = []; +// // 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. +// let namespaceImportDeclaration: ImportDeclaration | ImportEqualsDeclaration; +// let namedImportDeclaration: ImportDeclaration; +// let existingModuleSpecifier: string; +// for (const declaration of declarations) { +// if (declaration.kind === SyntaxKind.ImportDeclaration) { +// const namedBindings = declaration.importClause && declaration.importClause.namedBindings; +// if (namedBindings && namedBindings.kind === SyntaxKind.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. +// */ +// const textChange = getTextChangeForImportClause(namedImportDeclaration.importClause); +// const moduleSpecifierWithoutQuotes = stripQuotes(namedImportDeclaration.moduleSpecifier.getText()); +// actions.push(createCodeAction( +// 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: ImportEqualsDeclaration) { +// if (declaration.moduleReference && declaration.moduleReference.kind === SyntaxKind.ExternalModuleReference) { +// return declaration.moduleReference.expression.getText(); +// } +// return declaration.moduleReference.getText(); +// } +// function getTextChangeForImportClause(importClause: ImportClause): TextChange { +// const newImportText = isDefault ? `default as ${name}` : name; +// const importList = importClause.namedBindings; +// // case 1: +// // original text: import default from "module" +// // change to: import default, { name } from "module" +// if (!importList && importClause.name) { +// const start = importClause.name.getEnd(); +// return { +// newText: `, { ${newImportText} }`, +// span: { start, length: 0 } +// }; +// } +// // case 2: +// // original text: import {} from "module" +// // change to: import { name } from "module" +// if (importList.elements.length === 0) { +// const start = importList.getStart(); +// return { +// newText: `{ ${newImportText} }`, +// span: { start, length: importList.getEnd() - start } +// }; +// } +// // case 3: +// // original text: import { foo, bar } from "module" +// // change to: import { foo, bar, name } from "module" +// const 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"; +// */ +// const startLine = getLineOfLocalPosition(sourceFile, importList.getStart()); +// const endLine = getLineOfLocalPosition(sourceFile, importList.getEnd()); +// const oneImportPerLine = endLine - startLine > importList.elements.length; +// return { +// newText: `,${oneImportPerLine ? context.newLineCharacter : " "}${newImportText}`, +// span: { start: insertPoint, length: 0 } +// }; +// } +// function getCodeActionForNamespaceImport(declaration: ImportDeclaration | ImportEqualsDeclaration): ImportCodeAction { +// let namespacePrefix: string; +// if (declaration.kind === SyntaxKind.ImportDeclaration) { +// namespacePrefix = (declaration.importClause.namedBindings).name.getText(); +// } +// else { +// namespacePrefix = declaration.name.getText(); +// } +// namespacePrefix = 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( +// Diagnostics.Change_0_to_1, +// [name, `${namespacePrefix}.${name}`], +// `${namespacePrefix}.`, +// { start: token.getStart(), length: 0 }, +// sourceFile.fileName, +// "CodeChange" +// ); +// } +// } +// function getCodeActionForNewImport(moduleSpecifier?: string): ImportCodeAction { +// if (!cachedNewImportInsertPosition) { +// // insert after any existing imports +// let lastModuleSpecifierEnd = -1; +// for (const moduleSpecifier of sourceFile.imports) { +// const end = moduleSpecifier.getEnd(); +// if (!lastModuleSpecifierEnd || end > lastModuleSpecifierEnd) { +// lastModuleSpecifierEnd = end; +// } +// } +// cachedNewImportInsertPosition = lastModuleSpecifierEnd > 0 ? sourceFile.getLineEndOfPosition(lastModuleSpecifierEnd) : sourceFile.getStart(); +// } +// const getCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames); +// const moduleSpecifierWithoutQuotes = stripQuotes(moduleSpecifier || getModuleSpecifierForNewImport()); +// const 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. +// const newText = cachedNewImportInsertPosition === sourceFile.getStart() +// ? `${importStatementText};${context.newLineCharacter}${context.newLineCharacter}` +// : `${context.newLineCharacter}${importStatementText};`; +// return createCodeAction( +// Diagnostics.Import_0_from_1, +// [name, `"${moduleSpecifierWithoutQuotes}"`], +// newText, +// { start: cachedNewImportInsertPosition, length: 0 }, +// sourceFile.fileName, +// "NewImport", +// moduleSpecifierWithoutQuotes +// ); +// function getModuleSpecifierForNewImport() { +// const fileName = sourceFile.path; +// const moduleFileName = moduleSymbol.valueDeclaration.getSourceFile().path; +// const sourceDirectory = getDirectoryPath(fileName); +// const options = context.program.getCompilerOptions(); +// return tryGetModuleNameFromAmbientModule() || +// tryGetModuleNameFromBaseUrl() || +// tryGetModuleNameFromRootDirs() || +// tryGetModuleNameFromTypeRoots() || +// tryGetModuleNameAsNodeModule() || +// removeFileExtension(getRelativePath(moduleFileName, sourceDirectory)); +// function tryGetModuleNameFromAmbientModule(): string { +// if (moduleSymbol.valueDeclaration.kind !== SyntaxKind.SourceFile) { +// return moduleSymbol.name; +// } +// } +// function tryGetModuleNameFromBaseUrl() { +// if (!options.baseUrl) { +// return undefined; +// } +// const normalizedBaseUrl = toPath(options.baseUrl, getDirectoryPath(options.baseUrl), getCanonicalFileName); +// let relativeName = tryRemoveParentDirectoryName(moduleFileName, normalizedBaseUrl); +// if (!relativeName) { +// return undefined; +// } +// relativeName = removeExtensionAndIndexPostFix(relativeName); +// if (options.paths) { +// for (const key in options.paths) { +// for (const pattern of options.paths[key]) { +// const indexOfStar = pattern.indexOf("*"); +// if (indexOfStar === 0 && pattern.length === 1) { +// continue; +// } +// else if (indexOfStar !== -1) { +// const prefix = pattern.substr(0, indexOfStar); +// const suffix = pattern.substr(indexOfStar + 1); +// if (relativeName.length >= prefix.length + suffix.length && +// startsWith(relativeName, prefix) && +// endsWith(relativeName, suffix)) { +// const 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) { +// const normalizedRootDirs = map(options.rootDirs, rootDir => toPath(rootDir, /*basePath*/ undefined, getCanonicalFileName)); +// const normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, normalizedRootDirs); +// const normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, normalizedRootDirs); +// if (normalizedTargetPath !== undefined) { +// const relativePath = normalizedSourcePath !== undefined ? getRelativePath(normalizedTargetPath, normalizedSourcePath) : normalizedTargetPath; +// return removeFileExtension(relativePath); +// } +// } +// return undefined; +// } +// function tryGetModuleNameFromTypeRoots() { +// const typeRoots = getEffectiveTypeRoots(options, context.host); +// if (typeRoots) { +// const normalizedTypeRoots = map(typeRoots, typeRoot => toPath(typeRoot, /*basePath*/ undefined, getCanonicalFileName)); +// for (const typeRoot of normalizedTypeRoots) { +// if (startsWith(moduleFileName, typeRoot)) { +// const relativeFileName = moduleFileName.substring(typeRoot.length + 1); +// return removeExtensionAndIndexPostFix(relativeFileName); +// } +// } +// } +// } +// function tryGetModuleNameAsNodeModule() { +// if (getEmitModuleResolutionKind(options) !== ModuleResolutionKind.NodeJs) { +// // nothing to do here +// return undefined; +// } +// const indexOfNodeModules = moduleFileName.indexOf("node_modules"); +// if (indexOfNodeModules < 0) { +// return undefined; +// } +// let relativeFileName: string; +// 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 = removeFileExtension(relativeFileName); +// if (endsWith(relativeFileName, "/index")) { +// relativeFileName = getDirectoryPath(relativeFileName); +// } +// else { +// try { +// const moduleDirectory = getDirectoryPath(moduleFileName); +// const packageJsonContent = JSON.parse(context.host.readFile(combinePaths(moduleDirectory, "package.json"))); +// if (packageJsonContent) { +// const mainFile = packageJsonContent.main || packageJsonContent.typings; +// if (mainFile) { +// const mainExportFile = toPath(mainFile, moduleDirectory, getCanonicalFileName); +// if (removeFileExtension(mainExportFile) === removeFileExtension(moduleFileName)) { +// relativeFileName = getDirectoryPath(relativeFileName); +// } +// } +// } +// } +// catch (e) { } +// } +// return relativeFileName; +// } +// } +// function getPathRelativeToRootDirs(path: Path, rootDirs: Path[]) { +// for (const rootDir of rootDirs) { +// const relativeName = tryRemoveParentDirectoryName(path, rootDir); +// if (relativeName !== undefined) { +// return relativeName; +// } +// } +// return undefined; +// } +// function removeExtensionAndIndexPostFix(fileName: string) { +// fileName = removeFileExtension(fileName); +// if (endsWith(fileName, "/index")) { +// fileName = fileName.substr(0, fileName.length - 6/* "/index".length */); +// } +// return fileName; +// } +// function getRelativePath(path: string, directoryPath: string) { +// const relativePath = getRelativePathToDirectoryOrUrl(directoryPath, path, directoryPath, getCanonicalFileName, false); +// return moduleHasNonRelativeName(relativePath) ? "./" + relativePath : relativePath; +// } +// function tryRemoveParentDirectoryName(path: Path, parentDirectory: Path) { +// const index = path.indexOf(parentDirectory); +// if (index === 0) { +// return endsWith(parentDirectory, directorySeparator) +// ? path.substring(parentDirectory.length) +// : path.substring(parentDirectory.length + 1); +// } +// return undefined; +// } +// } +// } +// function createCodeAction( +// description: DiagnosticMessage, +// diagnosticArgs: string[], +// newText: string, +// span: TextSpan, +// fileName: string, +// kind: ImportCodeActionKind, +// moduleSpecifier?: string): ImportCodeAction { +// return { +// description: formatMessage.apply(undefined, [undefined, description].concat(diagnosticArgs)), +// changes: [{ fileName, textChanges: [{ newText, span }] }], +// kind, +// moduleSpecifier +// }; +// } +// } +// }); +// } +// /* @internal */ +// namespace ts.codefix { +// registerCodeFix({ +// errorCodes: [ +// Diagnostics._0_is_declared_but_never_used.code, +// Diagnostics.Property_0_is_declared_but_never_used.code +// ], +// getCodeActions: (context: CodeFixContext) => { +// const sourceFile = context.sourceFile; +// const start = context.span.start; +// let token = getTokenAtPosition(sourceFile, start); +// // this handles var ["computed"] = 12; +// if (token.kind === SyntaxKind.OpenBracketToken) { +// token = getTokenAtPosition(sourceFile, start + 1); +// } +// switch (token.kind) { +// case ts.SyntaxKind.Identifier: +// switch (token.parent.kind) { +// case ts.SyntaxKind.VariableDeclaration: +// switch (token.parent.parent.parent.kind) { +// case SyntaxKind.ForStatement: +// const forStatement = token.parent.parent.parent; +// const forInitializer = forStatement.initializer; +// if (forInitializer.declarations.length === 1) { +// return createCodeFix("", forInitializer.pos, forInitializer.end - forInitializer.pos); +// } +// else { +// return removeSingleItem(forInitializer.declarations, token); +// } +// case SyntaxKind.ForOfStatement: +// const forOfStatement = token.parent.parent.parent; +// if (forOfStatement.initializer.kind === SyntaxKind.VariableDeclarationList) { +// const forOfInitializer = forOfStatement.initializer; +// return createCodeFix("{}", forOfInitializer.declarations[0].pos, forOfInitializer.declarations[0].end - forOfInitializer.declarations[0].pos); +// } +// break; +// case SyntaxKind.ForInStatement: +// // There is no valid fix in the case of: +// // for .. in +// return undefined; +// case SyntaxKind.CatchClause: +// const catchClause = token.parent.parent; +// const parameter = catchClause.variableDeclaration.getChildren()[0]; +// return createCodeFix("", parameter.pos, parameter.end - parameter.pos); +// default: +// const variableStatement = token.parent.parent.parent; +// if (variableStatement.declarationList.declarations.length === 1) { +// return createCodeFix("", variableStatement.pos, variableStatement.end - variableStatement.pos); +// } +// else { +// const declarations = variableStatement.declarationList.declarations; +// return removeSingleItem(declarations, token); +// } +// } +// case SyntaxKind.TypeParameter: +// const 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 ts.SyntaxKind.Parameter: +// const 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 SyntaxKind.ImportEqualsDeclaration: +// const importEquals = findImportDeclaration(token); +// return createCodeFix("", importEquals.pos, importEquals.end - importEquals.pos); +// case SyntaxKind.ImportSpecifier: +// const namedImports = token.parent.parent; +// if (namedImports.elements.length === 1) { +// // Only 1 import and it is unused. So the entire declaration should be removed. +// const 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 SyntaxKind.ImportClause: // this covers both 'import |d|' and 'import |d,| *' +// const importClause = token.parent; +// if (!importClause.namedBindings) { // |import d from './file'| or |import * as ns from './file'| +// const importDecl = findImportDeclaration(importClause); +// return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); +// } +// else { // import |d,| * as ns from './file' +// return createCodeFix("", importClause.name.pos, importClause.namedBindings.pos - importClause.name.pos); +// } +// case SyntaxKind.NamespaceImport: +// const namespaceImport = token.parent; +// if (namespaceImport.name == token && !(namespaceImport.parent).name) { +// const importDecl = findImportDeclaration(namespaceImport); +// return createCodeFix("", importDecl.pos, importDecl.end - importDecl.pos); +// } +// else { +// const start = (namespaceImport.parent).name.end; +// return createCodeFix("", start, (namespaceImport.parent).namedBindings.end - start); +// } +// } +// break; +// case SyntaxKind.PropertyDeclaration: +// return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); +// case SyntaxKind.NamespaceImport: +// return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); +// } +// if (isDeclarationName(token)) { +// return createCodeFix("", token.parent.pos, token.parent.end - token.parent.pos); +// } +// else if (isLiteralComputedPropertyDeclarationName(token)) { +// return createCodeFix("", token.parent.parent.pos, token.parent.parent.end - token.parent.parent.pos); +// } +// else { +// return undefined; +// } +// function findImportDeclaration(token: Node): Node { +// let importDecl = token; +// while (importDecl.kind != SyntaxKind.ImportDeclaration && importDecl.parent) { +// importDecl = importDecl.parent; +// } +// return importDecl; +// } +// function createCodeFix(newText: string, start: number, length: number): CodeAction[] { +// return [{ +// description: getLocaleSpecificMessage(Diagnostics.Remove_unused_identifiers), +// changes: [{ +// fileName: sourceFile.fileName, +// textChanges: [{ newText, span: { start, length } }] +// }] +// }]; +// } +// function removeSingleItem(elements: NodeArray, token: T): CodeAction[] { +// 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); +// } +// } +// } +// }); +// } +/// +/// +/// /// /// +/// +/// /// -/// +/// +/// +/// +/// +/// +/// +/// +/// +/// /// /// +/// /// +/// +/// /// -/// -/// +/// +/// /// /// +/// +/// var ts; (function (ts) { /** The version of the language service API */ ts.servicesVersion = "0.5"; - var ScriptSnapshot; - (function (ScriptSnapshot) { - var StringScriptSnapshot = (function () { - function StringScriptSnapshot(text) { - this.text = text; - } - StringScriptSnapshot.prototype.getText = function (start, end) { - return this.text.substring(start, end); - }; - StringScriptSnapshot.prototype.getLength = function () { - return this.text.length; - }; - StringScriptSnapshot.prototype.getChangeRange = function (oldSnapshot) { - // Text-based snapshots do not support incremental parsing. Return undefined - // to signal that to the caller. - return undefined; - }; - return StringScriptSnapshot; - }()); - function fromString(text) { - return new StringScriptSnapshot(text); - } - ScriptSnapshot.fromString = fromString; - })(ScriptSnapshot = ts.ScriptSnapshot || (ts.ScriptSnapshot = {})); - var scanner = ts.createScanner(2 /* Latest */, /*skipTrivia*/ true); - var emptyArray = []; - var jsDocTagNames = [ - "augments", - "author", - "argument", - "borrows", - "class", - "constant", - "constructor", - "constructs", - "default", - "deprecated", - "description", - "event", - "example", - "extends", - "field", - "fileOverview", - "function", - "ignore", - "inner", - "lends", - "link", - "memberOf", - "name", - "namespace", - "param", - "private", - "property", - "public", - "requires", - "returns", - "see", - "since", - "static", - "throws", - "type", - "typedef", - "property", - "prop", - "version" - ]; - var jsDocCompletionEntries; function createNode(kind, pos, end, parent) { - var node = kind >= 139 /* FirstNode */ ? new NodeObject(kind, pos, end) : - kind === 69 /* Identifier */ ? new IdentifierObject(kind, pos, end) : + var node = kind >= 141 /* FirstNode */ ? new NodeObject(kind, pos, end) : + kind === 70 /* Identifier */ ? new IdentifierObject(70 /* Identifier */, pos, end) : new TokenObject(kind, pos, end); node.parent = parent; return node; @@ -53201,6 +78528,7 @@ var ts; this.pos = pos; this.end = end; this.flags = 0 /* None */; + this.transformFlags = undefined; this.parent = undefined; this.kind = kind; } @@ -53229,13 +78557,16 @@ var ts; return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end); }; NodeObject.prototype.getText = function (sourceFile) { - return (sourceFile || this.getSourceFile()).text.substring(this.getStart(), this.getEnd()); + if (!sourceFile) { + sourceFile = this.getSourceFile(); + } + return sourceFile.text.substring(this.getStart(sourceFile), this.getEnd()); }; NodeObject.prototype.addSyntheticNodes = function (nodes, pos, end, useJSDocScanner) { - scanner.setTextPos(pos); + ts.scanner.setTextPos(pos); while (pos < end) { - var token = useJSDocScanner ? scanner.scanJSDocToken() : scanner.scan(); - var textPos = scanner.getTextPos(); + var token = useJSDocScanner ? ts.scanner.scanJSDocToken() : ts.scanner.scan(); + var textPos = ts.scanner.getTextPos(); if (textPos <= end) { nodes.push(createNode(token, pos, textPos, this)); } @@ -53244,11 +78575,11 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(286 /* 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_4 = nodes; _i < nodes_4.length; _i++) { - var node = nodes_4[_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); } @@ -53263,11 +78594,11 @@ var ts; NodeObject.prototype.createChildren = function (sourceFile) { var _this = this; var children; - if (this.kind >= 139 /* FirstNode */) { - scanner.setText((sourceFile || this.getSourceFile()).text); + if (this.kind >= 141 /* FirstNode */) { + ts.scanner.setText((sourceFile || this.getSourceFile()).text); children = []; var pos_3 = this.pos; - var useJSDocScanner_1 = this.kind >= 273 /* FirstJSDocTagNode */ && this.kind <= 285 /* 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) { @@ -53286,19 +78617,23 @@ 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); } } + // For syntactic classifications, all trivia are classcified together, including jsdoc comments. + // For that to work, the jsdoc comments should still be the leading trivia of the first child. + // Restoring the scanner position ensures that. + pos_3 = this.pos; ts.forEachChild(this, processNode, processNodes); if (pos_3 < this.end) { this.addSyntheticNodes(children, pos_3, this.end); } - scanner.setText(undefined); + ts.scanner.setText(undefined); } - this._children = children || emptyArray; + this._children = children || ts.emptyArray; }; NodeObject.prototype.getChildCount = function (sourceFile) { if (!this._children) @@ -53321,7 +78656,7 @@ var ts; return undefined; } var child = children[0]; - return child.kind < 139 /* FirstNode */ ? child : child.getFirstToken(sourceFile); + return child.kind < 141 /* FirstNode */ ? child : child.getFirstToken(sourceFile); }; NodeObject.prototype.getLastToken = function (sourceFile) { var children = this.getChildren(sourceFile); @@ -53329,7 +78664,7 @@ var ts; if (!child) { return undefined; } - return child.kind < 139 /* FirstNode */ ? child : child.getLastToken(sourceFile); + return child.kind < 141 /* FirstNode */ ? child : child.getLastToken(sourceFile); }; return NodeObject; }()); @@ -53368,39 +78703,23 @@ var ts; TokenOrIdentifierObject.prototype.getText = function (sourceFile) { return (sourceFile || this.getSourceFile()).text.substring(this.getStart(), this.getEnd()); }; - TokenOrIdentifierObject.prototype.getChildCount = function (sourceFile) { + TokenOrIdentifierObject.prototype.getChildCount = function () { return 0; }; - TokenOrIdentifierObject.prototype.getChildAt = function (index, sourceFile) { + TokenOrIdentifierObject.prototype.getChildAt = function () { return undefined; }; - TokenOrIdentifierObject.prototype.getChildren = function (sourceFile) { - return emptyArray; + TokenOrIdentifierObject.prototype.getChildren = function () { + return ts.emptyArray; }; - TokenOrIdentifierObject.prototype.getFirstToken = function (sourceFile) { + TokenOrIdentifierObject.prototype.getFirstToken = function () { return undefined; }; - TokenOrIdentifierObject.prototype.getLastToken = function (sourceFile) { + TokenOrIdentifierObject.prototype.getLastToken = function () { return undefined; }; return TokenOrIdentifierObject; }()); - var TokenObject = (function (_super) { - __extends(TokenObject, _super); - function TokenObject(kind, pos, end) { - _super.call(this, pos, end); - this.kind = kind; - } - return TokenObject; - }(TokenOrIdentifierObject)); - var IdentifierObject = (function (_super) { - __extends(IdentifierObject, _super); - function IdentifierObject(kind, pos, end) { - _super.call(this, pos, end); - } - return IdentifierObject; - }(TokenOrIdentifierObject)); - IdentifierObject.prototype.kind = 69 /* Identifier */; var SymbolObject = (function () { function SymbolObject(flags, name) { this.flags = flags; @@ -53417,301 +78736,35 @@ var ts; }; SymbolObject.prototype.getDocumentationComment = function () { if (this.documentationComment === undefined) { - this.documentationComment = getJsDocCommentsFromDeclarations(this.declarations, this.name, !(this.flags & 4 /* Property */)); + this.documentationComment = ts.JsDoc.getJsDocCommentsFromDeclarations(this.declarations); } return this.documentationComment; }; + SymbolObject.prototype.getJsDocTags = function () { + if (this.tags === undefined) { + this.tags = ts.JsDoc.getJsDocTagsFromDeclarations(this.declarations); + } + return this.tags; + }; return SymbolObject; }()); - function getJsDocCommentsFromDeclarations(declarations, name, canUseParsedParamTagComments) { - var documentationComment = []; - var docComments = getJsDocCommentsSeparatedByNewLines(); - ts.forEach(docComments, function (docComment) { - if (documentationComment.length) { - documentationComment.push(ts.lineBreakPart()); - } - documentationComment.push(docComment); - }); - return documentationComment; - function getJsDocCommentsSeparatedByNewLines() { - var paramTag = "@param"; - var jsDocCommentParts = []; - ts.forEach(declarations, function (declaration, indexOfDeclaration) { - // Make sure we are collecting doc comment from declaration once, - // In case of union property there might be same declaration multiple times - // which only varies in type parameter - // Eg. const a: Array | Array; a.length - // The property length will have two declarations of property length coming - // from Array - Array and Array - if (ts.indexOf(declarations, declaration) === indexOfDeclaration) { - var sourceFileOfDeclaration = ts.getSourceFileOfNode(declaration); - // If it is parameter - try and get the jsDoc comment with @param tag from function declaration's jsDoc comments - if (canUseParsedParamTagComments && declaration.kind === 142 /* Parameter */) { - if ((declaration.parent.kind === 179 /* FunctionExpression */ || declaration.parent.kind === 180 /* ArrowFunction */) && - declaration.parent.parent.kind === 218 /* VariableDeclaration */) { - addCommentParts(declaration.parent.parent.parent, sourceFileOfDeclaration, getCleanedParamJsDocComment); - } - addCommentParts(declaration.parent, sourceFileOfDeclaration, getCleanedParamJsDocComment); - } - // If this is left side of dotted module declaration, there is no doc comments associated with this node - if (declaration.kind === 225 /* ModuleDeclaration */ && declaration.body && declaration.body.kind === 225 /* ModuleDeclaration */) { - return; - } - if ((declaration.kind === 179 /* FunctionExpression */ || declaration.kind === 180 /* ArrowFunction */) && - declaration.parent.kind === 218 /* VariableDeclaration */) { - addCommentParts(declaration.parent.parent, sourceFileOfDeclaration, getCleanedJsDocComment); - } - // If this is dotted module name, get the doc comments from the parent - while (declaration.kind === 225 /* ModuleDeclaration */ && declaration.parent.kind === 225 /* ModuleDeclaration */) { - declaration = declaration.parent; - } - addCommentParts(declaration.kind === 218 /* VariableDeclaration */ ? declaration.parent.parent : declaration, sourceFileOfDeclaration, getCleanedJsDocComment); - if (declaration.kind === 218 /* VariableDeclaration */) { - var init = declaration.initializer; - if (init && (init.kind === 179 /* FunctionExpression */ || init.kind === 180 /* ArrowFunction */)) { - // Get the cleaned js doc comment text from the initializer - addCommentParts(init, sourceFileOfDeclaration, getCleanedJsDocComment); - } - } - } - }); - return jsDocCommentParts; - function addCommentParts(commented, sourceFileOfDeclaration, getCommentPart) { - var ranges = getJsDocCommentTextRange(commented, sourceFileOfDeclaration); - // Get the cleaned js doc comment text from the declaration - ts.forEach(ranges, function (jsDocCommentTextRange) { - var cleanedComment = getCommentPart(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); - if (cleanedComment) { - ts.addRange(jsDocCommentParts, cleanedComment); - } - }); - } - function getJsDocCommentTextRange(node, sourceFile) { - return ts.map(ts.getJsDocComments(node, sourceFile), function (jsDocComment) { - return { - pos: jsDocComment.pos + "/*".length, - end: jsDocComment.end - "*/".length // Trim off comment end indicator - }; - }); - } - function consumeWhiteSpacesOnTheLine(pos, end, sourceFile, maxSpacesToRemove) { - if (maxSpacesToRemove !== undefined) { - end = Math.min(end, pos + maxSpacesToRemove); - } - for (; pos < end; pos++) { - var ch = sourceFile.text.charCodeAt(pos); - if (!ts.isWhiteSpaceSingleLine(ch)) { - return pos; - } - } - return end; - } - function consumeLineBreaks(pos, end, sourceFile) { - while (pos < end && ts.isLineBreak(sourceFile.text.charCodeAt(pos))) { - pos++; - } - return pos; - } - function isName(pos, end, sourceFile, name) { - return pos + name.length < end && - sourceFile.text.substr(pos, name.length) === name && - ts.isWhiteSpace(sourceFile.text.charCodeAt(pos + name.length)); - } - function isParamTag(pos, end, sourceFile) { - // If it is @param tag - return isName(pos, end, sourceFile, paramTag); - } - function pushDocCommentLineText(docComments, text, blankLineCount) { - // Add the empty lines in between texts - while (blankLineCount) { - blankLineCount--; - docComments.push(ts.textPart("")); - } - docComments.push(ts.textPart(text)); - } - function getCleanedJsDocComment(pos, end, sourceFile) { - var spacesToRemoveAfterAsterisk; - var docComments = []; - var blankLineCount = 0; - var isInParamTag = false; - while (pos < end) { - var docCommentTextOfLine = ""; - // First consume leading white space - pos = consumeWhiteSpacesOnTheLine(pos, end, sourceFile); - // If the comment starts with '*' consume the spaces on this line - if (pos < end && sourceFile.text.charCodeAt(pos) === 42 /* asterisk */) { - var lineStartPos = pos + 1; - pos = consumeWhiteSpacesOnTheLine(pos + 1, end, sourceFile, spacesToRemoveAfterAsterisk); - // Set the spaces to remove after asterisk as margin if not already set - if (spacesToRemoveAfterAsterisk === undefined && pos < end && !ts.isLineBreak(sourceFile.text.charCodeAt(pos))) { - spacesToRemoveAfterAsterisk = pos - lineStartPos; - } - } - else if (spacesToRemoveAfterAsterisk === undefined) { - spacesToRemoveAfterAsterisk = 0; - } - // Analyze text on this line - while (pos < end && !ts.isLineBreak(sourceFile.text.charCodeAt(pos))) { - var ch = sourceFile.text.charAt(pos); - if (ch === "@") { - // If it is @param tag - if (isParamTag(pos, end, sourceFile)) { - isInParamTag = true; - pos += paramTag.length; - continue; - } - else { - isInParamTag = false; - } - } - // Add the ch to doc text if we arent in param tag - if (!isInParamTag) { - docCommentTextOfLine += ch; - } - // Scan next character - pos++; - } - // Continue with next line - pos = consumeLineBreaks(pos, end, sourceFile); - if (docCommentTextOfLine) { - pushDocCommentLineText(docComments, docCommentTextOfLine, blankLineCount); - blankLineCount = 0; - } - else if (!isInParamTag && docComments.length) { - // This is blank line when there is text already parsed - blankLineCount++; - } - } - return docComments; - } - function getCleanedParamJsDocComment(pos, end, sourceFile) { - var paramHelpStringMargin; - var paramDocComments = []; - while (pos < end) { - if (isParamTag(pos, end, sourceFile)) { - var blankLineCount = 0; - var recordedParamTag = false; - // Consume leading spaces - pos = consumeWhiteSpaces(pos + paramTag.length); - if (pos >= end) { - break; - } - // Ignore type expression - if (sourceFile.text.charCodeAt(pos) === 123 /* openBrace */) { - pos++; - for (var curlies = 1; pos < end; pos++) { - var charCode = sourceFile.text.charCodeAt(pos); - // { character means we need to find another } to match the found one - if (charCode === 123 /* openBrace */) { - curlies++; - continue; - } - // } char - if (charCode === 125 /* closeBrace */) { - curlies--; - if (curlies === 0) { - // We do not have any more } to match the type expression is ignored completely - pos++; - break; - } - else { - // there are more { to be matched with } - continue; - } - } - // Found start of another tag - if (charCode === 64 /* at */) { - break; - } - } - // Consume white spaces - pos = consumeWhiteSpaces(pos); - if (pos >= end) { - break; - } - } - // Parameter name - if (isName(pos, end, sourceFile, name)) { - // Found the parameter we are looking for consume white spaces - pos = consumeWhiteSpaces(pos + name.length); - if (pos >= end) { - break; - } - var paramHelpString = ""; - var firstLineParamHelpStringPos = pos; - while (pos < end) { - var ch = sourceFile.text.charCodeAt(pos); - // at line break, set this comment line text and go to next line - if (ts.isLineBreak(ch)) { - if (paramHelpString) { - pushDocCommentLineText(paramDocComments, paramHelpString, blankLineCount); - paramHelpString = ""; - blankLineCount = 0; - recordedParamTag = true; - } - else if (recordedParamTag) { - blankLineCount++; - } - // Get the pos after cleaning start of the line - setPosForParamHelpStringOnNextLine(firstLineParamHelpStringPos); - continue; - } - // Done scanning param help string - next tag found - if (ch === 64 /* at */) { - break; - } - paramHelpString += sourceFile.text.charAt(pos); - // Go to next character - pos++; - } - // If there is param help text, add it top the doc comments - if (paramHelpString) { - pushDocCommentLineText(paramDocComments, paramHelpString, blankLineCount); - } - paramHelpStringMargin = undefined; - } - // If this is the start of another tag, continue with the loop in search of param tag with symbol name - if (sourceFile.text.charCodeAt(pos) === 64 /* at */) { - continue; - } - } - // Next character - pos++; - } - return paramDocComments; - function consumeWhiteSpaces(pos) { - while (pos < end && ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(pos))) { - pos++; - } - return pos; - } - function setPosForParamHelpStringOnNextLine(firstLineParamHelpStringPos) { - // Get the pos after consuming line breaks - pos = consumeLineBreaks(pos, end, sourceFile); - if (pos >= end) { - return; - } - if (paramHelpStringMargin === undefined) { - paramHelpStringMargin = sourceFile.getLineAndCharacterOfPosition(firstLineParamHelpStringPos).character; - } - // Now consume white spaces max - var startOfLinePos = pos; - pos = consumeWhiteSpacesOnTheLine(pos, end, sourceFile, paramHelpStringMargin); - if (pos >= end) { - return; - } - var consumedSpaces = pos - startOfLinePos; - if (consumedSpaces < paramHelpStringMargin) { - var ch = sourceFile.text.charCodeAt(pos); - if (ch === 42 /* asterisk */) { - // Consume more spaces after asterisk - pos = consumeWhiteSpacesOnTheLine(pos + 1, end, sourceFile, paramHelpStringMargin - consumedSpaces - 1); - } - } - } - } + var TokenObject = (function (_super) { + __extends(TokenObject, _super); + function TokenObject(kind, pos, end) { + var _this = _super.call(this, pos, end) || this; + _this.kind = kind; + return _this; } - } + return TokenObject; + }(TokenOrIdentifierObject)); + var IdentifierObject = (function (_super) { + __extends(IdentifierObject, _super); + function IdentifierObject(_kind, pos, end) { + return _super.call(this, pos, end) || this; + } + return IdentifierObject; + }(TokenOrIdentifierObject)); + IdentifierObject.prototype.kind = 70 /* Identifier */; var TypeObject = (function () { function TypeObject(checker, flags) { this.checker = checker; @@ -53745,7 +78798,7 @@ var ts; return this.checker.getIndexTypeOfType(this, 1 /* Number */); }; TypeObject.prototype.getBaseTypes = function () { - return this.flags & (32768 /* Class */ | 65536 /* Interface */) + return this.flags & 32768 /* Object */ && this.objectFlags & (1 /* Class */ | 2 /* Interface */) ? this.checker.getBaseTypes(this) : undefined; }; @@ -53772,18 +78825,22 @@ var ts; }; SignatureObject.prototype.getDocumentationComment = function () { if (this.documentationComment === undefined) { - this.documentationComment = this.declaration ? getJsDocCommentsFromDeclarations([this.declaration], - /*name*/ undefined, - /*canUseParsedParamTagComments*/ false) : []; + this.documentationComment = this.declaration ? ts.JsDoc.getJsDocCommentsFromDeclarations([this.declaration]) : []; } return this.documentationComment; }; + SignatureObject.prototype.getJsDocTags = function () { + if (this.jsDocTags === undefined) { + this.jsDocTags = this.declaration ? ts.JsDoc.getJsDocTagsFromDeclarations([this.declaration]) : []; + } + return this.jsDocTags; + }; return SignatureObject; }()); var SourceFileObject = (function (_super) { __extends(SourceFileObject, _super); function SourceFileObject(kind, pos, end) { - _super.call(this, kind, pos, end); + return _super.call(this, kind, pos, end) || this; } SourceFileObject.prototype.update = function (newText, textChangeRange) { return ts.updateSourceFile(this, newText, textChangeRange); @@ -53797,6 +78854,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(); @@ -53810,8 +78881,7 @@ var ts; function addDeclaration(declaration) { var name = getDeclarationName(declaration); if (name) { - var declarations = getDeclarations(name); - declarations.push(declaration); + ts.multiMapAdd(result, name, declaration); } } function getDeclarations(name) { @@ -53819,13 +78889,13 @@ var ts; } function getDeclarationName(declaration) { if (declaration.name) { - var result_3 = getTextOfIdentifierOrLiteral(declaration.name); - if (result_3 !== undefined) { - return result_3; + var result_7 = getTextOfIdentifierOrLiteral(declaration.name); + if (result_7 !== undefined) { + return result_7; } - if (declaration.name.kind === 140 /* ComputedPropertyName */) { + if (declaration.name.kind === 142 /* ComputedPropertyName */) { var expr = declaration.name.expression; - if (expr.kind === 172 /* PropertyAccessExpression */) { + if (expr.kind === 177 /* PropertyAccessExpression */) { return expr.name.text; } return getTextOfIdentifierOrLiteral(expr); @@ -53835,7 +78905,7 @@ var ts; } function getTextOfIdentifierOrLiteral(node) { if (node) { - if (node.kind === 69 /* Identifier */ || + if (node.kind === 70 /* Identifier */ || node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) { return node.text; @@ -53845,10 +78915,10 @@ var ts; } function visit(node) { switch (node.kind) { - case 220 /* FunctionDeclaration */: - case 179 /* FunctionExpression */: - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: + case 225 /* FunctionDeclaration */: + case 184 /* FunctionExpression */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -53865,35 +78935,35 @@ var ts; else { declarations.push(functionDeclaration); } - ts.forEachChild(node, visit); } + ts.forEachChild(node, visit); break; - case 221 /* ClassDeclaration */: - case 192 /* ClassExpression */: - case 222 /* InterfaceDeclaration */: - case 223 /* TypeAliasDeclaration */: - case 224 /* EnumDeclaration */: - case 225 /* ModuleDeclaration */: - case 229 /* ImportEqualsDeclaration */: - case 238 /* ExportSpecifier */: - case 234 /* ImportSpecifier */: - case 229 /* ImportEqualsDeclaration */: - case 231 /* ImportClause */: - case 232 /* NamespaceImport */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - case 159 /* TypeLiteral */: + case 226 /* ClassDeclaration */: + case 197 /* ClassExpression */: + case 227 /* InterfaceDeclaration */: + case 228 /* TypeAliasDeclaration */: + case 229 /* EnumDeclaration */: + case 230 /* ModuleDeclaration */: + case 234 /* ImportEqualsDeclaration */: + case 243 /* ExportSpecifier */: + case 239 /* ImportSpecifier */: + case 234 /* ImportEqualsDeclaration */: + case 236 /* ImportClause */: + case 237 /* NamespaceImport */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + case 161 /* TypeLiteral */: addDeclaration(node); ts.forEachChild(node, visit); break; - case 142 /* Parameter */: + case 144 /* Parameter */: // Only consider parameter properties - if (!(node.flags & 92 /* ParameterPropertyModifier */)) { + if (!ts.hasModifier(node, 92 /* ParameterPropertyModifier */)) { break; } // fall through - case 218 /* VariableDeclaration */: - case 169 /* BindingElement */: { + case 223 /* VariableDeclaration */: + case 174 /* BindingElement */: { var decl = node; if (ts.isBindingPattern(decl.name)) { ts.forEachChild(decl.name, visit); @@ -53902,19 +78972,19 @@ var ts; if (decl.initializer) visit(decl.initializer); } - case 255 /* EnumMember */: - case 145 /* PropertyDeclaration */: - case 144 /* PropertySignature */: + case 260 /* EnumMember */: + case 147 /* PropertyDeclaration */: + case 146 /* PropertySignature */: addDeclaration(node); break; - case 236 /* ExportDeclaration */: + case 241 /* ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 230 /* ImportDeclaration */: + case 235 /* ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -53926,7 +78996,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 232 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 237 /* NamespaceImport */) { addDeclaration(importClause.namedBindings); } else { @@ -53942,209 +79012,41 @@ var ts; }; return SourceFileObject; }(NodeObject)); - var TextChange = (function () { - function TextChange() { + function getServicesObjectAllocator() { + return { + getNodeConstructor: function () { return NodeObject; }, + getTokenConstructor: function () { return TokenObject; }, + getIdentifierConstructor: function () { return IdentifierObject; }, + getSourceFileConstructor: function () { return SourceFileObject; }, + getSymbolConstructor: function () { return SymbolObject; }, + getTypeConstructor: function () { return TypeObject; }, + getSignatureConstructor: function () { return SignatureObject; }, + }; + } + function toEditorSettings(optionsAsMap) { + var allPropertiesAreCamelCased = true; + for (var key in optionsAsMap) { + if (ts.hasProperty(optionsAsMap, key) && !isCamelCase(key)) { + allPropertiesAreCamelCased = false; + break; + } } - return TextChange; - }()); - ts.TextChange = TextChange; - var HighlightSpanKind; - (function (HighlightSpanKind) { - HighlightSpanKind.none = "none"; - HighlightSpanKind.definition = "definition"; - HighlightSpanKind.reference = "reference"; - HighlightSpanKind.writtenReference = "writtenReference"; - })(HighlightSpanKind = ts.HighlightSpanKind || (ts.HighlightSpanKind = {})); - (function (IndentStyle) { - IndentStyle[IndentStyle["None"] = 0] = "None"; - IndentStyle[IndentStyle["Block"] = 1] = "Block"; - IndentStyle[IndentStyle["Smart"] = 2] = "Smart"; - })(ts.IndentStyle || (ts.IndentStyle = {})); - var IndentStyle = ts.IndentStyle; - (function (SymbolDisplayPartKind) { - SymbolDisplayPartKind[SymbolDisplayPartKind["aliasName"] = 0] = "aliasName"; - SymbolDisplayPartKind[SymbolDisplayPartKind["className"] = 1] = "className"; - SymbolDisplayPartKind[SymbolDisplayPartKind["enumName"] = 2] = "enumName"; - SymbolDisplayPartKind[SymbolDisplayPartKind["fieldName"] = 3] = "fieldName"; - SymbolDisplayPartKind[SymbolDisplayPartKind["interfaceName"] = 4] = "interfaceName"; - SymbolDisplayPartKind[SymbolDisplayPartKind["keyword"] = 5] = "keyword"; - SymbolDisplayPartKind[SymbolDisplayPartKind["lineBreak"] = 6] = "lineBreak"; - SymbolDisplayPartKind[SymbolDisplayPartKind["numericLiteral"] = 7] = "numericLiteral"; - SymbolDisplayPartKind[SymbolDisplayPartKind["stringLiteral"] = 8] = "stringLiteral"; - SymbolDisplayPartKind[SymbolDisplayPartKind["localName"] = 9] = "localName"; - SymbolDisplayPartKind[SymbolDisplayPartKind["methodName"] = 10] = "methodName"; - SymbolDisplayPartKind[SymbolDisplayPartKind["moduleName"] = 11] = "moduleName"; - SymbolDisplayPartKind[SymbolDisplayPartKind["operator"] = 12] = "operator"; - SymbolDisplayPartKind[SymbolDisplayPartKind["parameterName"] = 13] = "parameterName"; - SymbolDisplayPartKind[SymbolDisplayPartKind["propertyName"] = 14] = "propertyName"; - SymbolDisplayPartKind[SymbolDisplayPartKind["punctuation"] = 15] = "punctuation"; - SymbolDisplayPartKind[SymbolDisplayPartKind["space"] = 16] = "space"; - SymbolDisplayPartKind[SymbolDisplayPartKind["text"] = 17] = "text"; - SymbolDisplayPartKind[SymbolDisplayPartKind["typeParameterName"] = 18] = "typeParameterName"; - SymbolDisplayPartKind[SymbolDisplayPartKind["enumMemberName"] = 19] = "enumMemberName"; - SymbolDisplayPartKind[SymbolDisplayPartKind["functionName"] = 20] = "functionName"; - SymbolDisplayPartKind[SymbolDisplayPartKind["regularExpressionLiteral"] = 21] = "regularExpressionLiteral"; - })(ts.SymbolDisplayPartKind || (ts.SymbolDisplayPartKind = {})); - var SymbolDisplayPartKind = ts.SymbolDisplayPartKind; - (function (OutputFileType) { - OutputFileType[OutputFileType["JavaScript"] = 0] = "JavaScript"; - OutputFileType[OutputFileType["SourceMap"] = 1] = "SourceMap"; - OutputFileType[OutputFileType["Declaration"] = 2] = "Declaration"; - })(ts.OutputFileType || (ts.OutputFileType = {})); - var OutputFileType = ts.OutputFileType; - (function (EndOfLineState) { - EndOfLineState[EndOfLineState["None"] = 0] = "None"; - EndOfLineState[EndOfLineState["InMultiLineCommentTrivia"] = 1] = "InMultiLineCommentTrivia"; - EndOfLineState[EndOfLineState["InSingleQuoteStringLiteral"] = 2] = "InSingleQuoteStringLiteral"; - EndOfLineState[EndOfLineState["InDoubleQuoteStringLiteral"] = 3] = "InDoubleQuoteStringLiteral"; - EndOfLineState[EndOfLineState["InTemplateHeadOrNoSubstitutionTemplate"] = 4] = "InTemplateHeadOrNoSubstitutionTemplate"; - EndOfLineState[EndOfLineState["InTemplateMiddleOrTail"] = 5] = "InTemplateMiddleOrTail"; - EndOfLineState[EndOfLineState["InTemplateSubstitutionPosition"] = 6] = "InTemplateSubstitutionPosition"; - })(ts.EndOfLineState || (ts.EndOfLineState = {})); - var EndOfLineState = ts.EndOfLineState; - (function (TokenClass) { - TokenClass[TokenClass["Punctuation"] = 0] = "Punctuation"; - TokenClass[TokenClass["Keyword"] = 1] = "Keyword"; - TokenClass[TokenClass["Operator"] = 2] = "Operator"; - TokenClass[TokenClass["Comment"] = 3] = "Comment"; - TokenClass[TokenClass["Whitespace"] = 4] = "Whitespace"; - TokenClass[TokenClass["Identifier"] = 5] = "Identifier"; - TokenClass[TokenClass["NumberLiteral"] = 6] = "NumberLiteral"; - TokenClass[TokenClass["StringLiteral"] = 7] = "StringLiteral"; - TokenClass[TokenClass["RegExpLiteral"] = 8] = "RegExpLiteral"; - })(ts.TokenClass || (ts.TokenClass = {})); - var TokenClass = ts.TokenClass; - // TODO: move these to enums - var ScriptElementKind; - (function (ScriptElementKind) { - ScriptElementKind.unknown = ""; - ScriptElementKind.warning = "warning"; - /** predefined type (void) or keyword (class) */ - ScriptElementKind.keyword = "keyword"; - /** top level script node */ - ScriptElementKind.scriptElement = "script"; - /** module foo {} */ - ScriptElementKind.moduleElement = "module"; - /** class X {} */ - ScriptElementKind.classElement = "class"; - /** var x = class X {} */ - ScriptElementKind.localClassElement = "local class"; - /** interface Y {} */ - ScriptElementKind.interfaceElement = "interface"; - /** type T = ... */ - ScriptElementKind.typeElement = "type"; - /** enum E */ - ScriptElementKind.enumElement = "enum"; - // TODO: GH#9983 - ScriptElementKind.enumMemberElement = "const"; - /** - * Inside module and script only - * const v = .. - */ - ScriptElementKind.variableElement = "var"; - /** Inside function */ - ScriptElementKind.localVariableElement = "local var"; - /** - * Inside module and script only - * function f() { } - */ - ScriptElementKind.functionElement = "function"; - /** Inside function */ - ScriptElementKind.localFunctionElement = "local function"; - /** class X { [public|private]* foo() {} } */ - ScriptElementKind.memberFunctionElement = "method"; - /** class X { [public|private]* [get|set] foo:number; } */ - ScriptElementKind.memberGetAccessorElement = "getter"; - ScriptElementKind.memberSetAccessorElement = "setter"; - /** - * class X { [public|private]* foo:number; } - * interface Y { foo:number; } - */ - ScriptElementKind.memberVariableElement = "property"; - /** class X { constructor() { } } */ - ScriptElementKind.constructorImplementationElement = "constructor"; - /** interface Y { ():number; } */ - ScriptElementKind.callSignatureElement = "call"; - /** interface Y { []:number; } */ - ScriptElementKind.indexSignatureElement = "index"; - /** interface Y { new():Y; } */ - ScriptElementKind.constructSignatureElement = "construct"; - /** function foo(*Y*: string) */ - ScriptElementKind.parameterElement = "parameter"; - ScriptElementKind.typeParameterElement = "type parameter"; - ScriptElementKind.primitiveType = "primitive type"; - ScriptElementKind.label = "label"; - ScriptElementKind.alias = "alias"; - ScriptElementKind.constElement = "const"; - ScriptElementKind.letElement = "let"; - })(ScriptElementKind = ts.ScriptElementKind || (ts.ScriptElementKind = {})); - var ScriptElementKindModifier; - (function (ScriptElementKindModifier) { - ScriptElementKindModifier.none = ""; - ScriptElementKindModifier.publicMemberModifier = "public"; - ScriptElementKindModifier.privateMemberModifier = "private"; - ScriptElementKindModifier.protectedMemberModifier = "protected"; - ScriptElementKindModifier.exportedModifier = "export"; - ScriptElementKindModifier.ambientModifier = "declare"; - ScriptElementKindModifier.staticModifier = "static"; - ScriptElementKindModifier.abstractModifier = "abstract"; - })(ScriptElementKindModifier = ts.ScriptElementKindModifier || (ts.ScriptElementKindModifier = {})); - var ClassificationTypeNames = (function () { - function ClassificationTypeNames() { + if (allPropertiesAreCamelCased) { + return optionsAsMap; } - ClassificationTypeNames.comment = "comment"; - ClassificationTypeNames.identifier = "identifier"; - ClassificationTypeNames.keyword = "keyword"; - ClassificationTypeNames.numericLiteral = "number"; - ClassificationTypeNames.operator = "operator"; - ClassificationTypeNames.stringLiteral = "string"; - ClassificationTypeNames.whiteSpace = "whitespace"; - ClassificationTypeNames.text = "text"; - ClassificationTypeNames.punctuation = "punctuation"; - ClassificationTypeNames.className = "class name"; - ClassificationTypeNames.enumName = "enum name"; - ClassificationTypeNames.interfaceName = "interface name"; - ClassificationTypeNames.moduleName = "module name"; - ClassificationTypeNames.typeParameterName = "type parameter name"; - ClassificationTypeNames.typeAliasName = "type alias name"; - ClassificationTypeNames.parameterName = "parameter name"; - ClassificationTypeNames.docCommentTagName = "doc comment tag name"; - ClassificationTypeNames.jsxOpenTagName = "jsx open tag name"; - ClassificationTypeNames.jsxCloseTagName = "jsx close tag name"; - ClassificationTypeNames.jsxSelfClosingTagName = "jsx self closing tag name"; - ClassificationTypeNames.jsxAttribute = "jsx attribute"; - ClassificationTypeNames.jsxText = "jsx text"; - ClassificationTypeNames.jsxAttributeStringLiteralValue = "jsx attribute string literal value"; - return ClassificationTypeNames; - }()); - ts.ClassificationTypeNames = ClassificationTypeNames; - (function (ClassificationType) { - ClassificationType[ClassificationType["comment"] = 1] = "comment"; - ClassificationType[ClassificationType["identifier"] = 2] = "identifier"; - ClassificationType[ClassificationType["keyword"] = 3] = "keyword"; - ClassificationType[ClassificationType["numericLiteral"] = 4] = "numericLiteral"; - ClassificationType[ClassificationType["operator"] = 5] = "operator"; - ClassificationType[ClassificationType["stringLiteral"] = 6] = "stringLiteral"; - ClassificationType[ClassificationType["regularExpressionLiteral"] = 7] = "regularExpressionLiteral"; - ClassificationType[ClassificationType["whiteSpace"] = 8] = "whiteSpace"; - ClassificationType[ClassificationType["text"] = 9] = "text"; - ClassificationType[ClassificationType["punctuation"] = 10] = "punctuation"; - ClassificationType[ClassificationType["className"] = 11] = "className"; - ClassificationType[ClassificationType["enumName"] = 12] = "enumName"; - ClassificationType[ClassificationType["interfaceName"] = 13] = "interfaceName"; - ClassificationType[ClassificationType["moduleName"] = 14] = "moduleName"; - ClassificationType[ClassificationType["typeParameterName"] = 15] = "typeParameterName"; - ClassificationType[ClassificationType["typeAliasName"] = 16] = "typeAliasName"; - ClassificationType[ClassificationType["parameterName"] = 17] = "parameterName"; - ClassificationType[ClassificationType["docCommentTagName"] = 18] = "docCommentTagName"; - ClassificationType[ClassificationType["jsxOpenTagName"] = 19] = "jsxOpenTagName"; - ClassificationType[ClassificationType["jsxCloseTagName"] = 20] = "jsxCloseTagName"; - ClassificationType[ClassificationType["jsxSelfClosingTagName"] = 21] = "jsxSelfClosingTagName"; - ClassificationType[ClassificationType["jsxAttribute"] = 22] = "jsxAttribute"; - ClassificationType[ClassificationType["jsxText"] = 23] = "jsxText"; - ClassificationType[ClassificationType["jsxAttributeStringLiteralValue"] = 24] = "jsxAttributeStringLiteralValue"; - })(ts.ClassificationType || (ts.ClassificationType = {})); - var ClassificationType = ts.ClassificationType; + var settings = {}; + for (var key in optionsAsMap) { + if (ts.hasProperty(optionsAsMap, key)) { + var newKey = isCamelCase(key) ? key : key.charAt(0).toLowerCase() + key.substr(1); + settings[newKey] = optionsAsMap[key]; + } + } + return settings; + } + ts.toEditorSettings = toEditorSettings; + function isCamelCase(s) { + return !s.length || s.charAt(0) === s.charAt(0).toLowerCase(); + } function displayPartsToString(displayParts) { if (displayParts) { return ts.map(displayParts, function (displayPart) { return displayPart.text; }).join(""); @@ -54152,29 +79054,6 @@ var ts; return ""; } ts.displayPartsToString = displayPartsToString; - function isLocalVariableOrFunction(symbol) { - if (symbol.parent) { - return false; // This is exported symbol - } - return ts.forEach(symbol.declarations, function (declaration) { - // Function expressions are local - if (declaration.kind === 179 /* FunctionExpression */) { - return true; - } - if (declaration.kind !== 218 /* VariableDeclaration */ && declaration.kind !== 220 /* FunctionDeclaration */) { - return false; - } - // If the parent is not sourceFile or module block it is local variable - for (var parent_17 = declaration.parent; !ts.isFunctionBlock(parent_17); parent_17 = parent_17.parent) { - // Reached source file or module block - if (parent_17.kind === 256 /* SourceFile */ || parent_17.kind === 226 /* ModuleBlock */) { - return false; - } - } - // parent is in function block - return true; - }); - } function getDefaultCompilerOptions() { // Always default to "ScriptTarget.ES5" for the language service return { @@ -54183,9 +79062,13 @@ var ts; }; } ts.getDefaultCompilerOptions = getDefaultCompilerOptions; - // Cache host information about script should be refreshed + function getSupportedCodeFixes() { + return ts.codefix.getSupportedErrorCodes(); + } + ts.getSupportedCodeFixes = getSupportedCodeFixes; + // Cache host information about script Should be refreshed // at each language service public entry point, since we don't know when - // set of scripts handled by the host changes. + // the set of scripts handled by the host changes. var HostCache = (function () { function HostCache(host, getCanonicalFileName) { this.host = host; @@ -54236,7 +79119,7 @@ var ts; }; HostCache.prototype.getRootFileNames = function () { var fileNames = []; - this.fileNameToEntry.forEachValue(function (path, value) { + this.fileNameToEntry.forEachValue(function (_path, value) { if (value) { fileNames.push(value.hostFileName); } @@ -54268,7 +79151,7 @@ var ts; var sourceFile; if (this.currentFileName !== fileName) { // This is a new file, just parse it - sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 2 /* Latest */, version, /*setNodeParents*/ true, scriptKind); + sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 5 /* Latest */, version, /*setNodeParents*/ true, scriptKind); } else if (this.currentFileVersion !== version) { // This is the same file, just a newer version. Incrementally parse the file. @@ -54290,128 +79173,6 @@ var ts; sourceFile.version = version; sourceFile.scriptSnapshot = scriptSnapshot; } - var commandLineOptionsStringToEnum; - /** JS users may pass in string values for enum compiler options (such as ModuleKind), so convert. */ - function fixupCompilerOptions(options, diagnostics) { - // Lazily create this value to fix module loading errors. - commandLineOptionsStringToEnum = commandLineOptionsStringToEnum || ts.filter(ts.optionDeclarations, function (o) { - return typeof o.type === "object" && !ts.forEachProperty(o.type, function (v) { return typeof v !== "number"; }); - }); - options = ts.clone(options); - var _loop_3 = function(opt) { - if (!ts.hasProperty(options, opt.name)) { - return "continue"; - } - var value = options[opt.name]; - // Value should be a key of opt.type - if (typeof value === "string") { - // If value is not a string, this will fail - options[opt.name] = ts.parseCustomTypeOption(opt, value, diagnostics); - } - else { - if (!ts.forEachProperty(opt.type, function (v) { return v === value; })) { - // Supplied value isn't a valid enum value. - diagnostics.push(ts.createCompilerDiagnosticForInvalidCustomType(opt)); - } - } - }; - for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) { - var opt = commandLineOptionsStringToEnum_1[_i]; - _loop_3(opt); - } - return options; - } - /* - * This function will compile source text from 'input' argument using specified compiler options. - * If not options are provided - it will use a set of default compiler options. - * Extra compiler options that will unconditionally be used by this function are: - * - isolatedModules = true - * - allowNonTsExtensions = true - * - noLib = true - * - noResolve = true - */ - function transpileModule(input, transpileOptions) { - var diagnostics = []; - var options = transpileOptions.compilerOptions ? fixupCompilerOptions(transpileOptions.compilerOptions, diagnostics) : getDefaultCompilerOptions(); - options.isolatedModules = true; - // transpileModule does not write anything to disk so there is no need to verify that there are no conflicts between input and output paths. - options.suppressOutputPathCheck = true; - // Filename can be non-ts file. - options.allowNonTsExtensions = true; - // We are not returning a sourceFile for lib file when asked by the program, - // so pass --noLib to avoid reporting a file not found error. - options.noLib = true; - // Clear out other settings that would not be used in transpiling this module - options.lib = undefined; - options.types = undefined; - options.noEmit = undefined; - options.noEmitOnError = undefined; - options.paths = undefined; - options.rootDirs = undefined; - options.declaration = undefined; - options.declarationDir = undefined; - options.out = undefined; - options.outFile = undefined; - // We are not doing a full typecheck, we are not resolving the whole context, - // so pass --noResolve to avoid reporting missing file errors. - options.noResolve = true; - // if jsx is specified then treat file as .tsx - var inputFileName = transpileOptions.fileName || (options.jsx ? "module.tsx" : "module.ts"); - var sourceFile = ts.createSourceFile(inputFileName, input, options.target); - if (transpileOptions.moduleName) { - sourceFile.moduleName = transpileOptions.moduleName; - } - if (transpileOptions.renamedDependencies) { - sourceFile.renamedDependencies = ts.createMap(transpileOptions.renamedDependencies); - } - var newLine = ts.getNewLineCharacter(options); - // Output - var outputText; - var sourceMapText; - // Create a compilerHost object to allow the compiler to read and write files - var compilerHost = { - getSourceFile: function (fileName, target) { return fileName === ts.normalizePath(inputFileName) ? sourceFile : undefined; }, - writeFile: function (name, text, writeByteOrderMark) { - if (ts.fileExtensionIs(name, ".map")) { - ts.Debug.assert(sourceMapText === undefined, "Unexpected multiple source map outputs for the file '" + name + "'"); - sourceMapText = text; - } - else { - ts.Debug.assert(outputText === undefined, "Unexpected multiple outputs for the file: '" + name + "'"); - outputText = text; - } - }, - getDefaultLibFileName: function () { return "lib.d.ts"; }, - useCaseSensitiveFileNames: function () { return false; }, - getCanonicalFileName: function (fileName) { return fileName; }, - getCurrentDirectory: function () { return ""; }, - getNewLine: function () { return newLine; }, - fileExists: function (fileName) { return fileName === inputFileName; }, - readFile: function (fileName) { return ""; }, - directoryExists: function (directoryExists) { return true; }, - getDirectories: function (path) { return []; } - }; - var program = ts.createProgram([inputFileName], options, compilerHost); - if (transpileOptions.reportDiagnostics) { - ts.addRange(/*to*/ diagnostics, /*from*/ program.getSyntacticDiagnostics(sourceFile)); - ts.addRange(/*to*/ diagnostics, /*from*/ program.getOptionsDiagnostics()); - } - // Emit - program.emit(); - ts.Debug.assert(outputText !== undefined, "Output generation failed"); - return { outputText: outputText, diagnostics: diagnostics, sourceMapText: sourceMapText }; - } - ts.transpileModule = transpileModule; - /* - * This is a shortcut function for transpileModule - it accepts transpileOptions as parameters and returns only outputText part of the result. - */ - function transpile(input, compilerOptions, fileName, diagnostics, moduleName) { - var output = transpileModule(input, { compilerOptions: compilerOptions, fileName: fileName, reportDiagnostics: !!diagnostics, moduleName: moduleName }); - // addRange correctly handles cases when wither 'from' or 'to' argument is missing - ts.addRange(diagnostics, output.diagnostics); - return output.outputText; - } - ts.transpile = transpile; function createLanguageServiceSourceFile(fileName, scriptSnapshot, scriptTarget, version, setNodeParents, scriptKind) { var text = scriptSnapshot.getText(0, scriptSnapshot.getLength()); var sourceFile = ts.createSourceFile(fileName, text, scriptTarget, setNodeParents, scriptKind); @@ -54470,693 +79231,6 @@ var ts; return createLanguageServiceSourceFile(sourceFile.fileName, scriptSnapshot, sourceFile.languageVersion, version, /*setNodeParents*/ true, sourceFile.scriptKind); } ts.updateLanguageServiceSourceFile = updateLanguageServiceSourceFile; - function createDocumentRegistry(useCaseSensitiveFileNames, currentDirectory) { - if (currentDirectory === void 0) { currentDirectory = ""; } - // Maps from compiler setting target (ES3, ES5, etc.) to all the cached documents we have - // for those settings. - var buckets = ts.createMap(); - var getCanonicalFileName = ts.createGetCanonicalFileName(!!useCaseSensitiveFileNames); - function getKeyForCompilationSettings(settings) { - return ("_" + settings.target + "|" + settings.module + "|" + settings.noResolve + "|" + settings.jsx + "|" + settings.allowJs + "|" + settings.baseUrl + "|" + JSON.stringify(settings.typeRoots) + "|" + JSON.stringify(settings.rootDirs) + "|" + JSON.stringify(settings.paths)); - } - function getBucketForCompilationSettings(key, createIfMissing) { - var bucket = buckets[key]; - if (!bucket && createIfMissing) { - buckets[key] = bucket = ts.createFileMap(); - } - return bucket; - } - function reportStats() { - var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === "_"; }).map(function (name) { - var entries = buckets[name]; - var sourceFiles = []; - entries.forEachValue(function (key, entry) { - sourceFiles.push({ - name: key, - refCount: entry.languageServiceRefCount, - references: entry.owners.slice(0) - }); - }); - sourceFiles.sort(function (x, y) { return y.refCount - x.refCount; }); - return { - bucket: name, - sourceFiles: sourceFiles - }; - }); - return JSON.stringify(bucketInfoArray, undefined, 2); - } - function acquireDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) { - var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); - var key = getKeyForCompilationSettings(compilationSettings); - return acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind); - } - function acquireDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) { - return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, /*acquiring*/ true, scriptKind); - } - function updateDocument(fileName, compilationSettings, scriptSnapshot, version, scriptKind) { - var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); - var key = getKeyForCompilationSettings(compilationSettings); - return updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind); - } - function updateDocumentWithKey(fileName, path, compilationSettings, key, scriptSnapshot, version, scriptKind) { - return acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, /*acquiring*/ false, scriptKind); - } - function acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, acquiring, scriptKind) { - var bucket = getBucketForCompilationSettings(key, /*createIfMissing*/ true); - var entry = bucket.get(path); - if (!entry) { - ts.Debug.assert(acquiring, "How could we be trying to update a document that the registry doesn't have?"); - // Have never seen this file with these settings. Create a new source file for it. - var sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, /*setNodeParents*/ false, scriptKind); - entry = { - sourceFile: sourceFile, - languageServiceRefCount: 0, - owners: [] - }; - bucket.set(path, entry); - } - else { - // We have an entry for this file. However, it may be for a different version of - // the script snapshot. If so, update it appropriately. Otherwise, we can just - // return it as is. - if (entry.sourceFile.version !== version) { - entry.sourceFile = updateLanguageServiceSourceFile(entry.sourceFile, scriptSnapshot, version, scriptSnapshot.getChangeRange(entry.sourceFile.scriptSnapshot)); - } - } - // If we're acquiring, then this is the first time this LS is asking for this document. - // Increase our ref count so we know there's another LS using the document. If we're - // not acquiring, then that means the LS is 'updating' the file instead, and that means - // it has already acquired the document previously. As such, we do not need to increase - // the ref count. - if (acquiring) { - entry.languageServiceRefCount++; - } - return entry.sourceFile; - } - function releaseDocument(fileName, compilationSettings) { - var path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); - var key = getKeyForCompilationSettings(compilationSettings); - return releaseDocumentWithKey(path, key); - } - function releaseDocumentWithKey(path, key) { - var bucket = getBucketForCompilationSettings(key, /*createIfMissing*/ false); - ts.Debug.assert(bucket !== undefined); - var entry = bucket.get(path); - entry.languageServiceRefCount--; - ts.Debug.assert(entry.languageServiceRefCount >= 0); - if (entry.languageServiceRefCount === 0) { - bucket.remove(path); - } - } - return { - acquireDocument: acquireDocument, - acquireDocumentWithKey: acquireDocumentWithKey, - updateDocument: updateDocument, - updateDocumentWithKey: updateDocumentWithKey, - releaseDocument: releaseDocument, - releaseDocumentWithKey: releaseDocumentWithKey, - reportStats: reportStats, - getKeyForCompilationSettings: getKeyForCompilationSettings - }; - } - ts.createDocumentRegistry = createDocumentRegistry; - function preProcessFile(sourceText, readImportFiles, detectJavaScriptImports) { - if (readImportFiles === void 0) { readImportFiles = true; } - if (detectJavaScriptImports === void 0) { detectJavaScriptImports = false; } - var referencedFiles = []; - var typeReferenceDirectives = []; - var importedFiles = []; - var ambientExternalModules; - var isNoDefaultLib = false; - var braceNesting = 0; - // assume that text represent an external module if it contains at least one top level import/export - // ambient modules that are found inside external modules are interpreted as module augmentations - var externalModule = false; - function nextToken() { - var token = scanner.scan(); - if (token === 15 /* OpenBraceToken */) { - braceNesting++; - } - else if (token === 16 /* CloseBraceToken */) { - braceNesting--; - } - return token; - } - function processTripleSlashDirectives() { - var commentRanges = ts.getLeadingCommentRanges(sourceText, 0); - ts.forEach(commentRanges, function (commentRange) { - var comment = sourceText.substring(commentRange.pos, commentRange.end); - var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, commentRange); - if (referencePathMatchResult) { - isNoDefaultLib = referencePathMatchResult.isNoDefaultLib; - var fileReference = referencePathMatchResult.fileReference; - if (fileReference) { - var collection = referencePathMatchResult.isTypeReferenceDirective - ? typeReferenceDirectives - : referencedFiles; - collection.push(fileReference); - } - } - }); - } - function getFileReference() { - var file = scanner.getTokenValue(); - var pos = scanner.getTokenPos(); - return { - fileName: file, - pos: pos, - end: pos + file.length - }; - } - function recordAmbientExternalModule() { - if (!ambientExternalModules) { - ambientExternalModules = []; - } - ambientExternalModules.push({ ref: getFileReference(), depth: braceNesting }); - } - function recordModuleName() { - importedFiles.push(getFileReference()); - markAsExternalModuleIfTopLevel(); - } - function markAsExternalModuleIfTopLevel() { - if (braceNesting === 0) { - externalModule = true; - } - } - /** - * Returns true if at least one token was consumed from the stream - */ - function tryConsumeDeclare() { - var token = scanner.getToken(); - if (token === 122 /* DeclareKeyword */) { - // declare module "mod" - token = nextToken(); - if (token === 125 /* ModuleKeyword */) { - token = nextToken(); - if (token === 9 /* StringLiteral */) { - recordAmbientExternalModule(); - } - } - return true; - } - return false; - } - /** - * Returns true if at least one token was consumed from the stream - */ - function tryConsumeImport() { - var token = scanner.getToken(); - if (token === 89 /* ImportKeyword */) { - token = nextToken(); - if (token === 9 /* StringLiteral */) { - // import "mod"; - recordModuleName(); - return true; - } - else { - if (token === 69 /* Identifier */ || ts.isKeyword(token)) { - token = nextToken(); - if (token === 136 /* FromKeyword */) { - token = nextToken(); - if (token === 9 /* StringLiteral */) { - // import d from "mod"; - recordModuleName(); - return true; - } - } - else if (token === 56 /* EqualsToken */) { - if (tryConsumeRequireCall(/*skipCurrentToken*/ true)) { - return true; - } - } - else if (token === 24 /* CommaToken */) { - // consume comma and keep going - token = nextToken(); - } - else { - // unknown syntax - return true; - } - } - if (token === 15 /* OpenBraceToken */) { - token = nextToken(); - // consume "{ a as B, c, d as D}" clauses - // make sure that it stops on EOF - while (token !== 16 /* CloseBraceToken */ && token !== 1 /* EndOfFileToken */) { - token = nextToken(); - } - if (token === 16 /* CloseBraceToken */) { - token = nextToken(); - if (token === 136 /* FromKeyword */) { - token = nextToken(); - if (token === 9 /* StringLiteral */) { - // import {a as A} from "mod"; - // import d, {a, b as B} from "mod" - recordModuleName(); - } - } - } - } - else if (token === 37 /* AsteriskToken */) { - token = nextToken(); - if (token === 116 /* AsKeyword */) { - token = nextToken(); - if (token === 69 /* Identifier */ || ts.isKeyword(token)) { - token = nextToken(); - if (token === 136 /* FromKeyword */) { - token = nextToken(); - if (token === 9 /* StringLiteral */) { - // import * as NS from "mod" - // import d, * as NS from "mod" - recordModuleName(); - } - } - } - } - } - } - return true; - } - return false; - } - function tryConsumeExport() { - var token = scanner.getToken(); - if (token === 82 /* ExportKeyword */) { - markAsExternalModuleIfTopLevel(); - token = nextToken(); - if (token === 15 /* OpenBraceToken */) { - token = nextToken(); - // consume "{ a as B, c, d as D}" clauses - // make sure it stops on EOF - while (token !== 16 /* CloseBraceToken */ && token !== 1 /* EndOfFileToken */) { - token = nextToken(); - } - if (token === 16 /* CloseBraceToken */) { - token = nextToken(); - if (token === 136 /* FromKeyword */) { - token = nextToken(); - if (token === 9 /* StringLiteral */) { - // export {a as A} from "mod"; - // export {a, b as B} from "mod" - recordModuleName(); - } - } - } - } - else if (token === 37 /* AsteriskToken */) { - token = nextToken(); - if (token === 136 /* FromKeyword */) { - token = nextToken(); - if (token === 9 /* StringLiteral */) { - // export * from "mod" - recordModuleName(); - } - } - } - else if (token === 89 /* ImportKeyword */) { - token = nextToken(); - if (token === 69 /* Identifier */ || ts.isKeyword(token)) { - token = nextToken(); - if (token === 56 /* EqualsToken */) { - if (tryConsumeRequireCall(/*skipCurrentToken*/ true)) { - return true; - } - } - } - } - return true; - } - return false; - } - function tryConsumeRequireCall(skipCurrentToken) { - var token = skipCurrentToken ? nextToken() : scanner.getToken(); - if (token === 129 /* RequireKeyword */) { - token = nextToken(); - if (token === 17 /* OpenParenToken */) { - token = nextToken(); - if (token === 9 /* StringLiteral */) { - // require("mod"); - recordModuleName(); - } - } - return true; - } - return false; - } - function tryConsumeDefine() { - var token = scanner.getToken(); - if (token === 69 /* Identifier */ && scanner.getTokenValue() === "define") { - token = nextToken(); - if (token !== 17 /* OpenParenToken */) { - return true; - } - token = nextToken(); - if (token === 9 /* StringLiteral */) { - // looks like define ("modname", ... - skip string literal and comma - token = nextToken(); - if (token === 24 /* CommaToken */) { - token = nextToken(); - } - else { - // unexpected token - return true; - } - } - // should be start of dependency list - if (token !== 19 /* OpenBracketToken */) { - return true; - } - // skip open bracket - token = nextToken(); - var i = 0; - // scan until ']' or EOF - while (token !== 20 /* CloseBracketToken */ && token !== 1 /* EndOfFileToken */) { - // record string literals as module names - if (token === 9 /* StringLiteral */) { - recordModuleName(); - i++; - } - token = nextToken(); - } - return true; - } - return false; - } - function processImports() { - scanner.setText(sourceText); - nextToken(); - // Look for: - // import "mod"; - // import d from "mod" - // import {a as A } from "mod"; - // import * as NS from "mod" - // import d, {a, b as B} from "mod" - // import i = require("mod"); - // - // export * from "mod" - // export {a as b} from "mod" - // export import i = require("mod") - // (for JavaScript files) require("mod") - while (true) { - if (scanner.getToken() === 1 /* EndOfFileToken */) { - break; - } - // check if at least one of alternative have moved scanner forward - if (tryConsumeDeclare() || - tryConsumeImport() || - tryConsumeExport() || - (detectJavaScriptImports && (tryConsumeRequireCall(/*skipCurrentToken*/ false) || tryConsumeDefine()))) { - continue; - } - else { - nextToken(); - } - } - scanner.setText(undefined); - } - if (readImportFiles) { - processImports(); - } - processTripleSlashDirectives(); - if (externalModule) { - // for external modules module all nested ambient modules are augmentations - if (ambientExternalModules) { - // move all detected ambient modules to imported files since they need to be resolved - for (var _i = 0, ambientExternalModules_1 = ambientExternalModules; _i < ambientExternalModules_1.length; _i++) { - var decl = ambientExternalModules_1[_i]; - importedFiles.push(decl.ref); - } - } - return { referencedFiles: referencedFiles, typeReferenceDirectives: typeReferenceDirectives, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: undefined }; - } - else { - // for global scripts ambient modules still can have augmentations - look for ambient modules with depth > 0 - var ambientModuleNames = void 0; - if (ambientExternalModules) { - for (var _a = 0, ambientExternalModules_2 = ambientExternalModules; _a < ambientExternalModules_2.length; _a++) { - var decl = ambientExternalModules_2[_a]; - if (decl.depth === 0) { - if (!ambientModuleNames) { - ambientModuleNames = []; - } - ambientModuleNames.push(decl.ref.fileName); - } - else { - importedFiles.push(decl.ref); - } - } - } - return { referencedFiles: referencedFiles, typeReferenceDirectives: typeReferenceDirectives, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: ambientModuleNames }; - } - } - ts.preProcessFile = preProcessFile; - /// Helpers - function getTargetLabel(referenceNode, labelName) { - while (referenceNode) { - if (referenceNode.kind === 214 /* LabeledStatement */ && referenceNode.label.text === labelName) { - return referenceNode.label; - } - referenceNode = referenceNode.parent; - } - return undefined; - } - function isJumpStatementTarget(node) { - return node.kind === 69 /* Identifier */ && - (node.parent.kind === 210 /* BreakStatement */ || node.parent.kind === 209 /* ContinueStatement */) && - node.parent.label === node; - } - function isLabelOfLabeledStatement(node) { - return node.kind === 69 /* Identifier */ && - node.parent.kind === 214 /* LabeledStatement */ && - node.parent.label === node; - } - /** - * Whether or not a 'node' is preceded by a label of the given string. - * Note: 'node' cannot be a SourceFile. - */ - function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 214 /* LabeledStatement */; owner = owner.parent) { - if (owner.label.text === labelName) { - return true; - } - } - return false; - } - function isLabelName(node) { - return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node); - } - function isRightSideOfQualifiedName(node) { - return node.parent.kind === 139 /* QualifiedName */ && node.parent.right === node; - } - function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 172 /* PropertyAccessExpression */ && node.parent.name === node; - } - function isCallExpressionTarget(node) { - if (isRightSideOfPropertyAccess(node)) { - node = node.parent; - } - return node && node.parent && node.parent.kind === 174 /* CallExpression */ && node.parent.expression === node; - } - function isNewExpressionTarget(node) { - if (isRightSideOfPropertyAccess(node)) { - node = node.parent; - } - return node && node.parent && node.parent.kind === 175 /* NewExpression */ && node.parent.expression === node; - } - function isNameOfModuleDeclaration(node) { - return node.parent.kind === 225 /* ModuleDeclaration */ && node.parent.name === node; - } - function isNameOfFunctionDeclaration(node) { - return node.kind === 69 /* Identifier */ && - ts.isFunctionLike(node.parent) && node.parent.name === node; - } - function isObjectLiteralPropertyDeclaration(node) { - switch (node.kind) { - case 253 /* PropertyAssignment */: - case 254 /* ShorthandPropertyAssignment */: - case 147 /* MethodDeclaration */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - return true; - } - return false; - } - /** - * Returns the containing object literal property declaration given a possible name node, e.g. "a" in x = { "a": 1 } - */ - function getContainingObjectLiteralElement(node) { - switch (node.kind) { - case 9 /* StringLiteral */: - case 8 /* NumericLiteral */: - if (node.parent.kind === 140 /* ComputedPropertyName */) { - return isObjectLiteralPropertyDeclaration(node.parent.parent) ? node.parent.parent : undefined; - } - // intential fall through - case 69 /* Identifier */: - return isObjectLiteralPropertyDeclaration(node.parent) && node.parent.name === node ? node.parent : undefined; - } - return undefined; - } - function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { - if (node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) { - switch (node.parent.kind) { - case 145 /* PropertyDeclaration */: - case 144 /* PropertySignature */: - case 253 /* PropertyAssignment */: - case 255 /* EnumMember */: - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - case 225 /* ModuleDeclaration */: - return node.parent.name === node; - case 173 /* ElementAccessExpression */: - return node.parent.argumentExpression === node; - case 140 /* ComputedPropertyName */: - return true; - } - } - return false; - } - function isNameOfExternalModuleImportOrDeclaration(node) { - if (node.kind === 9 /* StringLiteral */) { - return isNameOfModuleDeclaration(node) || - (ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node); - } - return false; - } - /** Returns true if the position is within a comment */ - function isInsideComment(sourceFile, token, position) { - // The position has to be: 1. in the leading trivia (before token.getStart()), and 2. within a comment - return position <= token.getStart(sourceFile) && - (isInsideCommentRange(ts.getTrailingCommentRanges(sourceFile.text, token.getFullStart())) || - isInsideCommentRange(ts.getLeadingCommentRanges(sourceFile.text, token.getFullStart()))); - function isInsideCommentRange(comments) { - return ts.forEach(comments, function (comment) { - // either we are 1. completely inside the comment, or 2. at the end of the comment - if (comment.pos < position && position < comment.end) { - return true; - } - else if (position === comment.end) { - var text = sourceFile.text; - var width = comment.end - comment.pos; - // is single line comment or just /* - if (width <= 2 || text.charCodeAt(comment.pos + 1) === 47 /* slash */) { - return true; - } - else { - // is unterminated multi-line comment - return !(text.charCodeAt(comment.end - 1) === 47 /* slash */ && - text.charCodeAt(comment.end - 2) === 42 /* asterisk */); - } - } - return false; - }); - } - } - var SemanticMeaning; - (function (SemanticMeaning) { - SemanticMeaning[SemanticMeaning["None"] = 0] = "None"; - SemanticMeaning[SemanticMeaning["Value"] = 1] = "Value"; - SemanticMeaning[SemanticMeaning["Type"] = 2] = "Type"; - SemanticMeaning[SemanticMeaning["Namespace"] = 4] = "Namespace"; - SemanticMeaning[SemanticMeaning["All"] = 7] = "All"; - })(SemanticMeaning || (SemanticMeaning = {})); - var BreakContinueSearchType; - (function (BreakContinueSearchType) { - BreakContinueSearchType[BreakContinueSearchType["None"] = 0] = "None"; - BreakContinueSearchType[BreakContinueSearchType["Unlabeled"] = 1] = "Unlabeled"; - BreakContinueSearchType[BreakContinueSearchType["Labeled"] = 2] = "Labeled"; - BreakContinueSearchType[BreakContinueSearchType["All"] = 3] = "All"; - })(BreakContinueSearchType || (BreakContinueSearchType = {})); - // A cache of completion entries for keywords, these do not change between sessions - var keywordCompletions = []; - for (var i = 70 /* FirstKeyword */; i <= 138 /* LastKeyword */; i++) { - keywordCompletions.push({ - name: ts.tokenToString(i), - kind: ScriptElementKind.keyword, - kindModifiers: ScriptElementKindModifier.none, - sortText: "0" - }); - } - /* @internal */ function getContainerNode(node) { - while (true) { - node = node.parent; - if (!node) { - return undefined; - } - switch (node.kind) { - case 256 /* SourceFile */: - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - case 220 /* FunctionDeclaration */: - case 179 /* FunctionExpression */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - case 221 /* ClassDeclaration */: - case 222 /* InterfaceDeclaration */: - case 224 /* EnumDeclaration */: - case 225 /* ModuleDeclaration */: - return node; - } - } - } - ts.getContainerNode = getContainerNode; - /* @internal */ function getNodeKind(node) { - switch (node.kind) { - case 256 /* SourceFile */: - return ts.isExternalModule(node) ? ScriptElementKind.moduleElement : ScriptElementKind.scriptElement; - case 225 /* ModuleDeclaration */: - return ScriptElementKind.moduleElement; - case 221 /* ClassDeclaration */: - case 192 /* ClassExpression */: - return ScriptElementKind.classElement; - case 222 /* InterfaceDeclaration */: return ScriptElementKind.interfaceElement; - case 223 /* TypeAliasDeclaration */: return ScriptElementKind.typeElement; - case 224 /* EnumDeclaration */: return ScriptElementKind.enumElement; - case 218 /* VariableDeclaration */: - return getKindOfVariableDeclaration(node); - case 169 /* BindingElement */: - return getKindOfVariableDeclaration(ts.getRootDeclaration(node)); - case 180 /* ArrowFunction */: - case 220 /* FunctionDeclaration */: - case 179 /* FunctionExpression */: - return ScriptElementKind.functionElement; - case 149 /* GetAccessor */: return ScriptElementKind.memberGetAccessorElement; - case 150 /* SetAccessor */: return ScriptElementKind.memberSetAccessorElement; - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - return ScriptElementKind.memberFunctionElement; - case 145 /* PropertyDeclaration */: - case 144 /* PropertySignature */: - return ScriptElementKind.memberVariableElement; - case 153 /* IndexSignature */: return ScriptElementKind.indexSignatureElement; - case 152 /* ConstructSignature */: return ScriptElementKind.constructSignatureElement; - case 151 /* CallSignature */: return ScriptElementKind.callSignatureElement; - case 148 /* Constructor */: return ScriptElementKind.constructorImplementationElement; - case 141 /* TypeParameter */: return ScriptElementKind.typeParameterElement; - case 255 /* EnumMember */: return ScriptElementKind.enumMemberElement; - case 142 /* Parameter */: return (node.flags & 92 /* ParameterPropertyModifier */) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; - case 229 /* ImportEqualsDeclaration */: - case 234 /* ImportSpecifier */: - case 231 /* ImportClause */: - case 238 /* ExportSpecifier */: - case 232 /* NamespaceImport */: - return ScriptElementKind.alias; - case 279 /* JSDocTypedefTag */: - return ScriptElementKind.typeElement; - default: - return ScriptElementKind.unknown; - } - function getKindOfVariableDeclaration(v) { - return ts.isConst(v) - ? ScriptElementKind.constElement - : ts.isLet(v) - ? ScriptElementKind.letElement - : ScriptElementKind.variableElement; - } - } - ts.getNodeKind = getNodeKind; var CancellationTokenObject = (function () { function CancellationTokenObject(cancellationToken) { this.cancellationToken = cancellationToken; @@ -55172,12 +79246,13 @@ var ts; return CancellationTokenObject; }()); function createLanguageService(host, documentRegistry) { - if (documentRegistry === void 0) { documentRegistry = createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); } + if (documentRegistry === void 0) { documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); } var syntaxTreeCache = new SyntaxTreeCache(host); var ruleProvider; var program; var lastProjectVersion; - var useCaseSensitivefileNames = false; + var lastTypesRootVersion = 0; + var useCaseSensitivefileNames = host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(); var cancellationToken = new CancellationTokenObject(host.getCancellationToken && host.getCancellationToken()); var currentDirectory = host.getCurrentDirectory(); // Check if the localized messages json is set, otherwise query the host for it @@ -55216,6 +79291,12 @@ var ts; lastProjectVersion = hostProjectVersion; } } + var typeRootsVersion = host.getTypeRootsVersion ? host.getTypeRootsVersion() : 0; + if (lastTypesRootVersion !== typeRootsVersion) { + log("TypeRoots version has changed; provide new program"); + program = undefined; + lastTypesRootVersion = typeRootsVersion; + } // Get a fresh cache of the host information var hostCache = new HostCache(host, getCanonicalFileName); // If the program is already up-to-date, we can reuse it @@ -55248,7 +79329,7 @@ var ts; useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; }, getNewLine: function () { return ts.getNewLineOrDefaultFromHost(host); }, getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); }, - writeFile: function (fileName, data, writeByteOrderMark) { }, + writeFile: ts.noop, getCurrentDirectory: function () { return currentDirectory; }, fileExists: function (fileName) { // stub missing host functionality @@ -55382,7 +79463,7 @@ var ts; return program; } function cleanupSemanticCache() { - // TODO: Should we jettison the program (or it's type checker) here? + program = undefined; } function dispose() { if (program) { @@ -55417,1519 +79498,17 @@ var ts; synchronizeHostData(); return program.getOptionsDiagnostics(cancellationToken).concat(program.getGlobalDiagnostics(cancellationToken)); } - /** - * Get the name to be display in completion from a given symbol. - * - * @return undefined if the name is of external module otherwise a name with striped of any quote - */ - function getCompletionEntryDisplayNameForSymbol(symbol, target, performCharacterChecks, location) { - var displayName = ts.getDeclaredName(program.getTypeChecker(), symbol, location); - if (displayName) { - var firstCharCode = displayName.charCodeAt(0); - // First check of the displayName is not external module; if it is an external module, it is not valid entry - if ((symbol.flags & 1920 /* Namespace */) && (firstCharCode === 39 /* singleQuote */ || firstCharCode === 34 /* doubleQuote */)) { - // If the symbol is external module, don't show it in the completion list - // (i.e declare module "http" { const x; } | // <= request completion here, "http" should not be there) - return undefined; - } - } - return getCompletionEntryDisplayName(displayName, target, performCharacterChecks); - } - /** - * Get a displayName from a given for completion list, performing any necessary quotes stripping - * and checking whether the name is valid identifier name. - */ - function getCompletionEntryDisplayName(name, target, performCharacterChecks) { - if (!name) { - return undefined; - } - name = ts.stripQuotes(name); - if (!name) { - return undefined; - } - // If the user entered name for the symbol was quoted, removing the quotes is not enough, as the name could be an - // invalid identifier name. We need to check if whatever was inside the quotes is actually a valid identifier name. - // e.g "b a" is valid quoted name but when we strip off the quotes, it is invalid. - // We, thus, need to check if whatever was inside the quotes is actually a valid identifier name. - if (performCharacterChecks) { - if (!ts.isIdentifier(name, target)) { - return undefined; - } - } - return name; - } - function getCompletionData(fileName, position) { - var typeChecker = program.getTypeChecker(); - var sourceFile = getValidSourceFile(fileName); - var isJavaScriptFile = ts.isSourceFileJavaScript(sourceFile); - var isJsDocTagName = false; - var start = ts.timestamp(); - var currentToken = ts.getTokenAtPosition(sourceFile, position); - log("getCompletionData: Get current token: " + (ts.timestamp() - start)); - start = ts.timestamp(); - // Completion not allowed inside comments, bail out if this is the case - var insideComment = isInsideComment(sourceFile, currentToken, position); - log("getCompletionData: Is inside comment: " + (ts.timestamp() - start)); - if (insideComment) { - // The current position is next to the '@' sign, when no tag name being provided yet. - // Provide a full list of tag names - if (ts.hasDocComment(sourceFile, position) && sourceFile.text.charCodeAt(position - 1) === 64 /* at */) { - isJsDocTagName = true; - } - // Completion should work inside certain JsDoc tags. For example: - // /** @type {number | string} */ - // Completion should work in the brackets - var insideJsDocTagExpression = false; - var tag = ts.getJsDocTagAtPosition(sourceFile, position); - if (tag) { - if (tag.tagName.pos <= position && position <= tag.tagName.end) { - isJsDocTagName = true; - } - switch (tag.kind) { - case 277 /* JSDocTypeTag */: - case 275 /* JSDocParameterTag */: - case 276 /* JSDocReturnTag */: - var tagWithExpression = tag; - if (tagWithExpression.typeExpression) { - insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end; - } - break; - } - } - if (isJsDocTagName) { - return { symbols: undefined, isMemberCompletion: false, isNewIdentifierLocation: false, location: undefined, isRightOfDot: false, isJsDocTagName: isJsDocTagName }; - } - if (!insideJsDocTagExpression) { - // Proceed if the current position is in jsDoc tag expression; otherwise it is a normal - // comment or the plain text part of a jsDoc comment, so no completion should be available - log("Returning an empty list because completion was inside a regular comment or plain text part of a JsDoc comment."); - return undefined; - } - } - start = ts.timestamp(); - var previousToken = ts.findPrecedingToken(position, sourceFile); - log("getCompletionData: Get previous token 1: " + (ts.timestamp() - start)); - // The decision to provide completion depends on the contextToken, which is determined through the previousToken. - // Note: 'previousToken' (and thus 'contextToken') can be undefined if we are the beginning of the file - var contextToken = previousToken; - // Check if the caret is at the end of an identifier; this is a partial identifier that we want to complete: e.g. a.toS| - // Skip this partial identifier and adjust the contextToken to the token that precedes it. - if (contextToken && position <= contextToken.end && ts.isWord(contextToken.kind)) { - var start_2 = ts.timestamp(); - contextToken = ts.findPrecedingToken(contextToken.getFullStart(), sourceFile); - log("getCompletionData: Get previous token 2: " + (ts.timestamp() - start_2)); - } - // Find the node where completion is requested on. - // Also determine whether we are trying to complete with members of that node - // or attributes of a JSX tag. - var node = currentToken; - var isRightOfDot = false; - var isRightOfOpenTag = false; - var isStartingCloseTag = false; - var location = ts.getTouchingPropertyName(sourceFile, position); - if (contextToken) { - // Bail out if this is a known invalid completion location - if (isCompletionListBlocker(contextToken)) { - log("Returning an empty list because completion was requested in an invalid position."); - return undefined; - } - var parent_18 = contextToken.parent, kind = contextToken.kind; - if (kind === 21 /* DotToken */) { - if (parent_18.kind === 172 /* PropertyAccessExpression */) { - node = contextToken.parent.expression; - isRightOfDot = true; - } - else if (parent_18.kind === 139 /* QualifiedName */) { - node = contextToken.parent.left; - isRightOfDot = true; - } - else { - // There is nothing that precedes the dot, so this likely just a stray character - // or leading into a '...' token. Just bail out instead. - return undefined; - } - } - else if (sourceFile.languageVariant === 1 /* JSX */) { - if (kind === 25 /* LessThanToken */) { - isRightOfOpenTag = true; - location = contextToken; - } - else if (kind === 39 /* SlashToken */ && contextToken.parent.kind === 245 /* JsxClosingElement */) { - isStartingCloseTag = true; - location = contextToken; - } - } - } - var semanticStart = ts.timestamp(); - var isMemberCompletion; - var isNewIdentifierLocation; - var symbols = []; - if (isRightOfDot) { - getTypeScriptMemberSymbols(); - } - else if (isRightOfOpenTag) { - var tagSymbols = typeChecker.getJsxIntrinsicTagNames(); - if (tryGetGlobalSymbols()) { - symbols = tagSymbols.concat(symbols.filter(function (s) { return !!(s.flags & (107455 /* Value */ | 8388608 /* Alias */)); })); - } - else { - symbols = tagSymbols; - } - isMemberCompletion = true; - isNewIdentifierLocation = false; - } - else if (isStartingCloseTag) { - var tagName = contextToken.parent.parent.openingElement.tagName; - var tagSymbol = typeChecker.getSymbolAtLocation(tagName); - if (!typeChecker.isUnknownSymbol(tagSymbol)) { - symbols = [tagSymbol]; - } - isMemberCompletion = true; - isNewIdentifierLocation = false; - } - else { - // For JavaScript or TypeScript, if we're not after a dot, then just try to get the - // global symbols in scope. These results should be valid for either language as - // the set of symbols that can be referenced from this location. - if (!tryGetGlobalSymbols()) { - return undefined; - } - } - log("getCompletionData: Semantic work: " + (ts.timestamp() - semanticStart)); - return { symbols: symbols, isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, location: location, isRightOfDot: (isRightOfDot || isRightOfOpenTag), isJsDocTagName: isJsDocTagName }; - function getTypeScriptMemberSymbols() { - // Right of dot member completion list - isMemberCompletion = true; - isNewIdentifierLocation = false; - if (node.kind === 69 /* Identifier */ || node.kind === 139 /* QualifiedName */ || node.kind === 172 /* PropertyAccessExpression */) { - var symbol = typeChecker.getSymbolAtLocation(node); - // This is an alias, follow what it aliases - if (symbol && symbol.flags & 8388608 /* Alias */) { - symbol = typeChecker.getAliasedSymbol(symbol); - } - if (symbol && symbol.flags & 1952 /* HasExports */) { - // Extract module or enum members - var exportedSymbols = typeChecker.getExportsOfModule(symbol); - ts.forEach(exportedSymbols, function (symbol) { - if (typeChecker.isValidPropertyAccess((node.parent), symbol.name)) { - symbols.push(symbol); - } - }); - } - } - var type = typeChecker.getTypeAtLocation(node); - addTypeProperties(type); - } - function addTypeProperties(type) { - if (type) { - // Filter private properties - for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) { - var symbol = _a[_i]; - if (typeChecker.isValidPropertyAccess((node.parent), symbol.name)) { - symbols.push(symbol); - } - } - if (isJavaScriptFile && type.flags & 524288 /* Union */) { - // In javascript files, for union types, we don't just get the members that - // the individual types have in common, we also include all the members that - // each individual type has. This is because we're going to add all identifiers - // anyways. So we might as well elevate the members that were at least part - // of the individual types to a higher status since we know what they are. - var unionType = type; - for (var _b = 0, _c = unionType.types; _b < _c.length; _b++) { - var elementType = _c[_b]; - addTypeProperties(elementType); - } - } - } - } - function tryGetGlobalSymbols() { - var objectLikeContainer; - var namedImportsOrExports; - var jsxContainer; - if (objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken)) { - return tryGetObjectLikeCompletionSymbols(objectLikeContainer); - } - if (namedImportsOrExports = tryGetNamedImportsOrExportsForCompletion(contextToken)) { - // cursor is in an import clause - // try to show exported member for imported module - return tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports); - } - if (jsxContainer = tryGetContainingJsxElement(contextToken)) { - var attrsType = void 0; - if ((jsxContainer.kind === 242 /* JsxSelfClosingElement */) || (jsxContainer.kind === 243 /* JsxOpeningElement */)) { - // Cursor is inside a JSX self-closing element or opening element - attrsType = typeChecker.getJsxElementAttributesType(jsxContainer); - if (attrsType) { - symbols = filterJsxAttributes(typeChecker.getPropertiesOfType(attrsType), jsxContainer.attributes); - isMemberCompletion = true; - isNewIdentifierLocation = false; - return true; - } - } - } - // Get all entities in the current scope. - isMemberCompletion = false; - isNewIdentifierLocation = isNewIdentifierDefinitionLocation(contextToken); - if (previousToken !== contextToken) { - ts.Debug.assert(!!previousToken, "Expected 'contextToken' to be defined when different from 'previousToken'."); - } - // We need to find the node that will give us an appropriate scope to begin - // aggregating completion candidates. This is achieved in 'getScopeNode' - // by finding the first node that encompasses a position, accounting for whether a node - // is "complete" to decide whether a position belongs to the node. - // - // However, at the end of an identifier, we are interested in the scope of the identifier - // itself, but fall outside of the identifier. For instance: - // - // xyz => x$ - // - // the cursor is outside of both the 'x' and the arrow function 'xyz => x', - // so 'xyz' is not returned in our results. - // - // We define 'adjustedPosition' so that we may appropriately account for - // being at the end of an identifier. The intention is that if requesting completion - // at the end of an identifier, it should be effectively equivalent to requesting completion - // anywhere inside/at the beginning of the identifier. So in the previous case, the - // 'adjustedPosition' will work as if requesting completion in the following: - // - // xyz => $x - // - // If previousToken !== contextToken, then - // - 'contextToken' was adjusted to the token prior to 'previousToken' - // because we were at the end of an identifier. - // - 'previousToken' is defined. - var adjustedPosition = previousToken !== contextToken ? - previousToken.getStart() : - position; - var scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile; - /// TODO filter meaning based on the current context - var symbolMeanings = 793064 /* Type */ | 107455 /* Value */ | 1920 /* Namespace */ | 8388608 /* Alias */; - symbols = typeChecker.getSymbolsInScope(scopeNode, symbolMeanings); - return true; - } - /** - * Finds the first node that "embraces" the position, so that one may - * accurately aggregate locals from the closest containing scope. - */ - function getScopeNode(initialToken, position, sourceFile) { - var scope = initialToken; - while (scope && !ts.positionBelongsToNode(scope, position, sourceFile)) { - scope = scope.parent; - } - return scope; - } - function isCompletionListBlocker(contextToken) { - var start = ts.timestamp(); - var result = isInStringOrRegularExpressionOrTemplateLiteral(contextToken) || - isSolelyIdentifierDefinitionLocation(contextToken) || - isDotOfNumericLiteral(contextToken) || - isInJsxText(contextToken); - log("getCompletionsAtPosition: isCompletionListBlocker: " + (ts.timestamp() - start)); - return result; - } - function isInJsxText(contextToken) { - if (contextToken.kind === 244 /* JsxText */) { - return true; - } - if (contextToken.kind === 27 /* GreaterThanToken */ && contextToken.parent) { - if (contextToken.parent.kind === 243 /* JsxOpeningElement */) { - return true; - } - if (contextToken.parent.kind === 245 /* JsxClosingElement */ || contextToken.parent.kind === 242 /* JsxSelfClosingElement */) { - return contextToken.parent.parent && contextToken.parent.parent.kind === 241 /* JsxElement */; - } - } - return false; - } - function isNewIdentifierDefinitionLocation(previousToken) { - if (previousToken) { - var containingNodeKind = previousToken.parent.kind; - switch (previousToken.kind) { - case 24 /* CommaToken */: - return containingNodeKind === 174 /* CallExpression */ // func( a, | - || containingNodeKind === 148 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ - || containingNodeKind === 175 /* NewExpression */ // new C(a, | - || containingNodeKind === 170 /* ArrayLiteralExpression */ // [a, | - || containingNodeKind === 187 /* BinaryExpression */ // const x = (a, | - || containingNodeKind === 156 /* FunctionType */; // var x: (s: string, list| - case 17 /* OpenParenToken */: - return containingNodeKind === 174 /* CallExpression */ // func( | - || containingNodeKind === 148 /* Constructor */ // constructor( | - || containingNodeKind === 175 /* NewExpression */ // new C(a| - || containingNodeKind === 178 /* ParenthesizedExpression */ // const x = (a| - || containingNodeKind === 164 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ - case 19 /* OpenBracketToken */: - return containingNodeKind === 170 /* ArrayLiteralExpression */ // [ | - || containingNodeKind === 153 /* IndexSignature */ // [ | : string ] - || containingNodeKind === 140 /* ComputedPropertyName */; // [ | /* this can become an index signature */ - case 125 /* ModuleKeyword */: // module | - case 126 /* NamespaceKeyword */: - return true; - case 21 /* DotToken */: - return containingNodeKind === 225 /* ModuleDeclaration */; // module A.| - case 15 /* OpenBraceToken */: - return containingNodeKind === 221 /* ClassDeclaration */; // class A{ | - case 56 /* EqualsToken */: - return containingNodeKind === 218 /* VariableDeclaration */ // const x = a| - || containingNodeKind === 187 /* BinaryExpression */; // x = a| - case 12 /* TemplateHead */: - return containingNodeKind === 189 /* TemplateExpression */; // `aa ${| - case 13 /* TemplateMiddle */: - return containingNodeKind === 197 /* TemplateSpan */; // `aa ${10} dd ${| - case 112 /* PublicKeyword */: - case 110 /* PrivateKeyword */: - case 111 /* ProtectedKeyword */: - return containingNodeKind === 145 /* PropertyDeclaration */; // class A{ public | - } - // Previous token may have been a keyword that was converted to an identifier. - switch (previousToken.getText()) { - case "public": - case "protected": - case "private": - return true; - } - } - return false; - } - function isInStringOrRegularExpressionOrTemplateLiteral(contextToken) { - if (contextToken.kind === 9 /* StringLiteral */ - || contextToken.kind === 10 /* RegularExpressionLiteral */ - || ts.isTemplateLiteralKind(contextToken.kind)) { - var start_3 = contextToken.getStart(); - var end = contextToken.getEnd(); - // To be "in" one of these literals, the position has to be: - // 1. entirely within the token text. - // 2. at the end position of an unterminated token. - // 3. at the end of a regular expression (due to trailing flags like '/foo/g'). - if (start_3 < position && position < end) { - return true; - } - if (position === end) { - return !!contextToken.isUnterminated - || contextToken.kind === 10 /* RegularExpressionLiteral */; - } - } - return false; - } - /** - * Aggregates relevant symbols for completion in object literals and object binding patterns. - * Relevant symbols are stored in the captured 'symbols' variable. - * - * @returns true if 'symbols' was successfully populated; false otherwise. - */ - function tryGetObjectLikeCompletionSymbols(objectLikeContainer) { - // We're looking up possible property names from contextual/inferred/declared type. - isMemberCompletion = true; - var typeForObject; - var existingMembers; - if (objectLikeContainer.kind === 171 /* ObjectLiteralExpression */) { - // We are completing on contextual types, but may also include properties - // other than those within the declared type. - isNewIdentifierLocation = true; - // If the object literal is being assigned to something of type 'null | { hello: string }', - // it clearly isn't trying to satisfy the 'null' type. So we grab the non-nullable type if possible. - typeForObject = typeChecker.getContextualType(objectLikeContainer); - typeForObject = typeForObject && typeForObject.getNonNullableType(); - existingMembers = objectLikeContainer.properties; - } - else if (objectLikeContainer.kind === 167 /* ObjectBindingPattern */) { - // We are *only* completing on properties from the type being destructured. - isNewIdentifierLocation = false; - var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); - if (ts.isVariableLike(rootDeclaration)) { - // We don't want to complete using the type acquired by the shape - // of the binding pattern; we are only interested in types acquired - // through type declaration or inference. - // Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed - - // type of parameter will flow in from the contextual type of the function - var canGetType = !!(rootDeclaration.initializer || rootDeclaration.type); - if (!canGetType && rootDeclaration.kind === 142 /* Parameter */) { - if (ts.isExpression(rootDeclaration.parent)) { - canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); - } - else if (rootDeclaration.parent.kind === 147 /* MethodDeclaration */ || rootDeclaration.parent.kind === 150 /* SetAccessor */) { - canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent); - } - } - if (canGetType) { - typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer); - existingMembers = objectLikeContainer.elements; - } - } - else { - ts.Debug.fail("Root declaration is not variable-like."); - } - } - else { - ts.Debug.fail("Expected object literal or binding pattern, got " + objectLikeContainer.kind); - } - if (!typeForObject) { - return false; - } - var typeMembers = typeChecker.getPropertiesOfType(typeForObject); - if (typeMembers && typeMembers.length > 0) { - // Add filtered items to the completion list - symbols = filterObjectMembersList(typeMembers, existingMembers); - } - return true; - } - /** - * Aggregates relevant symbols for completion in import clauses and export clauses - * whose declarations have a module specifier; for instance, symbols will be aggregated for - * - * import { | } from "moduleName"; - * export { a as foo, | } from "moduleName"; - * - * but not for - * - * export { | }; - * - * Relevant symbols are stored in the captured 'symbols' variable. - * - * @returns true if 'symbols' was successfully populated; false otherwise. - */ - function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) { - var declarationKind = namedImportsOrExports.kind === 233 /* NamedImports */ ? - 230 /* ImportDeclaration */ : - 236 /* ExportDeclaration */; - var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind); - var moduleSpecifier = importOrExportDeclaration.moduleSpecifier; - if (!moduleSpecifier) { - return false; - } - isMemberCompletion = true; - isNewIdentifierLocation = false; - var exports; - var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(importOrExportDeclaration.moduleSpecifier); - if (moduleSpecifierSymbol) { - exports = typeChecker.getExportsOfModule(moduleSpecifierSymbol); - } - symbols = exports ? filterNamedImportOrExportCompletionItems(exports, namedImportsOrExports.elements) : emptyArray; - return true; - } - /** - * Returns the immediate owning object literal or binding pattern of a context token, - * on the condition that one exists and that the context implies completion should be given. - */ - function tryGetObjectLikeCompletionContainer(contextToken) { - if (contextToken) { - switch (contextToken.kind) { - case 15 /* OpenBraceToken */: // const x = { | - case 24 /* CommaToken */: - var parent_19 = contextToken.parent; - if (parent_19 && (parent_19.kind === 171 /* ObjectLiteralExpression */ || parent_19.kind === 167 /* ObjectBindingPattern */)) { - return parent_19; - } - break; - } - } - return undefined; - } - /** - * Returns the containing list of named imports or exports of a context token, - * on the condition that one exists and that the context implies completion should be given. - */ - function tryGetNamedImportsOrExportsForCompletion(contextToken) { - if (contextToken) { - switch (contextToken.kind) { - case 15 /* OpenBraceToken */: // import { | - case 24 /* CommaToken */: - switch (contextToken.parent.kind) { - case 233 /* NamedImports */: - case 237 /* NamedExports */: - return contextToken.parent; - } - } - } - return undefined; - } - function tryGetContainingJsxElement(contextToken) { - if (contextToken) { - var parent_20 = contextToken.parent; - switch (contextToken.kind) { - case 26 /* LessThanSlashToken */: - case 39 /* SlashToken */: - case 69 /* Identifier */: - case 246 /* JsxAttribute */: - case 247 /* JsxSpreadAttribute */: - if (parent_20 && (parent_20.kind === 242 /* JsxSelfClosingElement */ || parent_20.kind === 243 /* JsxOpeningElement */)) { - return parent_20; - } - else if (parent_20.kind === 246 /* JsxAttribute */) { - return parent_20.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_20 && ((parent_20.kind === 246 /* JsxAttribute */) || (parent_20.kind === 247 /* JsxSpreadAttribute */))) { - return parent_20.parent; - } - break; - case 16 /* CloseBraceToken */: - if (parent_20 && - parent_20.kind === 248 /* JsxExpression */ && - parent_20.parent && - (parent_20.parent.kind === 246 /* JsxAttribute */)) { - return parent_20.parent.parent; - } - if (parent_20 && parent_20.kind === 247 /* JsxSpreadAttribute */) { - return parent_20.parent; - } - break; - } - } - return undefined; - } - function isFunction(kind) { - switch (kind) { - case 179 /* FunctionExpression */: - case 180 /* ArrowFunction */: - case 220 /* FunctionDeclaration */: - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - case 151 /* CallSignature */: - case 152 /* ConstructSignature */: - case 153 /* IndexSignature */: - return true; - } - return false; - } - /** - * @returns true if we are certain that the currently edited location must define a new location; false otherwise. - */ - function isSolelyIdentifierDefinitionLocation(contextToken) { - var containingNodeKind = contextToken.parent.kind; - switch (contextToken.kind) { - case 24 /* CommaToken */: - return containingNodeKind === 218 /* VariableDeclaration */ || - containingNodeKind === 219 /* VariableDeclarationList */ || - containingNodeKind === 200 /* VariableStatement */ || - containingNodeKind === 224 /* EnumDeclaration */ || - isFunction(containingNodeKind) || - containingNodeKind === 221 /* ClassDeclaration */ || - containingNodeKind === 192 /* ClassExpression */ || - containingNodeKind === 222 /* InterfaceDeclaration */ || - containingNodeKind === 168 /* ArrayBindingPattern */ || - containingNodeKind === 223 /* TypeAliasDeclaration */; // type Map, K, | - case 21 /* DotToken */: - return containingNodeKind === 168 /* ArrayBindingPattern */; // var [.| - case 54 /* ColonToken */: - return containingNodeKind === 169 /* BindingElement */; // var {x :html| - case 19 /* OpenBracketToken */: - return containingNodeKind === 168 /* ArrayBindingPattern */; // var [x| - case 17 /* OpenParenToken */: - return containingNodeKind === 252 /* CatchClause */ || - isFunction(containingNodeKind); - case 15 /* OpenBraceToken */: - return containingNodeKind === 224 /* EnumDeclaration */ || - containingNodeKind === 222 /* InterfaceDeclaration */ || - containingNodeKind === 159 /* TypeLiteral */; // const x : { | - case 23 /* SemicolonToken */: - return containingNodeKind === 144 /* PropertySignature */ && - contextToken.parent && contextToken.parent.parent && - (contextToken.parent.parent.kind === 222 /* InterfaceDeclaration */ || - contextToken.parent.parent.kind === 159 /* TypeLiteral */); // const x : { a; | - case 25 /* LessThanToken */: - return containingNodeKind === 221 /* ClassDeclaration */ || - containingNodeKind === 192 /* ClassExpression */ || - containingNodeKind === 222 /* InterfaceDeclaration */ || - containingNodeKind === 223 /* TypeAliasDeclaration */ || - isFunction(containingNodeKind); - case 113 /* StaticKeyword */: - return containingNodeKind === 145 /* PropertyDeclaration */; - case 22 /* DotDotDotToken */: - return containingNodeKind === 142 /* Parameter */ || - (contextToken.parent && contextToken.parent.parent && - contextToken.parent.parent.kind === 168 /* ArrayBindingPattern */); // var [...z| - case 112 /* PublicKeyword */: - case 110 /* PrivateKeyword */: - case 111 /* ProtectedKeyword */: - return containingNodeKind === 142 /* Parameter */; - case 116 /* AsKeyword */: - return containingNodeKind === 234 /* ImportSpecifier */ || - containingNodeKind === 238 /* ExportSpecifier */ || - containingNodeKind === 232 /* NamespaceImport */; - case 73 /* ClassKeyword */: - case 81 /* EnumKeyword */: - case 107 /* InterfaceKeyword */: - case 87 /* FunctionKeyword */: - case 102 /* VarKeyword */: - case 123 /* GetKeyword */: - case 131 /* SetKeyword */: - case 89 /* ImportKeyword */: - case 108 /* LetKeyword */: - case 74 /* ConstKeyword */: - case 114 /* YieldKeyword */: - case 134 /* TypeKeyword */: - return true; - } - // Previous token may have been a keyword that was converted to an identifier. - switch (contextToken.getText()) { - case "abstract": - case "async": - case "class": - case "const": - case "declare": - case "enum": - case "function": - case "interface": - case "let": - case "private": - case "protected": - case "public": - case "static": - case "var": - case "yield": - return true; - } - return false; - } - function isDotOfNumericLiteral(contextToken) { - if (contextToken.kind === 8 /* NumericLiteral */) { - var text = contextToken.getFullText(); - return text.charAt(text.length - 1) === "."; - } - return false; - } - /** - * Filters out completion suggestions for named imports or exports. - * - * @param exportsOfModule The list of symbols which a module exposes. - * @param namedImportsOrExports The list of existing import/export specifiers in the import/export clause. - * - * @returns Symbols to be suggested at an import/export clause, barring those whose named imports/exports - * do not occur at the current position and have not otherwise been typed. - */ - function filterNamedImportOrExportCompletionItems(exportsOfModule, namedImportsOrExports) { - var existingImportsOrExports = ts.createMap(); - for (var _i = 0, namedImportsOrExports_1 = namedImportsOrExports; _i < namedImportsOrExports_1.length; _i++) { - var element = namedImportsOrExports_1[_i]; - // If this is the current item we are editing right now, do not filter it out - if (element.getStart() <= position && position <= element.getEnd()) { - continue; - } - var name_41 = element.propertyName || element.name; - existingImportsOrExports[name_41.text] = true; - } - if (!ts.someProperties(existingImportsOrExports)) { - return ts.filter(exportsOfModule, function (e) { return e.name !== "default"; }); - } - return ts.filter(exportsOfModule, function (e) { return e.name !== "default" && !existingImportsOrExports[e.name]; }); - } - /** - * Filters out completion suggestions for named imports or exports. - * - * @returns Symbols to be suggested in an object binding pattern or object literal expression, barring those whose declarations - * do not occur at the current position and have not otherwise been typed. - */ - function filterObjectMembersList(contextualMemberSymbols, existingMembers) { - if (!existingMembers || existingMembers.length === 0) { - return contextualMemberSymbols; - } - var existingMemberNames = ts.createMap(); - for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { - var m = existingMembers_1[_i]; - // Ignore omitted expressions for missing members - if (m.kind !== 253 /* PropertyAssignment */ && - m.kind !== 254 /* ShorthandPropertyAssignment */ && - m.kind !== 169 /* BindingElement */ && - m.kind !== 147 /* MethodDeclaration */) { - continue; - } - // If this is the current item we are editing right now, do not filter it out - if (m.getStart() <= position && position <= m.getEnd()) { - continue; - } - var existingName = void 0; - if (m.kind === 169 /* BindingElement */ && m.propertyName) { - // include only identifiers in completion list - if (m.propertyName.kind === 69 /* Identifier */) { - existingName = m.propertyName.text; - } - } - else { - // TODO(jfreeman): Account for computed property name - // NOTE: if one only performs this step when m.name is an identifier, - // things like '__proto__' are not filtered out. - existingName = m.name.text; - } - existingMemberNames[existingName] = true; - } - return ts.filter(contextualMemberSymbols, function (m) { return !existingMemberNames[m.name]; }); - } - /** - * Filters out completion suggestions from 'symbols' according to existing JSX attributes. - * - * @returns Symbols to be suggested in a JSX element, barring those whose attributes - * do not occur at the current position and have not otherwise been typed. - */ - function filterJsxAttributes(symbols, attributes) { - var seenNames = ts.createMap(); - for (var _i = 0, attributes_1 = attributes; _i < attributes_1.length; _i++) { - var attr = attributes_1[_i]; - // If this is the current item we are editing right now, do not filter it out - if (attr.getStart() <= position && position <= attr.getEnd()) { - continue; - } - if (attr.kind === 246 /* JsxAttribute */) { - seenNames[attr.name.text] = true; - } - } - return ts.filter(symbols, function (a) { return !seenNames[a.name]; }); - } - } function getCompletionsAtPosition(fileName, position) { synchronizeHostData(); - var sourceFile = getValidSourceFile(fileName); - if (ts.isInString(sourceFile, position)) { - return getStringLiteralCompletionEntries(sourceFile, position); - } - var completionData = getCompletionData(fileName, position); - if (!completionData) { - return undefined; - } - var symbols = completionData.symbols, isMemberCompletion = completionData.isMemberCompletion, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, isJsDocTagName = completionData.isJsDocTagName; - if (isJsDocTagName) { - // If the current position is a jsDoc tag name, only tag names should be provided for completion - return { isMemberCompletion: false, isNewIdentifierLocation: false, entries: getAllJsDocCompletionEntries() }; - } - var entries = []; - if (ts.isSourceFileJavaScript(sourceFile)) { - var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, /*performCharacterChecks*/ false); - ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames)); - } - else { - if (!symbols || symbols.length === 0) { - if (sourceFile.languageVariant === 1 /* JSX */ && - location.parent && location.parent.kind === 245 /* JsxClosingElement */) { - // In the TypeScript JSX element, if such element is not defined. When users query for completion at closing tag, - // instead of simply giving unknown value, the completion will return the tag-name of an associated opening-element. - // For example: - // var x =
completion list at "1" will contain "div" with type any - var tagName = location.parent.parent.openingElement.tagName; - entries.push({ - name: tagName.text, - kind: undefined, - kindModifiers: undefined, - sortText: "0" - }); - } - else { - return undefined; - } - } - getCompletionEntriesFromSymbols(symbols, entries, location, /*performCharacterChecks*/ true); - } - // Add keywords if this is not a member completion list - if (!isMemberCompletion && !isJsDocTagName) { - ts.addRange(entries, keywordCompletions); - } - return { isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation || ts.isSourceFileJavaScript(sourceFile), entries: entries }; - function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames) { - var entries = []; - var target = program.getCompilerOptions().target; - var nameTable = getNameTable(sourceFile); - for (var name_42 in nameTable) { - // Skip identifiers produced only from the current location - if (nameTable[name_42] === position) { - continue; - } - if (!uniqueNames[name_42]) { - uniqueNames[name_42] = name_42; - var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name_42), target, /*performCharacterChecks*/ true); - if (displayName) { - var entry = { - name: displayName, - kind: ScriptElementKind.warning, - kindModifiers: "", - sortText: "1" - }; - entries.push(entry); - } - } - } - return entries; - } - function getAllJsDocCompletionEntries() { - return jsDocCompletionEntries || (jsDocCompletionEntries = ts.map(jsDocTagNames, function (tagName) { - return { - name: tagName, - kind: ScriptElementKind.keyword, - kindModifiers: "", - sortText: "0" - }; - })); - } - function createCompletionEntry(symbol, location, performCharacterChecks) { - // Try to get a valid display name for this symbol, if we could not find one, then ignore it. - // We would like to only show things that can be added after a dot, so for instance numeric properties can - // not be accessed with a dot (a.1 <- invalid) - var displayName = getCompletionEntryDisplayNameForSymbol(symbol, program.getCompilerOptions().target, performCharacterChecks, location); - if (!displayName) { - return undefined; - } - // TODO(drosen): Right now we just permit *all* semantic meanings when calling - // 'getSymbolKind' which is permissible given that it is backwards compatible; but - // really we should consider passing the meaning for the node so that we don't report - // that a suggestion for a value is an interface. We COULD also just do what - // 'getSymbolModifiers' does, which is to use the first declaration. - // Use a 'sortText' of 0' so that all symbol completion entries come before any other - // entries (like JavaScript identifier entries). - return { - name: displayName, - kind: getSymbolKind(symbol, location), - kindModifiers: getSymbolModifiers(symbol), - sortText: "0" - }; - } - function getCompletionEntriesFromSymbols(symbols, entries, location, performCharacterChecks) { - var start = ts.timestamp(); - var uniqueNames = ts.createMap(); - if (symbols) { - for (var _i = 0, symbols_4 = symbols; _i < symbols_4.length; _i++) { - var symbol = symbols_4[_i]; - var entry = createCompletionEntry(symbol, location, performCharacterChecks); - if (entry) { - var id = ts.escapeIdentifier(entry.name); - if (!uniqueNames[id]) { - entries.push(entry); - uniqueNames[id] = id; - } - } - } - } - log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (ts.timestamp() - start)); - return uniqueNames; - } - function getStringLiteralCompletionEntries(sourceFile, position) { - var node = ts.findPrecedingToken(position, sourceFile); - if (!node || node.kind !== 9 /* StringLiteral */) { - return undefined; - } - if (node.parent.kind === 253 /* PropertyAssignment */ && node.parent.parent.kind === 171 /* ObjectLiteralExpression */) { - // Get quoted name of properties of the object literal expression - // i.e. interface ConfigFiles { - // 'jspm:dev': string - // } - // let files: ConfigFiles = { - // '/*completion position*/' - // } - // - // function foo(c: ConfigFiles) {} - // foo({ - // '/*completion position*/' - // }); - return getStringLiteralCompletionEntriesFromPropertyAssignment(node.parent); - } - else if (ts.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node) { - // Get all names of properties on the expression - // i.e. interface A { - // 'prop1': string - // } - // let a: A; - // a['/*completion position*/'] - return getStringLiteralCompletionEntriesFromElementAccess(node.parent); - } - else { - var argumentInfo = ts.SignatureHelp.getContainingArgumentInfo(node, position, sourceFile); - if (argumentInfo) { - // Get string literal completions from specialized signatures of the target - // i.e. declare function f(a: 'A'); - // f("/*completion position*/") - return getStringLiteralCompletionEntriesFromCallExpression(argumentInfo, node); - } - // Get completion for string literal from string literal type - // i.e. var x: "hi" | "hello" = "/*completion position*/" - return getStringLiteralCompletionEntriesFromContextualType(node); - } - } - function getStringLiteralCompletionEntriesFromPropertyAssignment(element) { - var typeChecker = program.getTypeChecker(); - var type = typeChecker.getContextualType(element.parent); - var entries = []; - if (type) { - getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, element, /*performCharacterChecks*/ false); - if (entries.length) { - return { isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries }; - } - } - } - function getStringLiteralCompletionEntriesFromCallExpression(argumentInfo, location) { - var typeChecker = program.getTypeChecker(); - var candidates = []; - var entries = []; - typeChecker.getResolvedSignature(argumentInfo.invocation, candidates); - for (var _i = 0, candidates_3 = candidates; _i < candidates_3.length; _i++) { - var candidate = candidates_3[_i]; - if (candidate.parameters.length > argumentInfo.argumentIndex) { - var parameter = candidate.parameters[argumentInfo.argumentIndex]; - addStringLiteralCompletionsFromType(typeChecker.getTypeAtLocation(parameter.valueDeclaration), entries); - } - } - if (entries.length) { - return { isMemberCompletion: false, isNewIdentifierLocation: true, entries: entries }; - } - return undefined; - } - function getStringLiteralCompletionEntriesFromElementAccess(node) { - var typeChecker = program.getTypeChecker(); - var type = typeChecker.getTypeAtLocation(node.expression); - var entries = []; - if (type) { - getCompletionEntriesFromSymbols(type.getApparentProperties(), entries, node, /*performCharacterChecks*/ false); - if (entries.length) { - return { isMemberCompletion: true, isNewIdentifierLocation: true, entries: entries }; - } - } - return undefined; - } - function getStringLiteralCompletionEntriesFromContextualType(node) { - var typeChecker = program.getTypeChecker(); - var type = typeChecker.getContextualType(node); - if (type) { - var entries_2 = []; - addStringLiteralCompletionsFromType(type, entries_2); - if (entries_2.length) { - return { isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries_2 }; - } - } - return undefined; - } - function addStringLiteralCompletionsFromType(type, result) { - if (!type) { - return; - } - if (type.flags & 524288 /* Union */) { - ts.forEach(type.types, function (t) { return addStringLiteralCompletionsFromType(t, result); }); - } - else { - if (type.flags & 32 /* StringLiteral */) { - result.push({ - name: type.text, - kindModifiers: ScriptElementKindModifier.none, - kind: ScriptElementKind.variableElement, - sortText: "0" - }); - } - } - } + return ts.Completions.getCompletionsAtPosition(host, program.getTypeChecker(), log, program.getCompilerOptions(), getValidSourceFile(fileName), position); } function getCompletionEntryDetails(fileName, position, entryName) { synchronizeHostData(); - // Compute all the completion symbols again. - var completionData = getCompletionData(fileName, position); - if (completionData) { - var symbols = completionData.symbols, location_2 = completionData.location; - // Find the symbol with the matching entry name. - var target_2 = program.getCompilerOptions().target; - // 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(s, target_2, /*performCharacterChecks*/ false, location_2) === entryName ? s : undefined; }); - if (symbol) { - var _a = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, getValidSourceFile(fileName), location_2, location_2, 7 /* All */), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind; - return { - name: entryName, - kindModifiers: getSymbolModifiers(symbol), - kind: symbolKind, - displayParts: displayParts, - documentation: documentation - }; - } - } - // Didn't find a symbol with this name. See if we can find a keyword instead. - var keywordCompletion = ts.forEach(keywordCompletions, function (c) { return c.name === entryName; }); - if (keywordCompletion) { - return { - name: entryName, - kind: ScriptElementKind.keyword, - kindModifiers: ScriptElementKindModifier.none, - displayParts: [ts.displayPart(entryName, SymbolDisplayPartKind.keyword)], - documentation: undefined - }; - } - return undefined; + return ts.Completions.getCompletionEntryDetails(program.getTypeChecker(), log, program.getCompilerOptions(), getValidSourceFile(fileName), position, entryName); } - // TODO(drosen): use contextual SemanticMeaning. - function getSymbolKind(symbol, location) { - var flags = symbol.getFlags(); - if (flags & 32 /* Class */) - return ts.getDeclarationOfKind(symbol, 192 /* ClassExpression */) ? - ScriptElementKind.localClassElement : ScriptElementKind.classElement; - if (flags & 384 /* Enum */) - return ScriptElementKind.enumElement; - if (flags & 524288 /* TypeAlias */) - return ScriptElementKind.typeElement; - if (flags & 64 /* Interface */) - return ScriptElementKind.interfaceElement; - if (flags & 262144 /* TypeParameter */) - return ScriptElementKind.typeParameterElement; - var result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, flags, location); - if (result === ScriptElementKind.unknown) { - if (flags & 262144 /* TypeParameter */) - return ScriptElementKind.typeParameterElement; - if (flags & 8 /* EnumMember */) - return ScriptElementKind.variableElement; - if (flags & 8388608 /* Alias */) - return ScriptElementKind.alias; - if (flags & 1536 /* Module */) - return ScriptElementKind.moduleElement; - } - return result; - } - function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, flags, location) { - var typeChecker = program.getTypeChecker(); - if (typeChecker.isUndefinedSymbol(symbol)) { - return ScriptElementKind.variableElement; - } - if (typeChecker.isArgumentsSymbol(symbol)) { - return ScriptElementKind.localVariableElement; - } - if (location.kind === 97 /* ThisKeyword */ && ts.isExpression(location)) { - return ScriptElementKind.parameterElement; - } - if (flags & 3 /* Variable */) { - if (ts.isFirstDeclarationOfSymbolParameter(symbol)) { - return ScriptElementKind.parameterElement; - } - else if (symbol.valueDeclaration && ts.isConst(symbol.valueDeclaration)) { - return ScriptElementKind.constElement; - } - else if (ts.forEach(symbol.declarations, ts.isLet)) { - return ScriptElementKind.letElement; - } - return isLocalVariableOrFunction(symbol) ? ScriptElementKind.localVariableElement : ScriptElementKind.variableElement; - } - if (flags & 16 /* Function */) - return isLocalVariableOrFunction(symbol) ? ScriptElementKind.localFunctionElement : ScriptElementKind.functionElement; - if (flags & 32768 /* GetAccessor */) - return ScriptElementKind.memberGetAccessorElement; - if (flags & 65536 /* SetAccessor */) - return ScriptElementKind.memberSetAccessorElement; - if (flags & 8192 /* Method */) - return ScriptElementKind.memberFunctionElement; - if (flags & 16384 /* Constructor */) - return ScriptElementKind.constructorImplementationElement; - if (flags & 4 /* Property */) { - if (flags & 268435456 /* SyntheticProperty */) { - // If union property is result of union of non method (property/accessors/variables), it is labeled as property - var unionPropertyKind = ts.forEach(typeChecker.getRootSymbols(symbol), function (rootSymbol) { - var rootSymbolFlags = rootSymbol.getFlags(); - if (rootSymbolFlags & (98308 /* PropertyOrAccessor */ | 3 /* Variable */)) { - return ScriptElementKind.memberVariableElement; - } - ts.Debug.assert(!!(rootSymbolFlags & 8192 /* Method */)); - }); - if (!unionPropertyKind) { - // If this was union of all methods, - // make sure it has call signatures before we can label it as method - var typeOfUnionProperty = typeChecker.getTypeOfSymbolAtLocation(symbol, location); - if (typeOfUnionProperty.getCallSignatures().length) { - return ScriptElementKind.memberFunctionElement; - } - return ScriptElementKind.memberVariableElement; - } - return unionPropertyKind; - } - return ScriptElementKind.memberVariableElement; - } - return ScriptElementKind.unknown; - } - function getSymbolModifiers(symbol) { - return symbol && symbol.declarations && symbol.declarations.length > 0 - ? ts.getNodeModifiers(symbol.declarations[0]) - : ScriptElementKindModifier.none; - } - // TODO(drosen): Currently completion entry details passes the SemanticMeaning.All instead of using semanticMeaning of location - function getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, sourceFile, enclosingDeclaration, location, semanticMeaning) { - if (semanticMeaning === void 0) { semanticMeaning = getMeaningFromLocation(location); } - var typeChecker = program.getTypeChecker(); - var displayParts = []; - var documentation; - var symbolFlags = symbol.flags; - var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, symbolFlags, location); - var hasAddedSymbolInfo; - var isThisExpression = location.kind === 97 /* ThisKeyword */ && ts.isExpression(location); - var type; - // Class at constructor site need to be shown as constructor apart from property,method, vars - if (symbolKind !== ScriptElementKind.unknown || symbolFlags & 32 /* Class */ || symbolFlags & 8388608 /* Alias */) { - // If it is accessor they are allowed only if location is at name of the accessor - if (symbolKind === ScriptElementKind.memberGetAccessorElement || symbolKind === ScriptElementKind.memberSetAccessorElement) { - symbolKind = ScriptElementKind.memberVariableElement; - } - var signature = void 0; - type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location); - if (type) { - if (location.parent && location.parent.kind === 172 /* PropertyAccessExpression */) { - var right = location.parent.name; - // Either the location is on the right of a property access, or on the left and the right is missing - if (right === location || (right && right.getFullWidth() === 0)) { - location = location.parent; - } - } - // try get the call/construct signature from the type if it matches - var callExpression = void 0; - if (location.kind === 174 /* CallExpression */ || location.kind === 175 /* NewExpression */) { - callExpression = location; - } - else if (isCallExpressionTarget(location) || isNewExpressionTarget(location)) { - callExpression = location.parent; - } - if (callExpression) { - var candidateSignatures = []; - signature = typeChecker.getResolvedSignature(callExpression, candidateSignatures); - if (!signature && candidateSignatures.length) { - // Use the first candidate: - signature = candidateSignatures[0]; - } - var useConstructSignatures = callExpression.kind === 175 /* NewExpression */ || callExpression.expression.kind === 95 /* SuperKeyword */; - var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); - if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { - // Get the first signature if there is one -- allSignatures may contain - // either the original signature or its target, so check for either - signature = allSignatures.length ? allSignatures[0] : undefined; - } - if (signature) { - if (useConstructSignatures && (symbolFlags & 32 /* Class */)) { - // Constructor - symbolKind = ScriptElementKind.constructorImplementationElement; - addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); - } - else if (symbolFlags & 8388608 /* Alias */) { - symbolKind = ScriptElementKind.alias; - pushTypePart(symbolKind); - displayParts.push(ts.spacePart()); - if (useConstructSignatures) { - displayParts.push(ts.keywordPart(92 /* NewKeyword */)); - displayParts.push(ts.spacePart()); - } - addFullSymbolName(symbol); - } - else { - addPrefixForAnyFunctionOrVar(symbol, symbolKind); - } - switch (symbolKind) { - case ScriptElementKind.memberVariableElement: - case ScriptElementKind.variableElement: - case ScriptElementKind.constElement: - case ScriptElementKind.letElement: - case ScriptElementKind.parameterElement: - case ScriptElementKind.localVariableElement: - // If it is call or construct signature of lambda's write type name - displayParts.push(ts.punctuationPart(54 /* ColonToken */)); - displayParts.push(ts.spacePart()); - if (useConstructSignatures) { - displayParts.push(ts.keywordPart(92 /* NewKeyword */)); - displayParts.push(ts.spacePart()); - } - if (!(type.flags & 2097152 /* Anonymous */) && type.symbol) { - ts.addRange(displayParts, ts.symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, /*meaning*/ undefined, 1 /* WriteTypeParametersOrArguments */)); - } - addSignatureDisplayParts(signature, allSignatures, 8 /* WriteArrowStyleSignature */); - break; - default: - // Just signature - addSignatureDisplayParts(signature, allSignatures); - } - hasAddedSymbolInfo = true; - } - } - else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304 /* Accessor */)) || - (location.kind === 121 /* ConstructorKeyword */ && location.parent.kind === 148 /* Constructor */)) { - // get the signature from the declaration and write it - var functionDeclaration = location.parent; - var allSignatures = functionDeclaration.kind === 148 /* Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); - if (!typeChecker.isImplementationOfOverload(functionDeclaration)) { - signature = typeChecker.getSignatureFromDeclaration(functionDeclaration); - } - else { - signature = allSignatures[0]; - } - if (functionDeclaration.kind === 148 /* Constructor */) { - // show (constructor) Type(...) signature - symbolKind = ScriptElementKind.constructorImplementationElement; - addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); - } - else { - // (function/method) symbol(..signature) - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 151 /* CallSignature */ && - !(type.symbol.flags & 2048 /* TypeLiteral */ || type.symbol.flags & 4096 /* ObjectLiteral */) ? type.symbol : symbol, symbolKind); - } - addSignatureDisplayParts(signature, allSignatures); - hasAddedSymbolInfo = true; - } - } - } - if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo && !isThisExpression) { - if (ts.getDeclarationOfKind(symbol, 192 /* ClassExpression */)) { - // Special case for class expressions because we would like to indicate that - // the class name is local to the class body (similar to function expression) - // (local class) class - pushTypePart(ScriptElementKind.localClassElement); - } - else { - // Class declaration has name which is not local. - displayParts.push(ts.keywordPart(73 /* ClassKeyword */)); - } - displayParts.push(ts.spacePart()); - addFullSymbolName(symbol); - writeTypeParametersOfSymbol(symbol, sourceFile); - } - if ((symbolFlags & 64 /* Interface */) && (semanticMeaning & 2 /* Type */)) { - addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(107 /* InterfaceKeyword */)); - displayParts.push(ts.spacePart()); - addFullSymbolName(symbol); - writeTypeParametersOfSymbol(symbol, sourceFile); - } - if (symbolFlags & 524288 /* TypeAlias */) { - addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(134 /* TypeKeyword */)); - displayParts.push(ts.spacePart()); - addFullSymbolName(symbol); - writeTypeParametersOfSymbol(symbol, sourceFile); - displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(56 /* EqualsToken */)); - displayParts.push(ts.spacePart()); - ts.addRange(displayParts, ts.typeToDisplayParts(typeChecker, typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration, 512 /* InTypeAlias */)); - } - if (symbolFlags & 384 /* Enum */) { - addNewLineIfDisplayPartsExist(); - if (ts.forEach(symbol.declarations, ts.isConstEnumDeclaration)) { - displayParts.push(ts.keywordPart(74 /* ConstKeyword */)); - displayParts.push(ts.spacePart()); - } - displayParts.push(ts.keywordPart(81 /* EnumKeyword */)); - displayParts.push(ts.spacePart()); - addFullSymbolName(symbol); - } - if (symbolFlags & 1536 /* Module */) { - addNewLineIfDisplayPartsExist(); - var declaration = ts.getDeclarationOfKind(symbol, 225 /* ModuleDeclaration */); - var isNamespace = declaration && declaration.name && declaration.name.kind === 69 /* Identifier */; - displayParts.push(ts.keywordPart(isNamespace ? 126 /* NamespaceKeyword */ : 125 /* ModuleKeyword */)); - displayParts.push(ts.spacePart()); - addFullSymbolName(symbol); - } - if ((symbolFlags & 262144 /* TypeParameter */) && (semanticMeaning & 2 /* Type */)) { - addNewLineIfDisplayPartsExist(); - displayParts.push(ts.punctuationPart(17 /* OpenParenToken */)); - displayParts.push(ts.textPart("type parameter")); - displayParts.push(ts.punctuationPart(18 /* CloseParenToken */)); - displayParts.push(ts.spacePart()); - addFullSymbolName(symbol); - displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(90 /* InKeyword */)); - displayParts.push(ts.spacePart()); - if (symbol.parent) { - // Class/Interface type parameter - addFullSymbolName(symbol.parent, enclosingDeclaration); - writeTypeParametersOfSymbol(symbol.parent, enclosingDeclaration); - } - else { - // Method/function type parameter - var declaration = ts.getDeclarationOfKind(symbol, 141 /* TypeParameter */); - ts.Debug.assert(declaration !== undefined); - declaration = declaration.parent; - if (declaration) { - if (ts.isFunctionLikeKind(declaration.kind)) { - var signature = typeChecker.getSignatureFromDeclaration(declaration); - if (declaration.kind === 152 /* ConstructSignature */) { - displayParts.push(ts.keywordPart(92 /* NewKeyword */)); - displayParts.push(ts.spacePart()); - } - else if (declaration.kind !== 151 /* CallSignature */ && declaration.name) { - addFullSymbolName(declaration.symbol); - } - ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */)); - } - else { - // Type alias type parameter - // For example - // type list = T[]; // Both T will go through same code path - displayParts.push(ts.keywordPart(134 /* TypeKeyword */)); - displayParts.push(ts.spacePart()); - addFullSymbolName(declaration.symbol); - writeTypeParametersOfSymbol(declaration.symbol, sourceFile); - } - } - } - } - if (symbolFlags & 8 /* EnumMember */) { - addPrefixForAnyFunctionOrVar(symbol, "enum member"); - var declaration = symbol.declarations[0]; - if (declaration.kind === 255 /* EnumMember */) { - var constantValue = typeChecker.getConstantValue(declaration); - if (constantValue !== undefined) { - displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(56 /* EqualsToken */)); - displayParts.push(ts.spacePart()); - displayParts.push(ts.displayPart(constantValue.toString(), SymbolDisplayPartKind.numericLiteral)); - } - } - } - if (symbolFlags & 8388608 /* Alias */) { - addNewLineIfDisplayPartsExist(); - if (symbol.declarations[0].kind === 228 /* NamespaceExportDeclaration */) { - displayParts.push(ts.keywordPart(82 /* ExportKeyword */)); - displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(126 /* NamespaceKeyword */)); - } - else { - displayParts.push(ts.keywordPart(89 /* ImportKeyword */)); - } - displayParts.push(ts.spacePart()); - addFullSymbolName(symbol); - ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 229 /* ImportEqualsDeclaration */) { - var importEqualsDeclaration = declaration; - if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { - displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(56 /* EqualsToken */)); - displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(129 /* RequireKeyword */)); - displayParts.push(ts.punctuationPart(17 /* OpenParenToken */)); - displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), SymbolDisplayPartKind.stringLiteral)); - displayParts.push(ts.punctuationPart(18 /* CloseParenToken */)); - } - else { - var internalAliasSymbol = typeChecker.getSymbolAtLocation(importEqualsDeclaration.moduleReference); - if (internalAliasSymbol) { - displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(56 /* EqualsToken */)); - displayParts.push(ts.spacePart()); - addFullSymbolName(internalAliasSymbol, enclosingDeclaration); - } - } - return true; - } - }); - } - if (!hasAddedSymbolInfo) { - if (symbolKind !== ScriptElementKind.unknown) { - if (type) { - if (isThisExpression) { - addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(97 /* ThisKeyword */)); - } - else { - addPrefixForAnyFunctionOrVar(symbol, symbolKind); - } - // For properties, variables and local vars: show the type - if (symbolKind === ScriptElementKind.memberVariableElement || - symbolFlags & 3 /* Variable */ || - symbolKind === ScriptElementKind.localVariableElement || - isThisExpression) { - displayParts.push(ts.punctuationPart(54 /* ColonToken */)); - displayParts.push(ts.spacePart()); - // If the type is type parameter, format it specially - if (type.symbol && type.symbol.flags & 262144 /* TypeParameter */) { - var typeParameterParts = ts.mapToDisplayParts(function (writer) { - typeChecker.getSymbolDisplayBuilder().buildTypeParameterDisplay(type, writer, enclosingDeclaration); - }); - ts.addRange(displayParts, typeParameterParts); - } - else { - ts.addRange(displayParts, ts.typeToDisplayParts(typeChecker, type, enclosingDeclaration)); - } - } - else if (symbolFlags & 16 /* Function */ || - symbolFlags & 8192 /* Method */ || - symbolFlags & 16384 /* Constructor */ || - symbolFlags & 131072 /* Signature */ || - symbolFlags & 98304 /* Accessor */ || - symbolKind === ScriptElementKind.memberFunctionElement) { - var allSignatures = type.getNonNullableType().getCallSignatures(); - addSignatureDisplayParts(allSignatures[0], allSignatures); - } - } - } - else { - symbolKind = getSymbolKind(symbol, location); - } - } - if (!documentation) { - documentation = symbol.getDocumentationComment(); - if (documentation.length === 0 && symbol.flags & 4 /* Property */) { - // For some special property access expressions like `experts.foo = foo` or `module.exports.foo = foo` - // there documentation comments might be attached to the right hand side symbol of their declarations. - // The pattern of such special property access is that the parent symbol is the symbol of the file. - if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 256 /* SourceFile */; })) { - for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { - var declaration = _a[_i]; - if (!declaration.parent || declaration.parent.kind !== 187 /* BinaryExpression */) { - continue; - } - var rhsSymbol = program.getTypeChecker().getSymbolAtLocation(declaration.parent.right); - if (!rhsSymbol) { - continue; - } - documentation = rhsSymbol.getDocumentationComment(); - if (documentation.length > 0) { - break; - } - } - } - } - } - return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind }; - function addNewLineIfDisplayPartsExist() { - if (displayParts.length) { - displayParts.push(ts.lineBreakPart()); - } - } - function addFullSymbolName(symbol, enclosingDeclaration) { - var fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbol, enclosingDeclaration || sourceFile, /*meaning*/ undefined, 1 /* WriteTypeParametersOrArguments */ | 2 /* UseOnlyExternalAliasing */); - ts.addRange(displayParts, fullSymbolDisplayParts); - } - function addPrefixForAnyFunctionOrVar(symbol, symbolKind) { - addNewLineIfDisplayPartsExist(); - if (symbolKind) { - pushTypePart(symbolKind); - displayParts.push(ts.spacePart()); - addFullSymbolName(symbol); - } - } - function pushTypePart(symbolKind) { - switch (symbolKind) { - case ScriptElementKind.variableElement: - case ScriptElementKind.functionElement: - case ScriptElementKind.letElement: - case ScriptElementKind.constElement: - case ScriptElementKind.constructorImplementationElement: - displayParts.push(ts.textOrKeywordPart(symbolKind)); - return; - default: - displayParts.push(ts.punctuationPart(17 /* OpenParenToken */)); - displayParts.push(ts.textOrKeywordPart(symbolKind)); - displayParts.push(ts.punctuationPart(18 /* CloseParenToken */)); - return; - } - } - function addSignatureDisplayParts(signature, allSignatures, flags) { - ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, enclosingDeclaration, flags | 32 /* WriteTypeArgumentsOfSignature */)); - if (allSignatures.length > 1) { - displayParts.push(ts.spacePart()); - displayParts.push(ts.punctuationPart(17 /* OpenParenToken */)); - displayParts.push(ts.operatorPart(35 /* PlusToken */)); - displayParts.push(ts.displayPart((allSignatures.length - 1).toString(), SymbolDisplayPartKind.numericLiteral)); - displayParts.push(ts.spacePart()); - displayParts.push(ts.textPart(allSignatures.length === 2 ? "overload" : "overloads")); - displayParts.push(ts.punctuationPart(18 /* CloseParenToken */)); - } - documentation = signature.getDocumentationComment(); - } - function writeTypeParametersOfSymbol(symbol, enclosingDeclaration) { - var typeParameterParts = ts.mapToDisplayParts(function (writer) { - typeChecker.getSymbolDisplayBuilder().buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaration); - }); - ts.addRange(displayParts, typeParameterParts); - } + function getCompletionEntrySymbol(fileName, position, entryName) { + synchronizeHostData(); + return ts.Completions.getCompletionEntrySymbol(program.getTypeChecker(), log, program.getCompilerOptions(), getValidSourceFile(fileName), position, entryName); } function getQuickInfoAtPosition(fileName, position) { synchronizeHostData(); @@ -56938,7 +79517,7 @@ var ts; if (node === sourceFile) { return undefined; } - if (isLabelName(node)) { + if (ts.isLabelName(node)) { return undefined; } var typeChecker = program.getTypeChecker(); @@ -56946,238 +79525,58 @@ var ts; if (!symbol || typeChecker.isUnknownSymbol(symbol)) { // Try getting just type at this position and show switch (node.kind) { - case 69 /* Identifier */: - case 172 /* PropertyAccessExpression */: - case 139 /* QualifiedName */: - case 97 /* ThisKeyword */: - case 165 /* ThisType */: - case 95 /* SuperKeyword */: + case 70 /* Identifier */: + case 177 /* PropertyAccessExpression */: + case 141 /* QualifiedName */: + case 98 /* ThisKeyword */: + case 167 /* ThisType */: + case 96 /* SuperKeyword */: // For the identifiers/this/super etc get the type at position var type = typeChecker.getTypeAtLocation(node); if (type) { return { - kind: ScriptElementKind.unknown, - kindModifiers: ScriptElementKindModifier.none, + kind: ts.ScriptElementKind.unknown, + kindModifiers: ts.ScriptElementKindModifier.none, textSpan: ts.createTextSpan(node.getStart(), node.getWidth()), - displayParts: ts.typeToDisplayParts(typeChecker, type, getContainerNode(node)), - documentation: type.symbol ? type.symbol.getDocumentationComment() : undefined + displayParts: ts.typeToDisplayParts(typeChecker, type, ts.getContainerNode(node)), + documentation: type.symbol ? type.symbol.getDocumentationComment() : undefined, + tags: type.symbol ? type.symbol.getJsDocTags() : undefined }; } } return undefined; } - var displayPartsDocumentationsAndKind = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, sourceFile, getContainerNode(node), node); + var displayPartsDocumentationsAndKind = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, ts.getContainerNode(node), node); return { kind: displayPartsDocumentationsAndKind.symbolKind, - kindModifiers: getSymbolModifiers(symbol), + kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), textSpan: ts.createTextSpan(node.getStart(), node.getWidth()), displayParts: displayPartsDocumentationsAndKind.displayParts, - documentation: displayPartsDocumentationsAndKind.documentation - }; - } - function createDefinitionInfo(node, symbolKind, symbolName, containerName) { - return { - fileName: node.getSourceFile().fileName, - textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()), - kind: symbolKind, - name: symbolName, - containerKind: undefined, - containerName: containerName - }; - } - function getDefinitionFromSymbol(symbol, node) { - var typeChecker = program.getTypeChecker(); - var result = []; - var declarations = symbol.getDeclarations(); - var symbolName = typeChecker.symbolToString(symbol); // Do not get scoped name, just the name of the symbol - var symbolKind = getSymbolKind(symbol, node); - var containerSymbol = symbol.parent; - var containerName = containerSymbol ? typeChecker.symbolToString(containerSymbol, node) : ""; - if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) && - !tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) { - // Just add all the declarations. - ts.forEach(declarations, function (declaration) { - result.push(createDefinitionInfo(declaration, symbolKind, symbolName, containerName)); - }); - } - return result; - function tryAddConstructSignature(symbol, location, symbolKind, symbolName, containerName, result) { - // Applicable only if we are in a new expression, or we are on a constructor declaration - // and in either case the symbol has a construct signature definition, i.e. class - if (isNewExpressionTarget(location) || location.kind === 121 /* ConstructorKeyword */) { - if (symbol.flags & 32 /* Class */) { - // Find the first class-like declaration and try to get the construct signature. - for (var _i = 0, _a = symbol.getDeclarations(); _i < _a.length; _i++) { - var declaration = _a[_i]; - if (ts.isClassLike(declaration)) { - return tryAddSignature(declaration.members, - /*selectConstructors*/ true, symbolKind, symbolName, containerName, result); - } - } - ts.Debug.fail("Expected declaration to have at least one class-like declaration"); - } - } - return false; - } - function tryAddCallSignature(symbol, location, symbolKind, symbolName, containerName, result) { - if (isCallExpressionTarget(location) || isNewExpressionTarget(location) || isNameOfFunctionDeclaration(location)) { - return tryAddSignature(symbol.declarations, /*selectConstructors*/ false, symbolKind, symbolName, containerName, result); - } - return false; - } - function tryAddSignature(signatureDeclarations, selectConstructors, symbolKind, symbolName, containerName, result) { - var declarations = []; - var definition; - ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 148 /* Constructor */) || - (!selectConstructors && (d.kind === 220 /* FunctionDeclaration */ || d.kind === 147 /* MethodDeclaration */ || d.kind === 146 /* MethodSignature */))) { - declarations.push(d); - if (d.body) - definition = d; - } - }); - if (definition) { - result.push(createDefinitionInfo(definition, symbolKind, symbolName, containerName)); - return true; - } - else if (declarations.length) { - result.push(createDefinitionInfo(ts.lastOrUndefined(declarations), symbolKind, symbolName, containerName)); - return true; - } - return false; - } - } - function findReferenceInPosition(refs, pos) { - for (var _i = 0, refs_1 = refs; _i < refs_1.length; _i++) { - var ref = refs_1[_i]; - if (ref.pos <= pos && pos < ref.end) { - return ref; - } - } - return undefined; - } - function getDefinitionInfoForFileReference(name, targetFileName) { - return { - fileName: targetFileName, - textSpan: ts.createTextSpanFromBounds(0, 0), - kind: ScriptElementKind.scriptElement, - name: name, - containerName: undefined, - containerKind: undefined + documentation: displayPartsDocumentationsAndKind.documentation, + tags: displayPartsDocumentationsAndKind.tags }; } /// Goto definition function getDefinitionAtPosition(fileName, position) { synchronizeHostData(); - var sourceFile = getValidSourceFile(fileName); - /// Triple slash reference comments - var comment = findReferenceInPosition(sourceFile.referencedFiles, position); - if (comment) { - var referenceFile = ts.tryResolveScriptReference(program, sourceFile, comment); - if (referenceFile) { - return [getDefinitionInfoForFileReference(comment.fileName, referenceFile.fileName)]; - } - return undefined; - } - // Type reference directives - var typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position); - if (typeReferenceDirective) { - var referenceFile = program.getResolvedTypeReferenceDirectives()[typeReferenceDirective.fileName]; - if (referenceFile && referenceFile.resolvedFileName) { - return [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)]; - } - return undefined; - } - var node = ts.getTouchingPropertyName(sourceFile, position); - if (node === sourceFile) { - return undefined; - } - // Labels - if (isJumpStatementTarget(node)) { - var labelName = node.text; - var label = getTargetLabel(node.parent, node.text); - return label ? [createDefinitionInfo(label, ScriptElementKind.label, labelName, /*containerName*/ undefined)] : undefined; - } - var typeChecker = program.getTypeChecker(); - var symbol = typeChecker.getSymbolAtLocation(node); - // Could not find a symbol e.g. node is string or number keyword, - // or the symbol was an internal symbol and does not have a declaration e.g. undefined symbol - if (!symbol) { - return undefined; - } - // If this is an alias, and the request came at the declaration location - // get the aliased symbol instead. This allows for goto def on an import e.g. - // import {A, B} from "mod"; - // to jump to the implementation directly. - if (symbol.flags & 8388608 /* Alias */) { - var declaration = symbol.declarations[0]; - // Go to the original declaration for cases: - // - // (1) when the aliased symbol was declared in the location(parent). - // (2) when the aliased symbol is originating from a named import. - // - if (node.kind === 69 /* Identifier */ && - (node.parent === declaration || - (declaration.kind === 234 /* ImportSpecifier */ && declaration.parent && declaration.parent.kind === 233 /* NamedImports */))) { - symbol = typeChecker.getAliasedSymbol(symbol); - } - } - // Because name in short-hand property assignment has two different meanings: property name and property value, - // using go-to-definition at such position should go to the variable declaration of the property value rather than - // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition - // is performed at the location of property access, we would like to go to definition of the property in the short-hand - // assignment. This case and others are handled by the following code. - if (node.parent.kind === 254 /* ShorthandPropertyAssignment */) { - var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); - if (!shorthandSymbol) { - return []; - } - var shorthandDeclarations = shorthandSymbol.getDeclarations(); - var shorthandSymbolKind_1 = getSymbolKind(shorthandSymbol, node); - var shorthandSymbolName_1 = typeChecker.symbolToString(shorthandSymbol); - var shorthandContainerName_1 = typeChecker.symbolToString(symbol.parent, node); - return ts.map(shorthandDeclarations, function (declaration) { return createDefinitionInfo(declaration, shorthandSymbolKind_1, shorthandSymbolName_1, shorthandContainerName_1); }); - } - return getDefinitionFromSymbol(symbol, node); + return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position); + } + /// Goto implementation + function getImplementationAtPosition(fileName, position) { + synchronizeHostData(); + return ts.GoToImplementation.getImplementationAtPosition(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), ts.getTouchingPropertyName(getValidSourceFile(fileName), position)); } - /// Goto type function getTypeDefinitionAtPosition(fileName, position) { synchronizeHostData(); - var sourceFile = getValidSourceFile(fileName); - var node = ts.getTouchingPropertyName(sourceFile, position); - if (node === sourceFile) { - return undefined; - } - var typeChecker = program.getTypeChecker(); - var symbol = typeChecker.getSymbolAtLocation(node); - if (!symbol) { - return undefined; - } - var type = typeChecker.getTypeOfSymbolAtLocation(symbol, node); - if (!type) { - return undefined; - } - if (type.flags & 524288 /* Union */ && !(type.flags & 16 /* Enum */)) { - var result_4 = []; - ts.forEach(type.types, function (t) { - if (t.symbol) { - ts.addRange(/*to*/ result_4, /*from*/ getDefinitionFromSymbol(t.symbol, node)); - } - }); - return result_4; - } - if (!type.symbol) { - return undefined; - } - return getDefinitionFromSymbol(type.symbol, node); + return ts.GoToDefinition.getTypeDefinitionAtPosition(program.getTypeChecker(), getValidSourceFile(fileName), position); } function getOccurrencesAtPosition(fileName, position) { var results = getOccurrencesAtPositionCore(fileName, position); if (results) { - var sourceFile_1 = getCanonicalFileName(ts.normalizeSlashes(fileName)); + var sourceFile_2 = getCanonicalFileName(ts.normalizeSlashes(fileName)); // Get occurrences only supports reporting occurrences for the file queried. So // filter down to that list. - results = ts.filter(results, function (r) { return getCanonicalFileName(ts.normalizeSlashes(r.fileName)) === sourceFile_1; }); + results = ts.filter(results, function (r) { return getCanonicalFileName(ts.normalizeSlashes(r.fileName)) === sourceFile_2; }); } return results; } @@ -57185,527 +79584,7 @@ var ts; synchronizeHostData(); var sourceFilesToSearch = ts.map(filesToSearch, function (f) { return program.getSourceFile(f); }); var sourceFile = getValidSourceFile(fileName); - var node = ts.getTouchingWord(sourceFile, position); - if (!node) { - return undefined; - } - return getSemanticDocumentHighlights(node) || getSyntacticDocumentHighlights(node); - function getHighlightSpanForNode(node) { - var start = node.getStart(); - var end = node.getEnd(); - return { - fileName: sourceFile.fileName, - textSpan: ts.createTextSpanFromBounds(start, end), - kind: HighlightSpanKind.none - }; - } - function getSemanticDocumentHighlights(node) { - if (node.kind === 69 /* Identifier */ || - node.kind === 97 /* ThisKeyword */ || - node.kind === 165 /* ThisType */ || - node.kind === 95 /* SuperKeyword */ || - node.kind === 9 /* StringLiteral */ || - isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { - var referencedSymbols = getReferencedSymbolsForNode(node, sourceFilesToSearch, /*findInStrings*/ false, /*findInComments*/ false); - return convertReferencedSymbols(referencedSymbols); - } - return undefined; - function convertReferencedSymbols(referencedSymbols) { - if (!referencedSymbols) { - return undefined; - } - var fileNameToDocumentHighlights = ts.createMap(); - var result = []; - for (var _i = 0, referencedSymbols_1 = referencedSymbols; _i < referencedSymbols_1.length; _i++) { - var referencedSymbol = referencedSymbols_1[_i]; - for (var _a = 0, _b = referencedSymbol.references; _a < _b.length; _a++) { - var referenceEntry = _b[_a]; - var fileName_1 = referenceEntry.fileName; - var documentHighlights = fileNameToDocumentHighlights[fileName_1]; - if (!documentHighlights) { - documentHighlights = { fileName: fileName_1, highlightSpans: [] }; - fileNameToDocumentHighlights[fileName_1] = documentHighlights; - result.push(documentHighlights); - } - documentHighlights.highlightSpans.push({ - textSpan: referenceEntry.textSpan, - kind: referenceEntry.isWriteAccess ? HighlightSpanKind.writtenReference : HighlightSpanKind.reference - }); - } - } - return result; - } - } - function getSyntacticDocumentHighlights(node) { - var fileName = sourceFile.fileName; - var highlightSpans = getHighlightSpans(node); - if (!highlightSpans || highlightSpans.length === 0) { - return undefined; - } - return [{ fileName: fileName, highlightSpans: highlightSpans }]; - // returns true if 'node' is defined and has a matching 'kind'. - function hasKind(node, kind) { - return node !== undefined && node.kind === kind; - } - // Null-propagating 'parent' function. - function parent(node) { - return node && node.parent; - } - function getHighlightSpans(node) { - if (node) { - switch (node.kind) { - case 88 /* IfKeyword */: - case 80 /* ElseKeyword */: - if (hasKind(node.parent, 203 /* IfStatement */)) { - return getIfElseOccurrences(node.parent); - } - break; - case 94 /* ReturnKeyword */: - if (hasKind(node.parent, 211 /* ReturnStatement */)) { - return getReturnOccurrences(node.parent); - } - break; - case 98 /* ThrowKeyword */: - if (hasKind(node.parent, 215 /* ThrowStatement */)) { - return getThrowOccurrences(node.parent); - } - break; - case 72 /* CatchKeyword */: - if (hasKind(parent(parent(node)), 216 /* TryStatement */)) { - return getTryCatchFinallyOccurrences(node.parent.parent); - } - break; - case 100 /* TryKeyword */: - case 85 /* FinallyKeyword */: - if (hasKind(parent(node), 216 /* TryStatement */)) { - return getTryCatchFinallyOccurrences(node.parent); - } - break; - case 96 /* SwitchKeyword */: - if (hasKind(node.parent, 213 /* SwitchStatement */)) { - return getSwitchCaseDefaultOccurrences(node.parent); - } - break; - case 71 /* CaseKeyword */: - case 77 /* DefaultKeyword */: - if (hasKind(parent(parent(parent(node))), 213 /* SwitchStatement */)) { - return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); - } - break; - case 70 /* BreakKeyword */: - case 75 /* ContinueKeyword */: - if (hasKind(node.parent, 210 /* BreakStatement */) || hasKind(node.parent, 209 /* ContinueStatement */)) { - return getBreakOrContinueStatementOccurrences(node.parent); - } - break; - case 86 /* ForKeyword */: - if (hasKind(node.parent, 206 /* ForStatement */) || - hasKind(node.parent, 207 /* ForInStatement */) || - hasKind(node.parent, 208 /* ForOfStatement */)) { - return getLoopBreakContinueOccurrences(node.parent); - } - break; - case 104 /* WhileKeyword */: - case 79 /* DoKeyword */: - if (hasKind(node.parent, 205 /* WhileStatement */) || hasKind(node.parent, 204 /* DoStatement */)) { - return getLoopBreakContinueOccurrences(node.parent); - } - break; - case 121 /* ConstructorKeyword */: - if (hasKind(node.parent, 148 /* Constructor */)) { - return getConstructorOccurrences(node.parent); - } - break; - case 123 /* GetKeyword */: - case 131 /* SetKeyword */: - if (hasKind(node.parent, 149 /* GetAccessor */) || hasKind(node.parent, 150 /* SetAccessor */)) { - return getGetAndSetOccurrences(node.parent); - } - break; - default: - if (ts.isModifierKind(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 200 /* VariableStatement */)) { - return getModifierOccurrences(node.kind, node.parent); - } - } - } - return undefined; - } - /** - * Aggregates all throw-statements within this node *without* crossing - * into function boundaries and try-blocks with catch-clauses. - */ - function aggregateOwnedThrowStatements(node) { - var statementAccumulator = []; - aggregate(node); - return statementAccumulator; - function aggregate(node) { - if (node.kind === 215 /* ThrowStatement */) { - statementAccumulator.push(node); - } - else if (node.kind === 216 /* TryStatement */) { - var tryStatement = node; - if (tryStatement.catchClause) { - aggregate(tryStatement.catchClause); - } - else { - // Exceptions thrown within a try block lacking a catch clause - // are "owned" in the current context. - aggregate(tryStatement.tryBlock); - } - if (tryStatement.finallyBlock) { - aggregate(tryStatement.finallyBlock); - } - } - else if (!ts.isFunctionLike(node)) { - ts.forEachChild(node, aggregate); - } - } - } - /** - * For lack of a better name, this function takes a throw statement and returns the - * nearest ancestor that is a try-block (whose try statement has a catch clause), - * function-block, or source file. - */ - function getThrowStatementOwner(throwStatement) { - var child = throwStatement; - while (child.parent) { - var parent_21 = child.parent; - if (ts.isFunctionBlock(parent_21) || parent_21.kind === 256 /* SourceFile */) { - return parent_21; - } - // 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_21.kind === 216 /* TryStatement */) { - var tryStatement = parent_21; - if (tryStatement.tryBlock === child && tryStatement.catchClause) { - return child; - } - } - child = parent_21; - } - return undefined; - } - function aggregateAllBreakAndContinueStatements(node) { - var statementAccumulator = []; - aggregate(node); - return statementAccumulator; - function aggregate(node) { - if (node.kind === 210 /* BreakStatement */ || node.kind === 209 /* ContinueStatement */) { - statementAccumulator.push(node); - } - else if (!ts.isFunctionLike(node)) { - ts.forEachChild(node, aggregate); - } - } - } - function ownsBreakOrContinueStatement(owner, statement) { - var actualOwner = getBreakOrContinueOwner(statement); - return actualOwner && actualOwner === owner; - } - function getBreakOrContinueOwner(statement) { - for (var node_1 = statement.parent; node_1; node_1 = node_1.parent) { - switch (node_1.kind) { - case 213 /* SwitchStatement */: - if (statement.kind === 209 /* ContinueStatement */) { - continue; - } - // Fall through. - case 206 /* ForStatement */: - case 207 /* ForInStatement */: - case 208 /* ForOfStatement */: - case 205 /* WhileStatement */: - case 204 /* DoStatement */: - if (!statement.label || isLabeledBy(node_1, statement.label.text)) { - return node_1; - } - break; - default: - // Don't cross function boundaries. - if (ts.isFunctionLike(node_1)) { - return undefined; - } - break; - } - } - return undefined; - } - function getModifierOccurrences(modifier, declaration) { - var container = declaration.parent; - // Make sure we only highlight the keyword when it makes sense to do so. - if (ts.isAccessibilityModifier(modifier)) { - if (!(container.kind === 221 /* ClassDeclaration */ || - container.kind === 192 /* ClassExpression */ || - (declaration.kind === 142 /* Parameter */ && hasKind(container, 148 /* Constructor */)))) { - return undefined; - } - } - else if (modifier === 113 /* StaticKeyword */) { - if (!(container.kind === 221 /* ClassDeclaration */ || container.kind === 192 /* ClassExpression */)) { - return undefined; - } - } - else if (modifier === 82 /* ExportKeyword */ || modifier === 122 /* DeclareKeyword */) { - if (!(container.kind === 226 /* ModuleBlock */ || container.kind === 256 /* SourceFile */)) { - return undefined; - } - } - else if (modifier === 115 /* AbstractKeyword */) { - if (!(container.kind === 221 /* ClassDeclaration */ || declaration.kind === 221 /* ClassDeclaration */)) { - return undefined; - } - } - else { - // unsupported modifier - return undefined; - } - var keywords = []; - var modifierFlag = getFlagFromModifier(modifier); - var nodes; - switch (container.kind) { - case 226 /* ModuleBlock */: - case 256 /* SourceFile */: - // Container is either a class declaration or the declaration is a classDeclaration - if (modifierFlag & 128 /* Abstract */) { - nodes = declaration.members.concat(declaration); - } - else { - nodes = container.statements; - } - break; - case 148 /* Constructor */: - nodes = container.parameters.concat(container.parent.members); - break; - case 221 /* ClassDeclaration */: - case 192 /* ClassExpression */: - nodes = container.members; - // If we're an accessibility modifier, we're in an instance member and should search - // the constructor's parameter list for instance members as well. - if (modifierFlag & 28 /* AccessibilityModifier */) { - var constructor = ts.forEach(container.members, function (member) { - return member.kind === 148 /* Constructor */ && member; - }); - if (constructor) { - nodes = nodes.concat(constructor.parameters); - } - } - else if (modifierFlag & 128 /* Abstract */) { - nodes = nodes.concat(container); - } - break; - default: - ts.Debug.fail("Invalid container kind."); - } - ts.forEach(nodes, function (node) { - if (node.modifiers && node.flags & modifierFlag) { - ts.forEach(node.modifiers, function (child) { return pushKeywordIf(keywords, child, modifier); }); - } - }); - return ts.map(keywords, getHighlightSpanForNode); - function getFlagFromModifier(modifier) { - switch (modifier) { - case 112 /* PublicKeyword */: - return 4 /* Public */; - case 110 /* PrivateKeyword */: - return 8 /* Private */; - case 111 /* ProtectedKeyword */: - return 16 /* Protected */; - case 113 /* StaticKeyword */: - return 32 /* Static */; - case 82 /* ExportKeyword */: - return 1 /* Export */; - case 122 /* DeclareKeyword */: - return 2 /* Ambient */; - case 115 /* AbstractKeyword */: - return 128 /* Abstract */; - default: - ts.Debug.fail(); - } - } - } - function pushKeywordIf(keywordList, token) { - var expected = []; - for (var _i = 2; _i < arguments.length; _i++) { - expected[_i - 2] = arguments[_i]; - } - if (token && ts.contains(expected, token.kind)) { - keywordList.push(token); - return true; - } - return false; - } - function getGetAndSetOccurrences(accessorDeclaration) { - var keywords = []; - tryPushAccessorKeyword(accessorDeclaration.symbol, 149 /* GetAccessor */); - tryPushAccessorKeyword(accessorDeclaration.symbol, 150 /* SetAccessor */); - return ts.map(keywords, getHighlightSpanForNode); - function tryPushAccessorKeyword(accessorSymbol, accessorKind) { - var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); - if (accessor) { - ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 123 /* GetKeyword */, 131 /* SetKeyword */); }); - } - } - } - function getConstructorOccurrences(constructorDeclaration) { - var declarations = constructorDeclaration.symbol.getDeclarations(); - var keywords = []; - ts.forEach(declarations, function (declaration) { - ts.forEach(declaration.getChildren(), function (token) { - return pushKeywordIf(keywords, token, 121 /* ConstructorKeyword */); - }); - }); - return ts.map(keywords, getHighlightSpanForNode); - } - function getLoopBreakContinueOccurrences(loopNode) { - var keywords = []; - if (pushKeywordIf(keywords, loopNode.getFirstToken(), 86 /* ForKeyword */, 104 /* WhileKeyword */, 79 /* DoKeyword */)) { - // If we succeeded and got a do-while loop, then start looking for a 'while' keyword. - if (loopNode.kind === 204 /* DoStatement */) { - var loopTokens = loopNode.getChildren(); - for (var i = loopTokens.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, loopTokens[i], 104 /* WhileKeyword */)) { - break; - } - } - } - } - var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); - ts.forEach(breaksAndContinues, function (statement) { - if (ownsBreakOrContinueStatement(loopNode, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 70 /* BreakKeyword */, 75 /* ContinueKeyword */); - } - }); - return ts.map(keywords, getHighlightSpanForNode); - } - function getBreakOrContinueStatementOccurrences(breakOrContinueStatement) { - var owner = getBreakOrContinueOwner(breakOrContinueStatement); - if (owner) { - switch (owner.kind) { - case 206 /* ForStatement */: - case 207 /* ForInStatement */: - case 208 /* ForOfStatement */: - case 204 /* DoStatement */: - case 205 /* WhileStatement */: - return getLoopBreakContinueOccurrences(owner); - case 213 /* SwitchStatement */: - return getSwitchCaseDefaultOccurrences(owner); - } - } - return undefined; - } - function getSwitchCaseDefaultOccurrences(switchStatement) { - var keywords = []; - pushKeywordIf(keywords, switchStatement.getFirstToken(), 96 /* SwitchKeyword */); - // Go through each clause in the switch statement, collecting the 'case'/'default' keywords. - ts.forEach(switchStatement.caseBlock.clauses, function (clause) { - pushKeywordIf(keywords, clause.getFirstToken(), 71 /* CaseKeyword */, 77 /* DefaultKeyword */); - var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); - ts.forEach(breaksAndContinues, function (statement) { - if (ownsBreakOrContinueStatement(switchStatement, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 70 /* BreakKeyword */); - } - }); - }); - return ts.map(keywords, getHighlightSpanForNode); - } - function getTryCatchFinallyOccurrences(tryStatement) { - var keywords = []; - pushKeywordIf(keywords, tryStatement.getFirstToken(), 100 /* TryKeyword */); - if (tryStatement.catchClause) { - pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 72 /* CatchKeyword */); - } - if (tryStatement.finallyBlock) { - var finallyKeyword = ts.findChildOfKind(tryStatement, 85 /* FinallyKeyword */, sourceFile); - pushKeywordIf(keywords, finallyKeyword, 85 /* FinallyKeyword */); - } - return ts.map(keywords, getHighlightSpanForNode); - } - function getThrowOccurrences(throwStatement) { - var owner = getThrowStatementOwner(throwStatement); - if (!owner) { - return undefined; - } - var keywords = []; - ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 98 /* ThrowKeyword */); - }); - // If the "owner" is a function, then we equate 'return' and 'throw' statements in their - // ability to "jump out" of the function, and include occurrences for both. - if (ts.isFunctionBlock(owner)) { - ts.forEachReturnStatement(owner, function (returnStatement) { - pushKeywordIf(keywords, returnStatement.getFirstToken(), 94 /* ReturnKeyword */); - }); - } - return ts.map(keywords, getHighlightSpanForNode); - } - function getReturnOccurrences(returnStatement) { - var func = ts.getContainingFunction(returnStatement); - // If we didn't find a containing function with a block body, bail out. - if (!(func && hasKind(func.body, 199 /* Block */))) { - return undefined; - } - var keywords = []; - ts.forEachReturnStatement(func.body, function (returnStatement) { - pushKeywordIf(keywords, returnStatement.getFirstToken(), 94 /* ReturnKeyword */); - }); - // Include 'throw' statements that do not occur within a try block. - ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 98 /* ThrowKeyword */); - }); - return ts.map(keywords, getHighlightSpanForNode); - } - function getIfElseOccurrences(ifStatement) { - var keywords = []; - // Traverse upwards through all parent if-statements linked by their else-branches. - while (hasKind(ifStatement.parent, 203 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { - ifStatement = ifStatement.parent; - } - // Now traverse back down through the else branches, aggregating if/else keywords of if-statements. - while (ifStatement) { - var children = ifStatement.getChildren(); - pushKeywordIf(keywords, children[0], 88 /* IfKeyword */); - // Generally the 'else' keyword is second-to-last, so we traverse backwards. - for (var i = children.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, children[i], 80 /* ElseKeyword */)) { - break; - } - } - if (!hasKind(ifStatement.elseStatement, 203 /* IfStatement */)) { - break; - } - ifStatement = ifStatement.elseStatement; - } - var result = []; - // We'd like to highlight else/ifs together if they are only separated by whitespace - // (i.e. the keywords are separated by no comments, no newlines). - for (var i = 0; i < keywords.length; i++) { - if (keywords[i].kind === 80 /* ElseKeyword */ && i < keywords.length - 1) { - var elseKeyword = keywords[i]; - var ifKeyword = keywords[i + 1]; // this *should* always be an 'if' keyword. - var shouldCombindElseAndIf = true; - // Avoid recalculating getStart() by iterating backwards. - for (var j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) { - if (!ts.isWhiteSpaceSingleLine(sourceFile.text.charCodeAt(j))) { - shouldCombindElseAndIf = false; - break; - } - } - if (shouldCombindElseAndIf) { - result.push({ - fileName: fileName, - textSpan: ts.createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end), - kind: HighlightSpanKind.reference - }); - i++; // skip the next keyword - continue; - } - } - // Ordinary case: just highlight the keyword. - result.push(getHighlightSpanForNode(keywords[i])); - } - return result; - } - } + return ts.DocumentHighlights.getDocumentHighlights(program.getTypeChecker(), cancellationToken, sourceFile, position, sourceFilesToSearch); } /// References and Occurrences function getOccurrencesAtPositionCore(fileName, position) { @@ -57723,7 +79602,7 @@ var ts; result.push({ fileName: entry.fileName, textSpan: highlightSpan.textSpan, - isWriteAccess: highlightSpan.kind === HighlightSpanKind.writtenReference, + isWriteAccess: highlightSpan.kind === ts.HighlightSpanKind.writtenReference, isDefinition: false }); } @@ -57731,24 +79610,13 @@ var ts; return result; } } - function convertReferences(referenceSymbols) { - if (!referenceSymbols) { - return undefined; - } - var referenceEntries = []; - for (var _i = 0, referenceSymbols_1 = referenceSymbols; _i < referenceSymbols_1.length; _i++) { - var referenceSymbol = referenceSymbols_1[_i]; - ts.addRange(referenceEntries, referenceSymbol.references); - } - return referenceEntries; - } function findRenameLocations(fileName, position, findInStrings, findInComments) { var referencedSymbols = findReferencedSymbols(fileName, position, findInStrings, findInComments); - return convertReferences(referencedSymbols); + return ts.FindAllReferences.convertReferences(referencedSymbols); } function getReferencesAtPosition(fileName, position) { var referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings*/ false, /*findInComments*/ false); - return convertReferences(referencedSymbols); + return ts.FindAllReferences.convertReferences(referencedSymbols); } function findReferences(fileName, position) { var referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings*/ false, /*findInComments*/ false); @@ -57757,845 +79625,15 @@ var ts; } function findReferencedSymbols(fileName, position, findInStrings, findInComments) { synchronizeHostData(); - var sourceFile = getValidSourceFile(fileName); - var node = ts.getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true); - if (node === sourceFile) { - return undefined; - } - switch (node.kind) { - case 8 /* NumericLiteral */: - if (!isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { - break; - } - // Fallthrough - case 69 /* Identifier */: - case 97 /* ThisKeyword */: - // case SyntaxKind.SuperKeyword: TODO:GH#9268 - case 9 /* StringLiteral */: - return getReferencedSymbolsForNode(node, program.getSourceFiles(), findInStrings, findInComments); - } - return undefined; - } - function isThis(node) { - switch (node.kind) { - case 97 /* ThisKeyword */: - // case SyntaxKind.ThisType: TODO: GH#9267 - return true; - case 69 /* Identifier */: - // 'this' as a parameter - return node.originalKeywordKind === 97 /* ThisKeyword */ && node.parent.kind === 142 /* Parameter */; - default: - return false; - } - } - function getReferencedSymbolsForNode(node, sourceFiles, findInStrings, findInComments) { - var typeChecker = program.getTypeChecker(); - // Labels - if (isLabelName(node)) { - if (isJumpStatementTarget(node)) { - var labelDefinition = getTargetLabel(node.parent, node.text); - // if we have a label definition, look within its statement for references, if not, then - // the label is undefined and we have no results.. - return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : undefined; - } - else { - // it is a label definition and not a target, search within the parent labeledStatement - return getLabelReferencesInNode(node.parent, node); - } - } - if (isThis(node)) { - return getReferencesForThisKeyword(node, sourceFiles); - } - if (node.kind === 95 /* SuperKeyword */) { - return getReferencesForSuperKeyword(node); - } - var symbol = typeChecker.getSymbolAtLocation(node); - if (!symbol && node.kind === 9 /* StringLiteral */) { - return getReferencesForStringLiteral(node, sourceFiles); - } - // Could not find a symbol e.g. unknown identifier - if (!symbol) { - // Can't have references to something that we have no symbol for. - return undefined; - } - var declarations = symbol.declarations; - // The symbol was an internal symbol and does not have a declaration e.g. undefined symbol - if (!declarations || !declarations.length) { - return undefined; - } - var result; - // Compute the meaning from the location and the symbol it references - var searchMeaning = getIntersectingMeaningFromDeclarations(getMeaningFromLocation(node), declarations); - // Get the text to search for. - // Note: if this is an external module symbol, the name doesn't include quotes. - var declaredName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); - // Try to get the smallest valid scope that we can limit our search to; - // otherwise we'll need to search globally (i.e. include each file). - var scope = getSymbolScope(symbol); - // Maps from a symbol ID to the ReferencedSymbol entry in 'result'. - var symbolToIndex = []; - if (scope) { - result = []; - getReferencesInNode(scope, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex); - } - else { - var internedName = getInternedName(symbol, node, declarations); - for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) { - var sourceFile = sourceFiles_4[_i]; - cancellationToken.throwIfCancellationRequested(); - var nameTable = getNameTable(sourceFile); - if (nameTable[internedName] !== undefined) { - result = result || []; - getReferencesInNode(sourceFile, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result, symbolToIndex); - } - } - } - return result; - function getDefinition(symbol) { - var info = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, node.getSourceFile(), getContainerNode(node), node); - var name = ts.map(info.displayParts, function (p) { return p.text; }).join(""); - var declarations = symbol.declarations; - if (!declarations || declarations.length === 0) { - return undefined; - } - return { - containerKind: "", - containerName: "", - name: name, - kind: info.symbolKind, - fileName: declarations[0].getSourceFile().fileName, - textSpan: ts.createTextSpan(declarations[0].getStart(), 0) - }; - } - function getAliasSymbolForPropertyNameSymbol(symbol, location) { - if (symbol.flags & 8388608 /* Alias */) { - // Default import get alias - var defaultImport = ts.getDeclarationOfKind(symbol, 231 /* ImportClause */); - if (defaultImport) { - return typeChecker.getAliasedSymbol(symbol); - } - var importOrExportSpecifier = ts.forEach(symbol.declarations, function (declaration) { return (declaration.kind === 234 /* ImportSpecifier */ || - declaration.kind === 238 /* ExportSpecifier */) ? declaration : undefined; }); - if (importOrExportSpecifier && - // export { a } - (!importOrExportSpecifier.propertyName || - // export {a as class } where a is location - importOrExportSpecifier.propertyName === location)) { - // If Import specifier -> get alias - // else Export specifier -> get local target - return importOrExportSpecifier.kind === 234 /* ImportSpecifier */ ? - typeChecker.getAliasedSymbol(symbol) : - typeChecker.getExportSpecifierLocalTargetSymbol(importOrExportSpecifier); - } - } - return undefined; - } - function getPropertySymbolOfDestructuringAssignment(location) { - return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(location.parent.parent) && - typeChecker.getPropertySymbolOfDestructuringAssignment(location); - } - function isObjectBindingPatternElementWithoutPropertyName(symbol) { - var bindingElement = ts.getDeclarationOfKind(symbol, 169 /* BindingElement */); - return bindingElement && - bindingElement.parent.kind === 167 /* ObjectBindingPattern */ && - !bindingElement.propertyName; - } - function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol) { - if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { - var bindingElement = ts.getDeclarationOfKind(symbol, 169 /* BindingElement */); - var typeOfPattern = typeChecker.getTypeAtLocation(bindingElement.parent); - return typeOfPattern && typeChecker.getPropertyOfType(typeOfPattern, bindingElement.name.text); - } - return undefined; - } - function getInternedName(symbol, location, declarations) { - // If this is an export or import specifier it could have been renamed using the 'as' syntax. - // If so we want to search for whatever under the cursor. - if (ts.isImportOrExportSpecifierName(location)) { - return location.getText(); - } - // Try to get the local symbol if we're dealing with an 'export default' - // since that symbol has the "true" name. - var localExportDefaultSymbol = ts.getLocalSymbolForExportDefault(symbol); - symbol = localExportDefaultSymbol || symbol; - return ts.stripQuotes(symbol.name); - } - /** - * Determines the smallest scope in which a symbol may have named references. - * Note that not every construct has been accounted for. This function can - * probably be improved. - * - * @returns undefined if the scope cannot be determined, implying that - * a reference to a symbol can occur anywhere. - */ - function getSymbolScope(symbol) { - // If this is the symbol of a named function expression or named class expression, - // then named references are limited to its own scope. - var valueDeclaration = symbol.valueDeclaration; - if (valueDeclaration && (valueDeclaration.kind === 179 /* FunctionExpression */ || valueDeclaration.kind === 192 /* ClassExpression */)) { - return valueDeclaration; - } - // If this is private property or method, the scope is the containing class - if (symbol.flags & (4 /* Property */ | 8192 /* Method */)) { - var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 8 /* Private */) ? d : undefined; }); - if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 221 /* ClassDeclaration */); - } - } - // If the symbol is an import we would like to find it if we are looking for what it imports. - // So consider it visible outside its declaration scope. - if (symbol.flags & 8388608 /* Alias */) { - return undefined; - } - // If symbol is of object binding pattern element without property name we would want to - // look for property too and that could be anywhere - if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { - return undefined; - } - // if this symbol is visible from its parent container, e.g. exported, then bail out - // if symbol correspond to the union property - bail out - if (symbol.parent || (symbol.flags & 268435456 /* SyntheticProperty */)) { - return undefined; - } - var scope; - var declarations = symbol.getDeclarations(); - if (declarations) { - for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { - var declaration = declarations_9[_i]; - var container = getContainerNode(declaration); - if (!container) { - return undefined; - } - if (scope && scope !== container) { - // Different declarations have different containers, bail out - return undefined; - } - if (container.kind === 256 /* SourceFile */ && !ts.isExternalModule(container)) { - // This is a global variable and not an external module, any declaration defined - // within this scope is visible outside the file - return undefined; - } - // The search scope is the container node - scope = container; - } - } - return scope; - } - function getPossibleSymbolReferencePositions(sourceFile, symbolName, start, end) { - var positions = []; - /// TODO: Cache symbol existence for files to save text search - // Also, need to make this work for unicode escapes. - // Be resilient in the face of a symbol with no name or zero length name - if (!symbolName || !symbolName.length) { - return positions; - } - var text = sourceFile.text; - var sourceLength = text.length; - var symbolNameLength = symbolName.length; - var position = text.indexOf(symbolName, start); - while (position >= 0) { - cancellationToken.throwIfCancellationRequested(); - // If we are past the end, stop looking - if (position > end) - break; - // We found a match. Make sure it's not part of a larger word (i.e. the char - // before and after it have to be a non-identifier char). - var endPosition = position + symbolNameLength; - if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 2 /* Latest */)) && - (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 2 /* Latest */))) { - // Found a real match. Keep searching. - positions.push(position); - } - position = text.indexOf(symbolName, position + symbolNameLength + 1); - } - return positions; - } - function getLabelReferencesInNode(container, targetLabel) { - var references = []; - var sourceFile = container.getSourceFile(); - var labelName = targetLabel.text; - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container.getStart(), container.getEnd()); - ts.forEach(possiblePositions, function (position) { - cancellationToken.throwIfCancellationRequested(); - var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.getWidth() !== labelName.length) { - return; - } - // Only pick labels that are either the target label, or have a target that is the target label - if (node === targetLabel || - (isJumpStatementTarget(node) && getTargetLabel(node, labelName) === targetLabel)) { - references.push(getReferenceEntryFromNode(node)); - } - }); - var definition = { - containerKind: "", - containerName: "", - fileName: targetLabel.getSourceFile().fileName, - kind: ScriptElementKind.label, - name: labelName, - textSpan: ts.createTextSpanFromBounds(targetLabel.getStart(), targetLabel.getEnd()) - }; - return [{ definition: definition, references: references }]; - } - function isValidReferencePosition(node, searchSymbolName) { - if (node) { - // Compare the length so we filter out strict superstrings of the symbol we are looking for - switch (node.kind) { - case 69 /* Identifier */: - return node.getWidth() === searchSymbolName.length; - case 9 /* StringLiteral */: - if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || - isNameOfExternalModuleImportOrDeclaration(node)) { - // For string literals we have two additional chars for the quotes - return node.getWidth() === searchSymbolName.length + 2; - } - break; - case 8 /* NumericLiteral */: - if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { - return node.getWidth() === searchSymbolName.length; - } - break; - } - } - return false; - } - /** Search within node "container" for references for a search value, where the search value is defined as a - * tuple of(searchSymbol, searchText, searchLocation, and searchMeaning). - * searchLocation: a node where the search value - */ - function getReferencesInNode(container, searchSymbol, searchText, searchLocation, searchMeaning, findInStrings, findInComments, result, symbolToIndex) { - var sourceFile = container.getSourceFile(); - var tripleSlashDirectivePrefixRegex = /^\/\/\/\s*= 0) { - var referencedSymbol = getReferencedSymbol(shorthandValueSymbol); - referencedSymbol.references.push(getReferenceEntryFromNode(referenceSymbolDeclaration.name)); - } - } - }); - } - return; - function getReferencedSymbol(symbol) { - var symbolId = ts.getSymbolId(symbol); - var index = symbolToIndex[symbolId]; - if (index === undefined) { - index = result.length; - symbolToIndex[symbolId] = index; - result.push({ - definition: getDefinition(symbol), - references: [] - }); - } - return result[index]; - } - function isInNonReferenceComment(sourceFile, position) { - return ts.isInCommentHelper(sourceFile, position, isNonReferenceComment); - function isNonReferenceComment(c) { - var commentText = sourceFile.text.substring(c.pos, c.end); - return !tripleSlashDirectivePrefixRegex.test(commentText); - } - } - } - function getReferencesForSuperKeyword(superKeyword) { - var searchSpaceNode = ts.getSuperContainer(superKeyword, /*stopOnFunctions*/ false); - if (!searchSpaceNode) { - return undefined; - } - // Whether 'super' occurs in a static context within a class. - var staticFlag = 32 /* Static */; - switch (searchSpaceNode.kind) { - case 145 /* PropertyDeclaration */: - case 144 /* PropertySignature */: - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - case 148 /* Constructor */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - staticFlag &= searchSpaceNode.flags; - searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class - break; - default: - return undefined; - } - var references = []; - var sourceFile = searchSpaceNode.getSourceFile(); - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); - ts.forEach(possiblePositions, function (position) { - cancellationToken.throwIfCancellationRequested(); - var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.kind !== 95 /* SuperKeyword */) { - return; - } - var container = ts.getSuperContainer(node, /*stopOnFunctions*/ false); - // If we have a 'super' container, we must have an enclosing class. - // Now make sure the owning class is the same as the search-space - // and has the same static qualifier as the original 'super's owner. - if (container && (32 /* Static */ & container.flags) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { - references.push(getReferenceEntryFromNode(node)); - } - }); - var definition = getDefinition(searchSpaceNode.symbol); - return [{ definition: definition, references: references }]; - } - function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles) { - var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false); - // Whether 'this' occurs in a static context within a class. - var staticFlag = 32 /* Static */; - switch (searchSpaceNode.kind) { - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - if (ts.isObjectLiteralMethod(searchSpaceNode)) { - break; - } - // fall through - case 145 /* PropertyDeclaration */: - case 144 /* PropertySignature */: - case 148 /* Constructor */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - staticFlag &= searchSpaceNode.flags; - searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class - break; - case 256 /* SourceFile */: - if (ts.isExternalModule(searchSpaceNode)) { - return undefined; - } - // Fall through - case 220 /* FunctionDeclaration */: - case 179 /* FunctionExpression */: - break; - // Computed properties in classes are not handled here because references to this are illegal, - // so there is no point finding references to them. - default: - return undefined; - } - var references = []; - var possiblePositions; - if (searchSpaceNode.kind === 256 /* SourceFile */) { - ts.forEach(sourceFiles, function (sourceFile) { - possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); - getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); - }); - } - else { - var sourceFile = searchSpaceNode.getSourceFile(); - possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); - getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, references); - } - return [{ - definition: { - containerKind: "", - containerName: "", - fileName: node.getSourceFile().fileName, - kind: ScriptElementKind.variableElement, - name: "this", - textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()) - }, - references: references - }]; - function getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result) { - ts.forEach(possiblePositions, function (position) { - cancellationToken.throwIfCancellationRequested(); - var node = ts.getTouchingWord(sourceFile, position); - if (!node || !isThis(node)) { - return; - } - var container = ts.getThisContainer(node, /* includeArrowFunctions */ false); - switch (searchSpaceNode.kind) { - case 179 /* FunctionExpression */: - case 220 /* FunctionDeclaration */: - if (searchSpaceNode.symbol === container.symbol) { - result.push(getReferenceEntryFromNode(node)); - } - break; - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { - result.push(getReferenceEntryFromNode(node)); - } - break; - case 192 /* ClassExpression */: - case 221 /* ClassDeclaration */: - // Make sure the container belongs to the same class - // and has the appropriate static modifier from the original container. - if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 32 /* Static */) === staticFlag) { - result.push(getReferenceEntryFromNode(node)); - } - break; - case 256 /* SourceFile */: - if (container.kind === 256 /* SourceFile */ && !ts.isExternalModule(container)) { - result.push(getReferenceEntryFromNode(node)); - } - break; - } - }); - } - } - function getReferencesForStringLiteral(node, sourceFiles) { - var typeChecker = program.getTypeChecker(); - var type = getStringLiteralTypeForNode(node, typeChecker); - if (!type) { - // nothing to do here. moving on - return undefined; - } - var references = []; - for (var _i = 0, sourceFiles_5 = sourceFiles; _i < sourceFiles_5.length; _i++) { - var sourceFile = sourceFiles_5[_i]; - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, type.text, sourceFile.getStart(), sourceFile.getEnd()); - getReferencesForStringLiteralInFile(sourceFile, type, possiblePositions, references); - } - return [{ - definition: { - containerKind: "", - containerName: "", - fileName: node.getSourceFile().fileName, - kind: ScriptElementKind.variableElement, - name: type.text, - textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()) - }, - references: references - }]; - function getReferencesForStringLiteralInFile(sourceFile, searchType, possiblePositions, references) { - for (var _i = 0, possiblePositions_1 = possiblePositions; _i < possiblePositions_1.length; _i++) { - var position = possiblePositions_1[_i]; - cancellationToken.throwIfCancellationRequested(); - var node_2 = ts.getTouchingWord(sourceFile, position); - if (!node_2 || node_2.kind !== 9 /* StringLiteral */) { - return; - } - var type_1 = getStringLiteralTypeForNode(node_2, typeChecker); - if (type_1 === searchType) { - references.push(getReferenceEntryFromNode(node_2)); - } - } - } - } - function populateSearchSymbolSet(symbol, location) { - // The search set contains at least the current symbol - var result = [symbol]; - // If the location is name of property symbol from object literal destructuring pattern - // Search the property symbol - // for ( { property: p2 } of elems) { } - var containingObjectLiteralElement = getContainingObjectLiteralElement(location); - if (containingObjectLiteralElement && containingObjectLiteralElement.kind !== 254 /* ShorthandPropertyAssignment */) { - var propertySymbol = getPropertySymbolOfDestructuringAssignment(location); - if (propertySymbol) { - result.push(propertySymbol); - } - } - // If the symbol is an alias, add what it aliases to the list - // import {a} from "mod"; - // export {a} - // If the symbol is an alias to default declaration, add what it aliases to the list - // declare "mod" { export default class B { } } - // import B from "mod"; - //// For export specifiers, the exported name can be referring to a local symbol, e.g.: - //// import {a} from "mod"; - //// export {a as somethingElse} - //// We want the *local* declaration of 'a' as declared in the import, - //// *not* as declared within "mod" (or farther) - var aliasSymbol = getAliasSymbolForPropertyNameSymbol(symbol, location); - if (aliasSymbol) { - result = result.concat(populateSearchSymbolSet(aliasSymbol, location)); - } - // If the location is in a context sensitive location (i.e. in an object literal) try - // to get a contextual type for it, and add the property symbol from the contextual - // type to the search set - if (containingObjectLiteralElement) { - ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) { - ts.addRange(result, typeChecker.getRootSymbols(contextualSymbol)); - }); - /* Because in short-hand property assignment, location has two meaning : property name and as value of the property - * When we do findAllReference at the position of the short-hand property assignment, we would want to have references to position of - * property name and variable declaration of the identifier. - * Like in below example, when querying for all references for an identifier 'name', of the property assignment, the language service - * should show both 'name' in 'obj' and 'name' in variable declaration - * const name = "Foo"; - * const obj = { name }; - * In order to do that, we will populate the search set with the value symbol of the identifier as a value of the property assignment - * so that when matching with potential reference symbol, both symbols from property declaration and variable declaration - * will be included correctly. - */ - var shorthandValueSymbol = typeChecker.getShorthandAssignmentValueSymbol(location.parent); - if (shorthandValueSymbol) { - result.push(shorthandValueSymbol); - } - } - // If the symbol.valueDeclaration is a property parameter declaration, - // we should include both parameter declaration symbol and property declaration symbol - // Parameter Declaration symbol is only visible within function scope, so the symbol is stored in constructor.locals. - // Property Declaration symbol is a member of the class, so the symbol is stored in its class Declaration.symbol.members - if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 142 /* Parameter */ && - ts.isParameterPropertyDeclaration(symbol.valueDeclaration)) { - result = result.concat(typeChecker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name)); - } - // If this is symbol of binding element without propertyName declaration in Object binding pattern - // Include the property in the search - var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol); - if (bindingElementPropertySymbol) { - result.push(bindingElementPropertySymbol); - } - // If this is a union property, add all the symbols from all its source symbols in all unioned types. - // If the symbol is an instantiation from a another symbol (e.g. widened symbol) , add the root the list - ts.forEach(typeChecker.getRootSymbols(symbol), function (rootSymbol) { - if (rootSymbol !== symbol) { - result.push(rootSymbol); - } - // Add symbol of properties/methods of the same name in base classes and implemented interfaces definitions - if (rootSymbol.parent && rootSymbol.parent.flags & (32 /* Class */ | 64 /* Interface */)) { - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, /*previousIterationSymbolsCache*/ ts.createMap()); - } - }); - return result; - } - /** - * Find symbol of the given property-name and add the symbol to the given result array - * @param symbol a symbol to start searching for the given propertyName - * @param propertyName a name of property to search for - * @param result an array of symbol of found property symbols - * @param previousIterationSymbolsCache a cache of symbol from previous iterations of calling this function to prevent infinite revisiting of the same symbol. - * The value of previousIterationSymbol is undefined when the function is first called. - */ - function getPropertySymbolsFromBaseTypes(symbol, propertyName, result, previousIterationSymbolsCache) { - if (!symbol) { - return; - } - // If the current symbol is the same as the previous-iteration symbol, we can just return the symbol that has already been visited - // This is particularly important for the following cases, so that we do not infinitely visit the same symbol. - // For example: - // interface C extends C { - // /*findRef*/propName: string; - // } - // The first time getPropertySymbolsFromBaseTypes is called when finding-all-references at propName, - // the symbol argument will be the symbol of an interface "C" and previousIterationSymbol is undefined, - // the function will add any found symbol of the property-name, then its sub-routine will call - // getPropertySymbolsFromBaseTypes again to walk up any base types to prevent revisiting already - // visited symbol, interface "C", the sub-routine will pass the current symbol as previousIterationSymbol. - if (symbol.name in previousIterationSymbolsCache) { - return; - } - if (symbol.flags & (32 /* Class */ | 64 /* Interface */)) { - ts.forEach(symbol.getDeclarations(), function (declaration) { - if (ts.isClassLike(declaration)) { - getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); - ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); - } - else if (declaration.kind === 222 /* InterfaceDeclaration */) { - ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); - } - }); - } - return; - function getPropertySymbolFromTypeReference(typeReference) { - if (typeReference) { - var type = typeChecker.getTypeAtLocation(typeReference); - if (type) { - var propertySymbol = typeChecker.getPropertyOfType(type, propertyName); - if (propertySymbol) { - result.push.apply(result, typeChecker.getRootSymbols(propertySymbol)); - } - // Visit the typeReference as well to see if it directly or indirectly use that property - previousIterationSymbolsCache[symbol.name] = symbol; - getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache); - } - } - } - } - function getRelatedSymbol(searchSymbols, referenceSymbol, referenceLocation) { - if (searchSymbols.indexOf(referenceSymbol) >= 0) { - return referenceSymbol; - } - // If the reference symbol is an alias, check if what it is aliasing is one of the search - // symbols but by looking up for related symbol of this alias so it can handle multiple level of indirectness. - var aliasSymbol = getAliasSymbolForPropertyNameSymbol(referenceSymbol, referenceLocation); - if (aliasSymbol) { - return getRelatedSymbol(searchSymbols, aliasSymbol, referenceLocation); - } - // If the reference location is in an object literal, try to get the contextual type for the - // object literal, lookup the property symbol in the contextual type, and use this symbol to - // compare to our searchSymbol - var containingObjectLiteralElement = getContainingObjectLiteralElement(referenceLocation); - if (containingObjectLiteralElement) { - var contextualSymbol = ts.forEach(getPropertySymbolsFromContextualType(containingObjectLiteralElement), function (contextualSymbol) { - return ts.forEach(typeChecker.getRootSymbols(contextualSymbol), function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); - }); - if (contextualSymbol) { - return contextualSymbol; - } - // If the reference location is the name of property from object literal destructuring pattern - // Get the property symbol from the object literal's type and look if thats the search symbol - // In below eg. get 'property' from type of elems iterating type - // for ( { property: p2 } of elems) { } - var propertySymbol = getPropertySymbolOfDestructuringAssignment(referenceLocation); - if (propertySymbol && searchSymbols.indexOf(propertySymbol) >= 0) { - return propertySymbol; - } - } - // If the reference location is the binding element and doesn't have property name - // then include the binding element in the related symbols - // let { a } : { a }; - var bindingElementPropertySymbol = getPropertySymbolOfObjectBindingPatternWithoutPropertyName(referenceSymbol); - if (bindingElementPropertySymbol && searchSymbols.indexOf(bindingElementPropertySymbol) >= 0) { - return bindingElementPropertySymbol; - } - // Unwrap symbols to get to the root (e.g. transient symbols as a result of widening) - // Or a union property, use its underlying unioned symbols - return ts.forEach(typeChecker.getRootSymbols(referenceSymbol), function (rootSymbol) { - // if it is in the list, then we are done - if (searchSymbols.indexOf(rootSymbol) >= 0) { - return rootSymbol; - } - // Finally, try all properties with the same name in any type the containing type extended or implemented, and - // see if any is in the list - if (rootSymbol.parent && rootSymbol.parent.flags & (32 /* Class */ | 64 /* Interface */)) { - var result_5 = []; - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result_5, /*previousIterationSymbolsCache*/ ts.createMap()); - return ts.forEach(result_5, function (s) { return searchSymbols.indexOf(s) >= 0 ? s : undefined; }); - } - return undefined; - }); - } - function getNameFromObjectLiteralElement(node) { - if (node.name.kind === 140 /* 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)) { - return nameExpression.text; - } - return undefined; - } - return node.name.text; - } - function getPropertySymbolsFromContextualType(node) { - var objectLiteral = node.parent; - var contextualType = typeChecker.getContextualType(objectLiteral); - var name = getNameFromObjectLiteralElement(node); - if (name && contextualType) { - var result_6 = []; - var symbol_2 = contextualType.getProperty(name); - if (symbol_2) { - result_6.push(symbol_2); - } - if (contextualType.flags & 524288 /* Union */) { - ts.forEach(contextualType.types, function (t) { - var symbol = t.getProperty(name); - if (symbol) { - result_6.push(symbol); - } - }); - } - return result_6; - } - return undefined; - } - /** Given an initial searchMeaning, extracted from a location, widen the search scope based on the declarations - * of the corresponding symbol. e.g. if we are searching for "Foo" in value position, but "Foo" references a class - * then we need to widen the search to include type positions as well. - * On the contrary, if we are searching for "Bar" in type position and we trace bar to an interface, and an uninstantiated - * module, we want to keep the search limited to only types, as the two declarations (interface and uninstantiated module) - * do not intersect in any of the three spaces. - */ - function getIntersectingMeaningFromDeclarations(meaning, declarations) { - if (declarations) { - var lastIterationMeaning = void 0; - do { - // The result is order-sensitive, for instance if initialMeaning === Namespace, and declarations = [class, instantiated module] - // we need to consider both as they initialMeaning intersects with the module in the namespace space, and the module - // intersects with the class in the value space. - // To achieve that we will keep iterating until the result stabilizes. - // Remember the last meaning - lastIterationMeaning = meaning; - for (var _i = 0, declarations_10 = declarations; _i < declarations_10.length; _i++) { - var declaration = declarations_10[_i]; - var declarationMeaning = getMeaningFromDeclaration(declaration); - if (declarationMeaning & meaning) { - meaning |= declarationMeaning; - } - } - } while (meaning !== lastIterationMeaning); - } - return meaning; - } - } - function getReferenceEntryFromNode(node) { - var start = node.getStart(); - var end = node.getEnd(); - if (node.kind === 9 /* StringLiteral */) { - start += 1; - end -= 1; - } - return { - fileName: node.getSourceFile().fileName, - textSpan: ts.createTextSpanFromBounds(start, end), - isWriteAccess: isWriteAccess(node), - isDefinition: ts.isDeclarationName(node) || ts.isLiteralComputedPropertyDeclarationName(node) - }; - } - /** A node is considered a writeAccess iff it is a name of a declaration or a target of an assignment */ - function isWriteAccess(node) { - if (node.kind === 69 /* Identifier */ && ts.isDeclarationName(node)) { - return true; - } - var parent = node.parent; - if (parent) { - if (parent.kind === 186 /* PostfixUnaryExpression */ || parent.kind === 185 /* PrefixUnaryExpression */) { - return true; - } - else if (parent.kind === 187 /* BinaryExpression */ && parent.left === node) { - var operator = parent.operatorToken.kind; - return 56 /* FirstAssignment */ <= operator && operator <= 68 /* LastAssignment */; - } - } - return false; + return ts.FindAllReferences.findReferencedSymbols(program.getTypeChecker(), cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position, findInStrings, findInComments); } /// NavigateTo - function getNavigateToItems(searchValue, maxResultCount) { + function getNavigateToItems(searchValue, maxResultCount, fileName, excludeDtsFiles) { synchronizeHostData(); - var checker = getProgram().getTypeChecker(); - return ts.NavigateTo.getNavigateToItems(program, checker, cancellationToken, searchValue, maxResultCount); + var sourceFiles = fileName ? [getValidSourceFile(fileName)] : program.getSourceFiles(); + return ts.NavigateTo.getNavigateToItems(sourceFiles, program.getTypeChecker(), cancellationToken, searchValue, maxResultCount, excludeDtsFiles); } - function getEmitOutput(fileName) { + function getEmitOutput(fileName, emitOnlyDtsFiles) { synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); var outputFiles = []; @@ -58606,140 +79644,12 @@ var ts; text: data }); } - var emitOutput = program.emit(sourceFile, writeFile, cancellationToken); + var emitOutput = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles); return { outputFiles: outputFiles, emitSkipped: emitOutput.emitSkipped }; } - function getMeaningFromDeclaration(node) { - switch (node.kind) { - case 142 /* Parameter */: - case 218 /* VariableDeclaration */: - case 169 /* BindingElement */: - case 145 /* PropertyDeclaration */: - case 144 /* PropertySignature */: - case 253 /* PropertyAssignment */: - case 254 /* ShorthandPropertyAssignment */: - case 255 /* EnumMember */: - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - case 148 /* Constructor */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - case 220 /* FunctionDeclaration */: - case 179 /* FunctionExpression */: - case 180 /* ArrowFunction */: - case 252 /* CatchClause */: - return 1 /* Value */; - case 141 /* TypeParameter */: - case 222 /* InterfaceDeclaration */: - case 223 /* TypeAliasDeclaration */: - case 159 /* TypeLiteral */: - return 2 /* Type */; - case 221 /* ClassDeclaration */: - case 224 /* EnumDeclaration */: - return 1 /* Value */ | 2 /* Type */; - case 225 /* ModuleDeclaration */: - if (ts.isAmbientModule(node)) { - return 4 /* Namespace */ | 1 /* Value */; - } - else if (ts.getModuleInstanceState(node) === 1 /* Instantiated */) { - return 4 /* Namespace */ | 1 /* Value */; - } - else { - return 4 /* Namespace */; - } - case 233 /* NamedImports */: - case 234 /* ImportSpecifier */: - case 229 /* ImportEqualsDeclaration */: - case 230 /* ImportDeclaration */: - case 235 /* ExportAssignment */: - case 236 /* ExportDeclaration */: - return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; - // An external module can be a Value - case 256 /* SourceFile */: - return 4 /* Namespace */ | 1 /* Value */; - } - return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; - } - function isTypeReference(node) { - if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { - node = node.parent; - } - return node.parent.kind === 155 /* TypeReference */ || - (node.parent.kind === 194 /* ExpressionWithTypeArguments */ && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || - (node.kind === 97 /* ThisKeyword */ && !ts.isExpression(node)) || - node.kind === 165 /* ThisType */; - } - function isNamespaceReference(node) { - return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node); - } - function isPropertyAccessNamespaceReference(node) { - var root = node; - var isLastClause = true; - if (root.parent.kind === 172 /* PropertyAccessExpression */) { - while (root.parent && root.parent.kind === 172 /* PropertyAccessExpression */) { - root = root.parent; - } - isLastClause = root.name === node; - } - if (!isLastClause && root.parent.kind === 194 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 251 /* HeritageClause */) { - var decl = root.parent.parent.parent; - return (decl.kind === 221 /* ClassDeclaration */ && root.parent.parent.token === 106 /* ImplementsKeyword */) || - (decl.kind === 222 /* InterfaceDeclaration */ && root.parent.parent.token === 83 /* ExtendsKeyword */); - } - return false; - } - function isQualifiedNameNamespaceReference(node) { - var root = node; - var isLastClause = true; - if (root.parent.kind === 139 /* QualifiedName */) { - while (root.parent && root.parent.kind === 139 /* QualifiedName */) { - root = root.parent; - } - isLastClause = root.right === node; - } - return root.parent.kind === 155 /* TypeReference */ && !isLastClause; - } - function isInRightSideOfImport(node) { - while (node.parent.kind === 139 /* QualifiedName */) { - node = node.parent; - } - return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; - } - function getMeaningFromRightHandSideOfImportEquals(node) { - ts.Debug.assert(node.kind === 69 /* Identifier */); - // import a = |b|; // Namespace - // import a = |b.c|; // Value, type, namespace - // import a = |b.c|.d; // Namespace - if (node.parent.kind === 139 /* QualifiedName */ && - node.parent.right === node && - node.parent.parent.kind === 229 /* ImportEqualsDeclaration */) { - return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; - } - return 4 /* Namespace */; - } - function getMeaningFromLocation(node) { - if (node.parent.kind === 235 /* ExportAssignment */) { - return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; - } - else if (isInRightSideOfImport(node)) { - return getMeaningFromRightHandSideOfImportEquals(node); - } - else if (ts.isDeclarationName(node)) { - return getMeaningFromDeclaration(node.parent); - } - else if (isTypeReference(node)) { - return 2 /* Type */; - } - else if (isNamespaceReference(node)) { - return 4 /* Namespace */; - } - else { - return 1 /* Value */; - } - } // Signature help /** * This is a semantic operation. @@ -58756,7 +79666,7 @@ var ts; function getSourceFile(fileName) { return getNonBoundSourceFile(fileName); } - function getNameOrDottedNameSpan(fileName, startPos, endPos) { + function getNameOrDottedNameSpan(fileName, startPos, _endPos) { var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); // Get node at the location var node = ts.getTouchingPropertyName(sourceFile, startPos); @@ -58764,16 +79674,16 @@ var ts; return; } switch (node.kind) { - case 172 /* PropertyAccessExpression */: - case 139 /* QualifiedName */: + case 177 /* PropertyAccessExpression */: + case 141 /* QualifiedName */: case 9 /* StringLiteral */: - case 84 /* FalseKeyword */: - case 99 /* TrueKeyword */: - case 93 /* NullKeyword */: - case 95 /* SuperKeyword */: - case 97 /* ThisKeyword */: - case 165 /* ThisType */: - case 69 /* Identifier */: + case 85 /* FalseKeyword */: + case 100 /* TrueKeyword */: + case 94 /* NullKeyword */: + case 96 /* SuperKeyword */: + case 98 /* ThisKeyword */: + case 167 /* ThisType */: + case 70 /* Identifier */: break; // Cant create the text span default: @@ -58781,15 +79691,15 @@ var ts; } var nodeForStartPos = node; while (true) { - if (isRightSideOfPropertyAccess(nodeForStartPos) || isRightSideOfQualifiedName(nodeForStartPos)) { + if (ts.isRightSideOfPropertyAccess(nodeForStartPos) || ts.isRightSideOfQualifiedName(nodeForStartPos)) { // If on the span is in right side of the the property or qualified name, return the span from the qualified name pos to end of this node nodeForStartPos = nodeForStartPos.parent; } - else if (isNameOfModuleDeclaration(nodeForStartPos)) { + else if (ts.isNameOfModuleDeclaration(nodeForStartPos)) { // If this is name of a module declarations, check if this is right side of dotted module name // If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of // Then this name is name from dotted module - if (nodeForStartPos.parent.parent.kind === 225 /* ModuleDeclaration */ && + if (nodeForStartPos.parent.parent.kind === 230 /* ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { // Use parent module declarations name for start pos nodeForStartPos = nodeForStartPos.parent.parent.name; @@ -58812,469 +79722,38 @@ var ts; return ts.BreakpointResolver.spanInSourceFileAtLocation(sourceFile, position); } function getNavigationBarItems(fileName) { - var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); - return ts.NavigationBar.getNavigationBarItems(sourceFile); + return ts.NavigationBar.getNavigationBarItems(syntaxTreeCache.getCurrentSourceFile(fileName)); + } + function getNavigationTree(fileName) { + return ts.NavigationBar.getNavigationTree(syntaxTreeCache.getCurrentSourceFile(fileName)); + } + function isTsOrTsxFile(fileName) { + var kind = ts.getScriptKind(fileName, host); + return kind === 3 /* TS */ || kind === 4 /* TSX */; } function getSemanticClassifications(fileName, span) { - return convertClassifications(getEncodedSemanticClassifications(fileName, span)); - } - function checkForClassificationCancellation(kind) { - // We don't want to actually call back into our host on every node to find out if we've - // been canceled. That would be an enormous amount of chattyness, along with the all - // the overhead of marshalling the data to/from the host. So instead we pick a few - // reasonable node kinds to bother checking on. These node kinds represent high level - // constructs that we would expect to see commonly, but just at a far less frequent - // interval. - // - // For example, in checker.ts (around 750k) we only have around 600 of these constructs. - // That means we're calling back into the host around every 1.2k of the file we process. - // Lib.d.ts has similar numbers. - switch (kind) { - case 225 /* ModuleDeclaration */: - case 221 /* ClassDeclaration */: - case 222 /* InterfaceDeclaration */: - case 220 /* FunctionDeclaration */: - cancellationToken.throwIfCancellationRequested(); + if (!isTsOrTsxFile(fileName)) { + // do not run semantic classification on non-ts-or-tsx files + return []; } + synchronizeHostData(); + return ts.getSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span); } function getEncodedSemanticClassifications(fileName, span) { + if (!isTsOrTsxFile(fileName)) { + // do not run semantic classification on non-ts-or-tsx files + return { spans: [], endOfLineState: 0 /* None */ }; + } synchronizeHostData(); - var sourceFile = getValidSourceFile(fileName); - var typeChecker = program.getTypeChecker(); - var result = []; - var classifiableNames = program.getClassifiableNames(); - processNode(sourceFile); - return { spans: result, endOfLineState: 0 /* None */ }; - function pushClassification(start, length, type) { - result.push(start); - result.push(length); - result.push(type); - } - function classifySymbol(symbol, meaningAtPosition) { - var flags = symbol.getFlags(); - if ((flags & 788448 /* Classifiable */) === 0 /* None */) { - return; - } - if (flags & 32 /* Class */) { - return 11 /* className */; - } - else if (flags & 384 /* Enum */) { - return 12 /* enumName */; - } - else if (flags & 524288 /* TypeAlias */) { - return 16 /* typeAliasName */; - } - else if (meaningAtPosition & 2 /* Type */) { - if (flags & 64 /* Interface */) { - return 13 /* interfaceName */; - } - else if (flags & 262144 /* TypeParameter */) { - return 15 /* typeParameterName */; - } - } - else if (flags & 1536 /* Module */) { - // Only classify a module as such if - // - It appears in a namespace context. - // - There exists a module declaration which actually impacts the value side. - if (meaningAtPosition & 4 /* Namespace */ || - (meaningAtPosition & 1 /* Value */ && hasValueSideModule(symbol))) { - return 14 /* moduleName */; - } - } - return undefined; - /** - * Returns true if there exists a module that introduces entities on the value side. - */ - function hasValueSideModule(symbol) { - return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 225 /* ModuleDeclaration */ && - ts.getModuleInstanceState(declaration) === 1 /* Instantiated */; - }); - } - } - function processNode(node) { - // Only walk into nodes that intersect the requested span. - if (node && ts.textSpanIntersectsWith(span, node.getFullStart(), node.getFullWidth())) { - var kind = node.kind; - checkForClassificationCancellation(kind); - if (kind === 69 /* Identifier */ && !ts.nodeIsMissing(node)) { - var identifier = node; - // Only bother calling into the typechecker if this is an identifier that - // could possibly resolve to a type name. This makes classification run - // in a third of the time it would normally take. - if (classifiableNames[identifier.text]) { - var symbol = typeChecker.getSymbolAtLocation(node); - if (symbol) { - var type = classifySymbol(symbol, getMeaningFromLocation(node)); - if (type) { - pushClassification(node.getStart(), node.getWidth(), type); - } - } - } - } - ts.forEachChild(node, processNode); - } - } - } - function getClassificationTypeName(type) { - switch (type) { - case 1 /* comment */: return ClassificationTypeNames.comment; - case 2 /* identifier */: return ClassificationTypeNames.identifier; - case 3 /* keyword */: return ClassificationTypeNames.keyword; - case 4 /* numericLiteral */: return ClassificationTypeNames.numericLiteral; - case 5 /* operator */: return ClassificationTypeNames.operator; - case 6 /* stringLiteral */: return ClassificationTypeNames.stringLiteral; - case 8 /* whiteSpace */: return ClassificationTypeNames.whiteSpace; - case 9 /* text */: return ClassificationTypeNames.text; - case 10 /* punctuation */: return ClassificationTypeNames.punctuation; - case 11 /* className */: return ClassificationTypeNames.className; - case 12 /* enumName */: return ClassificationTypeNames.enumName; - case 13 /* interfaceName */: return ClassificationTypeNames.interfaceName; - case 14 /* moduleName */: return ClassificationTypeNames.moduleName; - case 15 /* typeParameterName */: return ClassificationTypeNames.typeParameterName; - case 16 /* typeAliasName */: return ClassificationTypeNames.typeAliasName; - case 17 /* parameterName */: return ClassificationTypeNames.parameterName; - case 18 /* docCommentTagName */: return ClassificationTypeNames.docCommentTagName; - case 19 /* jsxOpenTagName */: return ClassificationTypeNames.jsxOpenTagName; - case 20 /* jsxCloseTagName */: return ClassificationTypeNames.jsxCloseTagName; - case 21 /* jsxSelfClosingTagName */: return ClassificationTypeNames.jsxSelfClosingTagName; - case 22 /* jsxAttribute */: return ClassificationTypeNames.jsxAttribute; - case 23 /* jsxText */: return ClassificationTypeNames.jsxText; - case 24 /* jsxAttributeStringLiteralValue */: return ClassificationTypeNames.jsxAttributeStringLiteralValue; - } - } - function convertClassifications(classifications) { - ts.Debug.assert(classifications.spans.length % 3 === 0); - var dense = classifications.spans; - var result = []; - for (var i = 0, n = dense.length; i < n; i += 3) { - result.push({ - textSpan: ts.createTextSpan(dense[i], dense[i + 1]), - classificationType: getClassificationTypeName(dense[i + 2]) - }); - } - return result; + return ts.getEncodedSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span); } function getSyntacticClassifications(fileName, span) { - return convertClassifications(getEncodedSyntacticClassifications(fileName, span)); + // doesn't use compiler - no need to synchronize with host + return ts.getSyntacticClassifications(cancellationToken, syntaxTreeCache.getCurrentSourceFile(fileName), span); } function getEncodedSyntacticClassifications(fileName, span) { // doesn't use compiler - no need to synchronize with host - var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); - var spanStart = span.start; - var spanLength = span.length; - // Make a scanner we can get trivia from. - var triviaScanner = ts.createScanner(2 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text); - var mergeConflictScanner = ts.createScanner(2 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text); - var result = []; - processElement(sourceFile); - return { spans: result, endOfLineState: 0 /* None */ }; - function pushClassification(start, length, type) { - result.push(start); - result.push(length); - result.push(type); - } - function classifyLeadingTriviaAndGetTokenStart(token) { - triviaScanner.setTextPos(token.pos); - while (true) { - var start = triviaScanner.getTextPos(); - // only bother scanning if we have something that could be trivia. - if (!ts.couldStartTrivia(sourceFile.text, start)) { - return start; - } - var kind = triviaScanner.scan(); - var end = triviaScanner.getTextPos(); - var width = end - start; - // The moment we get something that isn't trivia, then stop processing. - if (!ts.isTrivia(kind)) { - return start; - } - // Don't bother with newlines/whitespace. - if (kind === 4 /* NewLineTrivia */ || kind === 5 /* WhitespaceTrivia */) { - continue; - } - // Only bother with the trivia if it at least intersects the span of interest. - if (ts.isComment(kind)) { - classifyComment(token, kind, start, width); - // Classifying a comment might cause us to reuse the trivia scanner - // (because of jsdoc comments). So after we classify the comment make - // sure we set the scanner position back to where it needs to be. - triviaScanner.setTextPos(end); - continue; - } - if (kind === 7 /* ConflictMarkerTrivia */) { - var text = sourceFile.text; - var ch = text.charCodeAt(start); - // for the <<<<<<< and >>>>>>> markers, we just add them in as comments - // in the classification stream. - if (ch === 60 /* lessThan */ || ch === 62 /* greaterThan */) { - pushClassification(start, width, 1 /* comment */); - continue; - } - // for the ======== add a comment for the first line, and then lex all - // subsequent lines up until the end of the conflict marker. - ts.Debug.assert(ch === 61 /* equals */); - classifyDisabledMergeCode(text, start, end); - } - } - } - function classifyComment(token, kind, start, width) { - if (kind === 3 /* MultiLineCommentTrivia */) { - // See if this is a doc comment. If so, we'll classify certain portions of it - // specially. - var docCommentAndDiagnostics = ts.parseIsolatedJSDocComment(sourceFile.text, start, width); - if (docCommentAndDiagnostics && docCommentAndDiagnostics.jsDocComment) { - docCommentAndDiagnostics.jsDocComment.parent = token; - classifyJSDocComment(docCommentAndDiagnostics.jsDocComment); - return; - } - } - // Simple comment. Just add as is. - pushCommentRange(start, width); - } - function pushCommentRange(start, width) { - pushClassification(start, width, 1 /* comment */); - } - function classifyJSDocComment(docComment) { - var pos = docComment.pos; - for (var _i = 0, _a = docComment.tags; _i < _a.length; _i++) { - var tag = _a[_i]; - // As we walk through each tag, classify the portion of text from the end of - // the last tag (or the start of the entire doc comment) as 'comment'. - if (tag.pos !== pos) { - pushCommentRange(pos, tag.pos - pos); - } - pushClassification(tag.atToken.pos, tag.atToken.end - tag.atToken.pos, 10 /* punctuation */); - pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); - pos = tag.tagName.end; - switch (tag.kind) { - case 275 /* JSDocParameterTag */: - processJSDocParameterTag(tag); - break; - case 278 /* JSDocTemplateTag */: - processJSDocTemplateTag(tag); - break; - case 277 /* JSDocTypeTag */: - processElement(tag.typeExpression); - break; - case 276 /* JSDocReturnTag */: - processElement(tag.typeExpression); - break; - } - pos = tag.end; - } - if (pos !== docComment.end) { - pushCommentRange(pos, docComment.end - pos); - } - return; - function processJSDocParameterTag(tag) { - if (tag.preParameterName) { - pushCommentRange(pos, tag.preParameterName.pos - pos); - pushClassification(tag.preParameterName.pos, tag.preParameterName.end - tag.preParameterName.pos, 17 /* parameterName */); - pos = tag.preParameterName.end; - } - if (tag.typeExpression) { - pushCommentRange(pos, tag.typeExpression.pos - pos); - processElement(tag.typeExpression); - pos = tag.typeExpression.end; - } - if (tag.postParameterName) { - pushCommentRange(pos, tag.postParameterName.pos - pos); - pushClassification(tag.postParameterName.pos, tag.postParameterName.end - tag.postParameterName.pos, 17 /* parameterName */); - pos = tag.postParameterName.end; - } - } - } - function processJSDocTemplateTag(tag) { - for (var _i = 0, _a = tag.getChildren(); _i < _a.length; _i++) { - var child = _a[_i]; - processElement(child); - } - } - function classifyDisabledMergeCode(text, start, end) { - // Classify the line that the ======= marker is on as a comment. Then just lex - // all further tokens and add them to the result. - var i; - for (i = start; i < end; i++) { - if (ts.isLineBreak(text.charCodeAt(i))) { - break; - } - } - pushClassification(start, i - start, 1 /* comment */); - mergeConflictScanner.setTextPos(i); - while (mergeConflictScanner.getTextPos() < end) { - classifyDisabledCodeToken(); - } - } - function classifyDisabledCodeToken() { - var start = mergeConflictScanner.getTextPos(); - var tokenKind = mergeConflictScanner.scan(); - var end = mergeConflictScanner.getTextPos(); - var type = classifyTokenType(tokenKind); - if (type) { - pushClassification(start, end - start, type); - } - } - /** - * Returns true if node should be treated as classified and no further processing is required. - * False will mean that node is not classified and traverse routine should recurse into node contents. - */ - function tryClassifyNode(node) { - if (ts.isJSDocTag(node)) { - return true; - } - if (ts.nodeIsMissing(node)) { - return true; - } - var classifiedElementName = tryClassifyJsxElementName(node); - if (!ts.isToken(node) && node.kind !== 244 /* JsxText */ && classifiedElementName === undefined) { - return false; - } - var tokenStart = node.kind === 244 /* JsxText */ ? node.pos : classifyLeadingTriviaAndGetTokenStart(node); - var tokenWidth = node.end - tokenStart; - ts.Debug.assert(tokenWidth >= 0); - if (tokenWidth > 0) { - var type = classifiedElementName || classifyTokenType(node.kind, node); - if (type) { - pushClassification(tokenStart, tokenWidth, type); - } - } - return true; - } - function tryClassifyJsxElementName(token) { - switch (token.parent && token.parent.kind) { - case 243 /* JsxOpeningElement */: - if (token.parent.tagName === token) { - return 19 /* jsxOpenTagName */; - } - break; - case 245 /* JsxClosingElement */: - if (token.parent.tagName === token) { - return 20 /* jsxCloseTagName */; - } - break; - case 242 /* JsxSelfClosingElement */: - if (token.parent.tagName === token) { - return 21 /* jsxSelfClosingTagName */; - } - break; - case 246 /* JsxAttribute */: - if (token.parent.name === token) { - return 22 /* jsxAttribute */; - } - break; - } - return undefined; - } - // for accurate classification, the actual token should be passed in. however, for - // cases like 'disabled merge code' classification, we just get the token kind and - // classify based on that instead. - function classifyTokenType(tokenKind, token) { - if (ts.isKeyword(tokenKind)) { - return 3 /* keyword */; - } - // Special case < and > If they appear in a generic context they are punctuation, - // not operators. - if (tokenKind === 25 /* LessThanToken */ || tokenKind === 27 /* GreaterThanToken */) { - // If the node owning the token has a type argument list or type parameter list, then - // we can effectively assume that a '<' and '>' belong to those lists. - if (token && ts.getTypeArgumentOrTypeParameterList(token.parent)) { - return 10 /* punctuation */; - } - } - if (ts.isPunctuation(tokenKind)) { - if (token) { - if (tokenKind === 56 /* EqualsToken */) { - // the '=' in a variable declaration is special cased here. - if (token.parent.kind === 218 /* VariableDeclaration */ || - token.parent.kind === 145 /* PropertyDeclaration */ || - token.parent.kind === 142 /* Parameter */ || - token.parent.kind === 246 /* JsxAttribute */) { - return 5 /* operator */; - } - } - if (token.parent.kind === 187 /* BinaryExpression */ || - token.parent.kind === 185 /* PrefixUnaryExpression */ || - token.parent.kind === 186 /* PostfixUnaryExpression */ || - token.parent.kind === 188 /* ConditionalExpression */) { - return 5 /* operator */; - } - } - return 10 /* punctuation */; - } - else if (tokenKind === 8 /* NumericLiteral */) { - return 4 /* numericLiteral */; - } - else if (tokenKind === 9 /* StringLiteral */) { - return token.parent.kind === 246 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; - } - else if (tokenKind === 10 /* RegularExpressionLiteral */) { - // TODO: we should get another classification type for these literals. - return 6 /* stringLiteral */; - } - else if (ts.isTemplateLiteralKind(tokenKind)) { - // TODO (drosen): we should *also* get another classification type for these literals. - return 6 /* stringLiteral */; - } - else if (tokenKind === 244 /* JsxText */) { - return 23 /* jsxText */; - } - else if (tokenKind === 69 /* Identifier */) { - if (token) { - switch (token.parent.kind) { - case 221 /* ClassDeclaration */: - if (token.parent.name === token) { - return 11 /* className */; - } - return; - case 141 /* TypeParameter */: - if (token.parent.name === token) { - return 15 /* typeParameterName */; - } - return; - case 222 /* InterfaceDeclaration */: - if (token.parent.name === token) { - return 13 /* interfaceName */; - } - return; - case 224 /* EnumDeclaration */: - if (token.parent.name === token) { - return 12 /* enumName */; - } - return; - case 225 /* ModuleDeclaration */: - if (token.parent.name === token) { - return 14 /* moduleName */; - } - return; - case 142 /* Parameter */: - if (token.parent.name === token) { - var isThis_1 = token.kind === 69 /* Identifier */ && token.originalKeywordKind === 97 /* ThisKeyword */; - return isThis_1 ? 3 /* keyword */ : 17 /* parameterName */; - } - return; - } - } - return 2 /* identifier */; - } - } - function processElement(element) { - if (!element) { - return; - } - // Ignore nodes that don't intersect the original span to classify. - if (ts.decodedTextSpanIntersectsWith(spanStart, spanLength, element.pos, element.getFullWidth())) { - checkForClassificationCancellation(element.kind); - var children = element.getChildren(sourceFile); - for (var i = 0, n = children.length; i < n; i++) { - var child = children[i]; - if (!tryClassifyNode(child)) { - // Recurse into our child nodes. - processElement(child); - } - } - } - } + return ts.getEncodedSyntacticClassifications(cancellationToken, syntaxTreeCache.getCurrentSourceFile(fileName), span); } function getOutliningSpans(fileName) { // doesn't use compiler - no need to synchronize with host @@ -59311,135 +79790,78 @@ var ts; return result; function getMatchingTokenKind(token) { switch (token.kind) { - case 15 /* OpenBraceToken */: return 16 /* CloseBraceToken */; - case 17 /* OpenParenToken */: return 18 /* CloseParenToken */; - case 19 /* OpenBracketToken */: return 20 /* CloseBracketToken */; - case 25 /* LessThanToken */: return 27 /* GreaterThanToken */; - case 16 /* CloseBraceToken */: return 15 /* OpenBraceToken */; - case 18 /* CloseParenToken */: return 17 /* OpenParenToken */; - case 20 /* CloseBracketToken */: return 19 /* OpenBracketToken */; - case 27 /* GreaterThanToken */: return 25 /* LessThanToken */; + case 16 /* OpenBraceToken */: return 17 /* CloseBraceToken */; + case 18 /* OpenParenToken */: return 19 /* CloseParenToken */; + case 20 /* OpenBracketToken */: return 21 /* CloseBracketToken */; + case 26 /* LessThanToken */: return 28 /* GreaterThanToken */; + case 17 /* CloseBraceToken */: return 16 /* OpenBraceToken */; + case 19 /* CloseParenToken */: return 18 /* OpenParenToken */; + case 21 /* CloseBracketToken */: return 20 /* OpenBracketToken */; + case 28 /* GreaterThanToken */: return 26 /* LessThanToken */; } return undefined; } } function getIndentationAtPosition(fileName, position, editorOptions) { var start = ts.timestamp(); + var settings = toEditorSettings(editorOptions); var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); log("getIndentationAtPosition: getCurrentSourceFile: " + (ts.timestamp() - start)); start = ts.timestamp(); - var result = ts.formatting.SmartIndenter.getIndentation(position, sourceFile, editorOptions); + var result = ts.formatting.SmartIndenter.getIndentation(position, sourceFile, settings); log("getIndentationAtPosition: computeIndentation : " + (ts.timestamp() - start)); return result; } function getFormattingEditsForRange(fileName, start, end, options) { var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); - return ts.formatting.formatSelection(start, end, sourceFile, getRuleProvider(options), options); + var settings = toEditorSettings(options); + return ts.formatting.formatSelection(start, end, sourceFile, getRuleProvider(settings), settings); } function getFormattingEditsForDocument(fileName, options) { var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); - return ts.formatting.formatDocument(sourceFile, getRuleProvider(options), options); + var settings = toEditorSettings(options); + return ts.formatting.formatDocument(sourceFile, getRuleProvider(settings), settings); } function getFormattingEditsAfterKeystroke(fileName, position, key, options) { var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + var settings = toEditorSettings(options); if (key === "}") { - return ts.formatting.formatOnClosingCurly(position, sourceFile, getRuleProvider(options), options); + return ts.formatting.formatOnClosingCurly(position, sourceFile, getRuleProvider(settings), settings); } else if (key === ";") { - return ts.formatting.formatOnSemicolon(position, sourceFile, getRuleProvider(options), options); + return ts.formatting.formatOnSemicolon(position, sourceFile, getRuleProvider(settings), settings); } else if (key === "\n") { - return ts.formatting.formatOnEnter(position, sourceFile, getRuleProvider(options), options); + return ts.formatting.formatOnEnter(position, sourceFile, getRuleProvider(settings), settings); } return []; } - /** - * Checks if position points to a valid position to add JSDoc comments, and if so, - * returns the appropriate template. Otherwise returns an empty string. - * Valid positions are - * - outside of comments, statements, and expressions, and - * - preceding a: - * - function/constructor/method declaration - * - class declarations - * - variable statements - * - namespace declarations - * - * Hosts should ideally check that: - * - The line is all whitespace up to 'position' before performing the insertion. - * - If the keystroke sequence "/\*\*" induced the call, we also check that the next - * non-whitespace character is '*', which (approximately) indicates whether we added - * the second '*' to complete an existing (JSDoc) comment. - * @param fileName The file in which to perform the check. - * @param position The (character-indexed) position in the file where the check should - * be performed. - */ - function getDocCommentTemplateAtPosition(fileName, position) { - var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); - // Check if in a context where we don't want to perform any insertion - if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position) || ts.hasDocComment(sourceFile, position)) { - return undefined; - } - var tokenAtPos = ts.getTokenAtPosition(sourceFile, position); - var tokenStart = tokenAtPos.getStart(); - if (!tokenAtPos || tokenStart < position) { - return undefined; - } - // TODO: add support for: - // - enums/enum members - // - interfaces - // - property declarations - // - potentially property assignments - var commentOwner; - findOwner: for (commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) { - switch (commentOwner.kind) { - case 220 /* FunctionDeclaration */: - case 147 /* MethodDeclaration */: - case 148 /* Constructor */: - case 221 /* ClassDeclaration */: - case 200 /* VariableStatement */: - break findOwner; - case 256 /* SourceFile */: - return undefined; - case 225 /* ModuleDeclaration */: - // If in walking up the tree, we hit a a nested namespace declaration, - // then we must be somewhere within a dotted namespace name; however we don't - // want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'. - if (commentOwner.parent.kind === 225 /* ModuleDeclaration */) { - return undefined; - } - break findOwner; + function getCodeFixesAtPosition(fileName, start, end, errorCodes) { + synchronizeHostData(); + var sourceFile = getValidSourceFile(fileName); + var span = { start: start, length: end - start }; + var newLineChar = ts.getNewLineOrDefaultFromHost(host); + var allFixes = []; + ts.forEach(errorCodes, function (error) { + cancellationToken.throwIfCancellationRequested(); + var context = { + errorCode: error, + sourceFile: sourceFile, + span: span, + program: program, + newLineCharacter: newLineChar, + host: host, + cancellationToken: cancellationToken + }; + var fixes = ts.codefix.getFixes(context); + if (fixes) { + allFixes = allFixes.concat(fixes); } - } - if (!commentOwner || commentOwner.getStart() < position) { - return undefined; - } - var parameters = getParametersForJsDocOwningNode(commentOwner); - var posLineAndChar = sourceFile.getLineAndCharacterOfPosition(position); - var lineStart = sourceFile.getLineStarts()[posLineAndChar.line]; - var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character); - var newLine = ts.getNewLineOrDefaultFromHost(host); - var docParams = ""; - for (var i = 0, numParams = parameters.length; i < numParams; i++) { - var currentName = parameters[i].name; - var paramName = currentName.kind === 69 /* Identifier */ ? - currentName.text : - "param" + i; - docParams += indentationStr + " * @param " + paramName + newLine; - } - // A doc comment consists of the following - // * The opening comment line - // * the first line (without a param) for the object's untagged info (this is also where the caret ends up) - // * the '@param'-tagged lines - // * TODO: other tags. - // * the closing comment line - // * if the caret was directly in front of the object, then we add an extra line and indentation. - var preamble = "/**" + newLine + - indentationStr + " * "; - var result = preamble + newLine + - docParams + - indentationStr + " */" + - (tokenStart === position ? newLine + indentationStr : ""); - return { newText: result, caretOffset: preamble.length }; + }); + return allFixes; + } + function getDocCommentTemplateAtPosition(fileName, position) { + return ts.JsDoc.getDocCommentTemplateAtPosition(ts.getNewLineOrDefaultFromHost(host), syntaxTreeCache.getCurrentSourceFile(fileName), position); } function isValidBraceCompletionAtPosition(fileName, position, openingBrace) { // '<' is currently not supported, figuring out if we're in a Generic Type vs. a comparison is too @@ -59453,7 +79875,7 @@ var ts; } var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); // Check if in a context where we don't want to perform any insertion - if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position)) { + if (ts.isInString(sourceFile, position)) { return false; } if (ts.isInsideJsxElementOrAttribute(sourceFile, position)) { @@ -59464,46 +79886,6 @@ var ts; } return true; } - function getParametersForJsDocOwningNode(commentOwner) { - if (ts.isFunctionLike(commentOwner)) { - return commentOwner.parameters; - } - if (commentOwner.kind === 200 /* VariableStatement */) { - var varStatement = commentOwner; - var varDeclarations = varStatement.declarationList.declarations; - if (varDeclarations.length === 1 && varDeclarations[0].initializer) { - return getParametersFromRightHandSideOfAssignment(varDeclarations[0].initializer); - } - } - return emptyArray; - } - /** - * Digs into an an initializer or RHS operand of an assignment operation - * to get the parameters of an apt signature corresponding to a - * function expression or a class expression. - * - * @param rightHandSide the expression which may contain an appropriate set of parameters - * @returns the parameters of a signature found on the RHS if one exists; otherwise 'emptyArray'. - */ - function getParametersFromRightHandSideOfAssignment(rightHandSide) { - while (rightHandSide.kind === 178 /* ParenthesizedExpression */) { - rightHandSide = rightHandSide.expression; - } - switch (rightHandSide.kind) { - case 179 /* FunctionExpression */: - case 180 /* ArrowFunction */: - return rightHandSide.parameters; - case 192 /* ClassExpression */: - for (var _i = 0, _a = rightHandSide.members; _i < _a.length; _i++) { - var member = _a[_i]; - if (member.kind === 148 /* Constructor */) { - return member.parameters; - } - } - break; - } - return emptyArray; - } function getTodoComments(fileName, descriptors) { // Note: while getting todo comments seems like a syntactic operation, we actually // treat it as a semantic operation here. This is because we expect our host to call @@ -59545,7 +79927,7 @@ var ts; // OK, we have found a match in the file. This is only an acceptable match if // it is contained within a comment. var token = ts.getTokenAtPosition(sourceFile, matchPosition); - if (!isInsideComment(sourceFile, token, matchPosition)) { + if (!ts.isInsideComment(sourceFile, token, matchPosition)) { continue; } var descriptor = undefined; @@ -59628,104 +80010,10 @@ var ts; (char >= 48 /* _0 */ && char <= 57 /* _9 */); } } - function getStringLiteralTypeForNode(node, typeChecker) { - var searchNode = node.parent.kind === 166 /* LiteralType */ ? node.parent : node; - var type = typeChecker.getTypeAtLocation(searchNode); - if (type && type.flags & 32 /* StringLiteral */) { - return type; - } - return undefined; - } function getRenameInfo(fileName, position) { synchronizeHostData(); - var sourceFile = getValidSourceFile(fileName); - var typeChecker = program.getTypeChecker(); var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); - var canonicalDefaultLibName = getCanonicalFileName(ts.normalizePath(defaultLibFileName)); - var node = ts.getTouchingWord(sourceFile, position, /*includeJsDocComment*/ true); - if (node) { - if (node.kind === 69 /* Identifier */ || - node.kind === 9 /* StringLiteral */ || - isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || - isThis(node)) { - var symbol = typeChecker.getSymbolAtLocation(node); - // Only allow a symbol to be renamed if it actually has at least one declaration. - if (symbol) { - var declarations = symbol.getDeclarations(); - if (declarations && declarations.length > 0) { - // Disallow rename for elements that are defined in the standard TypeScript library. - if (ts.forEach(declarations, isDefinedInLibraryFile)) { - return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); - } - var displayName = ts.stripQuotes(ts.getDeclaredName(typeChecker, symbol, node)); - var kind = getSymbolKind(symbol, node); - if (kind) { - return { - canRename: true, - kind: kind, - displayName: displayName, - localizedErrorMessage: undefined, - fullDisplayName: typeChecker.getFullyQualifiedName(symbol), - kindModifiers: getSymbolModifiers(symbol), - triggerSpan: createTriggerSpanForNode(node, sourceFile) - }; - } - } - } - else if (node.kind === 9 /* StringLiteral */) { - var type = getStringLiteralTypeForNode(node, typeChecker); - if (type) { - if (isDefinedInLibraryFile(node)) { - return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library)); - } - else { - var displayName = ts.stripQuotes(type.text); - return { - canRename: true, - kind: ScriptElementKind.variableElement, - displayName: displayName, - localizedErrorMessage: undefined, - fullDisplayName: displayName, - kindModifiers: ScriptElementKindModifier.none, - triggerSpan: createTriggerSpanForNode(node, sourceFile) - }; - } - } - } - } - } - return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_this_element)); - function getRenameInfoError(localizedErrorMessage) { - return { - canRename: false, - localizedErrorMessage: localizedErrorMessage, - displayName: undefined, - fullDisplayName: undefined, - kind: undefined, - kindModifiers: undefined, - triggerSpan: undefined - }; - } - function isDefinedInLibraryFile(declaration) { - if (defaultLibFileName) { - var sourceFile_2 = declaration.getSourceFile(); - var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile_2.fileName)); - if (canonicalName === canonicalDefaultLibName) { - return true; - } - } - return false; - } - function createTriggerSpanForNode(node, sourceFile) { - var start = node.getStart(sourceFile); - var width = node.getWidth(sourceFile); - if (node.kind === 9 /* StringLiteral */) { - // Exclude the quotes - start += 1; - width -= 2; - } - return ts.createTextSpan(start, width); - } + return ts.Rename.getRenameInfo(program.getTypeChecker(), defaultLibFileName, getCanonicalFileName, getValidSourceFile(fileName), position); } return { dispose: dispose, @@ -59739,9 +80027,11 @@ var ts; getEncodedSemanticClassifications: getEncodedSemanticClassifications, getCompletionsAtPosition: getCompletionsAtPosition, getCompletionEntryDetails: getCompletionEntryDetails, + getCompletionEntrySymbol: getCompletionEntrySymbol, getSignatureHelpItems: getSignatureHelpItems, getQuickInfoAtPosition: getQuickInfoAtPosition, getDefinitionAtPosition: getDefinitionAtPosition, + getImplementationAtPosition: getImplementationAtPosition, getTypeDefinitionAtPosition: getTypeDefinitionAtPosition, getReferencesAtPosition: getReferencesAtPosition, findReferences: findReferences, @@ -59753,6 +80043,7 @@ var ts; getRenameInfo: getRenameInfo, findRenameLocations: findRenameLocations, getNavigationBarItems: getNavigationBarItems, + getNavigationTree: getNavigationTree, getOutliningSpans: getOutliningSpans, getTodoComments: getTodoComments, getBraceMatchingAtPosition: getBraceMatchingAtPosition, @@ -59762,6 +80053,7 @@ var ts; getFormattingEditsAfterKeystroke: getFormattingEditsAfterKeystroke, getDocCommentTemplateAtPosition: getDocCommentTemplateAtPosition, isValidBraceCompletionAtPosition: isValidBraceCompletionAtPosition, + getCodeFixesAtPosition: getCodeFixesAtPosition, getEmitOutput: getEmitOutput, getNonBoundSourceFile: getNonBoundSourceFile, getSourceFile: getSourceFile, @@ -59783,7 +80075,7 @@ var ts; sourceFile.nameTable = nameTable; function walk(node) { switch (node.kind) { - case 69 /* Identifier */: + case 70 /* Identifier */: nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; break; case 9 /* StringLiteral */: @@ -59793,7 +80085,7 @@ var ts; // then we want 'something' to be in the name table. Similarly, if we have // "a['propname']" then we want to store "propname" in the name table. if (ts.isDeclarationName(node) || - node.parent.kind === 240 /* ExternalModuleReference */ || + node.parent.kind === 245 /* ExternalModuleReference */ || isArgumentOfElementAccessExpression(node) || ts.isLiteralComputedPropertyDeclarationName(node)) { nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; @@ -59801,10 +80093,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); } } } @@ -59813,428 +80105,9 @@ var ts; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 173 /* ElementAccessExpression */ && + node.parent.kind === 178 /* ElementAccessExpression */ && node.parent.argumentExpression === node; } - /// Classifier - function createClassifier() { - var scanner = ts.createScanner(2 /* Latest */, /*skipTrivia*/ false); - /// We do not have a full parser support to know when we should parse a regex or not - /// If we consider every slash token to be a regex, we could be missing cases like "1/2/3", where - /// we have a series of divide operator. this list allows us to be more accurate by ruling out - /// locations where a regexp cannot exist. - var noRegexTable = []; - noRegexTable[69 /* Identifier */] = true; - noRegexTable[9 /* StringLiteral */] = true; - noRegexTable[8 /* NumericLiteral */] = true; - noRegexTable[10 /* RegularExpressionLiteral */] = true; - noRegexTable[97 /* ThisKeyword */] = true; - noRegexTable[41 /* PlusPlusToken */] = true; - noRegexTable[42 /* MinusMinusToken */] = true; - noRegexTable[18 /* CloseParenToken */] = true; - noRegexTable[20 /* CloseBracketToken */] = true; - noRegexTable[16 /* CloseBraceToken */] = true; - noRegexTable[99 /* TrueKeyword */] = true; - noRegexTable[84 /* FalseKeyword */] = true; - // Just a stack of TemplateHeads and OpenCurlyBraces, used to perform rudimentary (inexact) - // classification on template strings. Because of the context free nature of templates, - // the only precise way to classify a template portion would be by propagating the stack across - // lines, just as we do with the end-of-line state. However, this is a burden for implementers, - // and the behavior is entirely subsumed by the syntactic classifier anyway, so we instead - // flatten any nesting when the template stack is non-empty and encode it in the end-of-line state. - // Situations in which this fails are - // 1) When template strings are nested across different lines: - // `hello ${ `world - // ` }` - // - // Where on the second line, you will get the closing of a template, - // a closing curly, and a new template. - // - // 2) When substitution expressions have curly braces and the curly brace falls on the next line: - // `hello ${ () => { - // return "world" } } ` - // - // Where on the second line, you will get the 'return' keyword, - // a string literal, and a template end consisting of '} } `'. - var templateStack = []; - /** Returns true if 'keyword2' can legally follow 'keyword1' in any language construct. */ - function canFollow(keyword1, keyword2) { - if (ts.isAccessibilityModifier(keyword1)) { - if (keyword2 === 123 /* GetKeyword */ || - keyword2 === 131 /* SetKeyword */ || - keyword2 === 121 /* ConstructorKeyword */ || - keyword2 === 113 /* StaticKeyword */) { - // Allow things like "public get", "public constructor" and "public static". - // These are all legal. - return true; - } - // Any other keyword following "public" is actually an identifier an not a real - // keyword. - return false; - } - // Assume any other keyword combination is legal. This can be refined in the future - // if there are more cases we want the classifier to be better at. - return true; - } - function convertClassifications(classifications, text) { - var entries = []; - var dense = classifications.spans; - var lastEnd = 0; - for (var i = 0, n = dense.length; i < n; i += 3) { - var start = dense[i]; - var length_4 = dense[i + 1]; - var type = dense[i + 2]; - // Make a whitespace entry between the last item and this one. - if (lastEnd >= 0) { - var whitespaceLength_1 = start - lastEnd; - if (whitespaceLength_1 > 0) { - entries.push({ length: whitespaceLength_1, classification: TokenClass.Whitespace }); - } - } - entries.push({ length: length_4, classification: convertClassification(type) }); - lastEnd = start + length_4; - } - var whitespaceLength = text.length - lastEnd; - if (whitespaceLength > 0) { - entries.push({ length: whitespaceLength, classification: TokenClass.Whitespace }); - } - return { entries: entries, finalLexState: classifications.endOfLineState }; - } - function convertClassification(type) { - switch (type) { - case 1 /* comment */: return TokenClass.Comment; - case 3 /* keyword */: return TokenClass.Keyword; - case 4 /* numericLiteral */: return TokenClass.NumberLiteral; - case 5 /* operator */: return TokenClass.Operator; - case 6 /* stringLiteral */: return TokenClass.StringLiteral; - case 8 /* whiteSpace */: return TokenClass.Whitespace; - case 10 /* punctuation */: return TokenClass.Punctuation; - case 2 /* identifier */: - case 11 /* className */: - case 12 /* enumName */: - case 13 /* interfaceName */: - case 14 /* moduleName */: - case 15 /* typeParameterName */: - case 16 /* typeAliasName */: - case 9 /* text */: - case 17 /* parameterName */: - default: - return TokenClass.Identifier; - } - } - function getClassificationsForLine(text, lexState, syntacticClassifierAbsent) { - return convertClassifications(getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent), text); - } - // If there is a syntactic classifier ('syntacticClassifierAbsent' is false), - // we will be more conservative in order to avoid conflicting with the syntactic classifier. - function getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent) { - var offset = 0; - var token = 0 /* Unknown */; - var lastNonTriviaToken = 0 /* Unknown */; - // Empty out the template stack for reuse. - while (templateStack.length > 0) { - templateStack.pop(); - } - // If we're in a string literal, then prepend: "\ - // (and a newline). That way when we lex we'll think we're still in a string literal. - // - // If we're in a multiline comment, then prepend: /* - // (and a newline). That way when we lex we'll think we're still in a multiline comment. - switch (lexState) { - case 3 /* InDoubleQuoteStringLiteral */: - text = "\"\\\n" + text; - offset = 3; - break; - case 2 /* InSingleQuoteStringLiteral */: - text = "'\\\n" + text; - offset = 3; - break; - case 1 /* InMultiLineCommentTrivia */: - text = "/*\n" + text; - offset = 3; - break; - case 4 /* InTemplateHeadOrNoSubstitutionTemplate */: - text = "`\n" + text; - offset = 2; - break; - case 5 /* InTemplateMiddleOrTail */: - text = "}\n" + text; - offset = 2; - // fallthrough - case 6 /* InTemplateSubstitutionPosition */: - templateStack.push(12 /* TemplateHead */); - break; - } - scanner.setText(text); - var result = { - endOfLineState: 0 /* None */, - spans: [] - }; - // We can run into an unfortunate interaction between the lexical and syntactic classifier - // when the user is typing something generic. Consider the case where the user types: - // - // Foo tokens. It's a weak heuristic, but should - // work well enough in practice. - var angleBracketStack = 0; - do { - token = scanner.scan(); - if (!ts.isTrivia(token)) { - if ((token === 39 /* SlashToken */ || token === 61 /* SlashEqualsToken */) && !noRegexTable[lastNonTriviaToken]) { - if (scanner.reScanSlashToken() === 10 /* RegularExpressionLiteral */) { - token = 10 /* RegularExpressionLiteral */; - } - } - else if (lastNonTriviaToken === 21 /* DotToken */ && isKeyword(token)) { - token = 69 /* Identifier */; - } - else if (isKeyword(lastNonTriviaToken) && isKeyword(token) && !canFollow(lastNonTriviaToken, token)) { - // We have two keywords in a row. Only treat the second as a keyword if - // it's a sequence that could legally occur in the language. Otherwise - // treat it as an identifier. This way, if someone writes "private var" - // we recognize that 'var' is actually an identifier here. - token = 69 /* Identifier */; - } - else if (lastNonTriviaToken === 69 /* Identifier */ && - token === 25 /* LessThanToken */) { - // Could be the start of something generic. Keep track of that by bumping - // up the current count of generic contexts we may be in. - angleBracketStack++; - } - else if (token === 27 /* GreaterThanToken */ && angleBracketStack > 0) { - // If we think we're currently in something generic, then mark that that - // generic entity is complete. - angleBracketStack--; - } - else if (token === 117 /* AnyKeyword */ || - token === 132 /* StringKeyword */ || - token === 130 /* NumberKeyword */ || - token === 120 /* BooleanKeyword */ || - token === 133 /* SymbolKeyword */) { - if (angleBracketStack > 0 && !syntacticClassifierAbsent) { - // If it looks like we're could be in something generic, don't classify this - // as a keyword. We may just get overwritten by the syntactic classifier, - // causing a noisy experience for the user. - token = 69 /* Identifier */; - } - } - else if (token === 12 /* TemplateHead */) { - templateStack.push(token); - } - else if (token === 15 /* OpenBraceToken */) { - // If we don't have anything on the template stack, - // then we aren't trying to keep track of a previously scanned template head. - if (templateStack.length > 0) { - templateStack.push(token); - } - } - else if (token === 16 /* CloseBraceToken */) { - // If we don't have anything on the template stack, - // then we aren't trying to keep track of a previously scanned template head. - if (templateStack.length > 0) { - var lastTemplateStackToken = ts.lastOrUndefined(templateStack); - if (lastTemplateStackToken === 12 /* TemplateHead */) { - token = scanner.reScanTemplateToken(); - // Only pop on a TemplateTail; a TemplateMiddle indicates there is more for us. - if (token === 14 /* TemplateTail */) { - templateStack.pop(); - } - else { - ts.Debug.assert(token === 13 /* TemplateMiddle */, "Should have been a template middle. Was " + token); - } - } - else { - ts.Debug.assert(lastTemplateStackToken === 15 /* OpenBraceToken */, "Should have been an open brace. Was: " + token); - templateStack.pop(); - } - } - } - lastNonTriviaToken = token; - } - processToken(); - } while (token !== 1 /* EndOfFileToken */); - return result; - function processToken() { - var start = scanner.getTokenPos(); - var end = scanner.getTextPos(); - addResult(start, end, classFromKind(token)); - if (end >= text.length) { - if (token === 9 /* StringLiteral */) { - // Check to see if we finished up on a multiline string literal. - var tokenText = scanner.getTokenText(); - if (scanner.isUnterminated()) { - var lastCharIndex = tokenText.length - 1; - var numBackslashes = 0; - while (tokenText.charCodeAt(lastCharIndex - numBackslashes) === 92 /* backslash */) { - numBackslashes++; - } - // If we have an odd number of backslashes, then the multiline string is unclosed - if (numBackslashes & 1) { - var quoteChar = tokenText.charCodeAt(0); - result.endOfLineState = quoteChar === 34 /* doubleQuote */ - ? 3 /* InDoubleQuoteStringLiteral */ - : 2 /* InSingleQuoteStringLiteral */; - } - } - } - else if (token === 3 /* MultiLineCommentTrivia */) { - // Check to see if the multiline comment was unclosed. - if (scanner.isUnterminated()) { - result.endOfLineState = 1 /* InMultiLineCommentTrivia */; - } - } - else if (ts.isTemplateLiteralKind(token)) { - if (scanner.isUnterminated()) { - if (token === 14 /* TemplateTail */) { - result.endOfLineState = 5 /* InTemplateMiddleOrTail */; - } - else if (token === 11 /* NoSubstitutionTemplateLiteral */) { - result.endOfLineState = 4 /* InTemplateHeadOrNoSubstitutionTemplate */; - } - else { - ts.Debug.fail("Only 'NoSubstitutionTemplateLiteral's and 'TemplateTail's can be unterminated; got SyntaxKind #" + token); - } - } - } - else if (templateStack.length > 0 && ts.lastOrUndefined(templateStack) === 12 /* TemplateHead */) { - result.endOfLineState = 6 /* InTemplateSubstitutionPosition */; - } - } - } - function addResult(start, end, classification) { - if (classification === 8 /* whiteSpace */) { - // Don't bother with whitespace classifications. They're not needed. - return; - } - if (start === 0 && offset > 0) { - // We're classifying the first token, and this was a case where we prepended - // text. We should consider the start of this token to be at the start of - // the original text. - start += offset; - } - // All our tokens are in relation to the augmented text. Move them back to be - // relative to the original text. - start -= offset; - end -= offset; - var length = end - start; - if (length > 0) { - result.spans.push(start); - result.spans.push(length); - result.spans.push(classification); - } - } - } - function isBinaryExpressionOperatorToken(token) { - switch (token) { - case 37 /* AsteriskToken */: - case 39 /* SlashToken */: - case 40 /* PercentToken */: - case 35 /* PlusToken */: - case 36 /* MinusToken */: - case 43 /* LessThanLessThanToken */: - case 44 /* GreaterThanGreaterThanToken */: - case 45 /* GreaterThanGreaterThanGreaterThanToken */: - case 25 /* LessThanToken */: - case 27 /* GreaterThanToken */: - case 28 /* LessThanEqualsToken */: - case 29 /* GreaterThanEqualsToken */: - case 91 /* InstanceOfKeyword */: - case 90 /* InKeyword */: - case 116 /* AsKeyword */: - case 30 /* EqualsEqualsToken */: - case 31 /* ExclamationEqualsToken */: - case 32 /* EqualsEqualsEqualsToken */: - case 33 /* ExclamationEqualsEqualsToken */: - case 46 /* AmpersandToken */: - case 48 /* CaretToken */: - case 47 /* BarToken */: - case 51 /* AmpersandAmpersandToken */: - case 52 /* BarBarToken */: - case 67 /* BarEqualsToken */: - case 66 /* AmpersandEqualsToken */: - case 68 /* CaretEqualsToken */: - case 63 /* LessThanLessThanEqualsToken */: - case 64 /* GreaterThanGreaterThanEqualsToken */: - case 65 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 57 /* PlusEqualsToken */: - case 58 /* MinusEqualsToken */: - case 59 /* AsteriskEqualsToken */: - case 61 /* SlashEqualsToken */: - case 62 /* PercentEqualsToken */: - case 56 /* EqualsToken */: - case 24 /* CommaToken */: - return true; - default: - return false; - } - } - function isPrefixUnaryExpressionOperatorToken(token) { - switch (token) { - case 35 /* PlusToken */: - case 36 /* MinusToken */: - case 50 /* TildeToken */: - case 49 /* ExclamationToken */: - case 41 /* PlusPlusToken */: - case 42 /* MinusMinusToken */: - return true; - default: - return false; - } - } - function isKeyword(token) { - return token >= 70 /* FirstKeyword */ && token <= 138 /* LastKeyword */; - } - function classFromKind(token) { - if (isKeyword(token)) { - return 3 /* keyword */; - } - else if (isBinaryExpressionOperatorToken(token) || isPrefixUnaryExpressionOperatorToken(token)) { - return 5 /* operator */; - } - else if (token >= 15 /* FirstPunctuation */ && token <= 68 /* LastPunctuation */) { - return 10 /* punctuation */; - } - switch (token) { - case 8 /* NumericLiteral */: - return 4 /* numericLiteral */; - case 9 /* StringLiteral */: - return 6 /* stringLiteral */; - case 10 /* RegularExpressionLiteral */: - return 7 /* regularExpressionLiteral */; - case 7 /* ConflictMarkerTrivia */: - case 3 /* MultiLineCommentTrivia */: - case 2 /* SingleLineCommentTrivia */: - return 1 /* comment */; - case 5 /* WhitespaceTrivia */: - case 4 /* NewLineTrivia */: - return 8 /* whiteSpace */; - case 69 /* Identifier */: - default: - if (ts.isTemplateLiteralKind(token)) { - return 6 /* stringLiteral */; - } - return 2 /* identifier */; - } - } - return { - getClassificationsForLine: getClassificationsForLine, - getEncodedLexicalClassifications: getEncodedLexicalClassifications - }; - } - ts.createClassifier = createClassifier; /** * Get the path of the default library files (lib.d.ts) as distributed with the typescript * node package. @@ -60249,15 +80122,7 @@ var ts; } ts.getDefaultLibFilePath = getDefaultLibFilePath; function initializeServices() { - ts.objectAllocator = { - getNodeConstructor: function () { return NodeObject; }, - getTokenConstructor: function () { return TokenObject; }, - getIdentifierConstructor: function () { return IdentifierObject; }, - getSourceFileConstructor: function () { return SourceFileObject; }, - getSymbolConstructor: function () { return SymbolObject; }, - getTypeConstructor: function () { return TypeObject; }, - getSignatureConstructor: function () { return SignatureObject; } - }; + ts.objectAllocator = getServicesObjectAllocator(); } initializeServices(); })(ts || (ts = {})); @@ -60324,143 +80189,143 @@ var ts; function spanInNode(node) { if (node) { switch (node.kind) { - case 200 /* VariableStatement */: + case 205 /* VariableStatement */: // Span on first variable declaration return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 218 /* VariableDeclaration */: - case 145 /* PropertyDeclaration */: - case 144 /* PropertySignature */: + case 223 /* VariableDeclaration */: + case 147 /* PropertyDeclaration */: + case 146 /* PropertySignature */: return spanInVariableDeclaration(node); - case 142 /* Parameter */: + case 144 /* Parameter */: return spanInParameterDeclaration(node); - case 220 /* FunctionDeclaration */: - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - case 148 /* Constructor */: - case 179 /* FunctionExpression */: - case 180 /* ArrowFunction */: + case 225 /* FunctionDeclaration */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + case 150 /* Constructor */: + case 184 /* FunctionExpression */: + case 185 /* ArrowFunction */: return spanInFunctionDeclaration(node); - case 199 /* Block */: + case 204 /* Block */: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } // Fall through - case 226 /* ModuleBlock */: + case 231 /* ModuleBlock */: return spanInBlock(node); - case 252 /* CatchClause */: + case 256 /* CatchClause */: return spanInBlock(node.block); - case 202 /* ExpressionStatement */: + case 207 /* ExpressionStatement */: // span on the expression return textSpan(node.expression); - case 211 /* ReturnStatement */: + case 216 /* ReturnStatement */: // span on return keyword and expression if present return textSpan(node.getChildAt(0), node.expression); - case 205 /* WhileStatement */: + case 210 /* WhileStatement */: // Span on while(...) return textSpanEndingAtNextToken(node, node.expression); - case 204 /* DoStatement */: + case 209 /* DoStatement */: // span in statement of the do statement return spanInNode(node.statement); - case 217 /* DebuggerStatement */: + case 222 /* DebuggerStatement */: // span on debugger keyword return textSpan(node.getChildAt(0)); - case 203 /* IfStatement */: + case 208 /* IfStatement */: // set on if(..) span return textSpanEndingAtNextToken(node, node.expression); - case 214 /* LabeledStatement */: + case 219 /* LabeledStatement */: // span in statement return spanInNode(node.statement); - case 210 /* BreakStatement */: - case 209 /* ContinueStatement */: + case 215 /* BreakStatement */: + case 214 /* ContinueStatement */: // On break or continue keyword and label if present return textSpan(node.getChildAt(0), node.label); - case 206 /* ForStatement */: + case 211 /* ForStatement */: return spanInForStatement(node); - case 207 /* ForInStatement */: + case 212 /* ForInStatement */: // span of for (a in ...) return textSpanEndingAtNextToken(node, node.expression); - case 208 /* ForOfStatement */: + case 213 /* ForOfStatement */: // span in initializer return spanInInitializerOfForLike(node); - case 213 /* SwitchStatement */: + case 218 /* SwitchStatement */: // span on switch(...) return textSpanEndingAtNextToken(node, node.expression); - case 249 /* CaseClause */: - case 250 /* DefaultClause */: + case 253 /* CaseClause */: + case 254 /* DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); - case 216 /* TryStatement */: + case 221 /* TryStatement */: // span in try block return spanInBlock(node.tryBlock); - case 215 /* ThrowStatement */: + case 220 /* ThrowStatement */: // span in throw ... return textSpan(node, node.expression); - case 235 /* ExportAssignment */: + case 240 /* ExportAssignment */: // span on export = id return textSpan(node, node.expression); - case 229 /* ImportEqualsDeclaration */: + case 234 /* ImportEqualsDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleReference); - case 230 /* ImportDeclaration */: + case 235 /* ImportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 236 /* ExportDeclaration */: + case 241 /* ExportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 225 /* ModuleDeclaration */: + case 230 /* ModuleDeclaration */: // span on complete module if it is instantiated if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return undefined; } - case 221 /* ClassDeclaration */: - case 224 /* EnumDeclaration */: - case 255 /* EnumMember */: - case 169 /* BindingElement */: + case 226 /* ClassDeclaration */: + case 229 /* EnumDeclaration */: + case 260 /* EnumMember */: + case 174 /* BindingElement */: // span on complete node return textSpan(node); - case 212 /* WithStatement */: + case 217 /* WithStatement */: // span in statement return spanInNode(node.statement); - case 143 /* Decorator */: + case 145 /* Decorator */: return spanInNodeArray(node.parent.decorators); - case 167 /* ObjectBindingPattern */: - case 168 /* ArrayBindingPattern */: + case 172 /* ObjectBindingPattern */: + case 173 /* ArrayBindingPattern */: return spanInBindingPattern(node); // No breakpoint in interface, type alias - case 222 /* InterfaceDeclaration */: - case 223 /* TypeAliasDeclaration */: + case 227 /* InterfaceDeclaration */: + case 228 /* TypeAliasDeclaration */: return undefined; // Tokens: - case 23 /* SemicolonToken */: + case 24 /* SemicolonToken */: case 1 /* EndOfFileToken */: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile)); - case 24 /* CommaToken */: + case 25 /* CommaToken */: return spanInPreviousNode(node); - case 15 /* OpenBraceToken */: + case 16 /* OpenBraceToken */: return spanInOpenBraceToken(node); - case 16 /* CloseBraceToken */: + case 17 /* CloseBraceToken */: return spanInCloseBraceToken(node); - case 20 /* CloseBracketToken */: + case 21 /* CloseBracketToken */: return spanInCloseBracketToken(node); - case 17 /* OpenParenToken */: + case 18 /* OpenParenToken */: return spanInOpenParenToken(node); - case 18 /* CloseParenToken */: + case 19 /* CloseParenToken */: return spanInCloseParenToken(node); - case 54 /* ColonToken */: + case 55 /* ColonToken */: return spanInColonToken(node); - case 27 /* GreaterThanToken */: - case 25 /* LessThanToken */: + case 28 /* GreaterThanToken */: + case 26 /* LessThanToken */: return spanInGreaterThanOrLessThanToken(node); // Keywords: - case 104 /* WhileKeyword */: + case 105 /* WhileKeyword */: return spanInWhileKeyword(node); - case 80 /* ElseKeyword */: - case 72 /* CatchKeyword */: - case 85 /* FinallyKeyword */: + case 81 /* ElseKeyword */: + case 73 /* CatchKeyword */: + case 86 /* FinallyKeyword */: return spanInNextNode(node); - case 138 /* OfKeyword */: + case 140 /* OfKeyword */: return spanInOfKeyword(node); default: // Destructuring pattern in destructuring assignment @@ -60472,14 +80337,14 @@ var ts; // Set breakpoint on identifier element of destructuring pattern // a or ...c or d: x from // [a, b, ...c] or { a, b } or { d: x } from destructuring pattern - if ((node.kind === 69 /* Identifier */ || - node.kind == 191 /* SpreadElementExpression */ || - node.kind === 253 /* PropertyAssignment */ || - node.kind === 254 /* ShorthandPropertyAssignment */) && + if ((node.kind === 70 /* Identifier */ || + node.kind == 196 /* SpreadElement */ || + node.kind === 257 /* PropertyAssignment */ || + node.kind === 258 /* ShorthandPropertyAssignment */) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { return textSpan(node); } - if (node.kind === 187 /* BinaryExpression */) { + if (node.kind === 192 /* BinaryExpression */) { var binaryExpression = node; // Set breakpoint in destructuring pattern if its destructuring assignment // [a, b, c] or {a, b, c} of @@ -60488,7 +80353,7 @@ var ts; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left)) { return spanInArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left); } - if (binaryExpression.operatorToken.kind === 56 /* EqualsToken */ && + if (binaryExpression.operatorToken.kind === 57 /* EqualsToken */ && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.parent)) { // Set breakpoint on assignment expression element of destructuring pattern // a = expression of @@ -60496,28 +80361,28 @@ var ts; // { a = expression, b, c } = someExpression return textSpan(node); } - if (binaryExpression.operatorToken.kind === 24 /* CommaToken */) { + if (binaryExpression.operatorToken.kind === 25 /* CommaToken */) { return spanInNode(binaryExpression.left); } } - if (ts.isExpression(node)) { + if (ts.isPartOfExpression(node)) { switch (node.parent.kind) { - case 204 /* DoStatement */: + case 209 /* DoStatement */: // Set span as if on while keyword return spanInPreviousNode(node); - case 143 /* Decorator */: + case 145 /* Decorator */: // Set breakpoint on the decorator emit return spanInNode(node.parent); - case 206 /* ForStatement */: - case 208 /* ForOfStatement */: + case 211 /* ForStatement */: + case 213 /* ForOfStatement */: return textSpan(node); - case 187 /* BinaryExpression */: - if (node.parent.operatorToken.kind === 24 /* CommaToken */) { + case 192 /* BinaryExpression */: + if (node.parent.operatorToken.kind === 25 /* CommaToken */) { // If this is a comma expression, the breakpoint is possible in this expression return textSpan(node); } break; - case 180 /* ArrowFunction */: + case 185 /* ArrowFunction */: if (node.parent.body === node) { // If this is body of arrow function, it is allowed to have the breakpoint return textSpan(node); @@ -60526,13 +80391,13 @@ var ts; } } // If this is name of property assignment, set breakpoint in the initializer - if (node.parent.kind === 253 /* PropertyAssignment */ && + if (node.parent.kind === 257 /* PropertyAssignment */ && node.parent.name === node && !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); } // Breakpoint in type assertion goes to its operand - if (node.parent.kind === 177 /* TypeAssertionExpression */ && node.parent.type === node) { + if (node.parent.kind === 182 /* TypeAssertionExpression */ && node.parent.type === node) { return spanInNextNode(node.parent.type); } // return type of function go to previous token @@ -60540,8 +80405,8 @@ var ts; return spanInPreviousNode(node); } // initializer of variable/parameter declaration go to previous node - if ((node.parent.kind === 218 /* VariableDeclaration */ || - node.parent.kind === 142 /* Parameter */)) { + if ((node.parent.kind === 223 /* VariableDeclaration */ || + node.parent.kind === 144 /* Parameter */)) { var paramOrVarDecl = node.parent; if (paramOrVarDecl.initializer === node || paramOrVarDecl.type === node || @@ -60549,7 +80414,7 @@ var ts; return spanInPreviousNode(node); } } - if (node.parent.kind === 187 /* BinaryExpression */) { + if (node.parent.kind === 192 /* BinaryExpression */) { var binaryExpression = node.parent; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left) && (binaryExpression.right === node || @@ -60575,7 +80440,7 @@ var ts; } function spanInVariableDeclaration(variableDeclaration) { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === 207 /* ForInStatement */) { + if (variableDeclaration.parent.parent.kind === 212 /* ForInStatement */) { return spanInNode(variableDeclaration.parent.parent); } // If this is a destructuring pattern, set breakpoint in binding pattern @@ -60585,8 +80450,8 @@ var ts; // Breakpoint is possible in variableDeclaration only if there is initialization // or its declaration from 'for of' if (variableDeclaration.initializer || - (variableDeclaration.flags & 1 /* Export */) || - variableDeclaration.parent.parent.kind === 208 /* ForOfStatement */) { + ts.hasModifier(variableDeclaration, 1 /* Export */) || + variableDeclaration.parent.parent.kind === 213 /* ForOfStatement */) { return textSpanFromVariableDeclaration(variableDeclaration); } var declarations = variableDeclaration.parent.declarations; @@ -60601,7 +80466,7 @@ var ts; function canHaveSpanInParameterDeclaration(parameter) { // Breakpoint is possible on parameter only if it has initializer, is a rest parameter, or has public or private modifier return !!parameter.initializer || parameter.dotDotDotToken !== undefined || - !!(parameter.flags & 4 /* Public */) || !!(parameter.flags & 8 /* Private */); + ts.hasModifier(parameter, 4 /* Public */ | 8 /* Private */); } function spanInParameterDeclaration(parameter) { if (ts.isBindingPattern(parameter.name)) { @@ -60625,8 +80490,8 @@ var ts; } } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { - return !!(functionDeclaration.flags & 1 /* Export */) || - (functionDeclaration.parent.kind === 221 /* ClassDeclaration */ && functionDeclaration.kind !== 148 /* Constructor */); + return ts.hasModifier(functionDeclaration, 1 /* Export */) || + (functionDeclaration.parent.kind === 226 /* ClassDeclaration */ && functionDeclaration.kind !== 150 /* Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { // No breakpoints in the function signature @@ -60649,25 +80514,25 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 225 /* ModuleDeclaration */: + case 230 /* ModuleDeclaration */: if (ts.getModuleInstanceState(block.parent) !== 1 /* Instantiated */) { return undefined; } // Set on parent if on same line otherwise on first statement - case 205 /* WhileStatement */: - case 203 /* IfStatement */: - case 207 /* ForInStatement */: + case 210 /* WhileStatement */: + case 208 /* IfStatement */: + case 212 /* ForInStatement */: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); // Set span on previous token if it starts on same line otherwise on the first statement of the block - case 206 /* ForStatement */: - case 208 /* ForOfStatement */: + case 211 /* ForStatement */: + case 213 /* ForOfStatement */: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } // Default action is to set on first statement return spanInNode(block.statements[0]); } function spanInInitializerOfForLike(forLikeStatement) { - if (forLikeStatement.initializer.kind === 219 /* VariableDeclarationList */) { + if (forLikeStatement.initializer.kind === 224 /* VariableDeclarationList */) { // Declaration list - set breakpoint in first declaration var variableDeclarationList = forLikeStatement.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -60692,23 +80557,23 @@ var ts; } function spanInBindingPattern(bindingPattern) { // Set breakpoint in first binding element - var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 193 /* OmittedExpression */ ? element : undefined; }); + var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 198 /* OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } // Empty binding pattern of binding element, set breakpoint on binding element - if (bindingPattern.parent.kind === 169 /* BindingElement */) { + if (bindingPattern.parent.kind === 174 /* BindingElement */) { return textSpan(bindingPattern.parent); } // Variable declaration is used as the span return textSpanFromVariableDeclaration(bindingPattern.parent); } function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) { - ts.Debug.assert(node.kind !== 168 /* ArrayBindingPattern */ && node.kind !== 167 /* ObjectBindingPattern */); - var elements = node.kind === 170 /* ArrayLiteralExpression */ ? + ts.Debug.assert(node.kind !== 173 /* ArrayBindingPattern */ && node.kind !== 172 /* ObjectBindingPattern */); + var elements = node.kind === 175 /* ArrayLiteralExpression */ ? node.elements : node.properties; - var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 193 /* OmittedExpression */ ? element : undefined; }); + var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 198 /* OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } @@ -60716,18 +80581,18 @@ var ts; // just nested element in another destructuring assignment // set breakpoint on assignment when parent is destructuring assignment // Otherwise set breakpoint for this element - return textSpan(node.parent.kind === 187 /* BinaryExpression */ ? node.parent : node); + return textSpan(node.parent.kind === 192 /* BinaryExpression */ ? node.parent : node); } // Tokens: function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 224 /* EnumDeclaration */: + case 229 /* EnumDeclaration */: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 221 /* ClassDeclaration */: + case 226 /* ClassDeclaration */: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 227 /* CaseBlock */: + case 232 /* CaseBlock */: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } // Default to parent node @@ -60735,24 +80600,24 @@ var ts; } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 226 /* ModuleBlock */: + case 231 /* ModuleBlock */: // If this is not an instantiated module block, no bp span if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* Instantiated */) { return undefined; } - case 224 /* EnumDeclaration */: - case 221 /* ClassDeclaration */: + case 229 /* EnumDeclaration */: + case 226 /* ClassDeclaration */: // Span on close brace token return textSpan(node); - case 199 /* Block */: + case 204 /* Block */: if (ts.isFunctionBlock(node.parent)) { // Span on close brace token return textSpan(node); } // fall through - case 252 /* CatchClause */: + case 256 /* CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 227 /* CaseBlock */: + case 232 /* CaseBlock */: // breakpoint in last statement of the last clause var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); @@ -60760,7 +80625,7 @@ var ts; return spanInNode(ts.lastOrUndefined(lastClause.statements)); } return undefined; - case 167 /* ObjectBindingPattern */: + case 172 /* ObjectBindingPattern */: // Breakpoint in last binding element or binding pattern if it contains no elements var bindingPattern = node.parent; return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); @@ -60776,7 +80641,7 @@ var ts; } function spanInCloseBracketToken(node) { switch (node.parent.kind) { - case 168 /* ArrayBindingPattern */: + case 173 /* ArrayBindingPattern */: // Breakpoint in last binding element or binding pattern if it contains no elements var bindingPattern = node.parent; return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); @@ -60791,12 +80656,12 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 204 /* DoStatement */ || - node.parent.kind === 174 /* CallExpression */ || - node.parent.kind === 175 /* NewExpression */) { + if (node.parent.kind === 209 /* DoStatement */ || + node.parent.kind === 179 /* CallExpression */ || + node.parent.kind === 180 /* NewExpression */) { return spanInPreviousNode(node); } - if (node.parent.kind === 178 /* ParenthesizedExpression */) { + if (node.parent.kind === 183 /* ParenthesizedExpression */) { return spanInNextNode(node); } // Default to parent node @@ -60805,21 +80670,21 @@ var ts; function spanInCloseParenToken(node) { // Is this close paren token of parameter list, set span in previous token switch (node.parent.kind) { - case 179 /* FunctionExpression */: - case 220 /* FunctionDeclaration */: - case 180 /* ArrowFunction */: - case 147 /* MethodDeclaration */: - case 146 /* MethodSignature */: - case 149 /* GetAccessor */: - case 150 /* SetAccessor */: - case 148 /* Constructor */: - case 205 /* WhileStatement */: - case 204 /* DoStatement */: - case 206 /* ForStatement */: - case 208 /* ForOfStatement */: - case 174 /* CallExpression */: - case 175 /* NewExpression */: - case 178 /* ParenthesizedExpression */: + case 184 /* FunctionExpression */: + case 225 /* FunctionDeclaration */: + case 185 /* ArrowFunction */: + case 149 /* MethodDeclaration */: + case 148 /* MethodSignature */: + case 151 /* GetAccessor */: + case 152 /* SetAccessor */: + case 150 /* Constructor */: + case 210 /* WhileStatement */: + case 209 /* DoStatement */: + case 211 /* ForStatement */: + case 213 /* ForOfStatement */: + case 179 /* CallExpression */: + case 180 /* NewExpression */: + case 183 /* ParenthesizedExpression */: return spanInPreviousNode(node); // Default to parent node default: @@ -60829,20 +80694,20 @@ var ts; function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration if (ts.isFunctionLike(node.parent) || - node.parent.kind === 253 /* PropertyAssignment */ || - node.parent.kind === 142 /* Parameter */) { + node.parent.kind === 257 /* PropertyAssignment */ || + node.parent.kind === 144 /* Parameter */) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 177 /* TypeAssertionExpression */) { + if (node.parent.kind === 182 /* TypeAssertionExpression */) { return spanInNextNode(node); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 204 /* DoStatement */) { + if (node.parent.kind === 209 /* DoStatement */) { // Set span on while expression return textSpanEndingAtNextToken(node, node.parent.expression); } @@ -60850,7 +80715,7 @@ var ts; return spanInNode(node.parent); } function spanInOfKeyword(node) { - if (node.parent.kind === 208 /* ForOfStatement */) { + if (node.parent.kind === 213 /* ForOfStatement */) { // Set using next token return spanInNextNode(node); } @@ -60878,7 +80743,7 @@ var ts; // /// /* @internal */ -var debugObjectHost = new Function("return this")(); +var debugObjectHost = (function () { return this; })(); // We need to use 'null' to interface with the managed side. /* tslint:disable:no-null-keyword */ /* tslint:disable:no-in-operator */ @@ -60932,7 +80797,7 @@ var ts; var resolutionsInFile = JSON.parse(_this.shimHost.getModuleResolutionsForFile(containingFile)); return ts.map(moduleNames, function (name) { var result = ts.getProperty(resolutionsInFile, name); - return result ? { resolvedFileName: result } : undefined; + return result ? { resolvedFileName: result, extension: ts.extensionFromPath(result), isExternalLibraryImport: false } : undefined; }); }; } @@ -60966,6 +80831,12 @@ var ts; } return this.shimHost.getProjectVersion(); }; + LanguageServiceShimHostAdapter.prototype.getTypeRootsVersion = function () { + if (!this.shimHost.getTypeRootsVersion) { + return 0; + } + return this.shimHost.getTypeRootsVersion(); + }; LanguageServiceShimHostAdapter.prototype.useCaseSensitiveFileNames = function () { return this.shimHost.useCaseSensitiveFileNames ? this.shimHost.useCaseSensitiveFileNames() : false; }; @@ -61022,6 +80893,16 @@ var ts; LanguageServiceShimHostAdapter.prototype.getDefaultLibFileName = function (options) { return this.shimHost.getDefaultLibFileName(JSON.stringify(options)); }; + LanguageServiceShimHostAdapter.prototype.readDirectory = function (path, extensions, exclude, include, depth) { + var pattern = ts.getFileMatcherPatterns(path, exclude, include, this.shimHost.useCaseSensitiveFileNames(), this.shimHost.getCurrentDirectory()); + return JSON.parse(this.shimHost.readDirectory(path, JSON.stringify(extensions), JSON.stringify(pattern.basePaths), pattern.excludePattern, pattern.includeFilePattern, pattern.includeDirectoryPattern, depth)); + }; + LanguageServiceShimHostAdapter.prototype.readFile = function (path, encoding) { + return this.shimHost.readFile(path, encoding); + }; + LanguageServiceShimHostAdapter.prototype.fileExists = function (path) { + return this.shimHost.fileExists(path); + }; return LanguageServiceShimHostAdapter; }()); ts.LanguageServiceShimHostAdapter = LanguageServiceShimHostAdapter; @@ -61062,7 +80943,7 @@ var ts; // Wrap the API changes for 2.0 release. This try/catch // should be removed once TypeScript 2.0 has shipped. try { - var pattern = ts.getFileMatcherPatterns(rootDir, extensions, exclude, include, this.shimHost.useCaseSensitiveFileNames(), this.shimHost.getCurrentDirectory()); + var pattern = ts.getFileMatcherPatterns(rootDir, exclude, include, this.shimHost.useCaseSensitiveFileNames(), this.shimHost.getCurrentDirectory()); return JSON.parse(this.shimHost.readDirectory(rootDir, JSON.stringify(extensions), JSON.stringify(pattern.basePaths), pattern.excludePattern, pattern.includeFilePattern, pattern.includeDirectoryPattern, depth)); } catch (e) { @@ -61136,7 +81017,7 @@ var ts; this.factory = factory; factory.registerShim(this); } - ShimBase.prototype.dispose = function (dummy) { + ShimBase.prototype.dispose = function (_dummy) { this.factory.unregisterShim(this); }; return ShimBase; @@ -61158,11 +81039,12 @@ var ts; var LanguageServiceShimObject = (function (_super) { __extends(LanguageServiceShimObject, _super); function LanguageServiceShimObject(factory, host, languageService) { - _super.call(this, factory); - this.host = host; - this.languageService = languageService; - this.logPerformance = false; - this.logger = this.host; + var _this = _super.call(this, factory) || this; + _this.host = host; + _this.languageService = languageService; + _this.logPerformance = false; + _this.logger = _this.host; + return _this; } LanguageServiceShimObject.prototype.forwardJSONCall = function (actionDescription, action) { return forwardJSONCall(this.logger, actionDescription, action, this.logPerformance); @@ -61212,14 +81094,14 @@ var ts; }; LanguageServiceShimObject.prototype.getEncodedSyntacticClassifications = function (fileName, start, length) { var _this = this; - return this.forwardJSONCall("getEncodedSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", + return this.forwardJSONCall("getEncodedSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", // directly serialize the spans out to a string. This is much faster to decode // on the managed side versus a full JSON array. function () { return convertClassifications(_this.languageService.getEncodedSyntacticClassifications(fileName, ts.createTextSpan(start, length))); }); }; LanguageServiceShimObject.prototype.getEncodedSemanticClassifications = function (fileName, start, length) { var _this = this; - return this.forwardJSONCall("getEncodedSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", + return this.forwardJSONCall("getEncodedSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", // directly serialize the spans out to a string. This is much faster to decode // on the managed side versus a full JSON array. function () { return convertClassifications(_this.languageService.getEncodedSemanticClassifications(fileName, ts.createTextSpan(start, length))); }); @@ -61294,6 +81176,15 @@ var ts; var _this = this; return this.forwardJSONCall("getTypeDefinitionAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getTypeDefinitionAtPosition(fileName, position); }); }; + /// GOTO Implementation + /** + * Computes the implementation location of the symbol + * at the requested position. + */ + LanguageServiceShimObject.prototype.getImplementationAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getImplementationAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getImplementationAtPosition(fileName, position); }); + }; LanguageServiceShimObject.prototype.getRenameInfo = function (fileName, position) { var _this = this; return this.forwardJSONCall("getRenameInfo('" + fileName + "', " + position + ")", function () { return _this.languageService.getRenameInfo(fileName, position); }); @@ -61383,14 +81274,18 @@ var ts; }; /// NAVIGATE TO /** Return a list of symbols that are interesting to navigate to */ - LanguageServiceShimObject.prototype.getNavigateToItems = function (searchValue, maxResultCount) { + LanguageServiceShimObject.prototype.getNavigateToItems = function (searchValue, maxResultCount, fileName) { var _this = this; - return this.forwardJSONCall("getNavigateToItems('" + searchValue + "', " + maxResultCount + ")", function () { return _this.languageService.getNavigateToItems(searchValue, maxResultCount); }); + return this.forwardJSONCall("getNavigateToItems('" + searchValue + "', " + maxResultCount + ", " + fileName + ")", function () { return _this.languageService.getNavigateToItems(searchValue, maxResultCount, fileName); }); }; LanguageServiceShimObject.prototype.getNavigationBarItems = function (fileName) { var _this = this; return this.forwardJSONCall("getNavigationBarItems('" + fileName + "')", function () { return _this.languageService.getNavigationBarItems(fileName); }); }; + LanguageServiceShimObject.prototype.getNavigationTree = function (fileName) { + var _this = this; + return this.forwardJSONCall("getNavigationTree('" + fileName + "')", function () { return _this.languageService.getNavigationTree(fileName); }); + }; LanguageServiceShimObject.prototype.getOutliningSpans = function (fileName) { var _this = this; return this.forwardJSONCall("getOutliningSpans('" + fileName + "')", function () { return _this.languageService.getOutliningSpans(fileName); }); @@ -61406,7 +81301,7 @@ var ts; }; LanguageServiceShimObject.prototype.getEmitOutputObject = function (fileName) { var _this = this; - return forwardCall(this.logger, "getEmitOutput('" + fileName + "')", + return forwardCall(this.logger, "getEmitOutput('" + fileName + "')", /*returnJson*/ false, function () { return _this.languageService.getEmitOutput(fileName); }, this.logPerformance); }; return LanguageServiceShimObject; @@ -61417,10 +81312,11 @@ var ts; var ClassifierShimObject = (function (_super) { __extends(ClassifierShimObject, _super); function ClassifierShimObject(factory, logger) { - _super.call(this, factory); - this.logger = logger; - this.logPerformance = false; - this.classifier = ts.createClassifier(); + var _this = _super.call(this, factory) || this; + _this.logger = logger; + _this.logPerformance = false; + _this.classifier = ts.createClassifier(); + return _this; } ClassifierShimObject.prototype.getEncodedLexicalClassifications = function (text, lexState, syntacticClassifierAbsent) { var _this = this; @@ -61443,10 +81339,11 @@ var ts; var CoreServicesShimObject = (function (_super) { __extends(CoreServicesShimObject, _super); function CoreServicesShimObject(factory, logger, host) { - _super.call(this, factory); - this.logger = logger; - this.host = host; - this.logPerformance = false; + var _this = _super.call(this, factory) || this; + _this.logger = logger; + _this.host = host; + _this.logPerformance = false; + return _this; } CoreServicesShimObject.prototype.forwardJSONCall = function (actionDescription, action) { return forwardJSONCall(this.logger, actionDescription, action, this.logPerformance); @@ -61456,8 +81353,15 @@ var ts; return this.forwardJSONCall("resolveModuleName('" + fileName + "')", function () { var compilerOptions = JSON.parse(compilerOptionsJson); var result = ts.resolveModuleName(moduleName, ts.normalizeSlashes(fileName), compilerOptions, _this.host); + var resolvedFileName = result.resolvedModule ? result.resolvedModule.resolvedFileName : undefined; + if (resolvedFileName && !compilerOptions.allowJs && ts.fileExtensionIs(resolvedFileName, ".js")) { + return { + resolvedFileName: undefined, + failedLookupLocations: [] + }; + } return { - resolvedFileName: result.resolvedModule ? result.resolvedModule.resolvedFileName : undefined, + resolvedFileName: resolvedFileName, failedLookupLocations: result.failedLookupLocations }; }); @@ -61518,7 +81422,7 @@ var ts; if (result.error) { return { options: {}, - typingOptions: {}, + typeAcquisition: {}, files: [], raw: {}, errors: [realizeDiagnostic(result.error, "\r\n")] @@ -61528,7 +81432,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") @@ -61543,7 +81447,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.compilerOptions); + 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; @@ -61626,12 +81530,10 @@ var TypeScript; Services.TypeScriptServicesFactory = ts.TypeScriptServicesFactory; })(Services = TypeScript.Services || (TypeScript.Services = {})); })(TypeScript || (TypeScript = {})); -/* tslint:disable:no-unused-variable */ // 'toolsVersion' gets consumed by the managed side, so it's not unused. // TODO: it should be moved into a namespace though. /* @internal */ -var toolsVersion = "2.0"; -/* tslint:enable:no-unused-variable */ +var toolsVersion = "2.1"; // MONACOCHANGE define([], function() { return ts; }); diff --git a/src/monaco.contribution.ts b/src/monaco.contribution.ts index 6ebe9c64..ed33cee3 100644 --- a/src/monaco.contribution.ts +++ b/src/monaco.contribution.ts @@ -10,7 +10,7 @@ import Emitter = monaco.Emitter; import IEvent = monaco.IEvent; import IDisposable = monaco.IDisposable; -declare var require:(moduleId:[string], callback:(module:T)=>void)=>void; +declare var require: (moduleId: [string], callback: (module: T) => void) => void; // --- TypeScript configuration and defaults --------- @@ -29,7 +29,7 @@ export class LanguageServiceDefaultsImpl implements monaco.languages.typescript. this.setDiagnosticsOptions(diagnosticsOptions); } - get onDidChange(): IEvent{ + get onDidChange(): IEvent { return this._onDidChange.event; } @@ -99,34 +99,45 @@ enum ModuleKind { AMD = 2, UMD = 3, System = 4, - ES6 = 5, ES2015 = 5, } - enum JsxEmit { None = 0, Preserve = 1, React = 2, } - enum NewLineKind { CarriageReturnLineFeed = 0, LineFeed = 1, } - +interface LineAndCharacter { + line: number; + character: number; +} +enum ScriptKind { + Unknown = 0, + JS = 1, + JSX = 2, + TS = 3, + TSX = 4, +} enum ScriptTarget { ES3 = 0, ES5 = 1, - ES6 = 2, ES2015 = 2, - Latest = 2, + ES2016 = 3, + ES2017 = 4, + ESNext = 5, + Latest = 5, +} +enum LanguageVariant { + Standard = 0, + JSX = 1, } - enum ModuleResolutionKind { Classic = 1, NodeJs = 2, } - // --- END enums copied from typescript to prevent loading the entire typescriptServices --- const typescriptDefaults = new LanguageServiceDefaultsImpl( @@ -139,20 +150,20 @@ const javascriptDefaults = new LanguageServiceDefaultsImpl( function getTypeScriptWorker(): monaco.Promise { return new monaco.Promise((resolve, reject) => { - withMode((mode) => { - mode.getTypeScriptWorker() - .then(resolve, reject); - }); - }); + withMode((mode) => { + mode.getTypeScriptWorker() + .then(resolve, reject); + }); + }); } function getJavaScriptWorker(): monaco.Promise { return new monaco.Promise((resolve, reject) => { - withMode((mode) => { - mode.getJavaScriptWorker() - .then(resolve, reject); - }); - }); + withMode((mode) => { + mode.getJavaScriptWorker() + .then(resolve, reject); + }); + }); } // Export API @@ -173,7 +184,7 @@ monaco.languages.typescript = createAPI(); // --- Registration to monaco editor --- -function withMode(callback:(module:typeof mode)=>void): void { +function withMode(callback: (module: typeof mode) => void): void { require(['vs/language/typescript/src/mode'], callback); } diff --git a/src/monaco.d.ts b/src/monaco.d.ts index 1ad1a1d7..4859df4e 100644 --- a/src/monaco.d.ts +++ b/src/monaco.d.ts @@ -1,33 +1,32 @@ declare module monaco.languages.typescript { - export enum ModuleKind { + enum ModuleKind { None = 0, CommonJS = 1, AMD = 2, UMD = 3, System = 4, - ES6 = 5, ES2015 = 5, } - - export enum JsxEmit { + enum JsxEmit { None = 0, Preserve = 1, React = 2, } - - export enum NewLineKind { + enum NewLineKind { CarriageReturnLineFeed = 0, LineFeed = 1, } - export enum ScriptTarget { + enum ScriptTarget { ES3 = 0, ES5 = 1, - ES6 = 2, ES2015 = 2, - Latest = 2, + ES2016 = 3, + ES2017 = 4, + ESNext = 5, + Latest = 5, } export enum ModuleResolutionKind { @@ -35,58 +34,70 @@ declare module monaco.languages.typescript { NodeJs = 2, } + type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[]; interface CompilerOptions { - allowNonTsExtensions?: boolean; + allowJs?: boolean; + allowSyntheticDefaultImports?: boolean; + allowUnreachableCode?: boolean; + allowUnusedLabels?: boolean; + alwaysStrict?: boolean; + baseUrl?: string; charset?: string; declaration?: boolean; - diagnostics?: boolean; + declarationDir?: string; + disableSizeLimit?: boolean; emitBOM?: boolean; - help?: boolean; - init?: boolean; + emitDecoratorMetadata?: boolean; + experimentalDecorators?: boolean; + forceConsistentCasingInFileNames?: boolean; + importHelpers?: boolean; inlineSourceMap?: boolean; inlineSources?: boolean; + isolatedModules?: boolean; jsx?: JsxEmit; - reactNamespace?: string; - listFiles?: boolean; + lib?: string[]; locale?: string; mapRoot?: string; + maxNodeModuleJsDepth?: number; module?: ModuleKind; + moduleResolution?: ModuleResolutionKind; newLine?: NewLineKind; noEmit?: boolean; noEmitHelpers?: boolean; noEmitOnError?: boolean; noErrorTruncation?: boolean; + noFallthroughCasesInSwitch?: boolean; noImplicitAny?: boolean; + noImplicitReturns?: boolean; + noImplicitThis?: boolean; + noUnusedLocals?: boolean; + noUnusedParameters?: boolean; + noImplicitUseStrict?: boolean; noLib?: boolean; noResolve?: boolean; out?: string; - outFile?: string; outDir?: string; + outFile?: string; preserveConstEnums?: boolean; project?: string; + reactNamespace?: string; + jsxFactory?: string; removeComments?: boolean; rootDir?: string; + rootDirs?: string[]; + skipLibCheck?: boolean; + skipDefaultLibCheck?: boolean; sourceMap?: boolean; sourceRoot?: string; + strictNullChecks?: boolean; suppressExcessPropertyErrors?: boolean; suppressImplicitAnyIndexErrors?: boolean; target?: ScriptTarget; - version?: boolean; - watch?: boolean; - isolatedModules?: boolean; - experimentalDecorators?: boolean; - emitDecoratorMetadata?: boolean; - moduleResolution?: ModuleResolutionKind; - allowUnusedLabels?: boolean; - allowUnreachableCode?: boolean; - noImplicitReturns?: boolean; - noFallthroughCasesInSwitch?: boolean; - forceConsistentCasingInFileNames?: boolean; - allowSyntheticDefaultImports?: boolean; - allowJs?: boolean; - noImplicitUseStrict?: boolean; - disableSizeLimit?: boolean; - [option: string]: string | number | boolean; + traceResolution?: boolean; + types?: string[]; + /** Paths used to compute primary types search locations */ + typeRoots?: string[]; + [option: string]: CompilerOptionsValue | undefined; } export interface DiagnosticsOptions {